|
@@ -78,23 +78,20 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- // form.setFieldsValue({ ...defaultFormData })
|
|
|
- tryAcountList()
|
|
|
- tryApprovalList()
|
|
|
}, [visible])
|
|
|
|
|
|
const onMount = () => {
|
|
|
- const newObject = { ...defaultFormData }
|
|
|
- const keys = Object.keys(newObject)
|
|
|
+ const currentFormData = { ...defaultFormData }
|
|
|
+ const keys = Object.keys(currentFormData)
|
|
|
keys.forEach(key => {
|
|
|
- if (key instanceof Object) {
|
|
|
- const newObjectKey = newObject[key]
|
|
|
- newObject.objectID = newObjectKey.ID
|
|
|
+ if (currentFormData[key] instanceof Object) {
|
|
|
+ const targetMap = currentFormData[key]
|
|
|
+ delete currentFormData[key]
|
|
|
+ currentFormData[`${key}ID`] = targetMap.ID
|
|
|
}
|
|
|
})
|
|
|
- form.setValues({ ...newObject })
|
|
|
- console.log({ ...newObject })
|
|
|
-
|
|
|
+ // console.log(currentFormData)
|
|
|
+ form.setValues({ ...currentFormData })
|
|
|
// form.setValues({ ...defaultFormData })
|
|
|
delay(80).then(() => {
|
|
|
form.setSchemaByPath('projectTypeID', {
|
|
@@ -104,13 +101,30 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ const onChange = key => {
|
|
|
+ if (key === '2') {
|
|
|
+ if (!state.acountList?.length) {
|
|
|
+ tryAcountList()
|
|
|
+ }
|
|
|
+ if (!state.approvalList?.length) {
|
|
|
+ tryApprovalList()
|
|
|
+ }
|
|
|
+ const TabFormData = {
|
|
|
+ accountID: defaultFormData.approval.name,
|
|
|
+ approvalID: defaultFormData.reportAccount.name
|
|
|
+ }
|
|
|
+ console.log(ref.current)
|
|
|
+ ref.current?.setFieldsValue({ ...TabFormData })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const onFinish = async (formData, value) => {
|
|
|
await trySetApproval({ ...formData, ...value, ID: defaultFormData.ID })
|
|
|
onVisibleChange(false)
|
|
|
reloadTable()
|
|
|
}
|
|
|
return (
|
|
|
- <Tabs>
|
|
|
+ <Tabs onChange={onChange}>
|
|
|
<TabPane tab="项目信息" key="1">
|
|
|
{schema && <FormRender form={form} schema={schema} onMount={onMount} readOnly={readOnly} />}
|
|
|
</TabPane>
|