检验项目删除

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

@ -180,7 +180,7 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="proDes" label="工序描述" align="left"> <el-table-column prop="proDes" label="工序描述" align="left">
<template #header> <template #header>
<span><i style="color: red">*</i>工序描述</span> <span><i style="color: red">*</i>工序描述</span>
</template> </template>
@ -432,6 +432,8 @@ export default {
}, },
tableData2: [], tableData2: [],
tableData: [], tableData: [],
processDeleteIds: [], //id
projectDeleteIds: [], //id
}, },
rules: { rules: {
promodel: { promodel: {
@ -620,8 +622,8 @@ export default {
this.ruleForm.tableData = res.data.data.proDetailVOList; this.ruleForm.tableData = res.data.data.proDetailVOList;
this.ruleForm.tableData.forEach(item => { this.ruleForm.tableData.forEach(item => {
item.ppsId = item.ppsId+''; item.ppsId = item.ppsId + '';
item.caId = item.caId+''; item.caId = item.caId + '';
}); });
this.treeData = [{ label: '工序列表', processList: res.data.data.proDetailVOList }]; this.treeData = [{ label: '工序列表', processList: res.data.data.proDetailVOList }];
}); });
@ -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