From 5e10a7ee4a5ef882d6b0d92b19b1a888ffcc6f7f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 14 四月 2020 11:55:03 +0800 Subject: [PATCH] 2020-04-14 --- src/templates/zshare/tabform/index.jsx | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/templates/zshare/tabform/index.jsx b/src/templates/zshare/tabform/index.jsx index 64b356a..98d21c0 100644 --- a/src/templates/zshare/tabform/index.jsx +++ b/src/templates/zshare/tabform/index.jsx @@ -113,9 +113,23 @@ if (item.hidden) return if (item.type === 'text') { // 鏂囨湰鎼滅储 + let rules = [] + + if (item.key === 'foreignKey') { + rules.push({ + pattern: /^[a-zA-Z_]*$/ig, + message: item.label + '瀛楁鍙厑璁稿寘鍚瓧姣嶅強涓嬪垝绾匡紒' + }) + } fields.push( <Col span={12} key={index}> - <Form.Item label={item.label}> + <Form.Item label={ + item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <Icon type="question-circle" /> + {item.label} + </Tooltip> : item.label + }> {getFieldDecorator(item.key, { initialValue: item.initVal, rules: [ @@ -126,7 +140,8 @@ { max: formRule.input.max, message: formRule.input.message - } + }, + ...rules ] })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)} </Form.Item> @@ -164,10 +179,11 @@ fields.push( <Col span={12} key={index}> <Form.Item label={ - <Tooltip placement="topLeft" title="鏍囩娣诲姞鍚岀骇鏍囩鍚庯紝鏍囩涓寜閽埛鏂颁富琛ㄦ椂锛屾坊鍔犵殑鍚岀骇鏍囩浼氬埛鏂般��"> + item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> <Icon type="question-circle" /> {item.label} - </Tooltip> + </Tooltip> : item.label }> {getFieldDecorator(item.key, { initialValue: item.initVal -- Gitblit v1.8.0