<template>
|
<div class="createUser">
|
<main>
|
<div class="mainContent">
|
<el-form ref="user" label-width="140px" autoComplete="on" :model="role" :rules="createRoleRules"
|
label-position="right">
|
<!-- 栏目名称 -->
|
<el-form-item class="optionItem" label="栏目名称:" prop="name">
|
<el-input v-model="role.name" placeholder="请填写栏目名称"></el-input>
|
</el-form-item>
|
<!-- 角色描述 -->
|
<el-form-item class="optionItem" label="栏目描述:" prop="description">
|
<el-input type="textarea" :rows="5" maxlength="300" show-word-limit v-model="role.description"
|
placeholder="请输入描述内容200字以内"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<div class="optionBtn">
|
<el-button class="btn cancel" @click.native.prevent="handleCancel">取消</el-button>
|
<el-button type="primary" class="btn submit" @click.native.prevent="handleUser">确定
|
</el-button>
|
</div>
|
</el-form-item>
|
</el-form>
|
|
</div>
|
</main>
|
</div>
|
</template>
|
<script>
|
export default {
|
data() {
|
const validateNickname = (rule, value, callback) => {
|
if (!value) {
|
callback(new Error("请填写栏目名称"));
|
} else {
|
callback();
|
}
|
};
|
const validateTruename = (rule, value, callback) => {
|
if (value) {
|
callback();
|
} else {
|
callback();
|
}
|
};
|
return {
|
role: {
|
name: '',
|
description: '',
|
},
|
createRoleRules: {
|
name: [
|
{ required: true, trigger: "blur", validator: validateNickname },
|
],
|
description: [
|
{ required: false, trigger: "blur", validator: validateTruename },
|
],
|
},
|
typeList: [],
|
}
|
},
|
created() {
|
},
|
methods: {
|
handleUser() {
|
this.$refs['user'].validate((valid) => {
|
if (valid) {
|
const { role } = this;
|
this.$axios({
|
method: 'post',
|
url: 'sccg/message_column/addColumn',
|
data: {
|
columnName: role.name,
|
createUser: 3,
|
description: role.description,
|
isShow: 1,
|
}
|
})
|
.then(res=>{
|
if(res.code === 200){
|
this.$message({
|
type:'success',
|
message:'添加成功'
|
})
|
this.$emit('closeDialog',{flag:false,index:1});
|
}else{
|
this.$message({
|
type:'error',
|
message:res.message
|
})
|
}
|
})
|
} else {
|
return false;
|
}
|
})
|
},
|
// 关闭弹窗
|
handleCancel(){
|
this.$emit('closeDialog',{flag:false,index:0});
|
}
|
},
|
props: ['closeDialog']
|
}
|
</script>
|
<style lang="scss" scoped>
|
.createUser {
|
border-radius: 1px;
|
background-color: white;
|
|
main {
|
text-align: left;
|
padding: 0 55px;
|
background-color: white;
|
padding-bottom: 50px;
|
|
.mainContent {
|
display: flex;
|
justify-content: center;
|
padding-top: 50px;
|
|
// &::v-deep .el-form-item__label {
|
// color: #606266;
|
// }
|
|
// &::v-deep .el-input__inner {
|
// //background-color: #09152f;
|
// border: 1px solid #17324c;
|
// }
|
|
// &::v-deep .el-textarea__inner {
|
// //background-color: #09152f;
|
// border: 1px solid #17324c;
|
// }
|
|
:deep(.el-input__count) {
|
//background-color: #09152f;
|
}
|
|
.el-form-item__content {
|
width: 400px;
|
|
.el-select {
|
width: 100%;
|
}
|
}
|
|
.optionHandleSp {
|
display: flex;
|
|
.areaNumber,
|
.moreNumber {
|
flex: 1;
|
}
|
|
.telNumber {
|
flex: 2;
|
}
|
}
|
|
.optionBtn {
|
display: flex;
|
margin-top: 20px;
|
|
.btn {
|
padding: 12px 50px;
|
}
|
}
|
|
}
|
}
|
}
|
</style>
|