This commit is contained in:
zds
2022-10-14 12:17:51 +08:00
parent 91a9c53d5a
commit 89f4859034
7 changed files with 168 additions and 46 deletions

View File

@@ -259,6 +259,7 @@
style="width: 100%;"
size="mini"
show-summary
:summary-method="getSummaries"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
@@ -534,6 +535,29 @@ export default {
this.form.accept_pcsn = res.accept_pcsn
})
},
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计'
return
}
const values = data.map(item => Number(item[column.property]))
if (column.property === 'formula_qty') {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index]
}
})
return sums
},
autoCalculation() {
this.fullscreenLoading = true
crudacceptformula.autoCalculation(this.form).then(res => {

View File

@@ -228,6 +228,8 @@
:data="tableData"
style="width: 100%;"
size="mini"
show-summary
:summary-method="getSummaries"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
@@ -362,6 +364,29 @@ export default {
this.form.liquid_qty = this.form.liquid_rate * this.form.accept_qty / 100.0
})
},
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计'
return
}
const values = data.map(item => Number(item[column.property]))
if (column.property === 'formula_qty') {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index]
}
})
return sums
},
close() {
this.$emit('update:dialogShow', false)
this.form = {}