diff --git a/src/views/modules/proofing/requestForProofing.vue b/src/views/modules/proofing/requestForProofing.vue
index da110c3..dca1c1d 100644
--- a/src/views/modules/proofing/requestForProofing.vue
+++ b/src/views/modules/proofing/requestForProofing.vue
@@ -352,7 +352,7 @@
- 查询
+ 查询
this.getRowKeys(item)))
+ this.projectPartList.forEach(item => {
+ let key = this.getRowKeys(item)
+ if (selectedKeySet.has(key)) {
+ this.$set(this.projectPartSelectionMap, key, item)
+ } else {
+ this.$delete(this.projectPartSelectionMap, key)
+ }
+ })
+ this.projectPartListSelections = Object.values(this.projectPartSelectionMap)
},
/**
* 获取唯一值,一般都为 id
@@ -2750,6 +2761,7 @@ export default {
} else {
this.projectPartData.testPartNo = '';
}
+ this.initProjectPartSelectionMapFromModalData()
this.getProjectPartList();
},
getProjectPartList() {
@@ -2757,10 +2769,6 @@ export default {
this.projectPartList = [];
return
}
- // 先清空缓存选中
- this.$nextTick(() => this.$refs.projectPartTable.clearSelection())
- // 拿到选中的产品编号
- let projectPartList = this.modalData.testPartNo.split(';')
this.projectPartData.projectId = this.modalData.projectId;
// 查询所有项目物料
let params = {
@@ -2773,12 +2781,7 @@ export default {
if (data && data.code === 0) {
this.projectPartList = data.rows
this.total = data.total
- this.projectPartList.forEach(val => {
- // 回显选中的项目物料
- if (projectPartList.includes(val.testPartNo)) {
- this.$nextTick(() => this.$refs.projectPartTable.toggleRowSelection(val, true))
- }
- })
+ this.$nextTick(() => this.syncProjectPartSelectionToTable())
// this.projectPartModelFlag = true
} else {
this.$message.warning(data.msg)
@@ -2789,6 +2792,10 @@ export default {
this.$message.error(error)
})
},
+ searchProjectPartList() {
+ this.no = 1
+ this.getProjectPartList()
+ },
/**
* 确认多选项目物料
*/
@@ -3614,7 +3621,7 @@ export default {
this.modalData.customerDesc = val.Customer_desc
this.modalData.projectId = undefined
this.modalData.projectName = undefined
- this.projectPartList = []
+ this.resetProjectPartSelectionState(true)
}
}
// if (this.tagNo === 103) {
@@ -3725,12 +3732,55 @@ export default {
sendSamplesUsage: ''
};
this.selectionDelegateAccess = [];
- this.projectPartList = [];
+ this.resetProjectPartSelectionState(true)
this.activeName = 'part'
Object.keys(this.proofingDelegateAccess).forEach(key => {
this.proofingDelegateAccess[key] = '';
})
},
+ initProjectPartSelectionMapFromModalData() {
+ if (Object.keys(this.projectPartSelectionMap).length > 0) {
+ return
+ }
+ let testPartNoList = (this.modalData.testPartNo || '').split(';').filter(item => item)
+ let partNameList = (this.modalData.partName || '').split(';')
+ testPartNoList.forEach((testPartNo, index) => {
+ this.$set(this.projectPartSelectionMap, testPartNo, {
+ testPartNo: testPartNo,
+ partName: partNameList[index] || ''
+ })
+ })
+ this.projectPartListSelections = Object.values(this.projectPartSelectionMap)
+ },
+ syncProjectPartSelectionToTable() {
+ if (!this.$refs.projectPartTable) {
+ return
+ }
+ this.projectPartTableSyncingSelection = true
+ this.$refs.projectPartTable.clearSelection()
+ this.projectPartList.forEach(row => {
+ if (this.projectPartSelectionMap[this.getRowKeys(row)]) {
+ this.$refs.projectPartTable.toggleRowSelection(row, true)
+ }
+ })
+ this.$nextTick(() => {
+ this.projectPartTableSyncingSelection = false
+ })
+ },
+ resetProjectPartSelectionState(clearTableData = false) {
+ this.projectPartListSelections = []
+ this.projectPartSelectionMap = {}
+ if (clearTableData) {
+ this.projectPartList = []
+ }
+ if (this.$refs.projectPartTable) {
+ this.projectPartTableSyncingSelection = true
+ this.$refs.projectPartTable.clearSelection()
+ this.$nextTick(() => {
+ this.projectPartTableSyncingSelection = false
+ })
+ }
+ },
checkSelectable(row, index) {
if (this.modalData.flag === '1') {
return true