|
@@ -46,20 +46,21 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="角色权限">
|
|
|
- <el-select
|
|
|
- v-model="form.permission_codes"
|
|
|
- filterable
|
|
|
+ <el-input
|
|
|
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>
|
|
|
</cloudDialog>
|
|
@@ -96,9 +97,8 @@ export default {
|
|
|
{
|
|
|
id: "1",
|
|
|
label: "角色权限",
|
|
|
- prop: "permission_codes",
|
|
|
+ prop: "permission_names",
|
|
|
show: true,
|
|
|
- // custom: "status",
|
|
|
},
|
|
|
],
|
|
|
data: [],
|
|
@@ -164,6 +164,11 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
+ defaultProps: {
|
|
|
+ label: "name",
|
|
|
+ children: "children",
|
|
|
+ },
|
|
|
+ showPermission: false,
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
@@ -201,6 +206,7 @@ export default {
|
|
|
this.dialogType = "edit";
|
|
|
this.dialogConfig.title = "编辑角色";
|
|
|
this.open("edit");
|
|
|
+
|
|
|
});
|
|
|
break;
|
|
|
case "handleDel":
|
|
@@ -236,12 +242,19 @@ export default {
|
|
|
this.$refs.dialogAdd.config.title = "新增角色";
|
|
|
} else {
|
|
|
this.$refs.dialogAdd.config.title = "编辑角色";
|
|
|
+ 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 (type == "edit") {
|
|
|
- this.form.permission_codes = this.form.permission_codes.join(",");
|
|
|
roleApi.edit(this.form).then((res) => {
|
|
|
if (res.mess == "success") {
|
|
|
this.getList();
|
|
@@ -255,7 +268,6 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
- this.form.permission_codes = this.form.permission_codes.join(",");
|
|
|
roleApi.add(this.form).then((res) => {
|
|
|
if (res.mess == "success") {
|
|
|
this.getList();
|