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/zysatisfaction/index.vue |  148 +++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 125 insertions(+), 23 deletions(-)

diff --git a/src/views/followvisit/zysatisfaction/index.vue b/src/views/followvisit/zysatisfaction/index.vue
index a3c7b54..78603be 100644
--- a/src/views/followvisit/zysatisfaction/index.vue
+++ b/src/views/followvisit/zysatisfaction/index.vue
@@ -15,7 +15,19 @@
         v-show="showSearch"
         label-width="98px"
       >
-        <el-form-item label="鍑洪櫌鏃堕棿">
+        <el-form-item label="婊℃剰搴︾被鍨�" prop="satisfactionScope">
+          <el-select
+            v-model="satisfactionScope"
+            placeholder="榛樿绂婚櫌"
+            clearable
+            style="width: 150px"
+            @change="handleSatisfactionScopeChange"
+          >
+            <el-option label="绂婚櫌婊℃剰搴�" value="leave" />
+            <el-option label="鍦ㄩ櫌婊℃剰搴�" value="hospital" />
+          </el-select>
+        </el-form-item>
+        <!-- <el-form-item label="鍑洪櫌鏃堕棿">
           <el-date-picker
             v-model="dateRange"
             style="width: 240px"
@@ -25,8 +37,19 @@
             start-placeholder="寮�濮嬫棩鏈�"
             end-placeholder="缁撴潫鏃ユ湡"
           ></el-date-picker>
-        </el-form-item>
+        </el-form-item> -->
 
+        <el-form-item label="瀹屾垚鏃堕棿">
+          <el-date-picker
+            v-model="dateRangefs"
+            style="width: 240px"
+            value-format="yyyy-MM-dd"
+            type="daterange"
+            range-separator="-"
+            start-placeholder="寮�濮嬫棩鏈�"
+            end-placeholder="缁撴潫鏃ユ湡"
+          ></el-date-picker>
+        </el-form-item>
         <el-form-item label="鎮h�呭鍚�" prop="sendname">
           <el-input
             v-model="topqueryParams.sendname"
@@ -71,12 +94,16 @@
             </el-option>
           </el-select>
         </el-form-item> -->
+        <!-- 澶勭悊鐘舵�侊細淇濈暀绾ц仈鑱斿姩锛堜竴绾уぇ绫� 鈫� 浜岀骇鍏蜂綋鐘舵�侊級锛�
+             闈㈡澘鎸傚湪鏈粍浠跺唴(popper-append-to-body=false)锛岄伩鍏嶄笅鎷夎窇鍒板埆澶� -->
         <el-form-item label="澶勭悊鐘舵��" prop="status">
           <el-cascader
             v-model="serviceStatusValue"
             placeholder="璇烽�夋嫨"
             :options="serviceStatusOptions"
             :props="cascaderProps"
+            :popper-append-to-body="false"
+            style="width: 180px"
             @change="handleServiceStatusChange"
             clearable
           ></el-cascader>
@@ -173,7 +200,7 @@
             </div>
           </div>
         </el-col>
-        <el-col :span="1.5">
+        <!-- <el-col :span="1.5">
           <div class="documentf">
             <div class="document">
               <el-button
@@ -185,7 +212,7 @@
               >
             </div>
           </div>
-        </el-col>
+        </el-col> -->
         <el-col :span="1.5">
           <div class="documentf">
             <div class="document">
@@ -363,18 +390,22 @@
         <el-table-column
           label="绉戝"
           align="center"
-          key="deptname"
-          prop="deptname"
+          key="leaveldeptname"
           width="120"
         >
+          <template slot-scope="scope">
+            {{ deptNameOf(scope.row) }}
+          </template>
         </el-table-column>
         <el-table-column
           label="鐥呭尯"
           align="center"
           key="leavehospitaldistrictname"
-          prop="leavehospitaldistrictname"
           width="120"
         >
+          <template slot-scope="scope">
+            {{ wardNameOf(scope.row) }}
+          </template>
         </el-table-column>
 
         <el-table-column
@@ -1078,6 +1109,8 @@
           label: "搴旈殢璁挎棩鏈�(鍊掑簭)",
         },
       ],
