From fb34ba28cb908bd328cf6690ab0b19a56428f4e2 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期五, 13 十一月 2026 10:56:55 +0800
Subject: [PATCH] 测试完成

---
 src/views/followvisit/discharge/outpatientService.vue |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 103 insertions(+), 5 deletions(-)

diff --git a/src/views/followvisit/discharge/outpatientService.vue b/src/views/followvisit/discharge/outpatientService.vue
index f9811f2..af0da6f 100644
--- a/src/views/followvisit/discharge/outpatientService.vue
+++ b/src/views/followvisit/discharge/outpatientService.vue
@@ -400,8 +400,8 @@
         <el-table-column
           label="绉戝"
           align="center"
-          key="deptname"
-          prop="deptname"
+          key="leaveldeptname"
+          prop="leaveldeptname"
           width="120"
         >
         </el-table-column>
@@ -758,7 +758,7 @@
           <el-input
             style="width: 400px"
             disabled
-            v-model="zcform.deptname"
+            v-model="zcform.leaveldeptname"
           ></el-input>
         </el-form-item>
         <el-form-item label="鐥呭尯">
@@ -1074,6 +1074,8 @@
           label: "姝e父",
         },
       ],
+      orgname: "",
+
       url: "http://9.208.2.190:8090/smartor/serviceExternal/query360PatInfo",
       postData: {
         XiaoXiTou: {
@@ -1117,10 +1119,25 @@
       rules: {},
     };
   },
-  watch: {},
+  watch: {
+    // 鍙充笅瑙掋�屽緟澶勭悊闅忚浠诲姟銆嶅崱鐗囧啀娆$偣鍑伙紙褰撳墠宸插湪鏈〉锛�
+    "$route.query": {
+      handler(newQuery) {
+        if (
+          newQuery?.month &&
+          newQuery?.fromPendingTask === "1" &&
+          this.taskQueryReady
+        ) {
+          this.applyPendingTaskQuery();
+        }
+      },
+      immediate: true,
+    },
+  },
   created() {
     this.serviceState = store.getters.serviceState;
     this.checkboxlist = store.getters.checkboxlist;
+    this.orgname = localStorage.getItem("orgname");
     this.errtype = this.$route.query.errtype;
     this.leavehospitaldistrictcode =
       this.$route.query.leavehospitaldistrictcode;
@@ -1136,7 +1153,9 @@
         value: dept.districtCode,
       };
     });
-    if (this.errtype) {
+    if (this.applyPendingTaskQuery()) {
+      // 鍙充笅瑙掋�屽緟澶勭悊闅忚浠诲姟銆嶅崱鐗囪烦杞細宸叉寜骞存湀 + 寰呴殢璁挎潯浠舵煡璇�
+    } else if (this.errtype) {
       this.toleadExport(2);
     } else {
       this.getList(1);
@@ -1144,8 +1163,13 @@
     this.getConfigKey("sys.user.initPassword").then((response) => {
       this.initPassword = response.msg;
     });
+    // created 鍒濆鍖栧畬鎴愶紝涔嬪悗璺敱 query 鍙樺寲鎵嶆寜鍗$墖鏉′欢閲嶆柊鏌ヨ
+    this.taskQueryReady = true;
   },
   activated() {
+    if (this.applyPendingTaskQuery()) {
+      return;
+    }
     this.getList(1);
   },
   methods: {
@@ -1350,6 +1374,80 @@
       };
       this.resetForm("form");
     },
