king
2021-05-31 ce70be666bcd78a7e16e739040488cf7e7256cc2
src/menu/components/form/normal-form/groupform/index.jsx
@@ -1,6 +1,6 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, Radio, Select } from 'antd'
import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon } from 'antd'
import { formRule } from '@/utils/option.js'
import './index.scss'
@@ -18,13 +18,22 @@
  UNSAFE_componentWillMount () {
    const { group } = this.props
    const { appType } = this.state
    let fields = []
    group.fields.forEach(f => {
      if (f.field && ['select', 'link', 'text', 'number'].includes(f.type) && f.hidden !== 'true' && f.readonly !== 'true') {
        fields.push(f)
      }
    })
    if (appType === 'mob') {
      group.fields.forEach(f => {
        if (f.field && ['text', 'number'].includes(f.type) && f.hidden !== 'true' && f.readonly !== 'true') {
          fields.push(f)
        }
      })
    } else {
      group.fields.forEach(f => {
        if (f.field && ['select', 'link', 'text', 'number'].includes(f.type) && f.hidden !== 'true' && f.readonly !== 'true') {
          fields.push(f)
        }
      })
    }
    this.setState({
      fields: fields
@@ -55,7 +64,7 @@
  render() {
    const { group, dict } = this.props
    const { getFieldDecorator } = this.props.form
    const { fields } = this.state
    const { fields, appType } = this.state
    const formItemLayout = {
      labelCol: {
@@ -75,6 +84,24 @@
            <Form.Item label="标题">
              {getFieldDecorator('title', {
                initialValue: group.setting.title,
                rules: [
                  {
                    max: formRule.input.max,
                    message: formRule.input.message
                  }
                ]
              })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)}
            </Form.Item>
          </Col>
          <Col span={12}>
            <Form.Item label={
              <Tooltip placement="topLeft" title="用于表单加载时的状态控制。">
                <Icon type="question-circle" />
                状态值
              </Tooltip>
            }>
              {getFieldDecorator('status', {
                initialValue: group.setting.status || '',
                rules: [
                  {
                    max: formRule.input.max,
@@ -105,7 +132,7 @@
              )}
            </Form.Item>
          </Col>
          <Col span={12}>
          {appType !== 'mob' ? <Col span={12}>
            <Form.Item label="表单排列">
              {getFieldDecorator('align', {
                initialValue: group.setting.align || 'left_right'
@@ -116,7 +143,7 @@
                </Radio.Group>
              )}
            </Form.Item>
          </Col>
          </Col> : null}
        </Row>
      </Form>
    )