增加一列剩余可入库箱数
							parent
							
								
									08299eabda
								
							
						
					
					
						commit
						7e72b11fdf
					
				| 
						 | 
					@ -1,4 +1,3 @@
 | 
				
			||||||
 | 
					 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
  <div class="div1">
 | 
					  <div class="div1">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,7 +62,9 @@
 | 
				
			||||||
        :data="tableData"
 | 
					        :data="tableData"
 | 
				
			||||||
        id="educe-table"
 | 
					        id="educe-table"
 | 
				
			||||||
        ref="tableData"
 | 
					        ref="tableData"
 | 
				
			||||||
        style="width: 100%;">
 | 
					        style="width: 100%;"
 | 
				
			||||||
 | 
					        :span-method="objectSpanMethod"
 | 
				
			||||||
 | 
					    >
 | 
				
			||||||
      <el-table-column
 | 
					      <el-table-column
 | 
				
			||||||
          type="selection"
 | 
					          type="selection"
 | 
				
			||||||
          width="55">
 | 
					          width="55">
 | 
				
			||||||
| 
						 | 
					@ -140,6 +141,16 @@
 | 
				
			||||||
        </template>
 | 
					        </template>
 | 
				
			||||||
      </el-table-column>
 | 
					      </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-table>
 | 
				
			||||||
    <el-pagination
 | 
					    <el-pagination
 | 
				
			||||||
        @size-change="handleSizeChange"
 | 
					        @size-change="handleSizeChange"
 | 
				
			||||||
| 
						 | 
					@ -156,6 +167,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
import {downloadExcel} from '@/util/excelUtils';
 | 
					import {downloadExcel} from '@/util/excelUtils';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
  data() {
 | 
					  data() {
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
| 
						 | 
					@ -222,6 +234,12 @@ export default {
 | 
				
			||||||
  }, computed: {
 | 
					  }, computed: {
 | 
				
			||||||
    MaxHeight() {
 | 
					    MaxHeight() {
 | 
				
			||||||
      return window.innerHeight - 240 + "px";
 | 
					      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 () {
 | 
					  mounted: function () {
 | 
				
			||||||
| 
						 | 
					@ -359,6 +377,23 @@ export default {
 | 
				
			||||||
      this.isShow = false;
 | 
					      this.isShow = false;
 | 
				
			||||||
      this.param = {};
 | 
					      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>
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue