Переглянути джерело

fix: 项目管理抽屉内容的修改

outaozhen 3 роки тому
батько
коміт
b1c40f56c7

+ 1 - 1
src/pages/Institutions/Staff/components/StaffDetail.tsx

@@ -224,7 +224,7 @@ const StaffDrawer: React.FC<StaffModalProps> = ({
         {type === ModalType.UPDATE ? '编辑账号' : null}
         {type === ModalType.DETAIL ? '员工详情' : null}
       </div>
-      <Form width="50vw">
+      <Form>
         {schema && (
           <FormRender
             form={form}

+ 1 - 1
src/pages/Project/Management/components/Detail.tsx

@@ -1,6 +1,6 @@
 import { connect, useRequest } from 'umi'
 import { useEffect, useRef, useState } from 'react'
-import { Drawer, message, Tabs } from 'antd'
+import { message, Tabs } from 'antd'
 import { getApprovalList, setApproval } from '@/services/api/project'
 import { queryAcountList } from '@/services/api/institution'
 import { delay } from '@/utils/util'

+ 33 - 17
src/pages/Project/Management/components/ProjectModal.tsx

@@ -1,6 +1,6 @@
 import { connect, useRequest } from 'umi'
 import { useEffect } from 'react'
-import { Button, Drawer, message } from 'antd'
+import { Button, Form, message } from 'antd'
 import { addProject, updateProject } from '@/services/api/project'
 import { delay } from '@/utils/util'
 import FormRender, { useForm } from 'form-render'
@@ -91,23 +91,39 @@ const ProjectModal: React.FC<ProjectModalProps> = ({
     }
   }
   return (
-    <Drawer
-      width="50vw"
-      visible={visibles}
-      onClose={() => {
-        // ref.current?.resetFields()
-        setVisible(false)
-      }}
-      title={type === ModalType.ADD ? '新增项目' : '编辑项目'}>
-      {schema && <FormRender form={form} schema={schema} onFinish={onFinish} onMount={onMount} />}
-      <div className="ml-120px">
-        {/** 重置会导致下拉框的options丢失 */}
-        {/* <Button onClick={() => form.setValues({})}>重置</Button> */}
-        <Button type="primary" onClick={form.submit}>
-          提交
-        </Button>
+    <div>
+      <div className="text-xl mb-6">
+        {type === ModalType.ADD ? '新增项目' : null}
+        {type === ModalType.UPDATE ? '编辑项目' : null}
       </div>
-    </Drawer>
+      <Form>
+        {schema && <FormRender form={form} schema={schema} onFinish={onFinish} onMount={onMount} />}
+        <div className="ml-120px">
+          {/** 重置会导致下拉框的options丢失 */}
+          {/* <Button onClick={() => form.setValues({})}>重置</Button> */}
+          <Button type="primary" onClick={form.submit}>
+            提交
+          </Button>
+        </div>
+      </Form>
+    </div>
+    // <Drawer
+    //   width="50vw"
+    //   visible={visibles}
+    //   onClose={() => {
+    //     // ref.current?.resetFields()
+    //     setVisible(false)
+    //   }}
+    //   title={type === ModalType.ADD ? '新增项目' : '编辑项目'}>
+    //   {schema && <FormRender form={form} schema={schema} onFinish={onFinish} onMount={onMount} />}
+    //   <div className="ml-120px">
+    //     {/** 重置会导致下拉框的options丢失 */}
+    //     {/* <Button onClick={() => form.setValues({})}>重置</Button> */}
+    //     <Button type="primary" onClick={form.submit}>
+    //       提交
+    //     </Button>
+    //   </div>
+    // </Drawer>
   )
 }
 

+ 12 - 19
src/pages/Project/Management/index.tsx

@@ -186,36 +186,29 @@ const List: React.FC<ListProps> = ({ schema, dispatch, pTypeList }) => {
         search={false}
       />
 
-      <ProjectModal
-        type={state.currentModalType}
-        defaultFormData={state.defaultFormData}
-        pTypeList={pTypeList}
-        visibles={state.visibles}
-        reloadTable={() => tRef.current?.reload()}
-        setVisible={(visibles: boolean) => setState({ ...state, visibles })}
-      />
+      <AnimateContent
+        visible={state.visibles}
+        onVisibleChange={visibles => setState({ ...state, visibles })}>
+        <ProjectModal
+          type={state.currentModalType}
+          defaultFormData={state.defaultFormData}
+          pTypeList={pTypeList}
+          visibles={state.visibles}
+          reloadTable={() => tRef.current?.reload()}
+          setVisible={(visibles: boolean) => setState({ ...state, visibles })}
+        />
+      </AnimateContent>
 
       <AnimateContent
         visible={state.visible}
         onVisibleChange={visible => setState({ ...state, visible })}>
         <Detail
-          visible={state.visible}
-          onVisibleChange={visible => setState({ ...state, visible })}
           defaultFormData={state.defaultFormData}
           pTypeList={pTypeList}
           readOnly={state.readOnly}
           reloadTable={() => tRef.current?.reload()}
         />
       </AnimateContent>
-
-      {/* <DetailModal
-        defaultFormData={state.defaultFormData}
-        pTypeList={pTypeList}
-        visibles={state.visibles}
-        readOnly={state.readOnly}
-        reloadTable={() => tRef.current?.reload()}
-        setVisible={(visibles: boolean) => setState({ ...state, visibles })}
-      /> */}
     </PageContainer>
   )
 }