king
2020-11-20 6e106eb13ce404d9955d6c9045d21050d3e08294
src/menu/components/chart/antv-bar/chartcompile/index.jsx
@@ -5,13 +5,14 @@
import Utils from '@/utils/utils.js'
import { chartColors } from '@/utils/option.js'
import { getBarOrLineChartOptionForm } from './formconfig'
import { getBaseForm, getOptionForm } from './formconfig'
import asyncComponent from '@/utils/asyncComponent'
import ColorSketch from '@/mob/colorsketch'
import './index.scss'
const { TabPane } = Tabs
const EditTable = asyncComponent(() => import('@/templates/zshare/editTable'))
const NormalForm = asyncComponent(() => import('@/menu/components/share/normalform'))
class LineChartDrawerForm extends Component {
  static propTpyes = {
@@ -29,6 +30,7 @@
    datatype: '',
    plot: null,
    formlist: null,
    baseFormlist: null,
    fieldName: null,
    colorColumns: [
      {
@@ -166,7 +168,8 @@
      datatype: config.plot.datatype || 'query',
      fieldName: fieldName,
      plot: fromJS(config.plot).toJS(),
      formlist: getBarOrLineChartOptionForm(config.plot, config.columns, sysRoles, MenuType)
      baseFormlist: getBaseForm(config.plot, sysRoles, MenuType),
      formlist: getOptionForm(config.plot, config.columns, MenuType)
    })
  }
@@ -218,7 +221,7 @@
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  }
                ]
              })(<Input placeholder="" autoComplete="off" disabled={item.readonly}/>)}
              })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.onSubmit}/>)}
            </Form.Item>
          </Col>
        )
@@ -239,7 +242,7 @@
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  }
                ]
              })(<InputNumber min={item.min} max={item.max} precision={item.decimal} />)}
              })(<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.onSubmit}/>)}
            </Form.Item>
          </Col>
        )
@@ -341,8 +344,10 @@
          if (values.datatype === 'statistics' || values.datatype !== plot.datatype) {
            _plot.enabled = 'false'
            _plot.customs = []
          } else if (!values.Yaxis || !plot.Yaxis || !is(fromJS(values.Yaxis), fromJS(plot.Yaxis))) {
            _plot.enabled = 'false'
            _plot.customs = []
            _plot.colors = null
          }
@@ -357,6 +362,17 @@
          this.props.plotchange({...config, plot: _plot})
        }
      })
    } else if (view === 'base') {
      this.baseRef.handleConfirm().then(res => {
        let _plot = {...plot, ...res}
        this.setState({
          plot: _plot,
          visible: false
        })
        this.props.plotchange({...config, plot: _plot})
      })
    } else {
      this.setState({
@@ -397,7 +413,7 @@
                name: labels[item] || item,
                axis: i === 0 ? 'true' : 'false',
                label: 'false',
                shape: _plot.chartType === 'bar' ? ['bar', 'rect'] : ['line', 'smooth']
                shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth']
              }
            })
          }
@@ -423,6 +439,13 @@
            view: tab
          })
        }
      })
    } else if (view === 'base') {
      this.baseRef.handleConfirm().then(res => {
        this.setState({
          plot: {...plot, ...res},
          view: tab
        })
      })
    } else {
      this.setState({
@@ -457,7 +480,7 @@
  }
  render() {
    const { view, visible, datatype, plot, colorColumns, statColorColumns, cusColumns } = this.state
    const { view, visible, datatype, plot, colorColumns, statColorColumns, cusColumns, baseFormlist } = this.state
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
@@ -483,7 +506,10 @@
          destroyOnClose
        >
          <Tabs activeKey={view} className="menu-chart-edit-box" onChange={this.changeTab}>
            <TabPane tab="基础设置" key="normal">
            <TabPane tab="组件设置" key="base">
              <NormalForm dict={this.props.dict} formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/>
            </TabPane>
            <TabPane tab="图表设置" key="normal">
              <Form {...formItemLayout}>
                <Row gutter={16}>{this.getFields()}</Row>
              </Form>