From f07c42a322f41e14ef5b1bf8f2fd66fc5d338cdd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 28 六月 2023 18:17:09 +0800 Subject: [PATCH] 2023-06-28 --- src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 98 +++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 78 insertions(+), 20 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 5bc343a..68651c3 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -17,7 +17,6 @@ import NormalHeader from '@/tabviews/custom/components/share/normalheader' import './index.scss' -// const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) const ExcelOutButton = asyncComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton')) const ExcelInButton = asyncComponent(() => import('@/tabviews/zshare/actionList/excelInbutton')) @@ -536,7 +535,7 @@ let result = await Api.genericInterface(param) if (result.status) { - if (config.$cache) { + if (config.$cache && config.setting.onload !== 'false') { Api.writeCacheConfig(config.uuid, result.data || '') } @@ -548,17 +547,38 @@ this.data = result.data || [] this.handleData() } + + if (config.timer && config.clearField && result.data && result.data[0]) { + let vals = (config.clearValue || '').split(',') + if (vals.includes(result.data[0][config.clearField])) { + this.timer && this.timer.stop() + } + } + if (result.message) { + if (result.ErrCode === 'Y') { + Modal.success({ + title: result.message + }) + } else if (result.ErrCode === 'S') { + notification.success({ + top: 92, + message: result.message, + duration: 2 + }) + } + } } else { this.setState({ loading: false }) this.timer && this.timer.stop() + if (!result.message) return if (result.ErrCode === 'N') { Modal.error({ title: result.message, }) - } else { + } else if (result.ErrCode !== '-2') { notification.error({ top: 92, message: result.message, @@ -1478,6 +1498,7 @@ let _valfield = 'value' let _typefield = 'key' let colorIndex = 0 + let barcolors = {} if (plot.datatype === 'statistics') { _valfield = plot.InfoValue @@ -1490,6 +1511,16 @@ if (plot.enabled === 'true') { this.customrender(data) return + } + + if (plot.barcolors && plot.barcolors.length > 0 && plot.Yaxis.length === 1) { + data.forEach((item, i) => { + if (plot.barcolors[i]) { + barcolors[item[plot.Xaxis]] = plot.barcolors[i].color + } + }) + } else { + barcolors = null } const ds = new DataSet() @@ -1624,14 +1655,28 @@ if (plot.$colors) { let limit = chartColors.length - _chart.color(_typefield, (key) => { - if (plot.$colors.has(key)) { - return plot.$colors.get(key) - } else { - colorIndex++ - return chartColors[(colorIndex - 1) % limit] - } - }) + + if (barcolors) { + _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => { + if (barcolors[label]) { + return barcolors[label] + } else if (plot.$colors.has(key)) { + return plot.$colors.get(key) + } else { + colorIndex++ + return chartColors[(colorIndex - 1) % limit] + } + }) + } else { + _chart.color(`${_typefield}`, (key) => { + if (plot.$colors.has(key)) { + return plot.$colors.get(key) + } else { + colorIndex++ + return chartColors[(colorIndex - 1) % limit] + } + }) + } } else { _chart.color(_typefield) } @@ -1686,14 +1731,27 @@ if (plot.$colors) { let limit = chartColors.length - _chart.color(_typefield, (key) => { - if (plot.$colors.has(key)) { - return plot.$colors.get(key) - } else { - colorIndex++ - return chartColors[(colorIndex - 1) % limit] - } - }) + if (barcolors) { + _chart.color(`${_typefield}*${plot.Xaxis}`, (key, label) => { + if (barcolors[label]) { + return barcolors[label] + } else if (plot.$colors.has(key)) { + return plot.$colors.get(key) + } else { + colorIndex++ + return chartColors[(colorIndex - 1) % limit] + } + }) + } else { + _chart.color(`${_typefield}`, (key) => { + if (plot.$colors.has(key)) { + return plot.$colors.get(key) + } else { + colorIndex++ + return chartColors[(colorIndex - 1) % limit] + } + }) + } } else { _chart.color(_typefield) } @@ -1742,7 +1800,7 @@ let menu = null if (plot.menus && plot.menus.length > 0) { - let s = data[plot.menuType] || '' + let s = data[plot.menuType] + '' plot.menus.forEach(m => { if (s !== m.sign) return menu = m -- Gitblit v1.8.0