From bbbc478129f72b26e2ec4a2e981ed8698a96880c Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 22 十月 2026 00:28:18 +0800
Subject: [PATCH] 当service_type=6时,需要根据传入的入院还是离院病区(病区)去后端查询

---
 src/views/followvisit/tasklist/index.vue |  159 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 149 insertions(+), 10 deletions(-)

diff --git a/src/views/followvisit/tasklist/index.vue b/src/views/followvisit/tasklist/index.vue
index cc6c050..38ccc13 100644
--- a/src/views/followvisit/tasklist/index.vue
+++ b/src/views/followvisit/tasklist/index.vue
@@ -130,19 +130,19 @@
           :show-overflow-tooltip="true"
         />
         <el-table-column
-          label="鎬讳换鍔�/宸查殢璁�"
+          label="鎵ц璇︽儏"
           align="center"
-          key="nickName"
+          key="taskDetail"
           width="120"
-          prop="nickName"
         >
           <template slot-scope="scope">
-            <span
-              >{{
-                scope.row.wfs || scope.row.wfs == 0
-                  ? scope.row.wfs + scope.row.yfs
-                  : ""
-              }}/{{ scope.row.yfs }}</span
+            <el-button
+              size="medium"
+              type="text"
+              @click="showCountDetail(scope.row)"
+              ><span class="button-xq"
+                ><i class="el-icon-s-data"></i>鎵ц璇︽儏</span
+              ></el-button
             >
           </template>
         </el-table-column>
@@ -385,6 +385,31 @@
         >
       </div>
     </el-dialog>
+    <!-- 浠诲姟鎵ц璇︽儏寮圭獥 -->
+    <el-dialog
+      :visible.sync="countDialogVisible"
+      width="600px"
+      :before-close="handleCountClose"
+    >
+      <span slot="title" class="count-dialog-title">浠诲姟鎵ц璇︽儏</span>
+      <div v-loading="countLoading" class="count-detail">
+        <div class="count-task-name">浠诲姟鍚嶇О锛歿{ countTaskName || "-" }}</div>
+        <div v-for="(row, ri) in countRows" :key="ri" class="count-grid">
+          <div
+            v-for="f in row"
+            :key="f.key"
+            class="count-item"
+            :style="countItemStyle(f)"
+          >
+            <span class="count-label">{{ f.label }}</span>
+            <span class="count-value">{{ countVal(f) }}</span>
+          </div>
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="countDialogVisible = false">鍏� 闂�</el-button>
+      </span>
+    </el-dialog>
     <!-- 閫夋嫨鎮h�呭脊妗� -->
     <Patient-Selection
       ref="Patient"
@@ -407,6 +432,7 @@
 import {
   getTasklist,
   delTaskInfo,
+  countByCondition,
   TaskTemplateSendExecution,
   scanGenerateSubtask,
   goSfRelay,
@@ -450,6 +476,18 @@
       qrDialogVisible: false,
       qrCodeUrl: "", // 涓棿椤甸摼鎺�
       qrCodeCanvas: null, // 瀛樺偍canvas寮曠敤
+      // 浠诲姟鎵ц璇︽儏寮圭獥
+      countDialogVisible: false,
+      countLoading: false,
+      countTaskName: "",
+      countData: {},
+      countFields: [
+        { key: "total", label: "鎬婚噺", color: "#67afab", bg: "#e6f4f3" },
+        { key: "dsf", label: "寰呴殢璁�", color: "#409eff", bg: "#ecf5ff" },
+        { key: "ywc", label: "宸插畬鎴�", color: "#67c23a", bg: "#f0f9eb" },
+        { key: "yc", label: "寮傚父", color: "#f56c6c", bg: "#fef0f0" },
+        { key: "jg", label: "璀﹀憡", color: "#e6a23c", bg: "#fdf6ec" },
+      ],
       // 鏃ユ湡鑼冨洿
       dateRange: [],
       // 宀椾綅閫夐」
@@ -658,6 +696,18 @@
     };
   },
   watch: {},
