Browse Source

Merge branch 'master' into 'master'

修改页面分页合计至后台计算

See merge request lighter/vue-intergration-platform!26
huangshuhua 2 years ago
parent
commit
7107dbb531

+ 27 - 57
src/views/medical-insurance/statistical/CssybCsTj.vue

@@ -49,13 +49,12 @@
         <el-table-column prop="cyks" label="出院科室" width="130"></el-table-column>
         <el-table-column prop="jssj" label="结算时间" width="140" align="center"></el-table-column>
       </el-table>
+      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
+        :page-sizes="[20, 30, 40, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
+        :total="returnData.length" style="margin-top: 5px">
+      </el-pagination>
     </template>
   </page-layer>
-  <el-footer style="height: 40px">
-    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
-      :page-sizes="[20, 30, 40, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
-      :total="returnData.length" style="margin-top: 5px"></el-pagination>
-  </el-footer>
 </template>
 <script>
 import { reactive, ref } from '@vue/reactivity'
@@ -72,7 +71,7 @@ import PageLayer from "@/layout/PageLayer";
 export default {
   setup() {
     const windowSize = store.state.app.windowSize;
-    const tableHeight = windowSize.h / 1.02;
+    const tableHeight = windowSize.h / 1.07;
     let start = formatDate(clockinShortcuts[0].value[0]);
     let end = formatDate(clockinShortcuts[0].value[1]);
     const handleSelect = (item) => { };
@@ -100,6 +99,7 @@ export default {
     });
     const dateRange = ref([]);
     const returnData = ref([]);
+    let totalData = {};
     const pageSize = ref(30);
     const currentPage = ref(1);
     const handleSizeChange = (val) => {
@@ -113,8 +113,7 @@ export default {
         let dateS = getDateRangeFormatDate(dateRange.value);
         queryTerm.startTime = dateS.startTime;
         queryTerm.endTime = dateS.endTime;
-      }
-      else {
+      } else {
         queryTerm.startTime = start;
         queryTerm.endTime = end;
         ElMessage({
@@ -129,12 +128,9 @@ export default {
       queryTerm.zyh = zyh.value;
       selectCssYbCsTj(queryTerm)
         .then((res) => {
-          returnData.value = res;
+          returnData.value = res.data;
+          totalData = res
         })
-        .catch(() => {
-          returnData.value = [];
-        });
-      returnData.value = [];
     };
     const filterInsurName = () => {
       if (insurId.value == "1") {
@@ -147,54 +143,28 @@ export default {
         return "";
       }
     };
-    let sum = {};
     const getSummaries = (param) => {
-      const { columns, data } = param;
+      const { columns } = param;
       const sums = [];
-      let bxblIndex, zfyIndex, tczfIndex;
       columns.forEach((column, index) => {
         if (index === 0) {
           sums[index] = "合计";
           return;
         }
-        if (column.property === "doctor" || column.property === "zyh" || column.property === "zlfs" || column.property === "ssmc") {
-          sums[index] = "";
-          return;
-        }
-        if (column.property === "bxbl") {
-          bxblIndex = index;
-        }
         if (column.property === "zfy") {
-          zfyIndex = index;
-        }
-        if (column.property === "tczf") {
-          tczfIndex = index;
-        }
-        const values = data.map((item) => Number(item[column.property]));
-        if (!values.every((value) => isNaN(value))) {
-          let hj = values.reduce((prev, curr) => {
-            const value = Number(curr);
-            if (!isNaN(value)) {
-              return prev + curr;
-            }
-            else {
-              return prev;
-            }
-          }, 0);
-          let reg = /rs$/;
-          if (!reg.test(column.property)) {
-            sums[index] = hj.toFixed(2);
-          }
-          else {
-            sums[index] = hj;
-          }
-        }
-        else {
-          sums[index] = "";
+          sums[index] = totalData.zfy;
+        } else if (column.property === "yjzf") {
+          sums[index] = totalData.yjzf;
+        } else if (column.property === "tczf") {
+          sums[index] = totalData.tczf;
+        } else if (column.property === "bal") {
+          sums[index] = totalData.bal;
+        } else if (column.property === "bxbl") {
+          sums[index] = totalData.bxbl;
+        } else if (column.property === "score") {
+          sums[index] = totalData.score;
         }
       });
-      sums[bxblIndex] = ((sums[tczfIndex] / sums[zfyIndex]) * 100).toFixed(2);
-      sum = sums;
       return sums;
     };
     // ----------------导出--------------------
@@ -232,12 +202,12 @@ export default {
         };
         let hj = {
           cyks: "合计",
-          zfy: sum[5],
-          yjzf: sum[6],
-          tczf: sum[7],
-          bal: sum[8],
-          bxbl: sum[9],
-          score: sum[10],
+          zfy: totalData.zfy,
+          yjzf: totalData.yjzf,
+          tczf: totalData.tczf,
+          bal: totalData.bal,
+          bxbl: totalData.bxbl,
+          score: totalData.score,
         };
         returnData.value.push(hj);
         Export(returnData.value, title, "市医保测算统计");

+ 32 - 8
src/views/medical-insurance/statistical/CssybJsTj.vue

@@ -152,7 +152,7 @@
       <el-button icon="Download" type="primary" @click="exportBrDetailExcel">导出Excel</el-button>
     </div>
     <el-table :data="setlBrdetails.slice((currentPage - 1) * pageSize, currentPage * pageSize)"
-      :height="tableHeight - 160" show-summary :summary-method="getSummaries" highlight-current-row stripe>
+      :height="tableHeight - 160" show-summary :summary-method="getSummaries1" highlight-current-row stripe>
       <el-table-column fixed prop="deptName" label="科室" width="100"></el-table-column>
       <el-table-column fixed prop="doctor" label="医生" width="80" align="center"></el-table-column>
       <el-table-column prop="zyh" label="住院号" width="80" align="center"></el-table-column>
@@ -330,6 +330,7 @@ export default {
     // -------------- 病人详情统计 -----------------
     const setlBrdetails = ref([])
     const showBrSetldetails = ref(false)
+    let heji = {}
     // 科室钻取到医生查询
     const brJsdetails = (row) => {
       queryTerm.deptId = row.deptId
@@ -338,9 +339,9 @@ export default {
       selectBrJsTj(selectInfo)
         .then((res) => {
           showBrSetldetails.value = true
-          setlBrdetails.value = res
-        })
-        .catch(() => {
+          setlBrdetails.value = res.data
+          heji = res.total
+        }).catch(() => {
           setlBrdetails.value = []
         })
     }
@@ -366,9 +367,6 @@ export default {
     }
 
     // -------------- 合计 -----------------
-
-    let sum = {}
-
     const getSummaries = (param) => {
       const { columns, data } = param
       const sums = []
@@ -417,7 +415,32 @@ export default {
         }
       })
       sums[bxblIndex] = ((sums[tczfIndex] / sums[zfyIndex]) * 100).toFixed(2)
-      sum = sums
+      return sums
+    }
+
+    // -------------- 分页合计行(需要统计全部数据的合计,而不是当前页数据的合计) -----------------
+    const getSummaries1 = (param) => {
+      const { columns } = param
+      const sums = []
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '合计'
+          return
+        }
+        if (column.property === 'zfy') {
+          sums[index] = heji.zfy
+        } else if (column.property === 'tczf') {
+          sums[index] = heji.tczf
+        } else if (column.property === 'yjzf') {
+          sums[index] = heji.yjzf
+        } else if (column.property === 'zfz') {
+          sums[index] = heji.zfz
+        } else if (column.property === 'bal') {
+          sums[index] = heji.bal
+        } else if (column.property === 'bxbl') {
+          sums[index] = heji.bxbl
+        }
+      })
       return sums
     }
 
@@ -485,6 +508,7 @@ export default {
       exportYsDetailExcel,
       exportBrDetailExcel,
       getSummaries,
+      getSummaries1,
       handleSizeChange,
       handleCurrentChange,
     }