|
@@ -8,6 +8,8 @@
|
|
:tableData="tableData.data"
|
|
:tableData="tableData.data"
|
|
:loading="loading"
|
|
:loading="loading"
|
|
tooltip-effect="dark"
|
|
tooltip-effect="dark"
|
|
|
|
+ show-summary
|
|
|
|
+ :summary-method="getSummaries"
|
|
@selection-change="handleSelectionChange"
|
|
@selection-change="handleSelectionChange"
|
|
>
|
|
>
|
|
<div slot="toolbar" class="inner-toolbar">
|
|
<div slot="toolbar" class="inner-toolbar">
|
|
@@ -47,12 +49,12 @@
|
|
width="55">
|
|
width="55">
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<!-- <el-table-column label="创建时间" :formatter="MixinUnixToDate" prop="create_time" sortable width="160"></el-table-column>-->
|
|
<!-- <el-table-column label="创建时间" :formatter="MixinUnixToDate" prop="create_time" sortable width="160"></el-table-column>-->
|
|
- <el-table-column v-if="params.type !== '2'" label="项目" min-width="180" show-overflow-tooltip>
|
|
|
|
|
|
+ <el-table-column v-if="params.type !== '2'" label="项目" min-width="180" show-overflow-tooltip sortable>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-button round size="mini" @click="gotoOrder(scope.row.order_no)">{{scope.row.order_name}}</el-button>
|
|
<el-button round size="mini" @click="gotoOrder(scope.row.order_no)">{{scope.row.order_name}}</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="产品名称" min-width="220" show-overflow-tooltip>
|
|
|
|
|
|
+ <el-table-column label="产品名称" min-width="220" prop="name" show-overflow-tooltip sortable>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<div class="goods-info">
|
|
<div class="goods-info">
|
|
<div class="goods-image" style="margin: 0 20px;">
|
|
<div class="goods-image" style="margin: 0 20px;">
|
|
@@ -66,7 +68,7 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="生产编码" prop="no" width="130">
|
|
|
|
|
|
+ <el-table-column label="生产编码" prop="no" width="130" sortable>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-button round size="mini" @click="gotoGoods(scope.row.good_id)">{{ scope.row.no }}</el-button>
|
|
<el-button round size="mini" @click="gotoGoods(scope.row.good_id)">{{ scope.row.no }}</el-button>
|
|
</template>
|
|
</template>
|
|
@@ -338,7 +340,63 @@ export default {
|
|
delete this.params.produce_status
|
|
delete this.params.produce_status
|
|
}
|
|
}
|
|
this.GET_List()
|
|
this.GET_List()
|
|
- console.log('========', e)
|
|
|
|
|
|
+ },
|
|
|
|
+ getSummaries(param) {
|
|
|
|
+ const { columns, data } = param
|
|
|
|
+ const sums = []
|
|
|
|
+ columns.forEach((column, index) => {
|
|
|
|
+ if (index === 0) {
|
|
|
|
+ sums[index] = '总数'
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if (column.label === '需产数量') {
|
|
|
|
+ let qty = 0
|
|
|
|
+ let producedQty = 0
|
|
|
|
+ if (this.params.type !== '2') {
|
|
|
|
+ qty = data.map(item => Number(item['qty']))
|
|
|
|
+ producedQty = data.map(item => Number(item['produced_qty']))
|
|
|
|
+ } else {
|
|
|
|
+ qty = data.map(item => Number(item['count1']))
|
|
|
|
+ producedQty = data.map(item => Number(item['count2']))
|
|
|
|
+ }
|
|
|
|
+ const qtyCount = qty.reduce((prev, curr) => {
|
|
|
|
+ const value = Number(curr)
|
|
|
|
+ if (!isNaN(value)) {
|
|
|
|
+ return prev + curr
|
|
|
|
+ } else {
|
|
|
|
+ return prev
|
|
|
|
+ }
|
|
|
|
+ }, 0)
|
|
|
|
+ const producedCount = producedQty.reduce((prev, curr) => {
|
|
|
|
+ const value = Number(curr)
|
|
|
|
+ if (!isNaN(value)) {
|
|
|
|
+ return prev + curr
|
|
|
|
+ } else {
|
|
|
|
+ return prev
|
|
|
|
+ }
|
|
|
|
+ }, 0)
|
|
|
|
+ sums[index] = qtyCount - producedCount
|
|
|
|
+ sums[index] += ' 件'
|
|
|
|
+ } else if (column.property === 'produced_qty' || column.property === 'qty' || column.property === 'shipped_qty' || column.property === 'count1' || column.property === 'count2') {
|
|
|
|
+ const values = data.map(item => Number(item[column.property]))
|
|
|
|
+ if (!values.every(value => isNaN(value))) {
|
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
|
+ const value = Number(curr)
|
|
|
|
+ if (!isNaN(value)) {
|
|
|
|
+ return prev + curr
|
|
|
|
+ } else {
|
|
|
|
+ return prev
|
|
|
|
+ }
|
|
|
|
+ }, 0)
|
|
|
|
+ sums[index] += ' 件'
|
|
|
|
+ } else {
|
|
|
|
+ sums[index] = 'N/A'
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ sums[index] = 'N/A'
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return sums
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|