浏览代码

release: 预算业务组件70%

lanjianrong 3 年之前
父节点
当前提交
5d82195539

+ 1 - 1
.gitignore

@@ -14,7 +14,7 @@ _roadhog-api-doc
 .DS_Store
 npm-debug.log*
 yarn-error.log
-pnpm-locak.yaml
+/pnpm-locak.yaml
 /coverage
 .idea
 yarn.lock

文件差异内容过多而无法显示
+ 0 - 9927
pnpm-lock.yaml


+ 216 - 0
src/pages/Schema/Budget/components/Designable/antd/components/Input/preview.tsx

@@ -26,6 +26,87 @@ Input.Behavior = createBehavior(
       propsSchema: createFieldSchema(AllSchemas.Input)
     },
     designerLocales: { 'zh-CN': { ...AllLocales.Input['zh-CN'], title: '项目名称' } }
+  },
+  {
+    name: 'Input',
+    extends: ['Field'],
+    selector: node => node.props['name'] === 'gcName',
+    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)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Input['zh-CN'], title: '工程地址' } }
+  },
+  {
+    name: 'Input',
+    extends: ['Field'],
+    selector: node => node.props['name'] === 'institution',
+    designerProps: {
+      propsSchema: createFieldSchema(AllSchemas.Input)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Input['zh-CN'], title: '单位' } }
+  },
+  {
+    name: 'Input',
+    extends: ['Field'],
+    selector: node => node.props['name'] === 'ministry',
+    designerProps: {
+      propsSchema: createFieldSchema(AllSchemas.Input)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Input['zh-CN'], title: '行业主管部门' } }
+  },
+  {
+    name: 'Input',
+    extends: ['Field'],
+    selector: node => node.props['name'] === 'bUnit',
+    designerProps: {
+      propsSchema: createFieldSchema(AllSchemas.Input)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Input['zh-CN'], title: '建设单位' } }
+  },
+  {
+    name: 'Input',
+    extends: ['Field'],
+    selector: node => node.props['name'] === 'fax',
+    designerProps: {
+      propsSchema: createFieldSchema(AllSchemas.Input)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Input['zh-CN'], title: '传真' } }
+  },
+  {
+    name: 'Input',
+    extends: ['Field'],
+    selector: node => node.props['name'] === 'pCorporation',
+    designerProps: {
+      propsSchema: createFieldSchema(AllSchemas.Input)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Input['zh-CN'], title: '项目法人' } }
+  },
+  {
+    name: 'Input',
+    extends: ['Field'],
+    selector: node => node.props['name'] === 'pMobile',
+    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)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Input['zh-CN'], title: '项目联系人邮箱' } }
   }
 )
 
@@ -59,5 +140,140 @@ Input.Resource = createResource(
         }
       }
     ]
+  },
+  {
+    icon: 'InputSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          type: 'string',
+          title: '工程名称',
+          name: 'gcName',
+          'x-decorator': 'FormItem',
+          'x-component': 'Input'
+        }
+      }
+    ]
+  },
+  {
+    icon: 'InputSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          type: 'string',
+          title: '工程地址',
+          name: 'gzAddress',
+          'x-decorator': 'FormItem',
+          'x-component': 'Input'
+        }
+      }
+    ]
+  },
+  {
+    icon: 'InputSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          type: 'string',
+          title: '单位',
+          name: 'institution',
+          'x-decorator': 'FormItem',
+          'x-component': 'Input'
+        }
+      }
+    ]
+  },
+  {
+    icon: 'InputSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          type: 'string',
+          title: '行业主管部门',
+          name: 'ministry',
+          'x-decorator': 'FormItem',
+          'x-component': 'Input'
+        }
+      }
+    ]
+  },
+  {
+    icon: 'InputSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          type: 'string',
+          title: '建设单位',
+          name: 'bUnit',
+          'x-decorator': 'FormItem',
+          'x-component': 'Input'
+        }
+      }
+    ]
+  },
+  {
+    icon: 'InputSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          type: 'string',
+          title: '传真',
+          name: 'fax',
+          'x-decorator': 'FormItem',
+          'x-component': 'Input'
+        }
+      }
+    ]
+  },
+  {
+    icon: 'InputSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          type: 'string',
+          title: '项目法人',
+          name: 'pCorporation',
+          'x-decorator': 'FormItem',
+          'x-component': 'Input'
+        }
+      }
+    ]
+  },
+  {
+    icon: 'InputSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          type: 'string',
+          title: '联系电话',
+          name: 'pMobile',
+          'x-decorator': 'FormItem',
+          'x-component': 'Input'
+        }
+      }
+    ]
+  },
+  {
+    icon: 'InputSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          type: 'string',
+          title: '项目联系人邮箱',
+          name: 'pMail',
+          'x-decorator': 'FormItem',
+          'x-component': 'Input'
+        }
+      }
+    ]
   }
 )

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

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

+ 35 - 0
src/pages/Schema/Budget/components/Designable/antd/components/NumberPicker/preview.ts

