|
|
@@ -37,8 +37,8 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item prop="invoiceType" label="应收项">
|
|
|
- <el-select v-model="recordForm.invoiceRiskType" clearable>
|
|
|
+ <el-form-item prop="accountsReceivable" label="应收项">
|
|
|
+ <el-select v-model="recordForm.accountsReceivable" clearable>
|
|
|
<el-option v-for="item in optionObj['invoice_risk_type']" :key="item.value" :value="item.value"
|
|
|
:label="item.label"></el-option>
|
|
|
</el-select>
|
|
|
@@ -64,8 +64,7 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
- <el-table height="calc(100% - 100px)" :data="recordData" row-key="id" :summary-method="getSummaries"
|
|
|
- show-summary>
|
|
|
+ <el-table height="calc(100% - 200px)" :data="recordData" show-summary :summary-method="getSummaries">
|
|
|
<el-table-column prop="companyName" label="保险公司" width="300"></el-table-column>
|
|
|
<el-table-column prop="totalReceivable" label="应收金额"></el-table-column>
|
|
|
<el-table-column prop="totalOverinflatedAmount" label="虚增金额合计"></el-table-column>
|
|
|
@@ -464,32 +463,52 @@ const handleCurrentChange = (page, type) => {
|
|
|
}
|
|
|
|
|
|
const getSummaries = (param) => {
|
|
|
+ console.log(param)
|
|
|
const { columns, data } = param
|
|
|
const sums: (string | VNode)[] = []
|
|
|
+ // 指定需要计算的字段列表(可根据需求添加字段名)
|
|
|
+ const specifiedFields = ['totalReceivable'] // 替换为您需要的字段名
|
|
|
+
|
|
|
columns.forEach((column, index) => {
|
|
|
if (index === 0) {
|
|
|
- sums[index] = h('div', [
|
|
|
+ sums[index] = h('div', { style: { textDecoration: 'underline' } }, [
|
|
|
'',
|
|
|
])
|
|
|
return
|
|
|
}
|
|
|
- const values = data.map((item) => Number(item[column.property]))
|
|
|
+ // 计算数字类型字段和指定字段
|
|
|
+ const values = data.map((item) => {
|
|
|
+ const val = item[column.property]
|
|
|
+ // 排除空值
|
|
|
+ if (val === '' || val === null || val === undefined) {
|
|
|
+ return NaN
|
|
|
+ }
|
|
|
+ // 如果是数字类型,直接参与计算
|
|
|
+ if (typeof val === 'number') {
|
|
|
+ return val
|
|
|
+ }
|
|
|
+ // 如果字段在指定列表中,尝试转换为数字
|
|
|
+ if (specifiedFields.includes(column.property)) {
|
|
|
+ const num = Number(val)
|
|
|
+ return Number.isNaN(num) ? NaN : num
|
|
|
+ }
|
|
|
+ // 其他情况不参与计算
|
|
|
+ return NaN
|
|
|
+ })
|
|
|
if (!values.every((value) => Number.isNaN(value))) {
|
|
|
- sums[index] = ` ${values.reduce((prev, curr) => {
|
|
|
- const value = Number(curr)
|
|
|
- if (!Number.isNaN(value)) {
|
|
|
+ const total = values.reduce((prev, curr) => {
|
|
|
+ if (!Number.isNaN(curr)) {
|
|
|
return prev + curr
|
|
|
} else {
|
|
|
return prev
|
|
|
}
|
|
|
- }, 0)}`
|
|
|
+ }, 0)
|
|
|
+ // 保留五位小数
|
|
|
+ sums[index] = ` ${total.toFixed(5)}`
|
|
|
} else {
|
|
|
- if (index > 2) {
|
|
|
- sums[index - 1] = '0'
|
|
|
- }
|
|
|
+ sums[index] = '-'
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
return sums
|
|
|
}
|
|
|
|
|
|
@@ -513,7 +532,7 @@ const initData1 = () => {
|
|
|
companyId: recordForm.value.companyId,
|
|
|
startTime: recordForm.value.time?.[0],
|
|
|
endTime: recordForm.value.time?.[1],
|
|
|
- invoiceRiskType: recordForm.value.invoiceRiskType,
|
|
|
+ accountsReceivable: recordForm.value.accountsReceivable,
|
|
|
invoiceStartTime: recordForm.value.invoiceTime?.[0],
|
|
|
invoiceEndTime: recordForm.value.invoiceTime?.[1],
|
|
|
settlementStartTime: recordForm.value.settlementTime?.[0],
|