king
2020-09-22 5944c2832820a8bfa86e3efb5085f5a2463897f9
src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -43,7 +43,8 @@
    chartData: [],             // 图表数据
    chartFields: [],           // 统计图表生成字段集
    selectFields: [],          // 统计图表选择字段
    percentFields: []          // 设置为百分比的字段,tooltip时增加%
    percentFields: [],         // 设置为百分比的字段,tooltip时增加%
    showHeader: false          // 存在标题、搜索、或统计数据时显示
  }
  UNSAFE_componentWillMount () {
@@ -100,6 +101,11 @@
      })
    }
    let showHeader = false
    if (config.setting.title || _config.plot.datatype === 'statistics') {
      showHeader = true
    }
    this.setState({
      config: _config,
      data: _data,
@@ -110,7 +116,8 @@
      plot: _config.plot,
      sync: _sync,
      title: config.setting.title,
      search: Utils.initMainSearch(config.search)
      search: Utils.initMainSearch(config.search),
      showHeader
    }, () => {
      if (config.setting.sync !== 'true') {
        this.loadData()
@@ -200,11 +207,10 @@
    let result = await Api.genericInterface(param)
    if (result.status) {
      this.setState({
        data: result.data.map((item, index) => {
          item.key = index
          return item
        }),
        data: result.data,
        loading: false
      }, () => {
        this.handleData()
      })
    } else {
      this.setState({
@@ -1017,29 +1023,31 @@
  render() {
    const { BID } = this.props
    const { config, loading, title, plot, empty, chartFields, selectFields } = this.state
    const { showHeader, config, loading, title, plot, empty, chartFields, selectFields } = this.state
    return (
      <div className="custom-line-chart-plot-box">
        {/* <searchLine /> */}
        {title ? <p className="chart-title">{title}</p> : null}
        {loading ?
          <div className="loading-mask">
            <div className="ant-spin-blur"></div>
            <Spin />
          </div> : null
        }
        {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}
        {showHeader ? <div className="chart-header">
          <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}
        <div className="canvas-wrap">
          <div className={'chart-action ' + (plot.title ? 'with-title' : '')}>
            {config.action.map(item => {