@@ -0,0 +1,35 @@
+import React from 'react'
+import { NumberPicker as FormilyNumberPicker } from '@formily/antd'
+import { createBehavior, createResource } from '@designable/core'
+import { DnFC } from '@designable/react'
+import { createFieldSchema } from '../Field'
+import { AllSchemas } from '../../schemas'
+import { AllLocales } from '../../locales'
+
+export const NumberPicker: DnFC<React.ComponentProps<typeof FormilyNumberPicker>> = FormilyNumberPicker
+
+NumberPicker.Behavior = createBehavior({
+  name: 'NumberPicker',
+  extends: ['Field'],
+  selector: node => node.props['name'] === 'bScale',
+  designerProps: {
+    propsSchema: createFieldSchema(AllSchemas.NumberPicker)
+  },
+  designerLocales: { 'zh-CN': { ...AllLocales.NumberPicker['zh-CN'], title: '建设规模' } }
+})
+
+NumberPicker.Resource = createResource({
+  icon: 'NumberPickerSource',
+  elements: [
+    {
+      componentName: 'Field',
+      props: {
+        type: 'number',
+        title: '建设规模',
+        name: 'bScale',
+        'x-decorator': 'FormItem',
+        'x-component': 'NumberPicker'
+      }
+    }
+  ]
+})

+ 69 - 0
src/pages/Schema/Budget/components/Designable/antd/components/Select/preview.tsx

@@ -35,6 +35,33 @@ Select.Behavior = createBehavior(
       propsSchema: createFieldSchema(AllSchemas.Select)
     },
     designerLocales: { 'zh-CN': { ...AllLocales.Select['zh-CN'], title: '项目类型' } }
+  },
+  {
+    name: 'Select',
+    extends: ['Field'],
+    selector: node => node.props['name'] === 'structureType',
+    designerProps: {
+      propsSchema: createFieldSchema(AllSchemas.Select)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Select['zh-CN'], title: '结构类型' } }
+  },
+  {
+    name: 'Select',
+    extends: ['Field'],
+    selector: node => node.props['name'] === 'expendType',
+    designerProps: {
+      propsSchema: createFieldSchema(AllSchemas.Select)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Select['zh-CN'], title: '项目支出类别' } }
+  },
+  {
+    name: 'Select',
+    extends: ['Field'],
+    selector: node => node.props['name'] === 'pLeader',
+    designerProps: {
+      propsSchema: createFieldSchema(AllSchemas.Select)
+    },
+    designerLocales: { 'zh-CN': { ...AllLocales.Select['zh-CN'], title: '项目联系人' } }
   }
 )
 
@@ -80,5 +107,47 @@ Select.Resource = createResource(
         }
       }
     ]
+  },
+  {
+    icon: 'SelectSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          title: '结构类型',
+          name: 'structureType',
+          'x-decorator': 'FormItem',
+          'x-component': 'Select'
+        }
+      }
+    ]
+  },
+  {
+    icon: 'SelectSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          title: '项目支出类别',
+          name: 'expendType',
+          'x-decorator': 'FormItem',
+          'x-component': 'Select'
+        }
+      }
+    ]
+  },
+  {
+    icon: 'SelectSource',
+    elements: [
+      {
+        componentName: 'Field',
+        props: {
+          title: '项目联系人',
+          name: 'pLeader',
+          'x-decorator': 'FormItem',
+          'x-component': 'Select'
+        }
+      }
+    ]
   }
 )

+ 2 - 0
src/pages/Schema/Budget/components/Designable/antd/components/index.ts

@@ -3,3 +3,5 @@ export * from './Form'
 export * from './FormGrid'
 export * from './FormLayout'
 export * from './Input'
+export * from './Select'
+export * from './NumberPicker'

+ 5 - 3
src/pages/Schema/Budget/components/Designable/index.tsx

@@ -19,7 +19,7 @@ import { SettingsForm } from '@designable/react-settings-form'
 import { createDesigner, GlobalRegistry, Shortcut, KeyCode } from '@designable/core'
 import { ActionsWidget, PreviewWidget, SchemaEditorWidget } from './widgets'
 import { saveSchema } from './service'
-import { Form, Field, FormGrid, FormLayout, Input } from './antd'
+import { Form, Field, FormGrid, FormLayout, Input, Select, NumberPicker } from './antd'
 import { connect, useParams } from '@umijs/max'
 
 GlobalRegistry.registerDesignerLocales({
@@ -76,7 +76,7 @@ const Designable: FC<DesignableProps> = ({ templateSchema, title }) => {
         <CompositePanel>
           <CompositePanel.Item title="panels.Component" icon="Component">
             <ResourceWidget title="sources.Layouts" sources={[FormGrid, FormLayout]} />
-            <ResourceWidget title="sources.Inputs" sources={[Input]} />
+            <ResourceWidget title="sources.Inputs" sources={[Input, Select, NumberPicker]} />
           </CompositePanel.Item>
         </CompositePanel>
 
@@ -94,7 +94,9 @@ const Designable: FC<DesignableProps> = ({ templateSchema, title }) => {
                       Field,
                       FormGrid,
                       FormLayout,
-                      Input
+                      Input,
+                      Select,
+                      NumberPicker
                     }}
                   />
                 )}