+      // 婊℃剰搴︾被鍨嬶細leave=绂婚櫌婊℃剰搴︼紙鎸夌闄㈢瀹�/鐥呭尯鏌ワ級锛宧ospital=鍦ㄩ櫌婊℃剰搴︼紙鎸夊湪闄㈢瀹�/鐥呭尯鏌ワ級
+      satisfactionScope: "leave",
       // 鏌ヨ鍙傛暟
       topqueryParams: {
         pageNum: 1,
@@ -1253,7 +1286,7 @@
         this.$message.warning("鏈厤缃瀹�/鐥呭尯鐩稿叧鏉冮檺涓嶅彲鏌ヨ");
         return Promise.reject(new Error("鏃犳潈闄愭煡璇�"));
       }
-      getTaskservelist(this.topqueryParams).then((response) => {
+      getTaskservelist(this.buildScopePayload(this.topqueryParams)).then((response) => {
         this.userList = response.rows[0].serviceSubtaskList;
         this.total = response.total;
         if (refresh) {
@@ -1298,6 +1331,47 @@
         this.total = response.total;
       });
     },
+
+    // 鍒囨崲婊℃剰搴︾被鍨嬶紙绂婚櫌/鍦ㄩ櫌锛夊悗閲嶆柊鏌ヨ
+    handleSatisfactionScopeChange() {
+      this.topqueryParams.pageNum = 1;
+      this.getList(1);
+    },
+
+    // 鎸夋弧鎰忓害绫诲瀷缁勮绉戝/鐥呭尯鏉′欢锛�
+    // 绂婚櫌婊℃剰搴� => leaveldeptcodes / leavehospitaldistrictcodes锛�
+    // 鍦ㄩ櫌婊℃剰搴� => deptcodes / hospitaldistrictcodes锛堝湪闄㈢瀹ゃ�佸湪闄㈢梾鍖猴級
+    buildScopePayload(params) {
+      const payload = { ...params };
+      if (this.satisfactionScope === "hospital") {
+        payload.deptcodes = params.leaveldeptcodes || [];
+        payload.hospitaldistrictcodes = params.leavehospitaldistrictcodes || [];
+        delete payload.leaveldeptcodes;
+        delete payload.leavehospitaldistrictcodes;
+      }
+      return payload;
+    },
+
+    // 绉戝鍚嶇О锛氬湪闄㈡弧鎰忓害浼樺厛鍙栧湪闄㈢瀹わ紝鍏朵綑鍙栧嚭闄㈢瀹�
+    deptNameOf(row) {
+      if (!row) return "-";
+      return (
+        (this.satisfactionScope === "hospital"
+          ? row.deptname || row.leaveldeptname
+          : row.leaveldeptname || row.deptname) || "-"
+      );
+    },
+
+    // 鐥呭尯鍚嶇О锛氬湪闄㈡弧鎰忓害浼樺厛鍙栧湪闄㈢梾鍖猴紝鍏朵綑鍙栧嚭闄㈢梾鍖�
+    wardNameOf(row) {
+      if (!row) return "-";
+      return (
+        (this.satisfactionScope === "hospital"
+          ? row.hospitaldistrictname || row.leavehospitaldistrictname
+          : row.leavehospitaldistrictname || row.hospitaldistrictname) || "-"
+      );
+    },
+
     // 鏈嶅姟鐘舵�佸彉鏇村鐞�
     handleServiceStatusChange(value) {
       // 娓呯┖閫夋嫨
@@ -1330,13 +1404,17 @@
       }
     },
     affiliation() {
+      this.resetQuerykj();
+
       this.topqueryParams.managementDoctorCode = store.getters.hisUserId;
 
       this.getList(1);
     },
     onthatday() {
-      this.topqueryParams.startSendDateTime = this.getCurrentDate();
-      this.topqueryParams.endSendDateTime = this.getCurrentDate();
+      this.resetQuerykj();
+
+      this.topqueryParams.finishtimeStart = this.getCurrentDate();
+      this.topqueryParams.finishtimeEnd = this.getCurrentDate();
       this.getList(1);
     },
     getCurrentDate() {
@@ -1344,13 +1422,12 @@
       return now.toISOString().slice(0, 10); // 鎴彇鍓�10涓瓧绗︼紝鍗� YYYY-MM-DD
     },
     buidegetTasklist(type) {
-      if (this.topqueryParams.searchscope == 3) {
-        this.topqueryParams.leaveldeptcodes = store.getters.belongDepts.map(
-          (obj) => obj.deptCode
-        );
-        this.topqueryParams.leavehospitaldistrictcodes =
-          store.getters.belongWards.map((obj) => obj.districtCode);
-      }
+      // 鐢ㄦ埛鏉冮檺涓嬫墍鏈夊緟闅忚浠诲姟锛氫紶閫掑叏閮ㄧ瀹ゅ拰鐥呭尯
+      this.topqueryParams.leaveldeptcodes = store.getters.belongDepts.map(
+        (obj) => obj.deptCode
+      );
+      this.topqueryParams.leavehospitaldistrictcodes =
+        store.getters.belongWards.map((obj) => obj.districtCode);
       // 鎺ュ彈寮傚父璺宠浆
       if (this.errtype) {
         this.topqueryParams.leavehospitaldistrictcodes.push(
@@ -1362,7 +1439,7 @@
         pageSize: 10,
         leavehospitaldistrictcodes:
           this.topqueryParams.leavehospitaldistrictcodes,
-        sendstates: [2, 3],
+        sendstateView: 1,
         leaveldeptcodes: this.topqueryParams.leaveldeptcodes,
       };
       buidegetTasklist(obj).then((response) => {
@@ -1467,10 +1544,10 @@
           store.getters.belongWards.map((obj) => obj.districtCode);
       }
       this.topqueryParams.pageNum = 1;
-      this.topqueryParams.startOutHospTime = this.dateRange[0];
-      this.topqueryParams.endOutHospTime = this.dateRange[1];
-      this.topqueryParams.startSendDateTime = this.dateRangefs[0];
-      this.topqueryParams.endSendDateTime = this.dateRangefs[1];
+      // this.topqueryParams.startOutHospTime = this.dateRange[0];
+      // this.topqueryParams.endOutHospTime = this.dateRange[1];
+      this.topqueryParams.finishtimeStart = this.dateRangefs[0];
+      this.topqueryParams.finishtimeEnd = this.dateRangefs[1];
       this.getList(refresh);
     },
     // 鎮h�呰寖鍥村鐞�
@@ -1510,6 +1587,26 @@
         leavehospitaldistrictcodes: [],
       };
       this.handleQuery(1);
+    },
+    /** 閲嶇疆鎸夐挳鎿嶄綔 */
+    resetQuerykj() {
+      this.dateRange = [];
+      this.dateRangefs = [];
+      this.serviceStatusValue = null;
+      this.topqueryParams = {
+        pageNum: 1,
+        pageSize: 10,
+        sendstate: null,
+
+        sendstateView: null,
+        sort: 2, //0 鍑洪櫌鏃堕棿(姝e簭)    1 鍑洪櫌鏃堕棿(鍊掑簭)   2 鍙戦�佹椂闂�(姝e簭)    3 鍙戦�佹椂闂�(鍊掑簭)
+        serviceType: 6,
+        searchscope: 3,
+        visitCount: 1,
+        scopetype: [],
+        leaveldeptcodes: [],
+        leavehospitaldistrictcodes: [],
+      };
     },
     handleSelectionChange(rows) {
       this.selectedRows = rows.map((row) => {
@@ -1807,7 +1904,7 @@
       this.download(
         "smartor/serviceSubtask/patItemExport",
         {
-          ...this.topqueryParams,
+          ...this.buildScopePayload(this.topqueryParams),
         },
         `user_${new Date().getTime()}.xlsx`
       );
@@ -2051,6 +2148,11 @@
   box-shadow: 0 2px 12px rgba(31, 45, 61, 0.05);
 }
 
+/* 绾ц仈涓嬫媺鎸傚湪鏈粍浠跺唴鏃讹紝浠ユ墍鍦ㄨ〃鍗曢」涓哄畾浣嶅熀鍑嗭紝閬垮厤闈㈡澘璺戝埌椤甸潰鍒 */
+::v-deep .el-form--inline .el-form-item {
+  position: relative;
+}
+
 /* 闅愯棌鍒嗗壊绾� */
 ::v-deep .el-divider {
   display: none;

--
Gitblit v1.9.3