From 8f059b6cc8daf96433ac699543996c9e1260023c Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期五, 30 十月 2026 09:58:04 +0800
Subject: [PATCH] Merge branch 'master' of http://116.62.18.175:6699/r/~yxh/opo-web

---
 src/views/project/statistics/caseStatistics/index.vue |  391 ++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 226 insertions(+), 165 deletions(-)

diff --git a/src/views/project/statistics/caseStatistics/index.vue b/src/views/project/statistics/caseStatistics/index.vue
index 9947593..c2a3f02 100644
--- a/src/views/project/statistics/caseStatistics/index.vue
+++ b/src/views/project/statistics/caseStatistics/index.vue
@@ -1,53 +1,17 @@
 <!--  -->
 <template>
   <div class="app-container">
-    缁╂晥
     <el-form
+      class="opo-query-form"
       :model="queryParams"
       ref="queryForm"
       :inline="true"
+      v-show="showSearch"
       label-width="70px"
     >
-      <el-row :gutter="8">
-        <el-col :span="6">
-          <el-form-item label="涓氬姟浜哄憳" prop="name">
-            <el-input
-              v-model="queryParams.name"
-              placeholder="璇疯緭鍏ュ鍚�"
-              clearable
-              size="small"
-              @keyup.enter.native="handleQuery"
-            />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item align="left" label="涓氬姟缁�" prop="treatmenthospitalno">
-            <org-selecter
-              ref="orgSelecter"
-              :org-type="'3'"
-              v-model="queryParams.treatmenthospitalno"
-            />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label='妗堜緥鐘舵��'>
-            <el-select
-              v-model="queryParams.pabonustype"
-              placeholder="璇烽�夋嫨妗堜緥鐘舵��"
-            >
-              <el-option
-                v-for="item in reportlist"
-                :label="item.label"
-                :value="item.value"
-              >
-              </el-option>
-            </el-select>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row :gutter="8">
-        <el-col :span="12">
-          <el-form-item label="缁熻鏃ユ湡">
+      <el-row >
+        <el-col :span="8">
+          <el-form-item label="鏈堜唤鑼冨洿">
             <el-date-picker
               style="width: 100%"
               v-model="selecttime"
@@ -60,8 +24,33 @@
             >
             </el-date-picker>
           </el-form-item>
+        </el-col>        
+        <el-col :span="5">
+          <el-form-item align="left" label="涓氬姟缁�" prop="treatmenthospitalno">
+            <el-select
+              v-model="queryParams.padeptno"
+              placeholder="璇烽�夋嫨涓氬姟缁�"
+            >
+              <el-option
+                v-for="item in deptList"
+                :label="item.deptName"
+                :value="item.deptId"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
         </el-col>
-
+        <el-col :span="5">
+          <el-form-item label="涓氬姟浜哄憳" prop="name">
+            <el-input
+              v-model="queryParams.pausername"
+              placeholder="璇疯緭鍏ュ鍚�"
+              clearable
+              size="small"
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
+        </el-col>        
         <el-col :span="6">
           <el-form-item>
             <el-button
@@ -79,55 +68,91 @@
       </el-row>
     </el-form>
 
-    <!--<el-table v-loading="loading" border :data="donatebaseinfoList">     -->
-    <el-table v-loading="loading"  :data="jxidata"  ref="table"
-      border
-      max-height="700"
-      highlight-current-row
-      :summary-method="getSummaries"
-      show-summary>
-      <el-table-column label="搴忓彿" align="center" prop="id" width="100">
-      </el-table-column>
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          >瀵煎嚭</el-button
+        >
+      </el-col>
+      <right-toolbar
+        :showSearch.sync="showSearch"
+        @queryTable="getList"
+      ></right-toolbar>
+    </el-row>
 
-      <el-table-column label="缁熻鏈堜唤" align="center" prop="name" />
+    <el-tabs v-model="activeTab">
+      <el-tab-pane label="鎸変笟鍔$粍" name="dept">
+        <el-table
+          v-loading="loading"
+          :data="deptData"
+          ref="deptTable"
+          border
+          max-height="700"
+          highlight-current-row
+          :summary-method="getDeptSummaries"
+          show-summary
+        >
+          <el-table-column label="搴忓彿" align="center" prop="id" width="50" />
+          <el-table-column label="涓氬姟缁�" align="center" prop="deptname" width="250" />
+          <el-table-column label="绱妗堜緥" align="center" prop="caseTotal" width="150" />
+          <el-table-column label="缁堟妗堜緥" align="center" prop="terminationTotal" width="150" />
+        </el-table>
+      </el-tab-pane>
 
