Ver código fonte

fix: 提交

bug/0816
yinsiyu 1 mês atrás
pai
commit
380ca8aa06
1 arquivos alterados com 34 adições e 13 exclusões
  1. +34
    -13
      src/views/userManage/roleManage/roleList/components/CrudPopup/index.vue

+ 34
- 13
src/views/userManage/roleManage/roleList/components/CrudPopup/index.vue Ver arquivo

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


Carregando…
Cancelar
Salvar