Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-3
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
office
haoban-3
Commits
9b854f48
Commit
9b854f48
authored
Oct 08, 2022
by
Jings
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复权限树回显问题
parent
428c1423
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
11 deletions
+41
-11
guide-setting-new.vue
src/views/enterprise/guide-setting-new.vue
+41
-11
No files found.
src/views/enterprise/guide-setting-new.vue
View file @
9b854f48
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
* @Author: Drama
* @Author: Drama
* @Date: 2022-09-14 11:09:43
* @Date: 2022-09-14 11:09:43
* @LastEditors: Drama
* @LastEditors: Drama
* @LastEditTime: 2022-
09-23 13:51:20
* @LastEditTime: 2022-
10-08 13:54:45
* @FilePath: /haoban-3/src/views/enterprise/guide-setting-new.vue
* @FilePath: /haoban-3/src/views/enterprise/guide-setting-new.vue
* Copyright (C) 2022 huzhenhong. All rights reserved.
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
-->
...
@@ -63,6 +63,9 @@ export default {
...
@@ -63,6 +63,9 @@ export default {
withoutParents_0
:
[],
withoutParents_0
:
[],
withoutParents_1
:
[],
withoutParents_1
:
[],
withoutParents_2
:
[],
withoutParents_2
:
[],
saveWithoutParents_0
:
[],
// 用于保存
saveWithoutParents_1
:
[],
saveWithoutParents_2
:
[],
curMenuCode_0
:
[],
// 拷贝当前节点了的按钮
curMenuCode_0
:
[],
// 拷贝当前节点了的按钮
curMenuCode_1
:
[],
curMenuCode_1
:
[],
curMenuCode_2
:
[],
curMenuCode_2
:
[],
...
@@ -89,9 +92,14 @@ export default {
...
@@ -89,9 +92,14 @@ export default {
this
.
titleList
.
forEach
(
item
=>
{
this
.
titleList
.
forEach
(
item
=>
{
item
.
isEmpty
=
false
;
item
.
isEmpty
=
false
;
});
});
let
isChooseList
=
this
.
$refs
.
tree
.
getCheckedKeys
().
concat
(
this
.
$refs
.
tree
.
getHalfCheckedKeys
());
// let isChooseList = this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys());
let
isChooseList
=
this
.
$refs
.
tree
.
getCheckedKeys
();
// 不包含半选
let
isChooseList_
=
this
.
$refs
.
tree
.
getCheckedKeys
().
concat
(
this
.
$refs
.
tree
.
getHalfCheckedKeys
());
// 包含半选
// 切换tab时 缓存上个tag选择的节点
// 切换tab时 缓存上个tag选择的节点
this
[
'withoutParents_'
+
this
.
activeNum
]
=
[...
isChooseList
];
this
[
'withoutParents_'
+
this
.
activeNum
]
=
[...
isChooseList
];
// 缓存保存加上半选的数据
this
[
'saveWithoutParents_'
+
this
.
activeNum
]
=
[...
isChooseList_
];
this
.
activeNum
=
index
;
this
.
activeNum
=
index
;
// this.treeData = deepClone(this.copyMenu);
// this.treeData = deepClone(this.copyMenu);
this
.
withoutParents
=
this
[
'withoutParents_'
+
this
.
activeNum
];
this
.
withoutParents
=
this
[
'withoutParents_'
+
this
.
activeNum
];
...
@@ -105,11 +113,25 @@ export default {
...
@@ -105,11 +113,25 @@ export default {
if
(
res
.
data
.
code
==
0
)
{
if
(
res
.
data
.
code
==
0
)
{
if
(
res
.
data
.
result
)
{
if
(
res
.
data
.
result
)
{
this
[
'roleId_'
+
clerkType
]
=
res
.
data
.
result
.
roleId
;
this
[
'roleId_'
+
clerkType
]
=
res
.
data
.
result
.
roleId
;
let
filterCodes
=
[];
// 筛选出不含父节点menuCode的数据
let
flagCodes
=
[];
// TODO: 删除半选
let
menuCodes
=
deepClone
(
res
.
data
.
result
.
menuCodes
);
let
menuList
=
deepClone
(
res
.
data
.
result
.
menuList
);
menuList
.
forEach
(
item
=>
{
if
(
menuCodes
.
includes
(
item
.
parentCode
))
{
flagCodes
.
push
(
item
.
parentCode
);
}
});
flagCodes
=
Array
.
from
(
new
Set
(
flagCodes
));
filterCodes
=
menuCodes
.
filter
(
v
=>
flagCodes
.
every
(
val
=>
val
!=
v
));
this
[
'curMenuCode_'
+
clerkType
]
=
[...
res
.
data
.
result
.
menuCodes
];
// 保存当前类别选中状态,保存的时候用用于记录操作的区别
this
[
'curMenuCode_'
+
clerkType
]
=
[...
res
.
data
.
result
.
menuCodes
];
// 保存当前类别选中状态,保存的时候用用于记录操作的区别
this
[
'withoutParents_'
+
clerkType
]
=
[...
res
.
data
.
result
.
menuCodes
];
// this['withoutParents_' + clerkType] = [...res.data.result.menuCodes];
this
[
'withoutParents_'
+
clerkType
]
=
[...
filterCodes
];
if
(
clerkType
==
0
)
{
if
(
clerkType
==
0
)
{
// 当前导购选中
// 当前导购选中
this
.
withoutParents
=
[...
res
.
data
.
result
.
menuCodes
];
// this.withoutParents = [...res.data.result.menuCodes];
this
.
withoutParents
=
[...
filterCodes
];
}
}
}
else
{
}
else
{
this
[
'withoutParents_'
+
clerkType
]
=
[];
this
[
'withoutParents_'
+
clerkType
]
=
[];
...
@@ -163,13 +185,18 @@ export default {
...
@@ -163,13 +185,18 @@ export default {
// 保存
// 保存
submit
:
_debounce
(
function
()
{
submit
:
_debounce
(
function
()
{
let
currentChooseList
=
this
.
$refs
.
tree
.
getCheckedKeys
().
concat
(
this
.
$refs
.
tree
.
getHalfCheckedKeys
());
let
currentChooseList
=
this
.
$refs
.
tree
.
getCheckedKeys
().
concat
(
this
.
$refs
.
tree
.
getHalfCheckedKeys
());
this
[
'withoutParents_'
+
this
.
activeNum
]
=
[...
currentChooseList
];
// this['withoutParents_' + this.activeNum] = [...currentChooseList];
this
[
'saveWithoutParents_'
+
this
.
activeNum
]
=
[...
currentChooseList
];
let
errFlag_0
=
this
.
withoutParents_0
.
length
?
true
:
false
;
let
errFlag_0
=
this
.
withoutParents_0
.
length
?
true
:
false
;
let
errFlag_1
=
this
.
withoutParents_1
.
length
?
true
:
false
;
let
errFlag_1
=
this
.
withoutParents_1
.
length
?
true
:
false
;
let
errFlag_2
=
this
.
withoutParents_2
.
length
?
true
:
false
;
let
errFlag_2
=
this
.
withoutParents_2
.
length
?
true
:
false
;
let
delMenu_0
=
getArrDifference
(
this
.
curMenuCode_0
,
this
.
withoutParents_0
);
// let delMenu_0 = getArrDifference(this.curMenuCode_0, this.withoutParents_0);
let
delMenu_1
=
getArrDifference
(
this
.
curMenuCode_1
,
this
.
withoutParents_1
);
// let delMenu_1 = getArrDifference(this.curMenuCode_1, this.withoutParents_1);
let
delMenu_2
=
getArrDifference
(
this
.
curMenuCode_2
,
this
.
withoutParents_2
);
// let delMenu_2 = getArrDifference(this.curMenuCode_2, this.withoutParents_2);
let
delMenu_0
=
getArrDifference
(
this
.
curMenuCode_0
,
this
.
saveWithoutParents_0
);
let
delMenu_1
=
getArrDifference
(
this
.
curMenuCode_1
,
this
.
saveWithoutParents_1
);
let
delMenu_2
=
getArrDifference
(
this
.
curMenuCode_2
,
this
.
saveWithoutParents_2
);
if
(
!
errFlag_0
||
!
errFlag_1
||
!
errFlag_2
)
{
if
(
!
errFlag_0
||
!
errFlag_1
||
!
errFlag_2
)
{
this
.
$set
(
this
.
titleList
[
0
],
'isEmpty'
,
!
errFlag_0
);
this
.
$set
(
this
.
titleList
[
0
],
'isEmpty'
,
!
errFlag_0
);
this
.
$set
(
this
.
titleList
[
1
],
'isEmpty'
,
!
errFlag_1
);
this
.
$set
(
this
.
titleList
[
1
],
'isEmpty'
,
!
errFlag_1
);
...
@@ -181,19 +208,22 @@ export default {
...
@@ -181,19 +208,22 @@ export default {
clerkMenus
:
{
clerkMenus
:
{
roleId
:
this
.
roleId_0
,
roleId
:
this
.
roleId_0
,
clerkType
:
0
,
// 导购
clerkType
:
0
,
// 导购
menuCodes
:
[...
this
.
withoutParents_0
],
// 权限id
// menuCodes: [...this.withoutParents_0], // 权限id
menuCodes
:
[...
this
.
saveWithoutParents_0
],
// 权限id
delMenuCodes
:
delMenu_0
// 删除的code
delMenuCodes
:
delMenu_0
// 删除的code
},
},
manegeClerkMenus
:
{
manegeClerkMenus
:
{
roleId
:
this
.
roleId_1
,
roleId
:
this
.
roleId_1
,
clerkType
:
1
,
// 店长
clerkType
:
1
,
// 店长
menuCodes
:
[...
this
.
withoutParents_1
],
// menuCodes: [...this.withoutParents_1],
menuCodes
:
[...
this
.
saveWithoutParents_1
],
delMenuCodes
:
delMenu_1
delMenuCodes
:
delMenu_1
},
},
managerMenus
:
{
managerMenus
:
{
roleId
:
this
.
roleId_2
,
roleId
:
this
.
roleId_2
,
clerkType
:
2
,
// 区经
clerkType
:
2
,
// 区经
menuCodes
:
[...
this
.
withoutParents_2
],
// menuCodes: [...this.withoutParents_2],
menuCodes
:
[...
this
.
saveWithoutParents_2
],
delMenuCodes
:
delMenu_2
delMenuCodes
:
delMenu_2
}
}
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment