From 3dc3891f5f80dc5462b96374ae90177616fb6a4c Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Wed, 15 Mar 2023 13:45:59 +0800 Subject: [PATCH] =?UTF-8?q?(*)=E6=A8=A1=E5=9E=8B=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B1=9E=E6=80=A7=E5=90=8D=E7=A7=B0=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=88=A4=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/modelModal.js | 38 ++++++++++++------- .../containers/metaModelManagement.js | 7 +++- 2 files changed, 30 insertions(+), 15 deletions(-) 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 || {}