From a89e722e201de8e2b87ed4ab052f89197b4820b9 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Mon, 21 Nov 2022 14:41:01 +0800 Subject: [PATCH 01/10] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE-AntV=E6=8A=98?= =?UTF-8?q?=E7=BA=BF=E5=9B=BE):=20=E4=BF=AE=E5=A4=8D=E5=A4=9A=E7=BB=B4?= =?UTF-8?q?=E5=BA=A6=E6=8A=98=E7=BA=BF=E5=9B=BE=E6=8E=A7=E5=88=B6=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复多维度折线图在主维度和子维度一样且空值策略为置 0 时显示异常 https://www.tapd.cn/55578866/bugtrace/bugs/view/1155578866001019910 --- frontend/src/views/chart/chart/util.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/frontend/src/views/chart/chart/util.js b/frontend/src/views/chart/chart/util.js index ca04a3124f..37dd7d4dc1 100644 --- a/frontend/src/views/chart/chart/util.js +++ b/frontend/src/views/chart/chart/util.js @@ -3398,15 +3398,18 @@ function handleSetZeroMultiDimension(chart, data) { let insertCount = 0 dimensionInfoMap.forEach((dimensionInfo, field) => { if (dimensionInfo.set.size < subDimensionSet.size) { - const toBeFillDimension = [...subDimensionSet].filter(item => !dimensionInfo.set.has(item)) - toBeFillDimension.forEach(dimension => { - data.splice(dimensionInfo.index + insertCount, 0, { - field, - value: 0, - category: dimension - }) + let subInsertIndex = 0 + subDimensionSet.forEach(dimension => { + if (!dimensionInfo.set.has(dimension)) { + data.splice(dimensionInfo.index + insertCount + subInsertIndex, 0, { + field, + value: 0, + category: dimension + }) + } + subInsertIndex++ }) - insertCount += toBeFillDimension.size + insertCount += subDimensionSet.size - dimensionInfo.set.size } }) } From b55440d4b760fa005201d8933a1db8719c2598cf Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Wed, 23 Nov 2022 17:47:47 +0800 Subject: [PATCH 02/10] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE-=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC):=20=E8=A1=A8=E6=A0=BC=E6=94=AF=E6=8C=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=BB=9A=E5=8A=A8=E6=9D=A1=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 表格支持修改滚动条颜色 https://www.tapd.cn/55578866/prong/stories/view/1155578866001010175 --- frontend/src/lang/en.js | 1 + frontend/src/lang/tw.js | 1 + frontend/src/lang/zh.js | 1 + frontend/src/views/chart/chart/chart.js | 8 ++++-- .../views/chart/chart/common/common_table.js | 11 +++++++- frontend/src/views/chart/chart/util.js | 24 ++++++++++++++++++ .../components/shapeAttr/ColorSelector.vue | 15 +++++++++++ .../chart/components/table/TableNormal.vue | 25 ++++++++++++++++--- .../panelStyle/PanelColorSelector.vue | 13 ++++++++++ 9 files changed, 92 insertions(+), 7 deletions(-) diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 1979ce85d2..739856bb18 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -1336,6 +1336,7 @@ export default { table_align_left: 'Left', table_align_center: 'Center', table_align_right: 'Right', + table_scroll_bar_color: 'Scroll Bar Color', draw_back: 'Draw Back', senior: 'Senior', senior_cfg: 'Senior Config', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 4914de9835..c5d48bf4f0 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -1336,6 +1336,7 @@ export default { table_align_left: '左對齊', table_align_center: '居中', table_align_right: '右對齊', + table_scroll_bar_color: '滾動條顏色', draw_back: '收回', senior: '高級', senior_cfg: '高級設置', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 88749cf7c9..fcad801da6 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -1335,6 +1335,7 @@ export default { table_align_left: '左对齐', table_align_center: '居中', table_align_right: '右对齐', + table_scroll_bar_color: '滚动条颜色', draw_back: '收回', senior: '高级', senior_cfg: '高级设置', diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index 5f78851539..cd0cfa5b05 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -28,7 +28,9 @@ export const DEFAULT_COLOR_CASE = { tableBorderColor: '#E6E7E4', seriesColors: [], // 格式:{"name":"s1","color":"","isCustom":false} areaBorderColor: '#303133', - areaBaseColor: '#FFFFFF' + areaBaseColor: '#FFFFFF', + tableScrollBarColor: 'rgba(0, 0, 0, 0.15)', + tableScrollBarHoverColor: 'rgba(0, 0, 0, 0.4)' } export const DEFAULT_COLOR_CASE_DARK = { @@ -44,7 +46,9 @@ export const DEFAULT_COLOR_CASE_DARK = { tableBorderColor: '#CCCCCC', seriesColors: [], // 格式:{"name":"s1","color":"","isCustom":false} areaBorderColor: '#EBEEF5', - areaBaseColor: '5470C6' + areaBaseColor: '5470C6', + tableScrollBarColor: 'rgba(255, 255, 255, 0.5)', + tableScrollBarHoverColor: 'rgba(255, 255, 255, 0.8)' } export const DEFAULT_SIZE = { barDefault: true, diff --git a/frontend/src/views/chart/chart/common/common_table.js b/frontend/src/views/chart/chart/common/common_table.js index 0a318f5e08..154b383410 100644 --- a/frontend/src/views/chart/chart/common/common_table.js +++ b/frontend/src/views/chart/chart/common/common_table.js @@ -1,4 +1,4 @@ -import { hexColorToRGBA } from '@/views/chart/chart/util' +import { hexColorToRGBA, resetRgbOpacity } from '@/views/chart/chart/util' import { DEFAULT_COLOR_CASE, DEFAULT_SIZE } from '@/views/chart/chart/chart' export function getCustomTheme(chart) { @@ -7,6 +7,8 @@ export function getCustomTheme(chart) { const borderColor = hexColorToRGBA(DEFAULT_COLOR_CASE.tableBorderColor, DEFAULT_COLOR_CASE.alpha) const headerAlign = DEFAULT_SIZE.tableHeaderAlign const itemAlign = DEFAULT_SIZE.tableItemAlign + const scrollBarColor = DEFAULT_COLOR_CASE.tableScrollBarColor + const scrollBarHoverColor = DEFAULT_COLOR_CASE.tableScrollBarHoverColor const theme = { background: { @@ -105,6 +107,10 @@ export function getCustomTheme(chart) { fontSize: DEFAULT_SIZE.tableItemFontSize, textAlign: headerAlign } + }, + scrollBar: { + thumbColor: scrollBarColor, + thumbHoverColor: scrollBarHoverColor } } @@ -156,6 +162,9 @@ export function getCustomTheme(chart) { theme.dataCell.bolderText.fill = c.tableFontColor theme.dataCell.text.fill = c.tableFontColor theme.dataCell.measureText.fill = c.tableFontColor + + theme.scrollBar.thumbColor = c.tableScrollBarColor + theme.scrollBar.thumbHoverColor = resetRgbOpacity(c.tableScrollBarColor, 1.5) } // size if (customAttr.size) { diff --git a/frontend/src/views/chart/chart/util.js b/frontend/src/views/chart/chart/util.js index 37dd7d4dc1..20889f0c7b 100644 --- a/frontend/src/views/chart/chart/util.js +++ b/frontend/src/views/chart/chart/util.js @@ -1,5 +1,6 @@ import { DEFAULT_TITLE_STYLE } from '@/views/chart/chart/chart' import { equalsAny, includesAny } from '@/utils/StringUtils' +import _ from 'lodash' export function hexColorToRGBA(hex, alpha) { const rgb = [] // 定义rgb数组 @@ -49,6 +50,7 @@ export const TYPE_CONFIGS = [ 'tableHeaderFontColor', 'tableFontColor', 'tableBorderColor', + 'tableScrollBarColor', 'alpha' ], 'size-selector-ant-v': [ @@ -95,6 +97,7 @@ export const TYPE_CONFIGS = [ 'tableHeaderFontColor', 'tableFontColor', 'tableBorderColor', + 'tableScrollBarColor', 'alpha' ], 'size-selector-ant-v': [ @@ -144,6 +147,7 @@ export const TYPE_CONFIGS = [ 'tableHeaderFontColor', 'tableFontColor', 'tableBorderColor', + 'tableScrollBarColor', 'alpha' ], 'size-selector-ant-v': [ @@ -1756,6 +1760,7 @@ export const TYPE_CONFIGS = [ 'tableItemBgColor', 'tableHeaderFontColor', 'tableFontColor', + 'tableScrollBarColor', 'alpha' ], 'size-selector': [ @@ -1795,6 +1800,7 @@ export const TYPE_CONFIGS = [ 'tableItemBgColor', 'tableHeaderFontColor', 'tableFontColor', + 'tableScrollBarColor', 'alpha' ], 'size-selector': [ @@ -3430,3 +3436,21 @@ function handleIgnoreData(chart, data) { } } } + +export function resetRgbOpacity(sourceColor, times) { + if (sourceColor?.startsWith('rgb')) { + const numbers = sourceColor.match(/(\d(\.\d+)?)+/g) + if (numbers?.length === 4) { + const opacity = parseFloat(numbers[3]) + if (_.isNumber(opacity)) { + let resultOpacity = (opacity * times).toFixed(2) + if (resultOpacity > 1) { + resultOpacity = 1 + } + const colorArr = numbers.slice(0, 3).concat(resultOpacity) + return `rgba(${colorArr.join(',')})` + } + } + } + return sourceColor +} diff --git a/frontend/src/views/chart/components/shapeAttr/ColorSelector.vue b/frontend/src/views/chart/components/shapeAttr/ColorSelector.vue index 6c8d7a0749..4dbebc5b80 100644 --- a/frontend/src/views/chart/components/shapeAttr/ColorSelector.vue +++ b/frontend/src/views/chart/components/shapeAttr/ColorSelector.vue @@ -237,6 +237,20 @@ @change="changeColorCase('tableBorderColor')" /> + + + import { hexColorToRGBA } from '../../chart/util' import eventBus from '@/components/canvas/utils/eventBus' -import { DEFAULT_SIZE } from '@/views/chart/chart/chart' +import { DEFAULT_COLOR_CASE, DEFAULT_SIZE } from '@/views/chart/chart/chart' export default { name: 'TableNormal', @@ -143,7 +143,9 @@ export default { scrollTimer: null, scrollTop: 0, showIndex: false, - indexLabel: '序号' + indexLabel: '序号', + scrollBarColor: DEFAULT_COLOR_CASE.tableScrollBarColor, + scrollBarHoverColor: DEFAULT_COLOR_CASE.tableScrollBarHoverColor } }, computed: { @@ -152,6 +154,12 @@ export default { background: hexColorToRGBA('#ffffff', 0), borderRadius: this.borderRadius } + }, + tableStyle() { + return { + width: '100%', + '--scroll-bar-color': this.scrollBarColor + } } }, watch: { @@ -283,6 +291,7 @@ export default { this.table_header_class.background = hexColorToRGBA(customAttr.color.tableHeaderBgColor, customAttr.color.alpha) this.table_item_class.color = customAttr.color.tableFontColor this.table_item_class.background = hexColorToRGBA(customAttr.color.tableItemBgColor, customAttr.color.alpha) + this.scrollBarColor = customAttr.color.tableScrollBarColor ? customAttr.color.tableScrollBarColor : DEFAULT_COLOR_CASE.tableScrollBarColor } if (customAttr.size) { this.table_header_class.fontSize = customAttr.size.tableTitleFontSize + 'px' @@ -472,7 +481,7 @@ export default { } - diff --git a/frontend/src/views/panel/subjectSetting/panelStyle/PanelColorSelector.vue b/frontend/src/views/panel/subjectSetting/panelStyle/PanelColorSelector.vue index 421557c96c..7960725df9 100644 --- a/frontend/src/views/panel/subjectSetting/panelStyle/PanelColorSelector.vue +++ b/frontend/src/views/panel/subjectSetting/panelStyle/PanelColorSelector.vue @@ -190,6 +190,19 @@ @change="changeColorCase('tableBorderColor')" /> + + + From 13b2269b32e2e111b126be96f4e93eb9b6b7974a Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Thu, 24 Nov 2022 10:54:42 +0800 Subject: [PATCH 03/10] =?UTF-8?q?fix:=20=E7=80=91=E5=B8=83=E5=9B=BE?= =?UTF-8?q?=E6=B8=90=E5=8F=98=20=E7=99=BE=E5=88=86=E6=AF=94=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E4=B8=BA30%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/chart/bar/bar_antv.js | 7 +++--- .../views/chart/chart/common/common_antv.js | 6 +++++ .../src/views/chart/chart/gauge/gauge_antv.js | 6 +++-- .../src/views/chart/chart/line/line_antv.js | 9 ++++---- .../src/views/chart/chart/pie/pie_antv.js | 12 ---------- frontend/src/views/chart/chart/util.js | 5 +--- .../views/chart/chart/waterfall/waterfall.js | 23 ++++++++++++------- .../components/shapeAttr/ColorSelector.vue | 2 +- frontend/src/views/chart/view/ChartEdit.vue | 1 + 9 files changed, 37 insertions(+), 34 deletions(-) diff --git a/frontend/src/views/chart/chart/bar/bar_antv.js b/frontend/src/views/chart/chart/bar/bar_antv.js index b799ec2517..ef626eeabe 100644 --- a/frontend/src/views/chart/chart/bar/bar_antv.js +++ b/frontend/src/views/chart/chart/bar/bar_antv.js @@ -8,7 +8,8 @@ import { getYAxis, getPadding, getSlider, - getAnalyse + getAnalyse, + setGradientColor } from '@/views/chart/chart/common/common_antv' import { antVCustomColor } from '@/views/chart/chart/util' @@ -105,7 +106,7 @@ export function baseBarOptionAntV(plot, container, chart, action, isGroup, isSta options.color = antVCustomColor(chart) if (customAttr.color.gradient) { options.color = options.color.map((ele) => { - return `l(270) 0:#ffffff00 1:${ele}` + return setGradientColor(ele, customAttr.color.gradient, 270) }) } @@ -206,7 +207,7 @@ export function hBaseBarOptionAntV(plot, container, chart, action, isGroup, isSt options.color = antVCustomColor(chart) if (customAttr.color.gradient) { options.color = options.color.map((ele) => { - return `l(0) 0:#ffffff00 1:${ele}` + return setGradientColor(ele, customAttr.color.gradient) }) } diff --git a/frontend/src/views/chart/chart/common/common_antv.js b/frontend/src/views/chart/chart/common/common_antv.js index 236d7da1b0..759f9c09a6 100644 --- a/frontend/src/views/chart/chart/common/common_antv.js +++ b/frontend/src/views/chart/chart/common/common_antv.js @@ -879,3 +879,9 @@ function getLineDash(type) { return [0, 0] } } + +export function setGradientColor(rawColor, show = false, angle = 0) { + const item = rawColor.split(',') + item.splice(3, 1, '0.3)') + return show ? `l(${angle}) 0:${item.join(',')} 1:${rawColor}` : rawColor +} diff --git a/frontend/src/views/chart/chart/gauge/gauge_antv.js b/frontend/src/views/chart/chart/gauge/gauge_antv.js index b4b3844d6e..5070f6f2c1 100644 --- a/frontend/src/views/chart/chart/gauge/gauge_antv.js +++ b/frontend/src/views/chart/chart/gauge/gauge_antv.js @@ -1,4 +1,4 @@ -import { getPadding, getTheme } from '@/views/chart/chart/common/common_antv' +import { getPadding, getTheme, setGradientColor } from '@/views/chart/chart/common/common_antv' import { Gauge } from '@antv/g2plot' import { DEFAULT_LABEL, DEFAULT_SIZE, DEFAULT_THRESHOLD } from '@/views/chart/chart/chart' import { getScaleValue } from '@/components/canvas/utils/style' @@ -154,7 +154,9 @@ export function baseGaugeOptionAntV(plot, container, chart, action, scale = 1) { } if (customAttr.color.gradient) { - const colorList = (theme.styleSheet?.paletteQualitative10 || []).map((ele) => `l(0) 0:#ffffff00 1:${ele}`) + const colorList = (theme.styleSheet?.paletteQualitative10 || []).map((ele) => { + return setGradientColor(ele, customAttr.color.gradient) + }) if (!options.range) { options.range = { color: colorList diff --git a/frontend/src/views/chart/chart/line/line_antv.js b/frontend/src/views/chart/chart/line/line_antv.js index d1a9c93948..c3ef3bfe59 100644 --- a/frontend/src/views/chart/chart/line/line_antv.js +++ b/frontend/src/views/chart/chart/line/line_antv.js @@ -8,7 +8,8 @@ import { getYAxis, getPadding, getSlider, - getAnalyse + getAnalyse, + setGradientColor } from '@/views/chart/chart/common/common_antv' import { antVCustomColor, handleEmptyDataStrategy } from '@/views/chart/chart/util' import _ from 'lodash' @@ -183,10 +184,10 @@ export function baseAreaOptionAntV(plot, container, chart, action, isStack) { const areaColors = [...options.color, ...options.color] if (customAttr.color.gradient) { options.areaStyle = () => { - const cr = areaColors.shift() - if (cr) { + const ele = areaColors.shift() + if (ele) { return { - fill: `l(270) 0:#ffffff00 1:${cr}` + fill: setGradientColor(ele, customAttr.color.gradient, 270) } } } diff --git a/frontend/src/views/chart/chart/pie/pie_antv.js b/frontend/src/views/chart/chart/pie/pie_antv.js index b3ad13f44a..00fbb8ba81 100644 --- a/frontend/src/views/chart/chart/pie/pie_antv.js +++ b/frontend/src/views/chart/chart/pie/pie_antv.js @@ -82,12 +82,6 @@ export function basePieOptionAntV(plot, container, chart, action) { // custom color options.color = antVCustomColor(chart) - if (customAttr.color.gradient) { - options.color = options.color.map((ele) => { - return `l(270) 0:#ffffff00 1:${ele}` - }) - } - // 开始渲染 if (plot) { plot.destroy() @@ -165,12 +159,6 @@ export function basePieRoseOptionAntV(plot, container, chart, action) { // custom color options.color = antVCustomColor(chart) - if (customAttr.color.gradient) { - options.color = options.color.map((ele) => { - return `l(270) 0:#ffffff00 1:${ele}` - }) - } - // 开始渲染 if (plot) { plot.destroy() diff --git a/frontend/src/views/chart/chart/util.js b/frontend/src/views/chart/chart/util.js index 00084eace9..93e41b6a89 100644 --- a/frontend/src/views/chart/chart/util.js +++ b/frontend/src/views/chart/chart/util.js @@ -943,6 +943,7 @@ export const TYPE_CONFIGS = [ 'color-selector': [ 'value', 'custom', + 'gradient', 'alpha' ], 'label-selector-ant-v': [ @@ -1168,7 +1169,6 @@ export const TYPE_CONFIGS = [ 'value', 'colorPanel', 'customColor', - 'gradient', 'alpha' ], 'size-selector-ant-v': [ @@ -1228,7 +1228,6 @@ export const TYPE_CONFIGS = [ 'value', 'colorPanel', 'customColor', - 'gradient', 'alpha' ], 'size-selector-ant-v': [ @@ -1289,7 +1288,6 @@ export const TYPE_CONFIGS = [ 'value', 'colorPanel', 'customColor', - 'gradient', 'alpha' ], 'size-selector-ant-v': [ @@ -1347,7 +1345,6 @@ export const TYPE_CONFIGS = [ 'value', 'colorPanel', 'customColor', - 'gradient', 'alpha' ], 'size-selector-ant-v': [ diff --git a/frontend/src/views/chart/chart/waterfall/waterfall.js b/frontend/src/views/chart/chart/waterfall/waterfall.js index 61a20c363e..79797d01c3 100644 --- a/frontend/src/views/chart/chart/waterfall/waterfall.js +++ b/frontend/src/views/chart/chart/waterfall/waterfall.js @@ -4,7 +4,8 @@ import { getTheme, getTooltip, getXAxis, - getYAxis + getYAxis, + setGradientColor } from '@/views/chart/chart/common/common_antv' import { Waterfall } from '@antv/g2plot' import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter' @@ -28,11 +29,17 @@ export function baseWaterfallOptionAntV(plot, container, chart, action) { } // data const data = chart.data.data + const [risingColorRgba, fallingColorRgba, totalColorRgba] = theme.styleSheet.paletteQualitative10 + + let customAttrCopy = {} + if (chart.customAttr) { + customAttrCopy = JSON.parse(chart.customAttr) + } // total const total = { label: '合计', style: { - fill: theme.styleSheet.paletteQualitative10[2] + fill: setGradientColor(totalColorRgba, customAttrCopy.color.gradient, 270) } } // options @@ -50,25 +57,25 @@ export function baseWaterfallOptionAntV(plot, container, chart, action) { items: [ { name: '增加', marker: { style: { - fill: theme.styleSheet.paletteQualitative10[0] + fill: setGradientColor(risingColorRgba, customAttrCopy.color.gradient, 270) } }}, { name: '减少', marker: { style: { - fill: theme.styleSheet.paletteQualitative10[1] + fill: setGradientColor(fallingColorRgba, customAttrCopy.color.gradient, 270) } }}, { name: '合计', marker: { style: { - fill: theme.styleSheet.paletteQualitative10[2] + fill: setGradientColor(totalColorRgba, customAttrCopy.color.gradient, 270) } }} ] }, xAxis: xAxis, yAxis: yAxis, - risingFill: theme.styleSheet.paletteQualitative10[0], - fallingFill: theme.styleSheet.paletteQualitative10[1], + risingFill: setGradientColor(risingColorRgba, customAttrCopy.color.gradient, 270), + fallingFill: setGradientColor(fallingColorRgba, customAttrCopy.color.gradient, 270), total: total, interactions: [ { @@ -79,7 +86,7 @@ export function baseWaterfallOptionAntV(plot, container, chart, action) { } ] } - // size + let customAttr = {} if (chart.customAttr) { customAttr = JSON.parse(chart.customAttr) diff --git a/frontend/src/views/chart/components/shapeAttr/ColorSelector.vue b/frontend/src/views/chart/components/shapeAttr/ColorSelector.vue index e4972fc2d0..7c7ae00757 100644 --- a/frontend/src/views/chart/components/shapeAttr/ColorSelector.vue +++ b/frontend/src/views/chart/components/shapeAttr/ColorSelector.vue @@ -477,7 +477,7 @@ export default { this.colorForm.tableBorderColor = this.colorForm.tableBorderColor ? this.colorForm.tableBorderColor : DEFAULT_COLOR_CASE.tableBorderColor this.colorForm.tableHeaderFontColor = this.colorForm.tableHeaderFontColor ? this.colorForm.tableHeaderFontColor : this.colorForm.tableFontColor - + this.$set(this.colorForm, 'gradient', this.colorForm.gradient || false) this.initCustomColor() } } diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 30ac660e0c..eb6fa9ef82 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -1662,6 +1662,7 @@ export default { name: 'ChartEdit', components: { PositionAdjust, + // eslint-disable-next-line MarginSelector, ScrollCfg, CalcChartFieldEdit, From cce1c7f5799fdb57b2d0880b80090b49e27e64d0 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 24 Nov 2022 11:51:25 +0800 Subject: [PATCH 04/10] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E5=A4=8D=E7=94=A8=E8=A7=86=E5=9B=BE=E6=82=AC=E6=B5=AE=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E9=BB=98=E8=AE=A4=E5=A4=A7=E5=B0=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/canvas/store/copy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/canvas/store/copy.js b/frontend/src/components/canvas/store/copy.js index 86a7feafbc..fbcc6c45a3 100644 --- a/frontend/src/components/canvas/store/copy.js +++ b/frontend/src/components/canvas/store/copy.js @@ -12,8 +12,8 @@ export default { copyData: null, // 复制粘贴剪切 isCut: false, baseStyle: { - width: 300, - height: 200, + width: 533, + height: 300, top: 0, left: 0 }, From ce1651fa8231a04c230356e56837b36b0585c60b Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 24 Nov 2022 12:09:56 +0800 Subject: [PATCH 05/10] =?UTF-8?q?feat(=E8=BF=87=E6=BB=A4=E5=99=A8):=20?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=8C=83=E5=9B=B4=E8=BF=87=E6=BB=A4=E5=99=A8?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8A=A8=E6=80=81=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/chart/ChartViewService.java | 32 ++++++++-- .../serviceImpl/NumberSelectServiceImpl.js | 3 + .../serviceImpl/TextSelectServiceImpl.js | 3 + .../serviceImpl/TimeDateRangeServiceImpl.js | 15 ++++- .../widget/serviceImpl/TimeDateServiceImpl.js | 7 +- .../serviceImpl/TimeMonthServiceImpl.js | 7 +- .../widget/serviceImpl/TimeYearServiceImpl.js | 7 +- frontend/src/styles/index.scss | 18 ++++-- .../panel/filter/filterMain/FilterControl.vue | 64 ++++++++++++++++++- 9 files changed, 136 insertions(+), 20 deletions(-) diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index 4ac293ebc8..958d4005b4 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -1694,15 +1694,34 @@ public class ChartViewService { continue; } + Boolean isEndParam = false; for (String parameter : chartExtFilterRequest.getParameters()) { if (parameter.contains("|DE|")) { - if (!parameter.split("\\|DE\\|")[0].equals(table.getId())) { + String[] parameterArray = parameter.split("\\|DE\\|"); + if (!parameterArray[0].equals(table.getId())) { continue; } - List parameters = sqlVariables.stream().filter(item -> item.getVariableName().equalsIgnoreCase(parameter.split("\\|DE\\|")[1])).collect(Collectors.toList()); + String paramName = null; + if (parameterArray.length > 1) { + paramName = parameterArray[1]; + if (paramName.contains("_START_END_SPLIT")) { + String[] paramNameArray = paramName.split("_START_END_SPLIT"); + paramName = paramNameArray[0]; + isEndParam = true; + } + } else { + continue; + } + final String finalParamName = paramName; + List parameters = sqlVariables.stream().filter(item -> item.getVariableName().equalsIgnoreCase(finalParamName)).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(parameters)) { - String filter = qp.transFilter(chartExtFilterRequest, parameters.get(0)); - sql = sql.replace("${" + parameter.split("\\|DE\\|")[1] + "}", filter); + String filter = null; + if (isEndParam) { + filter = transEndParamSql(chartExtFilterRequest, parameters.get(0)); + } else { + filter = qp.transFilter(chartExtFilterRequest, parameters.get(0)); + } + sql = sql.replace("${" + finalParamName + "}", filter); } } else { List parameters = sqlVariables.stream().filter(item -> item.getVariableName().equalsIgnoreCase(parameter)).collect(Collectors.toList()); @@ -1718,6 +1737,11 @@ public class ChartViewService { return sql; } + public String transEndParamSql(ChartExtFilterRequest chartExtFilterRequest, SqlVariableDetails sqlVariableDetails) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(sqlVariableDetails.getType().size() > 1 ? sqlVariableDetails.getType().get(1) : "YYYY"); + return simpleDateFormat.format(new Date(Long.parseLong(chartExtFilterRequest.getValue().get(1)))); + } + private String getDrillSort(List xAxis, ChartViewFieldDTO field) { String res = ""; for (ChartViewFieldDTO f : xAxis) { diff --git a/frontend/src/components/widget/serviceImpl/NumberSelectServiceImpl.js b/frontend/src/components/widget/serviceImpl/NumberSelectServiceImpl.js index 3dcc29a6f6..d18f91f69f 100644 --- a/frontend/src/components/widget/serviceImpl/NumberSelectServiceImpl.js +++ b/frontend/src/components/widget/serviceImpl/NumberSelectServiceImpl.js @@ -107,6 +107,9 @@ class NumberSelectServiceImpl extends WidgetService { return defaultV.split(',')[0] } } + isParamWidget() { + return true + } } const numberSelectServiceImpl = new NumberSelectServiceImpl() export default numberSelectServiceImpl diff --git a/frontend/src/components/widget/serviceImpl/TextSelectServiceImpl.js b/frontend/src/components/widget/serviceImpl/TextSelectServiceImpl.js index 4b5b79d85a..2a28a2d658 100644 --- a/frontend/src/components/widget/serviceImpl/TextSelectServiceImpl.js +++ b/frontend/src/components/widget/serviceImpl/TextSelectServiceImpl.js @@ -102,6 +102,9 @@ class TextSelectServiceImpl extends WidgetService { isCustomSortWidget() { return true } + isParamWidget() { + return true + } fillValueDerfault(element) { const defaultV = element.options.value === null ? '' : element.options.value.toString() diff --git a/frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js b/frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js index 301074284a..cd33146057 100644 --- a/frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js +++ b/frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js @@ -31,7 +31,10 @@ const dialogPanel = { eDynamicSuffix: 'after' }, showTime: false, - accuracy: 'HH:mm' + accuracy: 'HH:mm', + parameters: [], + startParameters: [], + endParameters: [] }, value: '', manualModify: false @@ -329,13 +332,13 @@ class TimeDateRangeServiceImpl extends WidgetService { const defaultV = element.options.value === null ? '' : element.options.value.toString() if (element.options.attrs.type === 'daterange') { if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === - '[object Object]') { + '[object Object]') { return [] } return defaultV.split(',').map(item => parseFloat(item)) } else { if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === - '[object Object]') { + '[object Object]') { return null } return parseFloat(defaultV.split(',')[0]) @@ -400,6 +403,12 @@ class TimeDateRangeServiceImpl extends WidgetService { { 'text': 'dynamic_year.last', 'callBack': () => this.formatShortValues([this.getStartYear(-1).getTime(), this.getEndYear(-1).getTime()]) } ] } + isParamWidget() { + return true + } + isRangeParamWidget() { + return true + } } const timeDateRangeServiceImpl = new TimeDateRangeServiceImpl() export default timeDateRangeServiceImpl diff --git a/frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js b/frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js index d9ce3365ad..a1646a5383 100644 --- a/frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js +++ b/frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js @@ -189,13 +189,13 @@ class TimeDateServiceImpl extends WidgetService { const defaultV = element.options.value === null ? '' : element.options.value.toString() if (element.options.attrs.type === 'daterange') { if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === - '[object Object]') { + '[object Object]') { return [] } return defaultV.split(',').map(item => parseFloat(item)) } else { if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === - '[object Object]') { + '[object Object]') { return null } return parseFloat(defaultV.split(',')[0]) @@ -234,6 +234,9 @@ class TimeDateServiceImpl extends WidgetService { isTimeWidget() { return true } + isParamWidget() { + return true + } } const timeDateServiceImpl = new TimeDateServiceImpl({ name: 'timeDateWidget' diff --git a/frontend/src/components/widget/serviceImpl/TimeMonthServiceImpl.js b/frontend/src/components/widget/serviceImpl/TimeMonthServiceImpl.js index c8defe995a..1254999750 100644 --- a/frontend/src/components/widget/serviceImpl/TimeMonthServiceImpl.js +++ b/frontend/src/components/widget/serviceImpl/TimeMonthServiceImpl.js @@ -150,13 +150,13 @@ class TimeMonthServiceImpl extends WidgetService { const defaultV = element.options.value === null ? '' : element.options.value.toString() if (element.options.attrs.type === 'daterange') { if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === - '[object Object]') { + '[object Object]') { return [] } return defaultV.split(',').map(item => parseFloat(item)) } else { if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === - '[object Object]') { + '[object Object]') { return null } return parseFloat(defaultV.split(',')[0]) @@ -186,6 +186,9 @@ class TimeMonthServiceImpl extends WidgetService { return timeSection(parseFloat(value), element.options.attrs.type) } } + isParamWidget() { + return true + } } const timeMonthServiceImpl = new TimeMonthServiceImpl() export default timeMonthServiceImpl diff --git a/frontend/src/components/widget/serviceImpl/TimeYearServiceImpl.js b/frontend/src/components/widget/serviceImpl/TimeYearServiceImpl.js index 54bbfac589..90d440cdf2 100644 --- a/frontend/src/components/widget/serviceImpl/TimeYearServiceImpl.js +++ b/frontend/src/components/widget/serviceImpl/TimeYearServiceImpl.js @@ -137,13 +137,13 @@ class TimeYearServiceImpl extends WidgetService { const defaultV = element.options.value === null ? '' : element.options.value.toString() if (element.options.attrs.type === 'daterange') { if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === - '[object Object]') { + '[object Object]') { return [] } return defaultV.split(',').map(item => parseFloat(item)) } else { if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === - '[object Object]') { + '[object Object]') { return null } return parseFloat(defaultV.split(',')[0]) @@ -173,6 +173,9 @@ class TimeYearServiceImpl extends WidgetService { return timeSection(parseFloat(value), element.options.attrs.type) } } + isParamWidget() { + return true + } } const timeYearServiceImpl = new TimeYearServiceImpl() export default timeYearServiceImpl diff --git a/frontend/src/styles/index.scss b/frontend/src/styles/index.scss index e4e820d4ac..6cebef7bc6 100644 --- a/frontend/src/styles/index.scss +++ b/frontend/src/styles/index.scss @@ -93,7 +93,7 @@ div:focus { } .de-filter-dialog { - min-width: 500px !important; + min-width: 785px !important; width: 55% !important; .el-dialog__header { @@ -322,12 +322,12 @@ div:focus { margin: 0 2px 1px 0; } -.field-icon-dimension{ - color: #3370FF!important; +.field-icon-dimension { + color: #3370FF !important; } -.field-icon-quota{ - color: #04B49C!important; +.field-icon-quota { + color: #04B49C !important; } .ds-icon-pdf { @@ -1509,6 +1509,7 @@ div:focus { .de-status { position: relative; margin-left: 15px; + &::before { content: ''; position: absolute; @@ -1546,6 +1547,7 @@ div:focus { &::before { background: var(--deDanger, #F54A45); } + .el-icon-s-order { color: var(--primary, #3370ff); cursor: pointer; @@ -1590,6 +1592,7 @@ div:focus { margin: 0; margin-right: 8px; position: relative; + i { position: absolute; right: 2px; @@ -1621,6 +1624,7 @@ div:focus { justify-content: center; align-items: center; } + .arrow-filter:hover { background: rgba(31, 35, 41, 0.1); border-radius: 4px; @@ -1633,6 +1637,7 @@ div:focus { .el-icon-arrow-left.arrow-filter { margin-right: 5px; } + .filter-texts-container { flex: 1; overflow-x: auto; @@ -1674,11 +1679,13 @@ div:focus { transform: translate(-50%, -50%); } } + .calcu-field { .calcu-cont { display: flex; justify-content: space-between; } + .codemirror { height: 250px; overflow-y: auto; @@ -1686,6 +1693,7 @@ div:focus { border: 1px solid #bbbfc4; border-radius: 4px; } + .codemirror .CodeMirror-scroll { height: 250px; overflow-y: auto; diff --git a/frontend/src/views/panel/filter/filterMain/FilterControl.vue b/frontend/src/views/panel/filter/filterMain/FilterControl.vue index d054c00185..d6dfacc517 100644 --- a/frontend/src/views/panel/filter/filterMain/FilterControl.vue +++ b/frontend/src/views/panel/filter/filterMain/FilterControl.vue @@ -169,7 +169,51 @@ width="200" >
- + + + + +
+ {{ item.alias }} + + {{ item.alias }} + +
+ +
+
+
+
+ Date: Thu, 24 Nov 2022 13:38:35 +0800 Subject: [PATCH 06/10] =?UTF-8?q?revert(=E8=A7=86=E5=9B=BE):=20=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E7=BC=96=E8=BE=91=E5=8E=BB=E6=8E=89=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/view/ChartEdit.vue | 62 ++++++++++----------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 992f8bb1c4..9d34f0a5e5 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -192,7 +192,7 @@ @command="chartFieldEdit" > - + - + {{ $t('chart.change_chart_type') }} - + @@ -490,8 +490,8 @@ > {{ - $t('chart.drag_block_table_data_column') - }} + $t('chart.drag_block_table_data_column') + }} {{ $t('chart.drag_block_type_axis') }} @@ -499,18 +499,18 @@ v-else-if="view.type && view.type.includes('pie')" >{{ $t('chart.drag_block_pie_label') }} {{ - $t('chart.drag_block_funnel_split') - }} + $t('chart.drag_block_funnel_split') + }} {{ - $t('chart.drag_block_radar_label') - }} + $t('chart.drag_block_radar_label') + }} {{ $t('chart.area') }} {{ - $t('chart.drag_block_treemap_label') - }} + $t('chart.drag_block_treemap_label') + }} {{ - $t('chart.drag_block_word_cloud_label') - }} + $t('chart.drag_block_word_cloud_label') + }} {{ $t('chart.drag_block_label') }} / {{ $t('chart.dimension') }} @@ -633,8 +633,8 @@ > {{ - $t('chart.drag_block_table_data_column') - }} + $t('chart.drag_block_table_data_column') + }} {{ $t('chart.drag_block_value_axis') }} @@ -642,30 +642,30 @@ v-else-if="view.type && view.type.includes('pie')" >{{ $t('chart.drag_block_pie_angel') }} {{ - $t('chart.drag_block_funnel_width') - }} + $t('chart.drag_block_funnel_width') + }} {{ - $t('chart.drag_block_radar_length') - }} + $t('chart.drag_block_radar_length') + }} {{ - $t('chart.drag_block_gauge_angel') - }} + $t('chart.drag_block_gauge_angel') + }} {{ $t('chart.drag_block_label_value') }} {{ $t('chart.chart_data') }} {{ - $t('chart.drag_block_treemap_size') - }} + $t('chart.drag_block_treemap_size') + }} {{ - $t('chart.drag_block_value_axis_main') - }} + $t('chart.drag_block_value_axis_main') + }} {{ $t('chart.drag_block_progress') }} {{ - $t('chart.drag_block_word_cloud_size') - }} + $t('chart.drag_block_word_cloud_size') + }} / {{ $t('chart.quota') }} - + @@ -1268,7 +1268,7 @@ width="800px" class="dialog-css" > - + - + @@ -270,7 +270,7 @@ />
- +
@@ -283,10 +283,11 @@ @click="changeRightDrawOpen(false)" /> - {{ $t('panel.position_adjust') }} + {{ $t('panel.position_adjust') }} - +
@@ -445,7 +446,8 @@ /> - {{ $t('panel.panel_cache_use_tips') }} + {{ $t('panel.panel_cache_use_tips') }}
{ - if (this.show) { - this.showIndex === -1 + if (this.show) { + this.showIndex === -1 + } + this.show = !this.show } - this.show = !this.show - } ) } this.showIndex = type From ded70247ea1a05a723f8b319c7de56ee3932a8a0 Mon Sep 17 00:00:00 2001 From: maninhill <41712985+maninhill@users.noreply.github.com> Date: Thu, 24 Nov 2022 14:41:45 +0800 Subject: [PATCH 08/10] =?UTF-8?q?chore=EF=BC=9A=E5=8E=BB=E6=8E=89=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=95=B0=20badge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e01b092a44..8b61b593d3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Codacy Latest release Stars - Downloads +


