|
|
|
@ -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 |
|
|
|
} |
|
|
|
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 |
|
|
|
}) |
|
|
|
|
|
|
|
this.propertyItemSelections.forEach(selected => { |
|
|
|
if (!mergedList.some(item => item.itemNo === selected.itemNo)) { |
|
|
|
const normalized = this.normalizePropertyItem(selected) |
|
|
|
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) => ({ |
|
|
|
|