From e46a4c29cd63ea4feb6b46d52fd2d9ca5d449706 Mon Sep 17 00:00:00 2001 From: gelibo Date: Mon, 1 Jun 2020 20:10:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DScriptUtils.formatHeader=20bu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/edp/davinci/common/utils/ScriptUtiils.java | 4 +++- server/src/main/resources/templates/js/formatCellValue.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/edp/davinci/common/utils/ScriptUtiils.java b/server/src/main/java/edp/davinci/common/utils/ScriptUtiils.java index 21c310059..528548717 100644 --- a/server/src/main/java/edp/davinci/common/utils/ScriptUtiils.java +++ b/server/src/main/java/edp/davinci/common/utils/ScriptUtiils.java @@ -10,6 +10,7 @@ package edp.davinci.common.utils; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import edp.davinci.core.common.Constants; @@ -67,8 +68,9 @@ public static synchronized ViewExecuteParam getViewExecuteParam(String dashboard public static synchronized List formatHeader(String json, List params) { Value js = ScriptEnum.INSTANCE.tableFormatJs; - Value result = js.execute(json, params); + Value result = js.execute(json, JSON.toJSONString(params)); List excelHeaders = JSONArray.parseArray(result.toString(), ExcelHeader.class); return excelHeaders; } + } diff --git a/server/src/main/resources/templates/js/formatCellValue.js b/server/src/main/resources/templates/js/formatCellValue.js index ecc126f5e..92bdb8c8d 100644 --- a/server/src/main/resources/templates/js/formatCellValue.js +++ b/server/src/main/resources/templates/js/formatCellValue.js @@ -5510,7 +5510,8 @@ function parseTableHeader(headerConfig, fields, queryVars) { return headerCells } -function getFieldsHeader(widgetConfigJson, queryVars) { +function getFieldsHeader(widgetConfigJson, queryVarsJson) { + var queryVars = JSON.parse(queryVarsJson || '[]') if (!widgetConfigJson) { return [] }