From aa8fba3c332b2af96c1fde03297ffeae76c76005 Mon Sep 17 00:00:00 2001 From: qianming Date: Thu, 21 Apr 2022 09:30:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9D=90=E6=A0=87=E8=BD=B4=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V1.0.17__add_dict_coord.sql | 9 +++++---- report-ui/src/mixins/queryform.js | 19 ++++++++++++++++++- .../tools/configure/widget-heatmap.js | 4 ++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/report-core/src/main/resources/db/migration/V1.0.17__add_dict_coord.sql b/report-core/src/main/resources/db/migration/V1.0.17__add_dict_coord.sql index 67401f4d..7410e4f8 100644 --- a/report-core/src/main/resources/db/migration/V1.0.17__add_dict_coord.sql +++ b/report-core/src/main/resources/db/migration/V1.0.17__add_dict_coord.sql @@ -1,6 +1,7 @@ -- 新增坐标轴字典 -INSERT INTO `aj_report`.`gaea_dict`(`dict_name`,`dict_code`,`remark`) SELECT "XY坐标属性","COORD_PROPERTIES","XY坐标属性" FROM DUAL WHERE NOT EXISTS(SELECT `dict_name`,`dict_code`,`remark` FROM `aj_report`.`gaea_dict` WHERE `dict_name`="XY坐标属性" AND `dict_code`="COORD_PROPERTIES" AND `remark`="XY坐标属性"); -INSERT INTO `aj_report`.`gaea_dict_item`(`dict_code`,`item_name`,`item_value`,`locale`) SELECT "COORD_PROPERTIES","数据","series","zh" FROM DUAL WHERE NOT EXISTS(SELECT `dict_code`,`item_name`,`item_value`,`locale` FROM `aj_report`.`gaea_dict_item` WHERE `dict_code`="COORD_PROPERTIES" AND `item_name`="数据" AND `item_value`="series" AND `locale`="zh"); -INSERT INTO `aj_report`.`gaea_dict_item`(`dict_code`,`item_name`,`item_value`,`locale`) SELECT "COORD_PROPERTIES","X轴","xAxis","zh" FROM DUAL WHERE NOT EXISTS(SELECT `dict_code`,`item_name`,`item_value`,`locale` FROM `aj_report`.`gaea_dict_item` WHERE `dict_code`="COORD_PROPERTIES" AND `item_name`="X轴" AND `item_value`="xAxis" AND `locale`="zh"); -INSERT INTO `aj_report`.`gaea_dict_item`(`dict_code`,`item_name`,`item_value`,`locale`) SELECT "COORD_PROPERTIES","Y轴","yAxis","zh" FROM DUAL WHERE NOT EXISTS(SELECT `dict_code`,`item_name`,`item_value`,`locale` FROM `aj_report`.`gaea_dict_item` WHERE `dict_code`="COORD_PROPERTIES" AND `item_name`="Y轴" AND `item_value`="yAxis" AND `locale`="zh"); \ No newline at end of file +INSERT INTO `aj_report`.`gaea_dict`(`dict_name`, `dict_code`, `remark`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES ('XY坐标属性', 'COORD_PROPERTIES', 'XY坐标属性', 'admin', NOW(), 'admin', NOW(), 1); + +INSERT INTO `aj_report`.`gaea_dict_item`(`dict_code`, `item_name`, `item_value`, `item_extend`, `enabled`, `locale`, `remark`, `sort`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES ('COORD_PROPERTIES', '数据', 'series', NULL, 1, 'zh', NULL, NULL, 'admin', NOW(), 'admin', NOW(), 1); +INSERT INTO `aj_report`.`gaea_dict_item`(`dict_code`, `item_name`, `item_value`, `item_extend`, `enabled`, `locale`, `remark`, `sort`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES ('COORD_PROPERTIES', 'X轴', 'xAxis', NULL, 1, 'zh', NULL, NULL, 'admin', NOW(), 'admin', NOW(), 1); +INSERT INTO `aj_report`.`gaea_dict_item`(`dict_code`, `item_name`, `item_value`, `item_extend`, `enabled`, `locale`, `remark`, `sort`, `create_by`, `create_time`, `update_by`, `update_time`, `version`) VALUES ('COORD_PROPERTIES', 'Y轴', 'yAxis', NULL, 1, 'zh', NULL, NULL, 'admin', NOW(), 'admin', NOW(), 1); diff --git a/report-ui/src/mixins/queryform.js b/report-ui/src/mixins/queryform.js index 23a9ea75..d4bd93a2 100644 --- a/report-ui/src/mixins/queryform.js +++ b/report-ui/src/mixins/queryform.js @@ -109,6 +109,7 @@ export default { // widget-text 文本框 // widge-table 表格(数据不要转) // widget-stackchart 堆叠图 + // widget-heatmap 热力图 const chartType = params.chartType if ( chartType == "widget-barchart" || @@ -125,7 +126,9 @@ export default { return this.widgettext(params.chartProperties, data) } else if (chartType == "widget-stackchart") { return this.stackChartFn(params.chartProperties, data) - } else { + } else if (chartType == "widget-heatmap") { + return this.heatmapChartFn(params.chartProperties, data) + }else { return data } }, @@ -223,6 +226,20 @@ export default { } return ananysicData; }, + // 坐标系数据解析 + heatmapChartFn(chartProperties,data){ + const ananysicData = {}; + const series = []; + //全部字段字典值 + const types = Object.values(chartProperties) + //x轴字段、y轴字段名 + const xAxisField = Object.keys(chartProperties)[types.indexOf('xAxis')] + const yAxisField = Object.keys(chartProperties)[types.indexOf('yAxis')] + //x轴数值去重,y轴去重 + const xAxisList = this.setUnique(data.map(item => item[xAxisField])) + const yAxisList = this.setUnique(data.map(item => item[yAxisField])) + + }, setUnique(arr) { let newArr = []; arr.forEach(item => { diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/widget-heatmap.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/widget-heatmap.js index 7512ab54..d0b267d0 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/widget-heatmap.js +++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/widget-heatmap.js @@ -645,7 +645,7 @@ export const widgetHeatmap = { relactiveDom: 'dataType', chartType: 'widget-heatmap', relactiveDomValue: 'dynamicData', - dictKey: 'PIE_PROPERTIES', + dictKey: 'COORD_PROPERTIES', value: '', }, ], @@ -681,7 +681,7 @@ export const widgetHeatmap = { name: 'height', required: false, placeholder: '该容器在1080px大屏中的高度', - value: 250, + value: 300, }, ], }