From 7991973cf4c25527e227b80192e0bd087cfcee58 Mon Sep 17 00:00:00 2001
From: “dzb” <2632970487@qq.com>
Date: 星期二, 27 九月 2022 18:26:25 +0800
Subject: [PATCH] 完善系统设置的基本设置

---
 src/views/systemSetting/baseSetting/department/updateUser/index.vue |   59 ++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/src/views/systemSetting/baseSetting/department/updateUser/index.vue b/src/views/systemSetting/baseSetting/department/updateUser/index.vue
index 44f43fc..e2cfc39 100644
--- a/src/views/systemSetting/baseSetting/department/updateUser/index.vue
+++ b/src/views/systemSetting/baseSetting/department/updateUser/index.vue
@@ -18,7 +18,8 @@
                     <!-- 涓婄骇閮ㄩ棬 -->
                     <el-form-item class="optionItems" label="涓婄骇閮ㄩ棬:" prop="parentId">
                         <el-select v-model="user.parentId" placeholder="璇烽�夋嫨涓婄骇閮ㄩ棬" :disabled="!updateFlag">
-                            <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value">
+                            <el-option v-for="item in typeList" :key="item.departName" :label="item.departName"
+                                :value="item.id">
                             </el-option>
                         </el-select>
                     </el-form-item>
@@ -51,31 +52,37 @@
         const validateNickname = (rule, value, callback) => {
             if (!value) {
                 callback(new Error("璇峰~鍐欓儴闂ㄥ悕绉�"));
+            } else {
+                callback();
             }
         };
         const validateId = (rule, value, callback) => {
             if (!value) {
                 callback(new Error("璇峰~鍐欓儴闂╥d"));
+            } else {
+                callback();
             }
         }
         const validatePass = (rule, value, callback) => {
             if (!value) {
-                callback(new Error("璇峰~鍐欑櫥褰曞瘑鐮�"));
+                callback();
             } else {
-                const rep = /^\w+$/;
-                if (!rep.test(value)) {
-                    callback(new Error("瀵嗙爜鍙兘鏄互鏁板瓧銆�26涓嫳鏂囧瓧姣嶆垨鑰呬笅鍒掔嚎缁勬垚鐨勫瓧绗︿覆"));
-                }
+                callback();
+                // const rep = /^\w+$/;
+                // if (!rep.test(value)) {
+                //     callback(new Error("瀵嗙爜鍙兘鏄互鏁板瓧銆�26涓嫳鏂囧瓧姣嶆垨鑰呬笅鍒掔嚎缁勬垚鐨勫瓧绗︿覆"));
+                // }
             }
         };
         const validatePhone = (rule, value, callback) => {
             if (!value) {
-                callback(new Error("璇峰~鍐欐墜鏈哄彿鐮�"));
+                callback();
             } else {
-                const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/
-                if (!rep.test(value)) {
-                    callback("璇疯緭鍏ユ纭殑鎵嬫満鍙风爜");
-                }
+                callback();
+                // const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/
+                // if (!rep.test(value)) {
+                //     callback("璇疯緭鍏ユ纭殑鎵嬫満鍙风爜");
+                // }
             }
         };
         return {
@@ -125,16 +132,26 @@
     },
     methods: {
         handleUser() {
-            const { user } = this;
-            const that = this;
-            this.$axios.post('sccg/depart/update', {
-                id: user.id,
-                departName: user.departName,
-                parentId: user.parentId,
-                departDes: user.departDes
-            }).then(res => {
-                this.$emit('changeDialog',{dialogUpdate:false});
-                this.getUserList();
+            this.$refs['user'].validate((valid) => {
+                if (valid) {
+                    const { user } = this;
+                    this.$axios.post('sccg/depart/update', {
+                        id: user.id,
+                        departName: user.departName,
+                        parentId: user.parentId,
+                        departDes: user.departDes
+                    }).then(res => {
+                        console.log(res);
+                        this.$message({
+                            message:res.message,
+                            type:res.code === 200 ? 'success' : 'warning',
+                        })
+                        this.$emit('changeDialog', { dialogUpdate: false });
+                        this.getUserList();
+                    })
+                } else {
+                    return false;
+                }
             })
         }
     },

--
Gitblit v1.8.0