|
@@ -45,7 +45,7 @@
|
|
|
<el-input v-model="form.name" placeholder="请输入角色名称"></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="角色权限">
|
|
|
+ <el-form-item label="角色权限" v-if="form.platform == 'admin'">
|
|
|
<el-input
|
|
|
placeholder="请选择"
|
|
|
@focus="showPermission = true"
|
|
@@ -202,7 +202,9 @@ export default {
|
|
|
case "handleDetail":
|
|
|
roleApi.getDetail(row.id).then((res) => {
|
|
|
this.form = res.data;
|
|
|
- this.form.permission_codes = res.data.permission_codes.split(",");
|
|
|
+ this.form.permission_codes = res.data.permission_codes
|
|
|
+ ? res.data.permission_codes.split(",")
|
|
|
+ : [];
|
|
|
this.dialogType = "edit";
|
|
|
this.dialogConfig.title = "编辑角色";
|
|
|
this.open("edit");
|
|
@@ -241,20 +243,27 @@ export default {
|
|
|
this.$refs.dialogAdd.config.title = "新增角色";
|
|
|
} else {
|
|
|
this.$refs.dialogAdd.config.title = "编辑角色";
|
|
|
- this.$nextTick(() => {
|
|
|
+ if(this.form.platform=="admin"){
|
|
|
+ this.$nextTick(() => {
|
|
|
this.$refs.ptree.setCheckedKeys(this.form.permission_codes);
|
|
|
});
|
|
|
+ }
|
|
|
}
|
|
|
this.$refs.dialogAdd.open((cancel) => {
|
|
|
this.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- let selPer = this.$refs.ptree.getCheckedKeys();
|
|
|
- let selNodes = [];
|
|
|
- this.$refs.ptree.getCheckedNodes().forEach((item) => {
|
|
|
- selNodes.push(item.name);
|
|
|
- });
|
|
|
- this.form.permission_codes = selPer.join(",");
|
|
|
- this.form.permission_names = selNodes.join(",");
|
|
|
+ if (this.form.platform == "admin") {
|
|
|
+ let selPer = this.$refs.ptree.getCheckedKeys();
|
|
|
+ let selNodes = [];
|
|
|
+ this.$refs.ptree.getCheckedNodes().forEach((item) => {
|
|
|
+ selNodes.push(item.name);
|
|
|
+ });
|
|
|
+ this.form.permission_codes = selPer.join(",");
|
|
|
+ this.form.permission_names = selNodes.join(",");
|
|
|
+ }else{
|
|
|
+ this.form.permission_codes = "";
|
|
|
+ this.form.permission_names = "";
|
|
|
+ }
|
|
|
if (type == "edit") {
|
|
|
roleApi.edit(this.form).then((res) => {
|
|
|
if (res.mess == "success") {
|