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/system/user/index.vue |  138 ++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 116 insertions(+), 22 deletions(-)

diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 64a85ad..9c5693e 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -125,7 +125,7 @@
               size="mini"
               :disabled="single"
               @click="handleUpdate"
-              v-hasPermi="['system:user:edit']"
+
               >淇敼</el-button
             >
           </el-col>
@@ -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"
@@ -253,7 +278,7 @@
                 type="text"
                 icon="el-icon-edit"
                 @click="handleUpdate(scope.row)"
-                v-hasPermi="['system:user:edit']"
+
                 >淇敼</el-button
               >
               <el-button
@@ -282,7 +307,7 @@
                   <el-dropdown-item
                     command="handleAuthRole"
                     icon="el-icon-circle-check"
-                    v-hasPermi="['system:user:edit']"
+
                     >鍒嗛厤瑙掕壊</el-dropdown-item
                   >
                 </el-dropdown-menu>
@@ -331,7 +356,7 @@
             </el-form-item>
           </el-col>
         </el-row>
-        <el-form-item label="閫傜敤璇鹃缁�" prop="region">
+        <el-form-item label="閫傜敤绉戝" prop="region">
             <el-cascader
               style="width: 478px"
               v-model="form.deptCodes"
@@ -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,
       // 閮ㄩ棬鍚嶇О
@@ -626,7 +660,7 @@
         deptId: undefined,
       },
       searchscopelist: [
-        { value: "1", label: "璇鹃缁�" },
+        { value: "1", label: "绉戝" },
         { value: "2", label: "鐥呭尯" },
         { value: "0", label: "鍏ㄩ儴" },
         { value: "9", label: "鏃�" },
@@ -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,23 +747,82 @@
         (response) => {
           this.userList = response.rows;
           this.total = response.total;
+          this.enrichUserDept();
           this.loading = false;
         }
       );
     },
     /** 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋� */
     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) {
@@ -855,9 +949,9 @@
         this.form.password = "";
       });
     },
-    // 鍒犻櫎璇鹃缁�
+    // 鍒犻櫎绉戝
     removehpsp(valueArray) {
-      console.log(valueArray, "鍒犻櫎璇鹃缁�");
+      console.log(valueArray, "鍒犻櫎绉戝");
       console.log(this.form.userId, "鍒犻櫎");
       let code = valueArray[valueArray.length - 1];
       removeusertd(this.form.userId, code).then((res) => {
@@ -907,7 +1001,7 @@
             updateUser(this.form).then((response) => {
               this.$modal.msgSuccess("淇敼鎴愬姛");
               this.open = false;
-              this.adduserdept();
+              // this.adduserdept();
             });
           } else {
             addUser(this.form).then((response) => {
@@ -916,7 +1010,7 @@
               this.form.userId = response.data;
               console.log("寮�濮嬪姞閮ㄩ棬");
 
-              this.adduserdept();
+              // this.adduserdept();
             });
           }
         }

--
Gitblit v1.9.3