super-page-runtime 2.2.29-tmp1 → 2.2.29-tmp2

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.
Files changed (165) hide show
  1. package/dist/es/_virtual/_plugin-vue_export-helper.js +7 -5
  2. package/dist/es/assets/chart-themes/theme1.js +6 -2
  3. package/dist/es/assets/chart-themes/theme2.js +6 -2
  4. package/dist/es/assets/chart-themes/theme3.js +6 -2
  5. package/dist/es/components/runtime/utils/api/api-util.js +7 -4
  6. package/dist/es/components/runtime/utils/api/page-expose-util.js +443 -135
  7. package/dist/es/components/runtime/utils/assemblys-config.js +369 -13
  8. package/dist/es/components/runtime/utils/barcode-util.js +33 -9
  9. package/dist/es/components/runtime/utils/charts/chart-columnline-util.js +306 -122
  10. package/dist/es/components/runtime/utils/charts/chart-gauge-util.js +68 -29
  11. package/dist/es/components/runtime/utils/charts/chart-pie-util.js +152 -69
  12. package/dist/es/components/runtime/utils/charts/chart-radar-util.js +124 -46
  13. package/dist/es/components/runtime/utils/charts/chart-scatter-util.js +99 -38
  14. package/dist/es/components/runtime/utils/charts/chart-util.js +522 -226
  15. package/dist/es/components/runtime/utils/common-util.js +156 -76
  16. package/dist/es/components/runtime/utils/eventBus.js +8 -3
  17. package/dist/es/components/runtime/utils/events/event-util.js +775 -362
  18. package/dist/es/components/runtime/utils/events/print-label.js +140 -73
  19. package/dist/es/components/runtime/utils/events/standard-event.js +2320 -820
  20. package/dist/es/components/runtime/utils/events/validator-util.js +560 -224
  21. package/dist/es/components/runtime/utils/form/date-shortcuts.js +88 -28
  22. package/dist/es/components/runtime/utils/form/scan-util.js +162 -62
  23. package/dist/es/components/runtime/utils/global-refs.js +84 -53
  24. package/dist/es/components/runtime/utils/i18n-util.js +20 -11
  25. package/dist/es/components/runtime/utils/interfaces/page-design-types.js +7 -2
  26. package/dist/es/components/runtime/utils/page-helper-util.js +660 -280
  27. package/dist/es/components/runtime/utils/page-init-util.js +405 -144
  28. package/dist/es/components/runtime/utils/page-permission-util.js +531 -22
  29. package/dist/es/components/runtime/utils/page-store.js +68 -23
  30. package/dist/es/components/runtime/utils/store-util.js +13 -9
  31. package/dist/es/components/runtime/utils/store.js +2 -2
  32. package/dist/es/components/runtime/utils/table-utils.js +81 -40
  33. package/dist/es/components/runtime/utils/tree-utils.js +37 -17
  34. package/dist/es/components/runtime/views/assemblys/button/button/button-runtime.vue.js +2 -2
  35. package/dist/es/components/runtime/views/assemblys/button/button/button-runtime.vue2.js +83 -21
  36. package/dist/es/components/runtime/views/assemblys/button/button-group/buttongroup-runtime.vue.js +2 -2
  37. package/dist/es/components/runtime/views/assemblys/button/button-group/buttongroup-runtime.vue2.js +46 -14
  38. package/dist/es/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue.js +2 -2
  39. package/dist/es/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue2.js +132 -36
  40. package/dist/es/components/runtime/views/assemblys/button/export-pdf/exportpdf-runtime.vue.js +2 -2
  41. package/dist/es/components/runtime/views/assemblys/button/export-pdf/exportpdf-runtime.vue2.js +18 -4
  42. package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue.js +2 -2
  43. package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue2.js +107 -17
  44. package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue.js +2 -2
  45. package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue2.js +198 -54
  46. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-breadcrumb.vue.js +42 -12
  47. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-breadcrumb.vue2.js +2 -2
  48. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-group.vue.js +60 -11
  49. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-group.vue2.js +2 -2
  50. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header.vue.js +203 -54
  51. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header.vue2.js +2 -2
  52. package/dist/es/components/runtime/views/assemblys/chart/common/common-homepage-search.vue.js +4 -4
  53. package/dist/es/components/runtime/views/assemblys/chart/common/common-homepage-search.vue2.js +162 -46
  54. package/dist/es/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue.js +2 -2
  55. package/dist/es/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue2.js +109 -33
  56. package/dist/es/components/runtime/views/assemblys/chart/pie/pie-runtime.vue.js +2 -2
  57. package/dist/es/components/runtime/views/assemblys/chart/pie/pie-runtime.vue2.js +166 -44
  58. package/dist/es/components/runtime/views/assemblys/chart/radar/radar-runtime.vue.js +2 -2
  59. package/dist/es/components/runtime/views/assemblys/chart/radar/radar-runtime.vue2.js +117 -33
  60. package/dist/es/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue.js +2 -2
  61. package/dist/es/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue2.js +118 -33
  62. package/dist/es/components/runtime/views/assemblys/chart/table/chart-table-util.js +599 -253
  63. package/dist/es/components/runtime/views/assemblys/chart/table/group-column-item.vue.js +42 -4
  64. package/dist/es/components/runtime/views/assemblys/chart/table/group-column-item.vue2.js +2 -2
  65. package/dist/es/components/runtime/views/assemblys/chart/table/group-column.vue.js +62 -8
  66. package/dist/es/components/runtime/views/assemblys/chart/table/group-column.vue2.js +2 -2
  67. package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue.js +160 -29
  68. package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue2.js +2 -2
  69. package/dist/es/components/runtime/views/assemblys/chart/table/table-pageination.vue.js +62 -13
  70. package/dist/es/components/runtime/views/assemblys/chart/table/table-pageination.vue2.js +2 -2
  71. package/dist/es/components/runtime/views/assemblys/chart/table/table-runtime.vue.js +2 -2
  72. package/dist/es/components/runtime/views/assemblys/chart/table/table-runtime.vue2.js +594 -213
  73. package/dist/es/components/runtime/views/assemblys/common/export-form-report-dialog.vue.js +139 -33
  74. package/dist/es/components/runtime/views/assemblys/common/export-form-report-dialog.vue2.js +2 -2
  75. package/dist/es/components/runtime/views/assemblys/common/remove-signer-dialog.vue.js +125 -21
  76. package/dist/es/components/runtime/views/assemblys/common/remove-signer-dialog.vue2.js +2 -2
  77. package/dist/es/components/runtime/views/assemblys/common/task-informition-dialog.vue.js +102 -16
  78. package/dist/es/components/runtime/views/assemblys/common/task-informition-dialog.vue2.js +2 -2
  79. package/dist/es/components/runtime/views/assemblys/container/card/card-runtime.vue.js +2 -2
  80. package/dist/es/components/runtime/views/assemblys/container/card/card-runtime.vue2.js +81 -18
  81. package/dist/es/components/runtime/views/assemblys/container/collapse/collapse-runtime.vue.js +2 -2
  82. package/dist/es/components/runtime/views/assemblys/container/collapse/collapse-runtime.vue2.js +82 -17
  83. package/dist/es/components/runtime/views/assemblys/container/container/container-runtime.vue.js +2 -2
  84. package/dist/es/components/runtime/views/assemblys/container/container/container-runtime.vue2.js +86 -14
  85. package/dist/es/components/runtime/views/assemblys/container/flex/flex-runtime.vue.js +2 -2
  86. package/dist/es/components/runtime/views/assemblys/container/flex/flex-runtime.vue2.js +79 -21
  87. package/dist/es/components/runtime/views/assemblys/container/form/form-runtime.vue.js +2 -2
  88. package/dist/es/components/runtime/views/assemblys/container/form/form-runtime.vue2.js +61 -16
  89. package/dist/es/components/runtime/views/assemblys/container/iframe/iframe-runtime.vue.js +2 -2
  90. package/dist/es/components/runtime/views/assemblys/container/iframe/iframe-runtime.vue2.js +37 -10
  91. package/dist/es/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue.js +2 -2
  92. package/dist/es/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue2.js +127 -38
  93. package/dist/es/components/runtime/views/assemblys/container/tools/tools-runtime.vue.js +2 -2
  94. package/dist/es/components/runtime/views/assemblys/container/tools/tools-runtime.vue2.js +76 -28
  95. package/dist/es/components/runtime/views/assemblys/data/bar-code/barcode-runtime.vue.js +2 -2
  96. package/dist/es/components/runtime/views/assemblys/data/bar-code/barcode-runtime.vue2.js +178 -63
  97. package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +810 -305
  98. package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue2.js +2 -2
  99. package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +635 -265
  100. package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue2.js +2 -2
  101. package/dist/es/components/runtime/views/assemblys/data/table/table-runtime.vue.js +2 -2
  102. package/dist/es/components/runtime/views/assemblys/data/table/table-runtime.vue2.js +115 -40
  103. package/dist/es/components/runtime/views/assemblys/data/tree/tree-runtime.vue.js +2 -2
  104. package/dist/es/components/runtime/views/assemblys/data/tree/tree-runtime.vue2.js +215 -56
  105. package/dist/es/components/runtime/views/assemblys/error-render.vue.js +21 -3
  106. package/dist/es/components/runtime/views/assemblys/error-render.vue2.js +2 -2
  107. package/dist/es/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue.js +2 -2
  108. package/dist/es/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue2.js +154 -43
  109. package/dist/es/components/runtime/views/assemblys/form/common/title-suffix-element.vue.js +98 -34
  110. package/dist/es/components/runtime/views/assemblys/form/common/title-suffix-element.vue2.js +2 -2
  111. package/dist/es/components/runtime/views/assemblys/form/custom/custom-runtime.vue.js +2 -2
  112. package/dist/es/components/runtime/views/assemblys/form/custom/custom-runtime.vue2.js +200 -52
  113. package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue.js +2 -2
  114. package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +239 -70
  115. package/dist/es/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue.js +2 -2
  116. package/dist/es/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue2.js +109 -31
  117. package/dist/es/components/runtime/views/assemblys/form/divider/divider-runtime.vue.js +2 -2
  118. package/dist/es/components/runtime/views/assemblys/form/divider/divider-runtime.vue2.js +59 -21
  119. package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue.js +2 -2
  120. package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue2.js +188 -56
  121. package/dist/es/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue.js +2 -2
  122. package/dist/es/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue2.js +103 -22
  123. package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue.js +2 -2
  124. package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue2.js +246 -59
  125. package/dist/es/components/runtime/views/assemblys/form/label/label-runtime.vue.js +2 -2
  126. package/dist/es/components/runtime/views/assemblys/form/label/label-runtime.vue2.js +174 -34
  127. package/dist/es/components/runtime/views/assemblys/form/link/link-runtime.vue.js +2 -2
  128. package/dist/es/components/runtime/views/assemblys/form/link/link-runtime.vue2.js +107 -29
  129. package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue.js +4 -4
  130. package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue2.js +50 -13
  131. package/dist/es/components/runtime/views/assemblys/form/radio/radio-runtime.vue.js +2 -2
  132. package/dist/es/components/runtime/views/assemblys/form/radio/radio-runtime.vue2.js +194 -65
  133. package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue.js +2 -2
  134. package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue2.js +249 -89
  135. package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue.js +2 -2
  136. package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue2.js +263 -80
  137. package/dist/es/components/runtime/views/assemblys/form/separatelabel/separatelabel-runtime.vue.js +2 -2
  138. package/dist/es/components/runtime/views/assemblys/form/separatelabel/separatelabel-runtime.vue2.js +57 -13
  139. package/dist/es/components/runtime/views/assemblys/form/switch/switch-runtime.vue.js +2 -2
  140. package/dist/es/components/runtime/views/assemblys/form/switch/switch-runtime.vue2.js +155 -30
  141. package/dist/es/components/runtime/views/assemblys/form/tag/tag-runtime.vue.js +2 -2
  142. package/dist/es/components/runtime/views/assemblys/form/tag/tag-runtime.vue2.js +129 -40
  143. package/dist/es/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue.js +2 -2
  144. package/dist/es/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue2.js +107 -22
  145. package/dist/es/components/runtime/views/assemblys/home-chart-render.vue.js +188 -89
  146. package/dist/es/components/runtime/views/assemblys/home-chart-render.vue2.js +2 -2
  147. package/dist/es/components/runtime/views/assemblys/object-render.vue.js +272 -133
  148. package/dist/es/components/runtime/views/assemblys/object-render.vue2.js +2 -2
  149. package/dist/es/components/runtime/views/assemblys/workflow/picture-flow/pictureflow-runtime.vue.js +2 -2
  150. package/dist/es/components/runtime/views/assemblys/workflow/picture-flow/pictureflow-runtime.vue2.js +46 -18
  151. package/dist/es/components/runtime/views/assemblys/workflow/text-history/textflow-runtime.vue.js +2 -2
  152. package/dist/es/components/runtime/views/assemblys/workflow/text-history/textflow-runtime.vue2.js +49 -21
  153. package/dist/es/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue.js +2 -2
  154. package/dist/es/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue2.js +58 -20
  155. package/dist/es/components/runtime/views/assemblys/workflow/workflow-node/workflownode-runtime.vue.js +2 -2
  156. package/dist/es/components/runtime/views/assemblys/workflow/workflow-node/workflownode-runtime.vue2.js +53 -16
  157. package/dist/es/components/runtime/views/home-chart.vue.js +160 -41
  158. package/dist/es/components/runtime/views/home-chart.vue2.js +2 -2
  159. package/dist/es/components/runtime/views/super-page-dialog.vue.js +139 -21
  160. package/dist/es/components/runtime/views/super-page-dialog.vue2.js +2 -2
  161. package/dist/es/components/runtime/views/super-page.vue.js +756 -230
  162. package/dist/es/components/runtime/views/super-page.vue2.js +2 -2
  163. package/dist/es/i18n/langs/cn.js +55 -2
  164. package/dist/es/i18n/langs/en.js +55 -2
  165. package/package.json +2 -2
