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/Satisfaction/sfstatistics/components/DataOverview.vue |   56 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/src/views/Satisfaction/sfstatistics/components/DataOverview.vue b/src/views/Satisfaction/sfstatistics/components/DataOverview.vue
index d221e0f..f189c1f 100644
--- a/src/views/Satisfaction/sfstatistics/components/DataOverview.vue
+++ b/src/views/Satisfaction/sfstatistics/components/DataOverview.vue
@@ -3,6 +3,19 @@
     <!-- 椤堕儴绛涢�夛細鏃堕棿鑼冨洿 + 绉戝/鐥呭尯锛屾帶鍒舵湰椤垫墍鏈夋暟鎹� -->
     <el-card shadow="never" class="overview-card filter-card">
       <el-form inline class="filter-form">
+        <el-form-item label="婊℃剰搴︾被鍨�">
+          <el-select
+            v-model="satisfactionScope"
+            size="small"
+            style="width: 140px"
+            clearable
+            placeholder="榛樿绂婚櫌"
+            @change="fetchData"
+          >
+            <el-option label="绂婚櫌婊℃剰搴�" value="leave" />
+            <el-option label="鍦ㄩ櫌婊℃剰搴�" value="hospital" />
+          </el-select>
+        </el-form-item>
         <el-form-item label="鍑洪櫌鏃ユ湡">
           <el-date-picker
             v-model="queryParams.dateRange"
