fix:表格优化

This commit is contained in:
shijing 2025-12-02 11:03:53 +08:00
parent b2f0a4f74a
commit 13e32911ac
1 changed files with 28 additions and 20 deletions

View File

@ -24,7 +24,10 @@
<table id="mlogbwlist" class="tables"> <table id="mlogbwlist" class="tables">
<thead> <thead>
<tr> <tr>
<th class="w_30 inlineBlock"></th> <th class="w_30 inlineBlock">
<input type="checkbox" v-model="selectedAll" :value="selectedAll" style="width: 18px;" @change="selectAllChange">
</th>
<th class="w_30 inlineBlock">序号</th>
<th class="w_140 inlineBlock">物料批次</th> <th class="w_140 inlineBlock">物料批次</th>
<th class="w_140 inlineBlock">物料编号</th> <th class="w_140 inlineBlock">物料编号</th>
<th class="w_80 inlineBlock" v-for="item in qct_testitems" :key="item.id">{{ item.testitem_name }}</th> <th class="w_80 inlineBlock" v-for="item in qct_testitems" :key="item.id">{{ item.testitem_name }}</th>
@ -38,6 +41,9 @@
<td class="w_30 inlineBlock padding_4"> <td class="w_30 inlineBlock padding_4">
<input type="checkbox" v-model="selectedindexes" :value="row.id" @change="selectChange"> <input type="checkbox" v-model="selectedindexes" :value="row.id" @change="selectChange">
</td> </td>
<td class="w_30 inlineBlock padding_4">
{{ index + 1 }}
</td>
<td class="w_140 inlineBlock"> <td class="w_140 inlineBlock">
<input v-if="row.isEdit" v-model="row.mlogb__batch" placeholder="物料批次"> <input v-if="row.isEdit" v-model="row.mlogb__batch" placeholder="物料批次">
<span v-else>{{ row.mlogb__batch }}</span> <span v-else>{{ row.mlogb__batch }}</span>
@ -66,7 +72,7 @@
<span v-else style="width: 100%;height: 100%;display: inline-block;">{{ row.note }}</span> <span v-else style="width: 100%;height: 100%;display: inline-block;">{{ row.note }}</span>
</td> </td>
<td class="w_180 inlineBlock" v-if="!isSubmit"> <td class="w_180 inlineBlock" v-if="!isSubmit">
<button v-if="row.isEdit" type="button" class="btn btn_blue" @click="formTableSave(row,index)">保存</button> <button v-if="row.isEdit" type="button" class="btn btn_green" @click="formTableSave(row,index)">保存</button>
<button v-if="row.isEdit && row.id" type="button" class="btn btn_red" @click="formTableCancel(row,index)">取消</button> <button v-if="row.isEdit && row.id" type="button" class="btn btn_red" @click="formTableCancel(row,index)">取消</button>
<button v-if="row.isEdit && setForm.cd_req_addr !== null" type="button" class="btn btn_yellow" @click="getEqData(index)">重取数据</button> <button v-if="row.isEdit && setForm.cd_req_addr !== null" type="button" class="btn btn_yellow" @click="getEqData(index)">重取数据</button>
<button v-if="!row.isEdit" type="button" class="btn btn_blue" @click="formTableEdit(index)">编辑</button> <button v-if="!row.isEdit" type="button" class="btn btn_blue" @click="formTableEdit(index)">编辑</button>
@ -318,6 +324,7 @@ export default {
route_code:"", route_code:"",
wprInputText:"", wprInputText:"",
canMultiple:false, canMultiple:false,
selectedAll:false,
checkAll: false, checkAll: false,
hideAdd: false, hideAdd: false,
visible: false, visible: false,
@ -402,17 +409,23 @@ export default {
selectChange(){ selectChange(){
let that = this; let that = this;
that.selectWprList = []; that.selectWprList = [];
console.log('selectedindexes',that.selectedindexes);
that.mlogbwlist.forEach((item) => { that.mlogbwlist.forEach((item) => {
if(that.selectedindexes.indexOf(item.id)>-1){ if(that.selectedindexes.indexOf(item.id)>-1){
that.selectWprList.push(item); that.selectWprList.push(item);
} }
}) })
console.log('selectWprList',that.selectWprList);
}, },
selectAllChange(datas){ selectAllChange(){
let that = this; let that = this;
that.selectWprList = datas; if(that.selectedAll){
that.mlogbwlist.forEach((item) => {
that.selectedindexes.push(item.id);
that.selectWprList.push(item);
})
}else{
that.selectedindexes=[];
that.selectWprList=[];
}
}, },
getEquipment4() { getEquipment4() {
let that = this; let that = this;
@ -527,7 +540,6 @@ export default {
} }
that.mlogbwlist.push(obj); that.mlogbwlist.push(obj);
}) })
// console.log('that.mlogbwlist',that.mlogbwlist);
} }
}) })
}, },
@ -624,7 +636,7 @@ export default {
let getEd = false; let getEd = false;
if(that.qct_testitems.length>0){ if(that.qct_testitems.length>0){
for(let i=0;i<that.qct_testitems.length;i++){ for(let i=0;i<that.qct_testitems.length;i++){
if(that.qct_testitems[i].cd_expr!=null){ if(that.qct_testitems[i].testitem_cd_expr!=null&&that.qct_testitems[i].testitem_cd_expr!=''&&that.qct_testitems[i].testitem_cd_expr!==undefined){
getEd = true; getEd = true;
} }
} }
@ -832,7 +844,6 @@ export default {
if(this.selectWprList.length>0){ if(this.selectWprList.length>0){
this.selectWpr = this.selectWprList; this.selectWpr = this.selectWprList;
} }
console.log('this.selectWpr',this.selectWpr);
this.setVisible=true; this.setVisible=true;
}, },
// //
@ -847,12 +858,13 @@ export default {
that.wprInputText = ""; that.wprInputText = "";
that.mlogbwlist.unshift(obj); that.mlogbwlist.unshift(obj);
that.$nextTick(() => { that.$nextTick(() => {
that.$refs.mlogbwTable.setCurrentRows(obj); // that.selectedindexes.push(obj.id);
that.selectWprList.push(item);
}) })
let getEd = false; let getEd = false;
if(that.qct_testitems.length>0){ if(that.qct_testitems.length>0){
for(let i=0;i<that.qct_testitems.length;i++){ for(let i=0;i<that.qct_testitems.length;i++){
if(that.qct_testitems[i].cd_expr!=null){ if(that.qct_testitems[i].testitem_cd_expr!=null&&that.qct_testitems[i].testitem_cd_expr!=''&&that.qct_testitems[i].testitem_cd_expr!==undefined){
getEd = true; getEd = true;
} }
} }
@ -889,7 +901,6 @@ export default {
} }
}) })
}).catch((err) => { }).catch((err) => {
console.log(err);
this.$notify.error({ this.$notify.error({
title: '获取数据失败', title: '获取数据失败',
message: err.data message: err.data
@ -919,6 +930,9 @@ export default {
that.$refs.dialogForm.validate((valid) => { that.$refs.dialogForm.validate((valid) => {
if (valid) { if (valid) {
that.selectWpr.forEach(item => { that.selectWpr.forEach(item => {
if(!item.ftest){
item.ftest = {};
}
item.ftest.ftestdefects = []; item.ftest.ftestdefects = [];
if(that.defectlists.length>0){ if(that.defectlists.length>0){
that.defectlists.forEach((item1) => { that.defectlists.forEach((item1) => {
@ -928,18 +942,12 @@ export default {
item.ftest.ftestdefects.push(obj); item.ftest.ftestdefects.push(obj);
}) })
} }
// item.ftest.ftestdefects.forEach(defect => {
// let defectindex = that.setForm.defectids.indexOf(defect.defect);
// if(defectindex > -1){
// defect.has = that.defectlists[defectindex].value;
// }
// })
}); });
that.$API.wpm.mlogbw.update.req("bulk",that.selectWpr).then((res) => { that.$API.wpm.mlogbw.update.req("bulk",that.selectWpr).then((res) => {
that.setVisible = false; that.setVisible = false;
that.selectedAll = false;
that.selectWprList = []; that.selectWprList = [];
that.$refs.mlogbwTable.clearSelection(); that.selectedindexes = [];
that.defectlists.forEach(item => { that.defectlists.forEach(item => {
item.value = false; item.value = false;
}); });