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/role/updateUser/index.vue |  137 +++++++++++++++++++--------------------------
 1 files changed, 58 insertions(+), 79 deletions(-)

diff --git a/src/views/systemSetting/baseSetting/role/updateUser/index.vue b/src/views/systemSetting/baseSetting/role/updateUser/index.vue
index 5d2e253..eb2c505 100644
--- a/src/views/systemSetting/baseSetting/role/updateUser/index.vue
+++ b/src/views/systemSetting/baseSetting/role/updateUser/index.vue
@@ -1,8 +1,5 @@
 <template>
     <div class="updateUser">
-        <!-- <header>
-            <div class="headerTitle">{{updateFlag ? '淇敼瑙掕壊淇℃伅' :'鏌ョ湅瑙掕壊淇℃伅'}}</div>
-        </header> -->
         <main>
             <div class="mainContent">
                 <el-form ref="user" label-width="140px" autoComplete="on" :model="role" :rules="createRoleRules"
@@ -12,20 +9,18 @@
                         <el-input v-model="role.name" placeholder="璇峰~鍐欒鑹插悕绉�" :disabled="!updateFlag"></el-input>
                     </el-form-item>
                     <!-- 瑙掕壊绫诲瀷 -->
-                    <el-form-item class="optionItems" label="瑙掕壊绫诲瀷:" prop="status">
-                        <el-select v-model="role.status" placeholder="璇烽�夋嫨瑙掕壊绫诲瀷" :disabled="!updateFlag">
-                            <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value"
-                                :disabled="item.disabled">
-                            </el-option>
-                        </el-select>
+                    <el-form-item class="optionItems" label="瑙掕壊绫诲瀷:" prop="sort">
+                        <el-input v-model="role.sort" placeholder="璇烽�夋嫨瑙掕壊绫诲瀷" :disabled="!updateFlag"></el-input>
                     </el-form-item>
                     <!-- 瑙掕壊鎻忚堪 -->
                     <el-form-item class="optionItem" label="瑙掕壊鎻忚堪:" prop="description">
-                        <el-input v-model="role.description" placeholder="璇疯緭鍏ユ弿杩板唴瀹�200瀛椾互鍐�" :disabled="!updateFlag"></el-input>
+                        <el-input type="textarea" v-model="role.description" placeholder="璇疯緭鍏ユ弿杩板唴瀹�200瀛椾互鍐�"
+                            :disabled="!updateFlag"></el-input>
                     </el-form-item>
                     <el-form-item v-if="updateFlag">
                         <div class="optionBtn">
-                        <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">纭</el-button>
+                            <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">纭
+                            </el-button>
                         </div>
                     </el-form-item>
                 </el-form>
