增加一列剩余可入库箱数

main
huojin\hj 2025-07-23 14:52:06 +08:00
parent 08299eabda
commit 7e72b11fdf
1 changed files with 85 additions and 50 deletions

View File

@ -1,4 +1,3 @@
<template>
<div class="div1">
@ -63,7 +62,9 @@
:data="tableData"
id="educe-table"
ref="tableData"
style="width: 100%;">
style="width: 100%;"
:span-method="objectSpanMethod"
>
<el-table-column
type="selection"
width="55">
@ -140,6 +141,16 @@
</template>
</el-table-column>
<el-table-column
label="剩余可入库箱数"
width="110"
align="center"
>
<template slot-scope="scope">
<span style="font-weight: bold">{{ syQty }}</span>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@ -156,6 +167,7 @@
<script>
import {downloadExcel} from '@/util/excelUtils';
export default {
data() {
return {
@ -222,6 +234,12 @@ export default {
}, computed: {
MaxHeight() {
return window.innerHeight - 240 + "px";
},
syQty() {
//
let mzkSum = this.tableData.reduce((total, row) => total + (Number(row.mzk) || 0), 0);
let kzkSum = this.tableData.reduce((total, row) => total + (Number(row.kzk) || 0), 0);
return 30500 - mzkSum - kzkSum;
}
},
mounted: function () {
@ -359,6 +377,23 @@ export default {
this.isShow = false;
this.param = {};
},
objectSpanMethod({row, column, rowIndex, columnIndex}) {
//
if (column.label === '剩余可入库箱数') {
if (rowIndex === 0) {
return {
rowspan: this.tableData.length,
colspan: 1
};
} else if (rowIndex > 0 && rowIndex < this.tableData.length) {
return {
rowspan: 0,
colspan: 0
};
}
}
//
}
}
}
</script>