Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
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
shenshaokai
jinfa-platform
Commits
8a6eb04a
Commit
8a6eb04a
authored
Jan 06, 2022
by
xiexiuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix: 角色bug修复
parent
d909ec95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
26 deletions
+36
-26
memberDetail.tsx
src/pages/authConfig/memberSystem/memberDetail.tsx
+36
-26
No files found.
src/pages/authConfig/memberSystem/memberDetail.tsx
View file @
8a6eb04a
...
...
@@ -224,6 +224,8 @@ const MemberDetail: React.FC<{}> = () => {
if
(
!
id
)
return
;
fetchRoleMenuDetail
(
id
).
then
(
res
=>
{
const
{
data
}
=
res
;
setcheckIds
({
...
data
.
checkIds
})
treeActions
.
setSelectKeys
(
data
.
checkIds
);
setFormValue
(
data
);
});
},
[]);
...
...
@@ -251,7 +253,6 @@ const MemberDetail: React.FC<{}> = () => {
actionRef
.
current
.
selected
||
(
formValue
&&
formValue
.
ids
)
||
[];
// 获取选中的树状 id
const
treeCheckIds
=
treeActions
.
getSelectKeys
();
// 把后台返回的数据处理成一个数组
const
cheIds
=
[];
for
(
let
i
in
checkIds
)
{
...
...
@@ -259,18 +260,11 @@ const MemberDetail: React.FC<{}> = () => {
}
// 判断后台返回的选中id 是否和和当前选中id是一样
const
flag
=
treeCheckIds
.
join
(
','
)
===
cheIds
.
join
(
','
)
?
true
:
false
;
// 如果后台返回的选中的id 和 当前选中id 是一样 则午休修改 提交一个空数据过去
const
publicarr
=
[];
// 判断选中的数组是否存在 后台返回的数据里面
for
(
let
i
=
0
;
i
<
treeCheckIds
.
length
;
i
++
)
{
if
(
cheIds
.
indexOf
(
treeCheckIds
[
i
])
===
-
1
)
{
publicarr
.
push
({
menuId
:
treeCheckIds
[
i
],
checked
:
true
})
}
}
// 如果选中的匹配不到后台返回的 就把后台返回的那个状态设置为不选中
let
list
=
[];
if
(
!
flag
)
{
// 如果后台返回的id 不匹配 当前选中的 id 把这个id设置为不选中
for
(
let
i
=
0
;
i
<
cheIds
.
length
;
i
++
)
{
if
(
treeCheckIds
.
indexOf
(
cheIds
[
i
])
===
-
1
)
{
publicarr
.
push
({
...
...
@@ -279,6 +273,16 @@ const MemberDetail: React.FC<{}> = () => {
})
}
}
// 如果选中选中id 不匹配后台返回选中id 把这个id 设置为选中
for
(
let
i
=
0
;
i
<
treeCheckIds
.
length
;
i
++
)
{
if
(
cheIds
.
indexOf
(
treeCheckIds
[
i
])
===
-
1
)
{
publicarr
.
push
({
menuId
:
treeCheckIds
[
i
],
checked
:
true
})
}
}
}
// 如果点击了 就给他重新更新一下
if
(
dataId
.
length
!=
0
)
{
...
...
@@ -289,9 +293,9 @@ const MemberDetail: React.FC<{}> = () => {
})
}
}
// 数组对象去掉重复
let
list
=
publicarr
.
filter
((
element
,
index
,
self
)
=>
{
// 数组对象去掉重复 如果 dataid 和 publicarr 有值才去去重复
list
=
publicarr
.
filter
((
element
,
index
,
self
)
=>
{
return
self
.
findIndex
(
x
=>
x
.
menuId
===
element
.
menuId
)
===
index
})
const
publicParams
=
{
...
...
@@ -315,9 +319,8 @@ const MemberDetail: React.FC<{}> = () => {
// orgIds: authInfos[v]?.orgIds
// })),
};
console
.
log
(
publicarr
,
'publicarr'
,
flag
,
'flag'
,
publicParams
)
delete
publicParams
.
checkIds
console
.
log
(
publicParams
,
'请求参数'
,
nodeRecord
,
publicarr
)
// return;
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
await
postMemberRoleUpdate
({
memberRoleId
:
id
,
...
...
@@ -339,15 +342,16 @@ const MemberDetail: React.FC<{}> = () => {
};
const
changeTabs
=
key
=>
{
if
(
key
===
'2'
&&
id
)
{
fetchRoleMenuDetail
(
id
).
then
(
res
=>
{
const
{
data
}
=
res
;
// 获取菜单id选中的集合
const
{
checkIds
,
...
reset
}
=
data
;
setcheckIds
({
...
checkIds
})
treeActions
.
setSelectKeys
(
checkIds
);
});
}
console
.
log
(
key
)
// if (key === '2' && id) {
// fetchRoleMenuDetail(id).then(res => {
// const { data } = res;
// // 获取菜单id选中的集合
// const { checkIds, ...reset } = data;
// setcheckIds({ ...checkIds })
// treeActions.setSelectKeys(checkIds);
// });
// }
};
// 数据权限按钮控制
const
onDataAuthChange
=
e
=>
{
...
...
@@ -379,6 +383,11 @@ const MemberDetail: React.FC<{}> = () => {
);
const
handleOrgSuccess
=
selectKeys
=>
{
console
.
log
(
selectKeys
,
'selectKeys'
)
if
(
!
dataId
.
includes
(
nodeRecord
.
id
))
{
dataId
.
push
(
nodeRecord
.
id
)
setdataId
(
dataId
)
}
setAuthInfos
({
...
authInfos
,
[
nodeRecord
.
id
]:
Object
.
assign
(
...
...
@@ -405,10 +414,11 @@ const MemberDetail: React.FC<{}> = () => {
extra=
{
extraButtons
}
>
<
Card
>
<
Tabs
type=
"card"
className=
"black-tabs"
onChange=
{
changeTabs
}
>
<
Tabs
type=
"card"
className=
"black-tabs"
onChange=
{
changeTabs
}
>
<
TabsItem
tab=
{
<
TabFormErrors
dot=
{
errors
}
>
{
intl
.
formatMessage
({
id
:
'authConfig.baseInfo'
})
}
</
TabFormErrors
>
}
key=
"1"
forceRender
>
<
NiceForm
labelCol=
{
4
}
...
...
@@ -457,7 +467,7 @@ const MemberDetail: React.FC<{}> = () => {
}
}
></
NiceForm
>
</
TabsItem
>
<
TabsItem
tab=
{
intl
.
formatMessage
({
id
:
'authConfig.operationAuthority'
})
}
key=
"2"
>
<
TabsItem
tab=
{
intl
.
formatMessage
({
id
:
'authConfig.operationAuthority'
})
}
key=
"2"
forceRender
>
<
Row
justify=
"space-between"
>
<
Col
span=
{
8
}
className=
{
styled
[
'menu-role-tree'
]
}
>
<
TabTree
...
...
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