lanjianrong 3 anos atrás
pai
commit
35404ae449

+ 9 - 1
src/pages/Institutions/Company/Add/index.tsx

@@ -1,8 +1,10 @@
+import { useEffect } from 'react'
 import { BaseMenuEnum } from '@/pages/Schema/Base'
 import { connect } from 'umi'
 import FormRender, { useForm } from 'form-render'
 import type { SchemaBaseModelState } from '@/pages/Schema/Base/model'
 import type { ConnectProps } from 'umi'
+import { PageContainer } from '@ant-design/pro-layout'
 
 type CompanyAddProps = ConnectProps & {
   schema?: Record<string, any> | null
@@ -19,7 +21,13 @@ const CompanyAdd: React.FC<CompanyAddProps> = ({ dispatch, schema }) => {
     }
   }, [])
   const form = useForm()
-  return <div>{schema && <FormRender form={form} schema={schema} />}</div>
+  return (
+    <PageContainer title={false}>
+      <div className="bg-white p-4">
+        {schema && <FormRender form={form} schema={JSON.parse(schema)} />}
+      </div>
+    </PageContainer>
+  )
 }
 
 export default connect(({ schemaBase }: { schemaBase: SchemaBaseModelState }) => ({

+ 3 - 2
src/pages/Institutions/Company/List/index.tsx

@@ -145,8 +145,9 @@ const CompanyList: React.FC<ListProps> = ({ dispatch, pTypeList }) => {
           },
           actions: [
             <Button
-              onClick={() =>
-                setState({ ...state, visible: true, currentModalType: ModalType.ADD })
+              onClick={
+                () => history.push('/institutions/company/add')
+                // setState({ ...state, visible: true, currentModalType: ModalType.ADD })
               }>
               新建企事业单位
             </Button>

+ 2 - 1
src/pages/Schema/Base/detail.tsx

@@ -24,12 +24,13 @@ const Detail: React.FC<DetailProps> = ({ base, location }) => {
     }
   })
 
+  const schema = base?.[columnType]?.schema
   return (
     <PageContainer title={false}>
       <div className="bg-white shadow-card p-4" style={{ height: 'calc(100vh - 146px)' }}>
         <Generator
           ref={genRef}
-          defaultValue={base?.[columnType]?.schema || {}}
+          defaultValue={(schema && JSON.parse(schema)) || {}}
           controlButtons={[true, true]}
           extraButtons={[
             true,