|
@@ -61,8 +61,19 @@ const ProcessUser = props => {
|
|
|
|
|
|
const { run: tryApprovalAccountDetail } = useRequest(queryApprovalAccountDetail, {
|
|
|
manual: true,
|
|
|
- onSuccess: result => {
|
|
|
- setState({ ...state, approvalAccountDetail: result })
|
|
|
+ onSuccess: (result: API.ApprovalAccountDetail[]) => {
|
|
|
+ setState({
|
|
|
+ ...state,
|
|
|
+ approvalAccountDetail:
|
|
|
+ result?.reduce((prev, curr) => {
|
|
|
+ const obj = { ...prev }
|
|
|
+ obj[curr.name] = {
|
|
|
+ [`${curr.name}InstitutionID`]: curr.institutionID,
|
|
|
+ [`${curr.name}AccountIDs`]: curr.accountIDs
|
|
|
+ }
|
|
|
+ return obj
|
|
|
+ }, {}) || []
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -97,53 +108,7 @@ const ProcessUser = props => {
|
|
|
}, [])
|
|
|
|
|
|
const form = createForm({
|
|
|
- initialValues: {
|
|
|
- receiver: {
|
|
|
- receiverInstitutionID: state.approvalAccountDetail.data
|
|
|
- ?.filter(item => item.name === 'receiver')
|
|
|
- .map(item => item.institutionID)
|
|
|
- .toString(),
|
|
|
- receiverAccountIDs: state.approvalAccountDetail.data
|
|
|
- ?.filter(item => item.name === 'receiver')
|
|
|
- .reduce(item => item.accountIDs).accountIDs
|
|
|
- },
|
|
|
- fgLeader: {
|
|
|
- fgLeaderInstitutionID: state.approvalAccountDetail.data
|
|
|
- ?.filter(item => item.name === 'fgLeader')
|
|
|
- .map(item => item.institutionID)
|
|
|
- .toString(),
|
|
|
- fgLeaderAccountIDs: state.approvalAccountDetail.data
|
|
|
- ?.filter(item => item.name === 'fgLeader')
|
|
|
- .reduce(item => item.accountIDs).accountIDs
|
|
|
- },
|
|
|
- zxLeader: {
|
|
|
- zxLeaderInstitutionID: state.approvalAccountDetail.data
|
|
|
- ?.filter(item => item.name === 'zxLeader')
|
|
|
- .map(item => item.institutionID)
|
|
|
- .toString(),
|
|
|
- zxLeaderAccountIDs: state.approvalAccountDetail.data
|
|
|
- ?.filter(item => item.name === 'zxLeader')
|
|
|
- .reduce(item => item.accountIDs).accountIDs
|
|
|
- },
|
|
|
- post: {
|
|
|
- postInstitutionID: state.approvalAccountDetail.data
|
|
|
- ?.filter(item => item.name === 'post')
|
|
|
- .map(item => item.institutionID)
|
|
|
- .toString(),
|
|
|
- postAccountIDs: state.approvalAccountDetail.data
|
|
|
- ?.filter(item => item.name === 'post')
|
|
|
- .reduce(item => item.accountIDs).accountIDs
|
|
|
- },
|
|
|
- archive: {
|
|
|
- archiveInstitutionID: state.approvalAccountDetail.data
|
|
|
- ?.filter(item => item.name === 'archive')
|
|
|
- .map(item => item.institutionID)
|
|
|
- .toString(),
|
|
|
- archiveAccountIDs: state.approvalAccountDetail.data
|
|
|
- ?.filter(item => item.name === 'archive')
|
|
|
- .reduce(item => item.accountIDs).accountIDs
|
|
|
- }
|
|
|
- },
|
|
|
+ initialValues: {},
|
|
|
effects() {
|
|
|
onFieldReact('receiver.receiverInstitutionID', async field => {
|
|
|
if (!field.dataSource?.length) {
|
|
@@ -249,19 +214,14 @@ const ProcessUser = props => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- const onFinish = values => {
|
|
|
- trysaveApprovalAccount({
|
|
|
- archiveAccountIDs: values.archive.archiveAccountIDs,
|
|
|
- archiveInstitutionID: values.archive.archiveInstitutionID,
|
|
|
- fgLeaderAccountIDs: values.fgLeader.fgLeaderAccountIDs,
|
|
|
- fgLeaderInstitutionID: values.fgLeader.fgLeaderInstitutionID,
|
|
|
- postAccountIDs: values.post.postAccountIDs,
|
|
|
- postInstitutionID: values.post.postInstitutionID,
|
|
|
- receiverAccountIDs: values.receiver.receiverAccountIDs,
|
|
|
- receiverInstitutionID: values.receiver.receiverInstitutionID,
|
|
|
- zxLeaderAccountIDs: values.zxLeader.zxLeaderAccountIDs,
|
|
|
- zxLeaderInstitutionID: values.zxLeader.zxLeaderInstitutionID
|
|
|
- })
|
|
|
+ const onFinish = (values: Record<string, any>) => {
|
|
|
+ const keys = Object.keys(values)
|
|
|
+ const params = keys.reduce((prev, curr) => {
|
|
|
+ const obj = { ...prev, ...values[curr] }
|
|
|
+ return obj
|
|
|
+ }, {})
|
|
|
+
|
|
|
+ trysaveApprovalAccount(params)
|
|
|
}
|
|
|
return (
|
|
|
<PageContainer title={false}>
|
|
@@ -276,11 +236,11 @@ const ProcessUser = props => {
|
|
|
<div className="flex flex-row mb-5 w-full text-xl">流程用户设置</div>
|
|
|
<div className="max-w-800px">
|
|
|
<div className="w-600px">
|
|
|
- <Form form={form} labelCol={12}>
|
|
|
+ <Form form={form} labelCol={8} wrapperCol={16}>
|
|
|
<SchemaField schema={schema} />
|
|
|
- <FormButtonGroup className="ml-150px">
|
|
|
+ <FormButtonGroup.Sticky className="ml-100px">
|
|
|
<Submit onSubmit={onFinish}>提交</Submit>
|
|
|
- </FormButtonGroup>
|
|
|
+ </FormButtonGroup.Sticky>
|
|
|
</Form>
|
|
|
</div>
|
|
|
</div>
|