king
2021-01-15 76a4300654a18d228838c3f27455dc8e7a8cd616
src/menu/components/share/markcomponent/index.jsx
File was renamed from src/menu/components/table/normal-table/columns/markcolumn/index.jsx
@@ -1,7 +1,7 @@
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'
@@ -127,6 +127,7 @@
  resetMark = () => {
    const { marks, columns, type } = this.props
    let markColumns = fromJS(this.state.markColumns).toJS()
    let options = columns.map(col => {
      return {
@@ -251,12 +252,18 @@
    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') {
@@ -276,7 +283,7 @@
    })
    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) {
@@ -313,6 +320,7 @@
          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>