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/createUser/index.vue |  113 +++++++++++++++++++++++++-------------------------------
 1 files changed, 51 insertions(+), 62 deletions(-)

diff --git a/src/views/systemSetting/baseSetting/role/createUser/index.vue b/src/views/systemSetting/baseSetting/role/createUser/index.vue
index 9d8fbc2..5208019 100644
--- a/src/views/systemSetting/baseSetting/role/createUser/index.vue
+++ b/src/views/systemSetting/baseSetting/role/createUser/index.vue
@@ -1,11 +1,5 @@
 <template>
     <div class="createUser">
-        <!-- <header>
-            <div class="headerTitle">鏂板瑙掕壊</div>
-            <div class="headerTip">
-                <label>x</label>
-            </div>
-        </header> -->
         <main>
             <div class="mainContent">
                 <el-form ref="user" label-width="140px" autoComplete="on" :model="role" :rules="createRoleRules"
@@ -16,20 +10,22 @@
                     </el-form-item>
                     <!-- 瑙掕壊绫诲瀷 -->
                     <el-form-item class="optionItems" label="瑙掕壊绫诲瀷:" prop="status">
-                        <el-select v-model="role.type" placeholder="璇烽�夋嫨瑙掕壊绫诲瀷">
+                        <el-input v-model="role.type" placeholder="璇烽�夋嫨瑙掕壊绫诲瀷"></el-input>
+                        <!-- <el-select v-model="role.type" placeholder="璇烽�夋嫨瑙掕壊绫诲瀷">
                             <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value"
                                 :disabled="item.disabled">
                             </el-option>
-                        </el-select>
+                        </el-select> -->
                     </el-form-item>
                     <!-- 瑙掕壊鎻忚堪 -->
                     <el-form-item class="optionItem" label="瑙掕壊鎻忚堪:" prop="description">
-                        <el-input v-model="role.description" placeholder="璇疯緭鍏ユ弿杩板唴瀹�200瀛椾互鍐�"></el-input>
+                        <el-input type="textarea" v-model="role.description" placeholder="璇疯緭鍏ユ弿杩板唴瀹�200瀛椾互鍐�"></el-input>
                     </el-form-item>
                     <el-form-item>
                         <div class="optionBtn">
-                            <el-button  class="btn cancel" >鍙栨秷</el-button>
-                        <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">鎻愪氦</el-button>
+                            <el-button class="btn cancel" @click="handleStop">鍙栨秷</el-button>
+                            <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">鎻愪氦
+                            </el-button>
                         </div>
                     </el-form-item>
                 </el-form>
@@ -43,50 +39,50 @@
     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: {
+                name: '',
                 type: '',
-                status: '',
                 description: '',
             },
             createRoleRules: {
                 name: [
                     { required: true, trigger: "blur", validator: validateNickname },
                 ],
-                status: [
+                type: [
                     { required: false, trigger: "blur", validator: validatePass },
                 ],
                 description: [
                     { required: false, trigger: "blur", validator: validateTruename },
                 ],
             },
-            roleList: [
-                { name: '瑙掕壊1', value: 1 }, { name: '瑙掕壊2', value: 2 }
-            ],
-            typeList: []
         }
     },
     created() {
@@ -98,21 +94,31 @@
         //     console.log(res);
         // })
         // 鑾峰彇鍏ㄩ儴閮ㄩ棬鍒楄〃
-        this.$axios.get('sccg/depart/page').then(res => {
-            that.typeList = res.data.records;
-        })
+        // this.$axios.get('sccg/depart/page').then(res => {
+        //     that.typeList = res.data.records;
+        // })
     },
     methods: {
         handleUser() {
-            const { role } = this;
-            console.log(role);
-            this.$axios.post('sccg/role/create', {
-                description:role.description,name:role.name,type:role.type
-            }).then(res => {
-                if (res.code === 200) {
-                    this.refresh();
+            this.$refs['user'].validate((valid) => {
+                console.log(valid);
+                if (valid) {
+                    const { role } = this;
+                    console.log(role);
+                    this.$axios.post('sccg/role/create', {
+                        description: role.description, name: role.name, type: role.type
+                    }).then(res => {
+                        if (res.code === 200) {
+                            this.refresh();
+                        }
+                    })
+                } else {
+                    return false;
                 }
             })
+        },
+        handleStop(){
+            this.refresh();
         }
     },
     props: ['refresh']
@@ -123,30 +129,7 @@
     border-radius: 1px;
     background-color: #09152f;
 
-    // header {
-    //     display: flex;
-    //     justify-content: space-between;
-    //     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;
@@ -156,6 +139,7 @@
             display: flex;
             justify-content: center;
             padding-top: 50px;
+
             &::v-deep .el-form-item__label {
                 color: #4b9bb7;
             }
@@ -165,6 +149,11 @@
                 border: 1px solid #17324c;
             }
 
+            &::v-deep .el-textarea__inner {
+                background-color: #09152f;
+                border: 1px solid #17324c;
+            }
+
             .el-form-item__content {
                 width: 400px;
 

--
Gitblit v1.8.0