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
linweijiong
jinfa-platform
Commits
6f6425b1
Commit
6f6425b1
authored
Jul 03, 2021
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改整改
parent
f9200484
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
add.tsx
...pages/member/memberRectification/rectificationAdd/add.tsx
+28
-7
No files found.
src/pages/member/memberRectification/rectificationAdd/add.tsx
View file @
6f6425b1
...
...
@@ -42,26 +42,40 @@ type SubmitData = {
const
formActions
=
createFormActions
()
const
format
=
'YYYY-MM-DD'
;
const
InspectionAdd
=
(
props
)
=>
{
const
{
location
}
=
props
;
const
{
id
,
memberId
,
memberName
,
roleId
}
=
usePageStatus
();
const
{
visible
,
toggle
}
=
useModal
()
const
{
memberColumns
,
memberSchema
,
handleFetchData
}
=
useGetCommonSubMember
(
PublicApi
.
getMemberInspectMembers
)
const
[
memberModalValue
,
setMemberModalValue
]
=
useState
([])
const
[
memberModalValue
,
setMemberModalValue
]
=
useState
<
{
subMemberId
:
number
,
subRoleId
:
number
,
name
:
string
}[]
>
([])
const
[
submitLoading
,
setSubmitLoading
]
=
useState
<
boolean
>
(
false
)
const
isPreview
=
location
.
pathname
.
includes
(
'/memberCenter/memberAbility/memberRectification/rectificationAdd/view'
);
const
{
id
}
=
usePageStatus
();
const
isEdit
=
useMemo
(()
=>
id
&&
typeof
id
===
'string'
,
[
id
]);
const
params
=
useMemo
(()
=>
{
return
id
?
{
id
:
id
.
toString
()
}
:
null
},
[
id
]);
const
{
loading
,
initialValue
}
=
useInitialValue
<
GetMemberRectifyWaitAddGetResponse
,
{
id
:
string
}
>
(
PublicApi
.
getMemberRectifyWaitAddGet
,
params
)
const
[
unsaved
,
setUnsaved
]
=
useState
(
false
);
/** 从会员信息列表设置默认会员 */
const
shouldSetInitiialMember
=
useMemo
(()
=>
{
if
(
memberId
&&
roleId
)
{
return
{
subMemberId
:
memberId
,
name
:
memberName
,
subRoleId
:
roleId
}
}
return
null
},
[
memberId
,
memberName
,
roleId
])
console
.
log
(
memberId
,
memberName
,
roleId
,
shouldSetInitiialMember
)
/**
/**
* 格式化初始化值
*/
const
formatedInitialValue
=
useMemo
(()
=>
{
if
(
!
isEdit
&&
shouldSetInitiialMember
!==
null
)
{
return
shouldSetInitiialMember
;
}
if
(
!
isEdit
||
!
initialValue
)
{
return
{}
}
...
...
@@ -71,9 +85,16 @@ const InspectionAdd = (props) => {
rectifyDayEnd
:
moment
(
rectifyDayEnd
,
'YYYY-MM-DD'
),
...
rest
,
}
},
[
initialValue
])
},
[
initialValue
,
isEdit
,
shouldSetInitiialMember
])
useEffect
(()
=>
{
if
(
!
isEdit
&&
shouldSetInitiialMember
!==
null
)
{
setMemberModalValue
([{
subMemberId
:
shouldSetInitiialMember
.
subMemberId
,
subRoleId
:
shouldSetInitiialMember
.
subRoleId
,
name
:
shouldSetInitiialMember
.
name
}])
}
if
(
initialValue
)
{
setMemberModalValue
([{
subMemberId
:
initialValue
.
subMemberId
,
...
...
@@ -81,7 +102,7 @@ const InspectionAdd = (props) => {
name
:
initialValue
.
name
}])
}
},
[
initialValue
])
},
[
initialValue
,
isEdit
,
shouldSetInitiialMember
])
const
handleSubmit
=
useCallback
(
async
(
value
:
SubmitData
)
=>
{
const
{
name
,
rectifyDayStart
,
rectifyDayEnd
,
attachments
,
...
rest
}
=
value
;
...
...
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