From 46f79b491173d284a4900d19e7aecf7509481438 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 21 一月 2022 17:21:25 +0800 Subject: [PATCH] 2022-01-21 --- src/templates/menuconfig/menuform/index.jsx | 30 ++++++++++++++++++++++++++---- 1 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/templates/menuconfig/menuform/index.jsx b/src/templates/menuconfig/menuform/index.jsx index c2de7f5..b7de0a9 100644 --- a/src/templates/menuconfig/menuform/index.jsx +++ b/src/templates/menuconfig/menuform/index.jsx @@ -1,7 +1,11 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select, Icon } from 'antd' +import { Form, Row, Col, Input, Select } from 'antd' + +import asyncComponent from '@/utils/asyncComponent' import './index.scss' + +const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) class MainSearch extends Component { static propTpyes = { @@ -35,7 +39,7 @@ const { getFieldDecorator } = this.props.form const fields = [] this.props.formlist.forEach((item, index) => { - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { fields.push( <Col span={24} key={index}> <Form.Item label={item.label}> @@ -51,7 +55,7 @@ </Form.Item> </Col> ) - } else if (item.type === 'select') { // 涓嬫媺鎼滅储 + } else if (item.type === 'select') { fields.push( <Col span={24} key={index}> <Form.Item label={item.label}> @@ -72,7 +76,7 @@ > {item.options.map(option => <Select.Option id={option.MenuID} key={option.MenuID} value={option.MenuID}> - {item.key === 'icon' && <Icon type={option.text} />} {option.text || option.MenuName} + {option.text || option.MenuName} </Select.Option> )} </Select> @@ -80,6 +84,24 @@ </Form.Item> </Col> ) + } else if (item.type === 'icon') { + fields.push( + <Col span={24} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.key, { + initialValue: item.initVal || '', + rules: [ + { + required: !!item.required, + message: this.props.dict['form.required.select'] + item.label + '!' + } + ] + })( + <MkEditIcon options={['normal', 'data', 'direction', 'edit', 'hint']} /> + )} + </Form.Item> + </Col> + ) } }) return fields -- Gitblit v1.8.0