From 4e1938344ca46c0cbe699756ecaffa630e698aec Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 06 五月 2020 13:59:54 +0800 Subject: [PATCH] 2020-05-06 --- src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx | 40 +++++++++++++++++++++++++++++++--------- 1 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx b/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx index 3ea5f49..b9b0a2c 100644 --- a/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx +++ b/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx @@ -8,10 +8,9 @@ class LineChartDrawerForm extends Component { static propTpyes = { - type: PropTypes.string, dict: PropTypes.object, plot: PropTypes.object, - columns: PropTypes.array, + config: PropTypes.object, plotchange: PropTypes.func } @@ -21,11 +20,11 @@ } showDrawer = () => { - const { columns, plot, type } = this.props + const { config, plot } = this.props this.setState({ visible: true, - formlist: getChartOptionForm(plot, columns, type) + formlist: getChartOptionForm(plot, config.columns, config.setting) }) } @@ -47,6 +46,24 @@ }) } + radioChange = (e, key) => { + const { formlist } = this.state + let val = e.target.value + + if (key === 'datatype') { + this.setState({ + formlist: formlist.map(item => { + if (['Yaxis'].includes(item.key)) { + item.hidden = val === 'statistics' + } else if (['InfoType', 'InfoValue', 'InfoDefNumber'].includes(item.key)) { + item.hidden = val !== 'statistics' + } + return item + }) + }) + } + } + getFields() { const { formlist } = this.state const { getFieldDecorator } = this.props.form @@ -57,9 +74,9 @@ } formlist.forEach((item, index) => { - if (item.hidden) return + if (item.hidden || item.forbid) return - if (item.type === 'text') { // 鏂囨湰鎼滅储 + if (item.type === 'text') { fields.push( <Col span={12} key={index}> <Form.Item label={item.tooltip ? @@ -101,7 +118,7 @@ </Form.Item> </Col> ) - } else if (item.type === 'select') { // 涓嬫媺鎼滅储 + } else if (item.type === 'select') { // 涓嬫媺 fields.push( <Col span={12} key={index}> <Form.Item label={item.tooltip ? @@ -133,7 +150,12 @@ } else if (item.type === 'radio') { fields.push( <Col span={12} key={index}> - <Form.Item label={item.label}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <Icon type="question-circle" /> + {item.label} + </Tooltip> : item.label + }> {getFieldDecorator(item.key, { initialValue: item.initVal, rules: [ @@ -143,7 +165,7 @@ } ] })( - <Radio.Group> + <Radio.Group disabled={item.readonly} onChange={(e) => this.radioChange(e, item.key)}> {item.options.map(option => { return ( <Radio key={option.value} value={option.value}>{option.text}</Radio> -- Gitblit v1.8.0