This commit is contained in:
zds
2022-12-15 16:29:01 +08:00
parent 3fca2fc149
commit b6f7e921bd
9 changed files with 2166 additions and 111 deletions

View File

@@ -42,8 +42,11 @@
<el-table
ref="table"
:data="tableDtl"
style="width: 100%;"
style="width: 100%;background: transparent;overflow:auto;"
:max-height="590"
border
show-summary
:summary-method="getSummaries"
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
@@ -103,6 +106,7 @@ export default {
report.query4().then(res => {
this.XLList = res
})
this.MyQuery2()
},
/**
* 接受父组件传值
@@ -135,6 +139,43 @@ export default {
this.fullscreenLoading = false
})
},
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 === 'sumqty') {
const total = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = parseFloat(total).toFixed(3)
sums[index]
}
if (column.property === 'notqty') {
const total = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = parseFloat(total).toFixed(3)
sums[index]
}
})
return sums
},
MyQuery2() {
this.fullscreenLoading = true
report.query3(this.queryrow).then(res => {