From b4fe2c16274a91fee4fb26d91374f95fbe2dbcec Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期一, 09 十一月 2026 15:28:21 +0800
Subject: [PATCH] 测试完成

---
 src/views/system/user/index.vue |  117 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 105 insertions(+), 12 deletions(-)

diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 987b5f7..9c5693e 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -199,14 +199,39 @@
             v-if="columns[2].visible"
             :show-overflow-tooltip="true"
           />
-          <!-- <el-table-column
-            label="閮ㄩ棬"
+          <el-table-column
+            label="绉戝"
             align="center"
-            key="deptName"
-            prop="dept.deptName"
+            key="deptNames"
             v-if="columns[3].visible"
             :show-overflow-tooltip="true"
-          /> -->
+          >
+            <template slot-scope="scope">
+              <span>{{ scope.row._deptNames || "-" }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="鐥呭尯"
+            align="center"
+            key="wardNames"
+            v-if="columns[7].visible"
+            :show-overflow-tooltip="true"
+          >
+            <template slot-scope="scope">
+              <span>{{ scope.row._wardNames || "-" }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="闄㈠尯"
+            align="center"
+            key="campusName"
+            v-if="columns[8].visible && (orgname === '绗竴浜烘皯鍖婚櫌婀栨花闄㈠尯' || orgname === '绗竴浜烘皯鍖婚櫌鍚村北闄㈠尯' || orgname === '绗竴浜烘皯鍖婚櫌鍩庝笢闄㈠尯')"
+            :show-overflow-tooltip="true"
+          >
+            <template slot-scope="scope">
+              <span>{{ scope.row._campusName || "-" }}</span>
+            </template>
+          </el-table-column>
           <el-table-column
             label="鎵嬫満鍙风爜"
             align="center"
@@ -552,6 +577,7 @@
   deptTreeSelect,
 } from "@/api/system/user";
 import { getToken } from "@/utils/auth";
+import { getorganization } from "@/api/AiCentre/index";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import { type } from "jquery";
@@ -572,6 +598,8 @@
       multiple: true,
       // 鏄剧ず鎼滅储鏉′欢
       showSearch: true,
+      // 褰撳墠鏈烘瀯鍚嶇О
+      orgname: localStorage.getItem("orgname") || "",
       // 鎬绘潯鏁�
       total: 0,
       // 鐢ㄦ埛琛ㄦ牸鏁版嵁
@@ -581,6 +609,12 @@
       // 閮ㄩ棬鏍戦�夐」
       deptOptionsks: undefined,
       deptOptionsbq: undefined,
+      // 绉戝缂栫爜 -> 鍚嶇О鏄犲皠
+      deptNameMap: {},
+      // 鐥呭尯缂栫爜 -> 鍚嶇О鏄犲皠
+      wardNameMap: {},
+      // 闄㈠尯缂栫爜 -> 鍚嶇О鏄犲皠
+      campusNameMap: {},
       // 鏄惁鏄剧ず寮瑰嚭灞�
       open: false,
       // 閮ㄩ棬鍚嶇О
@@ -636,10 +670,12 @@
         { key: 0, label: `鐢ㄦ埛缂栧彿`, visible: true },
         { key: 1, label: `鐢ㄦ埛宸ュ彿`, visible: true },
         { key: 2, label: `鐢ㄦ埛鏄电О`, visible: true },
-        { key: 3, label: `閮ㄩ棬`, visible: true },
+        { key: 3, label: `绉戝`, visible: true },
         { key: 4, label: `鎵嬫満鍙风爜`, visible: true },
         { key: 5, label: `鐘舵�乣, visible: true },
         { key: 6, label: `鍒涘缓鏃堕棿`, visible: true },
+        { key: 7, label: `鐥呭尯`, visible: true },
+        { key: 8, label: `闄㈠尯`, visible: true },
       ],
 
       // 琛ㄥ崟鏍¢獙
@@ -689,7 +725,6 @@
     },
   },
   created() {
-    this.getList();
     this.getDeptTree();
     this.getConfigKey("sys.user.initPassword").then((response) => {
       this.initPassword = response.msg;
@@ -712,6 +747,7 @@
         (response) => {
           this.userList = response.rows;
           this.total = response.total;
+          this.enrichUserDept();
           this.loading = false;
         }
       );
@@ -719,17 +755,74 @@
     /** 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋� */
     getDeptTree() {
       // 绉戝鍒楄〃
-      deptTreeSelect(1).then((response) => {
+      const ksPromise = deptTreeSelect(1).then((response) => {
         this.deptOptionsks = response.data;
+        this.deptNameMap = this.flattenDeptTree(response.data);
       });
       // 鐥呭尯鍒楄〃
-      deptTreeSelect(2).then((response) => {
+      const bqPromise = deptTreeSelect(2).then((response) => {
         this.deptOptionsbq = response.data;
+        this.wardNameMap = this.flattenDeptTree(response.data);
       });
       // 闄㈠尯鍒楄〃
-      //  deptTreeSelect().then((response) => {
-      //   this.deptOptions = response.data;
-      // });
+      const campusPromise = getorganization({ pageSize: 100 }).then((res) => {
+        if (res.code == 200) {
+          (res.rows || []).forEach((item) => {
+            this.campusNameMap[String(item.organizationID)] =
+              item.organizationName;
+          });
+        }
+      });
+      // 绉戝/鐥呭尯/闄㈠尯鏄犲皠灏辩华鍚庡啀鍔犺浇鍒楄〃锛屼繚璇侀灞忚兘鏄剧ず鍚嶇О
+      Promise.all([ksPromise, bqPromise, campusPromise]).then(() => {
+        this.getList();
+      });
+    },
+    /** 灏嗙瀹�/鐥呭尯鏍戞媿骞充负 { deptCode: label } 鏄犲皠 */
+    flattenDeptTree(nodes) {
+      const map = {};
+      const walk = (list) => {
+        (list || []).forEach((node) => {
+          if (node.deptCode) {
+            map[node.deptCode] = node.label;
+          }
+          if (node.children && node.children.length) {
+            walk(node.children);
+          }
+        });
+      };
+      walk(nodes);
+      return map;
+    },
+    /** 鎶� hospInfo/deptInfo 涓殑缂栫爜杞垚鍚嶇О锛屽啓鍏ヨ鐨勫睍绀哄瓧娈� */
+    enrichUserDept() {
+      (this.userList || []).forEach((row) => {
+        row._deptNames = this.mapCodesToNames(row.hospInfo, this.deptNameMap);
+        row._wardNames = this.mapCodesToNames(row.deptInfo, this.wardNameMap);
+        row._campusName = this.campusNameMap[String(row.campusid)] || "-";
+      });
+    },
+    /** 瑙f瀽缂栫爜 JSON 骞舵槧灏勪负鍚嶇О锛氱骇鑱旇矾寰勫悇灞傜敤 "/" 杩炴帴锛屽鏉$敤 "銆�" 杩炴帴 */
+    mapCodesToNames(jsonStr, nameMap) {
+      if (!jsonStr || !nameMap) return "";
+      let data = [];
+      try {
+        data = JSON.parse(jsonStr);
+      } catch (e) {
+        return "";
+      }
+      if (!Array.isArray(data)) data = [data];
+      return data
+        .map((item) => {
+          // 绾ц仈澶氶�夌殑鍊兼槸鏁存潯璺緞锛堟暟缁勶級锛屾棫鏁版嵁鍙兘鏄崟涓紪鐮�
+          const path = Array.isArray(item) ? item : [item];
+          return path
+            .map((code) => nameMap[code] || code)
+            .filter(Boolean)
+            .join(" / ");
+        })
+        .filter(Boolean)
+        .join("銆�");
     },
     // 绛涢�夎妭鐐�
     filterNode(value, data) {

--
Gitblit v1.9.3