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
黄庭坚
jinfa-platform
Commits
1eca8ec0
Commit
1eca8ec0
authored
Jan 05, 2022
by
xiexiuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix: 修改bug
parent
8257523a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
18 deletions
+67
-18
CustomStatus.tsx
src/components/NiceForm/components/CustomStatus.tsx
+0
-1
BasicLayout.tsx
src/layouts/BasicLayout.tsx
+5
-5
memberDetail.tsx
src/pages/authConfig/memberSystem/memberDetail.tsx
+62
-12
No files found.
src/components/NiceForm/components/CustomStatus.tsx
View file @
1eca8ec0
...
@@ -3,7 +3,6 @@ import { Space } from 'antd';
...
@@ -3,7 +3,6 @@ import { Space } from 'antd';
import
{
getIntl
}
from
'umi'
;
import
{
getIntl
}
from
'umi'
;
const
intl
=
getIntl
();
const
intl
=
getIntl
();
const
CustomStatus
=
props
=>
{
const
CustomStatus
=
props
=>
{
console
.
log
(
props
);
return
(
return
(
<>
<>
<
Space
>
<
Space
>
...
...
src/layouts/BasicLayout.tsx
View file @
1eca8ec0
...
@@ -79,8 +79,8 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
...
@@ -79,8 +79,8 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
const
isHome
=
location
.
pathname
===
'/memberCenter/home'
const
isHome
=
location
.
pathname
===
'/memberCenter/home'
const
handleMenuCollapse
=
(
payload
:
boolean
):
void
=>
{
const
handleMenuCollapse
=
(
payload
:
boolean
):
void
=>
{
if
(
DEFAULT_COLLAPSED_LIST
.
includes
(
location
.
pathname
))
{
if
(
DEFAULT_COLLAPSED_LIST
.
includes
(
location
.
pathname
))
{
return
;
return
;
}
}
setCollapsed
(
payload
)
setCollapsed
(
payload
)
if
(
payload
)
{
if
(
payload
)
{
...
@@ -139,7 +139,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
...
@@ -139,7 +139,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
},
[
currentRouter
,
collapsed
])
},
[
currentRouter
,
collapsed
])
useLayoutEffect
(()
=>
{
useLayoutEffect
(()
=>
{
if
(
DEFAULT_COLLAPSED_LIST
.
includes
(
location
.
pathname
))
{
if
(
DEFAULT_COLLAPSED_LIST
.
includes
(
location
.
pathname
))
{
setCollapsed
(
true
)
setCollapsed
(
true
)
}
else
{
}
else
{
setCollapsed
(
false
);
setCollapsed
(
false
);
...
@@ -152,7 +152,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
...
@@ -152,7 +152,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
minWidth
:
'1280px'
,
minWidth
:
'1280px'
,
}
}
:
{}
:
{}
console
.
log
(
currentRouter
)
//
console.log(currentRouter)
return
currentRouter
?.
noLayout
?
props
.
children
:
(
return
currentRouter
?.
noLayout
?
props
.
children
:
(
<
ProLayout
<
ProLayout
pageTitleRender=
{
()
=>
currentRouter
?
currentRouter
.
name
:
window
.
location
.
href
}
pageTitleRender=
{
()
=>
currentRouter
?
currentRouter
.
name
:
window
.
location
.
href
}
...
@@ -167,7 +167,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
...
@@ -167,7 +167,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
</
Link
>
</
Link
>
)
}
)
}
collapsed=
{
collapsed
}
collapsed=
{
collapsed
}
collapsedButtonRender=
{
(
flag
)
=>
(
DEFAULT_COLLAPSED_LIST
.
includes
(
location
.
pathname
)
?
null
:
flag
?
<
MenuUnfoldOutlined
/>
:
<
MenuFoldOutlined
/>)
}
collapsedButtonRender=
{
(
flag
)
=>
(
DEFAULT_COLLAPSED_LIST
.
includes
(
location
.
pathname
)
?
null
:
flag
?
<
MenuUnfoldOutlined
/>
:
<
MenuFoldOutlined
/>)
}
onCollapse=
{
handleMenuCollapse
}
onCollapse=
{
handleMenuCollapse
}
disableContentMargin=
{
currentRouter
?.
noMargin
!==
undefined
}
disableContentMargin=
{
currentRouter
?.
noMargin
!==
undefined
}
breadcrumbRender=
{
(
routers
=
[])
=>
[
breadcrumbRender=
{
(
routers
=
[])
=>
[
...
...
src/pages/authConfig/memberSystem/memberDetail.tsx
View file @
1eca8ec0
...
@@ -42,8 +42,9 @@ import FieldHeader from '@/components/FieldHeader';
...
@@ -42,8 +42,9 @@ import FieldHeader from '@/components/FieldHeader';
import
OrgModal
from
'./orgModal'
;
import
OrgModal
from
'./orgModal'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
useTreeTabs
}
from
'@/hooks/useTreeTabs'
;
import
{
useTreeTabs
}
from
'@/hooks/useTreeTabs'
;
import
{
concat
}
from
'lodash'
;
const
intl
=
getIntl
();
const
intl
=
getIntl
();
const
pageTitles
=
[
`
${
intl
.
formatMessage
({
id
:
'authConfig.add'
})}
`
,
`
${
intl
.
formatMessage
({
id
:
'authConfig.edit'
})}
`
,
`
${
intl
.
formatMessage
({
id
:
'authConfig.previewLook'
})}
`
];
const
pageTitles
=
[
`
${
intl
.
formatMessage
({
id
:
'authConfig.add'
})}
`
,
`
${
intl
.
formatMessage
({
id
:
'authConfig.edit'
})}
`
,
`
${
intl
.
formatMessage
({
id
:
'authConfig.previewLook'
})}
`
];
const
TabFormErrors
=
props
=>
{
const
TabFormErrors
=
props
=>
{
return
(
return
(
...
@@ -125,6 +126,9 @@ const MemberDetail: React.FC<{}> = () => {
...
@@ -125,6 +126,9 @@ const MemberDetail: React.FC<{}> = () => {
const
[
buttonInfos
,
setButtonInfos
]
=
useState
<
any
>
([]);
const
[
buttonInfos
,
setButtonInfos
]
=
useState
<
any
>
([]);
// 储存的数据权限选项
// 储存的数据权限选项
const
[
authInfos
,
setAuthInfos
]
=
useState
<
any
>
({});
const
[
authInfos
,
setAuthInfos
]
=
useState
<
any
>
({});
// 存储默认勾选的id
const
[
checkIds
,
setcheckIds
]
=
useState
<
any
>
({});
const
modalRef
=
useRef
<
any
>
({})
const
modalRef
=
useRef
<
any
>
({})
const
disabledCheckAuthConfig
=
useMemo
(()
=>
{
const
disabledCheckAuthConfig
=
useMemo
(()
=>
{
...
@@ -171,12 +175,13 @@ const MemberDetail: React.FC<{}> = () => {
...
@@ -171,12 +175,13 @@ const MemberDetail: React.FC<{}> = () => {
);
);
const
[
setEditForm
,
validateEditForm
]
=
useLeavePage
({
const
[
setEditForm
,
validateEditForm
]
=
useLeavePage
({
onSave
:
()
=>
{},
onSave
:
()
=>
{
},
onModalOk
:
()
=>
{},
onModalOk
:
()
=>
{
},
onModalCancel
:
()
=>
{},
onModalCancel
:
()
=>
{
},
});
});
const
handleNodeSelected
=
async
(
selectKey
,
selectNode
)
=>
{
const
handleNodeSelected
=
async
(
selectKey
,
selectNode
)
=>
{
// console.log(selectKey, 'selectKey', selectNode, 'selectNode')
try
{
try
{
const
{
node
}
=
await
handleSelect
(
selectKey
,
selectNode
);
const
{
node
}
=
await
handleSelect
(
selectKey
,
selectNode
);
if
(
nodeRecord
)
{
if
(
nodeRecord
)
{
...
@@ -199,7 +204,7 @@ const MemberDetail: React.FC<{}> = () => {
...
@@ -199,7 +204,7 @@ const MemberDetail: React.FC<{}> = () => {
setNodeRecord
(
node
);
setNodeRecord
(
node
);
fetchItemDetailData
(
node
);
fetchItemDetailData
(
node
);
}
}
}
catch
(
error
)
{}
}
catch
(
error
)
{
}
};
};
// 编辑和预览模式下需回显数据
// 编辑和预览模式下需回显数据
...
@@ -233,6 +238,8 @@ const MemberDetail: React.FC<{}> = () => {
...
@@ -233,6 +238,8 @@ const MemberDetail: React.FC<{}> = () => {
}
}
},
[
getButtonAuth
,
nodeRecord
]);
},
[
getButtonAuth
,
nodeRecord
]);
// 提交
const
handleSubmit
=
()
=>
{
const
handleSubmit
=
()
=>
{
menuActions
menuActions
.
submit
()
.
submit
()
...
@@ -241,19 +248,61 @@ const MemberDetail: React.FC<{}> = () => {
...
@@ -241,19 +248,61 @@ const MemberDetail: React.FC<{}> = () => {
// 如果未点击过操作权限tab, 则无法获取到actionRef实例, 需补充手动补充回显的ids, 新增的时候如果未设置按钮,则返回空数组
// 如果未点击过操作权限tab, 则无法获取到actionRef实例, 需补充手动补充回显的ids, 新增的时候如果未设置按钮,则返回空数组
const
buttonCheckIds
=
const
buttonCheckIds
=
actionRef
.
current
.
selected
||
(
formValue
&&
formValue
.
ids
)
||
[];
actionRef
.
current
.
selected
||
(
formValue
&&
formValue
.
ids
)
||
[];
// 获取选中的树状 id
const
treeCheckIds
=
treeActions
.
getSelectKeys
();
const
treeCheckIds
=
treeActions
.
getSelectKeys
();
// 把后台返回的数据处理成一个数组
const
cheIds
=
[];
for
(
let
i
in
checkIds
)
{
cheIds
.
push
(
checkIds
[
i
]);
}
// 1 获取勾选中的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
})
}
}
// 根据后台返回的勾选中 进去匹配
const
CheckIds
=
[];
for
(
let
i
in
checkIds
)
{
if
(
treeCheckIds
.
indexOf
(
checkIds
[
i
]))
CheckIds
.
push
({
menuId
:
checkIds
[
i
],
checked
:
treeCheckIds
.
includes
(
checkIds
[
i
])
})
}
// 把两个数组合并成一个数组
let
list
=
[]
list
=
CheckIds
.
concat
(
publicarr
)
const
publicParams
=
{
const
publicParams
=
{
...
values
,
...
values
,
imFlag
:
!!
values
.
imFlag
,
imFlag
:
!!
values
.
imFlag
,
auth
:
treeCheckIds
.
map
(
v
=>
({
checked
:
treeCheckIds
,
menuId
:
v
,
auth
:
list
.
map
(
v
=>
({
menuId
:
v
.
menuId
,
// @todo 暂时写死为空
// @todo 暂时写死为空
buttonIds
:
[],
buttonIds
:
[],
hasDataAuth
:
authInfos
[
v
]?.
hasDataAuth
,
checked
:
v
.
checked
,
orgIds
:
authInfos
[
v
]?.
orgIds
hasDataAuth
:
authInfos
[
v
.
menuId
]?.
hasDataAuth
,
})),
orgIds
:
authInfos
[
v
.
menuId
]?.
orgIds
}))
// auth: treeCheckIds.map(v => ({
// menuId: v,
// // @todo 暂时写死为空
// buttonIds: [],
// checked: true,
// hasDataAuth: authInfos[v]?.hasDataAuth,
// orgIds: authInfos[v]?.orgIds
// })),
};
};
delete
publicParams
.
checkIds
console
.
log
(
publicParams
,
'请求参数'
,
treeCheckIds
)
// return;
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
await
postMemberRoleUpdate
({
await
postMemberRoleUpdate
({
memberRoleId
:
id
,
memberRoleId
:
id
,
...
@@ -280,6 +329,7 @@ const MemberDetail: React.FC<{}> = () => {
...
@@ -280,6 +329,7 @@ const MemberDetail: React.FC<{}> = () => {
const
{
data
}
=
res
;
const
{
data
}
=
res
;
// 获取菜单id选中的集合
// 获取菜单id选中的集合
const
{
checkIds
,
...
reset
}
=
data
;
const
{
checkIds
,
...
reset
}
=
data
;
setcheckIds
({
...
checkIds
})
treeActions
.
setSelectKeys
(
checkIds
);
treeActions
.
setSelectKeys
(
checkIds
);
});
});
}
}
...
@@ -424,8 +474,8 @@ const MemberDetail: React.FC<{}> = () => {
...
@@ -424,8 +474,8 @@ const MemberDetail: React.FC<{}> = () => {
>
>
{
intl
.
formatMessage
({
id
:
'authConfig.ifHasDataAccess'
})
}
{
intl
.
formatMessage
({
id
:
'authConfig.ifHasDataAccess'
})
}
</
Checkbox
>
</
Checkbox
>
<
div
style=
{
{
marginTop
:
16
}
}
>
<
div
style=
{
{
marginTop
:
16
}
}
>
<
p
style=
{
{
color
:
'#909399'
}
}
>
{
intl
.
formatMessage
({
id
:
'authConfig.OrganizationAuthorization'
})
}
</
p
>
<
p
style=
{
{
color
:
'#909399'
}
}
>
{
intl
.
formatMessage
({
id
:
'authConfig.OrganizationAuthorization'
})
}
</
p
>
{
disabledCheckAuthConfig
.
orgIds
.
map
(
v
=>
{
{
disabledCheckAuthConfig
.
orgIds
.
map
(
v
=>
{
const
node
=
getTreeNode
(
plateformTreeData
,
v
);
const
node
=
getTreeNode
(
plateformTreeData
,
v
);
if
(
!
node
||
!
node
.
id
)
return
null
;
if
(
!
node
||
!
node
.
id
)
return
null
;
...
...
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