| | |
| | | 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' |
| | | |
| | |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | const { appType, display } = this.state |
| | | let fields = [] |
| | | |
| | | config.fields.forEach(f => { |
| | |
| | | } |
| | | }) |
| | | |
| | | let _display = display |
| | | if (appType === 'mob' && display !== 'prompt' && display !== 'drawer') { |
| | | _display = 'drawer' |
| | | } |
| | | |
| | | this.setState({ |
| | | fields: fields |
| | | fields: fields, |
| | | display: _display |
| | | }) |
| | | } |
| | | |
| | |
| | | })(<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', { |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | {appType !== 'mob' ? <Col span={12}> |
| | | <Form.Item label="表单排列"> |
| | | {getFieldDecorator('align', { |
| | | initialValue: config.setting.align || 'left_right' |
| | |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | </Col> : null} |
| | | <Col span={12}> |
| | | <Form.Item label="完成后"> |
| | | {getFieldDecorator('finish', { |
| | |
| | | <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' |