|
|
|
@ -352,7 +352,7 @@ |
|
|
|
<el-input v-model="projectPartData.customerPartNo" clearable style="width: 120px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<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> |
|
|
|
<el-table |
|
|
|
@ -956,9 +956,7 @@ export default { |
|
|
|
} |
|
|
|
this.modalData.testPartNo = '' |
|
|
|
this.modalData.partName = '' |
|
|
|
this.projectPartListSelections = []; |
|
|
|
this.projectPartList = []; |
|
|
|
this.$refs.projectPartTable.clearSelection(); |
|
|
|
this.resetProjectPartSelectionState(true) |
|
|
|
} |
|
|
|
}, |
|
|
|
rejectVisible(newVal, oldVal) { |
|
|
|
@ -980,8 +978,7 @@ export default { |
|
|
|
this.no = 1 |
|
|
|
this.size = 20 |
|
|
|
this.total = 0 |
|
|
|
this.projectPartList = [] |
|
|
|
this.projectPartListSelections = [] |
|
|
|
this.resetProjectPartSelectionState(true) |
|
|
|
} |
|
|
|
}, |
|
|
|
'modalData.tracker'(newVal,oldVal){ |
|
|
|
@ -2190,6 +2187,8 @@ export default { |
|
|
|
// ======== 复选数据集 ======== |
|
|
|
proofingSelections: [], |
|
|
|
projectPartListSelections: [], |
|
|
|
projectPartSelectionMap: {}, |
|
|
|
projectPartTableSyncingSelection: false, |
|
|
|
// ======== 选中的当前行数据 ======== |
|
|
|
proofingCurrentRow: {}, |
|
|
|
// ======== 模态框开关控制 ======== |
|
|
|
@ -2451,7 +2450,19 @@ export default { |
|
|
|
* @param 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 |
|
|
|
@ -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 |
|
|
|
|