From 5eea8066e149ade255d1440b350be6a8ee93b848 Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期一, 11 八月 2025 18:35:57 +0800
Subject: [PATCH] 1

---
 src/views/system/user/index.vue |   98 +++++++++++++++++++++++++++++++++---------------
 1 files changed, 67 insertions(+), 31 deletions(-)

diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 4a60aca..bccf0f7 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -13,7 +13,7 @@
             style="margin-bottom: 15px"
           />
         </div>
-        <div class="head-container">
+        <!-- <div class="head-container">
           <el-tree
             :data="deptOptions"
             :props="defaultProps"
@@ -26,6 +26,21 @@
             highlight-current
             @node-click="handleNodeClick"
           />
+        </div> -->
+        <div class="scrollable-container">
+          <div class="content">
+            <el-tree
+              :data="deptOptions"
+              :props="defaultProps"
+              :expand-on-click-node="false"
+              :filter-node-method="filterNode"
+              ref="tree"
+              node-key="id"
+              :default-expanded-keys="treeId"
+              highlight-current
+              @node-click="handleNodeClick"
+            />
+          </div>
         </div>
       </el-col>
 
@@ -359,7 +374,7 @@
                   icon="el-icon-d-arrow-right"
                   title="鏇村"
                 ></el-button>
-                <el-dropdown-menu slot="dropdown">
+                <el-dropdown-menu slot="dropdown" :append-to-body="true">
                   <el-dropdown-item
                     command="handleResetPwd"
                     icon="el-icon-key"
@@ -372,15 +387,6 @@
                     v-hasPermi="['system:user:edit']"
                     >鍒嗛厤瑙掕壊</el-dropdown-item
                   >
-                  <!-- 娣诲姞鐢ㄦ埛璇︽儏鎸夐挳 鐐瑰嚮璺冲嚭璇ョ敤鎴风殑璇︾粏淇℃伅椤甸潰 -->
-                  <!-- <el-button
-                    size="mini"
-                    type="text"
-                    icon="el-icon-share"
-                    @click="handleSearch(scope.row)"
-                    v-hasPermi="['hosp:Userinfo:list']"
-                    >璇︾粏淇℃伅</el-button
-                  > -->
                 </el-dropdown-menu>
               </el-dropdown>
             </template>
@@ -531,7 +537,7 @@
 
           <el-form-item label="鎵�鍦ㄥ尰闄�" prop="hospId">
             <el-select
-            v-if="hospList.length > 0" 
+              v-if="hospList.length > 0"
               v-model="form.hospId"
               placeholder="璇烽�夋嫨鎵�鍦ㄥ尰闄�"
               clearable
@@ -548,11 +554,10 @@
             </el-select>
             <!-- <el-input v-model="form.hospName" placeholder="璇疯緭鍏ョ粍缁囦腑鏂囧悕绉�" /> -->
           </el-form-item>
-          <el-form-item label="褰掑睘绉戝" prop="deptId">
+          <el-form-item label="褰掑睘绉戝" prop="deptId" >
             <!-- <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="璇烽�夋嫨褰掑睘绉戝"
               style="width: 200px" /> -->
-            <el-select
-            v-if="DepartmentList.length > 0" 
+            <el-select            
               v-model="form.deptId"
               placeholder="璇烽�夋嫨褰掑睘绉戝"
               clearable
@@ -1316,7 +1321,7 @@
           </el-collapse>
         </el-form>
         <div slot="footer" class="dialog-footer1">
-          <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
+          <el-button :disabled="submit" type="primary" @click="submitForm">纭� 瀹�</el-button>
           <el-button @click="cancel">鍙� 娑�</el-button>
         </div>
       </el-dialog>
@@ -1451,6 +1456,7 @@
       hospList: [],
       activeNames: ["1"],
       treeId: [],
+      selectedDeptId: null,
       // 閬僵灞�
       loading: true,
       // 閫変腑鏁扮粍
@@ -1459,6 +1465,7 @@
       single: true,
       // 闈炲涓鐢�
       multiple: true,
+      submit: false,
       // 鏄剧ず鎼滅储鏉′欢
       showSearch: true,
       // 鎬绘潯鏁�
