两位小数
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="请款金额" align="right" min-width="100" prop="请款金额">
|
<el-table-column label="请款金额" align="right" min-width="100" prop="请款金额">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.请款金额 }}
|
{{ Number(scope.row.请款金额).toFixed(2) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="请款人" align="center" min-width="100">
|
<el-table-column label="请款人" align="center" min-width="100">
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<el-table-column label="审核" align="center" width="320">
|
<el-table-column label="审核" align="center" width="320">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-popover placement="right" width="400" trigger="click">
|
<el-popover placement="right" width="400" trigger="click">
|
||||||
<el-table v-show="scope.row.类别==='采购'" :data="gridData2" stripe size="mini" show-summary>
|
<el-table v-show="scope.row.类别==='采购'" :data="gridData2" :summary-method="getSummaries" stripe size="mini" show-summary>
|
||||||
<el-table-column width="50" align="center" type="index" label="序号"/>
|
<el-table-column width="50" align="center" type="index" label="序号"/>
|
||||||
<el-table-column min-width="150" align="center" label="采购合同编号">
|
<el-table-column min-width="150" align="center" label="采购合同编号">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column min-width="100" align="center" label="合同总额" prop="请款金额">
|
<el-table-column min-width="100" align="center" label="合同总额" prop="请款金额">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.请款金额 }}
|
{{ Number(scope.row.请款金额).toFixed(2) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -242,6 +242,33 @@ export default {
|
|||||||
this.fetchData()
|
this.fetchData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 合计
|
||||||
|
getSummaries(param) {
|
||||||
|
const { columns, data } = param
|
||||||
|
const sums = []
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = '合计'
|
||||||
|
return
|
||||||
|
} else if (index === 2) {
|
||||||
|
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] = sums[index].toFixed(2) + ' 元'
|
||||||
|
} else {
|
||||||
|
sums[index] = 'N/A'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return sums
|
||||||
|
},
|
||||||
fetchData() {
|
fetchData() {
|
||||||
this.searchTable()
|
this.searchTable()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="请款金额" align="right" min-width="100" prop="请款金额">
|
<el-table-column label="请款金额" align="right" min-width="100" prop="请款金额">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.请款金额 }}
|
{{ Number(scope.row.请款金额).toFixed(2) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="请款人" align="center" min-width="100">
|
<el-table-column label="请款人" align="center" min-width="100">
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<el-table-column label="审核" align="center" width="320">
|
<el-table-column label="审核" align="center" width="320">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-popover placement="right" width="400" trigger="click">
|
<el-popover placement="right" width="400" trigger="click">
|
||||||
<el-table v-show="scope.row.类别==='采购'" :data="gridData1" stripe size="mini" show-summary>
|
<el-table v-show="scope.row.类别==='采购'" :data="gridData1" :summary-method="getSummaries" stripe size="mini" show-summary>
|
||||||
<el-table-column width="50" align="center" type="index" label="序号"/>
|
<el-table-column width="50" align="center" type="index" label="序号"/>
|
||||||
<el-table-column min-width="150" align="center" label="采购合同编号">
|
<el-table-column min-width="150" align="center" label="采购合同编号">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column min-width="100" align="center" label="合同总额" prop="请款金额">
|
<el-table-column min-width="100" align="center" label="合同总额" prop="请款金额">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.请款金额 }}
|
{{ Number(scope.row.请款金额).toFixed(2) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -252,6 +252,33 @@ export default {
|
|||||||
this.searchTable()
|
this.searchTable()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 合计
|
||||||
|
getSummaries(param) {
|
||||||
|
const { columns, data } = param
|
||||||
|
const sums = []
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = '合计'
|
||||||
|
return
|
||||||
|
} else if (index === 2) {
|
||||||
|
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] = sums[index].toFixed(2) + ' 元'
|
||||||
|
} else {
|
||||||
|
sums[index] = 'N/A'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return sums
|
||||||
|
},
|
||||||
fetchData() {
|
fetchData() {
|
||||||
this.searchTable()
|
this.searchTable()
|
||||||
this.searchTable2()
|
this.searchTable2()
|
||||||
|
|||||||
@@ -172,11 +172,6 @@
|
|||||||
{{ scope.row.发票号 }}
|
{{ scope.row.发票号 }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="供应商" align="center" min-width="250" show-overflow-tooltip>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
{{ scope.row.供应商名称 }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="到票金额" align="center" min-width="70">
|
<el-table-column label="到票金额" align="center" min-width="70">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ Number(scope.row.开票金额).toFixed(2) }}
|
{{ Number(scope.row.开票金额).toFixed(2) }}
|
||||||
|
|||||||
Reference in New Issue
Block a user