File was renamed from src/menu/components/table/normal-table/columns/markcolumn/index.jsx |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Icon, Modal } from 'antd' |
| | | import { Icon, Modal, Col } from 'antd' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | |
| | | resetMark = () => { |
| | | const { marks, columns, type } = this.props |
| | | let markColumns = fromJS(this.state.markColumns).toJS() |
| | | |
| | | let options = columns.map(col => { |
| | | return { |
| | |
| | | |
| | | if (type === 'line') { |
| | | signs.pop() |
| | | } else if (type === 'slider') { |
| | | markColumns = markColumns.filter(col => { |
| | | col.width = '20%' |
| | | return col.dataIndex !== 'signType' |
| | | }) |
| | | signs = [] |
| | | } |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | marks: marks ? fromJS(marks).toJS() : [], |
| | | markColumns: this.state.markColumns.map(col => { |
| | | markColumns: markColumns.map(col => { |
| | | if (col.dataIndex === 'field') { |
| | | col.options = options |
| | | } else if (col.dataIndex === 'signType') { |
| | |
| | | }) |
| | | |
| | | let marks = this.state.marks.map(item => { |
| | | if (item.signType[0] === 'background') { |
| | | if (item.signType && item.signType[0] === 'background') { |
| | | try { |
| | | let colors = item.color.match(/\d+/g) |
| | | if ((colors[0] * 0.299 + colors[1] * 0.578 + colors[2] * 0.114) * colors[3] < 192) { |
| | |
| | | destroyOnClose |
| | | > |
| | | <MarkForm dict={dict} signs={signs} columns={options} markChange={this.markChange}/> |
| | | <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>注:从上到下,匹配第一个符合条件的标记。</Col> |
| | | <EditTable actions={['edit', 'move', 'del']} data={marks} columns={markColumns} onChange={(marks) => this.setState({marks})}/> |
| | | </Modal> |
| | | </div> |