fix:表格优化

This commit is contained in:
shijing 2025-12-02 16:16:01 +08:00
parent aff4bcc201
commit 84562cfb37
1 changed files with 34 additions and 29 deletions

View File

@ -204,7 +204,7 @@
<el-row>
<el-col v-for="item2 in defectlists" :key="item2.id" :span="12">
<el-form-item :label="item2.defect_name">
<el-switch v-model="item2.value"></el-switch>
<el-switch v-model="item2.value" @change="defect_change(item2)"></el-switch>
</el-form-item>
</el-col>
<el-col>
@ -216,11 +216,13 @@
</el-row>
</el-form>
<el-row>
<el-table :data="selectWpr" border>
<el-table :data="selectWprList" border>
<el-table-column type="index"></el-table-column>
<el-table-column prop="number" label="物料编号"></el-table-column>
<el-table-column v-for="item2 in defectlists" :key="item2.id" :label="item2.defect_name">
<el-switch v-model="item2.value" disabled></el-switch>
<template #default="scope">
<el-switch v-model="scope.row[item2.defect_name]" disabled></el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="90" align="center" fixed="right">
<template #default="scope">
@ -231,7 +233,7 @@
</el-row>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click.stop="saveSetting" save>保存</el-button>
<el-button @click="saveCancel">取消</el-button>
<el-button @click="saveSettingCancel">取消</el-button>
</el-footer>
</el-main>
</el-container>
@ -366,7 +368,6 @@ export default {
selectWprList:[],
selectedindexes:[],
qct_defects_origin:[],
selectWpr:[],
tableHeight:500,
apiObjPrint:this.$API.cm.labelmat.fromWm,
printer_name:localStorage.getItem("printer_name")
@ -488,15 +489,6 @@ export default {
that.options = res;
})
},
optionChange(row){
let that = this;
that.options.forEach((item) => {
if(item.id == row.wpr){
let index = that.mlogbwlist.indexOf(row);
that.mlogbwlist[index].number = item.number;
}
})
},
getList(){
let that = this;
let params = {};
@ -766,7 +758,7 @@ export default {
that.qct_defects.forEach(item => {
if(that.form.defectids.indexOf(item.defect) > -1){
item.canEdit = true;
item.value=null;
item.value=false;
that.defectlists.push(item);
}
})
@ -783,7 +775,7 @@ export default {
if(that.checkAll){
that.qct_defects.forEach(item => {
item.canEdit = true;
item.value=null;
item.value=false;
that.defectlists.push(item);
that.form.defectids.push(item.defect);
})
@ -823,7 +815,6 @@ export default {
that.qct_testitems = [];
that.qct_testitems = that.testitemlists;
that.tableHeight = document.getElementById('mlogbwMain').clientHeight-80;
// that.getList();
}).catch(() => {
that.isSaveing = false;
})
@ -838,13 +829,11 @@ export default {
this.form.defectids = [];
this.checkVisible = false;
},
//
check_set(){
this.wprNumber = "";
this.selectWpr = [];
if(this.selectWprList.length>0){
this.selectWpr = this.selectWprList;
}
this.setVisible=true;
let that = this;
that.wprNumber = "";
that.setVisible=true;
},
//
wprinputChange(){
@ -912,24 +901,30 @@ export default {
let that = this;
that.mlogbwlist.forEach(item => {
if(item.number == wprNumber){
that.selectWpr.push(item);
that.selectWprList.push(item);
that.wprNumber = "";
}
});
},
selectWprDel(row){
let that = this;
that.selectWpr.forEach((item,index) => {
that.selectWprList.forEach((item,index) => {
if(item.number == row.number){
that.selectWpr.splice(index,1);
that.selectWprList.splice(index,1);
}
});
},
defect_change(item){
let that = this;
that.selectWprList.forEach(row => {
row[item.defect_name] = item.value;
});
},
saveSetting(){
let that = this;
that.$refs.dialogForm.validate((valid) => {
if (valid) {
that.selectWpr.forEach(item => {
that.selectWprList.forEach(item => {
if(!item.ftest){
item.ftest = {};
}
@ -938,12 +933,12 @@ export default {
that.defectlists.forEach((item1) => {
let obj = {};
obj.defect = item1.defect;
obj.has = item1.value;
obj.has = item[item1.defect_name]?item[item1.defect_name]:false;
item.ftest.ftestdefects.push(obj);
})
}
});
that.$API.wpm.mlogbw.update.req("bulk",that.selectWpr).then((res) => {
that.$API.wpm.mlogbw.update.req("bulk",that.selectWprList).then((res) => {
that.setVisible = false;
that.selectedAll = false;
that.selectWprList = [];
@ -958,6 +953,16 @@ export default {
}
});
},
saveSettingCancel(){
let that = this;
that.setVisible = false;
that.selectedAll = false;
that.selectWprList = [];
that.selectedindexes = [];
// that.defectlists.forEach(item => {
// item.value = false;
// });
},
},
};
</script>