|
@@ -17,8 +17,8 @@ export enum ModalType {
|
|
|
}
|
|
|
|
|
|
type ProjectModalProps = ConnectProps & {
|
|
|
- visibles: boolean
|
|
|
- setVisible: (visibles: boolean) => void
|
|
|
+ visible: boolean
|
|
|
+ setVisible: (visible: boolean) => void
|
|
|
readOnly: boolean
|
|
|
readOnly: boolean
|
|
|
type: ModalType
|
|
@@ -30,7 +30,7 @@ type ProjectModalProps = ConnectProps & {
|
|
|
schema?: Record<string, any> | null
|
|
|
}
|
|
|
const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
- visibles,
|
|
|
+ visible,
|
|
|
setVisible,
|
|
|
readOnly,
|
|
|
dispatch,
|
|
@@ -69,7 +69,7 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
})
|
|
|
|
|
|
useEffect(() => {
|
|
|
- if (visibles && !schema) {
|
|
|
+ if (visible && !schema) {
|
|
|
dispatch({
|
|
|
type: 'schemaBase/querySchema',
|
|
|
payload: {
|
|
@@ -79,7 +79,7 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
}
|
|
|
tryAcountList()
|
|
|
tryApprovalList()
|
|
|
- }, [visibles])
|
|
|
+ }, [visible])
|
|
|
|
|
|
const onMount = () => {
|
|
|
form.setValues({ ...defaultFormData })
|
|
@@ -99,47 +99,77 @@ const DetailModal: React.FC<ProjectModalProps> = ({
|
|
|
reloadTable()
|
|
|
}
|
|
|
return (
|
|
|
- <Drawer
|
|
|
- width="50vw"
|
|
|
- visible={visibles}
|
|
|
- onClose={() => {
|
|
|
- // ref.current?.resetFields()
|
|
|
- setVisible(false)
|
|
|
- }}
|
|
|
- title={defaultFormData?.name}>
|
|
|
- <Tabs>
|
|
|
- <TabPane tab="项目信息" key="1">
|
|
|
- {schema && (
|
|
|
- <FormRender form={form} schema={schema} onMount={onMount} readOnly={readOnly} />
|
|
|
- )}
|
|
|
- </TabPane>
|
|
|
- <TabPane tab="审批流程" key="2">
|
|
|
- <ProForm
|
|
|
- formRef={ref}
|
|
|
- submitter={{ resetButtonProps: { style: { display: 'none' } } }}
|
|
|
- onFinish={onFinish}>
|
|
|
- <ProFormSelect
|
|
|
- name="accountID"
|
|
|
- label={'上报人'}
|
|
|
- placeholder="请选择上报人"
|
|
|
- options={state.acountList.map(item => ({
|
|
|
- label: item.name,
|
|
|
- value: item.ID
|
|
|
- }))}
|
|
|
- />
|
|
|
- <ProFormSelect
|
|
|
- name="approvalID"
|
|
|
- label={'审批流程'}
|
|
|
- placeholder="请选择审批流程"
|
|
|
- options={state.approvalList.map(item => ({
|
|
|
- label: item.name,
|
|
|
- value: item.ID
|
|
|
- }))}
|
|
|
- />
|
|
|
- </ProForm>
|
|
|
- </TabPane>
|
|
|
- </Tabs>
|
|
|
- </Drawer>
|
|
|
+ <Tabs>
|
|
|
+ <TabPane tab="项目信息" key="1">
|
|
|
+ {schema && <FormRender form={form} schema={schema} onMount={onMount} readOnly={readOnly} />}
|
|
|
+ </TabPane>
|
|
|
+ <TabPane tab="审批流程" key="2">
|
|
|
+ <ProForm
|
|
|
+ formRef={ref}
|
|
|
+ submitter={{ resetButtonProps: { style: { display: 'none' } } }}
|
|
|
+ onFinish={onFinish}>
|
|
|
+ <ProFormSelect
|
|
|
+ name="accountID"
|
|
|
+ label={'上报人'}
|
|
|
+ placeholder="请选择上报人"
|
|
|
+ options={state.acountList.map(item => ({
|
|
|
+ label: item.name,
|
|
|
+ value: item.ID
|
|
|
+ }))}
|
|
|
+ />
|
|
|
+ <ProFormSelect
|
|
|
+ name="approvalID"
|
|
|
+ label={'审批流程'}
|
|
|
+ placeholder="请选择审批流程"
|
|
|
+ options={state.approvalList.map(item => ({
|
|
|
+ label: item.name,
|
|
|
+ value: item.ID
|
|
|
+ }))}
|
|
|
+ />
|
|
|
+ </ProForm>
|
|
|
+ </TabPane>
|
|
|
+ </Tabs>
|
|
|
+ // <Drawer
|
|
|
+ // width="50vw"
|
|
|
+ // visible={visibles}
|
|
|
+ // onClose={() => {
|
|
|
+ // // ref.current?.resetFields()
|
|
|
+ // setVisible(false)
|
|
|
+ // }}
|
|
|
+ // title={defaultFormData?.name}>
|
|
|
+ // <Tabs>
|
|
|
+ // <TabPane tab="项目信息" key="1">
|
|
|
+ // {schema && (
|
|
|
+ // <FormRender form={form} schema={schema} onMount={onMount} readOnly={readOnly} />
|
|
|
+ // )}
|
|
|
+ // </TabPane>
|
|
|
+ // <TabPane tab="审批流程" key="2">
|
|
|
+ // <ProForm
|
|
|
+ // formRef={ref}
|
|
|
+ // submitter={{ resetButtonProps: { style: { display: 'none' } } }}
|
|
|
+ // onFinish={onFinish}>
|
|
|
+ // <ProFormSelect
|
|
|
+ // name="accountID"
|
|
|
+ // label={'上报人'}
|
|
|
+ // placeholder="请选择上报人"
|
|
|
+ // options={state.acountList.map(item => ({
|
|
|
+ // label: item.name,
|
|
|
+ // value: item.ID
|
|
|
+ // }))}
|
|
|
+ // />
|
|
|
+ // <ProFormSelect
|
|
|
+ // name="approvalID"
|
|
|
+ // label={'审批流程'}
|
|
|
+ // placeholder="请选择审批流程"
|
|
|
+ // options={state.approvalList.map(item => ({
|
|
|
+ // label: item.name,
|
|
|
+ // value: item.ID
|
|
|
+ // }))}
|
|
|
+ // />
|
|
|
+ // </ProForm>
|
|
|
+ // </TabPane>
|
|
|
+ // </Tabs>
|
|
|
+ // </Drawer>
|
|
|
)
|
|
|
}
|
|
|
|