Browse Source

feat: 增加formily card组件,完善建设单位表单

feat: add 报审说明 placeholder
lanjianrong 3 năm trước cách đây
mục cha
commit
b4ce22015a

+ 54 - 36
src/pages/Schema/Budget/components/Designable/antd/components/Input/preview.tsx

@@ -21,15 +21,6 @@ Input.Behavior = createBehavior(
   {
     name: 'Input',
     extends: ['Field'],
-    selector: node => node.props['name'] === 'bScaleUnit',
-    designerProps: {
-      propsSchema: createFieldSchema(AllSchemas.Input)
-    },
-    designerLocales: { 'zh-CN': { ...AllLocales.Input['zh-CN'], title: '建设规模(单位)' } }
-  },
-  {
-    name: 'Input',
-    extends: ['Field'],
     selector: node => node.props['name'] === 'gzAddress',
     designerProps: {
       propsSchema: createFieldSchema(AllSchemas.Input)
@@ -93,6 +84,15 @@ Input.Behavior = createBehavior(
   {
     name: 'Input',
     extends: ['Field'],
+    selector: node => node.props['name'] === 'projectContactMobile',
+    designerProps: {
+      propsSchema: createFieldSchema(AllSchemas.Input)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Input['zh-CN'], title: '项目联系人手机' } }
+  },
+  {
+    name: 'Input',
+    extends: ['Field'],
     selector: node => node.props['name'] === 'pMail',
     designerProps: {
       propsSchema: createFieldSchema(AllSchemas.Input)
@@ -127,14 +127,14 @@ Input.Resource = createResource(
         componentName: 'Field',
         props: {
           type: 'string',
-          title: '工程名称(业务名称)',
+          title: '工程名称(业务名称)',
           name: 'gcName',
           required: true,
           'x-decorator': 'FormItem',
+          'x-component': 'Input',
           'x-component-props': {
             placeholder: '请输入'
-          },
-          'x-component': 'Input'
+          }
         }
       }
     ]
@@ -149,10 +149,10 @@ Input.Resource = createResource(
           title: '',
           name: 'bScaleUnit',
           'x-decorator': 'FormItem',
+          'x-component': 'Input',
           'x-component-props': {
-            placeholder: '请输入单位(㎡)'
-          },
-          'x-component': 'Input'
+            placeholder: '请选择单位'
+          }
         }
       }
     ]
@@ -167,10 +167,10 @@ Input.Resource = createResource(
           title: '工程地址',
           name: 'gzAddress',
           'x-decorator': 'FormItem',
+          'x-component': 'Input',
           'x-component-props': {
             placeholder: '请输入'
-          },
-          'x-component': 'Input'
+          }
         }
       }
     ]
@@ -185,10 +185,10 @@ Input.Resource = createResource(
           title: '建设单位',
           name: 'institutionID',
           'x-decorator': 'FormItem',
+          'x-component': 'Input',
           'x-component-props': {
             placeholder: '请输入'
-          },
-          'x-component': 'Input'
+          }
         }
       }
     ]
@@ -203,10 +203,11 @@ Input.Resource = createResource(
           title: '行业主管部门',
           name: 'ministry',
           'x-decorator': 'FormItem',
+          required: true,
+          'x-component': 'Input',
           'x-component-props': {
             placeholder: '请输入'
-          },
-          'x-component': 'Input'
+          }
         }
       }
     ]
@@ -223,10 +224,10 @@ Input.Resource = createResource(
           required: true,
           'x-validator': 'phone',
           'x-decorator': 'FormItem',
+          'x-component': 'Input',
           'x-component-props': {
             placeholder: '请输入'
-          },
-          'x-component': 'Input'
+          }
         }
       }
     ]
@@ -243,10 +244,10 @@ Input.Resource = createResource(
           required: true,
           'x-validator': 'email',
           'x-decorator': 'FormItem',
+          'x-component': 'Input',
           'x-component-props': {
             placeholder: '请输入'
-          },
-          'x-component': 'Input'
+          }
         }
       }
     ]
@@ -260,7 +261,6 @@ Input.Resource = createResource(
           type: 'string',
           title: '联系座机',
           name: 'reviewerLandline',
-          required: true,
           'x-validator': [
             {
               triggerType: 'onInput',
@@ -270,10 +270,30 @@ Input.Resource = createResource(
             }
           ],
           'x-decorator': 'FormItem',
+          'x-component': 'Input',
           'x-component-props': {
             placeholder: '请输入'
-          },
-          'x-component': 'Input'
+          }
+        }
+      }
+    ]
+  },
+  {
+    icon: 'InputSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          type: 'string',
+          title: '项目联系人手机',
+          name: 'projectContactMobile',
+          required: true,
+          'x-validator': 'phone',
+          'x-decorator': 'FormItem',
+          'x-component': 'Input',
+          'x-component-props': {
+            placeholder: '请输入'
+          }
         }
       }
     ]
@@ -288,11 +308,12 @@ Input.Resource = createResource(
           title: '项目联系人邮箱',
           name: 'pMail',
           'x-validator': 'email',
+          required: true,
           'x-decorator': 'FormItem',
+          'x-component': 'Input',
           'x-component-props': {
             placeholder: '请输入'
-          },
-          'x-component': 'Input'
+          }
         }
       }
     ]
@@ -306,7 +327,6 @@ Input.Resource = createResource(
           type: 'string',
           title: '联系座机',
           name: 'projectContactLandline',
-          required: true,
           'x-validator': [
             {
               triggerType: 'onInput',
@@ -316,10 +336,10 @@ Input.Resource = createResource(
             }
           ],
           'x-decorator': 'FormItem',
+          'x-component': 'Input',
           'x-component-props': {
             placeholder: '请输入'
-          },
-          'x-component': 'Input'
+          }
         }
       }
     ]
