From 3aed65849bc3288c5c98b13b35d4ba951feae885 Mon Sep 17 00:00:00 2001 From: qianming Date: Wed, 24 May 2023 09:36:35 +0800 Subject: [PATCH 01/33] =?UTF-8?q?=E6=96=87=E6=A1=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/docs/guide/chartsLinkage.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/docs/guide/chartsLinkage.md b/doc/docs/guide/chartsLinkage.md index 2ce62d2c..4998fdd6 100644 --- a/doc/docs/guide/chartsLinkage.md +++ b/doc/docs/guide/chartsLinkage.md @@ -4,9 +4,29 @@ - 表单联动
目前支持的有下拉框、时间筛选器。
+ V1.0.0 支持被联动的组件有:
+ - 柱状图(包含全部) + - 折线图(包含全部) + - 柱线图(包含全部) + - 饼图(包含全部) + - 漏斗图(包含全部) + - 百分比 + - 百分比图 + - 中国地图(包含全部) + - 热力图(包含全部) + - 雷达图(包含全部) - 图表联动:
目前联动主要集中在柱状图、折线图、饼图等这种二维图表,二维图表是指图表只支持2个字段的数据集,当然并不是说需要3个字段的堆叠图(柱状/折线)不支持联动,而是这种三维图表去联动二维图表会带来一些问题,反之二维的去联动三维的同样存在问题,因此目前源代码中只添加了部分二维图表的联动。
+ V1.0.0 支持联动的组件有:
+ - 柱状图 + - 柱状图 + - 柱状图-渐变色 + - 折线图 + - 折线图 + - 饼图 + - 饼图 + - 南丁格尔玫瑰图 **注:** 没有多级联动,联动都是一对一的。例如,时间筛选器绑定了A柱图,A柱图绑定了B饼图,当使用时间筛选器更改时间后,只会更新绑定的A柱图,A绑定的B饼图并不会更新数据。
From d39ec9b75a52e409170cfcaff0346c8da3d1ddb0 Mon Sep 17 00:00:00 2001 From: wenqindong Date: Fri, 9 Jun 2023 09:01:07 +0800 Subject: [PATCH 02/33] =?UTF-8?q?feat:=20=E2=9C=A8=20=E5=BC=95=E5=85=A5dat?= =?UTF-8?q?av=E4=BE=9D=E8=B5=96=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E8=BE=B9=E6=A1=86=E3=80=81=E8=A3=85=E9=A5=B0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加了样式组件分组,支持边框组件、装饰组件,可以在组件属性配置里切换不同的样式 --- report-ui/src/main.js | 4 +- .../configure/styleWidget/widget-border.js | 74 +++++++++++++++++++ .../styleWidget/widget-decoration.js | 74 +++++++++++++++++++ .../bigscreenDesigner/designer/tools/main.js | 4 + .../widget/styleWidget/widgetBorder.vue | 46 ++++++++++++ .../widget/styleWidget/widgetDecoration.vue | 45 +++++++++++ .../designer/widget/widget.vue | 4 + 7 files changed, 250 insertions(+), 1 deletion(-) create mode 100644 report-ui/src/views/bigscreenDesigner/designer/tools/configure/styleWidget/widget-border.js create mode 100644 report-ui/src/views/bigscreenDesigner/designer/tools/configure/styleWidget/widget-decoration.js create mode 100644 report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetBorder.vue create mode 100644 report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetDecoration.vue diff --git a/report-ui/src/main.js b/report-ui/src/main.js index abc86422..2fc0e97d 100644 --- a/report-ui/src/main.js +++ b/report-ui/src/main.js @@ -22,7 +22,9 @@ import 'echarts/lib/component/tooltip' //import 'echarts-liquidfill' // import 'echarts-gl' Vue.component('v-chart', ECharts) - +// 全局引入datav +import dataV from '@jiaminghi/data-view' +Vue.use(dataV) // anji component import anjiCrud from '@/components/AnjiPlus/anji-crud/anji-crud' import anjiSelect from '@/components/AnjiPlus/anji-select' diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/styleWidget/widget-border.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/styleWidget/widget-border.js new file mode 100644 index 00000000..ba7b5c32 --- /dev/null +++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/styleWidget/widget-border.js @@ -0,0 +1,74 @@ +/** + * author:wenqindong + * date:2023-05-31 + */ +let selectOptions = [] +for(let i=1;i<14;i++){ + selectOptions.push({code: 'dv-border-Box-'+i, name: '样式'+i}) +} +export const widgetBorder = { + code: 'widget-border', + type: 'border', + tabName: '样式组件', + label: '边框', + icon: 'icontupian1', + options: { + // 配置 + setup: [ + { + type: 'el-input-text', + label: '图层名称', + name: 'layerName', + required: false, + placeholder: '', + value: '边框一', + }, + { + type: 'el-select', + label: '样式', + name: 'showtype', + required: false, + placeholder: '', + selectOptions: selectOptions, + value: 'dv-border-Box-1' + }, + ], + // 数据 + data: [], + // 坐标 + position: [ + { + type: 'el-input-number', + label: '左边距', + name: 'left', + required: false, + placeholder: '', + value: 0, + }, + { + type: 'el-input-number', + label: '上边距', + name: 'top', + required: false, + placeholder: '', + value: 0, + }, + { + type: 'el-input-number', + label: '宽度', + name: 'width', + required: false, + placeholder: '该容器在1920px大屏中的宽度', + value: 400, + }, + { + type: 'el-input-number', + label: '高度', + name: 'height', + required: false, + placeholder: '该容器在1080px大屏中的高度', + value: 300, + }, + ], + } + } diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/styleWidget/widget-decoration.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/styleWidget/widget-decoration.js new file mode 100644 index 00000000..880e4170 --- /dev/null +++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/styleWidget/widget-decoration.js @@ -0,0 +1,74 @@ +/** + * author:wenqindong + * date:2023-05-31 + */ +let selectOptions = [] +for(let i=1;i<13;i++){ + selectOptions.push({code: 'dv-decoration-'+i, name: '装饰'+i}) +} +export const widgetDecoration = { + code: 'widget-decoration', + type: 'border', + tabName: '样式组件', + label: '装饰', + icon: 'icontupian1', + options: { + // 配置 + setup: [ + { + type: 'el-input-text', + label: '图层名称', + name: 'layerName', + required: false, + placeholder: '', + value: '装饰一', + }, + { + type: 'el-select', + label: '样式', + name: 'showtype', + required: false, + placeholder: '', + selectOptions: selectOptions, + value: 'dv-decoration-1' + }, + ], + // 数据 + data: [], + // 坐标 + position: [ + { + type: 'el-input-number', + label: '左边距', + name: 'left', + required: false, + placeholder: '', + value: 0, + }, + { + type: 'el-input-number', + label: '上边距', + name: 'top', + required: false, + placeholder: '', + value: 0, + }, + { + type: 'el-input-number', + label: '宽度', + name: 'width', + required: false, + placeholder: '该容器在1920px大屏中的宽度', + value: 400, + }, + { + type: 'el-input-number', + label: '高度', + name: 'height', + required: false, + placeholder: '该容器在1080px大屏中的高度', + value: 150, + }, + ], + } + } diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/main.js b/report-ui/src/views/bigscreenDesigner/designer/tools/main.js index db8e376b..c307dda2 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/tools/main.js +++ b/report-ui/src/views/bigscreenDesigner/designer/tools/main.js @@ -44,10 +44,14 @@ import { widgetFormTime } from "./configure/form/widget-form-time"; import { widgetScaleVertical } from "./configure/scaleCharts/widget-scale-vertical"; import { widgetScaleHorizontal } from "./configure/scaleCharts/widget-scale-horizontal" import {widgetBarDoubleYaxis} from "./configure/barCharts/widget-bar-double-yaxis-chart"; +import {widgetBorder} from "./configure/styleWidget/widget-border"; +import {widgetDecoration} from "./configure/styleWidget/widget-decoration"; export const widgetTool = [ // type=html类型的组件 widgetText, + widgetBorder, + widgetDecoration, widgetMarquee, widgetHref, widgetTime, diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetBorder.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetBorder.vue new file mode 100644 index 00000000..6491def0 --- /dev/null +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetBorder.vue @@ -0,0 +1,46 @@ + + + \ No newline at end of file diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetDecoration.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetDecoration.vue new file mode 100644 index 00000000..a34a3c55 --- /dev/null +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetDecoration.vue @@ -0,0 +1,45 @@ + + + \ No newline at end of file diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/widget.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/widget.vue index d9ad8dda..f9edce68 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/widget.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/widget.vue @@ -53,12 +53,16 @@ import widgetFormTime from "./form/widgetFormTime.vue"; import widgetScaleVertical from "./scale/widgetScaleVertical.vue"; import widgetScaleHorizontal from "./scale/widgetScaleHorizontal.vue"; import widgetBarDoubleYaxisChart from "./bar/widgetBarDoubleYaxisChart.vue"; +import widgetBorder from "./styleWidget/widgetBorder.vue"; +import widgetDecoration from "./styleWidget/widgetDecoration.vue"; export default { name: "Widget", components: { widgetHref, widgetText, + widgetBorder, + widgetDecoration, WidgetMarquee, widgetTime, widgetImage, From dcd3ed30f17bbc2e55c58ae679cfff1473962f6a Mon Sep 17 00:00:00 2001 From: wenqindong Date: Fri, 9 Jun 2023 09:15:59 +0800 Subject: [PATCH 03/33] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E7=BB=84=E4=BB=B6datav=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report-ui/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/report-ui/package.json b/report-ui/package.json index efd67958..1858c0ad 100644 --- a/report-ui/package.json +++ b/report-ui/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "@ckeditor/ckeditor5-build-decoupled-document": "^23.1.0", + "@jiaminghi/data-view": "^2.10.0", "@smallwei/avue": "^2.8.23", "axios": "0.18.0", "chokidar": "^3.5.2", From 60e562df3a4e916078c01a7bc1e3d15f9147184d Mon Sep 17 00:00:00 2001 From: qianming Date: Mon, 26 Jun 2023 10:27:22 +0800 Subject: [PATCH 04/33] =?UTF-8?q?fix--flagInter=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/widget/bar/widgetBarCompareChart.vue | 1 - .../designer/widget/bar/widgetBarStackChart.vue | 1 - .../bigscreenDesigner/designer/widget/bar/widgetBarchart.vue | 2 +- .../designer/widget/bar/widgetGradientColorBarchart.vue | 2 +- .../designer/widget/barline/widgetBarLineStackChart.vue | 1 - .../designer/widget/line/widgetLineCompareChart.vue | 1 - .../designer/widget/line/widgetLineStackChart.vue | 1 - .../bigscreenDesigner/designer/widget/line/widgetLinechart.vue | 1 + .../designer/widget/percent/widgetPiePercentageChart.vue | 1 + .../bigscreenDesigner/designer/widget/pie/widgetPiechart.vue | 2 +- 10 files changed, 5 insertions(+), 8 deletions(-) diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarCompareChart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarCompareChart.vue index 72170876..eab72a4f 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarCompareChart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarCompareChart.vue @@ -247,7 +247,6 @@ export default { optionsStyle: {}, optionsData: {}, optionsSetup: {}, - flagInter: null, }; }, computed: { diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarStackChart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarStackChart.vue index 9217e588..cdfa67f4 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarStackChart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarStackChart.vue @@ -59,7 +59,6 @@ export default { optionsStyle: {}, // 样式 optionsData: {}, // 数据 optionsSetup: {}, - flagInter: null, }; }, computed: { diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarchart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarchart.vue index e0011f61..ab0ee694 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarchart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarchart.vue @@ -15,6 +15,7 @@ export default { props: { value: Object, ispreview: Boolean, + flagInter: null, widgetIndex: { type: Number, default: 0, @@ -63,7 +64,6 @@ export default { optionsStyle: {}, // 样式 optionsData: {}, // 数据 optionsSetup: {}, - flagInter: null, }; }, computed: { diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetGradientColorBarchart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetGradientColorBarchart.vue index 142b0a61..ef551f26 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetGradientColorBarchart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetGradientColorBarchart.vue @@ -16,6 +16,7 @@ export default { props: { value: Object, ispreview: Boolean, + flagInter: null, widgetIndex: { type: Number, default: 0, @@ -138,7 +139,6 @@ export default { optionsStyle: {}, // 样式 optionsData: {}, // 数据 optionsSetup: {}, - flagInter: null, }; }, computed: { diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/barline/widgetBarLineStackChart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/barline/widgetBarLineStackChart.vue index 5d4387d1..aa1a68f5 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/barline/widgetBarLineStackChart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/barline/widgetBarLineStackChart.vue @@ -94,7 +94,6 @@ export default { optionsStyle: {}, // 样式 optionsData: {}, // 数据 optionsSetup: {}, - flagInter: null, }; }, computed: { diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineCompareChart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineCompareChart.vue index 300ee2de..f3aa19b6 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineCompareChart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineCompareChart.vue @@ -248,7 +248,6 @@ export default { optionsStyle: {}, optionsData: {}, optionsSetup: {}, - flagInter: null, }; }, computed: { diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineStackChart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineStackChart.vue index d979bcb7..595663eb 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineStackChart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLineStackChart.vue @@ -59,7 +59,6 @@ export default { optionsStyle: {}, // 样式 optionsData: {}, // 数据 optionsSetup: {}, - flagInter: null, }; }, computed: { diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLinechart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLinechart.vue index 9ddff668..24b668f8 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLinechart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/line/widgetLinechart.vue @@ -15,6 +15,7 @@ export default { props: { value: Object, ispreview: Boolean, + flagInter: null, widgetIndex: { type: Number, default: 0, diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/percent/widgetPiePercentageChart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/percent/widgetPiePercentageChart.vue index 5ffb89b7..480f1718 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/percent/widgetPiePercentageChart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/percent/widgetPiePercentageChart.vue @@ -13,6 +13,7 @@ export default { props: { value: Object, ispreview: Boolean, + flagInter: null, widgetIndex: { type: Number, default: 0, diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/pie/widgetPiechart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/pie/widgetPiechart.vue index 2b50b3f7..8641eb7a 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/pie/widgetPiechart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/pie/widgetPiechart.vue @@ -15,6 +15,7 @@ export default { props: { value: Object, ispreview: Boolean, + flagInter: null, }, data() { return { @@ -52,7 +53,6 @@ export default { optionsData: {}, // 数据 optionsCollapse: {}, // 图标属性 optionsSetup: {}, - flagInter: null, }; }, computed: { From bd3754c73c9fb19c7fd7b782e62efb8964a01a28 Mon Sep 17 00:00:00 2001 From: Stefan Zhu Date: Wed, 28 Jun 2023 15:47:35 +0800 Subject: [PATCH 05/33] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Text=E7=9A=84=E6=8D=A2?= =?UTF-8?q?=E8=A1=8C=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/tools/configure/texts/widget-text.js | 8 ++++++++ .../designer/widget/texts/widgetText.vue | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/texts/widget-text.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/texts/widget-text.js index 51009820..3541314f 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/texts/widget-text.js +++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/texts/widget-text.js @@ -90,6 +90,14 @@ export const widgetText = { ], value: 'center' }, + { + type: 'el-switch', + label: '识别换行符', + name: 'whiteSpace', + required: false, + placeholder: '', + value: true, + } ], // 数据 data: [ diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/texts/widgetText.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/texts/widgetText.vue index 95b59718..6575872c 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/texts/widgetText.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/texts/widgetText.vue @@ -40,7 +40,8 @@ export default { height: this.transStyle.height + "px", left: this.transStyle.left + "px", top: this.transStyle.top + "px", - right: this.transStyle.right + "px" + right: this.transStyle.right + "px", + whiteSpace: this.transStyle.whiteSpace ? "pre-line": null }; } }, From 261f94cb0aefeeac1ebcc87a8b11e76de6b0e8a3 Mon Sep 17 00:00:00 2001 From: Stefan Zhu Date: Wed, 28 Jun 2023 16:13:45 +0800 Subject: [PATCH 06/33] =?UTF-8?q?=E6=96=87=E6=9C=AC=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E6=94=B9=E4=B8=BAtextArea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/tools/configure/texts/widget-text.js | 2 +- .../bigscreenDesigner/designer/widget/texts/widgetText.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/texts/widget-text.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/texts/widget-text.js index 3541314f..505dcc4f 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/texts/widget-text.js +++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/texts/widget-text.js @@ -24,7 +24,7 @@ export const widgetText = { value: '文本框', }, { - type: 'el-input-text', + type: 'el-input-textarea', label: '文本内容', name: 'text', required: false, diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/texts/widgetText.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/texts/widgetText.vue index 6575872c..fa60696f 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/texts/widgetText.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/texts/widgetText.vue @@ -41,7 +41,7 @@ export default { left: this.transStyle.left + "px", top: this.transStyle.top + "px", right: this.transStyle.right + "px", - whiteSpace: this.transStyle.whiteSpace ? "pre-line": null + whiteSpace: this.transStyle.whiteSpace ? "pre-line": "normal" }; } }, From d2d050fc57802d22e8ccc2f41b98dc0d6989d7f5 Mon Sep 17 00:00:00 2001 From: qianming Date: Thu, 6 Jul 2023 13:18:58 +0800 Subject: [PATCH 07/33] fix--JSON null --- .../service/impl/DataSetServiceImpl.java | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java index a39faf70..5e35c877 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java @@ -1,8 +1,11 @@ package com.anjiplus.template.gaea.business.modules.dataset.service.impl; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; +import com.alibaba.fastjson.serializer.SerializerFeature; import com.anji.plus.gaea.constant.Enabled; import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper; import com.anji.plus.gaea.exception.BusinessExceptionBuilder; @@ -27,6 +30,7 @@ import com.anjiplus.template.gaea.business.util.JdbcConstants; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; @@ -39,10 +43,10 @@ import java.util.*; import java.util.stream.Collectors; /** -* @desc DataSet 数据集服务实现 -* @author Raod -* @date 2021-03-18 12:11:31.150755900 -**/ + * @author Raod + * @desc DataSet 数据集服务实现 + * @date 2021-03-18 12:11:31.150755900 + **/ @Service //@RequiredArgsConstructor @Slf4j @@ -62,7 +66,7 @@ public class DataSetServiceImpl implements DataSetService { @Override public GaeaBaseMapper getMapper() { - return dataSetMapper; + return dataSetMapper; } /** @@ -113,9 +117,9 @@ public class DataSetServiceImpl implements DataSetService { List dataSetTransformList = dataSetTransformService.list( new QueryWrapper() - .lambda() - .eq(DataSetTransform::getSetCode, setCode) - .orderByAsc(DataSetTransform::getOrderNum) + .lambda() + .eq(DataSetTransform::getSetCode, setCode) + .orderByAsc(DataSetTransform::getOrderNum) ); List dataSetTransformDtoList = new ArrayList<>(); dataSetTransformList.forEach(dataSetTransform -> { @@ -127,11 +131,11 @@ public class DataSetServiceImpl implements DataSetService { if (StringUtils.isNotBlank(dto.getCaseResult())) { try { - JSONArray jsonArray = JSONArray.parseArray(dto.getCaseResult()); + JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(dto.getCaseResult(), SerializerFeature.WriteMapNullValue)); JSONObject jsonObject = jsonArray.getJSONObject(0); dto.setSetParamList(jsonObject.keySet()); } catch (Exception e) { - log.error("error",e); + log.error("error", e); } } return dto; @@ -266,12 +270,12 @@ public class DataSetServiceImpl implements DataSetService { String body = JSONObject.parseObject(dynSentence).getString("body"); if (StringUtils.isNotBlank(body)) { dynSentence = body; - }else { + } else { dynSentence = "{}"; } - }else { - dataSource = dataSourceService.selectOne("source_code", dataSetDto.getSourceCode()); + } else { + dataSource = dataSourceService.selectOne("source_code", dataSetDto.getSourceCode()); } //3.参数替换 @@ -322,12 +326,12 @@ public class DataSetServiceImpl implements DataSetService { String body = JSONObject.parseObject(dynSentence).getString("body"); if (StringUtils.isNotBlank(body)) { dynSentence = body; - }else { + } else { dynSentence = "{}"; } - }else { - dataSource = dataSourceService.selectOne("source_code", sourceCode); + } else { + dataSource = dataSourceService.selectOne("source_code", sourceCode); } //3.参数替换 @@ -374,7 +378,7 @@ public class DataSetServiceImpl implements DataSetService { return dataSetMapper.selectList(wrapper); } - public void dataSetParamBatch(List dataSetParamDtoList,String setCode){ + public void dataSetParamBatch(List dataSetParamDtoList, String setCode) { dataSetParamService.delete( new QueryWrapper() .lambda() @@ -396,7 +400,7 @@ public class DataSetServiceImpl implements DataSetService { } - public void dataSetTransformBatch(List dataSetTransformDtoList,String setCode){ + public void dataSetTransformBatch(List dataSetTransformDtoList, String setCode) { dataSetTransformService.delete( new QueryWrapper() .lambda() @@ -420,10 +424,11 @@ public class DataSetServiceImpl implements DataSetService { /** * dataSetParamDtoList转map + * * @param dataSetParamDtoList * @return */ - public Map setContextData(List dataSetParamDtoList){ + public Map setContextData(List dataSetParamDtoList) { Map map = new HashMap<>(); if (null != dataSetParamDtoList && dataSetParamDtoList.size() > 0) { dataSetParamDtoList.forEach(dataSetParamDto -> map.put(dataSetParamDto.getParamName(), dataSetParamDto.getSampleItem())); From 1ebed96cc8564870ce027e23ac2936cc923d7571 Mon Sep 17 00:00:00 2001 From: qianming Date: Fri, 7 Jul 2023 09:38:34 +0800 Subject: [PATCH 08/33] fix--JSON null --- .../modules/dataset/service/impl/DataSetServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java index 5e35c877..d9c30c7a 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java @@ -131,7 +131,7 @@ public class DataSetServiceImpl implements DataSetService { if (StringUtils.isNotBlank(dto.getCaseResult())) { try { - JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(dto.getCaseResult(), SerializerFeature.WriteMapNullValue)); + JSONArray jsonArray = JSONArray.parseArray(dto.getCaseResult()); JSONObject jsonObject = jsonArray.getJSONObject(0); dto.setSetParamList(jsonObject.keySet()); } catch (Exception e) { @@ -163,7 +163,7 @@ public class DataSetServiceImpl implements DataSetService { Object o = objects.get(0); objects = new JSONArray(); objects.add(o); - dataSet.setCaseResult(objects.toJSONString()); + dataSet.setCaseResult(JSON.toJSONString(objects, SerializerFeature.WriteMapNullValue)); } } catch (Exception e) { log.info("结果集只保留一行数据失败...{}", e.getMessage()); @@ -184,7 +184,7 @@ public class DataSetServiceImpl implements DataSetService { * @param dto */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void updateSet(DataSetDto dto) { List dataSetParamDtoList = dto.getDataSetParamDtoList(); List dataSetTransformDtoList = dto.getDataSetTransformDtoList(); From 3a90ebab2d8e8473e2595b9bbb0b5db55e7be6ba Mon Sep 17 00:00:00 2001 From: qianming Date: Fri, 7 Jul 2023 09:50:14 +0800 Subject: [PATCH 09/33] fix--JSON null --- .../modules/dataset/service/impl/DataSetServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java index d9c30c7a..d669254b 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/dataset/service/impl/DataSetServiceImpl.java @@ -198,7 +198,7 @@ public class DataSetServiceImpl implements DataSetService { Object o = objects.get(0); objects = new JSONArray(); objects.add(o); - dataSet.setCaseResult(objects.toJSONString()); + dataSet.setCaseResult(JSON.toJSONString(objects, SerializerFeature.WriteMapNullValue)); } } catch (Exception e) { log.info("结果集只保留一行数据失败...{}", e.getMessage()); From 8ed0802e1738a25ecde9fc231f1ac33dcbf3fe5e Mon Sep 17 00:00:00 2001 From: qianming Date: Tue, 11 Jul 2023 09:27:25 +0800 Subject: [PATCH 10/33] =?UTF-8?q?bugfix--#I7K1RB=20=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configure/percentCharts/widget-gauge.js | 54 ++++++++++++++++--- .../designer/widget/percent/widgetGauge.vue | 39 +++++++------- 2 files changed, 67 insertions(+), 26 deletions(-) diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/percentCharts/widget-gauge.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/percentCharts/widget-gauge.js index 69f00877..83c24aa9 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/percentCharts/widget-gauge.js +++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/percentCharts/widget-gauge.js @@ -233,6 +233,14 @@ export const widgetGauge = { placeholder: '', value: 0, }, + { + type: 'vue-color', + label: '颜色', + name: 'labelColor', + required: false, + placeholder: '', + value: '#fff', + }, { type: 'el-input-number', label: '字号', @@ -242,12 +250,31 @@ export const widgetGauge = { value: 10, }, { - type: 'vue-color', - label: '颜色', - name: 'labelColor', + type: 'el-select', + label: '字体粗细', + name: 'labelFontWeight', required: false, placeholder: '', - value: '#fff', + selectOptions: [ + { code: 'normal', name: '正常' }, + { code: 'bold', name: '粗体' }, + { code: 'bolder', name: '特粗体' }, + { code: 'lighter', name: '细体' } + ], + value: 'normal' + }, + { + type: 'el-select', + label: '字体风格', + name: 'labelFontStyle', + required: false, + placeholder: '', + selectOptions: [ + { code: 'normal', name: '正常' }, + { code: 'italic', name: 'italic斜体' }, + { code: 'oblique', name: 'oblique斜体' }, + ], + value: 'normal' }, ] }, @@ -257,7 +284,7 @@ export const widgetGauge = { { type: 'vue-color', label: '颜色', - name: 'labelColor', + name: 'detailColor', required: false, placeholder: '', value: '#fff', @@ -265,7 +292,7 @@ export const widgetGauge = { { type: 'el-input-number', label: '字号', - name: 'labelFontSize', + name: 'detailFontSize', require: false, placeholder: '', value: 14, @@ -273,7 +300,7 @@ export const widgetGauge = { { type: 'el-select', label: '字体粗细', - name: 'labelFontWeight', + name: 'detailFontWeight', required: false, placeholder: '', selectOptions: [ @@ -284,6 +311,19 @@ export const widgetGauge = { ], value: 'normal' }, + { + type: 'el-select', + label: '字体风格', + name: 'detailFontStyle', + required: false, + placeholder: '', + selectOptions: [ + { code: 'normal', name: '正常' }, + { code: 'italic', name: 'italic斜体' }, + { code: 'oblique', name: 'oblique斜体' }, + ], + value: 'normal' + }, ] }, ], diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/percent/widgetGauge.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/percent/widgetGauge.vue index bd87eda0..977051fe 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/percent/widgetGauge.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/percent/widgetGauge.vue @@ -1,11 +1,12 @@ \ No newline at end of file + diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/decorate/widgetDecoratePieChart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetDecoratePieChart.vue similarity index 99% rename from report-ui/src/views/bigscreenDesigner/designer/widget/decorate/widgetDecoratePieChart.vue rename to report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetDecoratePieChart.vue index e25b5654..cea85ba4 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/decorate/widgetDecoratePieChart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetDecoratePieChart.vue @@ -1,6 +1,6 @@ diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetDecoration.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetDecoration.vue index a34a3c55..680877eb 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetDecoration.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/styleWidget/widgetDecoration.vue @@ -1,45 +1,47 @@ - \ No newline at end of file + diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/temp.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/temp.vue index 5c2037ad..df892766 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/temp.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/temp.vue @@ -34,7 +34,7 @@ import widgetBarStackChart from "./bar/widgetBarStackChart"; import widgetLineStackChart from "./line/widgetLineStackChart"; import widgetBarCompareChart from "./bar/widgetBarCompareChart"; import widgetLineCompareChart from "./line/widgetLineCompareChart"; -import widgetDecoratePieChart from "./decorate/widgetDecoratePieChart"; +import widgetDecoratePieChart from "./styleWidget/widgetDecoratePieChart.vue"; import widgetMoreBarLineChart from "./barline/widgetMoreBarLineChart"; import widgetWordCloud from "./wordcloud/widgetWordCloud"; import widgetHeatmap from "./heatmap/widgetHeatmap"; @@ -46,12 +46,16 @@ import widgetFormTime from "./form/widgetFormTime.vue"; import widgetScaleVertical from "./scale/widgetScaleVertical.vue"; import widgetScaleHorizontal from "./scale/widgetScaleHorizontal.vue"; import widgetBarDoubleYaxisChart from "./bar/widgetBarDoubleYaxisChart.vue"; +import widgetBorder from "./styleWidget/widgetBorder.vue"; +import widgetDecoration from "./styleWidget/widgetDecoration.vue"; export default { name: "WidgetTemp", components: { widgetHref, widgetText, + widgetBorder, + widgetDecoration, WidgetMarquee, widgetTime, widgetImage, diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/widget.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/widget.vue index f9edce68..dd2bf6d9 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/widget.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/widget.vue @@ -41,7 +41,7 @@ import widgetBarStackChart from "./bar/widgetBarStackChart"; import widgetLineStackChart from "./line/widgetLineStackChart"; import widgetBarCompareChart from "./bar/widgetBarCompareChart"; import widgetLineCompareChart from "./line/widgetLineCompareChart"; -import widgetDecoratePieChart from "./decorate/widgetDecoratePieChart"; +import widgetDecoratePieChart from "./styleWidget/widgetDecoratePieChart.vue"; import widgetMoreBarLineChart from "./barline/widgetMoreBarLineChart"; import widgetWordCloud from "./wordcloud/widgetWordCloud"; import widgetHeatmap from "./heatmap/widgetHeatmap"; From fb7341e0d88546789170998c7cdd5ca0ebe95001 Mon Sep 17 00:00:00 2001 From: chenxg Date: Wed, 19 Jul 2023 15:40:46 +0800 Subject: [PATCH 18/33] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E8=BF=AD=E4=BB=A3-Exce?= =?UTF-8?q?l=E6=8A=A5=E8=A1=A8=E5=AF=BC=E5=87=BAPDF-=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F-1(=E9=99=84=E5=B8=A6=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=EF=BC=8C=E5=AD=97=E4=BD=93=E5=8A=A0=E7=B2=97?= =?UTF-8?q?=EF=BC=8C=E5=AD=97=E4=BD=93=E6=96=9C=E4=BD=93=EF=BC=8C=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E9=A2=9C=E8=89=B2=EF=BC=8C=E5=AD=97=E4=BD=93=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report-core/pom.xml | 12 + .../controller/dto/CellStyleDto.java | 16 ++ .../controller/dto/CommentDto.java | 38 +++ .../controller/dto/ReportExcelDto.java | 6 + .../controller/dto/ReportExcelStyleDto.java | 97 +++++++ .../service/impl/ReportExcelServiceImpl.java | 242 +++++++++++++++--- .../src/views/excelreport/viewer/index.vue | 26 +- 7 files changed, 401 insertions(+), 36 deletions(-) create mode 100644 report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CellStyleDto.java create mode 100644 report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CommentDto.java create mode 100644 report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/ReportExcelStyleDto.java diff --git a/report-core/pom.xml b/report-core/pom.xml index 4fc498d3..ad74fd59 100644 --- a/report-core/pom.xml +++ b/report-core/pom.xml @@ -166,6 +166,18 @@ 3.0.9 + + org.xhtmlrenderer + core-renderer + R8 + + + + com.itextpdf.tool + xmlworker + 5.5.13 + + diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CellStyleDto.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CellStyleDto.java new file mode 100644 index 00000000..364a839d --- /dev/null +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CellStyleDto.java @@ -0,0 +1,16 @@ +package com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto; + +import lombok.Data; + +@Data +public class CellStyleDto { + /** + * 格式名称 + */ + private String fa; + + /** + * 格式类型 + */ + private String t; +} \ No newline at end of file diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CommentDto.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CommentDto.java new file mode 100644 index 00000000..95d45e5e --- /dev/null +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CommentDto.java @@ -0,0 +1,38 @@ +package com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto; + + +import lombok.Data; + +@Data +public class CommentDto { + /** + * 批注框左边距 + */ + private int left; + + /** + * 批注框上边距 + */ + private int top; + + /** + * 批注框宽度 + */ + private int width; + + /** + * 批注框高度 + */ + private int height; + + /** + * 批注内容 + */ + private String value; + + /** + * 批注框是否显示 + */ + private boolean isshow; +} + diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/ReportExcelDto.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/ReportExcelDto.java index df92b09f..739563f0 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/ReportExcelDto.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/ReportExcelDto.java @@ -5,6 +5,7 @@ import com.anji.plus.gaea.curd.dto.GaeaBaseDTO; import lombok.Data; import java.io.Serializable; +import java.util.List; /** @@ -58,4 +59,9 @@ public class ReportExcelDto extends GaeaBaseDTO implements Serializable { */ private String exportType; + /** + * 报表总体数据 + */ + private String rowDatas; + } diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/ReportExcelStyleDto.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/ReportExcelStyleDto.java new file mode 100644 index 00000000..dc8d41f9 --- /dev/null +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/ReportExcelStyleDto.java @@ -0,0 +1,97 @@ + +package com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto; + +import com.anji.plus.gaea.curd.dto.GaeaBaseDTO; +import lombok.Data; + +import java.io.Serializable; + + +/** + * @author chenxg + * @date 2023/8/1 10:37 + */ +@Data +public class ReportExcelStyleDto extends GaeaBaseDTO implements Serializable { + /** + * 单元格值格式 + */ + private CellStyleDto ct; + + /** + * 内容的原始值 + */ + private String v; + + /** + * 内容的显示值 + */ + private String m; + + /** + * 背景颜色 + */ + private String bg; + + /** + * 字体编号 + */ + private String ff; + + /** + * 字体颜色 + */ + private String fc; + + /** + * 是否加粗 + */ + private boolean bl; + + /** + * 是否斜体 + */ + private boolean it; + + /** + * 字体大小 + */ + private int fs; + + /** + * 是否删除线 + */ + private boolean cl; + + /** + * 水平对齐方式 + */ + private int ht; + + /** + * 垂直对齐方式 + */ + private int vt; + + /** + * 文字旋转角度 + */ + private int tr; + + /** + * 是否自动换行 + */ + private int tb; + + /** + * 批注信息 + */ + private CommentDto ps; + + /** + * 单元格公式 + */ + private String f; + + +} \ No newline at end of file diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java index fd17950a..60a37fa9 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java @@ -19,29 +19,40 @@ import com.anjiplus.template.gaea.business.modules.file.service.GaeaFileService; import com.anjiplus.template.gaea.business.modules.report.dao.ReportMapper; import com.anjiplus.template.gaea.business.modules.report.dao.entity.Report; import com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto.ReportExcelDto; +import com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto.ReportExcelStyleDto; import com.anjiplus.template.gaea.business.modules.reportexcel.dao.ReportExcelMapper; import com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel; import com.anjiplus.template.gaea.business.modules.reportexcel.service.ReportExcelService; import com.anjiplus.template.gaea.business.modules.reportexcel.util.CellType; import com.anjiplus.template.gaea.business.modules.reportexcel.util.XlsUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.itextpdf.text.*; +import com.itextpdf.text.Font; +import com.itextpdf.text.pdf.BaseFont; +import com.itextpdf.text.pdf.PdfPCell; +import com.itextpdf.text.pdf.PdfPTable; +import com.itextpdf.text.pdf.PdfWriter; +import com.itextpdf.tool.xml.XMLWorkerHelper; +import com.lowagie.text.DocumentException; +import io.swagger.models.auth.In; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.xhtmlrenderer.pdf.ITextRenderer; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; +import java.io.*; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.HashMap; +import java.util.*; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * TODO @@ -136,43 +147,212 @@ public class ReportExcelServiceImpl implements ReportExcelService { @Override public Boolean exportExcel(ReportExcelDto reportExcelDto) { + logger.error("导出..."); + exportExcelCore(reportExcelDto); + return true; + } + /** + * 抽取导出Excel核心逻辑 + */ + public void exportExcelCore(ReportExcelDto reportExcelDto) + { String reportCode = reportExcelDto.getReportCode(); String exportType = reportExcelDto.getExportType(); - logger.error("导出..."); - if (exportType.equals(ExportTypeEnum.GAEA_TEMPLATE_EXCEL.getCodeValue())) { - ReportExcelDto report = detailByReportCode(reportCode); - reportExcelDto.setJsonStr(report.getJsonStr()); - String jsonStr = analysisReportData(reportExcelDto); - List lists=(List ) JSON.parse(jsonStr); - OutputStream out = null; - File file = null; - try { - String fileName = report.getReportCode(); - File dir = new File(dictPath + ZIP_PATH); - if (!dir.exists()){ - dir.mkdirs(); - } - String filePath = dir.getAbsolutePath() + File.separator + fileName + ".xlsx"; - file = new File(filePath); - out = Files.newOutputStream(Paths.get(filePath)); - XlsUtil.exportXlsFile(out, true, lists); + List> reportExcelStyleList = new ArrayList<>(); + JSONObject rowData= JSON.parseObject(reportExcelDto.getRowDatas()); + // 将JSONObject对象转换为列表 + List dataNumList = rowData.keySet().stream().map(Integer::parseInt).sorted().collect(Collectors.toList()); + for (Integer i : dataNumList) { + JSONArray jsonArray = rowData.getJSONArray(i.toString()); + List reportExcelStyleDtos = jsonArray.toJavaList(ReportExcelStyleDto.class); + reportExcelStyleList.add(reportExcelStyleDtos); + } + ReportExcelDto report = detailByReportCode(reportCode); + reportExcelDto.setJsonStr(report.getJsonStr()); + String jsonStr = analysisReportData(reportExcelDto); + List lists=(List ) JSON.parse(jsonStr); + OutputStream out = null; + File file = null; + File pdfFile = null; + try { + String fileName = report.getReportCode(); + File dir = new File(dictPath + ZIP_PATH); + if (!dir.exists()){ + dir.mkdirs(); + } + String filePath = dir.getAbsolutePath() + File.separator + fileName + ".xlsx"; + file = new File(filePath); + out = Files.newOutputStream(Paths.get(filePath)); + XlsUtil.exportXlsFile(out, true, lists); + if (exportType.equals(ExportTypeEnum.GAEA_TEMPLATE_EXCEL.getCodeValue())) { gaeaFileService.upload(file); + } + else if(exportType.equals(ExportTypeEnum.GAEA_TEMPLATE_PDF.getCodeValue())) + { + // 将Excel文件转换为PDF + String pdfFileName = fileName + ".pdf"; + String pdfFilePath = dir.getAbsolutePath() + File.separator + pdfFileName; + pdfFile = convertExcelToPdf(filePath, pdfFilePath,reportExcelStyleList); + gaeaFileService.upload(pdfFile); + } + } catch (IOException e) { + logger.error("导出失败", e); + }finally { + try { + out.close(); + file.delete(); + if(!Objects.isNull(pdfFile)) + { + pdfFile.delete(); + } } catch (IOException e) { - logger.error("导出失败", e); - }finally { - try { - out.close(); - file.delete(); - } catch (IOException e) { - throw BusinessExceptionBuilder.build(ResponseCode.FILE_OPERATION_FAILED, e.getMessage()); + throw BusinessExceptionBuilder.build(ResponseCode.FILE_OPERATION_FAILED, e.getMessage()); + } + + } + } + // 将Excel文件转换为PDF + public File convertExcelToPdf(String excelFilePath, String pdfFilePath, List> reportExcelStyleList) { + try { + // 读取Excel文件 + Workbook workbook = new XSSFWorkbook(excelFilePath); + Sheet sheet = workbook.getSheetAt(0); + + // 创建PDF文档 + Document document = new Document(PageSize.A4); + PdfWriter pdfWriter = PdfWriter.getInstance(document, new FileOutputStream(pdfFilePath)); + document.open(); + + // 创建PDF表格 + PdfPTable table = new PdfPTable(sheet.getRow(0).getLastCellNum()); + table.setWidthPercentage(100); + + // 设置中文字体 + BaseFont baseFont = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); + Font font = new Font(baseFont, 10, Font.NORMAL); + + // 设置表头 + Row headerRow = sheet.getRow(0); + for (int i = 0; i < headerRow.getLastCellNum(); i++) { + Cell headerCell = headerRow.getCell(i); + + // 获取单元格样式 + PdfPCell tableCell = new PdfPCell(); + tableCell.setPhrase(new Phrase(getStringValue(headerCell), font)); + ReportExcelStyleDto reportExcelStyleDto = reportExcelStyleList.get(0).get(i); + if(!Objects.isNull(reportExcelStyleDto)) + { + processCellStyle(reportExcelStyleDto,tableCell); } + table.addCell(tableCell); + } + // 遍历Excel表格的行和列 + for (int i = 1; i <= sheet.getLastRowNum(); i++) { + Row row = sheet.getRow(i); + if (row == null) { + // 如果行为空,创建一个空的行并添加到PDF表格中 + row = sheet.createRow(i); + } + for (int j = 0; j < headerRow.getLastCellNum(); j++) { + Cell cell = row.getCell(j, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK); + if (cell.getCellType() == org.apache.poi.ss.usermodel.CellType.BLANK) { + cell.setCellValue(" "); + } + PdfPCell tableCell = new PdfPCell(); + tableCell.setPhrase(new Phrase(getStringValue(cell), font)); + ReportExcelStyleDto reportExcelStyleDto = reportExcelStyleList.get(i).get(j); + if(!Objects.isNull(reportExcelStyleDto)) + { + processCellStyle(reportExcelStyleDto,tableCell); + } + table.addCell(tableCell); + } } + + // 将表格添加到PDF文档中 + document.add(table); + + document.close(); + workbook.close(); + + System.out.println("Excel转换为PDF成功!"); + + return new File(pdfFilePath); + } catch (IOException e) { + e.printStackTrace(); + } catch (com.itextpdf.text.DocumentException e) { + e.printStackTrace(); } - return true; + + return null; } + /** + * 处理导出pdf文件样式 + * @param tableCell + */ + public void processCellStyle(ReportExcelStyleDto reportExcelStyleDto,PdfPCell tableCell) + { + //处理单元格背景颜色 + String bg = reportExcelStyleDto.getBg(); + java.awt.Color color = null; + if(!Objects.isNull(bg)) + { + color = java.awt.Color.decode(bg); + tableCell.setBackgroundColor(new BaseColor(color.getRed(), color.getGreen(), color.getBlue())); + } + //处理字体 + String fc = reportExcelStyleDto.getFc(); + Integer fs = reportExcelStyleDto.getFs(); + String ff = reportExcelStyleDto.getFf(); + Boolean bl = reportExcelStyleDto.isBl(); + Boolean it = reportExcelStyleDto.isIt(); + Font font = new Font(); + // 设置字体颜色 + if(!Objects.isNull(fc)) + { + color = java.awt.Color.decode(fc); + font.setColor(new BaseColor(color.getRed(), color.getGreen(), color.getBlue())); + } + // 设置字体 + if(!Objects.isNull(ff) && !Objects.equals("0",ff)) + { + font.setFamily(ff.toString()); + } + // 设置字体大小 + if(!Objects.isNull(fs) && !Objects.equals(0,fs)) + { + font.setSize(fs); + } + // 设置字体加粗 + if(Objects.equals(Boolean.TRUE,bl)) + { + font.setStyle(Font.BOLD); + } + // 设置字体斜体 + if(Objects.equals(Boolean.TRUE,it)) + { + font.setStyle(Font.ITALIC); + } + // 设置字体加粗且斜体 + if(Objects.equals(Boolean.TRUE,bl) && Objects.equals(Boolean.TRUE,it)) + { + font.setStyle(Font.BOLDITALIC); + } + Phrase phrase = tableCell.getPhrase(); + tableCell.setPhrase(new Paragraph(phrase.getContent(), font)); + //处理字体 + tableCell.setBorderColor(BaseColor.BLACK); + } + + private String getStringValue(Cell cell) { + if (cell == null) + return ""; + else + return cell.toString(); + } /** * 解析报表数据,动态插入列表数据和对象数据 */ diff --git a/report-ui/src/views/excelreport/viewer/index.vue b/report-ui/src/views/excelreport/viewer/index.vue index b94dd9a9..ac5fa404 100644 --- a/report-ui/src/views/excelreport/viewer/index.vue +++ b/report-ui/src/views/excelreport/viewer/index.vue @@ -108,16 +108,17 @@ export default { this.createSheet(); }, async download(val) { - if (val == "gaea_template_pdf") { - this.$message("暂不支持pdf"); - return; - } + // if (val == "gaea_template_pdf") { + // this.$message("暂不支持pdf"); + // return; + // } const result = {}; result["reportCode"] = this.reportCode; result["setParam"] = JSON.stringify(this.params.setParam); if (val != "") { result["exportType"] = val; } + this.getCellStyleData(result); const { code, message } = await exportExcel(result); if (code != 200) return; this.$message.success(message); @@ -192,7 +193,22 @@ export default { $(function() { luckysheet.create(options); }); - } + }, + getCellStyleData(result) { + const sheetData = luckysheet.getluckysheetfile(); // 获取整个表格的数据 + const rowDatas = {}; + + for (let sheetIndex in sheetData) { + const sheet = sheetData[sheetIndex]; + if (sheet && sheet.data) { + for (let rowIndex in sheet.data) { + const row = sheet.data[rowIndex]; + rowDatas[rowIndex]=row; + } + } + } + result["rowDatas"] = JSON.stringify(rowDatas);; + }, } }; From b7a253c5fe03e3e4dd432677d621ffd213151037 Mon Sep 17 00:00:00 2001 From: chenxg Date: Tue, 1 Aug 2023 15:12:22 +0800 Subject: [PATCH 19/33] =?UTF-8?q?=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/reportexcel/controller/dto/CellStyleDto.java | 4 ++++ .../modules/reportexcel/controller/dto/CommentDto.java | 4 ++++ .../reportexcel/service/impl/ReportExcelServiceImpl.java | 1 + 3 files changed, 9 insertions(+) diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CellStyleDto.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CellStyleDto.java index 364a839d..07cf70b2 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CellStyleDto.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CellStyleDto.java @@ -2,6 +2,10 @@ package com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto; import lombok.Data; +/** + * @author chenxg + * @date 2023/8/1 10:37 + */ @Data public class CellStyleDto { /** diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CommentDto.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CommentDto.java index 95d45e5e..acc26525 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CommentDto.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/controller/dto/CommentDto.java @@ -3,6 +3,10 @@ package com.anjiplus.template.gaea.business.modules.reportexcel.controller.dto; import lombok.Data; +/** + * @author chenxg + * @date 2023/8/1 10:37 + */ @Data public class CommentDto { /** diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java index 60a37fa9..4069daf2 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportexcel/service/impl/ReportExcelServiceImpl.java @@ -345,6 +345,7 @@ public class ReportExcelServiceImpl implements ReportExcelService { tableCell.setPhrase(new Paragraph(phrase.getContent(), font)); //处理字体 tableCell.setBorderColor(BaseColor.BLACK); + } private String getStringValue(Cell cell) { From 349e3f3a661351c53dee75bfe8a2d42ffd38498f Mon Sep 17 00:00:00 2001 From: qianming Date: Fri, 4 Aug 2023 14:19:08 +0800 Subject: [PATCH 20/33] =?UTF-8?q?feat--=E4=BB=AA=E8=A1=A8=E7=9B=98?= =?UTF-8?q?=E8=A2=AB=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../percentCharts/widget-pie-percentage.js | 12 -------- .../designer/widget/percent/widgetGauge.vue | 29 +++++++++++++++++-- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/percentCharts/widget-pie-percentage.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/percentCharts/widget-pie-percentage.js index 13ed55f5..0b1645c2 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/percentCharts/widget-pie-percentage.js +++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/percentCharts/widget-pie-percentage.js @@ -162,18 +162,6 @@ export const widgetPiePercentage = { value: '#173164' }, ] - }, - { - name: '组件联动', - list: [ - { - type: 'componentLinkage', - label: '', - name: 'componentLinkage', - required: false, - value: [] - } - ] } ], ], diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/percent/widgetGauge.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/percent/widgetGauge.vue index 977051fe..f25819e6 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/percent/widgetGauge.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/percent/widgetGauge.vue @@ -1,11 +1,12 @@