|
@@ -24,10 +24,10 @@ type StaffModalProps = ConnectProps & {
|
|
ID: string
|
|
ID: string
|
|
name: string
|
|
name: string
|
|
accountType: string
|
|
accountType: string
|
|
- dataID: string
|
|
|
|
|
|
+ institutionID: string
|
|
}
|
|
}
|
|
accountTypeList: API.AccountType
|
|
accountTypeList: API.AccountType
|
|
- organizationList: API.OrganizationalStructureListItem
|
|
|
|
|
|
+ organizationList: API.OrganizationalStructureListItem[]
|
|
reload: () => void
|
|
reload: () => void
|
|
schema?: Record<string, any> | null
|
|
schema?: Record<string, any> | null
|
|
}
|
|
}
|
|
@@ -45,29 +45,24 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
}) => {
|
|
}) => {
|
|
const form = useForm()
|
|
const form = useForm()
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
- 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'
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ if (!schema) {
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'schemaBase/querySchema',
|
|
|
|
+ payload: {
|
|
|
|
+ columnType: BaseMenuEnum.STAFF
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if (defaultFormData?.institutionID && !organizationList?.length) {
|
|
|
|
+ dispatch({
|
|
|
|
+ type: 'institutions/queryOrganizationList',
|
|
|
|
+ payload: {
|
|
|
|
+ dataID: defaultFormData?.institutionID,
|
|
|
|
+ structureType: '1'
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
- }, [visible])
|
|
|
|
- // useEffect(() => {
|
|
|
|
- // defaultFormData && ref.current?.setFieldsValue({ ...defaultFormData })
|
|
|
|
- // }, [defaultFormData])
|
|
|
|
|
|
+ }, [visible, defaultFormData?.institutionID])
|
|
|
|
|
|
const { run: tryUpdateAccount } = useRequest(updateAccount, {
|
|
const { run: tryUpdateAccount } = useRequest(updateAccount, {
|
|
manual: true,
|
|
manual: true,
|
|
@@ -84,7 +79,7 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
})
|
|
})
|
|
|
|
|
|
const onMount = () => {
|
|
const onMount = () => {
|
|
- console.log(defaultFormData)
|
|
|
|
|
|
+ console.log(organizationList)
|
|
|
|
|
|
form.setValues({ ...defaultFormData })
|
|
form.setValues({ ...defaultFormData })
|
|
delay(80).then(() => {
|
|
delay(80).then(() => {
|
|
@@ -92,15 +87,20 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
enum: accountTypeList.map(item => item.value),
|
|
enum: accountTypeList.map(item => item.value),
|
|
enumNames: accountTypeList.map(item => item.label)
|
|
enumNames: accountTypeList.map(item => item.label)
|
|
})
|
|
})
|
|
- form.setSchemaByPath('institution', {
|
|
|
|
|
|
+
|
|
|
|
+ // console.log('organizationList', organizationList)
|
|
|
|
+ })
|
|
|
|
+ delay(500).then(() => {
|
|
|
|
+ form.setSchemaByPath('organizationalStructureID', {
|
|
// enum: organizationList.map(item => item.value),
|
|
// enum: organizationList.map(item => item.value),
|
|
// enumNames: organizationList.map(item => item.label),
|
|
// enumNames: organizationList.map(item => item.label),
|
|
description: '',
|
|
description: '',
|
|
type: 'string',
|
|
type: 'string',
|
|
widget: 'treeSelect',
|
|
widget: 'treeSelect',
|
|
props: {
|
|
props: {
|
|
|
|
+ // defaultValue: defaultFormData.institutionID,
|
|
treeDefaultExpandAll: true,
|
|
treeDefaultExpandAll: true,
|
|
- treeData: organizationList.map(item => item.label)
|
|
|
|
|
|
+ treeData: organizationList
|
|
}
|
|
}
|
|
})
|
|
})
|
|
})
|
|
})
|
|
@@ -187,10 +187,7 @@ export default connect(
|
|
label: item.name,
|
|
label: item.name,
|
|
value: item.value
|
|
value: item.value
|
|
})),
|
|
})),
|
|
- organizationList: institutions.organizationType.map(item => ({
|
|
|
|
- label: item
|
|
|
|
- // value: item.dataID
|
|
|
|
- })),
|
|
|
|
|
|
+ organizationList: institutions.organizationType,
|
|
schema: schemaBase.base[BaseMenuEnum.STAFF]?.schema
|
|
schema: schemaBase.base[BaseMenuEnum.STAFF]?.schema
|
|
})
|
|
})
|
|
)(StaffDrawer)
|
|
)(StaffDrawer)
|