From 8e44c5f02c672fbd8d7044434e81f776be3eeb36 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 24 Nov 2022 14:44:16 +0800 Subject: [PATCH 09/10] =?UTF-8?q?refactor(=E7=BB=84=E4=BB=B6):=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4=E9=99=90=E5=88=B6?= =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E6=9C=80=E5=A4=A7=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/view/PositionAdjust.vue | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/chart/view/PositionAdjust.vue b/frontend/src/views/chart/view/PositionAdjust.vue index 6452daaabc..e8332c8a9d 100644 --- a/frontend/src/views/chart/view/PositionAdjust.vue +++ b/frontend/src/views/chart/view/PositionAdjust.vue @@ -29,6 +29,8 @@ v-model="styleInfo.left" type="number" :min="0" + :max="maxLeft" + @change="leftOnChange" class="hide-icon-number" > @@ -69,6 +71,8 @@ From de8480098bbd98c6e5025e2236aa6f5a82ffecee Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 24 Nov 2022 14:55:31 +0800 Subject: [PATCH 10/10] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E5=A4=8D=E5=88=B6=E6=96=B0=E7=9A=84=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E6=9D=BF=E5=88=97=E8=A1=A8=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/panel/list/PanelList.vue | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/src/views/panel/list/PanelList.vue b/frontend/src/views/panel/list/PanelList.vue index 4a77719708..3ae5ce2a0d 100644 --- a/frontend/src/views/panel/list/PanelList.vue +++ b/frontend/src/views/panel/list/PanelList.vue @@ -174,7 +174,7 @@ /> - + - + {{ $t('panel.groupAdd') }} - +
{{ - $t('panel.cancel') - }} + $t('panel.cancel') + }} {{ - $t('dataset.cancel') - }} + $t('dataset.cancel') + }} 0) { + if (showFirst && this.defaultData && this.defaultData.length > 0) { this.activeDefaultNodeAndClickOnly(this.defaultData[0].id) } } @@ -935,7 +935,7 @@ export default { localStorage.setItem('panel-default-tree', JSON.stringify(res.data)) if (!userCache) { this.defaultData = res.data - if (showFirst && this.defaultData.length > 0) { + if (showFirst && this.defaultData && this.defaultData.length > 0) { this.activeDefaultNodeAndClickOnly(this.defaultData[0].id) } }