@@ -497,11 +510,14 @@
   name: "DataOverview",
   data() {
     return {
+      // 婊℃剰搴︾被鍨嬶細leave=绂婚櫌婊℃剰搴︼紙绂婚櫌绉戝/鐥呭尯锛夛紝hospital=鍦ㄩ櫌婊℃剰搴︼紙鍦ㄩ櫌绉戝/鐥呭尯锛�
+      satisfactionScope: "leave",
       // 椤堕儴鍏ㄥ眬绛涢��
       queryParams: {
         dateRange: [],
         deptCodes: [], // 绉戝缂栫爜闆嗗悎 => leaveldeptcodes
-        wardCodes: [], // 鍑洪櫌鐥呭尯缂栫爜闆嗗悎 => leavehospitaldistrictcodes锛堟帴鍙e繀濉級
+        // 鐥呭尯缂栫爜闆嗗悎锛氫綇闄㈡弧鎰忓害鎸夊湪闄㈢梾鍖�(hospitaldistrictcodes)锛屽叾浣欐寜鍑洪櫌鐥呭尯(leavehospitaldistrictcodes)
+        wardCodes: [],
         serviceTypeList: [], // 鏈嶅姟绫诲瀷澶氶�夛紝鎻愪氦鏃剁敤閫楀彿鎷兼帴
         deptOrDistrict: "1", // 绉戝/鐥呭尯缁勫悎鏂瑰紡锛岄粯璁� 1锛氱闄㈢梾鍖� and 绂婚櫌绉戝
         statMode: "ward", // 缁熻缁村害锛歸ard=鎸夌梾鍖虹粺璁� dept=鎸夌瀹ょ粺璁�
@@ -553,6 +569,11 @@
     // 鏈�夌梾鍖烘椂鐨勯粯璁ゆ煡璇㈣寖鍥达細鍏ㄩ儴鐥呭尯缂栫爜
     defaultWardCodes() {
       return Array.from(new Set(this.wardOptions.map((w) => w.value)));
+    },
+    // 鏄惁鎸夈�屽湪闄㈡弧鎰忓害銆嶅彛寰勬煡璇細鍦ㄩ櫌婊℃剰搴︾敤 deptcodes/hospitaldistrictcodes锛�
+    // 绂婚櫌婊℃剰搴︼紙浠ュ強娓呯┖涓嬫媺鏃剁殑榛樿鍙e緞锛夌敤 leaveldeptcodes/leavehospitaldistrictcodes
+    isInHospitalSatisfaction() {
+      return this.satisfactionScope === "hospital";
     },
     // 鏈�夌瀹ゆ椂鐨勯粯璁ゆ煡璇㈣寖鍥达細鍏ㄩ儴绉戝缂栫爜
     defaultDeptCodes() {
@@ -828,8 +849,10 @@
         return;
       }
 
-      // 鐥呭尯 => leavehospitaldistrictcodes锛岀瀹� => leaveldeptcodes
-      // 绉戝/鐥呭尯浜掓枼锛氭寜鐥呭尯鍙紶 leavehospitaldistrictcodes锛屾寜绉戝鍙紶 leaveldeptcodes
+      // 绉戝/鐥呭尯鏉′欢闅忋�屾弧鎰忓害绫诲瀷銆嶅垏鎹細
+      // 鍦ㄩ櫌婊℃剰搴� => deptcodes / hospitaldistrictcodes锛堝湪闄㈢瀹ゃ�佸湪闄㈢梾鍖猴級
+      // 绂婚櫌婊℃剰搴� => leaveldeptcodes / leavehospitaldistrictcodes锛堢闄㈢瀹ゃ�佺闄㈢梾鍖猴級
+      // 绉戝/鐥呭尯浜掓枼锛氭寜鐥呭尯鍙紶鐥呭尯缂栫爜锛屾寜绉戝鍙紶绉戝缂栫爜
       const wards = this.queryParams.wardCodes || [];
       const depts = this.queryParams.deptCodes || [];
 
@@ -839,13 +862,23 @@
         endFinishTime: range[1],
       };
       if (this.queryParams.statMode === "dept") {
-        payload.leaveldeptcodes = depts.length
+        const deptCodes = depts.length
           ? Array.from(new Set(depts))
           : this.defaultDeptCodes;
+        if (this.isInHospitalSatisfaction) {
+          payload.deptcodes = deptCodes;
+        } else {
+          payload.leaveldeptcodes = deptCodes;
+        }
       } else {
-        payload.leavehospitaldistrictcodes = wards.length
+        const wardCodes = wards.length
           ? Array.from(new Set(wards))
           : this.defaultWardCodes;
+        if (this.isInHospitalSatisfaction) {
+          payload.hospitaldistrictcodes = wardCodes;
+        } else {
+          payload.leavehospitaldistrictcodes = wardCodes;
+        }
       }
       // 鏈嶅姟绫诲瀷澶氶�夛細閫楀彿鍒嗛殧锛堟帴鍙e瓧娈典负 serviceType 瀛楃涓诧級
       const serviceTypes = this.queryParams.serviceTypeList || [];
@@ -892,10 +925,17 @@
         endFinishTime: range[1],
       };
       try {
-        // 鎸夌瀹ょ粺璁★紙leaveldeptcodes 浼樺厛锛変笌鎸夌梾鍖虹粺璁★紙leavehospitaldistrictcodes锛夊悇鏌ヤ竴娆�
+        // 鎸夌瀹ょ粺璁°�佹寜鐥呭尯缁熻鍚勬煡涓�娆★紝鏉′欢闅忋�屾弧鎰忓害绫诲瀷銆嶅垏鎹細
+        // 鍦ㄩ櫌婊℃剰搴� => deptcodes / hospitaldistrictcodes锛涚闄㈡弧鎰忓害 => leaveldeptcodes / leavehospitaldistrictcodes
+        const deptParam = this.isInHospitalSatisfaction
+          ? { deptcodes: this.defaultDeptCodes }
+          : { leaveldeptcodes: this.defaultDeptCodes };
+        const wardParam = this.isInHospitalSatisfaction
+          ? { hospitaldistrictcodes: this.defaultWardCodes }
+          : { leavehospitaldistrictcodes: this.defaultWardCodes };
         const [deptRes, wardRes] = await Promise.all([
-          statQuestionOptionByKsOrBq({ ...base, leaveldeptcodes: this.defaultDeptCodes }),
-          statQuestionOptionByKsOrBq({ ...base, leavehospitaldistrictcodes: this.defaultWardCodes }),
+          statQuestionOptionByKsOrBq({ ...base, ...deptParam }),
+          statQuestionOptionByKsOrBq({ ...base, ...wardParam }),
         ]);
         // 鎺掓煡鐢細鎵撳嵃鎺ュ彛鍘熷杩斿洖锛屼究浜庢牳瀵逛袱绾у祵濂� Map 缁撴瀯锛堢‘璁ゆ棤璇悗鍙垹闄わ級
         console.log(

--
Gitblit v1.9.3