From 2bb0e066fdc522beb51dd13f6a72cd67bd5d6a58 Mon Sep 17 00:00:00 2001
From: “dzb” <2632970487@qq.com>
Date: 星期日, 09 十月 2022 18:06:46 +0800
Subject: [PATCH] 修改bug,店铺管理新增、查询

---
 src/views/systemSetting/baseSetting/department/updateUser/index.vue |  118 ++++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 68 insertions(+), 50 deletions(-)

diff --git a/src/views/systemSetting/baseSetting/department/updateUser/index.vue b/src/views/systemSetting/baseSetting/department/updateUser/index.vue
index c1280ce..6f1c887 100644
--- a/src/views/systemSetting/baseSetting/department/updateUser/index.vue
+++ b/src/views/systemSetting/baseSetting/department/updateUser/index.vue
@@ -1,8 +1,8 @@
 <template>
     <div class="updateUser">
-        <header>
-            <div class="headerTitle">{{updateFlag ? '淇敼鐢ㄦ埛閮ㄩ棬淇℃伅' :'鏌ョ湅鐢ㄦ埛淇℃伅'}}</div>
-        </header>
+        <!-- <header>
+             <div class="headerTitle">{{updateFlag ? '淇敼鐢ㄦ埛閮ㄩ棬淇℃伅' :'鏌ョ湅鐢ㄦ埛淇℃伅'}}</div>
+        </header> -->
         <main>
             <div class="mainContent">
                 <el-form ref="user" label-width="140px" autoComplete="on" :model="user" :rules="createUserRules"
@@ -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,27 @@
     },
     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;
+                    console.log(user)
+                    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', { flag: false });
+                        this.getUserList();
+                    })
+                } else {
+                    return false;
+                }
             })
         }
     },
@@ -146,46 +164,46 @@
     border-radius: 1px;
     background-color: #09152f;
 
-    header {
-        display: flex;
-        justify-content: center;
-        height: 60px;
-        line-height: 60px;
-        padding: 0 20px;
-        border: 1px solid #fff;
+    // header {
+    //     display: flex;
+    //     justify-content: center;
+    //     height: 60px;
+    //     line-height: 60px;
+    //     padding: 0 20px;
+    //     border: 1px solid #fff;
 
-        .headerTitle {
-            color: #4b9bb7;
-            font-weight: 600;
-        }
+    //     .headerTitle {
+    //         color: #4b9bb7;
+    //         font-weight: 600;
+    //     }
 
-        .headerTip span {
-            color: #ff3b6c;
-        }
+    //     .headerTip span {
+    //         color: #ff3b6c;
+    //     }
 
-        .headerTip label {
-            color: #4b9bb7;
-        }
-    }
+    //     .headerTip label {
+    //         color: #4b9bb7;
+    //     }
+    // }
 
     main {
-        border: 1px solid #fff;
+        // border: 1px solid #fff;
         text-align: left;
         padding: 0 55px;
         background-color: #09152f;
         padding-bottom: 50px;
 
-        .mainTitle {
-            color: #4b9bb7;
-            font-weight: 600;
-            line-height: 100px;
-            font-size: 14px;
-        }
+        // .mainTitle {
+        //     color: #4b9bb7;
+        //     font-weight: 600;
+        //     line-height: 100px;
+        //     font-size: 14px;
+        // }
 
         .mainContent {
             display: flex;
             justify-content: center;
-            margin-top: 50px;
+            padding-top: 50px;
 
             .el-form-item__content {
                 width: 400px;

--
Gitblit v1.8.0