@@ -1604,6 +1611,7 @@
     // 鏍规嵁鍚嶇О绛涢�夐儴闂ㄦ爲
     deptName(val) {
       console.log(val);
+      this.$refs.tree.filter(val);
     },
     treeId(newVal, oldVal) {
       if (newVal) {
@@ -1635,7 +1643,7 @@
     //   this.initPassword = response.msg;
     // });
   },
- 
+
   methods: {
     handleChange(val) {},
     /** 鏌ヨ鐢ㄦ埛鍒楄〃 */
@@ -1704,6 +1712,7 @@
     // 鑺傜偣鍗曞嚮浜嬩欢
     handleNodeClick(data) {
       this.queryParams.deptId = data.id;
+      this.selectedDeptId = data.id;
       this.handleQuery();
     },
     handlePackage() {
@@ -1738,10 +1747,11 @@
     cancel() {
       this.open = false;
       this.reset();
-      this.$tab.refreshPage();
+      // this.$tab.refreshPage();
     },
     handleClose() {
-      this.$tab.refreshPage();
+      this.cancel();
+      // this.$tab.refreshPage();
     },
     // 琛ㄥ崟閲嶇疆
     reset() {
@@ -1789,11 +1799,14 @@
       this.ids = selection.map((item) => item.userId);
       this.single = selection.length != 1;
       this.multiple = !selection.length;
+        if (selection.length >= 1) {
+        this.queryParams.userName = selection[0].userName
+      }
     },
 
     // 鏇村鎿嶄綔瑙﹀彂
     handleCommand(command, row) {
-      console.log('Command triggered:', command);
+      console.log("Command triggered:", command);
 
       switch (command) {
         case "handleResetPwd":
@@ -1819,6 +1832,9 @@
           this.sendhospName();
         }
       });
+      if (this.selectedDeptId) {
+        this.form.deptId = this.selectedDeptId;
+      }
       // getUser().then((response) => {
       //   this.postOptions = response.posts;
       //   this.roleOptions = response.roles;
@@ -1834,22 +1850,24 @@
       getDeptListByDictHospId(data).then((res) => {
         console.log(res, 123456);
         this.DepartmentList = res.data;
-        this.form.deptId = String(this.form.deptId);
+        // this.form.deptId = String(this.form.deptId);
       });
     },
 
-    handleUp(row) {
+       handleUp(row) {
       this.title = "鐢ㄦ埛淇℃伅缁存姢";
+
+      // this.form = row;
+
       this.open = true;
-      this.form = row;
-      this.form.hospId = Number(row.hospId);
-      // listUser(this.addDateRange(this.queryParams, this.dateRange)).then(
-      //   (response) => {
-      //     response.rows.forEach((item, index) => {
-      //       this.form = item;
-      //     });
-      //   }
-      // );
+      this.submit = false
+      listUser(this.addDateRange(this.queryParams, this.dateRange)).then(
+        (response) => {
+          response.rows.forEach((item, index) => {
+            this.form = item;
+          });
+        }
+      );
     },
     select(val) {
       this.postList.forEach((item) => {
@@ -1865,6 +1883,10 @@
       this.getlistHosp();
       this.reset();
       this.form = row;
+      this.form = {
+        ...row,
+        deptId: row.deptId != null ? String(row.deptId) : null, // 馃憟 纭繚涓哄瓧绗︿覆
+      };
       if (this.form.hospId) {
         this.sendhospName();
       }
@@ -1873,6 +1895,7 @@
       //   this.forms = this.form.userInfo;
       // }
       this.open = true;
+            this.submit = false
       this.title = "鐢ㄦ埛淇℃伅缁存姢";
     },
 
@@ -1882,9 +1905,11 @@
       this.$refs["form"].validate((valid) => {
         if (valid) {
           if (_this.form.userId !== undefined) {
+           _this.submit = true
             updateUser(_this.form).then((response) => {
               _this.$modal.msgSuccess("淇敼鎴愬姛");
               _this.open = false;
+               _this.submit = false
               _this.getList();
             });
           } else {
@@ -2019,6 +2044,17 @@
   line-height: 36px;
   width: 200px;
 }
+.scrollable-container {
+  width: 200px; /* 璁剧疆瀹瑰櫒鐨勫搴� */
+  height: 629px; /* 璁剧疆瀹瑰櫒鐨勯珮搴� */
+  overflow: auto; /* 鍏佽鍐呭婧㈠嚭鏃舵樉绀烘粴鍔ㄦ潯 */
+  border: 1px solid #ccc; /* 鍙�夛細娣诲姞杈规浠ユ洿濂藉湴鏄剧ず瀹瑰櫒 */
+  position: relative; /* 鍙�夛細浣垮鍣ㄥ唴鐨勭粷瀵瑰畾浣嶅厓绱犺兘澶熸纭樉绀� */
+}
+.content {
+  width: 600px; /* 璁剧疆鍐呭鐨勫搴︼紝浠ヨЕ鍙戞按骞虫粴鍔ㄦ潯 */
+  height: 1000px; /* 璁剧疆鍐呭鐨勯珮搴︼紝浠ヨЕ鍙戝瀭鐩存粴鍔ㄦ潯 */
+}
 
 .pag {
   width: 100%;

--
Gitblit v1.8.0