From cebec58d79ddab31246304bb5e3975ec67dd820c Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Tue, 7 Jul 2026 13:44:14 +0800 Subject: [PATCH] =?UTF-8?q?2026-07-07=20RoHS=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/lab/labRecord.vue | 32 ++++++++++++++++++--------- src/views/modules/rohs/rohsRecord.vue | 9 ++++++++ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/views/modules/lab/labRecord.vue b/src/views/modules/lab/labRecord.vue index 144771d..114ea68 100644 --- a/src/views/modules/lab/labRecord.vue +++ b/src/views/modules/lab/labRecord.vue @@ -1634,20 +1634,32 @@ export default { } const currentList = Array.isArray(this.modalData.propertyItemList) ? this.modalData.propertyItemList : [] const selectedNoSet = new Set(this.propertyItemSelections.map(item => item.itemNo)) + const currentMap = new Map(currentList.map(item => [item.itemNo, this.normalizePropertyItem(item)])) const mergedList = [] - currentList.forEach(item => { - if (selectedNoSet.has(item.itemNo)) { - mergedList.push(this.normalizePropertyItem(item)) + // 始终按模板明细顺序回写,确保Lab项目顺序与模板一致 + this.propertyItemList.forEach(templateItem => { + const templateNo = templateItem.itemNo + if (!selectedNoSet.has(templateNo)) { + return } - }) - - this.propertyItemSelections.forEach(selected => { - if (!mergedList.some(item => item.itemNo === selected.itemNo)) { - const normalized = this.normalizePropertyItem(selected) - normalized.itemValue = this.resolvePropertyDefaultValue(normalized) - mergedList.push(normalized) + const currentItem = currentMap.get(templateNo) + if (currentItem) { + const keepValueItem = this.normalizePropertyItem({ + ...templateItem, + ...currentItem, + itemNo: templateItem.itemNo, + itemDesc: templateItem.itemDesc, + valueChooseFlag: templateItem.valueChooseFlag, + defaultValue: templateItem.defaultValue, + availableValueList: templateItem.availableValueList + }) + mergedList.push(keepValueItem) + return } + const normalized = this.normalizePropertyItem(templateItem) + normalized.itemValue = this.resolvePropertyDefaultValue(normalized) + mergedList.push(normalized) }) this.$set(this.modalData, 'propertyItemList', mergedList.map((item, index) => ({ diff --git a/src/views/modules/rohs/rohsRecord.vue b/src/views/modules/rohs/rohsRecord.vue index 4a1e262..f39a543 100644 --- a/src/views/modules/rohs/rohsRecord.vue +++ b/src/views/modules/rohs/rohsRecord.vue @@ -3699,6 +3699,15 @@ export default { this.$message.warning('当前状态不允许保存') return } + const isAddMode = this.modalTitle === 'RoHS 新增' + if (isAddMode && !String(this.modalData.endCustomer || '').trim()) { + this.$message.warning('最终客户不能为空') + return + } + if (isAddMode && !String(this.modalData.projectId || '').trim()) { + this.$message.warning('项目编码不能为空') + return + } this.$set(this.modalData, 'isAhGrade', this.normalizeCheckboxFlag(this.modalData.isAhGrade)) this.normalizeHsfStandardByCustomer(this.modalData) this.syncHsfApproverFields()