You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
590 lines
20 KiB
590 lines
20 KiB
<template>
|
|
<div class="inspection-request-detail">
|
|
<!-- 编辑模式 -->
|
|
<div v-if="isEditMode" class="edit-form">
|
|
<el-form label-position="top" class="detail-form">
|
|
<el-row :gutter="20">
|
|
<el-col :span="6">
|
|
<el-form-item label="申请单号">
|
|
<el-input v-model="detailData.requestNo" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="申请日期">
|
|
<el-input :value="formatDate(detailData.requestDate)" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="供应商编码">
|
|
<el-input v-model="detailData.supplierNo" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="供应商名称">
|
|
<el-input v-model="detailData.supplierName" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :span="10">
|
|
<el-form-item>
|
|
<span slot="label" class="choose-label" @click="openAddressDialog">验货地址</span>
|
|
<el-input v-model="editData.inspectAddress" readonly @click.native="openAddressDialog" placeholder="点击标签选择验货地址" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="城市简称">
|
|
<el-input v-model="editData.inspectCityShort" readonly placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="5">
|
|
<el-form-item label="联系人">
|
|
<el-input v-model="editData.inspectContract" placeholder="请输入联系人" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="5">
|
|
<el-form-item label="联系电话">
|
|
<el-input v-model="editData.inspectPhone" placeholder="选择地址自动带出" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :span="4">
|
|
<el-form-item label="申请录入人">
|
|
<el-input v-model="detailData.createBy" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="申请录入时间">
|
|
<el-input v-model="detailData.createDate" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="5">
|
|
<el-form-item label="建议验货日期">
|
|
<el-date-picker
|
|
v-model="editData.needInspectDate"
|
|
type="date"
|
|
value-format="yyyy-MM-dd"
|
|
placeholder="请选择建议验货日期"
|
|
style="width: 100%"
|
|
/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="QC">
|
|
<el-input v-model="detailData.qcOperator" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="5">
|
|
<el-form-item label="QC联系方式">
|
|
<el-input v-model="detailData.qcContact" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :span="6">
|
|
<el-form-item label="排程人">
|
|
<el-input v-model="detailData.scheduledBy" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="排程时间">
|
|
<el-input v-model="detailData.scheduledDate" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="状态">
|
|
<el-input v-model="detailData.status" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="计划验货日期">
|
|
<el-input v-model="detailData.planStartDate" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :span="24" style="text-align: right;">
|
|
<el-button type="primary" @click="handleSave" :loading="saveLoading">保存</el-button>
|
|
<el-button @click="handleCancelEdit">取消</el-button>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
</div>
|
|
|
|
<!-- 查看模式 -->
|
|
<div v-else>
|
|
<el-form label-position="top" class="detail-form">
|
|
<el-row :gutter="20">
|
|
<el-col :span="6">
|
|
<el-form-item label="申请单号">
|
|
<el-input v-model="detailData.requestNo" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="申请日期">
|
|
<el-input :value="formatDate(detailData.requestDate)" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="供应商编码">
|
|
<el-input v-model="detailData.supplierNo" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="供应商名称">
|
|
<el-input v-model="detailData.supplierName" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :span="10">
|
|
<el-form-item label="验货地址">
|
|
<el-input v-model="detailData.inspectAddress" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="城市简称">
|
|
<el-input v-model="detailData.inspectCityShort" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="5">
|
|
<el-form-item label="联系人">
|
|
<el-input v-model="detailData.inspectContract" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="5">
|
|
<el-form-item label="联系电话">
|
|
<el-input v-model="detailData.inspectPhone" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :span="4">
|
|
<el-form-item label="申请录入人">
|
|
<el-input v-model="detailData.createBy" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="申请录入时间">
|
|
<el-input v-model="detailData.createDate" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="5">
|
|
<el-form-item label="建议验货日期">
|
|
<el-input :value="formatDate(detailData.needInspectDate)" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="QC">
|
|
<el-input v-model="detailData.qcOperator" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="5">
|
|
<el-form-item label="QC联系方式">
|
|
<el-input v-model="detailData.qcContact" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :span="6">
|
|
<el-form-item label="排程人">
|
|
<el-input v-model="detailData.scheduledBy" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="排程时间">
|
|
<el-input v-model="detailData.scheduledDate" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="状态">
|
|
<el-input v-model="detailData.status" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="计划验货日期">
|
|
<el-input v-model="detailData.planStartDate" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<!-- Planner与备注展示:仅调用页开启 showPlannerRemark 时显示(如验货申请列表基本信息页签) - rqrq -->
|
|
<el-row v-if="showPlannerRemark" :gutter="20">
|
|
<el-col :span="6">
|
|
<el-form-item label="Planner">
|
|
<el-input v-model="detailData.planner" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="18">
|
|
<el-form-item label="备注">
|
|
<el-input v-model="detailData.remark" disabled placeholder=" " />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
</el-form>
|
|
</div>
|
|
|
|
<el-dialog
|
|
title="选择验货地址"
|
|
:visible.sync="addressDialogVisible"
|
|
width="980px"
|
|
append-to-body
|
|
:close-on-click-modal="false">
|
|
<el-form :inline="true" label-width="80px" size="mini" label-position="top">
|
|
<el-form-item label="供应商编码">
|
|
<el-input :value="detailData.supplierNo || ''" readonly style="width: 140px" />
|
|
</el-form-item>
|
|
<el-form-item label="供应商名称">
|
|
<el-input :value="detailData.supplierName || ''" readonly style="width: 220px" />
|
|
</el-form-item>
|
|
<!-- <el-form-item label="地址关键词">-->
|
|
<!-- <el-input-->
|
|
<!-- v-model="addressSearch.keyword"-->
|
|
<!-- clearable-->
|
|
<!-- style="width: 260px"-->
|
|
<!-- @keyup.enter.native="searchAddressList" />-->
|
|
<!-- </el-form-item>-->
|
|
<!-- <el-form-item label=" ">-->
|
|
<!-- <el-button type="primary" @click="searchAddressList">查询</el-button>-->
|
|
<!-- <el-button @click="resetAddressSearch">重置</el-button>-->
|
|
<!-- </el-form-item>-->
|
|
</el-form>
|
|
|
|
<el-table
|
|
ref="addressTable"
|
|
:data="addressList"
|
|
border
|
|
height="360px"
|
|
v-loading="addressLoading"
|
|
highlight-current-row
|
|
@current-change="onAddressCurrentChange"
|
|
@row-dblclick="onAddressRowDblClick">
|
|
<el-table-column prop="addressId" label="地址ID" header-align="center" align="left" min-width="120" show-overflow-tooltip />
|
|
<el-table-column prop="companyName" label="公司名称" header-align="center" align="left" min-width="180" show-overflow-tooltip />
|
|
<el-table-column prop="cityShort" label="城市简称" header-align="center" align="left" min-width="120" show-overflow-tooltip />
|
|
<el-table-column prop="address" label="验货地址" header-align="center" align="left" min-width="280" show-overflow-tooltip />
|
|
<el-table-column prop="contact" label="联系人" header-align="center" align="left" min-width="120" show-overflow-tooltip />
|
|
<el-table-column prop="phoneNo" label="联系电话" header-align="center" align="left" min-width="140" show-overflow-tooltip />
|
|
<el-table-column prop="email" label="邮箱" header-align="center" align="left" min-width="180" show-overflow-tooltip />
|
|
</el-table>
|
|
|
|
<el-pagination
|
|
style="margin-top: 10px; text-align: right"
|
|
@size-change="onAddressPageSizeChange"
|
|
@current-change="onAddressPageCurrentChange"
|
|
:current-page="addressPageIndex"
|
|
:page-sizes="[20, 50, 100, 200]"
|
|
:page-size="addressPageSize"
|
|
:total="addressTotal"
|
|
layout="total, sizes, prev, pager, next, jumper">
|
|
</el-pagination>
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="confirmAddressSelect">确认</el-button>
|
|
<el-button @click="addressDialogVisible = false">取消</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { updateInspectionRequest } from '@/api/inspection/inspectionRequestHeader.js'
|
|
import { searchSrmSupplierAddressList } from '@/api/srm/srmSupplier.js'
|
|
|
|
export default {
|
|
name: 'InspectionRequestDetail',
|
|
props: {
|
|
detailData: {
|
|
type: Object,
|
|
default: () => ({})
|
|
},
|
|
// 是否在查看模式展示 Planner 与备注(默认不展示,保持其他引用页不变) - rqrq
|
|
showPlannerRemark: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
isEditMode: false,
|
|
saveLoading: false,
|
|
editData: {},
|
|
originalData: {},
|
|
addressDialogVisible: false,
|
|
addressLoading: false,
|
|
addressList: [],
|
|
addressCurrentRow: null,
|
|
addressPageIndex: 1,
|
|
addressPageSize: 20,
|
|
addressTotal: 0,
|
|
addressSearch: {
|
|
keyword: ''
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
formatDate(dateStr) {
|
|
if (!dateStr) return ''
|
|
return dateStr.length > 10 ? dateStr.substring(0, 10) : dateStr
|
|
},
|
|
|
|
handleEdit() {
|
|
this.editData = {
|
|
requestNo: this.detailData.requestNo,
|
|
needInspectDate: this.detailData.needInspectDate,
|
|
inspectAddressId: this.detailData.inspectAddressId || this.detailData.inspectAddress || '',
|
|
inspectAddress: this.detailData.inspectAddress,
|
|
inspectCityShort: this.detailData.inspectCityShort || '',
|
|
inspectContract: this.detailData.inspectContract,
|
|
inspectPhone: this.detailData.inspectPhone || ''
|
|
}
|
|
|
|
this.originalData = JSON.parse(JSON.stringify(this.editData))
|
|
this.isEditMode = true
|
|
},
|
|
|
|
handleCancelEdit() {
|
|
this.editData = JSON.parse(JSON.stringify(this.originalData))
|
|
this.addressDialogVisible = false
|
|
this.isEditMode = false
|
|
},
|
|
|
|
openAddressDialog () {
|
|
if (!this.detailData.supplierNo) {
|
|
this.$message.warning('当前申请单缺少供应商编码')
|
|
return
|
|
}
|
|
this.addressDialogVisible = true
|
|
this.addressPageIndex = 1
|
|
this.addressSearch.keyword = ''
|
|
this.addressCurrentRow = null
|
|
this.loadAddressList()
|
|
},
|
|
|
|
normalizeAddressRows (list) {
|
|
return (list || []).map(item => ({
|
|
...item,
|
|
supplierId: item.supplierId || item.supplier_id || '',
|
|
addressId: item.addressId || item.address_id || '',
|
|
cityShort: item.cityShort || item.city_short || '',
|
|
companyName: item.companyName || item.company_name || '',
|
|
contact: item.contact || '',
|
|
phoneNo: item.phoneNo || item.phone_no || '',
|
|
email: item.email || '',
|
|
address: item.address || '',
|
|
addressType: item.addressType || item.address_type || ''
|
|
}))
|
|
},
|
|
|
|
loadAddressList () {
|
|
const supplierNo = this.detailData.supplierNo || ''
|
|
if (!supplierNo) {
|
|
this.addressList = []
|
|
this.addressTotal = 0
|
|
return
|
|
}
|
|
const params = {
|
|
site: this.$store.state.user.site,
|
|
supplierId: supplierNo,
|
|
addressType: '验货地址',
|
|
page: this.addressPageIndex,
|
|
limit: this.addressPageSize
|
|
}
|
|
if (this.addressSearch.keyword) {
|
|
params.address = this.addressSearch.keyword
|
|
}
|
|
this.addressLoading = true
|
|
searchSrmSupplierAddressList(params).then(({ data }) => {
|
|
if (data && data.code === 0) {
|
|
const pageData = data.page || data.data || {}
|
|
const rawList = Array.isArray(pageData.list) ? pageData.list : (Array.isArray(pageData) ? pageData : [])
|
|
this.addressList = this.normalizeAddressRows(rawList)
|
|
this.addressTotal = pageData.totalCount || this.addressList.length
|
|
this.addressPageIndex = pageData.currPage || this.addressPageIndex
|
|
this.addressPageSize = pageData.pageSize || this.addressPageSize
|
|
this.$nextTick(() => {
|
|
if (this.addressList.length > 0) {
|
|
this.addressCurrentRow = this.addressList[0]
|
|
if (this.$refs.addressTable) {
|
|
this.$refs.addressTable.setCurrentRow(this.addressCurrentRow)
|
|
}
|
|
} else {
|
|
this.addressCurrentRow = null
|
|
if (this.$refs.addressTable) {
|
|
this.$refs.addressTable.setCurrentRow()
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
this.addressList = []
|
|
this.addressCurrentRow = null
|
|
this.addressTotal = 0
|
|
}
|
|
}).catch((error) => {
|
|
this.addressList = []
|
|
this.addressCurrentRow = null
|
|
this.addressTotal = 0
|
|
console.error('查询验货地址失败:', error)
|
|
this.$message.error('查询验货地址失败')
|
|
}).finally(() => {
|
|
this.addressLoading = false
|
|
})
|
|
},
|
|
|
|
searchAddressList () {
|
|
this.addressPageIndex = 1
|
|
this.loadAddressList()
|
|
},
|
|
|
|
resetAddressSearch () {
|
|
this.addressSearch.keyword = ''
|
|
this.addressPageIndex = 1
|
|
this.loadAddressList()
|
|
},
|
|
|
|
onAddressPageSizeChange (val) {
|
|
this.addressPageSize = val
|
|
this.addressPageIndex = 1
|
|
this.loadAddressList()
|
|
},
|
|
|
|
onAddressPageCurrentChange (val) {
|
|
this.addressPageIndex = val
|
|
this.loadAddressList()
|
|
},
|
|
|
|
onAddressCurrentChange (row) {
|
|
this.addressCurrentRow = row || null
|
|
},
|
|
|
|
onAddressRowDblClick (row) {
|
|
this.selectAddressRow(row)
|
|
},
|
|
|
|
confirmAddressSelect () {
|
|
this.selectAddressRow(this.addressCurrentRow)
|
|
},
|
|
|
|
selectAddressRow (row) {
|
|
if (!row || !row.addressId) {
|
|
this.$message.warning('请选择验货地址')
|
|
return
|
|
}
|
|
this.editData.inspectAddressId = row.addressId || ''
|
|
this.editData.inspectAddress = row.address || ''
|
|
this.editData.inspectCityShort = row.cityShort || ''
|
|
this.editData.inspectContract = row.contact || this.editData.inspectContract || ''
|
|
this.editData.inspectPhone = row.phoneNo || ''
|
|
this.addressDialogVisible = false
|
|
},
|
|
|
|
async handleSave() {
|
|
if (!this.editData.needInspectDate) {
|
|
this.$message.warning('请选择建议验货日期')
|
|
return
|
|
}
|
|
|
|
const isChanged =
|
|
JSON.stringify(this.editData) !== JSON.stringify(this.originalData)
|
|
|
|
this.saveLoading = true
|
|
try {
|
|
await updateInspectionRequest({
|
|
...this.editData,
|
|
inspectAddress: this.editData.inspectAddressId || this.editData.inspectAddress,
|
|
inspectAddressId: this.editData.inspectAddressId || '',
|
|
isChanged: isChanged ? 'Y' : 'N'
|
|
})
|
|
|
|
this.$message.success('修改成功')
|
|
this.$emit('update-success')
|
|
this.isEditMode = false
|
|
} catch (e) {
|
|
this.$message.error(e.message || '修改失败')
|
|
} finally {
|
|
this.saveLoading = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.inspection-request-detail {
|
|
width: 100%;
|
|
}
|
|
|
|
.detail-form {
|
|
width: 100%;
|
|
}
|
|
|
|
// 表单项底部间距 - 与产品页面保持一致
|
|
.el-form-item {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
// 标签样式:字体14px,与产品页面一致
|
|
/deep/ .el-form-item__label {
|
|
font-size: 14px;
|
|
color: #606266;
|
|
line-height: 1.5;
|
|
padding-bottom: 6px;
|
|
font-weight: normal;
|
|
}
|
|
|
|
// 输入框样式 - 与产品页面完全一致(默认尺寸)
|
|
/deep/ .el-input__inner {
|
|
height: 32px;
|
|
line-height: 32px;
|
|
font-size: 13px;
|
|
border-radius: 4px;
|
|
border: 1px solid #dcdfe6;
|
|
background-color: #fff;
|
|
}
|
|
|
|
// disabled 状态样式 - 文字加深便于阅读(原浅灰 #c0c4cc 太浅) - rqrq
|
|
/deep/ .el-input.is-disabled .el-input__inner {
|
|
background-color: #f5f7fa;
|
|
border-color: #e4e7ed;
|
|
color: #303133;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/deep/ .el-input__inner:focus {
|
|
border-color: #409eff;
|
|
outline: none;
|
|
}
|
|
|
|
// 日期选择器样式
|
|
/deep/ .el-date-editor.el-input {
|
|
width: 100%;
|
|
}
|
|
|
|
/deep/ .el-date-editor .el-input__inner {
|
|
padding-left: 35px;
|
|
}
|
|
|
|
// 按钮样式 - 使用 Element UI 默认样式,不覆盖颜色
|
|
/deep/ .el-button {
|
|
height: 32px;
|
|
line-height: 32px;
|
|
padding: 0 15px;
|
|
font-size: 13px;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.choose-label {
|
|
cursor: pointer;
|
|
color: #409eff;
|
|
}
|
|
|
|
</style>
|