From 120a1ca7042212630dbe9a0cb6aa208ebf1b1e3d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 22 十二月 2021 16:15:17 +0800 Subject: [PATCH] 2021-12-22 --- src/templates/menuconfig/menuform/index.jsx | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/templates/menuconfig/menuform/index.jsx b/src/templates/menuconfig/menuform/index.jsx index df1a2f6..b7de0a9 100644 --- a/src/templates/menuconfig/menuform/index.jsx +++ b/src/templates/menuconfig/menuform/index.jsx @@ -2,8 +2,10 @@ import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select } from 'antd' -import MkIcon from '@/components/mk-icon' +import asyncComponent from '@/utils/asyncComponent' import './index.scss' + +const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) class MainSearch extends Component { static propTpyes = { @@ -37,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}> @@ -53,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}> @@ -74,7 +76,7 @@ > {item.options.map(option => <Select.Option id={option.MenuID} key={option.MenuID} value={option.MenuID}> - {item.key === 'icon' && <MkIcon type={option.text} />} {option.text || option.MenuName} + {option.text || option.MenuName} </Select.Option> )} </Select> @@ -82,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