From dda82a85f10294bda3df4192aecc3f763bf629f8 Mon Sep 17 00:00:00 2001
From: qinxianzhangyao <11053546+qinxianzhangyao@user.noreply.gitee.com>
Date: 星期五, 13 十月 2023 09:02:56 +0800
Subject: [PATCH] xpdytj

---
 src/views/system/user/index.vue |  109 ++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 81 insertions(+), 28 deletions(-)

diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 146e883..89875c4 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" />
@@ -650,6 +650,27 @@
         <el-button @click="upload.open = false">鍙� 娑�</el-button>
       </div>
     </el-dialog>
+
+    <!-- 閲嶇疆瀵嗙爜瀵硅瘽妗� -->
+    <el-dialog
+      title="鎻愮ず"
+      :visible.sync="dialogVisible1"
+      width="30%"
+      :before-close="handleClose">
+      <el-form :rules="rules1">
+        <span>璇疯緭鍏モ�渰{row.userName}}鈥濈殑鏂板瘑鐮�</span>
+        <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>
+        </el-form-item>
+      </el-form>
+      
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="tijiao">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -694,6 +715,10 @@
   components: { Treeselect },
   data() {
     return {
+      row:[],
+      flag: false,
+      password:"",
+      dialogVisible1:false,
       nums: "",
       userInfoList: [],
       hospList: [],
@@ -833,6 +858,17 @@
           },
         ],
       },
+      rules1: {
+        password: [
+          { required: true, message: "鐢ㄦ埛瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" },
+          {
+            min: 5,
+            max: 20,
+            message: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜� 20 涔嬮棿",
+            trigger: "blur",
+          },
+        ],
+      },
     };
   },
   watch: {
@@ -841,15 +877,21 @@
       this.$refs.tree.filter(val);
     },
   },
+  computed: {
+    type() {
+      return this.flag ? "text" : "password";
+    },
+    elIcon() {
+      return this.flag ? "el-icon-minus" : "el-icon-view";
+    }
+  },
   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) { },
@@ -865,12 +907,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;
         }
@@ -892,11 +928,9 @@
     },
     /** 鏌ヨ闄㈠尯淇℃伅鍒楄〃 */
     getlistHosp() {
-      this.loading = true;
       listHosp(this.queryParams).then((response) => {
         this.hospList = response.rows;
         this.total = response.total;
-        this.loading = false;
       });
     },
 
@@ -908,7 +942,6 @@
     getDeptTree() {
       deptTreeSelect().then((response) => {
         this.deptOptions = response.data;
-        console.log(this.deptOptions);
       });
     },
     // 绛涢�夎妭鐐�
@@ -1010,6 +1043,8 @@
       this.reset();
       this.open = true;
       this.title = "鐢ㄦ埛淇℃伅缁存姢";
+      this.getPostList();
+      this.getlistHosp();
       // getUser().then((response) => {
       //   this.postOptions = response.posts;
       //   this.roleOptions = response.roles;
@@ -1040,6 +1075,8 @@
     },
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleUpdate(row) {
+      this.getPostList();
+      this.getlistHosp();
       this.reset();
       this.form = row;
       // this.form.userInfo.id = null;
@@ -1073,19 +1110,35 @@
     },
     /** 閲嶇疆瀵嗙爜鎸夐挳鎿嶄綔 */
     handleResetPwd(row) {
-      this.$prompt('璇疯緭鍏�"' + row.userName + '"鐨勬柊瀵嗙爜', "鎻愮ず", {
-        confirmButtonText: "纭畾",
-        cancelButtonText: "鍙栨秷",
-        closeOnClickModal: false,
-        inputPattern: /^.{5,20}$/,
-        inputErrorMessage: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜� 20 涔嬮棿",
+      this.dialogVisible1 = true;
+      this.row = row;
+      // this.$prompt('璇疯緭鍏�"' + row.userName + '"鐨勬柊瀵嗙爜', "鎻愮ず", {
+      //   confirmButtonText: "纭畾",
+      //   cancelButtonText: "鍙栨秷",
+      //   closeOnClickModal: false,
+      //   inputPattern: /^.{5,20}$/,
+      //   inputErrorMessage: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜� 20 涔嬮棿",
+      //   inputType:'password'
+      // })
+      //   .then(({ value }) => {
+      //     resetUserPwd(row.userId, value).then((response) => {
+      //       this.$modal.msgSuccess("淇敼鎴愬姛");
+      //       // 锛屾柊瀵嗙爜鏄細" + value
+      //     });
+      //   })
+      //   .catch(() => { });
+    },
+    tijiao(){
+      let data = {
+        password:this.password,
+        userId:this.row.userId,
+      }
+      resetUserPwd(data).then(res=>{
+        if(res.code == 200){
+          this.$modal.msgSuccess("淇敼鎴愬姛");
+          this.dialogVisible1 = false;
+        }
       })
-        .then(({ value }) => {
-          resetUserPwd(row.userId, value).then((response) => {
-            this.$modal.msgSuccess("淇敼鎴愬姛锛屾柊瀵嗙爜鏄細" + value);
-          });
-        })
-        .catch(() => { });
     },
     /** 鍒嗛厤瑙掕壊鎿嶄綔 */
     handleAuthRole: function (row) {

--
Gitblit v1.8.0