This commit is contained in:
liushuai
2020-03-19 17:53:12 +08:00
6 changed files with 55 additions and 92 deletions

View File

@@ -35,27 +35,9 @@
</div>
</el-card>
<el-card style="width: 100%">
<el-table
v-loading="loading"
:data="tableData"
highlight-current-row
border
stripe
size="mini"
style="width: 100%"
height="750"
@sort-change="sortChange">
<el-table-column
label="序号"
align="center"
type="index"
width="50"/>
<el-table-column
label="进程"
align="center"
prop="进程"
sortable="custom"
width="80px">
<el-table v-loading="loading" :data="tableData" highlight-current-row border stripe size="mini" style="width: 100%" height="750" @sort-change="sortChange">
<el-table-column label="序号" align="center" type="index" width="50"/>
<el-table-column label="进程" align="center" prop="进程" sortable="custom" width="80px">
<template slot-scope="scope">
<span v-if="Number(scope.row.是否到货)===0" type="warning" size="mini">未到</span>
<span v-if="Number(scope.row.是否到货)===1" type="primary" size="mini">已到</span>
@@ -200,8 +182,8 @@ export default {
// this.getTableData()
},
methods: {
formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => {
formatJson(column, tableData) {
return tableData.map(v => column.map(j => {
return v[j]
}))
},
@@ -283,9 +265,8 @@ export default {
check2 = 0
}
searchTable(check, this.supplierNameValue, check1, this.partNumber, check2, this.MaterialsValue, check3, this.dateRange[0], this.dateRange[1], this.ordername, this.order, this.pageSize, this.pageCurrent).then(response => {
console.log(response)
this.tableData = response.data.rows
this.total = response.data.total
this.tableData = response.data.result
this.total = parseInt(response.data.output[0].ItemCount)
this.loading = false
})
},

View File

@@ -43,6 +43,7 @@
:row-key="getRowKeys"
:expand-row-keys="expands"
:header-cell-style="{fontFamily:'YouYuan',fontSize:'13px',fontWeight:200}"
:summary-method="getSummaries1"
border
stripe
style="margin-top: 3px;"
@@ -271,6 +272,31 @@ export default {
})
return sums
},
getSummaries1(param) { // 合计
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计'
} else if (index === 3) {
const values = data.map(item => Number(parseFloat(item['请款金额'])))
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] = sums[index].toFixed(2) + ' 元'
} else {
sums[index] = 'N/A'
}
}
})
return sums
},
exportExcel() {
this.dateRange ? this.check1 = 1 : (this.check1 = 0, this.dateRange = '')
this.supplierName0 ? this.check2 = 1 : (this.check2 = 0, this.supplierName0 = '')