From f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 十一月 2022 16:11:55 +0800 Subject: [PATCH] 2022-11-21 --- src/components/normalform/modalform/index.jsx | 37 +++++++++++++++++++++++++++---------- 1 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx index 8bc59c5..6a2636b 100644 --- a/src/components/normalform/modalform/index.jsx +++ b/src/components/normalform/modalform/index.jsx @@ -57,6 +57,10 @@ required: item.required, message: item.label + '涓嶅彲涓虹┖!' }] + + if (item.rules) { + _rules.push(...item.rules) + } item.rules = _rules } else if (item.type === 'number') { @@ -275,16 +279,29 @@ if (!content) return - fields.push( - <Col span={item.span || 12} key={index}> - <Form.Item label={label}> - {getFieldDecorator(item.field, { - initialValue: item.initval, - rules: item.rules - })(content)} - </Form.Item> - </Col> - ) + if (item.help) { + fields.push( + <Col span={item.span || 12} key={index}> + <Form.Item label={label} help={<span style={{fontSize: '12px'}}>{item.help}</span>}> + {getFieldDecorator(item.field, { + initialValue: item.initval, + rules: item.rules + })(content)} + </Form.Item> + </Col> + ) + } else { + fields.push( + <Col span={item.span || 12} key={index}> + <Form.Item label={label}> + {getFieldDecorator(item.field, { + initialValue: item.initval, + rules: item.rules + })(content)} + </Form.Item> + </Col> + ) + } }) return fields -- Gitblit v1.8.0