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
653586e6
Commit
653586e6
authored
Nov 17, 2021
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: 重构authConfig目录接口
parent
4140bdd1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
43 deletions
+32
-43
index.tsx
src/pages/authConfig/memberSystem/index.tsx
+4
-4
memberDetail.tsx
src/pages/authConfig/memberSystem/memberDetail.tsx
+10
-10
orgModal.tsx
src/pages/authConfig/memberSystem/orgModal.tsx
+0
-2
index.tsx
src/pages/authConfig/organ/index.tsx
+8
-17
index.tsx
src/pages/authConfig/userSystem/index.tsx
+2
-2
useSystemTable.tsx
src/pages/authConfig/userSystem/useSystemTable.tsx
+3
-3
userDetail.tsx
src/pages/authConfig/userSystem/userDetail.tsx
+5
-5
No files found.
src/pages/authConfig/memberSystem/index.tsx
View file @
653586e6
...
...
@@ -11,7 +11,7 @@ import {
import
{
StandardTable
}
from
'god'
import
{
ColumnType
}
from
'antd/lib/table/interface'
import
{
IButtonFilter
,
IFormFilter
}
from
'god/dist/src/standard-table/TableController'
;
import
{
PublicApi
}
from
'@/services/a
pi'
;
import
{
getMemberRolePage
,
postMemberRoleDelete
,
postMemberRoleUpdatestatus
}
from
'@/services/MemberV2A
pi'
;
import
StatusSwitch
from
'@/components/StatusSwitch'
;
import
EyePreview
from
'@/components/EyePreview'
;
import
{
STATUS_ENUM
}
from
'@/constants'
;
...
...
@@ -19,7 +19,7 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
import
PopConfirmControl
from
'@/components/PopConfirmControl'
;
const
fetchData
=
async
(
params
)
=>
{
const
{
data
}
=
await
PublicApi
.
getMemberRolePage
(
params
)
const
{
data
}
=
await
getMemberRolePage
(
params
)
return
data
}
...
...
@@ -28,7 +28,7 @@ const MemberSystem: React.FC<{}> = () => {
const
deleteItem
=
async
(
record
)
=>
{
// 删除该项
await
PublicApi
.
postMemberRoleDelete
({
await
postMemberRoleDelete
({
memberRoleId
:
record
.
id
})
ref
.
current
.
reload
()
...
...
@@ -39,7 +39,7 @@ const MemberSystem: React.FC<{}> = () => {
}
const
handleStatus
=
async
(
record
)
=>
{
await
PublicApi
.
postMemberRoleUpdatestatus
({
await
postMemberRoleUpdatestatus
({
id
:
record
.
id
,
status
:
record
.
status
===
1
?
0
:
1
})
...
...
src/pages/authConfig/memberSystem/memberDetail.tsx
View file @
653586e6
...
...
@@ -28,7 +28,7 @@ import TabTree, {
useTreeActions
,
createTreeActions
,
}
from
'@/components/TabTree'
;
import
{
PublicApi
}
from
'@/services/a
pi'
;
import
{
getMemberRoleAuthTree
,
getMemberOrgTree
,
postMemberRoleAdd
,
postMemberRoleUpdate
,
getMemberRoleGet
,
getMemberRoleAuthButton
,
getMemberRoleAuthButtonCheck
,
}
from
'@/services/MemberV2A
pi'
;
import
styled
from
'./index.less'
;
import
CheckboxTree
from
'@/components/CheckBoxTree'
;
import
{
useTreeData
}
from
'@/hooks/useTreeData'
;
...
...
@@ -54,7 +54,7 @@ const TabFormErrors = props => {
};
const
fetchMenuData
=
async
()
=>
{
const
res
=
await
PublicApi
.
getMemberRoleAuthTree
();
const
res
=
await
getMemberRoleAuthTree
();
return
{
data
:
res
.
data
.
menus
};
};
...
...
@@ -65,7 +65,7 @@ const menuActions = createFormActions();
const
treeActions
=
createTreeActions
();
const
fetchOrgsTreeData
=
async
()
=>
{
const
res
=
await
PublicApi
.
getMemberOrgTree
();
const
res
=
await
getMemberOrgTree
();
return
res
;
};
...
...
@@ -109,7 +109,7 @@ const MemberDetail: React.FC<{}> = () => {
const
{
treeData
,
handleSelect
}
=
useTreeData
({
fetchMenuData
,
fetchItemDetailData
:
({
id
})
=>
PublicApi
.
getMemberRoleAuthButton
({
getMemberRoleAuthButton
({
menuId
:
id
,
}),
});
...
...
@@ -141,9 +141,9 @@ const MemberDetail: React.FC<{}> = () => {
const
fetchItemDetailData
=
useCallback
(
async
node
=>
{
const
isAdd
=
pageStatus
===
PageStatus
.
ADD
;
const
fn
=
isAdd
?
PublicApi
.
getMemberRoleAuthButton
:
PublicApi
.
getMemberRoleAuthButtonCheck
;
const
fn
:
any
=
isAdd
?
getMemberRoleAuthButton
:
getMemberRoleAuthButtonCheck
;
const
params
=
isAdd
?
{}
:
{
memberRoleId
:
id
};
const
{
data
}
=
await
fn
({
menuId
:
node
?
node
.
id
:
nodeRecord
.
id
,
...
...
@@ -203,7 +203,7 @@ const MemberDetail: React.FC<{}> = () => {
// 编辑和预览模式下需回显数据
const
fetchRoleMenuDetail
=
async
id
=>
{
// 10秒缓存
const
res
=
await
PublicApi
.
getMemberRoleGet
(
const
res
=
await
getMemberRoleGet
(
{
memberRoleId
:
id
,
},
...
...
@@ -253,12 +253,12 @@ const MemberDetail: React.FC<{}> = () => {
})),
};
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
await
PublicApi
.
postMemberRoleUpdate
({
await
postMemberRoleUpdate
({
memberRoleId
:
id
,
...
publicParams
,
});
}
else
{
await
PublicApi
.
postMemberRoleAdd
({
await
postMemberRoleAdd
({
...
publicParams
,
});
}
...
...
src/pages/authConfig/memberSystem/orgModal.tsx
View file @
653586e6
import
TabTree
,
{
createTreeActions
}
from
'@/components/TabTree'
import
{
useTreeTabs
}
from
'@/hooks/useTreeTabs'
import
{
PublicApi
}
from
'@/services/api'
import
{
Button
,
Drawer
,
Row
}
from
'antd'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
'./orgModal.less'
...
...
src/pages/authConfig/organ/index.tsx
View file @
653586e6
import
React
,
{
useState
,
ReactText
,
useEffect
}
from
'react'
;
import
{
Row
,
Col
,
Tree
,
Form
,
Table
,
InputNumber
,
Popconfirm
,
Button
,
Input
,
Modal
,
Card
}
from
'antd'
;
import
{
CarryOutOutlined
,
FormOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
TabTree
,
{
useTreeActions
,
createTreeActions
}
from
'@/components/TabTree'
;
import
React
from
'react'
;
import
{
Row
,
Col
,
Popconfirm
,
Button
,
Card
}
from
'antd'
;
import
TabTree
,
{
createTreeActions
}
from
'@/components/TabTree'
;
import
SchemaForm
,
{
createFormActions
,
LifeCycleTypes
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
menuSchema
}
from
'./schema'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
omit
}
from
'@/utils'
;
import
{
useMap
,
useBoolean
}
from
'@umijs/hooks'
;
import
{
getMemberOrgTree
,
postMemberOrgDelete
,
getMemberOrgGet
,
postMemberOrgUpdate
,
postMemberOrgAdd
,
}
from
'@/services/MemberV2Api'
;
import
{
useTreeTabs
}
from
'@/hooks/useTreeTabs'
;
import
{
isObject
}
from
'@antv/util'
;
// import "./index.less"
const
{
ON_FORM_INPUT_CHANGE
}
=
LifeCycleTypes
const
{
onFieldInputChange$
}
=
FormEffectHooks
...
...
@@ -28,7 +19,7 @@ const formActions = createFormActions()
const
treeActions
=
createTreeActions
()
const
fetchMenuData
=
async
(
params
?)
=>
{
const
res
=
await
PublicApi
.
getMemberOrgTree
()
const
res
=
await
getMemberOrgTree
()
return
res
}
...
...
@@ -50,9 +41,9 @@ const Organ: React.FC<{}> = () => {
}
=
useTreeTabs
({
treeActions
,
formActions
,
deleteMenu
:
PublicApi
.
postMemberOrgDelete
,
deleteMenu
:
postMemberOrgDelete
,
fetchMenuData
:
fetchMenuData
,
fetchItemDetailData
:
PublicApi
.
getMemberOrgGet
fetchItemDetailData
:
getMemberOrgGet
})
// 当拥有节点数据并且当前状态是编辑状态时 需回显表单
...
...
@@ -70,7 +61,7 @@ const Organ: React.FC<{}> = () => {
...
value
,
parentId
:
nodeRecord
?
nodeRecord
.
parentId
:
0
,
}
const
fn
=
editOrAdd
?
PublicApi
.
postMemberOrgUpdate
:
PublicApi
.
postMemberOrgAdd
const
fn
=
editOrAdd
?
postMemberOrgUpdate
:
postMemberOrgAdd
fn
(
params
).
then
(
res
=>
{
resetMenu
()
setTreeStatus
(
FormState
.
FREE
)
...
...
src/pages/authConfig/userSystem/index.tsx
View file @
653586e6
...
...
@@ -10,7 +10,7 @@ import {
}
from
'@ant-design/icons'
;
import
{
StandardTable
}
from
'god'
import
{
IButtonFilter
,
IFormFilter
}
from
'god/dist/src/standard-table/TableController'
;
import
{
PublicApi
}
from
'@/services/a
pi'
;
import
{
getMemberUserPage
}
from
'@/services/MemberV2A
pi'
;
import
EyePreview
from
'@/components/EyePreview'
;
import
StatusSwitch
from
'@/components/StatusSwitch'
;
import
{
STATUS_ENUM
}
from
'@/constants'
;
...
...
@@ -19,7 +19,7 @@ import useSysetemTable from './useSystemTable';
// 模拟请求
const
fetchData
=
async
(
params
)
=>
{
const
{
data
}
=
await
PublicApi
.
getMemberUserPage
(
params
)
const
{
data
}
=
await
getMemberUserPage
(
params
)
return
data
}
...
...
src/pages/authConfig/userSystem/useSystemTable.tsx
View file @
653586e6
...
...
@@ -3,7 +3,7 @@ import EyePreview from "@/components/EyePreview";
import
StatusSwitch
from
'@/components/StatusSwitch'
;
import
{
Button
}
from
'antd'
;
import
PopConfirmControl
from
'@/components/PopConfirmControl'
;
import
{
PublicApi
}
from
'@/services/a
pi'
;
import
{
postMemberUserDelete
,
postMemberUserUpdatestatus
,
}
from
'@/services/MemberV2A
pi'
;
import
{
history
}
from
'umi'
const
useSysetemTable
=
()
=>
{
...
...
@@ -84,7 +84,7 @@ const useSysetemTable = () => {
const
deleteItem
=
(
record
)
=>
{
// 删除该项
PublicApi
.
postMemberUserDelete
({
postMemberUserDelete
({
userId
:
record
.
userId
}).
then
(()
=>
{
tableRef
.
current
.
reload
()
...
...
@@ -96,7 +96,7 @@ const useSysetemTable = () => {
}
const
handleStatus
=
(
record
)
=>
{
PublicApi
.
postMemberUserUpdatestatus
({
postMemberUserUpdatestatus
({
userId
:
record
.
userId
,
status
:
record
.
status
===
1
?
0
:
1
}).
then
(
res
=>
{
...
...
src/pages/authConfig/userSystem/userDetail.tsx
View file @
653586e6
...
...
@@ -3,7 +3,7 @@ import { Button, Modal, Card } from 'antd';
import
{
createFormActions
,
FormButtonGroup
}
from
'@formily/antd'
import
{
LinkOutlined
}
from
'@ant-design/icons'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
{
PublicApi
}
from
'@/services/a
pi'
;
import
{
getMemberOrgTree
,
postMemberUserUpdate
,
postMemberUserAdd
,
getMemberUserGet
,
getMemberRolePageByname
,
}
from
'@/services/MemberV2A
pi'
;
import
{
history
}
from
'umi'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
...
...
@@ -28,7 +28,7 @@ const titleRender = (title) => {
}
const
fetchOriginTreeData
=
async
(
params
?)
=>
{
// 平台后台树
const
res
=
await
PublicApi
.
getMemberOrgTree
({},
{
ttl
:
10
,
useCache
:
true
})
const
res
=
await
getMemberOrgTree
({},
{
ttl
:
10
,
useCache
:
true
})
return
res
}
...
...
@@ -43,7 +43,7 @@ const AddUser: React.FC<{}> = () => {
const
{
id
,
pageStatus
}
=
usePageStatus
()
const
[
roleSelection
,
roleSelectCtl
]
=
useRowSelectionTable
()
const
[
originSelectNode
,
setOriginSelectNode
]
=
useState
<
any
>
()
const
{
data
,
loading
,
err
,
run
}
=
useHttpRequest
(
id
?
PublicApi
.
postMemberUserUpdate
:
PublicApi
.
postMemberUserAdd
)
const
{
data
,
loading
,
err
,
run
}
=
useHttpRequest
(
id
?
postMemberUserUpdate
:
postMemberUserAdd
)
const
{
treeData
:
originTreeData
,
}
=
useTreeTabs
({
...
...
@@ -51,7 +51,7 @@ const AddUser: React.FC<{}> = () => {
})
useEffect
(()
=>
{
if
(
id
)
{
PublicApi
.
getMemberUserGet
({
getMemberUserGet
({
userId
:
id
}).
then
(
async
res
=>
{
const
{
data
}
=
res
...
...
@@ -103,7 +103,7 @@ const AddUser: React.FC<{}> = () => {
// 模拟请求
const
fetchUserList
=
async
(
params
:
any
)
=>
{
const
data
=
await
PublicApi
.
getMemberRolePageByname
(
params
)
const
data
=
await
getMemberRolePageByname
(
params
)
return
data
.
data
}
...
...
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