From e1cee96b38805bcccf48e7bcb9d296f2bc54c720 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 24 一月 2025 11:10:32 +0800 Subject: [PATCH] 2025-01-24 --- src/templates/sharecomponent/tabscomponent/tabform/index.jsx | 45 ++++++++++++++++++++++++++++++++------------- 1 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/templates/sharecomponent/tabscomponent/tabform/index.jsx b/src/templates/sharecomponent/tabscomponent/tabform/index.jsx index 267c67c..b32a839 100644 --- a/src/templates/sharecomponent/tabscomponent/tabform/index.jsx +++ b/src/templates/sharecomponent/tabscomponent/tabform/index.jsx @@ -1,16 +1,18 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select, Icon, Tooltip, Radio, InputNumber, notification } from 'antd' +import { Form, Row, Col, Input, Select, Tooltip, Radio, InputNumber, notification } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import { formRule } from '@/utils/option.js' import Utils from '@/utils/utils.js' +import asyncComponent from '@/utils/asyncComponent' // import './index.scss' + +const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) class MainTab extends Component { static propTpyes = { tabs: PropTypes.array, // 鍙叧鑱旀爣绛鹃泦 - dict: PropTypes.object, // 瀛楀吀椤� formlist: PropTypes.any, // 琛ㄥ崟 levels: PropTypes.any, // 鏍囩鏄剧ず绾у埆 card: PropTypes.object, // 鏍囩椤典俊鎭� @@ -115,12 +117,6 @@ 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={ @@ -135,7 +131,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' + message: '璇疯緭鍏�' + item.label + '!' }, { max: formRule.input.max, @@ -162,7 +158,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.input'] + item.label + '!' + message: '璇疯緭鍏�' + item.label + '!' } ] })(<InputNumber min={item.min} max={item.max} precision={0} />)} @@ -178,7 +174,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' + message: '璇烽�夋嫨' + item.label + '!' } ] })( @@ -189,10 +185,33 @@ > {item.options.map((option, i) => <Select.Option id={'mk' + i} title={option.text} key={'mk' + i} value={option.value}> - {item.key === 'icon' && i !== 0 ? <Icon type={option.text} /> : option.text} + {option.text} </Select.Option> )} </Select> + )} + </Form.Item> + </Col> + ) + } else if (item.type === 'icon') { // 涓嬫媺鎼滅储 + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <QuestionCircleOutlined className="mk-form-tip" /> + {item.label} + </Tooltip> : item.label + }> + {getFieldDecorator(item.key, { + initialValue: item.initVal || '', + rules: [ + { + required: !!item.required, + message: '璇烽�夋嫨' + item.label + '!' + } + ] + })( + <MkEditIcon options={['data', 'normal', 'edit', 'direction', 'hint']} allowClear/> )} </Form.Item> </Col> @@ -237,7 +256,7 @@ rules: [ { required: !!item.required, - message: this.props.dict['form.required.select'] + item.label + '!' + message: '璇烽�夋嫨' + item.label + '!' } ] })( -- Gitblit v1.8.0