-      <el-table-column label="涓氬姟缁�" align="center" prop="name">
-      </el-table-column>
-      <el-table-column label="涓撹亴浜哄憳" align="center" prop="age" />
+      <el-tab-pane label="鎸変汉鍛�" name="person">
+        <el-table
+          v-loading="loading"
+          :data="jxidata"
+          ref="personTable"
+          border
+          max-height="700"
+          highlight-current-row
+          :summary-method="getSummaries"
+          show-summary
+        >
+          <el-table-column label="搴忓彿" align="center" prop="id" width="50" />
+          <el-table-column label="涓氬姟缁�" align="center" prop="deptname" width="250" >      </el-table-column>
+          <el-table-column label="涓撹亴浜哄憳" align="center" prop="reportername" width="150" />
+          <!-- <el-table-column label="鐧昏妗堜緥绱" align="center" prop="casesum" width="100" /> -->
+          <!-- <el-table-column label="娼滃湪鎹愮尞" align="center" prop="workflow0" width="100" />
+          <el-table-column label="鍖诲璇勪及" align="center" prop="workflow1" width="100" />
+          <el-table-column label="瀹跺睘纭" align="center" prop="workflow2" width="100" />
+          <el-table-column label="浼︾悊瀹℃煡" align="center" prop="workflow3" width="100" />
+          <el-table-column label="鍣ㄥ畼鍒嗛厤" align="center" prop="workflow4" width="100" />
+          <el-table-column label="鑾峰彇瑙佽瘉" align="center" prop="workflow5" width="100" />
+          <el-table-column label="鎹愮尞瀹屾垚" align="center" prop="workflow6" width="100" />
+          <el-table-column label="褰掓。鎾ら攢" align="center" prop="workflow7" width="100" />
+          <el-table-column label="妗堜緥褰掓。" align="center" prop="workflow8" width="100" /> -->
+          <el-table-column label="妗堜緥绱" align="center" prop="workflowsum" width="200" />
+          <el-table-column label="缁堟妗堜緥" align="center" prop="terminationcase" width="100" />
 
-      <el-table-column
-        label="妗堜緥鏁伴噺"
-        align="center"
-        prop="treatmenthospitalname"
-      />
-
-      <el-table-column
-        label="鎿嶄綔"
-        align="center"
-        class-name="small-padding fixed-width"
-        fixed="right"
-      >
-        <template slot-scope="scope">
-          <!--           v-if="scope.row.recordstate==2"
- -->
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            
-            >鏄庣粏</el-button
+          <!-- <el-table-column
+            label="鎿嶄綔"
+            align="center"
+            class-name="small-padding fixed-width"
+            fixed="right"
           >
-        </template>
-      </el-table-column>
-    </el-table>
+            <template slot-scope="scope">
+              <el-button size="mini" type="text" icon="el-icon-edit"
+                >鏄庣粏</el-button
+              >
+            </template>
+          </el-table-column> -->
+        </el-table>
+      </el-tab-pane>
+    </el-tabs>
 
-    <pagination
-      v-show="total > 0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
+    <div style="margin: 10px;text-align: right;">
+      <div>
+        鍏� <span style="color:#1890FF ;">{{ tableTotal }}</span> 鏉℃暟鎹�
+      </div>
+    </div>
 
     <!-- 娣诲姞鎴栦慨鏀瑰灞炵‘璁ゅ璇濇 -->
   </div>
@@ -137,12 +162,13 @@
 //杩欓噷鍙互瀵煎叆鍏朵粬鏂囦欢锛堟瘮濡傦細缁勪欢锛屽伐鍏穓s锛岀涓夋柟鎻掍欢js锛宩son鏂囦欢锛屽浘鐗囨枃浠剁瓑绛夛級
 //渚嬪锛歩mport 銆婄粍浠跺悕绉般�� from '銆婄粍浠惰矾寰勩��';
 
-
 import {
   listsfeistatistics,
   listbxiaostatistics,
   listjixstatistics,
-  listanlstatistics
+  listanlstatistics,
+  exportCaseStatistics,
+  exportCaseDeptStatistics
 } from "@/api/project/statistics";
 
 import { listUser } from "@/api/project/organization";
@@ -150,6 +176,7 @@
 import Li_area_select from "@/components/Address";
 import OrgSelecter from "@/views/project/components/orgselect";
 import AnnexUpload from "@/views/project/components/annexupload";
