king
2021-06-29 3f85ff9067b806df7848ce7b852ff357a7bac7f5
src/templates/modalconfig/settingform/index.jsx
@@ -1,6 +1,6 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, Radio, InputNumber, Select } from 'antd'
import { Form, Row, Col, Input, Radio, InputNumber, Select, Tooltip, Icon } from 'antd'
import { formRule } from '@/utils/option.js'
import './index.scss'
@@ -20,6 +20,7 @@
  UNSAFE_componentWillMount () {
    const { config } = this.props
    const { appType, display } = this.state
    let fields = []
    config.fields.forEach(f => {
@@ -28,8 +29,14 @@
      }
    })
    let _display = display
    if (appType === 'mob' && display !== 'prompt' && display !== 'drawer') {
      _display = 'drawer'
    }
    this.setState({
      fields: fields
      fields: fields,
      display: _display
    })
  }
@@ -87,13 +94,25 @@
              })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)}
            </Form.Item>
          </Col>
          <Col span={12}>
          {appType !== 'mob' ? <Col span={12}>
            <Form.Item label="宽度(%)">
              {getFieldDecorator('width', {
                initialValue: config.setting.width
              })(<InputNumber min={10} max={90} precision={0} onPressEnter={this.handleSubmit}/>)}
            </Form.Item>
          </Col>
          </Col> : null}
          {appType === 'mob' ? <Col span={12}>
            <Form.Item label={
              <Tooltip placement="topLeft" title="宽度小于100时为百分率,大于100时为绝对值。">
                <Icon type="question-circle" />
                宽度
              </Tooltip>
            }>
              {getFieldDecorator('width', {
                initialValue: config.setting.width
              })(<InputNumber min={10} max={2000} precision={0} onPressEnter={this.handleSubmit}/>)}
            </Form.Item>
          </Col> : null}
          <Col span={12}>
            <Form.Item label="焦点">
              {getFieldDecorator('focus', {
@@ -115,7 +134,7 @@
              )}
            </Form.Item>
          </Col>
          <Col span={12}>
          {appType !== 'mob' ? <Col span={12}>
            <Form.Item label="表单排列">
              {getFieldDecorator('align', {
                initialValue: config.setting.align || 'left_right'
@@ -126,7 +145,7 @@
                </Radio.Group>
              )}
            </Form.Item>
          </Col>
          </Col> : null}
          <Col span={12}>
            <Form.Item label="完成后">
              {getFieldDecorator('finish', {
@@ -154,17 +173,17 @@
          <Col span={12}>
            <Form.Item label="显示方式">
              {getFieldDecorator('display', {
                initialValue: config.setting.display || 'modal'
                initialValue: display || 'modal'
              })(
                <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => this.setState({display: e.target.value})}>
                  <Radio value="modal">模态框</Radio>
                  {appType !== 'mob' ? <Radio value="modal">模态框</Radio> : null}
                  <Radio value="prompt">是否框</Radio>
                  <Radio value="drawer">抽屉</Radio>
                </Radio.Group>
              )}
            </Form.Item>
          </Col>
          {!this.props.isSubTab && appType !== 'pc' && display === 'modal' ? <Col span={12}>
          {!this.props.isSubTab && !appType && display === 'modal' ? <Col span={12}>
            <Form.Item label="挂载对象">
              {getFieldDecorator('container', {
                initialValue: config.setting.container || 'tab'