| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Select, Button, Input, InputNumber, Radio, Icon, Cascader, Tooltip } from 'antd' |
| | | import { Form, Row, Col, Select, Button, Input, Radio, Icon, Cascader, Tooltip } from 'antd' |
| | | |
| | | import { minkeColorSystem, minkeIconSystem } from '@/utils/option.js' |
| | | import './index.scss' |
| | |
| | | const { columns } = this.props |
| | | let item = columns.filter(col => col.field === record.field)[0] |
| | | |
| | | let _type = 'background ' |
| | | if (record.signType === 'icon' || record.signType === 'font') { |
| | | _type = 'font ' |
| | | } |
| | | |
| | | this.setState({ |
| | | originField: item || '', |
| | | editItem: record, |
| | | contrastType: record.contrastType || '', |
| | | signType: record.signType || '', |
| | | selectIcon: record.icon || '' |
| | | selectIcon: record.icon || '', |
| | | options: this.state.options.map(option => { |
| | | option.children = option.children.map(cell => { |
| | | cell.label = <div className={_type + cell.value}>{record.icon ? <Icon type={record.icon} /> : cell.value}</div> |
| | | |
| | | return cell |
| | | }) |
| | | return option |
| | | }) |
| | | }, () => { |
| | | let fieldvalue = {} |
| | | Object.keys(record).forEach(key => { |
| | |
| | | } |
| | | } |
| | | |
| | | let contFields = columns.filter(col => originField.field !== col.field && originField.type === col.type) |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} id="model-mark-form-box" className="mingke-table"> |
| | | <Row gutter={24}> |
| | |
| | | <Select> |
| | | <Select.Option value="="> = </Select.Option> |
| | | <Select.Option value="!="> != </Select.Option> |
| | | {originField.type === 'number' ? <Select.Option value=">"> > </Select.Option> : null} |
| | | {originField.type === 'number' ? <Select.Option value="<"> < </Select.Option> : null} |
| | | {originField.type === 'text' ? <Select.Option value="like"> like </Select.Option> : null} |
| | | <Select.Option value=">"> > </Select.Option> |
| | | <Select.Option value="<"> < </Select.Option> |
| | | <Select.Option value="like"> like </Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | |
| | | {contrastType === 'static' ? <Col span={6}> |
| | | <Form.Item label={'对比值'}> |
| | | {getFieldDecorator('contrastValue', { |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '对比值!' |
| | | } |
| | | ] |
| | | })(originField.type === 'number' ? <InputNumber /> : <Input placeholder="" autoComplete="off" />)} |
| | | initialValue: '' |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {contrastType === 'dynamic' ? <Col span={6}> |
| | |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | > |
| | | {contFields.map(item => ( |
| | | {columns.map(item => ( |
| | | <Select.Option key={item.uuid} title={item.label + '(' + item.field + ')'} value={item.field}>{item.label + '(' + item.field + ')'}</Select.Option> |
| | | ))} |
| | | </Select> |
| | |
| | | <Cascader |
| | | options={options} |
| | | placeholder="" |
| | | displayRender={(label, selectedOptions) => selectedOptions[0] ? selectedOptions[0].label + ' / ' + selectedOptions[1].value : ''} |
| | | displayRender={(label, selectedOptions) => selectedOptions[0] ? selectedOptions[0].label + (selectedOptions[1] ? ' / ' + selectedOptions[1].value : '') : ''} |
| | | getPopupContainer={() => document.getElementById('model-mark-form-box')} |
| | | /> |
| | | )} |