diff --git a/src/views/modules/sampleTracking/projectProofTracking.vue b/src/views/modules/sampleTracking/projectProofTracking.vue
index 2633988..30376b0 100644
--- a/src/views/modules/sampleTracking/projectProofTracking.vue
+++ b/src/views/modules/sampleTracking/projectProofTracking.vue
@@ -70,6 +70,8 @@
+
+
@@ -631,15 +633,15 @@
- 客户编码
+ {{ oneKeyDialogMode === 'create' ? '客户编码' : '项目客户编码' }}
(新客户)
-
-
+
+
@@ -656,6 +658,23 @@
+
+
+
+
+ 物料客户编码
+ (新客户)
+
+
+
+
+
+
+
+
+
+
+
@@ -738,7 +757,7 @@
PM/Sales
-
+
@@ -915,7 +934,7 @@
-
+
@@ -951,7 +970,7 @@
{{ isOneKeyDetailMode ? '关闭' : '取消' }}
- {{ oneKeyDialogMode === 'edit' ? '保存修改' : '保存' }}
+ {{ oneKeyDialogMode === 'create' ? '保存' : '保存修改' }}
@@ -1848,6 +1867,8 @@ export default {
oneKeyDialogVisible: false,
oneKeyDialogMode: 'create',
+ customerChooserScope: 'project',
+ newCustomerScope: 'project',
saveOneKeyLoading: false,
oneKeyForm: {},
oneKeyProofingApplyOptions: [],
@@ -3911,14 +3932,22 @@ export default {
return []
})
},
- newCustomer () {
+ getOneKeyCustomerFields (scope) {
+ return scope === 'part'
+ ? { no: 'partCustomerNo', desc: 'partCustomerDesc' }
+ : { no: 'customerNo', desc: 'customerDesc' }
+ },
+ newCustomer (scope) {
+ this.newCustomerScope = scope === 'part' ? 'part' : 'project'
this.newCustomerData.customerDesc = ''
this.newCustomerFlag = true
},
- getBaseList (val) {
+ getBaseList (val, scope) {
this.tagNo = val
+ this.customerChooserScope = scope === 'part' ? 'part' : 'project'
this.$nextTick(() => {
- const strVal = val === 509 ? (this.oneKeyForm.customerNo || '') : ''
+ const fields = this.getOneKeyCustomerFields(this.customerChooserScope)
+ const strVal = val === 509 ? (this.oneKeyForm[fields.no] || '') : ''
this.$refs.baseList.init(val, strVal, '')
})
},
@@ -3946,8 +3975,9 @@ export default {
},
getBaseData (val) {
if (this.tagNo === 509) {
- this.oneKeyForm.customerNo = val.customer_no
- this.oneKeyForm.customerDesc = val.customer_desc
+ const fields = this.getOneKeyCustomerFields(this.customerChooserScope)
+ this.oneKeyForm[fields.no] = val.customer_no
+ this.oneKeyForm[fields.desc] = val.customer_desc
return
}
// IQC/SQE/FQC2/IPQC-Hardtag/前道工程师与 NPI 项目页共用 Chooselist 回填规则。
@@ -3957,21 +3987,25 @@ export default {
}
this.setOneKeyRoleFieldValue(roleField, this.buildRoleValueFromChooserRow(val))
},
- customerNoBlur () {
- if (!this.oneKeyForm.customerNo) {
- this.oneKeyForm.customerDesc = ''
+ customerNoBlur (scope) {
+ const fields = this.getOneKeyCustomerFields(scope)
+ const form = this.oneKeyForm
+ const customerNo = form[fields.no]
+ if (!customerNo) {
+ form[fields.desc] = ''
return
}
const params = {
- customerNo: this.oneKeyForm.customerNo,
+ customerNo,
createBy: this.$store.state.user.name
}
- queryCustomerList(params).then(({ data }) => {
- if (data && data.code === 0 && data.rows && data.rows.length === 1) {
- this.oneKeyForm.customerDesc = data.rows[0].customerDesc
- } else {
- this.oneKeyForm.customerDesc = ''
+ return queryCustomerList(params).then(({ data }) => {
+ // 异步查询返回时只回填原字段,且不覆盖用户后来选择的客户。
+ if (this.oneKeyForm !== form || form[fields.no] !== customerNo) {
+ return
}
+ form[fields.desc] = data && data.code === 0 && data.rows && data.rows.length === 1
+ ? data.rows[0].customerDesc : ''
})
},
saveNewCustomer () {
@@ -3979,7 +4013,10 @@ export default {
this.$message.warning('请输入客户名称!')
return
}
- this.generateNextCustomerNo().then(customerNo => {
+ const form = this.oneKeyForm
+ const fields = this.getOneKeyCustomerFields(this.newCustomerScope)
+ const customerDesc = this.newCustomerData.customerDesc
+ return this.generateNextCustomerNo().then(customerNo => {
if (!customerNo) {
this.$alert('该客户已存在,请重新输入客户名称!', '提示', {
confirmButtonText: '确定',
@@ -3990,13 +4027,15 @@ export default {
const params = {
site: this.$store.state.user.site,
customerNo: customerNo,
- customerDesc: this.newCustomerData.customerDesc,
+ customerDesc,
createBy: this.$store.state.user.name
}
- saveNewCustomer(params).then(({ data }) => {
+ return saveNewCustomer(params).then(({ data }) => {
if (data && data.code === 0) {
- this.oneKeyForm.customerNo = customerNo
- this.oneKeyForm.customerDesc = this.newCustomerData.customerDesc
+ if (this.oneKeyForm === form) {
+ form[fields.no] = customerNo
+ form[fields.desc] = customerDesc
+ }
this.newCustomerFlag = false
this.$message.success(data.msg || '新增客户成功')
} else {
@@ -5292,6 +5331,10 @@ export default {
}
this.oneKeyForm.testPartNo = partNo
this.oneKeyPartNoSnapshot = partNo
+ if (this.oneKeyDialogMode !== 'create') {
+ this.oneKeyForm.partCustomerNo = selectedPart.customerNo || ''
+ this.oneKeyForm.partCustomerDesc = selectedPart.customerDesc || ''
+ }
if (!this.isBlankValue(selectedPart.partDesc)) {
this.oneKeyForm.partDesc = String(selectedPart.partDesc).trim()
}
@@ -5362,6 +5405,11 @@ export default {
}
inData.pmInqueryTime = this.isBlankValue(inData.pmInqueryTime) ? null : this.formatDate(inData.pmInqueryTime)
inData.importance = this.normalizeImportanceValue(inData.importance)
+ if (this.oneKeyDialogMode === 'create') {
+ // 一键创建保持单客户逻辑,不提交修改模式专用的物料客户字段。
+ delete inData.partCustomerNo
+ }
+ delete inData.partCustomerDesc
return inData
},
validateOneKeySubmitPayload (inData) {
@@ -5384,7 +5432,7 @@ export default {
return false
}
}
- if (this.oneKeyDialogMode === 'edit') {
+ if (this.oneKeyDialogMode === 'edit' || this.oneKeyDialogMode === 'detail') {
if (!inData.projectId || !inData.projectPartId || !inData.trackingId) {
this.$message.error('项目/物料/打样记录ID缺失,无法修改')
return false
@@ -5432,8 +5480,11 @@ export default {
finalPartNo: part.finalPartNo || current.finalPartNo || '',
baseNo: part.baseNo || '',
revNo: part.revNo || '',
- customerNo: project.customerNo || part.customerNo || current.customerNo || '',
- customerDesc: project.customerDesc || current.customerDesc || '',
+ // 修改时分别使用项目与物料的真实客户,空值也不能互相回退覆盖。
+ customerNo: project.customerNo || '',
+ customerDesc: project.customerDesc || '',
+ partCustomerNo: part.customerNo || '',
+ partCustomerDesc: part.customerDesc || '',
finalCustomerId: project.finalCustomerId || '',
customerRemark: project.customerRemark || '',
parentProjectNo: project.parentProjectNo || '',
@@ -5585,14 +5636,31 @@ export default {
this.saveOneKeyLoading = false
})
},
- submitOneKey () {
+ async submitOneKey () {
+ if (this.saveOneKeyLoading) {
+ return
+ }
const inData = this.buildOneKeySubmitPayload()
if (!this.validateOneKeySubmitPayload(inData)) {
return
}
this.saveOneKeyLoading = true
- if (this.oneKeyDialogMode === 'edit') {
- oneKeyUpdateProofTracking(inData).then(({ data }) => {
+ // 详情入口对应已完成记录;即使表单中的状态被修改,也必须先确认。
+ if (this.oneKeyDialogMode === 'detail' ||
+ (this.oneKeyDialogMode === 'edit' && this.isProofingFinishedForTrackingStatus(this.oneKeyForm))) {
+ try {
+ await this.$confirm('打样已完成,是否确定修改?', '提示', {
+ confirmButtonText: '确定修改',
+ cancelButtonText: '取消',
+ type: 'warning'
+ })
+ } catch (e) {
+ this.saveOneKeyLoading = false
+ return
+ }
+ }
+ if (this.oneKeyDialogMode === 'edit' || this.oneKeyDialogMode === 'detail') {
+ return oneKeyUpdateProofTracking(inData).then(({ data }) => {
if (!data || data.code !== 0) {
throw new Error((data && data.msg) || '修改项目/物料/打样失败')
}
@@ -5604,9 +5672,8 @@ export default {
}).finally(() => {
this.saveOneKeyLoading = false
})
- return
}
- oneKeyCreateProofTracking(inData).then(({ data }) => {
+ return oneKeyCreateProofTracking(inData).then(({ data }) => {
this.saveOneKeyLoading = false
if (data && data.code === 0) {
this.$message.success('一键创建成功')