From 000ff61dd8a88eb875048e6a3deca8679d75df18 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 29 八月 2020 11:29:33 +0800 Subject: [PATCH] 2020-08-29 --- src/menu/components/chart/antv-bar/chartcompile/index.jsx | 45 ++++++++++++++++----------------------------- 1 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/menu/components/chart/antv-bar/chartcompile/index.jsx b/src/menu/components/chart/antv-bar/chartcompile/index.jsx index e40a2ed..315d9bd 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx @@ -23,7 +23,6 @@ disabled: true, plot: null, formlist: null, - datatype: null, fieldName: null, colorOptions: fromJS(minkeColorSystem).toJS().map(option => { option.children = option.children.map(cell => { @@ -78,6 +77,7 @@ this.setState({ visible: true, view: 'normal', + disabled: config.plot.datatype === 'statistics', fieldName: fieldName, plot: fromJS(config.plot).toJS(), formlist: getBarOrLineChartOptionForm(config.plot, config.columns, config.setting) @@ -90,7 +90,7 @@ if (key === 'datatype') { this.setState({ - datatype: val, + disabled: val === 'statistics', formlist: formlist.map(item => { if (['Yaxis'].includes(item.key)) { item.hidden = val === 'statistics' @@ -336,6 +336,7 @@ } onSubmit = () => { + const { config } = this.props const { plot, view, datatype } = this.state if (view !== 'custom') { @@ -360,7 +361,7 @@ visible: false }) - this.props.plotchange(_plot) + this.props.plotchange({...config, plot: _plot}) } }) } else { @@ -400,12 +401,11 @@ } } - changeView = () => { + changeTab = (tab) => { const { config } = this.props - const { plot, view } = this.state - let _view = view === 'normal' ? 'custom' : 'normal' + const { plot } = this.state - if (_view === 'custom') { + if (tab === 'custom') { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { let _plot = {...plot, ...values} @@ -426,7 +426,7 @@ this.setState({ enabled: _plot.enabled || 'false', plot: _plot, - view: _view + view: tab }) } }) @@ -462,15 +462,12 @@ this.setState({ plot: _plot, - view: _view, + view: tab, formlist: getBarOrLineChartOptionForm(_plot, config.columns) }) } }) } - } - - changeTab = () => { } @@ -499,32 +496,22 @@ maskClosable={false} okText={dict['model.submit']} cancelText={dict['model.cancel']} - onOk={this.verifySubmit} + onOk={this.onSubmit} onCancel={() => { this.setState({ visible: false }) }} destroyOnClose > <Tabs activeKey={view} className="menu-chart-edit-box" onChange={this.changeTab}> <TabPane tab="鍩虹璁剧疆" key="normal"> - <Form {...formItemLayout}> + {view === 'normal' ? <Form {...formItemLayout}> <Row gutter={16}>{this.getFields()}</Row> - </Form> + </Form> : null} </TabPane> - <TabPane tab="瀛楁闆�" disabled={disabled} key="custom"> - + <TabPane tab="鑷畾涔夎缃�" disabled={disabled} key="custom"> + {view === 'custom' ? <Form {...formItemLayout}> + <Row gutter={16}>{this.getCustomFields()}</Row> + </Form> : null} </TabPane> </Tabs> - {/* {view !== 'custom' ? <Form {...formItemLayout} className="base-setting"> - <Row gutter={16}>{this.getFields()}</Row> - {datatype === 'query' ? <Row gutter={16}> - <Button onClick={this.changeView} style={{border: 0, boxShadow: 'unset',float: 'right', color: '#1890ff', marginRight: 12, cursor: 'pointer'}}>鑷畾涔夎缃�<Icon style={{marginLeft: 5}} type="right" /></Button> - </Row> : null} - </Form> : null} - {view === 'custom' ? <Form {...formItemLayout} id="chart-custom-drawer-form" className="mingke-table"> - <Row gutter={16} style={{minHeight: 'calc(100vh - 180px)'}}>{this.getCustomFields()}</Row> - <Row gutter={16}> - <Button onClick={this.changeView} style={{border: 0, boxShadow: 'unset', color: '#1890ff', marginRight: 12, cursor: 'pointer'}}><Icon style={{marginRight: 5}} type="left" />鍩烘湰璁剧疆</Button> - </Row> - </Form> : null} */} </Modal> </div> ); -- Gitblit v1.8.0