检验项目删除

dev-scheduling
zhangdi 2 months ago
parent 1e246e9a70
commit 4860f26cde
  1. 59
      src/views/processManagement/components/addTemplateDialog.vue

@ -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);

Loading…
Cancel
Save