Browse Source

模型管理功规则调整 移除是否可读

master
peng.peng 2 years ago
parent
commit
5248eb1f8b
  1. 48
      web/client/src/sections/metadataManagement/components/modelModal.js
  2. 15
      web/client/src/sections/metadataManagement/containers/metaModelManagement.js

48
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 { Button, Form } from 'antd';
import { import {
ModalForm, ModalForm,
ProFormSelect, ProFormSelect,
ProFormTextArea, ProFormTextArea,
ProFormDigit, ProFormDigit,
ProFormText ProFormText,
ProFormDependency
} from '@ant-design/pro-form'; } from '@ant-design/pro-form';
const DATA_TYPES = {
"整型": "数字输入框",
"字符型": "文本框",
"布尔型": "下拉框",
"数字输入框": "整型",
"文本框": "字符型",
"下拉框": "布尔型",
}
export default (props) => { export default (props) => {
const { title, triggerRender, editData = null, onFinish, readOnly, models } = props; const { title, triggerRender, editData = null, onFinish, readOnly, models } = props;
const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 } }; const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 } };
@ -15,9 +23,10 @@ export default (props) => {
...editData, ...editData,
} : {}; } : {};
const [form] = Form.useForm(); const [form] = Form.useForm();
const formRef = useRef();
return ( return (
<ModalForm <ModalForm
form={form} formRef={formRef}
title={title || ''} title={title || ''}
initialValues={initialValues} initialValues={initialValues}
trigger={ trigger={
@ -63,18 +72,18 @@ export default (props) => {
name="dataType" name="dataType"
label="数据类型" label="数据类型"
fieldProps={{ fieldProps={{
showSearch: true showSearch: true,
onChange: value => {
formRef?.current?.setFieldsValue({
control: DATA_TYPES[value]
})
}
}} }}
/> />
<ProFormDigit
name="length"
label="长度"
fieldProps={{ precision: 0, max: 99999999, }}
/>
<ProFormSelect <ProFormSelect
rules={[{ required: true, message: '请选择输入控件' }]} rules={[{ required: true, message: '请选择输入控件' }]}
disabled={true}
options={[ options={[
{ label: '数字输入框', value: '数字输入框' }, { label: '数字输入框', value: '数字输入框' },
{ label: '文本框', value: '文本框' }, { label: '文本框', value: '文本框' },
@ -82,6 +91,19 @@ export default (props) => {
]} ]}
name="control" name="control"
label="输入控件" label="输入控件"
fieldProps={{
showSearch: true,
onChange: value => {
formRef?.current?.setFieldsValue({
dataType: DATA_TYPES[value]
})
}
}}
/>
<ProFormDigit
name="length"
label="长度"
fieldProps={{ precision: 0, max: 99999999, }}
/> />
<ProFormSelect <ProFormSelect
@ -92,7 +114,7 @@ export default (props) => {
name="nullable" name="nullable"
label="是否允许为空" label="是否允许为空"
/> />
{/*
<ProFormSelect <ProFormSelect
rules={[{ required: true, message: '请选是否只读' }]} rules={[{ required: true, message: '请选是否只读' }]}
options={[ options={[
@ -100,7 +122,7 @@ export default (props) => {
{ label: '否', value: false }]} { label: '否', value: false }]}
name="readOnly" name="readOnly"
label="是否只读" label="是否只读"
/> /> */}
<ProFormTextArea <ProFormTextArea
name="description" name="description"

15
web/client/src/sections/metadataManagement/containers/metaModelManagement.js

@ -49,6 +49,7 @@ function MetaModelManagement(props) {
return dispatch(actions.metadataManagement.addMetaModel({ return dispatch(actions.metadataManagement.addMetaModel({
modelType: selectedKeys[0], modelType: selectedKeys[0],
...values, ...values,
readOnly: false
})).then(res => { })).then(res => {
if (res.success) { if (res.success) {
queryData(); queryData();
@ -97,13 +98,13 @@ function MetaModelManagement(props) {
search: false, search: false,
render: (text, record) => record?.nullable ? '是' : '否' render: (text, record) => record?.nullable ? '是' : '否'
}, },
{ // {
title: '是否只读', // title: '是否只读',
dataIndex: 'readOnly', // dataIndex: 'readOnly',
ellipsis: true, // ellipsis: true,
search: false, // search: false,
render: (text, record) => record?.readOnly ? '是' : '否' // render: (text, record) => record?.readOnly ? '是' : '否'
}, // },
{ {
title: '描述', title: '描述',
dataIndex: 'description', dataIndex: 'description',

Loading…
Cancel
Save