|
@@ -1,6 +1,8 @@
|
|
|
import type { FC } from 'react'
|
|
|
+import { useEffect, useRef } from 'react'
|
|
|
import { Card, Form, InputNumber, message } from 'antd'
|
|
|
|
|
|
+import type { ProFormInstance } from '@ant-design/pro-form'
|
|
|
import ProForm, { ProFormSelect } from '@ant-design/pro-form'
|
|
|
import consts from '@/utils/consts'
|
|
|
import { queryAcountList, saveInstitutionSetting } from '@/services/api/institution'
|
|
@@ -13,16 +15,21 @@ interface RoleProps {
|
|
|
}
|
|
|
|
|
|
const Role: FC<RoleProps> = ({ dataID, memberTotal, managerID }) => {
|
|
|
+ const ref = useRef<ProFormInstance>(null)
|
|
|
const { run: trySave } = useRequest(saveInstitutionSetting, {
|
|
|
manual: true,
|
|
|
onSuccess: () => {
|
|
|
return message.success('设置成功')
|
|
|
}
|
|
|
})
|
|
|
+ useEffect(() => {
|
|
|
+ // eslint-disable-next-line no-unused-expressions
|
|
|
+ ref.current?.setFieldsValue({ accountID: managerID, memberTotal })
|
|
|
+ }, [])
|
|
|
return (
|
|
|
<Card>
|
|
|
<ProForm
|
|
|
- initialValues={{ accountID: managerID, memberTotal }}
|
|
|
+ formRef={ref}
|
|
|
wrapperCol={{ span: 6 }}
|
|
|
onFinish={async values => {
|
|
|
await trySave({ ...values, ID: dataID })
|