From ba9dbeee7c139c67d770afe0053f06f1f235e565 Mon Sep 17 00:00:00 2001
From: qinxianzhangyao <11053546+qinxianzhangyao@user.noreply.gitee.com>
Date: 星期二, 17 十月 2023 10:56:35 +0800
Subject: [PATCH] qxtj

---
 src/views/system/user/index.vue |   66 ++++++++++++++++++++------------
 1 files changed, 41 insertions(+), 25 deletions(-)

diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index c3a6932..1c496fd 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -78,7 +78,7 @@
           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
         </el-row>
 
-        <el-table v-loading="loading" :data="userList" border @selection-change="handleSelectionChange"
+        <el-table  :data="userList" border @selection-change="handleSelectionChange" v-loading="loading"
           highlight-current-row>
           <el-table-column type="selection" width="50" align="center" fixed="left" />
           <el-table-column label="搴忓彿" align="center" key="newID" prop="newID" width="50px" fixed="left" />
@@ -233,16 +233,20 @@
             <!-- <el-input v-model="form.nationDesc" placeholder="璇疯緭鍏ユ皯鏃忔弿杩�"/> -->
           </el-form-item>
 
-          <el-form-item label="鎵�鍦ㄩ櫌鍖�" prop="hospName">
-            <el-select v-model="form.hospName" placeholder="璇烽�夋嫨鎵�鍦ㄩ櫌鍖�" clearable style="width: 200px" filterable>
+          <el-form-item label="鎵�鍦ㄥ尰闄�" prop="hospId">
+            <el-select v-model="form.hospId" placeholder="璇烽�夋嫨鎵�鍦ㄥ尰闄�" clearable style="width: 200px" filterable  @change="sendhospName">
               <el-option v-for="dict in hospList" :key="dict.hospAreaName" :label="dict.hospAreaName"
                 :value="dict.hospAreaId" />
             </el-select>
             <!-- <el-input v-model="form.hospName" placeholder="璇疯緭鍏ョ粍缁囦腑鏂囧悕绉�" /> -->
           </el-form-item>
           <el-form-item label="褰掑睘绉戝" prop="deptId">
-            <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="璇烽�夋嫨褰掑睘绉戝"
-              style="width: 200px" />
+            <!-- <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="璇烽�夋嫨褰掑睘绉戝"
+              style="width: 200px" /> -->
+              <el-select v-model="form.deptId" placeholder="璇烽�夋嫨褰掑睘绉戝" clearable style="width: 200px" filterable  >
+              <el-option v-for="dict in DepartmentList" :key="dict.deptName" :label="dict.deptName"
+                :value="dict.deptId" />
+            </el-select>
           </el-form-item>
 
           <el-form-item label="鍏ヨ亴鏃ユ湡" prop="entryDate">
@@ -657,9 +661,9 @@
       :visible.sync="dialogVisible1"
       width="30%"
       :before-close="handleClose">
-      <el-form>
+      <el-form :rules="rules1">
         <span>璇疯緭鍏モ�渰{row.userName}}鈥濈殑鏂板瘑鐮�</span>
-        <el-form-item>
+        <el-form-item prop="password">
           <el-input v-model="password" :type="type" auto-complete="off" placeholder="瀵嗙爜" ref="barcodeMsg">
             <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
             <i slot="suffix" class="icon-style" :class="elIcon" autocomplete="auto" @click="flag = !flag" /></el-input>
@@ -684,7 +688,7 @@
   resetUserPwd,
   changeUserStatus,
   deptTreeSelect,
-  getUserInfo,
+  getDeptListByDictHospId,
 } from "@/api/system/user";
 import { getToken } from "@/utils/auth";
 import { listHosp } from "@/api/hosp/hosp";
@@ -746,6 +750,7 @@
       dialogVisible: false,
       // 鐢ㄦ埛琛ㄦ牸鏁版嵁
       sysUserList: [],
+      DepartmentList:[],
       // 宀椾綅琛ㄦ牸鏁版嵁
       postList: [],
       // 瑙掕壊琛ㄦ牸鏁版嵁
@@ -858,6 +863,17 @@
           },
         ],
       },
+      rules1: {
+        password: [
+          { required: true, message: "鐢ㄦ埛瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" },
+          {
+            min: 5,
+            max: 20,
+            message: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜� 20 涔嬮棿",
+            trigger: "blur",
+          },
+        ],
+      },
     };
   },
   watch: {
@@ -877,12 +893,10 @@
   created() {
     this.getList();
     this.getDeptTree();
-    this.getlistHosp();
-    this.getPostList();
-    this.getRoleList();
-    this.getConfigKey("sys.user.initPassword").then((response) => {
-      this.initPassword = response.msg;
-    });
+    // this.getRoleList();
+    // this.getConfigKey("sys.user.initPassword").then((response) => {
+    //   this.initPassword = response.msg;
+    // });
   },
   methods: {
     handleChange(val) { },
@@ -898,12 +912,6 @@
               1;
           });
           this.userList = response.rows;
-          // for(let key in this.userList){
-          //   for(let i = 0; i < this.userList[key].length; i++){
-          //     this.userList[key][i]["form"] = key;
-          //     this.userInfoList.push(this.userList[key][i])
-          //   }
-          // }
           this.total = response.total;
           this.loading = false;
         }
@@ -925,11 +933,9 @@
     },
     /** 鏌ヨ闄㈠尯淇℃伅鍒楄〃 */
     getlistHosp() {
-      this.loading = true;
       listHosp(this.queryParams).then((response) => {
         this.hospList = response.rows;
         this.total = response.total;
-        this.loading = false;
       });
     },
 
@@ -941,7 +947,6 @@
     getDeptTree() {
       deptTreeSelect().then((response) => {
         this.deptOptions = response.data;
-        console.log(this.deptOptions);
       });
     },
     // 绛涢�夎妭鐐�
@@ -1043,12 +1048,23 @@
       this.reset();
       this.open = true;
       this.title = "鐢ㄦ埛淇℃伅缁存姢";
+      this.getPostList();
+      this.getlistHosp();
       // getUser().then((response) => {
       //   this.postOptions = response.posts;
       //   this.roleOptions = response.roles;
       //   this.form.password = this.initPassword;
 
       // });
+    },
+
+    sendhospName(){
+      let data = {
+        id:this.form.hospId
+      }
+      getDeptListByDictHospId(data).then(res => {
+        this.DepartmentList = res.data
+      })
     },
 
     handleUp(row) {
@@ -1073,6 +1089,8 @@
     },
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleUpdate(row) {
+      this.getPostList();
+      this.getlistHosp();
       this.reset();
       this.form = row;
       // this.form.userInfo.id = null;
@@ -1106,7 +1124,6 @@
     },
     /** 閲嶇疆瀵嗙爜鎸夐挳鎿嶄綔 */
     handleResetPwd(row) {
-      console.log(row);
       this.dialogVisible1 = true;
       this.row = row;
       // this.$prompt('璇疯緭鍏�"' + row.userName + '"鐨勬柊瀵嗙爜', "鎻愮ず", {
@@ -1131,7 +1148,6 @@
         userId:this.row.userId,
       }
       resetUserPwd(data).then(res=>{
-        console.log(res);
         if(res.code == 200){
           this.$modal.msgSuccess("淇敼鎴愬姛");
           this.dialogVisible1 = false;

--
Gitblit v1.8.0