king
2022-01-21 46f79b491173d284a4900d19e7aecf7509481438
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