From cdd5b449130ea4d7223fde4f414a11a7d0c33d6d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 07 三月 2024 17:52:16 +0800 Subject: [PATCH] 2024-03-07 --- src/menu/components/chart/antv-bar/index.jsx | 46 ++++++++++++++- src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx | 9 ++ src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 47 ++++++++++++++- src/tabviews/custom/components/chart/antv-dashboard/index.jsx | 4 src/templates/zshare/verifycard/callbackcustomscript/index.jsx | 9 +++ src/utils/utils-custom.js | 10 +++ src/tabviews/custom/components/chart/antv-pie/index.jsx | 4 7 files changed, 118 insertions(+), 11 deletions(-) diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx index f0b3e10..7946f54 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx @@ -432,7 +432,7 @@ required: false, options: labelOptions, controlFields: [ - {field: 'labelColor', values: ['true']} + {field: 'labelUnit', values: ['true', 'top', 'middle', 'bottom']} ] }, { type: 'radio', @@ -583,6 +583,13 @@ forbid: appType === 'mob', required: false }, { + type: 'text', + field: 'labelUnit', + label: '鏍囨敞鍗曚綅', + initval: card.labelUnit ||'', + forbid: appType === 'mob', + required: false + }, { type: 'color', field: 'lineColor', label: '鍧愭爣杞撮鑹�', diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index 8074b88..0ad4db4 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -337,6 +337,9 @@ if (plot.show === 'percent') { value = value + '%' } + if (plot.labelUnit) { + value = value + plot.labelUnit + } let _color = color if (plot.labelColor === 'custom' && colors.has(key)) { @@ -720,6 +723,9 @@ if (plot.show === 'percent') { value = value + '%' } + if (plot.labelUnit) { + value = value + plot.labelUnit + } if (label === 'true' && plot.labelColor === 'custom' && colors.has(key)) { lablecfg.style.fill = colors.get(key) @@ -770,6 +776,9 @@ _chart.label('value*key', (value, key) => { if (plot.show === 'percent') { value = value + '%' + } + if (plot.labelUnit) { + value = value + plot.labelUnit } if (label === 'true' && plot.labelColor === 'custom' && colors.has(key)) { @@ -842,6 +851,9 @@ if (item.show === 'percent') { value = value + '%' } + if (plot.labelUnit) { + value = value + plot.labelUnit + } if (plot.label === 'true' && plot.labelColor === 'custom') { lablecfg.style.fill = item.color @@ -884,6 +896,9 @@ _chart.label(item.name, (value) => { if (item.show === 'percent') { value = value + '%' + } + if (plot.labelUnit) { + value = value + plot.labelUnit } let _color = color @@ -977,12 +992,31 @@ if (plot.grid === 'hidden') { yc.grid = null } - if (plot.y_line === 'show') { + if (plot.tick === 'hidden') { + xc.tickLine = null + } + if (plot.x_line === 'hidden') { + xc.line = null + } + if (plot.y_line === 'hidden') { + yc.line = null + } else { yc.line = {style: { stroke: '#D1D2CE' }} } + if (plot.x_label === 'hidden') { + xc.label = null + } + if (plot.y_label === 'hidden') { + yc.label = null + } + if (plot.lineColor) { - xc.tickLine = {style: { stroke: plot.lineColor }} - xc.line = { style: { stroke: plot.lineColor } } + if (xc.tickLine !== null) { + xc.tickLine = {style: { stroke: plot.lineColor }} + } + if (xc.line !== null) { + xc.line = { style: { stroke: plot.lineColor } } + } if (yc.grid !== null) { yc.grid = { line: { style: { stroke: plot.lineColor } }} } @@ -1119,6 +1153,9 @@ if (plot.show === 'percent') { value = value + '%' } + if (plot.labelUnit) { + value = value + plot.labelUnit + } if (plot.label === 'true' && plot.labelColor === 'custom' && colors.has(key)) { lablecfg.style.fill = colors.get(key) @@ -1180,6 +1217,9 @@ if (plot.show === 'percent') { value = value + '%' } + if (plot.labelUnit) { + value = value + plot.labelUnit + } if (plot.label === 'true' && plot.labelColor === 'custom' && colors.has(key)) { lablecfg.style.fill = colors.get(key) 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 f86a91e..75a01b7 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -256,15 +256,35 @@ style: { fill: _config.plot.color } }} let yc = {label: { style: { fill: _config.plot.color } }} + if (_config.plot.grid === 'hidden') { yc.grid = null } - if (_config.plot.y_line === 'show') { + if (_config.plot.tick === 'hidden') { + xc.tickLine = null + } + if (_config.plot.x_line === 'hidden') { + xc.line = null + } + if (_config.plot.y_line === 'hidden') { + yc.line = null + } else { yc.line = {style: { stroke: '#D1D2CE' }} } + if (_config.plot.x_label === 'hidden') { + xc.label = null + } + if (_config.plot.y_label === 'hidden') { + yc.label = null + } + if (_config.plot.lineColor) { - xc.tickLine = {style: { stroke: _config.plot.lineColor }} - xc.line = { style: { stroke: _config.plot.lineColor } } + if (xc.tickLine !== null) { + xc.tickLine = {style: { stroke: _config.plot.lineColor }} + } + if (xc.line !== null) { + xc.line = { style: { stroke: _config.plot.lineColor } } + } if (yc.grid !== null) { yc.grid = { line: { style: { stroke: _config.plot.lineColor } }} } @@ -929,6 +949,9 @@ val = val + '' val = val.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') } + if (plot.labelUnit) { + val = val + plot.labelUnit + } return { content: val, style: { @@ -1221,6 +1244,9 @@ val = val + '' val = val.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') } + if (plot.labelUnit) { + val = val + plot.labelUnit + } if (plot.$label === 'true' && plot.labelColor === 'custom' && plot.$colors && plot.$colors.has(key)) { lablecfg.style.fill = plot.$colors.get(key) @@ -1283,6 +1309,9 @@ } else if (plot.show === 'thdSeparator') { val = val + '' val = val.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') + } + if (plot.labelUnit) { + val = val + plot.labelUnit } if (plot.$label === 'true' && plot.labelColor === 'custom' && plot.$colors && plot.$colors.has(key)) { lablecfg.style.fill = plot.$colors.get(key) @@ -1380,6 +1409,9 @@ val = val + '' val = val.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') } + if (plot.labelUnit) { + val = val + plot.labelUnit + } if (plot.label === 'true' && plot.labelColor === 'custom' && item.color) { lablecfg.style.fill = item.color } @@ -1446,6 +1478,9 @@ } else if (item.show === 'thdSeparator') { val = val + '' val = val.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') + } + if (plot.labelUnit) { + val = val + plot.labelUnit } return { @@ -1694,6 +1729,9 @@ val = val + '' val = val.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') } + if (plot.labelUnit) { + val = val + plot.labelUnit + } if (plot.label === 'true' && plot.labelColor === 'custom' && plot.$colors && plot.$colors.has(key)) { lablecfg.style.fill = plot.$colors.get(key) @@ -1780,6 +1818,9 @@ val = val + '' val = val.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') } + if (plot.labelUnit) { + val = val + plot.labelUnit + } if (plot.label === 'true' && plot.labelColor === 'custom' && plot.$colors && plot.$colors.has(key)) { lablecfg.style.fill = plot.$colors.get(key) diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx index 605b841..15cf833 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx @@ -3,7 +3,7 @@ import { is, fromJS } from 'immutable' import { Chart, registerShape } from '@antv/g2' import { Spin, notification, Modal } from 'antd' -import { DownloadOutlined } from '@ant-design/icons' +// import { DownloadOutlined } from '@ant-design/icons' import moment from 'moment' import Api from '@/api' @@ -731,7 +731,7 @@ } <NormalHeader config={config} /> <div className="canvas-wrap"> - {config.plot.download === 'enable' && this.state.chart ? <DownloadOutlined onClick={this.downloadImage} className="system-color download"/> : null} + {/* {config.plot.download === 'enable' && this.state.chart ? <DownloadOutlined onClick={this.downloadImage} className="system-color download"/> : null} */} <div className="canvas" id={this.state.chartId}></div> </div> </div> diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index 4b9a3d2..44ed1cc 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -4,7 +4,7 @@ import { Chart } from '@antv/g2' import DataSet, { DataView } from '@antv/data-set' import { Spin, Empty, notification, Modal } from 'antd' -import { DownloadOutlined } from '@ant-design/icons' +// import { DownloadOutlined } from '@ant-design/icons' import moment from 'moment' import Api from '@/api' @@ -916,7 +916,7 @@ } <NormalHeader config={config} BID={BID} refresh={this.refreshSearch} /> <div className="canvas-wrap"> - {config.plot.download === 'enable' && this.state.chart && !empty ? <DownloadOutlined onClick={this.downloadImage} className="system-color download"/> : null} + {/* {config.plot.download === 'enable' && this.state.chart && !empty ? <DownloadOutlined onClick={this.downloadImage} className="system-color download"/> : null} */} <div className={'canvas' + (empty ? ' empty' : '')} id={this.state.chartId}></div> </div> {empty ? <Empty description={false}/> : null} diff --git a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx index e552443..c0c0a6c 100644 --- a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx +++ b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx @@ -57,6 +57,15 @@ } if (!err) { + if (/^[\s\n]+$/.test(values.sql)) { + notification.warning({ + top: 92, + message: '璇疯緭鍏ql!', + duration: 5 + }) + return + } + values.uuid = editItem ? editItem.uuid : '' values.position = values.position || (editItem ? editItem.position : 'front') diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 8926d01..9390ede 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -1649,6 +1649,16 @@ if (card.$c_ds) { columns = card.columns.map(c => c.field) + + if (card.setting.primaryKey && !columns.includes(card.setting.primaryKey)) { + let key = card.setting.primaryKey.toLowerCase() + columns.forEach(f => { + if (f.toLowerCase() === key) { + card.setting.primaryKey = f + } + }) + } + if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) } else if (card.setting.interType === 'system' && card.setting.execute === 'false' && card.scripts.filter(script => script.status !== 'false').length === 0) { -- Gitblit v1.8.0