报工动态tab table 复选效果bug修复

yangwl
zhaoxiaolin 8 months ago
parent af4f3734f9
commit ea287e1b45

@ -468,7 +468,9 @@
:label="item.title"
:name="item.libId"
>
<el-table v-loading="loading" :data="item.libList" ref="myPOrderTable" @selection-change="pReportSelection"
<el-table v-loading="loading" :data="item.libList" ref="myPOrderTable"
@select="pReportSelection"
@select-all="allReportSelection"
:summary-method="getSummaries"
show-summary
>
@ -515,7 +517,10 @@
:name="item.libId"
>
<el-table v-loading="loading" :data="item.libList" ref="mypConsumeTable" @selection-change="pConsumeSelection">
<el-table v-loading="loading" :data="item.libList" ref="mypConsumeTable"
@select="pConsumeSelection"
@select-all="allConsumeSelection"
>
<el-table-column width="50" align="center" type="selection"/>
<el-table-column label="recordId" align="center" prop="recordId" v-if="false"/>
<el-table-column label="parentOrder" align="center" prop="parentOrder" v-if="false"/>
@ -1278,9 +1283,45 @@ export default {
console.log('row:',index, row);
},
//
pReportSelection(selection) {
this.pReportRows = this.pReportRows.concat(selection)
pReportSelection(selection,row) {
const allRows = this.pReportRows.concat(selection)
this.pReportRows = allRows.reduce((acc, cur) => {
const hasDuplicate = acc.some(item => item.batch === cur.batch
&& item.workorderCode === cur.workorderCode);
if (!hasDuplicate) {
acc.push(cur);
}
return acc;
}, []);
// selectedRows
if (selection.indexOf(row) === -1) {
console.log('Row unchecked:', row);
console.log('过滤前:', this.pReportRows);
var newReportRows = [];
this.pReportRows.forEach(item=>{
if (item.workorderCode!=row.workorderCode
|| item.batch!=row.batch) {
newReportRows.push(item)
}
})
this.pReportRows = newReportRows;
console.log('过滤后:', this.pReportRows);
}
},
allReportSelection(selection){
const allRows = this.pReportRows.concat(selection)
this.pReportRows = allRows.reduce((acc, cur) => {
const hasDuplicate = acc.some(item => item.batch === cur.batch
&& item.workorderCode === cur.workorderCode);
if (!hasDuplicate) {
acc.push(cur);
}
return acc;
}, []);
},
submitReport() {
this.reportRows = this.pReportRows;
if ( this.reportRows==0) {
@ -1344,8 +1385,35 @@ export default {
//});
},
//
pConsumeSelection(selection) {
// (zxl)
pConsumeSelection(selection, row) {
const allRows = this.pConsumeRows.concat(selection)
this.pConsumeRows = allRows.reduce((acc, cur) => {
const hasDuplicate = acc.some(item => item.materialCode === cur.materialCode
&& item.workorderCode === cur.workorderCode);
if (!hasDuplicate) {
acc.push(cur);
}
return acc;
}, []);
// selectedRows
if (selection.indexOf(row) === -1) {
console.log('Row unchecked:', row);
console.log('过滤前:', this.pConsumeRows);
var newPConsumeRows = [];
this.pConsumeRows.forEach(item=>{
if (item.workorderCode!=row.workorderCode
|| item.materialCode!=row.materialCode) {
newPConsumeRows.push(item)
}
})
this.pConsumeRows = newPConsumeRows;
console.log('过滤后:', this.pConsumeRows);
}
},
// all(zxl)
allConsumeSelection(selection, row) {
const allRows = this.pConsumeRows.concat(selection)
this.pConsumeRows = allRows.reduce((acc, cur) => {
const hasDuplicate = acc.some(item => item.materialCode === cur.materialCode
@ -1364,7 +1432,8 @@ export default {
this.consumeRows = this.pConsumeRows;
if ( this.consumeRows==0) {
this.$modal.msgError(`请选择数据`);
this.$modal.msgError(`请选择要修改的物料数据!`);
this.loading = false;
return false;
}

Loading…
Cancel
Save