From 38caeb98d38808aa76a5e04d18b28387018de9a5 Mon Sep 17 00:00:00 2001
From: mg <maokecheng@163.com>
Date: 星期五, 28 十月 2022 18:13:42 +0800
Subject: [PATCH] Merge branch 'master' of http://42.193.1.25:9521/r/sccg_ui
---
src/views/systemSetting/baseSetting/role/createUser/index.vue | 122 ++++++++++++++++++----------------------
1 files changed, 54 insertions(+), 68 deletions(-)
diff --git a/src/views/systemSetting/baseSetting/role/createUser/index.vue b/src/views/systemSetting/baseSetting/role/createUser/index.vue
index 9d8fbc2..442819b 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,21 @@
</el-form-item>
<!-- 瑙掕壊绫诲瀷 -->
<el-form-item class="optionItems" label="瑙掕壊绫诲瀷:" prop="status">
+ <!-- <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 v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</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>
@@ -39,80 +34,88 @@
</div>
</template>
<script>
+import { getTypeList } from '@/utils/helper'
export default {
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: []
+ typeList:[],
}
},
created() {
const that = this;
// 鑾峰彇瑙掕壊鍒楄〃
- // 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;
- })
+ this.getRoleTypeList();
},
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();
+ },
+ // 鑾峰彇瑙掕壊绫诲瀷
+ async getRoleTypeList(){
+ this.typeList = await getTypeList(1,'09');
}
},
props: ['refresh']
@@ -123,30 +126,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 +136,7 @@
display: flex;
justify-content: center;
padding-top: 50px;
+
&::v-deep .el-form-item__label {
color: #4b9bb7;
}
@@ -165,6 +146,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