|
@@ -47,8 +47,8 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
- <el-table height="calc(100% - 100px)" :data="recordData" row-key="companyId" :summary-method="getSummaries"
|
|
|
|
|
- show-summary>
|
|
|
|
|
|
|
+ <el-table height="calc(100% - 190px)" :data="recordData" row-key="companyId"
|
|
|
|
|
+ :summary-method="val => getSummaries(val)" show-summary>
|
|
|
<el-table-column prop="companyName" label="保险公司" width="240"></el-table-column>
|
|
<el-table-column prop="companyName" label="保险公司" width="240"></el-table-column>
|
|
|
<el-table-column prop="totalReceivable" label="应收金额" width="240"></el-table-column>
|
|
<el-table-column prop="totalReceivable" label="应收金额" width="240"></el-table-column>
|
|
|
<el-table-column prop="contactPerson" label="对接人" width="240"></el-table-column>
|
|
<el-table-column prop="contactPerson" label="对接人" width="240"></el-table-column>
|
|
@@ -92,9 +92,10 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
- <el-table height="calc(100% - 142px)" :data="recordData1">
|
|
|
|
|
- <el-table-column prop="receiver" label="对接人" ></el-table-column>
|
|
|
|
|
- <el-table-column prop="companyName" label="保险公司" ></el-table-column>
|
|
|
|
|
|
|
+ <el-table height="calc(100% - 142px)" :data="recordData1" show-summary
|
|
|
|
|
+ :summary-method="val => getSummaries(val, ['totalReceivable','settledAmount','unSettledAmount'])">
|
|
|
|
|
+ <el-table-column prop="receiver" label="对接人"></el-table-column>
|
|
|
|
|
+ <el-table-column prop="companyName" label="保险公司"></el-table-column>
|
|
|
<el-table-column prop="totalReceivable" label="应收总计" width="150"></el-table-column>
|
|
<el-table-column prop="totalReceivable" label="应收总计" width="150"></el-table-column>
|
|
|
<el-table-column prop="settledAmount" label="已结算总计" width="150"></el-table-column>
|
|
<el-table-column prop="settledAmount" label="已结算总计" width="150"></el-table-column>
|
|
|
<el-table-column prop="unSettledAmount" label="未结算总计" width="150"></el-table-column>
|
|
<el-table-column prop="unSettledAmount" label="未结算总计" width="150"></el-table-column>
|
|
@@ -123,8 +124,7 @@
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item prop="companyId" label="保险公司">
|
|
<el-form-item prop="companyId" label="保险公司">
|
|
|
<el-select v-model="recordForm2.companyId" placeholder="请选择" clearable filterable>
|
|
<el-select v-model="recordForm2.companyId" placeholder="请选择" clearable filterable>
|
|
|
- <el-option v-for="item in companyList" :key="item.id" :value="item.id"
|
|
|
|
|
- :label="item.name"></el-option>
|
|
|
|
|
|
|
+ <el-option v-for="item in companyList" :key="item.id" :value="item.id" :label="item.name"></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
@@ -155,7 +155,8 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
- <el-table height="calc(100% - 192px)" :data="recordData2">
|
|
|
|
|
|
|
+ <el-table height="calc(100% - 192px)" :data="recordData2" show-summary
|
|
|
|
|
+ :summary-method="val => getSummaries(val, ['receivableSuperviseCosts','jqPremium','syPremium','jyPremium','taxPremium','jqSuperviseCostsProportion','sySuperviseCostsProportion','jySuperviseCostsProportion'])">
|
|
|
<el-table-column prop="settlementId" label="结算记录编号" width="200"></el-table-column>
|
|
<el-table-column prop="settlementId" label="结算记录编号" width="200"></el-table-column>
|
|
|
<el-table-column prop="companyName" label="保险公司" width="200"></el-table-column>
|
|
<el-table-column prop="companyName" label="保险公司" width="200"></el-table-column>
|
|
|
<el-table-column prop="contactPerson" label="对接人" width="150"></el-table-column>
|
|
<el-table-column prop="contactPerson" label="对接人" width="150"></el-table-column>
|
|
@@ -240,33 +241,53 @@ const handleCurrentChange = (page) => {
|
|
|
pages.value = page
|
|
pages.value = page
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const getSummaries = (param) => {
|
|
|
|
|
|
|
+const getSummaries = (param, list) => {
|
|
|
|
|
+ console.log(param)
|
|
|
const { columns, data } = param
|
|
const { columns, data } = param
|
|
|
const sums: (string | VNode)[] = []
|
|
const sums: (string | VNode)[] = []
|
|
|
|
|
+ // 指定需要计算的字段列表(可根据需求添加字段名)
|
|
|
|
|
+ const specifiedFields = list || [] // 替换为您需要的字段名
|
|
|
|
|
+
|
|
|
columns.forEach((column, index) => {
|
|
columns.forEach((column, index) => {
|
|
|
if (index === 0) {
|
|
if (index === 0) {
|
|
|
- sums[index] = h('div', [
|
|
|
|
|
|
|
+ sums[index] = h('div', { style: { textDecoration: 'underline' } }, [
|
|
|
'',
|
|
'',
|
|
|
])
|
|
])
|
|
|
return
|
|
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))) {
|
|
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
|
|
return prev + curr
|
|
|
} else {
|
|
} else {
|
|
|
return prev
|
|
return prev
|
|
|
}
|
|
}
|
|
|
- }, 0)}`
|
|
|
|
|
|
|
+ }, 0)
|
|
|
|
|
+ // 保留五位小数
|
|
|
|
|
+ sums[index] = ` ${total.toFixed(5)}`
|
|
|
} else {
|
|
} else {
|
|
|
- if (index > 2) {
|
|
|
|
|
- sums[index - 1] = '0'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ sums[index] = '-'
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
return sums
|
|
return sums
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -416,7 +437,7 @@ const initOption = () => {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
-const handleSettlementDetail = (row) => {
|
|
|
|
|
|
|
+const handleSettlementDetail = (row) => {
|
|
|
activeName.value = '3'
|
|
activeName.value = '3'
|
|
|
recordForm2.value.companyId = row.id
|
|
recordForm2.value.companyId = row.id
|
|
|
initData3()
|
|
initData3()
|