From bc3c6ea4a83ed5770e29f3f20c39050c88131053 Mon Sep 17 00:00:00 2001 From: zhangminghua Date: Fri, 24 Mar 2023 15:25:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=83=E6=95=B0=E6=8D=AE=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=B1=95=E7=A4=BA=E8=B0=83=E6=95=B4=EF=BC=9B?= =?UTF-8?q?=E5=85=83=E6=95=B0=E6=8D=AE=E6=96=B0=E5=BB=BAmodal=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/metadataDatabModal.js | 26 ++++++++++++------- .../containers/latestMetadata.js | 9 +++---- .../containers/metadataTab.js | 1 - .../src/sections/metadataManagement/routes.js | 1 + 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/web/client/src/sections/metadataManagement/components/metadataDatabModal.js b/web/client/src/sections/metadataManagement/components/metadataDatabModal.js index 0f88ac6..4991dc8 100644 --- a/web/client/src/sections/metadataManagement/components/metadataDatabModal.js +++ b/web/client/src/sections/metadataManagement/components/metadataDatabModal.js @@ -19,15 +19,15 @@ const MetadataDatabaseModal = (props) => { } return Promise.resolve(); } - const renderModel = () => { + const renderModelItems = () => { const items = metadataModels.map(m => { if (m.control === '文本框') { - const rules = [{ required: m.nullable, message: '' }, - { max: m.length, message: `${m.attributeName}不超过${m.length}个字符` }] - if (m.nullable) { + const rules = [{ required: !m.nullable, message: '' }] + if (!m.nullable) { rules.push(({ getFieldValue, validateFields }) => ({ validator(_, value) { return validatorNull(_, value, getFieldValue, validateFields, m.attributeName) } })) + rules.push({ max: m.length, message: `${m.attributeName}不超过${m.length}个字符` }) } return { } else if (m.control === '数字输入框') { + const rules = [{ required: !m.nullable, message: `${m.attributeName}不可空` }] + let maxValue = ''; + if (m.length) { + while (m.length > 0) { + maxValue += '9' + m.length--; + } + } return - + rules={rules}> + } else { return + rules={[{ required: !m.nullable, message: `${m.attributeName}不可空` }]}> +