+  computed: {
+    // 浠诲姟鎵ц璇︽儏锛氭寜涓よ鍒嗙粍锛屽�间负 0 鐨勯」涓嶅睍绀�
+    countRows() {
+      const row1 = this.countFields
+        .slice(0, 3)
+        .filter((f) => this.countNum(f) !== 0);
+      const row2 = this.countFields
+        .slice(3)
+        .filter((f) => this.countNum(f) !== 0);
+      return [row1, row2].filter((r) => r.length > 0);
+    },
+  },
   created() {
     this.orgname = localStorage.getItem("orgname");
     if (this.orgname == "鍗楀崕澶у闄勫睘绗竴鍖婚櫌") {
@@ -1103,7 +1153,7 @@
       // 1. 鏋勯�犺姹傚弬鏁�
       const params = {
         taskId: row.taskid,
-        deptcode: row.deptcode || "", // 褰撳墠鐢ㄦ埛閮ㄩ棬缂栫爜锛岃纭繚 store 涓湁璇� getter
+        deptcode: row.leaveldeptcode || "", // 鍑洪櫌绉戝缂栫爜锛堝瓙浠诲姟瀛楁宸茬敱 deptcode 鏀瑰悕涓� leaveldeptcode锛�
         leavehospitaldistrictcode: row.leavehospitaldistrictcode || "", // 杞负閫楀彿鍒嗛殧瀛楃涓诧紝瑙嗘帴鍙i渶姹�
         // 濡傛灉鏈夊叾浠栧弬鏁板 hospitalDistrictCode 涔熷彲琛ュ厖
       };
@@ -1195,6 +1245,57 @@
       this.qrCodeCanvas = null;
       const container = this.$refs.qrCodeContainer;
       if (container) container.innerHTML = "";
+    },
+    // 鏌ョ湅浠诲姟鎵ц璇︽儏锛坈ountByCondition 鐩存帴杩斿洖鑱氬悎 Map锛�
+    showCountDetail(row) {
+      console.log(11);
+
+      this.countTaskName = row.taskName || "";
+      this.countData = {};
+      this.countDialogVisible = true;
+      this.countLoading = true;
+      countByCondition({ taskid: row.taskid })
+        .then((res) => {
+          this.countData = this.normalizeCount(res || {});
+        })
+        .catch(() => {
+          this.countData = {};
+          this.$modal.msgError("鑾峰彇浠诲姟鎵ц璇︽儏澶辫触");
+        })
+        .finally(() => {
+          this.countLoading = false;
+        });
+    },
+    // 褰掍竴閿悕锛堣仛鍚� SQL 鍒悕鍙兘甯︾┖鏍硷級
+    normalizeCount(data) {
+      const out = {};
+      Object.keys(data || {}).forEach((k) => {
+        out[String(k).trim()] = data[k];
+      });
+      return out;
+    },
+    // 璇诲彇缁熻鍊硷紙key 浼樺厛锛宎ltKey 鍏滃簳锛岀己澶辨樉绀� 0锛�
+    countVal(f) {
+      const d = this.countData || {};
+      if (d[f.key] != null && d[f.key] !== "") return d[f.key];
+      if (f.altKey && d[f.altKey] != null && d[f.altKey] !== "")
+        return d[f.altKey];
+      return 0;
+    },
+    // 缁熻鍊艰浆涓烘暟瀛楋紙鐢ㄤ簬鍒ゆ柇鏄惁涓� 0锛�
+    countNum(f) {
+      return Number(this.countVal(f)) || 0;
+    },
+    // 姣忛」鐨勮儗鏅壊涓庡瓧浣撻鑹�
+    countItemStyle(f) {
+      return {
+        background: f.bg || "#f5f7fa",
+        color: f.color || "#303133",
+      };
+    },
+    handleCountClose() {
+      this.countDialogVisible = false;
+      this.countData = {};
     },
   },
 };
@@ -1358,4 +1459,42 @@
     font-size: 24px;
   }
 }
+
+.count-dialog-title {
+  font-size: 16px;
+  font-weight: 600;
+  color: #67afab;
+}
+.count-detail {
+  .count-task-name {
+    font-size: 14px;
+    color: #67afab;
+    font-weight: 600;
+    margin-bottom: 16px;
+  }
+  .count-grid {
+    display: flex;
+    gap: 12px;
+    margin-bottom: 12px;
+    &:last-child {
+      margin-bottom: 0;
+    }
+  }
+  .count-item {
+    flex: 1;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 12px 14px;
+    border-radius: 4px;
+    .count-label {
+      font-size: 13px;
+      opacity: 0.9;
+    }
+    .count-value {
+      font-size: 16px;
+      font-weight: 600;
+    }
+  }
+}
 </style>

--
Gitblit v1.9.3