Browse Source

私有应收、平台应收所有结算报表加合计金额行

@dongkboy 2 months ago
parent
commit
f48cd7a1b3

+ 41 - 20
src/views/platform/platformReport.vue

@@ -47,8 +47,8 @@
             </el-col>
           </el-row>
         </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="totalReceivable" label="应收金额" width="240"></el-table-column>
           <el-table-column prop="contactPerson" label="对接人" width="240"></el-table-column>
@@ -92,9 +92,10 @@
             </el-col>
           </el-row>
         </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="settledAmount" 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-form-item prop="companyId" label="保险公司">
                 <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-form-item>
             </el-col>
@@ -155,7 +155,8 @@
             </el-col>
           </el-row>
         </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="companyName" label="保险公司" width="200"></el-table-column>
           <el-table-column prop="contactPerson" label="对接人" width="150"></el-table-column>
@@ -240,33 +241,53 @@ const handleCurrentChange = (page) => {
   pages.value = page
 }
 
-const getSummaries = (param) => {
+const getSummaries = (param, list) => {
+  console.log(param)
   const { columns, data } = param
   const sums: (string | VNode)[] = []
+  // 指定需要计算的字段列表(可根据需求添加字段名)
+  const specifiedFields = list || [] // 替换为您需要的字段名
+
   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
 }
 
@@ -416,7 +437,7 @@ const initOption = () => {
     })
   })
 }
-const  handleSettlementDetail = (row) => {
+const handleSettlementDetail = (row) => {
   activeName.value = '3'
   recordForm2.value.companyId = row.id
   initData3()

+ 34 - 13
src/views/receivable/documentary/documentaryReport.vue

@@ -42,7 +42,7 @@
             </el-col>
           </el-row>
         </el-form>
-        <el-table height="calc(100% - 100px)" :data="recordData" row-key="id" :summary-method="getSummaries"
+        <el-table height="calc(100% - 100px)" :data="recordData" row-key="id" :summary-method="val=>getSummaries(val,['settlementPaymentDifference'])"
           show-summary>
           <el-table-column prop="companyName" label="保险公司" width="300"></el-table-column>
           <el-table-column prop="totalReceivable" label="累计应收"></el-table-column>
@@ -133,7 +133,7 @@
             </el-col>
           </el-row>
         </el-form>
-        <el-table height="calc(100% - 192px)" :data="recordData1">
+        <el-table height="calc(100% - 192px)" :data="recordData1" show-summary :summary-method="val=>getSummaries(val,['taxPoint','actualReceivedAmount','settlementPaymentDifference'])">
           <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="invoiceParty" label="开票方" width="150"></el-table-column>
@@ -415,36 +415,57 @@ const handleCurrentChange = (page, type) => {
   }
 }
 
-const getSummaries = (param) => {
+const getSummaries = (param, list) => {
+  console.log(param)
   const { columns, data } = param
   const sums: (string | VNode)[] = []
+  // 指定需要计算的字段列表(可根据需求添加字段名)
+  const specifiedFields = list // 替换为您需要的字段名
+
   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
 }
 
+
 // 结算记录
 let recordForm = ref({})
 let recordForm1 = ref({})

+ 7 - 6
src/views/receivable/handingFee/report.vue

@@ -64,7 +64,8 @@
             </el-col>
           </el-row>
         </el-form>
-        <el-table height="calc(100% - 200px)" :data="recordData" show-summary :summary-method="getSummaries">
+        <el-table height="calc(100% - 200px)" :data="recordData" show-summary
+          :summary-method="val => getSummaries(val, ['totalReceivable', 'totalOverinflatedAmount', 'superviseFee', 'SxfInvoicedAmount', 'sxfSettledAmount', 'SxfUnInvoicedAmount', 'sxfUnSettledAmount', 'settlementPaymentDifference'])">
           <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>
@@ -155,7 +156,7 @@
             </el-col>
           </el-row>
         </el-form>
-        <el-table height="calc(100% - 192px)" :data="recordData1">
+        <el-table height="calc(100% - 192px)" :data="recordData1" show-summary :summary-method="val=>getSummaries(val,['taxPoint', 'actualReceivedAmount'])">
           <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="invoiceParty" label="开票方" width="150"></el-table-column>
@@ -235,7 +236,7 @@
             </el-col>
           </el-row>
         </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','taxPremium','syPremium','jqSuperviseCostsProportion','sySuperviseCostsProportion'])">
           <el-table-column prop="invoiceId" label="开票记录编号" width="200"></el-table-column>
           <el-table-column prop="companyName" label="保险公司" width="200"></el-table-column>
           <el-table-column prop="invoiceParty" label="开票方" width="100"></el-table-column>
@@ -311,7 +312,7 @@
             </el-col>
           </el-row>
         </el-form>
-        <el-table height="calc(100% - 192px)" :data="recordData3">
+        <el-table height="calc(100% - 192px)" :data="recordData3" show-summary :summary-method="val=>getSummaries(val,['receivableSuperviseCosts','jyPremium','jySuperviseCostsProportion'])">
           <el-table-column prop="invoiceId" label="开票记录编号" width="200"></el-table-column>
           <el-table-column prop="companyName" label="保险公司" width="200"></el-table-column>
           <el-table-column prop="invoiceParty" label="开票方" width="100"></el-table-column>
@@ -462,12 +463,12 @@ const handleCurrentChange = (page, type) => {
   }
 }
 
-const getSummaries = (param) => {
+const getSummaries = (param, list) => {
   console.log(param)
   const { columns, data } = param
   const sums: (string | VNode)[] = []
   // 指定需要计算的字段列表(可根据需求添加字段名)
-  const specifiedFields = ['totalReceivable'] // 替换为您需要的字段名
+  const specifiedFields = list // 替换为您需要的字段名
 
   columns.forEach((column, index) => {
     if (index === 0) {