|
@@ -46,20 +46,21 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="角色权限">
|
|
<el-form-item label="角色权限">
|
|
- <el-select
|
|
|
|
- v-model="form.permission_codes"
|
|
|
|
- filterable
|
|
|
|
|
|
+ <el-input
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
- multiple
|
|
|
|
|
|
+ @focus="showPermission=true"
|
|
|
|
+ ></el-input>
|
|
|
|
+ <el-tree
|
|
|
|
+ v-show="showPermission||dialogType=='edit'"
|
|
|
|
+ :data="roleList"
|
|
|
|
+ show-checkbox
|
|
|
|
+ default-expand-all
|
|
|
|
+ node-key="value"
|
|
|
|
+ ref="ptree"
|
|
|
|
+ highlight-current
|
|
|
|
+ :props="defaultProps"
|
|
>
|
|
>
|
|
- <el-option
|
|
|
|
- v-for="item in roleList"
|
|
|
|
- :key="item.id"
|
|
|
|
- :label="item.name"
|
|
|
|
- :value="item.codename"
|
|
|
|
- >
|
|
|
|
- </el-option>
|
|
|
|
- </el-select>
|
|
|
|
|
|
+ </el-tree>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</cloudDialog>
|
|
</cloudDialog>
|
|
@@ -96,9 +97,8 @@ export default {
|
|
{
|
|
{
|
|
id: "1",
|
|
id: "1",
|
|
label: "角色权限",
|
|
label: "角色权限",
|
|
- prop: "permission_codes",
|
|
|
|
|
|
+ prop: "permission_names",
|
|
show: true,
|
|
show: true,
|
|
- // custom: "status",
|
|
|
|
},
|
|
},
|
|
],
|
|
],
|
|
data: [],
|
|
data: [],
|
|
@@ -164,6 +164,11 @@ export default {
|
|
},
|
|
},
|
|
],
|
|
],
|
|
},
|
|
},
|
|
|
|
+ defaultProps: {
|
|
|
|
+ label: "name",
|
|
|
|
+ children: "children",
|
|
|
|
+ },
|
|
|
|
+ showPermission: false,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {},
|
|
computed: {},
|
|
@@ -201,6 +206,7 @@ export default {
|
|
this.dialogType = "edit";
|
|
this.dialogType = "edit";
|
|
this.dialogConfig.title = "编辑角色";
|
|
this.dialogConfig.title = "编辑角色";
|
|
this.open("edit");
|
|
this.open("edit");
|
|
|
|
+
|
|
});
|
|
});
|
|
break;
|
|
break;
|
|
case "handleDel":
|
|
case "handleDel":
|
|
@@ -236,12 +242,19 @@ export default {
|
|
this.$refs.dialogAdd.config.title = "新增角色";
|
|
this.$refs.dialogAdd.config.title = "新增角色";
|
|
} else {
|
|
} else {
|
|
this.$refs.dialogAdd.config.title = "编辑角色";
|
|
this.$refs.dialogAdd.config.title = "编辑角色";
|
|
|
|
+ this.$refs.ptree.setCheckedKeys(this.form.permission_codes);
|
|
}
|
|
}
|
|
this.$refs.dialogAdd.open((cancel) => {
|
|
this.$refs.dialogAdd.open((cancel) => {
|
|
this.$refs["form"].validate((valid) => {
|
|
this.$refs["form"].validate((valid) => {
|
|
if (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 (type == "edit") {
|
|
if (type == "edit") {
|
|
- this.form.permission_codes = this.form.permission_codes.join(",");
|
|
|
|
roleApi.edit(this.form).then((res) => {
|
|
roleApi.edit(this.form).then((res) => {
|
|
if (res.mess == "success") {
|
|
if (res.mess == "success") {
|
|
this.getList();
|
|
this.getList();
|
|
@@ -255,7 +268,6 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
- this.form.permission_codes = this.form.permission_codes.join(",");
|
|
|
|
roleApi.add(this.form).then((res) => {
|
|
roleApi.add(this.form).then((res) => {
|
|
if (res.mess == "success") {
|
|
if (res.mess == "success") {
|
|
this.getList();
|
|
this.getList();
|