|
@@ -17,10 +17,7 @@ import type { ConnectProps } from 'umi'
|
|
|
import type { InstitutionsModelState } from '../../model'
|
|
|
|
|
|
import 'antd/lib/tree-select/style/index'
|
|
|
-export enum ModalType {
|
|
|
- ADD = 0,
|
|
|
- UPDATE = 1
|
|
|
-}
|
|
|
+import { ModalType } from '@/utils/enum'
|
|
|
|
|
|
type StaffModalProps = ConnectProps & {
|
|
|
visible: boolean
|
|
@@ -123,16 +120,16 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
|
}
|
|
|
|
|
|
const onMount = () => {
|
|
|
- form.setValues({ ...defaultFormData })
|
|
|
+ form.setValues(type === ModalType.ADD ? {} : { ...defaultFormData })
|
|
|
delay(80).then(() => {
|
|
|
form.setSchemaByPath('accountType', {
|
|
|
type: 'string',
|
|
|
widget: 'select',
|
|
|
- props: {
|
|
|
- options: accountTypeList
|
|
|
- }
|
|
|
- // enum: accountTypeList.map(item => item.value),
|
|
|
- // enumNames: accountTypeList.map(item => item.label)
|
|
|
+ // props: {
|
|
|
+ // options: accountTypeList
|
|
|
+ // }
|
|
|
+ enum: accountTypeList.map(item => item.value),
|
|
|
+ enumNames: accountTypeList.map(item => item.label)
|
|
|
})
|
|
|
form.setSchemaByPath('institutionID', {
|
|
|
type: 'string',
|
|
@@ -222,7 +219,7 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
|
<div className="text-xl mb-6">
|
|
|
{type === ModalType.ADD ? '新增账号' : null}
|
|
|
{type === ModalType.UPDATE ? '编辑账号' : null}
|
|
|
- {type === ModalType.DETAIL ? '员工详情' : null}
|
|
|
+ {type === ModalType.PREVIEW ? '员工详情' : null}
|
|
|
</div>
|
|
|
<Form>
|
|
|
{schema && (
|
|
@@ -236,9 +233,11 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
|
|
|
/>
|
|
|
)}
|
|
|
<div className="ml-120px">
|
|
|
- <Button type="primary" onClick={form.submit}>
|
|
|
- 提交
|
|
|
- </Button>
|
|
|
+ {type !== ModalType.PREVIEW && (
|
|
|
+ <Button type="primary" onClick={form.submit}>
|
|
|
+ 提交
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
</div>
|
|
|
</Form>
|
|
|
</div>
|