Browse Source

2026-08-06

打样申请:【新增】时物料列表选中问题
master
fengyuan_yang 1 month ago
parent
commit
eb754e466d
  1. 88
      src/views/modules/proofing/requestForProofing.vue

88
src/views/modules/proofing/requestForProofing.vue

@ -352,7 +352,7 @@
<el-input v-model="projectPartData.customerPartNo" clearable style="width: 120px"></el-input> <el-input v-model="projectPartData.customerPartNo" clearable style="width: 120px"></el-input>
</el-form-item> </el-form-item>
<el-form-item label=" " v-if="modalData.projectId"> <el-form-item label=" " v-if="modalData.projectId">
<el-button type="primary" @click="getProjectPartList">查询</el-button>
<el-button type="primary" @click="searchProjectPartList">查询</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
@ -956,9 +956,7 @@ export default {
} }
this.modalData.testPartNo = '' this.modalData.testPartNo = ''
this.modalData.partName = '' this.modalData.partName = ''
this.projectPartListSelections = [];
this.projectPartList = [];
this.$refs.projectPartTable.clearSelection();
this.resetProjectPartSelectionState(true)
} }
}, },
rejectVisible(newVal, oldVal) { rejectVisible(newVal, oldVal) {
@ -980,8 +978,7 @@ export default {
this.no = 1 this.no = 1
this.size = 20 this.size = 20
this.total = 0 this.total = 0
this.projectPartList = []
this.projectPartListSelections = []
this.resetProjectPartSelectionState(true)
} }
}, },
'modalData.tracker'(newVal,oldVal){ 'modalData.tracker'(newVal,oldVal){
@ -2190,6 +2187,8 @@ export default {
// ======== ======== // ======== ========
proofingSelections: [], proofingSelections: [],
projectPartListSelections: [], projectPartListSelections: [],
projectPartSelectionMap: {},
projectPartTableSyncingSelection: false,
// ======== ======== // ======== ========
proofingCurrentRow: {}, proofingCurrentRow: {},
// ======== ======== // ======== ========
@ -2451,7 +2450,19 @@ export default {
* @param val * @param val
*/ */
selectionProjectPart(val) { selectionProjectPart(val) {
this.projectPartListSelections = val
if (this.projectPartTableSyncingSelection) {
return
}
let selectedKeySet = new Set(val.map(item => 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 * 获取唯一值一般都为 id
@ -2750,6 +2761,7 @@ export default {
} else { } else {
this.projectPartData.testPartNo = ''; this.projectPartData.testPartNo = '';
} }
this.initProjectPartSelectionMapFromModalData()
this.getProjectPartList(); this.getProjectPartList();
}, },
getProjectPartList() { getProjectPartList() {
@ -2757,10 +2769,6 @@ export default {
this.projectPartList = []; this.projectPartList = [];
return return
} }
//
this.$nextTick(() => this.$refs.projectPartTable.clearSelection())
//
let projectPartList = this.modalData.testPartNo.split(';')
this.projectPartData.projectId = this.modalData.projectId; this.projectPartData.projectId = this.modalData.projectId;
// //
let params = { let params = {
@ -2773,12 +2781,7 @@ export default {
if (data && data.code === 0) { if (data && data.code === 0) {
this.projectPartList = data.rows this.projectPartList = data.rows
this.total = data.total 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 // this.projectPartModelFlag = true
} else { } else {
this.$message.warning(data.msg) this.$message.warning(data.msg)
@ -2789,6 +2792,10 @@ export default {
this.$message.error(error) this.$message.error(error)
}) })
}, },
searchProjectPartList() {
this.no = 1
this.getProjectPartList()
},
/** /**
* 确认多选项目物料 * 确认多选项目物料
*/ */
@ -3614,7 +3621,7 @@ export default {
this.modalData.customerDesc = val.Customer_desc this.modalData.customerDesc = val.Customer_desc
this.modalData.projectId = undefined this.modalData.projectId = undefined
this.modalData.projectName = undefined this.modalData.projectName = undefined
this.projectPartList = []
this.resetProjectPartSelectionState(true)
} }
} }
// if (this.tagNo === 103) { // if (this.tagNo === 103) {
@ -3725,12 +3732,55 @@ export default {
sendSamplesUsage: '' sendSamplesUsage: ''
}; };
this.selectionDelegateAccess = []; this.selectionDelegateAccess = [];
this.projectPartList = [];
this.resetProjectPartSelectionState(true)
this.activeName = 'part' this.activeName = 'part'
Object.keys(this.proofingDelegateAccess).forEach(key => { Object.keys(this.proofingDelegateAccess).forEach(key => {
this.proofingDelegateAccess[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) { checkSelectable(row, index) {
if (this.modalData.flag === '1') { if (this.modalData.flag === '1') {
return true return true

Loading…
Cancel
Save