+    /**
+     * 鍙充笅瑙掋�屽緟澶勭悊闅忚浠诲姟銆嶅崱鐗囩偣鍑绘暟瀛楄烦杞繃鏉ワ細
+     * 鎸夊嚭闄㈠勾鏈� + 寰呴殢璁匡紙sendstate 1/2/3/7锛�+ 鍑洪櫌婊� 7 澶� 杩囨护锛屽彛寰勪笌鍗$墖涓�鑷�
+     * @returns {boolean} 鏄惁宸叉寜鍗$墖鏉′欢鍙戣捣鏌ヨ
+     */
+    applyPendingTaskQuery() {
+      const query = this.$route.query || {};
+      if (!query.month || query.fromPendingTask !== "1") {
+        return false;
+      }
+      // 椤甸潰琚� keep-alive 澶嶇敤鏃朵細閲嶅瑙﹀彂 activated锛屽悓涓�娆$偣鍑诲彧澶勭悊涓�娆�
+      if (this.pendingTaskToken && this.pendingTaskToken === query._t) {
+        return false;
+      }
+      this.pendingTaskToken = query._t;
+
+      const month = String(query.month);
+      const serviceType = Number(query.serviceType) === 3 ? 3 : 2;
+      this.errtype = undefined;
+      const start = month + "-01";
+      // 鍗$墖缁熻鐨勬槸銆屽嚭闄㈡弧 7 澶┿�嶇殑浠诲姟锛屾埅姝㈡棩 = min(璇ユ湀鏈�鍚庝竴澶�, 浠婂ぉ-7 澶�)
+      const end = this.pendingTaskMonthEnd(month);
+      this.dateRange = [start, end];
+      this.topqueryParams.serviceType = serviceType;
+      this.topqueryParams.sendstateView = 1;
+      this.topqueryParams.sendstate = null;
+      // 鍗$墖缁熻鐨勬槸鍏ㄩ儴寰呴殢璁夸换鍔★紙涓嶅尯鍒嗛杞�/澶嶈瘖锛夛紝鍒楄〃杩欓噷鍚屾鏀惧紑
+      this.topqueryParams.visitCount = null;
+      this.topqueryParams.pageNum = 1;
+      // 褰撴湀杩樻病鍒扮 8 澶╂椂锛岃鏈堜笉鍙兘鏈夈�屽嚭闄㈡弧 7 澶┿�嶇殑浠诲姟锛堝崱鐗囨樉绀� 0锛夛紝鍒楄〃鐩存帴缁欑┖銆�
+      // 鏃ユ湡妗嗕粛鏄剧ず璇ユ湀鐨勮嚜鐒跺尯闂达紝閬垮厤鍑虹幇銆岃捣姝㈠�掓寕銆嶇殑绛涢�夋潯浠躲��
+      if (end < start) {
+        this.dateRange = [start, this.pendingTaskMonthLastDay(month)];
+        this.userList = [];
+        this.total = 0;
+        this.loading = false;
+        this.$message.info("璇ユ湀鏆傛棤鍑洪櫌婊� 7 澶╃殑寰呴殢璁夸换鍔�");
+        return true;
+      }
+      this.handleQuery(1);
+      return true;
+    },
+    /**
+     * 璇ユ湀鏈�鍚庝竴澶╋紙yyyy-MM-dd锛夛紝鍙敤浜庛�屽綋鏈堣繕娌℃湁婊� 7 澶╀换鍔°�嶆椂灞曠ず姝e父鏈堜唤鍖洪棿
+     */
+    pendingTaskMonthLastDay(month) {
+      const parts = String(month).split("-");
+      const date = new Date(Number(parts[0]), Number(parts[1]), 0);
+      const mm = String(date.getMonth() + 1).padStart(2, "0");
+      const dd = String(date.getDate()).padStart(2, "0");
+      return date.getFullYear() + "-" + mm + "-" + dd;
+    },
+    /**
+     * 鍗$墖鍙e緞鐨勬湀浠界粨鏉熸棩锛氬崱鐗囧彧缁熻銆屽嚭闄㈡弧 7 澶╀粛鏈殢璁裤�嶇殑浠诲姟锛�
+     * 鎵�浠ユ埅姝㈡棩姘歌繙鏄� min(璇ユ湀鏈�鍚庝竴澶�, 浠婂ぉ-7 澶�)锛�
+     * 鍘嗗彶鏈堜唤鍚屾牱瑕佹寜銆屼粖澶�-7 澶┿�嶆埅鏂紝鍚﹀垯鏈堟湯鍑犲ぉ鍑洪櫌鐨勬偅鑰呬細琚畻杩涙潵锛堝崱鐗� 49銆佸垪琛� 77锛夈��
+     */
+    pendingTaskMonthEnd(month) {
+      const parts = String(month).split("-");
+      const year = Number(parts[0]);
+      const mon = Number(parts[1]);
+      const now = new Date();
+      // 鍑洪櫌婊� 7 澶╋細鍑洪櫌鏃ユ湡 <= 浠婂ぉ-7锛堜笌鍚庣 endtime < 浠婂ぉ-6 00:00 绛変环锛�
+      const cutoff = new Date(
+        now.getFullYear(),
+        now.getMonth(),
+        now.getDate() - 7
+      );
+      const monthEnd = new Date(year, mon, 0);
+      const date = cutoff < monthEnd ? cutoff : monthEnd;
+      const mm = String(date.getMonth() + 1).padStart(2, "0");
+      const dd = String(date.getDate()).padStart(2, "0");
+      return date.getFullYear() + "-" + mm + "-" + dd;
+    },
     /** 鎼滅储鎸夐挳鎿嶄綔 */
     handleQuery(refresh) {
       if (this.topqueryParams.searchscope == 3) {

--
Gitblit v1.9.3