@@ -336,10 +356,8 @@ Input.Resource = createResource(
           'x-decorator': 'FormItem',
           'x-component': 'Input.TextArea',
           'x-component-props': {
+            maxLength: 200,
             placeholder: '请输入'
-          },
-          'x-component-props': {
-            maxLength: 200
           }
         }
       }

+ 4 - 1
src/pages/Schema/Budget/components/Designable/antd/components/NumberPicker/preview.ts

@@ -28,7 +28,10 @@ NumberPicker.Resource = createResource({
         title: '建设规模',
         name: 'bScaleVolume',
         'x-decorator': 'FormItem',
-        'x-component': 'NumberPicker'
+        'x-component': 'NumberPicker',
+        'x-component-props': {
+          placeholder: '请输入'
+        }
       }
     }
   ]

+ 58 - 1
src/pages/Schema/Budget/components/Designable/antd/components/Select/preview.tsx

@@ -21,6 +21,15 @@ Select.Behavior = createBehavior(
   {
     name: 'Select',
     extends: ['Field'],
+    selector: node => node.props['name'] === 'bScaleUnit',
+    designerProps: {
+      propsSchema: createFieldSchema(AllSchemas.Select)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Select['zh-CN'], title: '建设规模(单位)' } }
+  },
+  {
+    name: 'Select',
+    extends: ['Field'],
     selector: node => node.props['name'] === 'gcType',
     designerProps: {
       propsSchema: createFieldSchema(AllSchemas.Select)
@@ -80,6 +89,15 @@ Select.Behavior = createBehavior(
       propsSchema: createFieldSchema(AllSchemas.Select)
     },
     designerLocales: { 'zh-CN': { ...AllLocales.Select['zh-CN'], title: '项目联系人' } }
+  },
+  {
+    name: 'Select',
+    extends: ['Field'],
+    selector: node => node.props['name'] === 'area',
+    designerProps: {
+      propsSchema: createFieldSchema(AllSchemas.Select)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Select['zh-CN'], title: '所在区域' } }
   }
 )
 
@@ -108,6 +126,24 @@ Select.Resource = createResource(
       {
         componentName: 'Field',
         props: {
+          title: '',
+          name: 'bScaleUnit',
+          required: true,
+          'x-decorator': 'FormItem',
+          'x-component': 'Select',
+          'x-component-props': {
+            placeholder: '请选择单位'
+          }
+        }
+      }
+    ]
+  },
+  {
+    icon: 'SelectSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
           title: '工程类型',
           name: 'gcType',
           'x-decorator': 'FormItem',
@@ -147,7 +183,10 @@ Select.Resource = createResource(
           name: 'expendType',
           required: true,
           'x-decorator': 'FormItem',
-          'x-component': 'Select'
+          'x-component': 'Select',
+          'x-component-props': {
+            placeholder: '请选择'
+          }
         }
       }
     ]
@@ -223,5 +262,23 @@ Select.Resource = createResource(
         }
       }
     ]
+  },
+  {
+    icon: 'SelectSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          title: '所在区域',
+          name: 'area',
+          required: true,
+          'x-decorator': 'FormItem',
+          'x-component': 'Select',
+          'x-component-props': {
+            placeholder: '请选择'
+          }
+        }
+      }
+    ]
   }
 )

+ 7 - 0
src/pages/Schema/Budget/components/formily/antd/Card/index.tsx

@@ -0,0 +1,7 @@
+import { connect, ReactFC } from '@formily/react'
+import { Card as AntdCard } from 'antd'
+import { CardProps } from 'antd/lib/card'
+import 'antd/lib/card/style/index'
+export const Card: ReactFC<CardProps<any, any>> = connect(AntdCard)
+
+export default Card

+ 1 - 0
src/pages/Schema/Budget/components/formily/antd/index.ts

@@ -0,0 +1 @@
+export * from './Card'

+ 6 - 4
src/pages/Schema/Budget/index.tsx

@@ -1,7 +1,7 @@
 import { queryTemplateList } from '@/services/api/schema'
 import { PageContainer } from '@ant-design/pro-layout'
 import React, { useEffect, useMemo, useState } from 'react'
-import { history, useRequest, connect, useDispatch } from '@umijs/max'
+import { history, useRequest, useDispatch } from '@umijs/max'
 import { createForm } from '@formily/core'
 import { createSchemaField } from '@formily/react'
 import {
@@ -20,6 +20,7 @@ import {
   TimePicker,
   TreeSelect
 } from '@formily/antd'
+import { Card } from './components/formily/antd'
 import { Button } from 'antd'
 import LeftMenu from '../Base/components/LeftMenu'
 import { isString } from '@/utils/is'
@@ -80,11 +81,12 @@ const Budget: React.FC = () => {
         Password,
         DatePicker,
         TimePicker,
-        TreeSelect
+        TreeSelect,
+        Card
       }
     })
     return (
-      <Form form={normalForm} labelCol={4}>
+      <Form form={normalForm} labelWidth="160px" labelAlign="left">
         <SchemaField schema={currentSchema} />
       </Form>
     )
@@ -110,7 +112,7 @@ const Budget: React.FC = () => {
               </Button>
             )}
           </div>
-          <div className="w-600px">{renderForm()}</div>
+          <div className="w-full overflow-y-auto max-h-700px">{renderForm()}</div>
         </div>
       </div>
     </PageContainer>