@@ -1,81 +1,164 @@
1
- import { getValueFromSource as o, setValueForVariableName as e } from "../page-helper-util.js";
2
- import { deepCopy as s } from "../common-util.js";
3
- import { CommonName as r, caculateFormulaValue as t, executeChartFormula as l, sortDatas as n, limitDatas as p } from "./chart-util.js";
4
- function i(i2, u, c, a) {
5
- if (!a || !a.result) return;
6
- const f = a && a.result ? a.result : {};
7
- let g = a && a.groupValue ? a.groupValue : void 0;
8
- const m = u.serviceDataField;
9
- let h = null;
10
- m ? h = f[m] : f && (h = Array.isArray(f) ? f : [f]), h || (h = []);
11
- let d = u.props ? u.props.groups : null;
12
- if (d || (d = []), !g || 0 === g.length) {
13
- g = [];
14
- for (const o2 of d) g.push(o2.group);
1
+ import { getValueFromSource, setValueForVariableName } from "../page-helper-util.js";
2
+ import { deepCopy } from "../common-util.js";
3
+ import { CommonName, caculateFormulaValue, executeChartFormula, sortDatas, limitDatas } from "./chart-util.js";
4
+ function updateChartOption(pageContext, configure, chartOption, resultData) {
5
+ if (!resultData || !resultData.result) {
6
+ return;
15
7
  }
16
- const y = {}, v = [], x = [];
17
- for (const o2 of d) y[o2.group] = o2.target, o2.target && !v.includes(o2.target) && (v.push(o2.target), g.includes(o2.group) && x.push(o2.target));
18
- let F = u.props ? u.props.mulGroupShow : "";
19
- F = "break" == F ? "\r\n" : " ", console.log("groupValue", g);
20
- for (const e2 of h) {
21
- if (!e2) continue;
22
- const s2 = [];
23
- for (const r2 of g) {
24
- const t3 = y[r2], l2 = o(e2, t3, void 0);
25
- l2 && s2.push(l2);
8
+ const result = resultData && resultData.result ? resultData.result : {};
9
+ let groupValue = resultData && resultData.groupValue ? resultData.groupValue : void 0;
10
+ const dataSetField = configure.serviceDataField;
11
+ let datas = null;
12
+ if (dataSetField) {
13
+ datas = result[dataSetField];
14
+ } else {
15
+ if (result) {
16
+ if (Array.isArray(result)) {
17
+ datas = result;
18
+ } else {
19
+ datas = [result];
20
+ }
21
+ }
22
+ }
23
+ if (!datas) {
24
+ datas = [];
25
+ }
26
+ let confGroups = configure.props ? configure.props.groups : null;
27
+ if (!confGroups) {
28
+ confGroups = [];
29
+ }
30
+ if (!groupValue || groupValue.length === 0) {
31
+ groupValue = [];
32
+ for (const g of confGroups) {
33
+ groupValue.push(g.group);
26
34
  }
27
- const t2 = s2.join(F);
28
- e2[r.X_FIELD_NAME] = t2;
29
35
  }
30
- const E = u.items ? u.items : [];
31
- if (0 == E.length) return void console.log("饼图的系列为空,操作失败!", u);
32
- const S = u.props ? u.props : {};
33
- let _ = S.yaxisField;
34
- if (console.log("valueField", _), E[0].props.yaxisField = _, E[0].props.yaxisSource = S.yaxisSource, E[0].props.formula = S.formula, "formula" === S.yaxisSource) {
35
- const e2 = [], s2 = t(E, h, e2);
36
- let n2 = S.formula ? S.formula : "";
37
- for (const o2 in s2) n2 = n2.replace(new RegExp(o2.replace("$", "\\$"), "g"), s2[o2]);
38
- _ = r.Y_TEMP_NAME;
39
- const p2 = {};
40
- for (const s3 of h) {
41
- if (!s3) continue;
42
- for (const r3 of e2) {
43
- const e3 = o(s3, r3, void 0);
44
- let t2 = p2[r3];
45
- void 0 === e3 || isNaN(e3) || (void 0 === t2 ? t2 = e3 : t2 += e3), p2[r3] = t2;
36
+ const groupMap = {};
37
+ const groupFields = [];
38
+ const realGroupFilds = [];
39
+ for (const g of confGroups) {
40
+ groupMap[g.group] = g.target;
41
+ if (g.target && !groupFields.includes(g.target)) {
42
+ groupFields.push(g.target);
43
+ if (groupValue.includes(g.group)) {
44
+ realGroupFilds.push(g.target);
46
45
  }
47
- console.log("formula", n2);
48
- const r2 = l(n2, p2, s3, i2);
49
- console.log("formula-result", r2), s3[_] = r2;
50
46
  }
51
47
  }
52
- E[0].props.yaxisField = _, E[0].props.yaxisSource = "", n(i2, u, h), h = p(i2, u, h, v, [_]);
53
- const A = [], D = [];
54
- for (const e2 of h) {
55
- if (!e2) continue;
56
- A.push(e2[r.X_FIELD_NAME]);
57
- const s2 = o(e2, _, void 0);
58
- D.push(s2);
48
+ let mulGroupShow = configure.props ? configure.props.mulGroupShow : "";
49
+ mulGroupShow = mulGroupShow == "break" ? "\r\n" : " ";
50
+ console.log("groupValue", groupValue);
51
+ for (const d of datas) {
52
+ if (!d) {
53
+ continue;
54
+ }
55
+ const xValues2 = [];
56
+ for (const g of groupValue) {
57
+ const fieldName = groupMap[g];
58
+ const value = getValueFromSource(d, fieldName, void 0);
59
+ if (value) {
60
+ xValues2.push(value);
61
+ }
62
+ }
63
+ const xValue = xValues2.join(mulGroupShow);
64
+ d[CommonName.X_FIELD_NAME] = xValue;
59
65
  }
60
- const M = u.defaultSeries;
61
- let N = M[0].pieColors;
62
- N = N || [];
63
- let j = M[0].pieColorMap;
64
- j = j || {};
65
- const V = [];
66
- for (let o2 = 0; o2 < A.length && o2 < D.length; o2++) {
67
- const e2 = { value: D[o2], name: A[o2] };
68
- if (o2 < N.length || j[e2.name]) {
69
- let s2 = j[e2.name];
70
- s2 || (s2 = N[o2]), s2 && (e2.itemStyle = { color: s2 });
66
+ const itemConfs = configure.items ? configure.items : [];
67
+ if (itemConfs.length == 0) {
68
+ console.log("饼图的系列为空,操作失败!", configure);
69
+ return;
70
+ }
71
+ const confProps = configure.props ? configure.props : {};
72
+ let valueField = confProps.yaxisField;
73
+ console.log("valueField", valueField);
74
+ itemConfs[0].props.yaxisField = valueField;
75
+ itemConfs[0].props.yaxisSource = confProps.yaxisSource;
76
+ itemConfs[0].props.formula = confProps.formula;
77
+ if (confProps.yaxisSource === "formula") {
78
+ const accumulateFields = [];
79
+ const totalValueMap = caculateFormulaValue(itemConfs, datas, accumulateFields);
80
+ let formula = confProps.formula ? confProps.formula : "";
81
+ for (const paramName in totalValueMap) {
82
+ formula = formula.replace(
83
+ new RegExp(paramName.replace("$", "\\$"), "g"),
84
+ totalValueMap[paramName]
85
+ );
71
86
  }
72
- V.push(e2);
87
+ valueField = CommonName.Y_TEMP_NAME;
88
+ const cumulativeMap = {};
89
+ for (const data of datas) {
90
+ if (!data) {
91
+ continue;
92
+ }
93
+ for (const cumulativeField of accumulateFields) {
94
+ const value2 = getValueFromSource(data, cumulativeField, void 0);
95
+ let hisValue = cumulativeMap[cumulativeField];
96
+ if (value2 !== void 0 && !isNaN(value2)) {
97
+ if (hisValue === void 0) {
98
+ hisValue = value2;
99
+ } else {
100
+ hisValue = hisValue + value2;
101
+ }
102
+ }
103
+ cumulativeMap[cumulativeField] = hisValue;
104
+ }
105
+ console.log("formula", formula);
106
+ const value = executeChartFormula(formula, cumulativeMap, data, pageContext);
107
+ console.log("formula-result", value);
108
+ data[valueField] = value;
109
+ }
110
+ }
111
+ itemConfs[0].props.yaxisField = valueField;
112
+ itemConfs[0].props.yaxisSource = "";
113
+ sortDatas(pageContext, configure, datas);
114
+ datas = limitDatas(pageContext, configure, datas, groupFields, [valueField]);
115
+ const xValues = [];
116
+ const yValues = [];
117
+ for (const data of datas) {
118
+ if (!data) {
119
+ continue;
120
+ }
121
+ xValues.push(data[CommonName.X_FIELD_NAME]);
122
+ const value = getValueFromSource(data, valueField, void 0);
123
+ yValues.push(value);
124
+ }
125
+ const defaultSeries = configure.defaultSeries;
126
+ let pieColors = defaultSeries[0].pieColors;
127
+ pieColors = pieColors ? pieColors : [];
128
+ let pieColorMap = defaultSeries[0].pieColorMap;
129
+ pieColorMap = pieColorMap ? pieColorMap : {};
130
+ const pieDatas = [];
131
+ for (let index = 0; index < xValues.length && index < yValues.length; index++) {
132
+ const data = {
133
+ value: yValues[index],
134
+ name: xValues[index]
135
+ };
136
+ if (index < pieColors.length || pieColorMap[data.name]) {
137
+ let color = pieColorMap[data.name];
138
+ if (!color) {
139
+ color = pieColors[index];
140
+ }
141
+ if (color) {
142
+ data.itemStyle = {
143
+ color
144
+ };
145
+ }
146
+ }
147
+ pieDatas.push(data);
148
+ }
149
+ const tempSeries = deepCopy(defaultSeries);
150
+ tempSeries[0].data = pieDatas;
151
+ chartOption.series = [tempSeries[0]];
152
+ const selGroupVariable = configure.props ? configure.props.selGroupVariable : null;
153
+ const enableDrill = configure.props ? configure.props.enableDrill : null;
154
+ if (!enableDrill && selGroupVariable) {
155
+ configure.highlightInfos = [];
156
+ setValueForVariableName(pageContext.entity, selGroupVariable, null);
73
157
  }
74
- const b = s(M);
75
- b[0].data = V, c.series = [b[0]];
76
- const w = u.props ? u.props.selGroupVariable : null;
77
- !(u.props ? u.props.enableDrill : null) && w && (u.highlightInfos = [], e(i2.entity, w, null)), u.groupFields = x, u.cacheDatas = h, u.rawResult = a;
158
+ configure.groupFields = realGroupFilds;
159
+ configure.cacheDatas = datas;
160
+ configure.rawResult = resultData;
78
161
  }
79
162
  export {
80
- i as updateChartOption
163
+ updateChartOption
81
164
  };
@@ -1,54 +1,132 @@
1
- import { getValueFromSource as e } from "../page-helper-util.js";
2
- import { deepCopy as o } from "../common-util.js";
3
- import { caculateFormulaValue as i, executeChartFormula as t } from "./chart-util.js";
4
- function a(a2, s, r, l) {
5
- if (!l || !l.result) return;
6
- const u = l && l.result ? l.result : {}, f = s.serviceDataField;
7
- let d = null;
8
- f ? d = u[f] : u && (d = Array.isArray(u) ? u : [u]), d || (d = []);
9
- const n = s.items ? s.items : [], c = [], p = {}, m = [], x = i(n, d, m);
10
- for (const e2 of n) {
11
- const o2 = e2.props ? e2.props : {}, i2 = o2.yaxisSource, t2 = o2.yaxisField;
12
- let a3 = null;
13
- if (!t2 || i2 && "variable" != i2) if ("formula" == i2) {
14
- let i3 = o2.formula ? o2.formula : "";
15
- for (const e3 in x) i3 = i3.replace(new RegExp(e3.replace("$", "\\$"), "g"), x[e3]);
16
- a3 = { uuid: e2.uuid, type: "formula", formula: i3, data: [] };
17
- } else a3 = { uuid: e2.uuid, type: "fixed", field: o2.yaxisFix, data: [] };
18
- else a3 = { uuid: e2.uuid, type: "variable", field: t2, data: [] };
19
- a3 && (c.push(a3), p[a3.uuid] = a3);
1
+ import { getValueFromSource } from "../page-helper-util.js";
2
+ import { deepCopy } from "../common-util.js";
3
+ import { caculateFormulaValue, executeChartFormula } from "./chart-util.js";
4
+ function updateChartOption(pageContext, configure, chartOption, resultData) {
5
+ if (!resultData || !resultData.result) {
6
+ return;
20
7
  }
21
- const v = s.props ? s.props : {}, y = v.nameField, h = v.maxSource, F = v.maxField, b = v.maxFixed, g = [], j = {};
22
- for (const o2 of d) {
23
- if (!o2) continue;
24
- const i2 = e(o2, y, void 0);
25
- let s2 = null;
26
- s2 = h && "variable" != h ? b : e(o2, F, void 0), g.push({ text: i2, max: s2 });
27
- for (const i3 of m) {
28
- const t2 = e(o2, i3, void 0);
29
- let a3 = j[i3];
30
- void 0 === t2 || isNaN(t2) || (void 0 === a3 ? a3 = t2 : a3 += t2), j[i3] = a3;
8
+ const result = resultData && resultData.result ? resultData.result : {};
9
+ const dataSetField = configure.serviceDataField;
10
+ let datas = null;
11
+ if (dataSetField) {
12
+ datas = result[dataSetField];
13
+ } else {
14
+ if (result) {
15
+ if (Array.isArray(result)) {
16
+ datas = result;
17
+ } else {
18
+ datas = [result];
19
+ }
31
20
  }
32
- for (const i3 of c) {
33
- const s3 = i3.data;
34
- if ("fixed" == i3.type) s3.push(i3.field);
35
- else if ("variable" == i3.type) {
36
- const t2 = e(o2, i3.field, void 0);
37
- s3.push(t2);
38
- } else if ("formula" == i3.type) {
39
- const e2 = t(i3.formula, j, o2, a2);
40
- s3.push(e2);
41
- } else s3.push(void 0);
21
+ }
22
+ if (!datas) {
23
+ datas = [];
24
+ }
25
+ const itemConfs = configure.items ? configure.items : [];
26
+ const dataConfs = [];
27
+ const dataValueMap = {};
28
+ const accumulateFields = [];
29
+ const totalValueMap = caculateFormulaValue(itemConfs, datas, accumulateFields);
30
+ for (const item of itemConfs) {
31
+ const itemProps = item.props ? item.props : {};
32
+ const sourceType = itemProps.yaxisSource;
33
+ const yaxisField = itemProps.yaxisField;
34
+ let dataConf = null;
35
+ if (yaxisField && (!sourceType || sourceType == "variable")) {
36
+ dataConf = {
37
+ uuid: item.uuid,
38
+ type: "variable",
39
+ field: yaxisField,
40
+ data: []
41
+ };
42
+ } else if (sourceType == "formula") {
43
+ let formula = itemProps.formula ? itemProps.formula : "";
44
+ for (const paramName in totalValueMap) {
45
+ formula = formula.replace(
46
+ new RegExp(paramName.replace("$", "\\$"), "g"),
47
+ totalValueMap[paramName]
48
+ );
49
+ }
50
+ dataConf = {
51
+ uuid: item.uuid,
52
+ type: "formula",
53
+ formula,
54
+ data: []
55
+ };
56
+ } else {
57
+ dataConf = {
58
+ uuid: item.uuid,
59
+ type: "fixed",
60
+ field: itemProps.yaxisFix,
61
+ data: []
62
+ };
63
+ }
64
+ if (dataConf) {
65
+ dataConfs.push(dataConf);
66
+ dataValueMap[dataConf.uuid] = dataConf;
67
+ }
68
+ }
69
+ const confProps = configure.props ? configure.props : {};
70
+ const nameField = confProps.nameField;
71
+ const maxSource = confProps.maxSource;
72
+ const maxField = confProps.maxField;
73
+ const maxFixed = confProps.maxFixed;
74
+ const indicators = [];
75
+ const cumulativeMap = {};
76
+ for (const d of datas) {
77
+ if (!d) {
78
+ continue;
79
+ }
80
+ const name = getValueFromSource(d, nameField, void 0);
81
+ let maxValue = null;
82
+ if (!maxSource || maxSource == "variable") {
83
+ maxValue = getValueFromSource(d, maxField, void 0);
84
+ } else {
85
+ maxValue = maxFixed;
86
+ }
87
+ indicators.push({
88
+ text: name,
89
+ max: maxValue
90
+ });
91
+ for (const cumulativeField of accumulateFields) {
92
+ const value = getValueFromSource(d, cumulativeField, void 0);
93
+ let hisValue = cumulativeMap[cumulativeField];
94
+ if (value !== void 0 && !isNaN(value)) {
95
+ if (hisValue === void 0) {
96
+ hisValue = value;
97
+ } else {
98
+ hisValue = hisValue + value;
99
+ }
100
+ }
101
+ cumulativeMap[cumulativeField] = hisValue;
102
+ }
103
+ for (const item of dataConfs) {
104
+ const data = item.data;
105
+ if (item.type == "fixed") {
106
+ data.push(item.field);
107
+ } else if (item.type == "variable") {
108
+ const value = getValueFromSource(d, item.field, void 0);
109
+ data.push(value);
110
+ } else if (item.type == "formula") {
111
+ const value = executeChartFormula(item.formula, cumulativeMap, d, pageContext);
112
+ data.push(value);
113
+ } else {
114
+ data.push(void 0);
115
+ }
42
116
  }
43
117
  }
44
- r.radar[0].indicator = g;
45
- const S = s.defaultSeries, w = o(S), A = w[0].data;
46
- for (const e2 of A) {
47
- const o2 = p[e2.uuid];
48
- e2.value = o2.data;
118
+ chartOption.radar[0].indicator = indicators;
119
+ const defaultSeries = configure.defaultSeries;
120
+ const tempSeries = deepCopy(defaultSeries);
121
+ const serieDatas = tempSeries[0].data;
122
+ for (const serieData of serieDatas) {
123
+ const dataValue = dataValueMap[serieData.uuid];
124
+ serieData.value = dataValue.data;
49
125
  }
50
- r.series = w, s.cacheDatas = d, s.rawResult = l;
126
+ chartOption.series = tempSeries;
127
+ configure.cacheDatas = datas;
128
+ configure.rawResult = resultData;
51
129
  }
52
130
  export {
53
- a as updateChartOption
131
+ updateChartOption
54
132
  };
@@ -1,47 +1,108 @@
1
- import { getValueFromSource as o } from "../page-helper-util.js";
2
- import { deepCopy as s } from "../common-util.js";
3
- import { caculateFormulaValue as i, executeChartFormula as e } from "./chart-util.js";
4
- function r(r2, t, l, a) {
5
- if (!a || !a.result) return;
6
- const u = a && a.result ? a.result : {}, c = t.serviceDataField;
7
- let f = null;
8
- c ? f = u[c] : u && (f = Array.isArray(u) ? u : [u]), f || (f = []);
9
- const d = t.items ? t.items : [], n = [], p = {};
10
- for (const o2 of d) {
11
- const s2 = o2.props ? o2.props : {}, i2 = o2.props ? o2.style : {}, e2 = s2.xaxisField, r3 = s2.sizeField, t2 = { uuid: o2.uuid, xaxisField: e2, yaxisField: s2.yaxisField, yaxisSource: s2.yaxisSource, formula: s2.formula, sizeField: r3, symbolSize: i2.symbolSize, data: [] };
12
- n.push(t2), p[t2.uuid] = t2;
1
+ import { getValueFromSource } from "../page-helper-util.js";
2
+ import { deepCopy } from "../common-util.js";
3
+ import { caculateFormulaValue, executeChartFormula } from "./chart-util.js";
4
+ function updateChartOption(pageContext, configure, chartOption, resultData) {
5
+ if (!resultData || !resultData.result) {
6
+ return;
13
7
  }
14
- const m = [], x = i(d, f, m);
15
- for (const o2 of n) if ("formula" === o2.yaxisSource) {
16
- let s2 = o2.formula ? o2.formula : "";
17
- for (const o3 in x) s2 = s2.replace(new RegExp(o3.replace("$", "\\$"), "g"), x[o3]);
18
- o2.formula = s2;
8
+ const result = resultData && resultData.result ? resultData.result : {};
9
+ const dataSetField = configure.serviceDataField;
10
+ let datas = null;
11
+ if (dataSetField) {
12
+ datas = result[dataSetField];
13
+ } else {
14
+ if (result) {
15
+ if (Array.isArray(result)) {
16
+ datas = result;
17
+ } else {
18
+ datas = [result];
19
+ }
20
+ }
21
+ }
22
+ if (!datas) {
23
+ datas = [];
24
+ }
25
+ const itemConfs = configure.items ? configure.items : [];
26
+ const dataConfs = [];
27
+ const dataValueMap = {};
28
+ for (const item of itemConfs) {
29
+ const itemProps = item.props ? item.props : {};
30
+ const itemStyle = item.props ? item.style : {};
31
+ const xaxisField = itemProps.xaxisField;
32
+ const sizeField = itemProps.sizeField;
33
+ const dataConf = {
34
+ uuid: item.uuid,
35
+ xaxisField,
36
+ yaxisField: itemProps.yaxisField,
37
+ yaxisSource: itemProps.yaxisSource,
38
+ formula: itemProps.formula,
39
+ sizeField,
40
+ symbolSize: itemStyle.symbolSize,
41
+ data: []
42
+ };
43
+ dataConfs.push(dataConf);
44
+ dataValueMap[dataConf.uuid] = dataConf;
19
45
  }
20
- const y = {};
21
- for (const s2 of f) if (s2) {
22
- for (const i2 of m) {
23
- const e2 = o(s2, i2, void 0);
24
- let r3 = y[i2];
25
- void 0 === e2 || isNaN(e2) || (void 0 === r3 ? r3 = e2 : r3 += e2), y[i2] = r3;
46
+ const accumulateFields = [];
47
+ const totalValueMap = caculateFormulaValue(itemConfs, datas, accumulateFields);
48
+ for (const dataConf of dataConfs) {
49
+ if (dataConf.yaxisSource === "formula") {
50
+ let formula = dataConf.formula ? dataConf.formula : "";
51
+ for (const paramName in totalValueMap) {
52
+ formula = formula.replace(
53
+ new RegExp(paramName.replace("$", "\\$"), "g"),
54
+ totalValueMap[paramName]
55
+ );
56
+ }
57
+ dataConf.formula = formula;
58
+ }
59
+ }
60
+ const cumulativeMap = {};
61
+ for (const d of datas) {
62
+ if (!d) {
63
+ continue;
64
+ }
65
+ for (const cumulativeField of accumulateFields) {
66
+ const value = getValueFromSource(d, cumulativeField, void 0);
67
+ let hisValue = cumulativeMap[cumulativeField];
68
+ if (value !== void 0 && !isNaN(value)) {
69
+ if (hisValue === void 0) {
70
+ hisValue = value;
71
+ } else {
72
+ hisValue = hisValue + value;
73
+ }
74
+ }
75
+ cumulativeMap[cumulativeField] = hisValue;
26
76
  }
27
- for (const i2 of n) {
28
- const t2 = i2.data, l2 = [];
29
- if (l2.push(o(s2, i2.xaxisField, void 0)), "formula" === i2.yaxisSource) {
30
- const o2 = e(i2.formula, y, s2, r2);
31
- l2.push(o2);
32
- } else l2.push(o(s2, i2.yaxisField, void 0));
33
- i2.sizeField ? l2.push(o(s2, i2.xaxisField, void 0)) : l2.push(i2.symbolSize), t2.push(l2);
77
+ for (const item of dataConfs) {
78
+ const data = item.data;
79
+ const values = [];
80
+ values.push(getValueFromSource(d, item.xaxisField, void 0));
81
+ if (item.yaxisSource === "formula") {
82
+ const value = executeChartFormula(item.formula, cumulativeMap, d, pageContext);
83
+ values.push(value);
84
+ } else {
85
+ values.push(getValueFromSource(d, item.yaxisField, void 0));
86
+ }
87
+ if (item.sizeField) {
88
+ values.push(getValueFromSource(d, item.xaxisField, void 0));
89
+ } else {
90
+ values.push(item.symbolSize);
91
+ }
92
+ data.push(values);
34
93
  }
35
94
  }
36
- const F = t.defaultSeries;
37
- console.log("defaultSeries", F);
38
- const h = s(F);
39
- for (const o2 of h) {
40
- const s2 = p[o2.uuid];
41
- o2.data = s2.data;
95
+ const defaultSeries = configure.defaultSeries;
96
+ console.log("defaultSeries", defaultSeries);
97
+ const tempSeries = deepCopy(defaultSeries);
98
+ for (const serie of tempSeries) {
99
+ const dataValue = dataValueMap[serie.uuid];
100
+ serie.data = dataValue.data;
42
101
  }
43
- l.series = h, t.cacheDatas = f, t.rawResult = a;
102
+ chartOption.series = tempSeries;
103
+ configure.cacheDatas = datas;
104
+ configure.rawResult = resultData;
44
105
  }
45
106
  export {
46
- r as updateChartOption
107
+ updateChartOption
47
108
  };