king
2020-12-18 106263ec10e60ce6c406e4fd5eb76d195772d0f0
src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -12,10 +12,10 @@
import Utils from '@/utils/utils.js'
import UtilsDM from '@/utils/utils-datamanage.js'
import { modifyTabview } from '@/store/action'
// import searchLine from '../../share/searchLine'
import MKEmitter from '@/utils/events.js'
import './index.scss'
const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader'))
const ExcelOutButton = asyncComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton'))
const ExcelInButton = asyncComponent(() => import('@/tabviews/zshare/actionList/excelInbutton'))
@@ -35,7 +35,6 @@
    loading: false,            // 数据加载状态
    chartId: Utils.getuuid(),  // 图表Id
    transfield: {},            // 字段名称翻译
    title: '',                 // 组件标题
    sync: false,               // 是否统一请求数据
    plot: null,                // 图表设置
    data: null,                // 数据
@@ -45,7 +44,6 @@
    chartData: [],             // 图表数据
    chartFields: [],           // 统计图表生成字段集
    selectFields: [],          // 统计图表选择字段
    showHeader: false          // 存在标题、搜索、或统计数据时显示
  }
  UNSAFE_componentWillMount () {
@@ -99,9 +97,7 @@
      })
    }
    let showHeader = false
    if (config.plot.title || _config.plot.datatype === 'statistics' || config.search.length > 0) {
      showHeader = true
    if (config.plot.title || config.search.length > 0) {
      _config.plot.height = _config.plot.height - 80
    } else {
      _config.plot.height = _config.plot.height - 30
@@ -196,10 +192,8 @@
      arr_field: _config.columns.map(col => col.field).join(','),
      plot: _config.plot,
      sync: _sync,
      title: config.plot.title,
      search: Utils.initMainSearch(config.search),
      transfield,
      showHeader
      transfield
    }, () => {
      if (config.setting.sync !== 'true' && config.setting.onload === 'true') {
        this.loadData()
@@ -1265,8 +1259,14 @@
    })
  }
  refreshSearch = (list) => {
    this.setState({search: list}, () => {
      this.loadData()
    })
  }
  render() {
    const { showHeader, config, loading, title, plot, empty, chartFields, selectFields, BID } = this.state
    const { config, loading, plot, empty, chartFields, selectFields, BID } = this.state
    return (
      <div className="custom-line-chart-plot-box" style={config.style}>
@@ -1276,23 +1276,9 @@
            <Spin />
          </div> : null
        }
        {showHeader ? <div className="chart-header" style={config.headerStyle}>
          <span className="chart-title">{title}</span>
          {/* <searchLine /> */}
          {plot.datatype === 'statistics' && chartFields.length > 0 ? <Select
            mode="multiple"
            showSearch
            showArrow={true}
            value={selectFields}
            onChange={this.handleChange}
            maxTagCount={0}
            maxTagPlaceholder={(option) => <div className="type-label">{option.join('、')}</div>}
          >
            {chartFields.map((item, i) => <Select.Option key={i} value={item}>{item}</Select.Option>)}
          </Select> : null}
        </div> : null}
        <NormalHeader config={config} BID={BID} menuType={this.props.menuType} refresh={this.refreshSearch} />
        <div className="canvas-wrap">
          <div className={'chart-action ' + (plot.title ? 'with-title' : '')}>
          <div className="chart-action">
            {config.action.map(item => {
              if (item.OpenType === 'excelOut') {
                return (
@@ -1319,6 +1305,17 @@
                )
              }
            })}
            {plot.datatype === 'statistics' && chartFields.length > 0 ? <Select
              mode="multiple"
              showSearch
              showArrow={true}
              value={selectFields}
              onChange={this.handleChange}
              maxTagCount={0}
              maxTagPlaceholder={(option) => <div className="type-label">{option.join('、')}</div>}
            >
              {chartFields.map((item, i) => <Select.Option key={i} value={item}>{item}</Select.Option>)}
            </Select> : null}
          </div>
          <div className={'canvas' + (empty ? ' empty' : '')} id={this.state.chartId}></div>
        </div>