diff --git a/web/client/src/sections/metadataManagement/components/modelModal.js b/web/client/src/sections/metadataManagement/components/modelModal.js index 36e1fc6..f85da5b 100644 --- a/web/client/src/sections/metadataManagement/components/modelModal.js +++ b/web/client/src/sections/metadataManagement/components/modelModal.js @@ -1,13 +1,21 @@ -import React from 'react'; +import React, { useRef } from 'react'; import { Button, Form } from 'antd'; import { ModalForm, ProFormSelect, ProFormTextArea, ProFormDigit, - ProFormText + ProFormText, + ProFormDependency } from '@ant-design/pro-form'; - +const DATA_TYPES = { + "整型": "数字输入框", + "字符型": "文本框", + "布尔型": "下拉框", + "数字输入框": "整型", + "文本框": "字符型", + "下拉框": "布尔型", +} export default (props) => { const { title, triggerRender, editData = null, onFinish, readOnly, models } = props; const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 } }; @@ -15,9 +23,10 @@ export default (props) => { ...editData, } : {}; const [form] = Form.useForm(); + const formRef = useRef(); return ( { name="dataType" label="数据类型" fieldProps={{ - showSearch: true + showSearch: true, + onChange: value => { + formRef?.current?.setFieldsValue({ + control: DATA_TYPES[value] + }) + } }} /> - - { ]} name="control" label="输入控件" + fieldProps={{ + showSearch: true, + onChange: value => { + formRef?.current?.setFieldsValue({ + dataType: DATA_TYPES[value] + }) + } + }} + /> + { name="nullable" label="是否允许为空" /> - + {/* { { label: '否', value: false }]} name="readOnly" label="是否只读" - /> + /> */} { if (res.success) { queryData(); @@ -97,13 +98,13 @@ function MetaModelManagement(props) { search: false, render: (text, record) => record?.nullable ? '是' : '否' }, - { - title: '是否只读', - dataIndex: 'readOnly', - ellipsis: true, - search: false, - render: (text, record) => record?.readOnly ? '是' : '否' - }, + // { + // title: '是否只读', + // dataIndex: 'readOnly', + // ellipsis: true, + // search: false, + // render: (text, record) => record?.readOnly ? '是' : '否' + // }, { title: '描述', dataIndex: 'description',