|
@@ -29,9 +29,10 @@ |
|
|
show-checkbox |
|
|
show-checkbox |
|
|
node-key="id" |
|
|
node-key="id" |
|
|
@check="(_, val) => handleSelectMenuChange(val, 'doctorWorkChecks')" |
|
|
@check="(_, val) => handleSelectMenuChange(val, 'doctorWorkChecks')" |
|
|
:props="{ children: 'children', label: 'menuName', isLeaf: true }" |
|
|
|
|
|
|
|
|
:props="{ children: 'children', label: 'menuName', }" |
|
|
default-expand-all |
|
|
default-expand-all |
|
|
></el-tree> |
|
|
></el-tree> |
|
|
|
|
|
<!-- isLeaf: true --> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="tree-menu-item"> |
|
|
<div class="tree-menu-item"> |
|
@@ -115,9 +116,6 @@ export default { |
|
|
loading: false, |
|
|
loading: false, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
created() { |
|
|
|
|
|
this.loadAllMenuList(); |
|
|
|
|
|
}, |
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
loadAllMenuList() { |
|
|
loadAllMenuList() { |
|
|
return geMenuTreeList().then((res) => { |
|
|
return geMenuTreeList().then((res) => { |
|
@@ -127,6 +125,7 @@ export default { |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
async loadMenuIdList(roleId) { |
|
|
async loadMenuIdList(roleId) { |
|
|
|
|
|
await this.loadAllMenuList(); |
|
|
this.loading = true; |
|
|
this.loading = true; |
|
|
const [err, res] = await to(getRoleMenuList({ roleId })); |
|
|
const [err, res] = await to(getRoleMenuList({ roleId })); |
|
|
if (!err) { |
|
|
if (!err) { |
|
@@ -134,6 +133,9 @@ export default { |
|
|
this.form.saleManageChecks = res?.data?.saleManage || []; |
|
|
this.form.saleManageChecks = res?.data?.saleManage || []; |
|
|
this.form.saleProcessChecks = res?.data?.saleProcess || []; |
|
|
this.form.saleProcessChecks = res?.data?.saleProcess || []; |
|
|
} |
|
|
} |
|
|
|
|
|
this.form.doctorWorkChecks = this.form.doctorWorkChecks.filter(item => this.treeData.findIndex(item2 => item2.id === item) < 0) |
|
|
|
|
|
this.form.saleManageChecks = this.form.doctorWorkChecks.filter(item => this.treeData2.findIndex(item2 => item2.id === item) <0) |
|
|
|
|
|
this.form.saleProcessChecks = this.form.doctorWorkChecks.filter(item => this.treeData3.findIndex(item2 => item2.id === item) <0) |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
console.log("this.$refs.tree=", this.$refs.tree); |
|
|
console.log("this.$refs.tree=", this.$refs.tree); |
|
|
this.$refs.tree.setCheckedKeys(this.form.doctorWorkChecks); |
|
|
this.$refs.tree.setCheckedKeys(this.form.doctorWorkChecks); |
|
@@ -145,7 +147,6 @@ export default { |
|
|
handleSelectMenuChange({ checkedKeys, halfCheckedKeys }, property) { |
|
|
handleSelectMenuChange({ checkedKeys, halfCheckedKeys }, property) { |
|
|
console.log("property=", property); |
|
|
console.log("property=", property); |
|
|
this.form[property] = checkedKeys; |
|
|
this.form[property] = checkedKeys; |
|
|
// this.form.menuIdList = checkedKeys; |
|
|
|
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
this.$refs.form?.validateField("menuIdList"); |
|
|
this.$refs.form?.validateField("menuIdList"); |
|
|
}); |
|
|
}); |
|
@@ -187,8 +188,12 @@ export default { |
|
|
try { |
|
|
try { |
|
|
const { menuIdList, doctorWorkChecks, saleManageChecks, saleProcessChecks, ...params } = |
|
|
const { menuIdList, doctorWorkChecks, saleManageChecks, saleProcessChecks, ...params } = |
|
|
this.form; |
|
|
this.form; |
|
|
|
|
|
await this.$nextTick(); |
|
|
|
|
|
const halfChecks1 = this.$refs.tree.getHalfCheckedKeys(); |
|
|
|
|
|
const halfChecks2 = this.$refs.tree2.getHalfCheckedKeys(); |
|
|
|
|
|
const halfChecks3 = this.$refs.tree3.getHalfCheckedKeys(); |
|
|
const res = await saveRole({ |
|
|
const res = await saveRole({ |
|
|
menuIdList: [...doctorWorkChecks, ...saleManageChecks, ...saleProcessChecks], |
|
|
|
|
|
|
|
|
menuIdList: [...doctorWorkChecks, ...saleManageChecks, ...saleProcessChecks, ...halfChecks1, ...halfChecks2, ...halfChecks3], |
|
|
...params, |
|
|
...params, |
|
|
}); |
|
|
}); |
|
|
if (this.form.roleId) { |
|
|
if (this.form.roleId) { |
|
|