| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader, Popover, message, AutoComplete } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Radio, Checkbox, Tooltip, InputNumber, Cascader, Popover, message, AutoComplete } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import { formRule } from '@/utils/option.js' |
| | |
| | | }) |
| | | }) |
| | | } |
| | | } else if (['tsField', 'noVField'].includes(item.key)) { |
| | | item.options = [] |
| | | |
| | | if (side === 'sub') { |
| | | config.subColumns.forEach(col => { |
| | | let label = `${col.field}(${col.label})` |
| | | item.options.push({ |
| | | value: col.field, |
| | | text: label |
| | | }) |
| | | }) |
| | | } else { |
| | | config.columns.forEach(col => { |
| | | let label = `${col.field}(${col.label})` |
| | | item.options.push({ |
| | | value: col.field, |
| | | text: label |
| | | }) |
| | | }) |
| | | } |
| | | } else if (item.key === 'formula') { |
| | | item.fields = [] |
| | | |
| | |
| | | _options.push('value') |
| | | } |
| | | |
| | | if (this.record.eleType === 'text' && this.record.noValue === 'hide') { |
| | | if (this.record.datatype === 'static') { |
| | | _options.push('noVField') |
| | | if (this.record.noVField) { |
| | | _options.push('noVExtra') |
| | | } |
| | | } else { |
| | | _options.push('noVExtra') |
| | | } |
| | | } |
| | | |
| | | if (this.record.eleType === 'picture' && this.record.noValue === 'show') { |
| | | _options.push('lostTip') |
| | | } else if (this.record.eleType === 'video' && this.record.posterType) { |
| | |
| | | if (['text', 'picture'].includes(this.record.eleType) && this.record.link) { |
| | | _options.push('linkType') |
| | | if (this.record.linkType === 'linkmenu') { |
| | | _options.push('open') |
| | | _options.push('open', 'tsField') |
| | | if (this.record.link === 'static') { |
| | | _options.push('linkmenu') |
| | | } else { |
| | |
| | | } |
| | | } else if (this.record.eleType === 'formula') { |
| | | if (this.record.eval !== 'func') { |
| | | _options.push('prefix', 'postfix', 'fixStyle', 'alignItems') |
| | | _options.push('link', 'prefix', 'postfix', 'fixStyle', 'alignItems', 'evalchars') |
| | | } |
| | | if (this.record.eval === 'true') { |
| | | _options.push('decimal') |
| | | } |
| | | if (this.record.link && this.record.eval !== 'func') { |
| | | _options.push('linkType') |
| | | if (this.record.linkType === 'linkmenu') { |
| | | _options.push('open', 'tsField') |
| | | if (this.record.link === 'static') { |
| | | _options.push('linkmenu') |
| | | } else { |
| | | _options.push('linkurl') |
| | | } |
| | | } else if (this.record.linkType === 'other') { |
| | | _options.push('linkurl', 'open') |
| | | } else { |
| | | _options.push('linkurl') |
| | | } |
| | | } |
| | | } |
| | | if (_options.includes('fixStyle') && this.record.fixStyle === 'alone') { |
| | |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType', 'tipType', 'noValue'].includes(key)) { |
| | | } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType', 'tipType', 'noValue', 'noVField'].includes(key)) { |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'checkbox') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal, |
| | | rules: [{ |
| | | required: item.required, |
| | | message: '请选择' + item.label + '!' |
| | | }] |
| | | })( |
| | | <Checkbox.Group style={{whiteSpace: 'nowrap'}}> |
| | | {item.options.map(option => <Checkbox key={option.value} value={option.value}>{option.text}</Checkbox>)} |
| | | </Checkbox.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'color') { |
| | | fields.push( |
| | | <Col span={12} key={index} className="color-form"> |