|
|
|
@ -432,6 +432,8 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
tableData2: [], |
|
|
|
tableData2: [], |
|
|
|
tableData: [], |
|
|
|
tableData: [], |
|
|
|
|
|
|
|
processDeleteIds: [], //工序删除id |
|
|
|
|
|
|
|
projectDeleteIds: [], //项目的删除id |
|
|
|
}, |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
rules: { |
|
|
|
promodel: { |
|
|
|
promodel: { |
|
|
|
@ -665,7 +667,60 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 删除一行 |
|
|
|
// 删除一行 |
|
|
|
delTable(row, index) { |
|
|
|
delTable(row, index) { |
|
|
|
this.ruleForm.tableData.splice(index, 1); |
|
|
|
// this.ruleForm.tableData.splice(index, 1); |
|
|
|
|
|
|
|
if (this.activeName === '1') { |
|
|
|
|
|
|
|
const selected = this.selectedProcessRows; |
|
|
|
|
|
|
|
if (selected.length === 0) { |
|
|
|
|
|
|
|
this.$message.warning('请至少选择一条工序数据'); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 收集有 id 的行(用于后续提交删除) |
|
|
|
|
|
|
|
const idsToDelete = selected |
|
|
|
|
|
|
|
.filter(row => row.id != null && row.id !== '') |
|
|
|
|
|
|
|
.map(row => row.id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.ruleForm.processDeleteIds.push(...idsToDelete); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 从 tableData 中移除选中行(包括临时行) |
|
|
|
|
|
|
|
const tempIds = selected.map(row => row._tempId).filter(id => id != null); |
|
|
|
|
|
|
|
const realIds = selected.map(row => row.id).filter(id => id != null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.ruleForm.tableData = this.ruleForm.tableData.filter(row => { |
|
|
|
|
|
|
|
if (row.id != null) { |
|
|
|
|
|
|
|
return !realIds.includes(row.id); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return !tempIds.includes(row._tempId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.$message.success('删除成功'); |
|
|
|
|
|
|
|
} else if (this.activeName === '2') { |
|
|
|
|
|
|
|
const selected = this.selectedProjectRows; |
|
|
|
|
|
|
|
if (selected.length === 0) { |
|
|
|
|
|
|
|
this.$message.warning('请至少选择一条项目数据'); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const idsToDelete = selected |
|
|
|
|
|
|
|
.filter(row => row.id != null && row.id !== '') |
|
|
|
|
|
|
|
.map(row => row.id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.ruleForm.projectDeleteIds.push(...idsToDelete); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const tempIds = selected.map(row => row._tempId).filter(id => id != null); |
|
|
|
|
|
|
|
const realIds = selected.map(row => row.id).filter(id => id != null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.ruleForm.tableData2 = this.ruleForm.tableData2.filter(row => { |
|
|
|
|
|
|
|
if (row.id != null) { |
|
|
|
|
|
|
|
return !realIds.includes(row.id); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return !tempIds.includes(row._tempId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.$message.success('删除成功'); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
submit() { |
|
|
|
submit() { |
|
|
|
@ -705,6 +760,8 @@ export default { |
|
|
|
let query = { |
|
|
|
let query = { |
|
|
|
promodel, |
|
|
|
promodel, |
|
|
|
tableData, |
|
|
|
tableData, |
|
|
|
|
|
|
|
processDeleteIds: this.ruleForm.processDeleteIds, |
|
|
|
|
|
|
|
projectDeleteIds: this.ruleForm.projectDeleteIds, |
|
|
|
}; |
|
|
|
}; |
|
|
|
console.log('提交数据:', query); |
|
|
|
console.log('提交数据:', query); |
|
|
|
|
|
|
|
|
|
|
|
|