super-page-runtime 2.1.21 → 2.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,3 +75,13 @@ export declare function caculateFormulaValue(itemConfs: any, datas: any, accumul
75
75
  * @param pageContext 页面对象
76
76
  */
77
77
  export declare function executeChartFormula(formulaStr: string, accumulateMap: any, rowData: any, pageContext: PageContext): any;
78
+ /**
79
+ * 导出图表工具方法
80
+ * @param chartDom
81
+ * @returns
82
+ */
83
+ export declare function exportCommonChart(chartDom: any): {
84
+ isTable: boolean;
85
+ fileContent: any;
86
+ fileSize: string;
87
+ };
@@ -482,11 +482,20 @@ function executeChartFormula(formulaStr, accumulateMap, rowData, pageContext) {
482
482
  row: rowData
483
483
  });
484
484
  }
485
+ function exportCommonChart(chartDom) {
486
+ const fileSize = chartDom.getAttribute("width") + ":" + chartDom.getAttribute("height");
487
+ return {
488
+ isTable: false,
489
+ fileContent: chartDom.getAttribute("base64Url"),
490
+ fileSize
491
+ };
492
+ }
485
493
  export {
486
494
  CommonName,
487
495
  caculateFormulaValue,
488
496
  clearChartSelected,
489
497
  executeChartFormula,
498
+ exportCommonChart,
490
499
  getCustomTheme,
491
500
  getCustomThemeOptions,
492
501
  getNumFormatter,
@@ -76,7 +76,7 @@ function getListCode(pageCode, pageVersion, tableUuid) {
76
76
  return "V" + pageVersion + "__" + pageCode + "__" + tableUuid;
77
77
  }
78
78
  function deepCopy(srcObj) {
79
- if (typeof srcObj !== "object" || srcObj === null) {
79
+ if (typeof srcObj !== "object" || srcObj === null || srcObj === void 0) {
80
80
  return srcObj;
81
81
  }
82
82
  const copyObj = Array.isArray(srcObj) ? [] : {};
@@ -40,6 +40,8 @@ export declare const standardEvents: {
40
40
  lineEditCreate: (params: any) => void;
41
41
  printLabel: (params: any) => void;
42
42
  queryCharts: (params: any) => void;
43
+ resetCharts: (params: any) => void;
44
+ exportCharts: (params: any) => void;
43
45
  };
44
46
  export declare function exportFormReport(pageContext: any, configureObj: any, templateFile: any, isPdf: any): void;
45
47
  export declare function getSaveFormRequestWithRow(pageContext: PageContext, configureObj: any, url: string, isUnControlVersion: boolean, mainDefaultValueColumns: any, dynamicColumnInfo: any, row: any, otherParams: any): any;
@@ -1,4 +1,4 @@
1
- import { getBaseUrl, getRealRestApiPath, upperFirstCase, isWorkflowPage, packageTemplateFiles, deepCopy, isArrayFn } from "../common-util.js";
1
+ import { deepCopy, getBaseUrl, getRealRestApiPath, upperFirstCase, isWorkflowPage, packageTemplateFiles, isArrayFn } from "../common-util.js";
2
2
  import http from "agilebuilder-ui/src/utils/request";
3
3
  import { getI18n } from "agilebuilder-ui/src/utils/util";
4
4
  import { ElMessage, ElMessageBox } from "element-plus";
@@ -216,32 +216,114 @@ const standardEvents = {
216
216
  },
217
217
  queryCharts: function(params) {
218
218
  console.log("查询统计图--params=", params);
219
- const pageContext = params.pageContext;
220
- const chartConfigs = pageContext.initChartServiceConfigs;
221
- if (!chartConfigs || chartConfigs.length == 0) {
222
- console.log("无需要查询的统计图数据");
223
- return;
224
- }
225
- const configure = params.configureObj;
226
- let runtimeProps = null;
227
- if (configure && configure.runtime) {
228
- runtimeProps = configure.runtime.props;
219
+ queryPageCharts(params);
220
+ },
221
+ resetCharts: function(params) {
222
+ var _a, _b;
223
+ console.log("重置统计图--params=", params);
224
+ let pageContext = params.pageContext;
225
+ pageContext.entity.data = deepCopy((_a = pageContext.initChartData) == null ? void 0 : _a.data);
226
+ pageContext.entity.page = deepCopy((_b = pageContext.initChartData) == null ? void 0 : _b.page);
227
+ params.isInitChart = true;
228
+ queryPageCharts(params);
229
+ },
230
+ exportCharts: function(params) {
231
+ console.log("导出统计图--params=", params);
232
+ exportPageCharts(params);
233
+ }
234
+ };
235
+ function queryPageCharts(params) {
236
+ const pageContext = params.pageContext;
237
+ const chartConfigs = pageContext.initChartServiceConfigs;
238
+ if (!chartConfigs || chartConfigs.length == 0) {
239
+ console.log("无需要查询的统计图数据");
240
+ return;
241
+ }
242
+ const configure = params.configureObj;
243
+ let runtimeProps = null;
244
+ if (configure && configure.runtime) {
245
+ runtimeProps = configure.runtime.props;
246
+ }
247
+ const hisState = runtimeProps ? runtimeProps.state : void 0;
248
+ if (runtimeProps) {
249
+ runtimeProps.state = "disabled";
250
+ }
251
+ updateChartDatasources(pageContext, chartConfigs, void 0, params.isInitChart).then(() => {
252
+ if (runtimeProps) {
253
+ runtimeProps.state = hisState;
229
254
  }
230
- const hisState = runtimeProps ? runtimeProps.state : void 0;
255
+ }).catch(() => {
231
256
  if (runtimeProps) {
232
- runtimeProps.state = "disabled";
257
+ runtimeProps.state = hisState;
233
258
  }
234
- updateChartDatasources(pageContext, chartConfigs, void 0).then(() => {
235
- if (runtimeProps) {
236
- runtimeProps.state = hisState;
237
- }
238
- }).catch(() => {
239
- if (runtimeProps) {
240
- runtimeProps.state = hisState;
259
+ });
260
+ }
261
+ function exportPageCharts(params) {
262
+ const pageContext = params.pageContext;
263
+ const chartConfigs = pageContext.initChartServiceConfigs;
264
+ if (!chartConfigs || chartConfigs.length == 0) {
265
+ console.log("无需要导出的统计图数据");
266
+ return;
267
+ }
268
+ const configure = params.configureObj;
269
+ let runtimeProps = null;
270
+ if (configure && configure.runtime) {
271
+ runtimeProps = configure.runtime.props;
272
+ }
273
+ const hisState = runtimeProps ? runtimeProps.state : void 0;
274
+ if (runtimeProps) {
275
+ runtimeProps.state = "disabled";
276
+ }
277
+ let exportChartList = [];
278
+ for (let i = 0; i < chartConfigs.length; i++) {
279
+ const chartDataSourceConfig = chartConfigs[i];
280
+ const chartUuid = chartDataSourceConfig.uuid;
281
+ const componentObj = getComponentRef(pageContext, chartUuid);
282
+ if (componentObj) {
283
+ const chartConfig = componentObj.getConfigure();
284
+ if (chartConfig && chartConfig.exportable && componentObj.exportChart) {
285
+ exportChartList.push(componentObj.exportChart());
241
286
  }
242
- });
287
+ }
243
288
  }
244
- };
289
+ if (!exportChartList || exportChartList.length == 0) {
290
+ console.log("无需要导出的统计图数据");
291
+ return;
292
+ }
293
+ let exportFileName;
294
+ let pageName = pageContext.label;
295
+ if (!pageName) {
296
+ pageName = pageContext.code;
297
+ }
298
+ exportFileName = pageName;
299
+ const param = {
300
+ reportDataList: exportChartList,
301
+ beanName: pageContext.beanName
302
+ };
303
+ const backendUrl = pageContext.backendUrl;
304
+ let request;
305
+ const baseUrl = getBaseUrl(backendUrl, pageContext.isTest);
306
+ const path = baseUrl + "/dsc/commons/exportChart";
307
+ axios.defaults.headers.common.Authorization = getToken();
308
+ request = axios.post(
309
+ path,
310
+ param,
311
+ { responseType: "blob" }
312
+ );
313
+ request.then((res) => {
314
+ const link = document.createElement("a");
315
+ link.style.display = "none";
316
+ link.href = URL.createObjectURL(res.data);
317
+ link.setAttribute("download", exportFileName + ".xlsx");
318
+ document.body.appendChild(link);
319
+ link.click();
320
+ document.body.removeChild(link);
321
+ }).finally(() => {
322
+ if (runtimeProps) {
323
+ runtimeProps.state = hisState;
324
+ }
325
+ });
326
+ }
245
327
  function exportFormReport(pageContext, configureObj, templateFile, isPdf) {
246
328
  var _a;
247
329
  const templateUUID = templateFile.templateUuid;
@@ -801,8 +883,8 @@ function deleteFunc(params) {
801
883
  pageCode: pageContext.code,
802
884
  pageVersion: pageContext.version
803
885
  };
804
- if (configureBase.beanName) {
805
- param["beanName"] = configureBase.beanName;
886
+ if (pageContext.beanName) {
887
+ param["beanName"] = pageContext.beanName;
806
888
  }
807
889
  const deleteLogicSetting = configureObj.props.deleteLogicSetting;
808
890
  if (deleteLogicSetting) {
@@ -19,7 +19,7 @@ export declare function initComponentDataSources(component: Component, pageConte
19
19
  * @param pageContext 页面上下文
20
20
  * @param dataSourceConfs 初始化数据配置参数
21
21
  */
22
- export declare function updateChartDatasources(pageContext: PageContext, dataSourceConfs: Array<any>, appendParams: any): Promise<any>;
22
+ export declare function updateChartDatasources(pageContext: PageContext, dataSourceConfs: Array<any>, appendParams: any, isInit?: boolean): Promise<any>;
23
23
  /**
24
24
  * 初始化数据源
25
25
  * @param pageContext 页面上下文
@@ -129,7 +129,7 @@ function getServiceQueryInfo(dataOriginInfo, pageContext2) {
129
129
  infoObj.props.labelField = dataOriginInfo.serviceLabelField;
130
130
  return infoObj;
131
131
  }
132
- function updateChartDatasources(pageContext2, dataSourceConfs, appendParams) {
132
+ function updateChartDatasources(pageContext2, dataSourceConfs, appendParams, isInit) {
133
133
  return new Promise((resolve, reject) => {
134
134
  if (!dataSourceConfs || dataSourceConfs.length == 0) {
135
135
  reject(new Error("无需查询的统计图配置!"));
@@ -170,8 +170,13 @@ function updateChartDatasources(pageContext2, dataSourceConfs, appendParams) {
170
170
  for (const uuid in result) {
171
171
  pageContext2.chartDataSourceMap[uuid] = result[uuid];
172
172
  const componentObj = getComponentRef(pageContext2, uuid);
173
- if (componentObj && componentObj.updateChartDatas) {
174
- componentObj.updateChartDatas(result[uuid]);
173
+ if (componentObj) {
174
+ const chartConfig = componentObj.getConfigure();
175
+ if (!isInit || chartConfig && chartConfig.initializationQuery) {
176
+ if (componentObj.updateChartDatas) {
177
+ componentObj.updateChartDatas(result[uuid]);
178
+ }
179
+ }
175
180
  }
176
181
  }
177
182
  console.log("查询统计图数据完成", result);
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, onMounted, watch, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createVNode, vShow } from "vue";
2
- import { getCustomTheme, initChartOption, monitorChartClickToVariable, clearChartSelected } from "../../../../utils/charts/chart-util.js";
2
+ import { getCustomTheme, initChartOption, monitorChartClickToVariable, clearChartSelected, exportCommonChart } from "../../../../utils/charts/chart-util.js";
3
3
  import { getChartDatasFromPage, updateChartDatasources, monitorFieldChange } from "../../../../utils/page-helper-util.js";
4
4
  import { updateChartOption } from "../../../../utils/charts/chart-columnline-util.js";
5
5
  import { doClickJumpPageEvent } from "../../../../utils/events/event-util.js";
@@ -128,8 +128,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
128
128
  dataConfig.autoRefresh = false;
129
129
  updateChartOption(props.pageContext, props.configure, chartOption, resultData);
130
130
  }
131
+ function exportChart() {
132
+ exportCommonChart(chartRef.value);
133
+ }
131
134
  __expose({
132
- updateChartDatas
135
+ updateChartDatas,
136
+ exportChart
133
137
  });
134
138
  return (_ctx, _cache) => {
135
139
  return openBlock(), createElementBlock("div", {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, onMounted, watch, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createVNode, vShow } from "vue";
2
- import { getCustomTheme, initChartOption } from "../../../../utils/charts/chart-util.js";
2
+ import { getCustomTheme, initChartOption, exportCommonChart } from "../../../../utils/charts/chart-util.js";
3
3
  import { getChartDatasFromPage, updateChartDatasources, monitorFieldChange } from "../../../../utils/page-helper-util.js";
4
4
  import { updateChartOption } from "../../../../utils/charts/chart-gauge-util.js";
5
5
  import _sfc_main$1 from "../common/common-chart-header.vue.js";
@@ -71,8 +71,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
71
71
  updateChartOption(props.pageContext, props.configure, chartOption, resultData);
72
72
  console.log("chartOption", chartOption);
73
73
  }
74
+ function exportChart() {
75
+ exportCommonChart(chartRef.value);
76
+ }
74
77
  __expose({
75
- updateChartDatas
78
+ updateChartDatas,
79
+ exportChart
76
80
  });
77
81
  return (_ctx, _cache) => {
78
82
  return openBlock(), createElementBlock("div", {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, onMounted, watch, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createVNode, vShow } from "vue";
2
- import { getCustomTheme, initChartOption, monitorChartClickToVariable, clearChartSelected } from "../../../../utils/charts/chart-util.js";
2
+ import { getCustomTheme, initChartOption, monitorChartClickToVariable, clearChartSelected, exportCommonChart } from "../../../../utils/charts/chart-util.js";
3
3
  import { updateChartOption } from "../../../../utils/charts/chart-pie-util.js";
4
4
  import { doClickJumpPageEvent } from "../../../../utils/events/event-util.js";
5
5
  import { getChartDatasFromPage, updateChartDatasources, monitorFieldChange } from "../../../../utils/page-helper-util.js";
@@ -127,8 +127,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
127
127
  updateChartOption(props.pageContext, props.configure, chartOption, resultData);
128
128
  console.log("chartOption--pie", chartOption);
129
129
  }
130
+ function exportChart() {
131
+ exportCommonChart(chartRef.value);
132
+ }
130
133
  __expose({
131
- updateChartDatas
134
+ updateChartDatas,
135
+ exportChart
132
136
  });
133
137
  return (_ctx, _cache) => {
134
138
  return openBlock(), createElementBlock("div", {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, onMounted, watch, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createVNode, vShow } from "vue";
2
- import { getCustomTheme, initChartOption } from "../../../../utils/charts/chart-util.js";
2
+ import { getCustomTheme, initChartOption, exportCommonChart } from "../../../../utils/charts/chart-util.js";
3
3
  import { getChartDatasFromPage, updateChartDatasources, monitorFieldChange } from "../../../../utils/page-helper-util.js";
4
4
  import { updateChartOption } from "../../../../utils/charts/chart-radar-util.js";
5
5
  import _sfc_main$1 from "../common/common-chart-header.vue.js";
@@ -79,8 +79,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
79
79
  updateChartOption(props.pageContext, props.configure, chartOption, resultData);
80
80
  console.log("chartOption", chartOption);
81
81
  }
82
+ function exportChart() {
83
+ exportCommonChart(chartRef.value);
84
+ }
82
85
  __expose({
83
- updateChartDatas
86
+ updateChartDatas,
87
+ exportChart
84
88
  });
85
89
  return (_ctx, _cache) => {
86
90
  return openBlock(), createElementBlock("div", {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, onMounted, watch, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createVNode, vShow } from "vue";
2
- import { getCustomTheme, initChartOption } from "../../../../utils/charts/chart-util.js";
2
+ import { getCustomTheme, initChartOption, exportCommonChart } from "../../../../utils/charts/chart-util.js";
3
3
  import { getChartDatasFromPage, updateChartDatasources, monitorFieldChange } from "../../../../utils/page-helper-util.js";
4
4
  import { updateChartOption } from "../../../../utils/charts/chart-scatter-util.js";
5
5
  import _sfc_main$1 from "../common/common-chart-header.vue.js";
@@ -80,8 +80,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
80
80
  updateChartOption(props.pageContext, props.configure, chartOption, resultData);
81
81
  console.log("chartOption scatter", chartOption);
82
82
  }
83
+ function exportChart() {
84
+ exportCommonChart(chartRef.value);
85
+ }
83
86
  __expose({
84
- updateChartDatas
87
+ updateChartDatas,
88
+ exportChart
85
89
  });
86
90
  return (_ctx, _cache) => {
87
91
  return openBlock(), createElementBlock("div", {
@@ -18,7 +18,7 @@ import _sfc_main$5 from "./super-page-dialog.vue.js";
18
18
  import { useRoute, useRouter } from "vue-router";
19
19
  import { jumpToPage } from "agilebuilder-ui/src/utils/jump-page-utils";
20
20
  import { setSessionCache } from "agilebuilder-ui/src/utils/auth";
21
- import { isNumber, deepCopy } from "../utils/common-util.js";
21
+ import { deepCopy, isNumber } from "../utils/common-util.js";
22
22
  const _hoisted_1 = { class: "app-container" };
23
23
  const _sfc_main = /* @__PURE__ */ defineComponent({
24
24
  __name: "super-page",
@@ -228,9 +228,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
228
228
  console.log("无需要初始化的选项组数据");
229
229
  return;
230
230
  }
231
+ pageContext2.initChartData = {};
232
+ pageContext2.initChartData.data = deepCopy(pageContext2.entity.data);
233
+ pageContext2.initChartData.page = deepCopy(pageContext2.entity.page);
231
234
  console.log("pageContext.chartConfigs:", chartConfigs);
232
235
  if (chartConfigs && chartConfigs.length > 0) {
233
- updateChartDatasources(pageContext2, chartConfigs);
236
+ updateChartDatasources(pageContext2, chartConfigs, null, true);
234
237
  }
235
238
  }
236
239
  onMounted(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "super-page-runtime",
3
- "version": "2.1.21",
3
+ "version": "2.1.22",
4
4
  "description": "AgileBuilder super page runtime",
5
5
  "license": "ISC",
6
6
  "main": "dist/es/index.js",