| | |
| | | } |
| | | }, |
| | | ], |
| | | cusColumns: [ |
| | | { |
| | | title: '指标', |
| | | dataIndex: 'name', |
| | | editable: false, |
| | | width: '14%' |
| | | }, |
| | | { |
| | | title: '形状', |
| | | dataIndex: 'shape', |
| | | inputType: 'cascader', |
| | | editable: true, |
| | | width: '12%', |
| | | render: (text, record) => { |
| | | return text.join(' / ').replace('line', '折线').replace('bar', '柱形') |
| | | }, |
| | | options: [ |
| | | { |
| | | value: 'line', |
| | | label: '折线', |
| | | children: [ |
| | | { value: 'smooth', label: 'smooth' }, |
| | | { value: 'line', label: 'line' }, |
| | | { value: 'dot', label: 'dot' }, |
| | | { value: 'dash', label: 'dash' }, |
| | | { value: 'hv', label: 'hv' }, |
| | | { value: 'vh', label: 'vh' }, |
| | | { value: 'hvh', label: 'hvh' }, |
| | | { value: 'vhv', label: 'vhv' } |
| | | ] |
| | | }, |
| | | { |
| | | value: 'bar', |
| | | label: '柱形', |
| | | children: [ |
| | | { value: 'rect', label: 'rect' }, |
| | | { value: 'hollow-rect', label: 'hollow-rect' }, |
| | | { value: 'line', label: 'line' }, |
| | | { value: 'tick', label: 'tick' }, |
| | | { value: 'funnel', label: 'funnel' }, |
| | | { value: 'pyramid', label: 'pyramid' } |
| | | ], |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | title: '坐标轴', |
| | | dataIndex: 'axis', |
| | | inputType: 'select', |
| | | editable: true, |
| | | width: '12%', |
| | | options: [ |
| | | { value: 'true', text: '显示'}, |
| | | { value: 'false', text: '隐藏'} |
| | | ], |
| | | render: (text, record) => { |
| | | let trans = {'true': '显示', 'false': '隐藏'} |
| | | return trans[text] || '隐藏' |
| | | } |
| | | }, |
| | | { |
| | | title: '标注', |
| | | dataIndex: 'label', |
| | | inputType: 'select', |
| | | editable: true, |
| | | width: '12%', |
| | | options: [ |
| | | { value: 'true', text: '显示'}, |
| | | { value: 'false', text: '隐藏'} |
| | | ], |
| | | render: (text, record) => { |
| | | let trans = {'true': '显示', 'false': '隐藏'} |
| | | return trans[text] || '' |
| | | } |
| | | }, |
| | | { |
| | | title: '标题', |
| | | dataIndex: 'title', |
| | | inputType: 'select', |
| | | editable: true, |
| | | required: false, |
| | | width: '12%', |
| | | options: [ |
| | | { value: 'true', text: '显示'}, |
| | | { value: 'false', text: '隐藏'} |
| | | ], |
| | | render: (text, record) => { |
| | | let trans = {'true': '显示', 'false': '隐藏'} |
| | | return trans[text] || '' |
| | | } |
| | | }, |
| | | { |
| | | title: '显示(值/%)', |
| | | dataIndex: 'show', |
| | | inputType: 'select', |
| | | editable: true, |
| | | required: false, |
| | | width: '12%', |
| | | options: [ |
| | | { value: 'value', text: '数值'}, |
| | | { value: 'percent', text: '百分比'}, |
| | | { value: 'thdSeparator', text: '千分位'} |
| | | ], |
| | | render: (text, record) => { |
| | | let trans = {value: '数值', percent: '百分比', thdSeparator: '千分位'} |
| | | return trans[text] || '' |
| | | } |
| | | }, |
| | | { |
| | | title: '最小值', |
| | | dataIndex: 'min', |
| | | inputType: 'number', |
| | | editable: true, |
| | | max: 9999999999, |
| | | required: false, |
| | | width: '12%' |
| | | }, |
| | | { |
| | | title: '最大值', |
| | | dataIndex: 'max', |
| | | inputType: 'number', |
| | | editable: true, |
| | | max: 9999999999, |
| | | required: false, |
| | | width: '12%' |
| | | }, |
| | | ] |
| | | cusColumns: [] |
| | | } |
| | | |
| | | showDrawer = () => { |
| | |
| | | } |
| | | } |
| | | |
| | | if (!plot.zoomYaxis && plot.customs) { |
| | | plot.customs.forEach(item => { |
| | | if (item.min || item.min === 0) { |
| | | plot.zoomYaxis = 'custom' |
| | | } else if (item.max || item.max === 0) { |
| | | plot.zoomYaxis = 'custom' |
| | | } |
| | | }) |
| | | } |
| | | |
| | | plot.zoomYaxis = plot.zoomYaxis || 'default' |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | view: 'base', |
| | |
| | | fieldName: fieldName, |
| | | plot: plot, |
| | | baseFormlist: getBaseForm(plot, config.columns), |
| | | formlist: getOptionForm(plot, config.columns) |
| | | formlist: getOptionForm(plot, config.columns), |
| | | cusColumns: this.getCusColumns(plot.zoomYaxis) |
| | | }) |
| | | } |
| | | |
| | |
| | | this.setState({plot: {...plot, enabled: val}}) |
| | | } |
| | | |
| | | zoomChange = (e) => { |
| | | const { plot } = this.state |
| | | let val = e.target.value |
| | | |
| | | this.setState({plot: {...plot, zoomYaxis: val}, cusColumns: this.getCusColumns(val)}) |
| | | } |
| | | |
| | | getCusColumns = (zoomYaxis) => { |
| | | let cusColumns = [ |
| | | { |
| | | title: '指标', |
| | | dataIndex: 'name', |
| | | editable: false, |
| | | width: '12%' |
| | | }, |
| | | { |
| | | title: '形状', |
| | | dataIndex: 'shape', |
| | | inputType: 'cascader', |
| | | editable: true, |
| | | width: '12%', |
| | | render: (text, record) => { |
| | | return text.join(' / ').replace('line', '折线').replace('bar', '柱形') |
| | | }, |
| | | options: [ |
| | | { |
| | | value: 'line', |
| | | label: '折线', |
| | | children: [ |
| | | { value: 'smooth', label: 'smooth' }, |
| | | { value: 'line', label: 'line' }, |
| | | { value: 'dot', label: 'dot' }, |
| | | { value: 'dash', label: 'dash' }, |
| | | { value: 'hv', label: 'hv' }, |
| | | { value: 'vh', label: 'vh' }, |
| | | { value: 'hvh', label: 'hvh' }, |
| | | { value: 'vhv', label: 'vhv' } |
| | | ] |
| | | }, |
| | | { |
| | | value: 'bar', |
| | | label: '柱形', |
| | | children: [ |
| | | { value: 'rect', label: 'rect' }, |
| | | { value: 'hollow-rect', label: 'hollow-rect' }, |
| | | { value: 'line', label: 'line' }, |
| | | { value: 'tick', label: 'tick' }, |
| | | { value: 'funnel', label: 'funnel' }, |
| | | { value: 'pyramid', label: 'pyramid' } |
| | | ], |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | title: '坐标轴', |
| | | dataIndex: 'axis', |
| | | inputType: 'select', |
| | | editable: true, |
| | | width: '12%', |
| | | options: [ |
| | | { value: 'true', text: '显示'}, |
| | | { value: 'false', text: '隐藏'} |
| | | ], |
| | | render: (text, record) => { |
| | | let trans = {'true': '显示', 'false': '隐藏'} |
| | | return trans[text] || '隐藏' |
| | | } |
| | | }, |
| | | { |
| | | title: '标注', |
| | | dataIndex: 'label', |
| | | inputType: 'select', |
| | | editable: true, |
| | | width: '12%', |
| | | options: [ |
| | | { value: 'true', text: '显示'}, |
| | | { value: 'false', text: '隐藏'} |
| | | ], |
| | | render: (text, record) => { |
| | | let trans = {'true': '显示', 'false': '隐藏'} |
| | | return trans[text] || '' |
| | | } |
| | | }, |
| | | { |
| | | title: '标题', |
| | | dataIndex: 'title', |
| | | inputType: 'select', |
| | | editable: true, |
| | | required: false, |
| | | width: '12%', |
| | | options: [ |
| | | { value: 'true', text: '显示'}, |
| | | { value: 'false', text: '隐藏'} |
| | | ], |
| | | render: (text, record) => { |
| | | let trans = {'true': '显示', 'false': '隐藏'} |
| | | return trans[text] || '' |
| | | } |
| | | }, |
| | | { |
| | | title: '显示(值/%)', |
| | | dataIndex: 'show', |
| | | inputType: 'select', |
| | | editable: true, |
| | | required: false, |
| | | width: '12%', |
| | | options: [ |
| | | { value: 'value', text: '数值'}, |
| | | { value: 'percent', text: '百分比'}, |
| | | { value: 'thdSeparator', text: '千分位'} |
| | | ], |
| | | render: (text, record) => { |
| | | let trans = {value: '数值', percent: '百分比', thdSeparator: '千分位'} |
| | | return trans[text] || '' |
| | | } |
| | | }, |
| | | { |
| | | title: '最小值', |
| | | dataIndex: 'min', |
| | | inputType: 'number', |
| | | editable: true, |
| | | max: 9999999999, |
| | | required: false, |
| | | width: '12%' |
| | | }, |
| | | { |
| | | title: '最大值', |
| | | dataIndex: 'max', |
| | | inputType: 'number', |
| | | editable: true, |
| | | max: 9999999999, |
| | | required: false, |
| | | width: '12%' |
| | | }, |
| | | ] |
| | | |
| | | if (zoomYaxis !== 'custom') { |
| | | cusColumns.pop() |
| | | cusColumns.pop() |
| | | cusColumns.forEach(item => { |
| | | item.width = '16%' |
| | | }) |
| | | } |
| | | |
| | | return cusColumns |
| | | } |
| | | |
| | | mutilBarChange = (e) => { |
| | | const { plot } = this.state |
| | | let val = e.target.value |
| | |
| | | _plot.customs = [] |
| | | delete _plot.Yaxis |
| | | } else if (!is(fromJS(values.Yaxis), fromJS(plot.Yaxis || []))) { |
| | | _plot.enabled = 'false' |
| | | _plot.colors = null |
| | | // _plot.enabled = 'false' |
| | | // _plot.colors = null |
| | | |
| | | let labels = {} |
| | | config.columns.forEach(col => { |
| | |
| | | </div> |
| | | </TabPane> : null} |
| | | {plot ? <TabPane tab="自定义图形设置" disabled={datatype === 'statistics'} key="custom"> |
| | | <Col span={12}> |
| | | <Col span={8}> |
| | | <Form {...formItemLayout}> |
| | | <Form.Item label="是否启用" style={{marginBottom: 10}}> |
| | | <Radio.Group value={plot.enabled || 'false'} onChange={this.enabledChange}> |
| | |
| | | </Form.Item> |
| | | </Form> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Col span={8}> |
| | | <Form {...formItemLayout}> |
| | | <Form.Item label="多柱排列" style={{marginBottom: 10}}> |
| | | <Radio.Group value={plot.mutilBar || 'dodge'} onChange={this.mutilBarChange}> |
| | |
| | | </Form.Item> |
| | | </Form> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form {...formItemLayout}> |
| | | <Form.Item label="Y轴区间" style={{marginBottom: 10}}> |
| | | <Radio.Group value={plot.zoomYaxis} onChange={this.zoomChange}> |
| | | <Radio value="default">默认</Radio> |
| | | <Radio value="custom">自定义</Radio> |
| | | <Radio value="adjust">自适应</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Form> |
| | | </Col> |
| | | <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>注:使用自定义设置时,显示的坐标轴第一个在左侧,第二个在右侧,多余的不生效。</Col> |
| | | <EditTable indexShow={false} actions={['edit', 'move']} data={plot.customs || []} columns={cusColumns} onChange={this.changeCustom}/> |
| | | </TabPane> : null} |