+import { listDept } from "@/api/system/dept";
 
 export default {
   //import寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
@@ -170,11 +197,6 @@
 
       selecttime: "",
       reportervalue: "",
-      reportlist: [
-        { label: "鏈堝害", value: "1" },
-        { label: "瀛e害", value: "2" },
-        { label: "骞村害", value: "3" }
-      ],
       //鐪佸競鍖�
       //榛樿鍊艰缃紝鍙负绌�
       searchAddress: {
@@ -230,6 +252,10 @@
       donatebaseinfoList: [],
       // 鎹愮尞鍩虹琛ㄦ牸鏁版嵁
       jxidata: [],
+      // 褰撳墠椤电锛歞ept=鎸変笟鍔$粍锛宲erson=鎸変汉鍛�
+      activeTab: "dept",
+      // 鎸変笟鍔$粍鑱氬悎鏁版嵁
+      deptData: [],
       // 寮瑰嚭灞傛爣棰�
       title: "",
       // 鏄惁鏄剧ず寮瑰嚭灞�
@@ -238,10 +264,10 @@
       daterangeReporttime: [],
       // 鏌ヨ鍙傛暟
       queryParams: {
-        pageNum: 1,
-        pageSize: 10
+        pabegtime: null,
+        paendtime: null
       },
-
+      deptList: [],
       // 琛ㄥ崟鍙傛暟
       form: {},
       // 琛ㄥ崟鏍¢獙
@@ -260,7 +286,11 @@
     };
   },
   //鐩戝惉灞炴�� 绫讳技浜巇ata姒傚康
-  computed: {},
+  computed: {
+    tableTotal() {
+      return this.activeTab === "dept" ? this.deptData.length : this.jxidata.length;
+    }
+  },
   activated() {},
   mounted() {},
 
