|
@@ -29,7 +29,7 @@ |
|
|
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', }" |
|
|
|
|
|
|
|
|
:props="{ children: 'children', label: 'menuName' }" |
|
|
default-expand-all |
|
|
default-expand-all |
|
|
></el-tree> |
|
|
></el-tree> |
|
|
<!-- isLeaf: true --> |
|
|
<!-- isLeaf: true --> |
|
@@ -127,7 +127,7 @@ export default { |
|
|
async loadMenuIdList(roleId) { |
|
|
async loadMenuIdList(roleId) { |
|
|
await this.loadAllMenuList(); |
|
|
await this.loadAllMenuList(); |
|
|
if (!roleId) { |
|
|
if (!roleId) { |
|
|
return |
|
|
|
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
this.loading = true; |
|
|
this.loading = true; |
|
|
const [err, res] = await to(getRoleMenuList({ roleId })); |
|
|
const [err, res] = await to(getRoleMenuList({ roleId })); |
|
@@ -136,12 +136,18 @@ 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.doctorWorkChecks = this.form.doctorWorkChecks.filter( |
|
|
|
|
|
(item) => this.treeData.findIndex((item2) => item2.id === item) < 0 |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
console.log('this.form.doctorWorkChecks=', this.form.doctorWorkChecks) |
|
|
|
|
|
this.form.saleManageChecks = this.form.saleManageChecks.filter(item => this.treeData2.findIndex(item2 => item2.id === item) < 0) |
|
|
|
|
|
|
|
|
console.log("this.form.doctorWorkChecks=", this.form.doctorWorkChecks); |
|
|
|
|
|
this.form.saleManageChecks = this.form.saleManageChecks.filter( |
|
|
|
|
|
(item) => this.treeData2.findIndex((item2) => item2.id === item) < 0 |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
this.form.saleProcessChecks = this.form.saleProcessChecks.filter(item => this.treeData3.findIndex(item2 => item2.id === item) < 0) |
|
|
|
|
|
|
|
|
this.form.saleProcessChecks = this.form.saleProcessChecks.filter( |
|
|
|
|
|
(item) => this.treeData3.findIndex((item2) => item2.id === item) < 0 |
|
|
|
|
|
); |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
this.$refs.tree.setCheckedKeys(this.form.doctorWorkChecks); |
|
|
this.$refs.tree.setCheckedKeys(this.form.doctorWorkChecks); |
|
|
this.$refs.tree2.setCheckedKeys(this.form.saleManageChecks); |
|
|
this.$refs.tree2.setCheckedKeys(this.form.saleManageChecks); |
|
@@ -150,7 +156,6 @@ export default { |
|
|
this.loading = false; |
|
|
this.loading = false; |
|
|
}, |
|
|
}, |
|
|
handleSelectMenuChange({ checkedKeys, halfCheckedKeys }, property) { |
|
|
handleSelectMenuChange({ checkedKeys, halfCheckedKeys }, property) { |
|
|
console.log("property=", property, checkedKeys); |
|
|
|
|
|
this.form[property] = checkedKeys; |
|
|
this.form[property] = checkedKeys; |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
this.$refs.form?.validateField("menuIdList"); |
|
|
this.$refs.form?.validateField("menuIdList"); |
|
@@ -191,13 +196,29 @@ export default { |
|
|
if (valid) { |
|
|
if (valid) { |
|
|
this.loading = true; |
|
|
this.loading = true; |
|
|
try { |
|
|
try { |
|
|
const { menuIdList, doctorWorkChecks = [], saleManageChecks = [], saleProcessChecks = [], ...params } = this.form; |
|
|
|
|
|
await this.$nextTick(); |
|
|
|
|
|
const halfChecks1 = this.$refs.tree.getHalfCheckedKeys(); |
|
|
|
|
|
const halfChecks2 = this.$refs.tree2.getHalfCheckedKeys(); |
|
|
|
|
|
const halfChecks3 = this.$refs.tree3.getHalfCheckedKeys(); |
|
|
|
|
|
|
|
|
const { |
|
|
|
|
|
menuIdList, |
|
|
|
|
|
doctorWorkChecks = [], |
|
|
|
|
|
saleManageChecks = [], |
|
|
|
|
|
saleProcessChecks = [], |
|
|
|
|
|
...params |
|
|
|
|
|
} = this.form; |
|
|
|
|
|
await this.$nextTick(); |
|
|
|
|
|
const halfChecks1 = this.$refs.tree.getHalfCheckedKeys(); |
|
|
|
|
|
const halfChecks2 = this.$refs.tree2.getHalfCheckedKeys(); |
|
|
|
|
|
const halfChecks3 = this.$refs.tree3.getHalfCheckedKeys(); |
|
|
|
|
|
const checks1 = this.$refs.tree.getCheckedKeys(); |
|
|
|
|
|
const checks2 = this.$refs.tree2.getCheckedKeys(); |
|
|
|
|
|
const checks3 = this.$refs.tree3.getCheckedKeys(); |
|
|
const res = await saveRole({ |
|
|
const res = await saveRole({ |
|
|
menuIdList: [...doctorWorkChecks, ...saleManageChecks, ...saleProcessChecks, ...halfChecks1, ...halfChecks2, ...halfChecks3], |
|
|
|
|
|
|
|
|
menuIdList: [ |
|
|
|
|
|
...checks1, |
|
|
|
|
|
...checks2, |
|
|
|
|
|
...checks3, |
|
|
|
|
|
...halfChecks1, |
|
|
|
|
|
...halfChecks2, |
|
|
|
|
|
...halfChecks3, |
|
|
|
|
|
], |
|
|
...params, |
|
|
...params, |
|
|
}); |
|
|
}); |
|
|
if (this.form.roleId) { |
|
|
if (this.form.roleId) { |
|
|