@@ -39,83 +34,81 @@
     data() {
         const validateNickname = (rule, value, callback) => {
             if (!value) {
-                callback(new Error("璇峰~鍐欑敤鎴峰悕绉�"));
+                callback(new Error("璇峰~鍐欒鑹插悕绉�"));
+            } 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涓嫳鏂囧瓧姣嶆垨鑰呬笅鍒掔嚎缁勬垚鐨勫瓧绗︿覆"));
-                }
+                // const rep = /^\w+$/;
+                // if (!rep.test(value)) {
+                //     callback(new Error("瀵嗙爜鍙兘鏄互鏁板瓧銆�26涓嫳鏂囧瓧姣嶆垨鑰呬笅鍒掔嚎缁勬垚鐨勫瓧绗︿覆"));
+                // }
+                callback();
             }
         };
         const validateTruename = (rule, value, callback) => {
-            if (!value) {
-                callback(new Error("璇峰~鍐欑敤鎴峰鍚�"));
+            if (value) {
+                callback();
             } else {
-                const rep = /^[\u4E00-\u9FA5]{2,4}$/;
-                if (!rep.test(value)) {
-                    callback("璇疯緭鍏ユ纭殑鐢ㄦ埛濮撳悕");
-                }
+                // const rep = /^[\u4E00-\u9FA5]{2,4}$/;
+                // if (!rep.test(value)) {
+                //     callback("璇疯緭鍏ユ纭殑鐢ㄦ埛濮撳悕");
+                // }
+                callback();
             }
         };
         return {
             role: {
-                id:'',
                 name: '',
-                status: '',
+                sort: '',
                 description: '',
             },
             createRoleRules: {
                 name: [
                     { required: true, trigger: "blur", validator: validateNickname },
                 ],
-                status: [
+                sort: [
                     { required: false, trigger: "blur", validator: validatePass },
                 ],
                 description: [
                     { required: false, trigger: "blur", validator: validateTruename },
                 ],
             },
-            roleList: [
-                { name: '瑙掕壊1', value: 1 }, { name: '瑙掕壊2', value: 2 }
-            ],
-            typeList: []
         }
     },
     created() {
         const that = this;
-        this.userInfo.status ? this.userInfo.status = 1: this.userInfo.status = 0;
+        this.userInfo.status ? this.userInfo.status = 1 : this.userInfo.status = 0;
         this.role = JSON.parse(JSON.stringify(that.userInfo));
-        // 鑾峰彇瑙掕壊鍒楄〃
-        // this.$axios.get('')
-        // 鑾峰彇鐢ㄦ埛绫诲瀷鍒楄〃
-        // this.$axios.get('sccg/admin/list',{userType:0}).then(res=>{
-        //     console.log(res);
-        // })
-        // 鑾峰彇鍏ㄩ儴閮ㄩ棬鍒楄〃
-        this.$axios.get('sccg/depart/page').then(res => {
-            that.typeList = res.data.records;
-        })
+        console.log(this.role);
     },
     methods: {
         handleUser() {
-            const { role } = this;
-            this.$axios.post('/sccg/role/update/'+role.id, {
-                id:role.id,
-                status: role.status,
-                description:role.description,
-                name:role.name
-            }).then(res => {
-                this.$emit('changeDialog',{dialogUpdate:false});
-                this.getUserList();
+            this.$refs.user.validate((valid) => {
+                console.log(valid);
+                if (valid) {
+                    const { role } = this;
+                    this.$axios.post('/sccg/role/update/' + role.id, {
+                        id: role.id,
+                        status: role.status,
+                        description: role.description,
+                        name: role.name,
+                        sort:role.sort
+                    }).then(res => {
+                        this.$emit('changeDialog', { dialogUpdate: false });
+                        this.getUserList();
+                    })
+                } else {
+                    return false;
+                }
             })
         }
     },
-    props: ['userInfo', 'updateFlag','getUserList','changeDialog']
+    props: ['userInfo', 'updateFlag', 'getUserList', 'changeDialog']
 }
 </script>
 <style lang="scss" scoped>
@@ -123,37 +116,18 @@
     border-radius: 1px;
     background-color: #09152f;
 
-    // header {
-    //     display: flex;
-    //     justify-content: center;
-    //     height: 60px;
-    //     line-height: 60px;
-    //     padding: 0 20px;
-    //     border: 1px solid #fff;
-    //     .headerTitle {
-    //         color: #4b9bb7;
-    //         font-weight: 600;
-    //     }
-
-    //     .headerTip span {
-    //         color: #ff3b6c;
-    //     }
-
-    //     .headerTip label {
-    //         color: #4b9bb7;
-    //     }
-    // }
-
     main {
         // border: 1px solid #fff;
         text-align: left;
         padding: 0 55px;
         background-color: #09152f;
         padding-bottom: 50px;
+
         .mainContent {
             display: flex;
             justify-content: center;
             padding-top: 50px;
+
             .el-form-item__content {
                 width: 400px;
 
@@ -186,14 +160,19 @@
 
         }
     }
-}
 
-.updateUser::v-deep .el-form-item__label {
-    color: #4b9bb7;
-}
+    &::v-deep .el-textarea__inner {
+        background-color: #09152f;
+        border: 1px solid #17324c;
+    }
 
-.updateUser::v-deep .el-input__inner {
-    background-color: #09152f;
-    border: 1px solid #17324c;
+    ::v-deep .el-form-item__label {
+        color: #4b9bb7;
+    }
+
+    ::v-deep .el-input__inner {
+        background-color: #09152f;
+        border: 1px solid #17324c;
+    }
 }
 </style>
\ No newline at end of file

--
Gitblit v1.8.0