king
2022-07-27 fbf25a99e0bc643be89b0f9dd0efed7867f1490e
src/views/design/sidemenu/menuform/index.jsx
@@ -7,9 +7,8 @@
const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
class MainSearch extends Component {
class MainForm extends Component {
  static propTpyes = {
    dict: PropTypes.object,     // 字典项
    formlist: PropTypes.array,
    inputSubmit: PropTypes.func
  }
@@ -48,10 +47,10 @@
                rules: [
                  {
                    required: !!item.required,
                    message: this.props.dict['form.required.input'] + item.label + '!'
                    message: '请输入' + item.label + '!'
                  }
                ]
              })(<Input placeholder="" autoFocus={item.key.toLowerCase() === 'menuname'} autoComplete="off" disabled={item.readonly} />)}
              })(<Input placeholder="" autoFocus={item.key.toLowerCase() === 'menuname'} autoComplete="off" disabled={item.readonly} onPressEnter={() => this.props.inputSubmit()}/>)}
            </Form.Item>
          </Col>
        )
@@ -64,7 +63,7 @@
                rules: [
                  {
                    required: !!item.required,
                    message: this.props.dict['form.required.select'] + item.label + '!'
                    message: '请选择' + item.label + '!'
                  }
                ]
              })(
@@ -93,7 +92,7 @@
                rules: [
                  {
                    required: !!item.required,
                    message: this.props.dict['form.required.select'] + item.label + '!'
                    message: '请选择' + item.label + '!'
                  }
                ]
              })(
@@ -120,13 +119,6 @@
    })
  }
  onEnterSubmit = (e) => {
    // 表单回车提交
    if (e.key !== 'Enter') return
    this.props.inputSubmit && this.props.inputSubmit()
  }
  render() {
    const formItemLayout = {
      labelCol: {
@@ -139,11 +131,11 @@
      }
    }
    return (
      <Form {...formItemLayout} className="ant-advanced-search-form" id="form-box" onKeyDown={this.onEnterSubmit}>
      <Form {...formItemLayout} id="form-box">
        <Row gutter={24}>{this.getFields()}</Row>
      </Form>
    )
  }
}
export default Form.create()(MainSearch)
export default Form.create()(MainForm)