|
@@ -28,7 +28,7 @@ type StaffModalProps = ConnectProps & {
|
|
}
|
|
}
|
|
accountTypeList: API.AccountType
|
|
accountTypeList: API.AccountType
|
|
organizationList: API.OrganizationalStructureListItem
|
|
organizationList: API.OrganizationalStructureListItem
|
|
- reloadTable: () => void
|
|
|
|
|
|
+ reload: () => void
|
|
schema?: Record<string, any> | null
|
|
schema?: Record<string, any> | null
|
|
}
|
|
}
|
|
|
|
|
|
@@ -40,19 +40,29 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
type,
|
|
type,
|
|
defaultFormData,
|
|
defaultFormData,
|
|
accountTypeList,
|
|
accountTypeList,
|
|
- // organizationList,
|
|
|
|
- // pTypeList,
|
|
|
|
- reloadTable
|
|
|
|
|
|
+ organizationList,
|
|
|
|
+ reload
|
|
}) => {
|
|
}) => {
|
|
const form = useForm()
|
|
const form = useForm()
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
- if (visible && !schema) {
|
|
|
|
- dispatch({
|
|
|
|
- type: 'schemaBase/querySchema',
|
|
|
|
- payload: {
|
|
|
|
- columnType: BaseMenuEnum.STAFF
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ if (visible) {
|
|
|
|
+ if (!schema) {
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'schemaBase/querySchema',
|
|
|
|
+ payload: {
|
|
|
|
+ columnType: BaseMenuEnum.STAFF
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if (!organizationList?.length) {
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'institutions/queryOrganizationList',
|
|
|
|
+ payload: {
|
|
|
|
+ dataID: defaultFormData?.dataID,
|
|
|
|
+ structureType: '1'
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}, [visible])
|
|
}, [visible])
|
|
// useEffect(() => {
|
|
// useEffect(() => {
|
|
@@ -74,6 +84,8 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
})
|
|
})
|
|
|
|
|
|
const onMount = () => {
|
|
const onMount = () => {
|
|
|
|
+ console.log(defaultFormData)
|
|
|
|
+
|
|
form.setValues({ ...defaultFormData })
|
|
form.setValues({ ...defaultFormData })
|
|
delay(80).then(() => {
|
|
delay(80).then(() => {
|
|
form.setSchemaByPath('accountType', {
|
|
form.setSchemaByPath('accountType', {
|
|
@@ -114,7 +126,7 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
await tryUpdateAccount(formData)
|
|
await tryUpdateAccount(formData)
|
|
}
|
|
}
|
|
setVisible(false)
|
|
setVisible(false)
|
|
- reloadTable()
|
|
|
|
|
|
+ reload()
|
|
} catch (error) {
|
|
} catch (error) {
|
|
message.error(error)
|
|
message.error(error)
|
|
}
|
|
}
|
|
@@ -162,10 +174,10 @@ export default connect(
|
|
label: item.name,
|
|
label: item.name,
|
|
value: item.value
|
|
value: item.value
|
|
})),
|
|
})),
|
|
- // organizationList: institutions.organizationType.map(item => ({
|
|
|
|
- // label: item.name,
|
|
|
|
- // value: item.dataID
|
|
|
|
- // })),
|
|
|
|
|
|
+ organizationList: institutions.organizationType.map(item => ({
|
|
|
|
+ label: item.name,
|
|
|
|
+ value: item.dataID
|
|
|
|
+ })),
|
|
schema: schemaBase.base[BaseMenuEnum.STAFF]?.schema
|
|
schema: schemaBase.base[BaseMenuEnum.STAFF]?.schema
|
|
})
|
|
})
|
|
)(StaffDrawer)
|
|
)(StaffDrawer)
|