king
2021-12-22 bd1dfc9e6c9b9f8076ca2783ce598e0936b4c664
src/templates/menuconfig/menuform/index.jsx
@@ -1,12 +1,15 @@
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 MkIcon from '@/components/mk-icon'
import './index.scss'
class MainSearch extends Component {
  static propTpyes = {
    dict: PropTypes.object, // 字典项
    formlist: PropTypes.array
    dict: PropTypes.object,     // 字典项
    formlist: PropTypes.array,
    inputSubmit: PropTypes.func
  }
  openTypeChange = (key, value) => {
@@ -46,7 +49,7 @@
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  }
                ]
              })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)}
              })(<Input placeholder="" autoFocus={item.key.toLowerCase() === 'menuname'} autoComplete="off" disabled={item.readonly} />)}
            </Form.Item>
          </Col>
        )
@@ -70,8 +73,8 @@
                  getPopupContainer={() => document.getElementById('form-box')}
                >
                  {item.options.map(option =>
                    <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}>
                      {item.key === 'icon' && <Icon type={option.text} />} {option.text}
                    <Select.Option id={option.MenuID} key={option.MenuID} value={option.MenuID}>
                      {item.key === 'icon' && <MkIcon type={option.text} />} {option.text || option.MenuName}
                    </Select.Option>
                  )}
                </Select>
@@ -97,6 +100,13 @@
    })
  }
  onEnterSubmit = (e) => {
    // 表单回车提交
    if (e.key !== 'Enter') return
    this.props.inputSubmit && this.props.inputSubmit()
  }
  render() {
    const formItemLayout = {
      labelCol: {
@@ -109,7 +119,7 @@
      }
    }
    return (
      <Form {...formItemLayout} className="ant-advanced-search-form" id="form-box">
      <Form {...formItemLayout} className="ant-advanced-search-form" id="form-box" onKeyDown={this.onEnterSubmit}>
        <Row gutter={24}>{this.getFields()}</Row>
      </Form>
    )