|
@@ -150,23 +150,25 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
async visibleChange() {
|
|
async visibleChange() {
|
|
- if (this.instance.id && this.instance.type === "CUSTOM") {
|
|
|
|
|
|
+ if (this.instance.id) {
|
|
this.modalForm = this.$objAssign(initModalForm, this.instance);
|
|
this.modalForm = this.$objAssign(initModalForm, this.instance);
|
|
- let privilegeIds = await roleBoundPrivileges(this.instance.id);
|
|
|
|
- let checkedIds = [];
|
|
|
|
- const getCheckedIds = list => {
|
|
|
|
- list.forEach(item => {
|
|
|
|
- if (item["children"] && item["children"].length) {
|
|
|
|
- getCheckedIds(item.children);
|
|
|
|
- } else {
|
|
|
|
- const isChecked = privilegeIds.includes(item.id);
|
|
|
|
- if (isChecked) checkedIds.push(item.id);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
- getCheckedIds(this.menus);
|
|
|
|
- this.$refs.MenuTree.setCheckedKeys(checkedIds);
|
|
|
|
- this.modalForm.privilegeIds = checkedIds;
|
|
|
|
|
|
+ if (this.instance.type === "CUSTOM") {
|
|
|
|
+ let privilegeIds = await roleBoundPrivileges(this.instance.id);
|
|
|
|
+ let checkedIds = [];
|
|
|
|
+ const getCheckedIds = list => {
|
|
|
|
+ list.forEach(item => {
|
|
|
|
+ if (item["children"] && item["children"].length) {
|
|
|
|
+ getCheckedIds(item.children);
|
|
|
|
+ } else {
|
|
|
|
+ const isChecked = privilegeIds.includes(item.id);
|
|
|
|
+ if (isChecked) checkedIds.push(item.id);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ getCheckedIds(this.menus);
|
|
|
|
+ this.$refs.MenuTree.setCheckedKeys(checkedIds);
|
|
|
|
+ this.modalForm.privilegeIds = checkedIds;
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
this.modalForm = { ...initModalForm };
|
|
this.modalForm = { ...initModalForm };
|
|
this.$refs.MenuTree.setCheckedKeys([]);
|
|
this.$refs.MenuTree.setCheckedKeys([]);
|