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/ChartsPanel.vue |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue b/src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue
index 93f0164..86c5b41 100644
--- a/src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue
+++ b/src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue
@@ -21,6 +21,18 @@
           <el-radio-button label="month">鎸夋湀</el-radio-button>
           <el-radio-button label="year">鎸夊勾</el-radio-button>
         </el-radio-group>
+        <span class="filter-label">婊℃剰搴︾被鍨嬶細</span>
+        <el-select
+          v-model="satisfactionScope"
+          size="small"
+          clearable
+          placeholder="榛樿绂婚櫌"
+          class="filter-scope"
+          @change="refreshAll"
+        >
+          <el-option label="绂婚櫌婊℃剰搴�" value="leave" />
+          <el-option label="鍦ㄩ櫌婊℃剰搴�" value="hospital" />
+        </el-select>
         <span class="filter-label">缁熻缁村害锛�</span>
         <el-radio-group v-model="queryParams.dimension" size="small" @change="onDimensionChange">
           <el-radio-button label="ward">鎸夌梾鍖虹粺璁�</el-radio-button>
@@ -170,6 +182,8 @@
   dicts: ['dimensionality_type'],
   data() {
     return {
+      // 婊℃剰搴︾被鍨嬶細leave=绂婚櫌婊℃剰搴︼紙绂婚櫌绉戝/鐥呭尯锛夛紝hospital=鍦ㄩ櫌婊℃剰搴︼紙鍦ㄩ櫌绉戝/鐥呭尯锛�
+      satisfactionScope: 'leave',
       queryParams: {
         dateRange: [],
         interval: 'month',
@@ -226,6 +240,10 @@
     },
     defaultWardCodes() {
       return Array.from(new Set(this.wardCodeList.map((w) => w.districtCode)));
+    },
+    // 鏄惁鎸夈�屽湪闄㈡弧鎰忓害銆嶅彛寰勬煡璇紙娓呯┖涓嬫媺鏃舵寜榛樿鐨勭闄㈠彛寰勶級
+    isInHospitalSatisfaction() {
+      return this.satisfactionScope === 'hospital';
     },
     intervalLabel() {
       return { day: '鎸夊ぉ', week: '鎸夊懆', month: '鎸夋湀', year: '鎸夊勾' }[this.queryParams.interval] || '鎸夋湀';
@@ -426,12 +444,17 @@
           questionContent: this.singleQuestionContent,
         };
         const sel = this.singleDeptWards || [];
+        // 绉戝/鐥呭尯鏉′欢闅忋�屾弧鎰忓害绫诲瀷銆嶅垏鎹細鍦ㄩ櫌 => deptcodes/hospitaldistrictcodes锛岀闄� => leaveldeptcodes/leavehospitaldistrictcodes
         if (this.queryParams.dimension === 'dept') {
           const names = sel.map((s) => String(s).replace(/^dept:/, ''));
-          payload.leaveldeptcodes = names.length ? this.mapDeptNames(names) : this.defaultDeptCodes;
+          const codes = names.length ? this.mapDeptNames(names) : this.defaultDeptCodes;
+          if (this.isInHospitalSatisfaction) payload.deptcodes = codes;
+          else payload.leaveldeptcodes = codes;
         } else {
           const names = sel.map((s) => String(s).replace(/^ward:/, ''));
-          payload.leavehospitaldistrictcodes = names.length ? this.mapWardNames(names) : this.defaultWardCodes;
+          const codes = names.length ? this.mapWardNames(names) : this.defaultWardCodes;
+          if (this.isInHospitalSatisfaction) payload.hospitaldistrictcodes = codes;
+          else payload.leavehospitaldistrictcodes = codes;
         }
         const res = await sltdMydTotalByScore(payload);
         console.log('[sltdMydTotalByScore 鍗曢] code=', res && res.code, 'data=', JSON.stringify(res && res.data).slice(0, 1500));
@@ -875,7 +898,7 @@
 
 <style lang="scss" scoped>
 .export-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
-.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; .filter-label { font-size: 13px; color: #606266; } .filter-date { width: 260px; } }
+.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; .filter-label { font-size: 13px; color: #606266; } .filter-date { width: 260px; } .filter-scope { width: 140px; } }
 .chart-card { margin-bottom: 0; }
 .chart-box { width: 100%; height: 360px; }
 .chart-wrap { position: relative; width: 100%; }

--
Gitblit v1.9.3