@@ -270,57 +300,31 @@
   methods: {
     getTimeList(e) {
       if (this.selecttime != 0) {
-        this.endtime = this.selecttime[1];
-        this.starttime = this.selecttime[0];
-        // if (this.endtime == this.starttime) {
-        let num = Number(this.endtime.slice(5, 7));
-        if (num < 9) {
-          let mon = Number(this.endtime.slice(6, 7));
-          this.endtime =
-            this.endtime.slice(0, 5) +
-            "0" +
-            (mon + 1) +
-            "-" +
-            "01" +
-            " " +
-            "00" +
-            ":" +
-            "00" +
-            ":" +
-            "00";
-        }
-        // this.endtime=this.endtime.slice(0,5)骞�
-        else if (num >= 10) {
-          this.endtime =
-            this.endtime.slice(0, 5) +
-            (num + 1) +
-            "-" +
-            "01" +
-            " " +
-            "00" +
-            ":" +
-            "00" +
-            ":" +
-            "00";
-        } else {
-          this.endtime =
-            this.endtime.slice(0, 5) +
-            "10" +
-            "-" +
-            "01" +
-            " " +
-            "00" +
-            ":" +
-            "00" +
-            ":" +
-            "00";
-        }
-        this.starttime = this.starttime + " " + "00" + ":" + "00" + ":" + "00";
+        this.queryParams.pabegtime = this.selecttime[0];
+        this.queryParams.paendtime = this.selecttime[1];
+        // if (this.queryParams.paendtime == this.queryParams.pabegtime) {
+        // 缁撴潫鏃堕棿鍙�"鎵�閫夌粨鏉熸湀鐨勬鏈� 1 鍙�"锛屼互鍖呭惈鏁翠釜缁撴潫鏈堛��
+        // 鍘熷疄鐜版妸鏈堜唤 +1 鍚庣洿鎺ユ嫾瀛楃涓诧紝12 鏈堜細寰楀埌 13 鏈堬紙2026-13-01锛夛紝
+        // MySQL 鎶� Incorrect datetime value锛屽瓨鍌ㄨ繃绋嬬洿鎺� 500銆�
+        this.queryParams.paendtime = this.$moment(this.queryParams.paendtime)
+          .startOf("month")
+          .add(1, "month")
+          .format("YYYY-MM")
+          .concat("-01 00:00:00");
+        this.queryParams.pabegtime =
+          this.queryParams.pabegtime + " " + "00" + ":" + "00" + ":" + "00";
         // }
       } else {
-        // this.starttime = "1998-01-01 00:00:00";
-        // this.endtime = "2998-01-01 00:00:00";
+        // this.queryParams.pabegtime = "1998-01-01 00:00:00";
+        // this.queryParams.paendtime = "2998-01-01 00:00:00";
       }
+    },
+    listDept() {
+      // 鍙彇涓氬姟鍔炲叕瀹わ紙dept_id=102锛変笅鐨勪笟鍔$粍锛屼緵鈥滀笟鍔$粍鈥濅笅鎷変娇鐢�
+      listDept({ parentId: 102 }).then(response => {
+        this.deptList = response.data;
+        this.loading = false;
+      });
     },
 
     resetArr(Arr) {
@@ -338,14 +342,64 @@
     getList() {
       listanlstatistics(this.queryParams).then(res => {
         this.jxidata = res.rows;
+        this.jxidata.forEach(($obj, $index) => {
+          $obj.id = $index + 1;
+        });
+        this.total = res.total;
+        this.buildDeptData();
       });
+    },
+    /** 鎸変笟鍔$粍鑱氬悎锛氱疮璁℃渚� = 危workflowsum锛岀粓姝㈡渚� = 危terminationcase */
+    buildDeptData() {
+      const map = new Map();
+      this.jxidata.forEach(row => {
+        const key = row.deptid || row.deptname || "鏈垎缁�";
+        if (!map.has(key)) {
+          map.set(key, {
+            deptname: row.deptname || "鏈垎缁�",
+            caseTotal: 0,
+            terminationTotal: 0
+          });
+        }
+        const item = map.get(key);
+        item.caseTotal += Number(row.workflowsum) || 0;
+        item.terminationTotal += Number(row.terminationcase) || 0;
+      });
+      this.deptData = Array.from(map.values()).map((item, index) => {
+        item.id = index + 1;
+        return item;
+      });
+    },
+    /** 瀵煎嚭鎸夐挳鎿嶄綔 */
+    handleExport() {
+      const queryParams = {
+        pabegtime: this.queryParams.pabegtime,
+        paendtime: this.queryParams.paendtime,
+        padeptno: this.queryParams.padeptno,
+        pausername: this.queryParams.pausername
+      };
+      const exportApi =
+        this.activeTab === "dept"
+          ? exportCaseDeptStatistics
+          : exportCaseStatistics;
+      this.$modal
+        .confirm("鏄惁纭瀵煎嚭褰撳墠鍒楄〃鐨勬渚嬬粺璁℃暟鎹紵")
+        .then(() => {
+          this.exportLoading = true;
+          return exportApi(queryParams);
+        })
+        .then(response => {
+          this.$download.name(response.msg);
+          this.exportLoading = false;
+        })
+        .catch(() => {
+          this.exportLoading = false;
+        });
     },
     getSummaries(param) {
       const { columns, data } = param;
       const sums = [];
-      var columnnames = [
-      "applymonth", "deptmentName", "username"
-      ];
+      var columnnames = ["deptname", "reportername"];
       columns.forEach((column, index) => {
         if (index === 0) {
           sums[index] = "鍚堣";
@@ -366,10 +420,30 @@
               return prev;
             }
           }, 0);
-          sums[index] = sums[index].toFixed(2); // 淇濈暀2浣嶅皬鏁帮紝瑙e喅灏忔暟鍚堣鍒�;
+          sums[index] = sums[index]; // 淇濈暀2浣嶅皬鏁帮紝瑙e喅灏忔暟鍚堣鍒�;
         } else {
           sums[index] = "";
         }
+      });
+      return sums;
+    },
+    /** 鎸変笟鍔$粍琛ㄦ牸鍚堣 */
+    getDeptSummaries(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = "鍚堣";
+          return;
+        }
+        if (column.property === "deptname") {
+          return;
+        }
+        const total = data.reduce(
+          (prev, item) => prev + (Number(item[column.property]) || 0),
+          0
+        );
+        sums[index] = data.length === 0 ? "" : total;
       });
       return sums;
     },
@@ -392,22 +466,8 @@
       this.form.treatmenthospitalno = "";
 
       this.queryParams = {
-        doname: null,
-        pageNum: 1,
-        pageSize: 10,
-        name: null,
-        idcardno: null,
-        residenceprovince: null,
-        residencecity: null,
-        residencetown: null,
-        // "2"
-        recordstate: null,
-        treatmenthospitalname: null,
-        donorno: null,
-        acquisitiontissueno: null,
-        reportername: null,
-        reporttime: null,
-        city: null
+        pabegtime: null,
+        paendtime: null
       };
       this.selecttime = [];
       this.getTimeList();
@@ -427,6 +487,7 @@
   created() {
     //鑾峰彇鍒楄〃
     this.getList();
+    this.listDept();
   }
   // //鐢熷懡鍛ㄦ湡 - 鎸傝浇瀹屾垚锛堝彲浠ヨ闂瓺OM鍏冪礌锛�
   //    mounted() {},

--
Gitblit v1.9.3