fix:coding#803#842、25检测表,绑定缺陷项的时候加判断,如果列表里已绑定就加提示:缺陷项已存在

This commit is contained in:
shijing 2025-07-04 11:27:20 +08:00
parent bf64596820
commit 642baa3965
1 changed files with 61 additions and 5 deletions

View File

@ -27,6 +27,7 @@
hideDelete
hideIndex
:tableHeight="200"
:pushType="pushType"
v-model="qctmatlist"
:addTemplate="mataddTemplate"
placeholder="暂无数据"
@ -38,9 +39,11 @@
v-else
:apiObj="apiObj"
:labelField="'full_name'"
v-model:obj="materialrow"
v-model="scope.row.material"
v-model:label="scope.row.full_name"
style="width:100%"
@change="materialrowChange"
>
<el-table-column label="物料名称" prop="full_name"></el-table-column>
<!-- <el-table-column label="工序" prop="process_name"></el-table-column>
@ -102,6 +105,7 @@
<sc-form-table
hideIndex
:tableHeight="300"
:pushType="pushType"
v-model="qcttestitemlist"
:addTemplate="defectaddTemplate"
placeholder="暂无数据"
@ -119,9 +123,10 @@
v-else
:apiObj="apiObj2"
v-model="scope.row.testitem"
v-model:label="scope.row.testitem_name"
v-model:label="scope.row.testitem_name"
v-model:obj="testitemrow"
style="width:100%"
@change="testitemrowChange"
>
<el-table-column label="名称" prop="name"></el-table-column>
<el-table-column label="描述" prop="description"></el-table-column>
@ -177,6 +182,7 @@
<el-card style="width: 100%" header="检测缺陷项" shadow="hover">
<sc-form-table
hideIndex
:pushType="pushType"
:tableHeight="300"
v-model="qctdefectlist"
:addTemplate="testitemaddTemplate"
@ -196,8 +202,9 @@
:apiObj="apiObj3"
v-model="scope.row.defect"
v-model:obj="defectrow"
v-model:label="scope.row.defect_name"
v-model:label="scope.row.defect_name"
style="width:100%"
@change="defectrowChange"
>
<el-table-column label="名称" prop="name"></el-table-column>
<el-table-column label="分类" prop="cate"></el-table-column>
@ -325,8 +332,9 @@ export default {
isEdit: true,
},
defectrow:{},
materialrow:{},
testitemrow:{},
pushType:'unshift',
};
},
mounted() {
@ -337,7 +345,30 @@ export default {
this.getLists();
},
watch:{
defectrow:{}
// testitemrow:{
// handler(newVal,oldVal){
// console.log('newVal',newVal);
// console.log('oldVal',oldVal);
// this.testitemrowChange()
// },
// deep: true,
// },
// defectrow:{
// handler(newVal,oldVal){
// console.log('newVal',newVal);
// console.log('oldVal',oldVal);
// this.defectrowChange()
// },
// deep: true,
// },
// materialrow:{
// handler(newVal,oldVal){
// console.log('newVal',newVal);
// console.log('oldVal',oldVal);
// this.materialrowChange()
// },
// deep: true,
// }
},
methods: {
open() {
@ -491,7 +522,32 @@ export default {
});
}).catch(() => {});
},
materialrowChange(){
let that = this;
that.qctmatlist.forEach((item) => {
if (item.material&&(item.material == that.materialrow.id)) {
that.$message.warning("该物料已存在");
}
});
},
defectrowChange(){
let that = this;
console.log('that.qctdefectlist',that.qctdefectlist);
that.qctdefectlist.forEach((item) => {
if (item.defect&&(item.defect == that.defectrow.id)) {
that.$message.warning("该缺陷项已存在");
}
});
},
testitemrowChange(){
let that = this;
console.log('that.qcttestitemlist',that.qcttestitemlist);
that.qcttestitemlist.forEach((item) => {
if (item.testitem&&item.testitem == that.testitemrow.id) {
that.$message.warning("该检测项已存在");
}
});
},
//
check_edit(row) {
this.mioitemId = row.id;