From f3d4db769ba9b51b799d981511a710fd443d0e08 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 四月 2025 12:18:03 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/menu/components/chart/antv-bar/chartcompile/index.jsx | 72 ++++++++++++++++++++++++++++++------ 1 files changed, 60 insertions(+), 12 deletions(-) diff --git a/src/menu/components/chart/antv-bar/chartcompile/index.jsx b/src/menu/components/chart/antv-bar/chartcompile/index.jsx index d7ba22d..ca696d2 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx @@ -181,10 +181,15 @@ plot.zoomYaxis = plot.zoomYaxis || 'default' + let datatype = plot.datatype || 'query' + if (plot.enabled === 'true') { + datatype = 'custom' + } + this.setState({ visible: true, view: 'base', - datatype: plot.datatype || 'query', + datatype: datatype, fieldName: fieldName, plot: plot, baseFormlist: getBaseForm(plot, config.columns), @@ -299,6 +304,7 @@ { value: 'false', text: '闅愯棌'} ], render: (text, record) => { + if (record.axis !== 'true') return '' let trans = {'true': '鏄剧ず', 'false': '闅愯棌'} return trans[text] || '' } @@ -317,7 +323,7 @@ ], render: (text, record) => { let trans = {value: '鏁板��', percent: '鐧惧垎姣�', thdSeparator: '鍗冨垎浣�'} - return trans[text] || '' + return trans[text] || '鏁板��' } }, { @@ -359,9 +365,18 @@ this.normalRef.handleConfirm().then(values => { let _plot = {...plot, ...values} + if (_plot.datatype === 'custom') { + _plot.datatype = 'query' + _plot.enabled = 'true' + _plot.show = 'value' + } else { + _plot.enabled = 'false' + } + if (_plot.datatype !== plot.datatype) { _plot.colors = null } + this.resetPlot(_plot) this.setState({ @@ -398,6 +413,14 @@ if (view === 'normal') { this.normalRef.handleConfirm().then(values => { let _plot = {...plot, ...values} + + if (_plot.datatype === 'custom') { + _plot.datatype = 'query' + _plot.enabled = 'true' + _plot.show = 'value' + } else { + _plot.enabled = 'false' + } if (_plot.datatype !== plot.datatype) { _plot.colors = null @@ -482,6 +505,30 @@ resetPlot = (_plot) => { const { config } = this.props + if (_plot.chartType === 'bar') { + _plot.transpose = _plot.shape === 'barChart' ? 'true' : 'false' + _plot.coordinate = _plot.shape === 'roseChart' ? 'polar' : 'angle' + if (_plot.shape === 'barChart' || _plot.shape === 'roseChart') { + _plot.shape = 'rect' + } + } + + if (_plot.axis) { + _plot.grid = _plot.axis.includes('grid') ? 'show' : 'hidden' + _plot.x_line = _plot.axis.includes('x_line') ? 'show' : 'hidden' + _plot.y_line = _plot.axis.includes('y_line') ? 'show' : 'hidden' + _plot.tick = _plot.axis.includes('tick') ? 'show' : 'hidden' + + delete _plot.axis + } + + if (_plot.tickVals) { + _plot.x_label = _plot.tickVals.includes('x_label') ? 'show' : 'hidden' + _plot.y_label = _plot.tickVals.includes('y_label') ? 'show' : 'hidden' + + delete _plot.tickVals + } + if (_plot.datatype === 'statistics') { _plot.enabled = 'false' _plot.customs = [] @@ -515,7 +562,8 @@ name: labels[item] || item, axis: i === 0 ? 'true' : 'false', label: _plot.label === 'false' ? 'false' : true, - title: 'true', + show: 'value', + title: 'false', shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth'] } }) @@ -613,14 +661,14 @@ <Modal wrapClassName="mk-pop-modal" visible={visible} - width={1100} + width={1200} maskClosable={false} onOk={this.onSubmit} onCancel={() => { this.setState({ visible: false }) }} destroyOnClose > {config.name ? <div className="mk-com-name">{config.name} - 缂栬緫</div> : null} - <Tabs activeKey={view} className="menu-chart-edit-box" onChange={this.changeTab}> + <Tabs activeKey={view} className="menu-chart-line-edit-box" onChange={this.changeTab}> <TabPane tab="缁勪欢璁剧疆" key="base"> <ModalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/> </TabPane> @@ -652,15 +700,15 @@ {datatype === 'statistics' ? <Button className="color-add mk-green" onClick={this.addColor}>娣诲姞</Button> : null} {datatype === 'statistics' ? <EditTable actions={['edit', 'move', 'del']} data={plot.colors || []} columns={plot.ramp ==='true' ? rampStatColorColumns : statColorColumns} onChange={this.changeColor}/> : null} {datatype !== 'statistics' ? <EditTable actions={['edit']} data={plot.colors || []} columns={plot.ramp ==='true' ? rampColorColumns : colorColumns} onChange={this.changeColor}/> : null} - {plot.chartType === 'bar' && plot.datatype === 'query' ? <div className="mk-bar-colors"> - <p>鏌卞舰棰滆壊锛氬彲鏍规嵁鏌卞浘搴忓彿璁剧疆棰滆壊銆傛敞锛氫娇鐢ㄨ嚜瀹氫箟鍥惧舰璁剧疆鎴栧鏍规煴鍥炬椂鏃犳晥銆�</p> + {plot.chartType === 'bar' && datatype === 'query' ? <div className="mk-bar-colors"> + <p>鏌卞舰棰滆壊锛氬彲鏍规嵁鏌卞浘搴忓彿璁剧疆棰滆壊銆傛敞锛氬鏍规煴鍥炬椂鏃犳晥銆�</p> <div className="bar-color-add"><PlusOutlined onClick={this.addbarColor}/></div> <EditTable actions={['edit', 'move', 'del']} data={plot.barcolors || []} columns={barColorColumns} onChange={this.changebarColor}/> </div> : null} </div> </TabPane> : null} - {plot ? <TabPane tab="鑷畾涔夊浘褰㈣缃�" disabled={datatype === 'statistics'} key="custom"> - <Col span={8}> + {plot ? <TabPane tab="鑷畾涔夊浘褰㈣缃�" disabled={datatype !== 'custom'} key="custom"> + {/* <Col span={8}> <Form {...formItemLayout}> <Form.Item label="鏄惁鍚敤" style={{marginBottom: 10}}> <Radio.Group value={plot.enabled || 'false'} onChange={(e) => this.optionChange(e.target.value, 'enabled')}> @@ -669,8 +717,8 @@ </Radio.Group> </Form.Item> </Form> - </Col> - <Col span={8}> + </Col> */} + {/* <Col span={8}> <Form {...formItemLayout}> <Form.Item label="澶氭煴鎺掑垪" style={{marginBottom: 10}}> <Radio.Group value={plot.mutilBar || 'dodge'} onChange={(e) => this.optionChange(e.target.value, 'mutilBar')}> @@ -680,7 +728,7 @@ </Radio.Group> </Form.Item> </Form> - </Col> + </Col> */} <Col span={8}> <Form {...formItemLayout}> <Form.Item label="Y杞村尯闂�" style={{marginBottom: 10}}> -- Gitblit v1.8.0