From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 02 八月 2022 11:42:43 +0800 Subject: [PATCH] Merge branch 'develop' --- src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 96 +++++++++++++++++++++++++++++++---------------- 1 files changed, 63 insertions(+), 33 deletions(-) diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index be150a4..b2449054 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -26,7 +26,6 @@ data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 - menuType: PropTypes.any, // 鑿滃崟绫诲瀷 } state = { @@ -198,12 +197,14 @@ _config.plot.$colors = colors } + let limit = _config.plot.XLimit || 11 + let xc = {label: { formatter: (val) => { if (!val || /^\s*$/.test(val)) return val let _val = `${val}` - if (_val.length <= 11) return val - return _val.substring(0, 8) + '...' + if (_val.length <= limit) return val + return _val.substring(0, limit) + '...' }, style: { fill: _config.plot.color } }} @@ -415,22 +416,30 @@ }) return } else if (result.run_type) { - this.setState({timer}) + let repeats = config.timerRepeats || 0 + this.setState({timer, repeats}) this.timer = setTimeout(() => { - this.timerTask() + this.timerTask(repeats) }, timer) } }) } - timerTask = () => { - const { timer } = this.state + timerTask = (times) => { + const { timer, repeats } = this.state if (!timer) return this.loadData(true) - + + if (repeats) { + times = times - 1 + if (times <= 0) { + clearTimeout(this.timer) + return + } + } this.timer = setTimeout(() => { - this.timerTask() + this.timerTask(times) }, timer) } @@ -445,20 +454,10 @@ if (config.uuid !== menuId) return - let supModule = config.setting.supModule - - btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId) - - if (!btn.syncComponentId || btn.syncComponentId !== supModule) { - if (position === 'mainline' || position === 'popclose') { // 鍒锋柊婧愮粍浠舵椂锛岄檮甯﹀埛鏂颁笂绾ц涓庡綋鍓嶇粍浠� - if (supModule && BID) { - MKEmitter.emit('reloadData', supModule, BID) - } else { - this.loadData() - } - } else { - this.loadData() - } + if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { // 鍒锋柊婧愮粍浠舵椂锛岄檮甯﹀埛鏂颁笂绾ц涓庡綋鍓嶇粍浠� + MKEmitter.emit('reloadData', config.setting.supModule, BID) + } else { + this.loadData() } if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 @@ -516,7 +515,7 @@ * @description 鏁版嵁鍔犺浇 */ async loadData (hastimer) { - const { mainSearch, menuType } = this.props + const { mainSearch } = this.props const { config, arr_field, BID, search } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -550,7 +549,7 @@ } let _orderBy = config.setting.order || '' - let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID, menuType) + let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID) let result = await Api.genericInterface(param) if (result.status) { @@ -1018,6 +1017,9 @@ } if (plot.label !== 'false') { _chart.label(_valfield, (value) => { + if (plot.labelValue === 'zero' && value === 0) { + return null + } if (plot.show === 'percent') { value = value + '%' } @@ -1253,6 +1255,10 @@ } if (plot.label !== 'false') { _chart.label('value*key', (value, key) => { + if (plot.labelValue === 'zero' && value === 0) { + return null + } + if (plot.show === 'percent') { value = value + '%' } @@ -1304,6 +1310,10 @@ } if (plot.label !== 'false') { _chart.label('value*key', (value, key) => { + if (plot.labelValue === 'zero' && value === 0) { + return null + } + if (plot.show === 'percent') { value = value + '%' } @@ -1326,13 +1336,17 @@ } } - const view2 = chart.createView({ - region: { - start: { x: 0, y: 0 }, - end: { x: 1, y: 1 } - }, - padding - }) + let view2 = chart + + if (plot.Bar_axis) { + view2 = chart.createView({ + region: { + start: { x: 0, y: 0 }, + end: { x: 1, y: 1 } + }, + padding + }) + } view2.data(dv.rows) view2.legend(false) @@ -1371,6 +1385,10 @@ } if (item.label !== 'false') { _chart.label(item.name, (value) => { + if (plot.labelValue === 'zero' && value === 0) { + return null + } + if (item.show === 'percent') { value = value + '%' } @@ -1419,6 +1437,10 @@ if (item.label === 'true') { _chart.label(item.name, (value) => { + if (plot.labelValue === 'zero' && value === 0) { + return null + } + if (item.show === 'percent') { value = value + '%' } @@ -1624,6 +1646,10 @@ } if (plot.label !== 'false') { _chart.label(`${_valfield}*${_typefield}`, (value, key) => { + if (plot.labelValue === 'zero' && value === 0) { + return null + } + if (plot.show === 'percent') { value = value + '%' } @@ -1682,6 +1708,10 @@ } if (plot.label !== 'false') { _chart.label(`${_valfield}*${_typefield}`, (value, key) => { + if (plot.labelValue === 'zero' && value === 0) { + return null + } + if (plot.show === 'percent') { value = value + '%' } @@ -1845,7 +1875,7 @@ <Spin /> </div> : null } - <NormalHeader config={config} BID={BID} menuType={this.props.menuType} refresh={this.refreshSearch} /> + <NormalHeader config={config} BID={BID} refresh={this.refreshSearch} /> <div className="canvas-wrap" ref={ref => this.wrap = ref}> {config.plot.download === 'enable' && this.state.chart && !empty ? <DownloadOutlined onClick={this.downloadImage} className="system-color download"/> : null} <div className={'chart-action' + (config.plot.download === 'enable' ? ' downable' : '')}> -- Gitblit v1.8.0