diff --git a/web/client/src/sections/metadataManagement/components/modelModal.js b/web/client/src/sections/metadataManagement/components/modelModal.js index e07ad64..93af2e2 100644 --- a/web/client/src/sections/metadataManagement/components/modelModal.js +++ b/web/client/src/sections/metadataManagement/components/modelModal.js @@ -1,24 +1,36 @@ -import React, { useState, useRef } from 'react'; -import { Button, Form, Row, Col, Table, Popconfirm, Input, message } from 'antd'; +import React from 'react'; +import { Button } from 'antd'; import { ModalForm, - ProFormRadio, ProFormSelect, ProFormTextArea, ProFormDigit, - ProFormDependency, ProFormText } from '@ant-design/pro-form'; -import moment from 'moment'; - export default (props) => { - const { title, triggerRender, editData = null, onFinish, readOnly, } = props; + const { title, triggerRender, editData = null, onFinish, readOnly, models } = props; const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 16 } }; const initialValues = editData ? { ...editData, } : {}; + const checkName = async (rule, value) => { + let filter = models?.find(s => s?.attributeName == value) + if (filter) { + return Promise.reject(new Error('已存该属性名称!')); + } + return Promise.resolve(); + } + + const checkCode = async (rule, value) => { + let filter = models?.find(s => s?.attributeCode == value) + if (filter) { + return Promise.reject(new Error('已存该属性代码!')); + } + return Promise.resolve(); + } + return ( { modalProps={{ destroyOnClose: true, onCancel: () => { }, - // bodyStyle: { height: 800, overflowY: 'auto' } }} onFinish={async (values) => { onFinish && await onFinish(values, editData) return true; }} - // submitter={!readOnly} width={500} - > { { ) @@ -172,9 +173,10 @@ function MetaModelManagement(props) { } } pagination={{ + size: 'large', total: metaModel?.count, showSizeChanger: true, - showQuickJumper: true, + // showQuickJumper: true, current: currentPage, pageSize: pageSize || 10, pageSizeOptions: [10, 20, 50], @@ -199,6 +201,7 @@ function MetaModelManagement(props) { title="新建模型" onFinish={onFinish} key="addModel" + models={metaModel?.rows || []} /> ]} options={false} @@ -214,7 +217,7 @@ function mapStateToProps(state) { auth, global, metaModel } = state; return { - loading: auth.isRequesting, + loading: metaModel.isRequesting, clientHeight: global.clientHeight, actions: global.actions, metaModel: metaModel?.data || {}