|
@@ -20,7 +20,7 @@
|
|
|
</el-col>
|
|
|
<!-- 表格 -->
|
|
|
<el-table :data="tableData" style="width: 100%" height="615">
|
|
|
- <el-table-column prop="rolename" label="角色">
|
|
|
+ <el-table-column prop="rolename" label="角色" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
{{scope.row.rolename}} <span v-if="scope.row.isDefault == 1" style="color: #909399;"> - (默认角色)</span>
|
|
|
</template>
|
|
@@ -89,15 +89,15 @@
|
|
|
<!-- 添加角色弹窗 -->
|
|
|
<el-dialog :title="titles" :visible.sync="addDialogVisible" width="600px" :before-close="handleClose">
|
|
|
<div>
|
|
|
- <el-form ref="form" :model="form" label-width="80px">
|
|
|
- <el-form-item label="角色名称">
|
|
|
+ <el-form ref="form" :rules="rules" :model="form" label-width="80px">
|
|
|
+ <el-form-item label="角色名称" prop="rolename">
|
|
|
<el-input v-model="form.rolename" clearable></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="描述">
|
|
|
- <el-input type="textarea" v-model="form.roleDescribe" clearable></el-input>
|
|
|
+ <el-input type="textarea" v-model="form.roleDescribe" maxlength="25" show-word-limit clearable></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button style="float: right" type="primary" @click="onSubmit()">确定</el-button>
|
|
|
+ <el-button style="float: right" type="primary" @click="onSubmit('form')">确定</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -151,7 +151,12 @@ export default {
|
|
|
auseList: [],
|
|
|
defaultRole: false,
|
|
|
roleId: '',
|
|
|
- roleName: ''
|
|
|
+ roleName: '',
|
|
|
+ rules: {
|
|
|
+ rolename: [{
|
|
|
+ required: true, message: '请输入角色名称', trigger: 'blur'
|
|
|
+ }]
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
@@ -292,32 +297,40 @@ export default {
|
|
|
this.form = ss
|
|
|
},
|
|
|
// 添加角色
|
|
|
- onSubmit() {
|
|
|
+ onSubmit(formName) {
|
|
|
// var ss = this.form
|
|
|
- this.http.post('/permission/editRole', {
|
|
|
- id: this.form.id,
|
|
|
- name: this.form.rolename,
|
|
|
- description: this.form.roleDescribe,
|
|
|
- companyId: this.user.companyId
|
|
|
- },
|
|
|
- res => {
|
|
|
- if (res.code == "ok") {
|
|
|
- console.log(res.data, '数据来源(123)')
|
|
|
- this.addDialogVisible = false
|
|
|
- this.getRole()
|
|
|
- } else {
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.http.post('/permission/editRole', {
|
|
|
+ id: this.form.id,
|
|
|
+ name: this.form.rolename,
|
|
|
+ description: this.form.roleDescribe,
|
|
|
+ companyId: this.user.companyId
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ if (res.code == "ok") {
|
|
|
+ console.log(res.data, '数据来源(123)')
|
|
|
+ this.addDialogVisible = false
|
|
|
+ this.getRole()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
this.$message({
|
|
|
- message: res.msg,
|
|
|
+ message: error,
|
|
|
type: "error"
|
|
|
});
|
|
|
- }
|
|
|
- },
|
|
|
- error => {
|
|
|
- this.$message({
|
|
|
- message: error,
|
|
|
- type: "error"
|
|
|
});
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
},
|
|
|
deteHand(item) {
|
|
|
this.$confirm('此操作将删除('+item.rolename+')角色, 是否继续?', '提示', {
|