super-page-runtime 2.2.29-tmp2 → 2.2.32

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 (167) hide show
  1. package/dist/es/_virtual/_plugin-vue_export-helper.js +5 -7
  2. package/dist/es/assets/chart-themes/theme1.js +2 -6
  3. package/dist/es/assets/chart-themes/theme2.js +2 -6
  4. package/dist/es/assets/chart-themes/theme3.js +2 -6
  5. package/dist/es/components/runtime/utils/api/api-util.js +4 -7
  6. package/dist/es/components/runtime/utils/api/page-expose-util.js +135 -443
  7. package/dist/es/components/runtime/utils/assemblys-config.js +13 -369
  8. package/dist/es/components/runtime/utils/barcode-util.js +9 -33
  9. package/dist/es/components/runtime/utils/charts/chart-columnline-util.js +122 -306
  10. package/dist/es/components/runtime/utils/charts/chart-gauge-util.js +29 -68
  11. package/dist/es/components/runtime/utils/charts/chart-pie-util.js +68 -152
  12. package/dist/es/components/runtime/utils/charts/chart-radar-util.js +46 -124
  13. package/dist/es/components/runtime/utils/charts/chart-scatter-util.js +36 -99
  14. package/dist/es/components/runtime/utils/charts/chart-util.js +224 -522
  15. package/dist/es/components/runtime/utils/common-util.js +76 -156
  16. package/dist/es/components/runtime/utils/eventBus.js +3 -8
  17. package/dist/es/components/runtime/utils/events/event-util.js +362 -775
  18. package/dist/es/components/runtime/utils/events/print-label.js +72 -140
  19. package/dist/es/components/runtime/utils/events/standard-event.js +808 -2320
  20. package/dist/es/components/runtime/utils/events/validator-util.js +224 -560
  21. package/dist/es/components/runtime/utils/form/date-shortcuts.js +28 -88
  22. package/dist/es/components/runtime/utils/form/scan-util.js +61 -162
  23. package/dist/es/components/runtime/utils/global-refs.js +53 -84
  24. package/dist/es/components/runtime/utils/i18n-util.js +11 -20
  25. package/dist/es/components/runtime/utils/interfaces/page-design-types.d.ts +6 -0
  26. package/dist/es/components/runtime/utils/interfaces/page-design-types.js +2 -7
  27. package/dist/es/components/runtime/utils/page-helper-util.js +280 -660
  28. package/dist/es/components/runtime/utils/page-init-util.js +141 -406
  29. package/dist/es/components/runtime/utils/page-permission-util.js +22 -531
  30. package/dist/es/components/runtime/utils/page-store.js +23 -68
  31. package/dist/es/components/runtime/utils/store-util.js +9 -13
  32. package/dist/es/components/runtime/utils/store.js +2 -2
  33. package/dist/es/components/runtime/utils/table-utils.d.ts +4 -0
  34. package/dist/es/components/runtime/utils/table-utils.js +40 -81
  35. package/dist/es/components/runtime/utils/tree-utils.js +17 -37
  36. package/dist/es/components/runtime/views/assemblys/button/button/button-runtime.vue.js +2 -2
  37. package/dist/es/components/runtime/views/assemblys/button/button/button-runtime.vue2.js +21 -83
  38. package/dist/es/components/runtime/views/assemblys/button/button-group/buttongroup-runtime.vue.js +2 -2
  39. package/dist/es/components/runtime/views/assemblys/button/button-group/buttongroup-runtime.vue2.js +14 -46
  40. package/dist/es/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue.js +2 -2
  41. package/dist/es/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue2.js +36 -132
  42. package/dist/es/components/runtime/views/assemblys/button/export-pdf/exportpdf-runtime.vue.js +2 -2
  43. package/dist/es/components/runtime/views/assemblys/button/export-pdf/exportpdf-runtime.vue2.js +4 -18
  44. package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue.js +2 -2
  45. package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue2.js +17 -107
  46. package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue.js +2 -2
  47. package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue2.js +50 -198
  48. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-breadcrumb.vue.js +12 -42
  49. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-breadcrumb.vue2.js +2 -2
  50. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-group.vue.js +7 -60
  51. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-group.vue2.js +2 -2
  52. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header.vue.js +52 -203
  53. package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header.vue2.js +2 -2
  54. package/dist/es/components/runtime/views/assemblys/chart/common/common-homepage-search.vue.js +4 -4
  55. package/dist/es/components/runtime/views/assemblys/chart/common/common-homepage-search.vue2.js +46 -162
  56. package/dist/es/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue.js +2 -2
  57. package/dist/es/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue2.js +32 -109
  58. package/dist/es/components/runtime/views/assemblys/chart/pie/pie-runtime.vue.js +2 -2
  59. package/dist/es/components/runtime/views/assemblys/chart/pie/pie-runtime.vue2.js +43 -166
  60. package/dist/es/components/runtime/views/assemblys/chart/radar/radar-runtime.vue.js +2 -2
  61. package/dist/es/components/runtime/views/assemblys/chart/radar/radar-runtime.vue2.js +32 -117
  62. package/dist/es/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue.js +2 -2
  63. package/dist/es/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue2.js +32 -118
  64. package/dist/es/components/runtime/views/assemblys/chart/table/chart-table-util.js +246 -597
  65. package/dist/es/components/runtime/views/assemblys/chart/table/group-column-item.vue.js +4 -42
  66. package/dist/es/components/runtime/views/assemblys/chart/table/group-column-item.vue2.js +2 -2
  67. package/dist/es/components/runtime/views/assemblys/chart/table/group-column.vue.js +8 -62
  68. package/dist/es/components/runtime/views/assemblys/chart/table/group-column.vue2.js +2 -2
  69. package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue.js +29 -160
  70. package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue2.js +2 -2
  71. package/dist/es/components/runtime/views/assemblys/chart/table/table-pageination.vue.js +13 -62
  72. package/dist/es/components/runtime/views/assemblys/chart/table/table-pageination.vue2.js +2 -2
  73. package/dist/es/components/runtime/views/assemblys/chart/table/table-runtime.vue.js +2 -2
  74. package/dist/es/components/runtime/views/assemblys/chart/table/table-runtime.vue2.js +212 -594
  75. package/dist/es/components/runtime/views/assemblys/common/export-form-report-dialog.vue.js +29 -139
  76. package/dist/es/components/runtime/views/assemblys/common/export-form-report-dialog.vue2.js +2 -2
  77. package/dist/es/components/runtime/views/assemblys/common/remove-signer-dialog.vue.js +21 -125
  78. package/dist/es/components/runtime/views/assemblys/common/remove-signer-dialog.vue2.js +2 -2
  79. package/dist/es/components/runtime/views/assemblys/common/task-informition-dialog.vue.js +16 -102
  80. package/dist/es/components/runtime/views/assemblys/common/task-informition-dialog.vue2.js +2 -2
  81. package/dist/es/components/runtime/views/assemblys/container/card/card-runtime.vue.js +2 -2
  82. package/dist/es/components/runtime/views/assemblys/container/card/card-runtime.vue2.js +18 -81
  83. package/dist/es/components/runtime/views/assemblys/container/collapse/collapse-runtime.vue.js +2 -2
  84. package/dist/es/components/runtime/views/assemblys/container/collapse/collapse-runtime.vue2.js +17 -82
  85. package/dist/es/components/runtime/views/assemblys/container/container/container-runtime.vue.js +2 -2
  86. package/dist/es/components/runtime/views/assemblys/container/container/container-runtime.vue2.js +14 -86
  87. package/dist/es/components/runtime/views/assemblys/container/flex/flex-runtime.vue.js +2 -2
  88. package/dist/es/components/runtime/views/assemblys/container/flex/flex-runtime.vue2.js +21 -79
  89. package/dist/es/components/runtime/views/assemblys/container/form/form-runtime.vue.js +2 -2
  90. package/dist/es/components/runtime/views/assemblys/container/form/form-runtime.vue2.js +16 -61
  91. package/dist/es/components/runtime/views/assemblys/container/iframe/iframe-runtime.vue.js +2 -2
  92. package/dist/es/components/runtime/views/assemblys/container/iframe/iframe-runtime.vue2.js +10 -37
  93. package/dist/es/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue.js +2 -2
  94. package/dist/es/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue2.js +38 -127
  95. package/dist/es/components/runtime/views/assemblys/container/tools/tools-runtime.vue.js +2 -2
  96. package/dist/es/components/runtime/views/assemblys/container/tools/tools-runtime.vue2.js +28 -76
  97. package/dist/es/components/runtime/views/assemblys/data/bar-code/barcode-runtime.vue.js +2 -2
  98. package/dist/es/components/runtime/views/assemblys/data/bar-code/barcode-runtime.vue2.js +61 -178
  99. package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +317 -810
  100. package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue2.js +2 -2
  101. package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +262 -635
  102. package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue2.js +2 -2
  103. package/dist/es/components/runtime/views/assemblys/data/table/table-runtime.vue.js +2 -2
  104. package/dist/es/components/runtime/views/assemblys/data/table/table-runtime.vue2.js +40 -115
  105. package/dist/es/components/runtime/views/assemblys/data/tree/tree-runtime.vue.js +2 -2
  106. package/dist/es/components/runtime/views/assemblys/data/tree/tree-runtime.vue2.js +56 -215
  107. package/dist/es/components/runtime/views/assemblys/error-render.vue.js +3 -21
  108. package/dist/es/components/runtime/views/assemblys/error-render.vue2.js +2 -2
  109. package/dist/es/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue.js +2 -2
  110. package/dist/es/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue2.js +42 -154
  111. package/dist/es/components/runtime/views/assemblys/form/common/title-suffix-element.vue.js +34 -98
  112. package/dist/es/components/runtime/views/assemblys/form/common/title-suffix-element.vue2.js +2 -2
  113. package/dist/es/components/runtime/views/assemblys/form/custom/custom-runtime.vue.js +2 -2
  114. package/dist/es/components/runtime/views/assemblys/form/custom/custom-runtime.vue2.js +52 -200
  115. package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue.js +2 -2
  116. package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +68 -239
  117. package/dist/es/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue.js +2 -2
  118. package/dist/es/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue2.js +31 -109
  119. package/dist/es/components/runtime/views/assemblys/form/divider/divider-runtime.vue.js +2 -2
  120. package/dist/es/components/runtime/views/assemblys/form/divider/divider-runtime.vue2.js +21 -59
  121. package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue.js +2 -2
  122. package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue2.js +56 -188
  123. package/dist/es/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue.js +2 -2
  124. package/dist/es/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue2.js +22 -103
  125. package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue.js +2 -2
  126. package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue2.js +57 -245
  127. package/dist/es/components/runtime/views/assemblys/form/label/label-runtime.vue.js +2 -2
  128. package/dist/es/components/runtime/views/assemblys/form/label/label-runtime.vue2.js +32 -174
  129. package/dist/es/components/runtime/views/assemblys/form/link/link-runtime.vue.js +2 -2
  130. package/dist/es/components/runtime/views/assemblys/form/link/link-runtime.vue2.js +28 -107
  131. package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue.js +4 -4
  132. package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue2.js +13 -50
  133. package/dist/es/components/runtime/views/assemblys/form/radio/radio-runtime.vue.js +2 -2
  134. package/dist/es/components/runtime/views/assemblys/form/radio/radio-runtime.vue2.js +64 -194
  135. package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue.js +2 -2
  136. package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue2.js +88 -249
  137. package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue.js +2 -2
  138. package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue2.js +80 -263
  139. package/dist/es/components/runtime/views/assemblys/form/separatelabel/separatelabel-runtime.vue.js +2 -2
  140. package/dist/es/components/runtime/views/assemblys/form/separatelabel/separatelabel-runtime.vue2.js +13 -57
  141. package/dist/es/components/runtime/views/assemblys/form/switch/switch-runtime.vue.js +2 -2
  142. package/dist/es/components/runtime/views/assemblys/form/switch/switch-runtime.vue2.js +30 -155
  143. package/dist/es/components/runtime/views/assemblys/form/tag/tag-runtime.vue.js +2 -2
  144. package/dist/es/components/runtime/views/assemblys/form/tag/tag-runtime.vue2.js +40 -129
  145. package/dist/es/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue.js +2 -2
  146. package/dist/es/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue2.js +22 -107
  147. package/dist/es/components/runtime/views/assemblys/home-chart-render.vue.js +89 -188
  148. package/dist/es/components/runtime/views/assemblys/home-chart-render.vue2.js +2 -2
  149. package/dist/es/components/runtime/views/assemblys/object-render.vue.js +133 -272
  150. package/dist/es/components/runtime/views/assemblys/object-render.vue2.js +2 -2
  151. package/dist/es/components/runtime/views/assemblys/workflow/picture-flow/pictureflow-runtime.vue.js +2 -2
  152. package/dist/es/components/runtime/views/assemblys/workflow/picture-flow/pictureflow-runtime.vue2.js +18 -46
  153. package/dist/es/components/runtime/views/assemblys/workflow/text-history/textflow-runtime.vue.js +2 -2
  154. package/dist/es/components/runtime/views/assemblys/workflow/text-history/textflow-runtime.vue2.js +21 -49
  155. package/dist/es/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue.js +2 -2
  156. package/dist/es/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue2.js +20 -58
  157. package/dist/es/components/runtime/views/assemblys/workflow/workflow-node/workflownode-runtime.vue.js +2 -2
  158. package/dist/es/components/runtime/views/assemblys/workflow/workflow-node/workflownode-runtime.vue2.js +16 -53
  159. package/dist/es/components/runtime/views/home-chart.vue.js +41 -160
  160. package/dist/es/components/runtime/views/home-chart.vue2.js +2 -2
  161. package/dist/es/components/runtime/views/super-page-dialog.vue.js +20 -139
  162. package/dist/es/components/runtime/views/super-page-dialog.vue2.js +2 -2
  163. package/dist/es/components/runtime/views/super-page.vue.js +226 -754
  164. package/dist/es/components/runtime/views/super-page.vue2.js +2 -2
  165. package/dist/es/i18n/langs/cn.js +2 -55
  166. package/dist/es/i18n/langs/en.js +2 -55
  167. package/package.json +2 -2
@@ -2,694 +2,343 @@ import { getParamNames, getValueFromVariable } from "../../../../utils/page-help
2
2
  import { getCustomFunc } from "../../../../utils/events/event-util.js";
3
3
  import { getMinValue, getMaxValue, getSumValue, getAvgValue } from "../../../../utils/charts/chart-util.js";
4
4
  class ExpressionEvaluator {
5
- static evaluate(pageContext, conditions, data2) {
6
- const expressions = conditions.map(
7
- (condition) => this.createExpression(pageContext, condition, data2)
8
- );
9
- const joinedExpression = expressions.join(" ");
10
- return this.evaluateExpression(joinedExpression);
11
- }
12
- static createExpression(pageContext, condition, data2) {
13
- const { propName, operator, propValue, leftBracket, rightBracket, joinSign, dataType } = condition;
14
- if (!propName || propName === "") {
15
- return "";
16
- }
17
- const value = getValueFromVariable(pageContext.entity, propName, data2);
18
- let expression2 = `${leftBracket} ${this.getComparisonExpression(value, operator, getValueFromVariable(pageContext.entity, propValue, data2), dataType)} ${rightBracket}`;
19
- if (joinSign) {
20
- if (joinSign === "and" || joinSign === "AND") {
21
- expression2 += "&&";
22
- } else if (joinSign === "or" || joinSign === "OR") {
23
- expression2 += "||";
24
- }
25
- }
26
- return expression2.trim();
27
- }
28
- static getComparisonExpression(value, operator, propValue, dataType) {
29
- if (!operator) {
30
- operator = "EQ";
31
- }
32
- const parsedValue = this.parseValue(value, dataType);
33
- const parsedPropValue = this.parseValue(propValue, dataType);
34
- switch (operator) {
5
+ static evaluate(e, t, o) {
6
+ const r = t.map((t2) => this.createExpression(e, t2, o)).join(" ");
7
+ return this.evaluateExpression(r);
8
+ }
9
+ static createExpression(e, t, o) {
10
+ const { propName: r, operator: a, propValue: n, leftBracket: s, rightBracket: l, joinSign: i, dataType: c } = t;
11
+ if (!r || "" === r) return "";
12
+ const u = getValueFromVariable(e.entity, r, o);
13
+ let p = `${s} ${this.getComparisonExpression(u, a, getValueFromVariable(e.entity, n, o), c)} ${l}`;
14
+ return i && ("and" === i || "AND" === i ? p += "&&" : "or" !== i && "OR" !== i || (p += "||")), p.trim();
15
+ }
16
+ static getComparisonExpression(e, t, o, r) {
17
+ t || (t = "EQ");
18
+ const a = this.parseValue(e, r), n = this.parseValue(o, r);
19
+ switch (t) {
35
20
  case "EQ":
36
- return `${parsedValue} === ${parsedPropValue}`;
21
+ return `${a} === ${n}`;
37
22
  case "GT":
38
- return `${parsedValue} > ${parsedPropValue}`;
23
+ return `${a} > ${n}`;
39
24
  case "LT":
40
- return `${parsedValue} < ${parsedPropValue}`;
25
+ return `${a} < ${n}`;
41
26
  case "GET":
42
- return `${parsedValue} >= ${parsedPropValue}`;
27
+ return `${a} >= ${n}`;
43
28
  case "LET":
44
- return `${parsedValue} <= ${parsedPropValue}`;
29
+ return `${a} <= ${n}`;
45
30
  case "NET":
46
- return `${parsedValue} !== ${parsedPropValue}`;
31
+ return `${a} !== ${n}`;
47
32
  case "CONTAIN":
48
- return `${parsedValue}.includes(${parsedPropValue})`;
33
+ return `${a}.includes(${n})`;
49
34
  case "NOT_CONTAIN":
50
- return `!${parsedValue}.includes(${parsedPropValue})`;
35
+ return `!${a}.includes(${n})`;
51
36
  case "IS_NULL":
52
- return `${parsedValue} === null`;
37
+ return `${a} === null`;
53
38
  case "IS_NOT_NULL":
54
- return `${parsedValue} !== null`;
39
+ return `${a} !== null`;
55
40
  default:
56
- throw new Error(`比较符号不匹配: ${operator}`);
41
+ throw new Error(`比较符号不匹配: ${t}`);
57
42
  }
58
43
  }
59
- static changeDataType(dataType) {
60
- let resultDataType = dataType;
61
- if (dataType) {
62
- if (dataType === "TEXT") {
63
- resultDataType = "string";
64
- } else if (dataType === "DATE" || dataType === "TIME") {
65
- resultDataType = "date";
66
- } else if (dataType === "DOUBLE" || dataType === "FLOAT" || dataType === "INTEGER" || dataType === "LONG" || dataType === "BOOLEAN") {
67
- resultDataType = "number";
68
- }
69
- }
70
- return resultDataType;
44
+ static changeDataType(e) {
45
+ let t = e;
46
+ return e && ("TEXT" === e ? t = "string" : "DATE" === e || "TIME" === e ? t = "date" : "DOUBLE" !== e && "FLOAT" !== e && "INTEGER" !== e && "LONG" !== e && "BOOLEAN" !== e || (t = "number")), t;
71
47
  }
72
- static parseValue(value, dataType) {
73
- dataType = this.changeDataType(dataType);
74
- switch (dataType) {
48
+ static parseValue(e, t) {
49
+ switch (t = this.changeDataType(t)) {
75
50
  case "number":
76
- return Number(value);
51
+ return Number(e);
77
52
  case "date":
78
- return new Date(value).getTime();
53
+ return new Date(e).getTime();
79
54
  case "string":
80
- return `"${value}"`;
55
+ return `"${e}"`;
81
56
  default:
82
- throw new Error(`数据类型解析错误: ${dataType}`);
57
+ throw new Error(`数据类型解析错误: ${t}`);
83
58
  }
84
59
  }
85
60
  static evaluateExpression(expression) {
86
61
  try {
87
62
  return eval(expression);
88
- } catch (error) {
89
- console.error("表达式错误:", expression, error);
63
+ } catch (e) {
90
64
  return false;
91
65
  }
92
66
  }
93
67
  }
94
- function getSummaryTitleColumn(configure) {
68
+ function getSummaryTitleColumn(e) {
95
69
  var _a;
96
- const result = {};
97
- if (((_a = configure.props.summaries) == null ? void 0 : _a.titleColumn) && configure.props.summaries.titleColumn.length > 0) {
98
- configure.props.summaries.titleColumn.forEach((item) => {
99
- result[item.prop] = item;
100
- });
101
- }
102
- return result;
70
+ const t = {};
71
+ return ((_a = e.props.summaries) == null ? void 0 : _a.titleColumn) && e.props.summaries.titleColumn.length > 0 && e.props.summaries.titleColumn.forEach((e2) => {
72
+ t[e2.prop] = e2;
73
+ }), t;
103
74
  }
104
- function getSummaryDataColumn(configure, type) {
75
+ function getSummaryDataColumn(e, t) {
105
76
  var _a;
106
- const result = {};
107
- if (((_a = configure.props.summaries) == null ? void 0 : _a.dataColumn) && configure.props.summaries.dataColumn.length > 0) {
108
- configure.props.summaries.dataColumn.forEach((item) => {
109
- var _a2;
110
- const columnConfigs = (_a2 = configure.items) == null ? void 0 : _a2.find(
111
- (columnItem) => item.prop === columnItem.props.base.prop
112
- );
113
- if (columnConfigs) {
114
- if (type === "table" && columnConfigs.props.base.tableSummary) {
115
- result[item.prop] = item;
116
- } else if (type === "group" && columnConfigs.props.base.groupSummary) {
117
- result[item.prop] = item;
118
- }
119
- }
120
- });
121
- }
122
- return result;
77
+ const o = {};
78
+ return ((_a = e.props.summaries) == null ? void 0 : _a.dataColumn) && e.props.summaries.dataColumn.length > 0 && e.props.summaries.dataColumn.forEach((r) => {
79
+ var _a2;
80
+ const a = (_a2 = e.items) == null ? void 0 : _a2.find((e2) => r.prop === e2.props.base.prop);
81
+ a && ("table" === t && a.props.base.tableSummary || "group" === t && a.props.base.groupSummary) && (o[r.prop] = r);
82
+ }), o;
123
83
  }
124
- function summaryStatistics(summaryColumn, data2, prop, pageContext) {
125
- let sumsIndex = "";
126
- const summaryMode = summaryColumn.summaryMode;
127
- const values = data2.map((item) => Number(item[prop])).filter((value) => !Number.isNaN(value));
128
- if (values.length > 0) {
129
- if (summaryMode === "custom") {
130
- const func = getCustomFunc(pageContext, summaryColumn.customFunc);
131
- if (func) {
132
- try {
133
- const resultValue = func.apply(func, [{ data: data2, prop }]);
134
- if (resultValue) {
135
- sumsIndex = ` ${resultValue}`;
136
- } else {
137
- sumsIndex = " N/A";
138
- }
139
- } catch (error) {
140
- console.error("自定义函数脚本错误:", data2, error);
141
- }
142
- } else {
143
- sumsIndex = " N/A";
144
- }
145
- } else {
146
- switch (summaryMode) {
147
- case "sum":
148
- sumsIndex = ` ${values.reduce((prev, curr) => prev + curr, 0)}`;
149
- break;
150
- case "avg":
151
- sumsIndex = ` ${values.reduce((prev, curr) => prev + curr, 0) / values.length}`;
152
- break;
153
- case "min":
154
- sumsIndex = ` ${Math.min(...values)}`;
155
- break;
156
- case "max":
157
- sumsIndex = ` ${Math.max(...values)}`;
158
- break;
159
- default:
160
- sumsIndex = " N/A";
161
- }
84
+ function summaryStatistics(e, t, o, r) {
85
+ let a = "";
86
+ const n = e.summaryMode, s = t.map((e2) => Number(e2[o])).filter((e2) => !Number.isNaN(e2));
87
+ if (s.length > 0) if ("custom" === n) {
88
+ const n2 = getCustomFunc(r, e.customFunc);
89
+ if (n2) try {
90
+ const e2 = n2.apply(n2, [{ data: t, prop: o }]);
91
+ a = e2 ? ` ${e2}` : " N/A";
92
+ } catch (e2) {
162
93
  }
163
- } else {
164
- sumsIndex = " N/A";
94
+ else a = " N/A";
95
+ } else switch (n) {
96
+ case "sum":
97
+ a = ` ${s.reduce((e2, t2) => e2 + t2, 0)}`;
98
+ break;
99
+ case "avg":
100
+ a = " " + s.reduce((e2, t2) => e2 + t2, 0) / s.length;
101
+ break;
102
+ case "min":
103
+ a = ` ${Math.min(...s)}`;
104
+ break;
105
+ case "max":
106
+ a = ` ${Math.max(...s)}`;
107
+ break;
108
+ default:
109
+ a = " N/A";
165
110
  }
166
- return sumsIndex;
111
+ else a = " N/A";
112
+ return a;
167
113
  }
168
- function replacePlaceholders(template, data2) {
169
- if (template) {
170
- return template.replace(/\$\{row\.(\w+)\}/g, (match, p1) => {
171
- return Object.prototype.hasOwnProperty.call(data2, p1) ? data2[p1] : "";
172
- });
173
- }
114
+ function replacePlaceholders(e, t) {
115
+ if (e) return e.replace(/\$\{row\.(\w+)\}/g, (e2, o) => Object.prototype.hasOwnProperty.call(t, o) ? t[o] : "");
174
116
  }
175
- function getHeaderCellStyleUtil(data2, runtimeStyle, props) {
117
+ function getHeaderCellStyleUtil(e, t, o) {
176
118
  var _a;
177
- const headerStyle = {};
178
- if (data2.column.property) {
179
- (_a = runtimeStyle.titleStyle) == null ? void 0 : _a.forEach((item) => {
180
- if (item.field && item.field.includes(data2.column.property)) {
181
- if (item.scopeFunc) {
182
- const func = getCustomFunc(props.pageContext, item.scopeFunc);
183
- if (func) {
184
- try {
185
- const funcResult = func.apply(func, [{ item, data: data2 }]);
186
- if (funcResult !== false) {
187
- copyStyle(headerStyle, item);
188
- }
189
- } catch (error) {
190
- console.error("自定义函数脚本错误:", item, data2, error);
191
- }
192
- }
193
- } else {
194
- copyStyle(headerStyle, item);
195
- }
119
+ const r = {};
120
+ e.column.property && ((_a = t.titleStyle) == null ? void 0 : _a.forEach((t2) => {
121
+ if (t2.field && t2.field.includes(e.column.property)) if (t2.scopeFunc) {
122
+ const a2 = getCustomFunc(o.pageContext, t2.scopeFunc);
123
+ if (a2) try {
124
+ false !== a2.apply(a2, [{ item: t2, data: e }]) && copyStyle(r, t2);
125
+ } catch (e2) {
196
126
  }
197
- });
198
- }
199
- const cellTitleStytle = getCellStyleUtil(data2, runtimeStyle.cellTitleStyle, props);
200
- if (cellTitleStytle) {
201
- Object.assign(headerStyle, cellTitleStytle);
202
- }
203
- return headerStyle;
127
+ } else copyStyle(r, t2);
128
+ }));
129
+ const a = getCellStyleUtil(e, t.cellTitleStyle, o);
130
+ return a && Object.assign(r, a), r;
204
131
  }
205
- function getRowStyleUtil(data2, groupSummaryDataRowIndex, props) {
206
- const returnStyle = {};
207
- if (props.configure.style.rowStyle) {
208
- for (let i = 0; i < props.configure.style.rowStyle.length; i++) {
209
- const rowStyle = props.configure.style.rowStyle[i];
210
- if (rowStyle.scopeFunc) {
211
- const func = getCustomFunc(props.pageContext, rowStyle.scopeFunc);
212
- if (func) {
213
- try {
214
- const funcResult = func.apply(func, [{ data: data2 }]);
215
- if (funcResult !== void 0 && funcResult !== null && funcResult !== false) {
216
- copyStyle(returnStyle, rowStyle);
217
- }
218
- } catch (error) {
219
- console.error("自定义函数脚本错误:", data2, error);
220
- }
221
- }
222
- } else if (rowStyle.matchingCondition) {
223
- const result = ExpressionEvaluator.evaluate(
224
- props.pageContext,
225
- rowStyle.matchingCondition,
226
- data2.row
227
- );
228
- if (result || result === void 0) {
229
- copyStyle(returnStyle, rowStyle);
230
- }
231
- } else {
232
- copyStyle(returnStyle, rowStyle);
233
- }
234
- }
235
- }
236
- if (groupSummaryDataRowIndex && groupSummaryDataRowIndex.length > 0 && groupSummaryDataRowIndex.indexOf(data2.rowIndex) !== -1) {
237
- const result = {};
238
- if (props.configure.style.collectStyle && props.configure.style.collectStyle.length > 0) {
239
- for (let i = 0; i < props.configure.style.collectStyle.length; i++) {
240
- const collectStyle = props.configure.style.collectStyle[i];
241
- copyStyle(result, collectStyle);
132
+ function getRowStyleUtil(e, t, o) {
133
+ const r = {};
134
+ if (o.configure.style.rowStyle) for (let t2 = 0; t2 < o.configure.style.rowStyle.length; t2++) {
135
+ const a = o.configure.style.rowStyle[t2];
136
+ if (a.scopeFunc) {
137
+ const t3 = getCustomFunc(o.pageContext, a.scopeFunc);
138
+ if (t3) try {
139
+ const o2 = t3.apply(t3, [{ data: e }]);
140
+ null != o2 && false !== o2 && copyStyle(r, a);
141
+ } catch (e2) {
242
142
  }
143
+ } else if (a.matchingCondition) {
144
+ const t3 = ExpressionEvaluator.evaluate(o.pageContext, a.matchingCondition, e.row);
145
+ (t3 || void 0 === t3) && copyStyle(r, a);
146
+ } else copyStyle(r, a);
147
+ }
148
+ if (t && t.length > 0 && -1 !== t.indexOf(e.rowIndex)) {
149
+ const e2 = {};
150
+ if (o.configure.style.collectStyle && o.configure.style.collectStyle.length > 0) for (let t2 = 0; t2 < o.configure.style.collectStyle.length; t2++) {
151
+ copyStyle(e2, o.configure.style.collectStyle[t2]);
243
152
  }
244
- if (Object.keys(result).length === 0) {
245
- result["background-color"] = "var(--el-table-row-hover-bg-color)";
246
- }
247
- return result;
153
+ return 0 === Object.keys(e2).length && (e2["background-color"] = "var(--el-table-row-hover-bg-color)"), e2;
248
154
  }
249
- return returnStyle;
155
+ return r;
250
156
  }
251
- function getCellStyleUtil(data2, cellStyles, props) {
252
- const cellStyle = {};
253
- if (cellStyles) {
254
- for (let i = 0; i < cellStyles.length; i++) {
255
- const columnsStyleSetting = cellStyles[i];
256
- if (isSetStyle(columnsStyleSetting)) {
257
- if (columnsStyleSetting.scopeFunc) {
258
- const func = getCustomFunc(props.pageContext, columnsStyleSetting.scopeFunc);
259
- if (func) {
260
- try {
261
- const funcResult = func.apply(func, [{ data: data2 }]);
262
- if (funcResult !== false) {
263
- copyStyle(cellStyle, columnsStyleSetting);
264
- }
265
- } catch (error) {
266
- console.error("自定义函数脚本错误:", data2, error);
267
- }
268
- }
269
- } else if (columnsStyleSetting.matchingCondition) {
270
- const result = ExpressionEvaluator.evaluate(
271
- props.pageContext,
272
- columnsStyleSetting.matchingCondition,
273
- data2.row
274
- );
275
- if (result || result === void 0) {
276
- copyStyle(cellStyle, columnsStyleSetting);
277
- }
278
- } else {
279
- copyStyle(cellStyle, columnsStyleSetting);
280
- }
157
+ function getCellStyleUtil(e, t, o) {
158
+ const r = {};
159
+ if (t) for (let a = 0; a < t.length; a++) {
160
+ const n = t[a];
161
+ if (isSetStyle(n)) if (n.scopeFunc) {
162
+ const t2 = getCustomFunc(o.pageContext, n.scopeFunc);
163
+ if (t2) try {
164
+ false !== t2.apply(t2, [{ data: e }]) && copyStyle(r, n);
165
+ } catch (e2) {
281
166
  }
282
- }
167
+ } else if (n.matchingCondition) {
168
+ const t2 = ExpressionEvaluator.evaluate(o.pageContext, n.matchingCondition, e.row);
169
+ (t2 || void 0 === t2) && copyStyle(r, n);
170
+ } else copyStyle(r, n);
283
171
  }
284
- return cellStyle;
172
+ return r;
285
173
  }
286
- function isSetStyle(columnsStyleSetting) {
287
- let customStyle;
288
- if (columnsStyleSetting.customStyle) {
289
- customStyle = JSON.parse(columnsStyleSetting.customStyle);
290
- }
291
- if (columnsStyleSetting.style && Object.keys(columnsStyleSetting.style).length > 0 || customStyle && Object.keys(customStyle).length > 0) {
292
- return true;
293
- }
294
- return false;
174
+ function isSetStyle(e) {
175
+ let t;
176
+ return e.customStyle && (t = JSON.parse(e.customStyle)), !!(e.style && Object.keys(e.style).length > 0 || t && Object.keys(t).length > 0);
295
177
  }
296
- function copyStyle(target, source) {
297
- Object.assign(target, source.style);
298
- if (source.customStyle) {
299
- Object.assign(target, JSON.parse(source.customStyle));
300
- }
178
+ function copyStyle(e, t) {
179
+ Object.assign(e, t.style), t.customStyle && Object.assign(e, JSON.parse(t.customStyle));
301
180
  }
302
- function rowDataToColumn(data2, configure, sourceTableColumnsConfig) {
303
- const groupByFields = configure.props.dataOrigin.groupField;
304
- const titleColumns = configure.props.dataOrigin.rowToColumn.titleColumns;
305
- const dataColumns = configure.props.dataOrigin.rowToColumn.dataColumns;
306
- const result = [];
307
- const groupedData = {};
308
- if (groupByFields && groupByFields.length > 0) {
309
- data2.forEach((item) => {
310
- const key2 = groupByFields.map((field) => item[field]).join("|");
311
- if (!groupedData[key2]) {
312
- const group = {};
313
- groupByFields.forEach((field) => group[field] = item[field]);
314
- groupedData[key2] = group;
315
- result.push(group);
316
- }
317
- dataColumns.forEach((valueField) => {
318
- const columnNameParts = titleColumns.map((field) => item[field]);
319
- const columnName = `${columnNameParts.join("")}${valueField}`;
320
- groupedData[key2][columnName] = item[valueField];
321
- });
181
+ function rowDataToColumn(e, t, o) {
182
+ const r = t.props.dataOrigin.groupField, a = t.props.dataOrigin.rowToColumn.titleColumns, n = t.props.dataOrigin.rowToColumn.dataColumns, s = [], l = {};
183
+ if (r && r.length > 0) e.forEach((e2) => {
184
+ const t2 = r.map((t3) => e2[t3]).join("|");
185
+ if (!l[t2]) {
186
+ const o2 = {};
187
+ r.forEach((t3) => o2[t3] = e2[t3]), l[t2] = o2, s.push(o2);
188
+ }
189
+ n.forEach((o2) => {
190
+ const r2 = `${a.map((t3) => e2[t3]).join("")}${o2}`;
191
+ l[t2][r2] = e2[o2];
322
192
  });
323
- } else {
324
- const titleColProp = [];
325
- data2.forEach((item) => {
326
- titleColumns.forEach((titleColumn) => {
327
- if (item[titleColumn]) {
328
- titleColProp.push(item[titleColumn]);
329
- }
193
+ });
194
+ else {
195
+ const t2 = [];
196
+ e.forEach((e2) => {
197
+ a.forEach((o2) => {
198
+ e2[o2] && t2.push(e2[o2]);
330
199
  });
331
- });
332
- dataColumns.forEach((dataColumn) => {
333
- const rowData = {};
334
- const sourceDataColumns = sourceTableColumnsConfig.find(
335
- (column) => {
336
- var _a, _b;
337
- return ((_b = (_a = column.props) == null ? void 0 : _a.base) == null ? void 0 : _b.prop) === dataColumn;
338
- }
339
- );
340
- if (sourceDataColumns) {
341
- rowData.$GroupColumn = sourceDataColumns.props.base.name;
342
- }
343
- data2.forEach((item) => {
344
- titleColumns.forEach((titleProp) => {
345
- const prop = item[titleProp];
346
- const value = item[dataColumn];
347
- rowData[prop] = value;
348
- });
200
+ }), n.forEach((t3) => {
201
+ const r2 = {}, n2 = o.find((e2) => {
202
+ var _a, _b;
203
+ return ((_b = (_a = e2.props) == null ? void 0 : _a.base) == null ? void 0 : _b.prop) === t3;
349
204
  });
350
- result.push(rowData);
205
+ n2 && (r2.$GroupColumn = n2.props.base.name), e.forEach((e2) => {
206
+ a.forEach((o2) => {
207
+ const a2 = e2[o2], n3 = e2[t3];
208
+ r2[a2] = n3;
209
+ });
210
+ }), s.push(r2);
351
211
  });
352
212
  }
353
- return result;
213
+ return s;
354
214
  }
355
- function colDataToRow(data2, configure) {
356
- const groupByFields = configure.props.dataOrigin.groupField;
357
- const titleColumns = configure.props.dataOrigin.columnToRow.titleColumns;
358
- const dataColumns = configure.props.dataOrigin.columnToRow.dataColumns;
359
- const transColumns = configure.props.dataOrigin.columnToRow.transColumns;
360
- const dataColumnsMapping = configure.props.dataOrigin.columnToRow.dataColumnsMapping;
361
- if (data2.length === 0) {
362
- return data2;
363
- }
364
- const result = [];
365
- const newData = groupBy(data2, groupByFields);
366
- const dataColumnsConfig = dataColumns.reduce((max, current) => {
367
- return current.columns.length > max.columns.length ? current : max;
368
- }, dataColumns[0]);
369
- const dataColumnsAndNewColumnMapping = dataColumns.reduce((acc, item) => {
370
- item.columns.forEach((column) => {
371
- acc[column] = item.prop;
372
- });
373
- return acc;
374
- }, {});
375
- newData.forEach((item) => {
376
- dataColumnsConfig.columns.forEach((col) => {
377
- const newColumnsProp = dataColumnsConfig.prop;
378
- const dataRow = {};
379
- groupByFields.forEach((field) => {
380
- dataRow[field] = item[field];
381
- });
382
- dataRow[newColumnsProp] = item[col];
383
- if (dataColumns.length > 1) {
384
- const columnMapping = dataColumnsMapping.find((item2) => item2.props.includes(col));
385
- if (columnMapping && columnMapping.props.length > 1) {
386
- columnMapping.props.forEach((prop) => {
387
- if (prop !== col && dataColumnsAndNewColumnMapping[prop]) {
388
- dataRow[dataColumnsAndNewColumnMapping[prop]] = item[prop];
389
- }
390
- });
391
- }
215
+ function colDataToRow(e, t) {
216
+ const o = t.props.dataOrigin.groupField, r = t.props.dataOrigin.columnToRow.titleColumns, a = t.props.dataOrigin.columnToRow.dataColumns, n = t.props.dataOrigin.columnToRow.transColumns, s = t.props.dataOrigin.columnToRow.dataColumnsMapping;
217
+ if (0 === e.length) return e;
218
+ const l = [], i = groupBy(e, o), c = a.reduce((e2, t2) => t2.columns.length > e2.columns.length ? t2 : e2, a[0]), u = a.reduce((e2, t2) => (t2.columns.forEach((o2) => {
219
+ e2[o2] = t2.prop;
220
+ }), e2), {});
221
+ return i.forEach((e2) => {
222
+ c.columns.forEach((t2) => {
223
+ const i2 = c.prop, p = {};
224
+ if (o.forEach((t3) => {
225
+ p[t3] = e2[t3];
226
+ }), p[i2] = e2[t2], a.length > 1) {
227
+ const o2 = s.find((e3) => e3.props.includes(t2));
228
+ o2 && o2.props.length > 1 && o2.props.forEach((o3) => {
229
+ o3 !== t2 && u[o3] && (p[u[o3]] = e2[o3]);
230
+ });
392
231
  }
393
- titleColumns.forEach((titleCol) => {
394
- const sourceTitleRenameConfigs = transColumns.filter(
395
- (transCol) => transCol.relatedTitle === titleCol.prop
396
- );
397
- let rename = false;
398
- if (sourceTitleRenameConfigs && sourceTitleRenameConfigs.length > 0) {
399
- sourceTitleRenameConfigs.forEach((item2) => {
400
- if (item2.columns.includes(col)) {
401
- dataRow[titleCol.prop] = item2.label;
402
- rename = true;
403
- return;
404
- }
405
- });
406
- }
407
- if (!rename) {
408
- dataRow[titleCol.prop] = col;
409
- }
410
- });
411
- result.push(dataRow);
232
+ r.forEach((e3) => {
233
+ const o2 = n.filter((t3) => t3.relatedTitle === e3.prop);
234
+ let r2 = false;
235
+ o2 && o2.length > 0 && o2.forEach((o3) => {
236
+ if (o3.columns.includes(t2)) return p[e3.prop] = o3.label, void (r2 = true);
237
+ }), r2 || (p[e3.prop] = t2);
238
+ }), l.push(p);
412
239
  });
413
- });
414
- return result;
240
+ }), l;
415
241
  }
416
- function getColumnToRowTableConfig(configure) {
417
- const sourceConfig = configure.items;
418
- const groupField = configure.props.dataOrigin.groupField;
419
- const titleColumns = configure.props.dataOrigin.columnToRow.titleColumns;
420
- const dataColumns = configure.props.dataOrigin.columnToRow.dataColumns;
421
- const newTableColumns = [];
422
- if (groupField && groupField.length > 0) {
423
- groupField.forEach((field) => {
424
- if (sourceConfig) {
425
- const column = sourceConfig.find((item) => item.props.base.prop === field);
426
- if (column) {
427
- newTableColumns.push(column);
428
- }
429
- }
430
- });
431
- }
432
- const newCols = [...titleColumns, ...dataColumns];
433
- newCols.forEach((field) => {
434
- if (sourceConfig) {
435
- const column = sourceConfig.find((item) => item.props.base.prop === field);
436
- if (column) {
437
- newTableColumns.push(column);
438
- } else {
439
- newTableColumns.push({
440
- uuid: (/* @__PURE__ */ new Date()).getTime(),
441
- // 生成新的UUID
442
- name: "",
443
- props: {
444
- base: {
445
- prop: field.prop,
446
- name: field.title,
447
- sortable: true,
448
- headerAlign: "center",
449
- align: "center",
450
- fixed: false,
451
- visible: true,
452
- dataType: "string"
453
- },
454
- format: {},
455
- size: {
456
- pc: {}
457
- }
458
- },
459
- style: {},
460
- componentIndex: 0,
461
- // 根据实际情况设置
462
- runtime: {
463
- common: {
464
- class: "",
465
- style: {
466
- pc_style: {},
467
- pc_class: ""
468
- }
469
- }
470
- }
471
- });
472
- }
242
+ function getColumnToRowTableConfig(e) {
243
+ const t = e.items, o = e.props.dataOrigin.groupField, r = e.props.dataOrigin.columnToRow.titleColumns, a = e.props.dataOrigin.columnToRow.dataColumns, n = [];
244
+ o && o.length > 0 && o.forEach((e2) => {
245
+ if (t) {
246
+ const o2 = t.find((t2) => t2.props.base.prop === e2);
247
+ o2 && n.push(o2);
473
248
  }
474
249
  });
475
- return newTableColumns;
476
- }
477
- function groupBy(data2, groupFields) {
478
- const grouped = {};
479
- data2.forEach((item) => {
480
- const key2 = groupFields.map((field) => item[field]).join("|");
481
- if (!grouped[key2]) {
482
- grouped[key2] = {
483
- ...item,
484
- // 复制所有字段
485
- records: []
486
- // 初始化记录数组
487
- };
488
- groupFields.forEach((field, index2) => {
489
- grouped[key2][field] = item[field];
490
- });
250
+ return [...r, ...a].forEach((e2) => {
251
+ if (t) {
252
+ const o2 = t.find((t2) => t2.props.base.prop === e2);
253
+ o2 ? n.push(o2) : n.push({ uuid: (/* @__PURE__ */ new Date()).getTime(), name: "", props: { base: { prop: e2.prop, name: e2.title, sortable: true, headerAlign: "center", align: "center", fixed: false, visible: true, dataType: "string" }, format: {}, size: { pc: {} } }, style: {}, componentIndex: 0, runtime: { common: { class: "", style: { pc_style: {}, pc_class: "" } } } });
491
254
  }
492
- grouped[key2].records.push(item);
493
- });
494
- return Object.values(grouped).map((group) => ({
495
- ...group,
496
- // 复制所有分组信息
497
- records: void 0
498
- // 移除records字段,因为不需要展示
499
- }));
255
+ }), n;
256
+ }
257
+ function groupBy(e, t) {
258
+ const o = {};
259
+ return e.forEach((e2) => {
260
+ const r = t.map((t2) => e2[t2]).join("|");
261
+ o[r] || (o[r] = { ...e2, records: [] }, t.forEach((t2, a) => {
262
+ o[r][t2] = e2[t2];
263
+ })), o[r].records.push(e2);
264
+ }), Object.values(o).map((e2) => ({ ...e2, records: void 0 }));
500
265
  }
501
266
  function getIndexColumn() {
502
- return {
503
- props: {
504
- base: {
505
- name: "序号",
506
- prop: "$index",
507
- columnWidth: 80,
508
- sortable: true,
509
- visible: true,
510
- displayOrder: 1,
511
- alignTitle: "center",
512
- alignContent: "center"
513
- }
514
- },
515
- events: [],
516
- style: {
517
- titleFont: {},
518
- contentFont: {},
519
- width: {},
520
- background: {},
521
- tableCell: [{ type: "", model: "" }],
522
- conentPadding: {},
523
- tittlePadding: {},
524
- border: {},
525
- shadow: {},
526
- tittleClass: ""
527
- }
528
- };
267
+ return { props: { base: { name: "序号", prop: "$index", columnWidth: 80, sortable: true, visible: true, displayOrder: 1, alignTitle: "center", alignContent: "center" } }, events: [], style: { titleFont: {}, contentFont: {}, width: {}, background: {}, tableCell: [{ type: "", model: "" }], conentPadding: {}, tittlePadding: {}, border: {}, shadow: {}, tittleClass: "" } };
529
268
  }
530
- function getNewColumnConfig(prop, name, displayOrder, dataType) {
531
- return {
532
- uuid: (/* @__PURE__ */ new Date()).getTime(),
533
- // 生成新的UUID
534
- name: "",
535
- props: {
536
- base: {
537
- prop,
538
- name,
539
- displayOrder,
540
- // 更新显示顺序
541
- sortable: true,
542
- headerAlign: "center",
543
- align: "center",
544
- fixed: false,
545
- visible: true,
546
- dataType
547
- },
548
- format: {},
549
- size: {
550
- pc: {}
551
- }
552
- },
553
- style: {},
554
- componentIndex: 0,
555
- // 根据实际情况设置
556
- runtime: {
557
- common: {
558
- class: "",
559
- style: {
560
- pc_style: {},
561
- pc_class: ""
562
- }
563
- }
564
- }
565
- };
269
+ function getNewColumnConfig(e, t, o, r) {
270
+ return { uuid: (/* @__PURE__ */ new Date()).getTime(), name: "", props: { base: { prop: e, name: t, displayOrder: o, sortable: true, headerAlign: "center", align: "center", fixed: false, visible: true, dataType: r }, format: {}, size: { pc: {} } }, style: {}, componentIndex: 0, runtime: { common: { class: "", style: { pc_style: {}, pc_class: "" } } } };
566
271
  }
567
272
  function computeFormula(itemConfs, datas, entity) {
568
273
  Object.keys(itemConfs).forEach((key) => {
569
274
  const paramNames = getParamNames(itemConfs[key]);
570
275
  datas.forEach((data, index) => {
571
276
  const totalValueMap = {};
572
- for (const paramName of paramNames) {
573
- if (paramName.startsWith("${min.")) {
574
- totalValueMap[paramName] = getMinValue(datas, getFieldName(paramName));
575
- } else if (paramName.startsWith("${max.")) {
576
- totalValueMap[paramName] = getMaxValue(datas, getFieldName(paramName));
577
- } else if (paramName.startsWith("${sum.")) {
578
- totalValueMap[paramName] = getSumValue(datas, getFieldName(paramName));
579
- } else if (paramName.startsWith("${avg.")) {
580
- totalValueMap[paramName] = getAvgValue(datas, getFieldName(paramName));
581
- } else if (paramName.startsWith("${add.")) {
582
- const fieldName = getFieldName(paramName);
583
- let currentRowValue = 0;
584
- try {
585
- currentRowValue = Number(data[fieldName]);
586
- datas.slice(0, index).forEach((item) => {
587
- currentRowValue += Number(item[fieldName]);
588
- });
589
- } catch (e) {
590
- console.error("计算错误:", e);
591
- currentRowValue = 0;
592
- }
593
- totalValueMap[paramName] = currentRowValue;
594
- } else if (paramName.startsWith("${page.") || paramName.startsWith("${data.") || paramName.startsWith("${row.") || paramName.startsWith("${request.") || paramName.startsWith("${context.") || paramName.startsWith("${system.") || paramName.startsWith("${fixed.")) {
595
- totalValueMap[paramName] = getValueFromVariable(entity, paramName, data);
277
+ for (const e of paramNames) if (e.startsWith("${min.")) totalValueMap[e] = getMinValue(datas, getFieldName(e));
278
+ else if (e.startsWith("${max.")) totalValueMap[e] = getMaxValue(datas, getFieldName(e));
279
+ else if (e.startsWith("${sum.")) totalValueMap[e] = getSumValue(datas, getFieldName(e));
280
+ else if (e.startsWith("${avg.")) totalValueMap[e] = getAvgValue(datas, getFieldName(e));
281
+ else if (e.startsWith("${add.")) {
282
+ const t = getFieldName(e);
283
+ let o = 0;
284
+ try {
285
+ o = Number(data[t]), datas.slice(0, index).forEach((e2) => {
286
+ o += Number(e2[t]);
287
+ });
288
+ } catch (e2) {
289
+ o = 0;
596
290
  }
597
- }
291
+ totalValueMap[e] = o;
292
+ } else (e.startsWith("${page.") || e.startsWith("${data.") || e.startsWith("${row.") || e.startsWith("${request.") || e.startsWith("${context.") || e.startsWith("${system.") || e.startsWith("${fixed.")) && (totalValueMap[e] = getValueFromVariable(entity, e, data));
598
293
  let expr = itemConfs[key];
599
- Object.keys(totalValueMap).forEach((exprParam) => {
600
- if (expr.indexOf(exprParam) > -1) {
601
- expr = expr.replaceAll(exprParam, totalValueMap[exprParam]);
602
- }
294
+ Object.keys(totalValueMap).forEach((e) => {
295
+ expr.indexOf(e) > -1 && (expr = expr.replaceAll(e, totalValueMap[e]));
603
296
  });
604
- for (const paramName of paramNames) {
605
- if (expr.indexOf(paramName) > -1) {
606
- expr = expr.replaceAll(paramName, 0);
607
- }
608
- }
297
+ for (const e of paramNames) expr.indexOf(e) > -1 && (expr = expr.replaceAll(e, 0));
609
298
  try {
610
299
  data[key] = eval(expr);
611
300
  } catch (e) {
612
- console.error(itemConfs[key] + " 计算错误, 替换后表达式为:" + expr, e);
613
301
  data[key] = 0;
614
302
  }
615
303
  });
616
304
  });
617
305
  }
618
- function getFieldName(paramName) {
619
- return paramName.substring(6, paramName.length - 1);
306
+ function getFieldName(e) {
307
+ return e.substring(6, e.length - 1);
620
308
  }
621
- function formatColContent(row, format, column, pageContext, configure) {
622
- const value = row[column.props.base.prop];
623
- switch (format.type) {
309
+ function formatColContent(e, t, o, r, a) {
310
+ const n = e[o.props.base.prop];
311
+ switch (t.type) {
624
312
  case "number":
625
- return formatNumber(value, format);
313
+ return formatNumber(n, t);
626
314
  case "currency":
627
- return formatCurrency(value, format);
315
+ return formatCurrency(n, t);
628
316
  case "percent":
629
- return formatPercent(value, format);
317
+ return formatPercent(n, t);
630
318
  case "custom":
631
- return formatCustomFunc(row, format, column, pageContext, configure);
319
+ return formatCustomFunc(e, t, o, r, a);
632
320
  default:
633
- return value;
321
+ return n;
634
322
  }
635
323
  }
636
- function formatNumber(value, format) {
637
- let formattedValue = value;
638
- if (!formattedValue) {
639
- formattedValue = 0;
640
- }
641
- if (format.scientific) {
642
- formattedValue = Number(value).toExponential(format.scientificNum);
643
- }
644
- if (format.decimalDigit) {
645
- formattedValue = Number(value).toFixed(format.decimalDigit);
646
- }
647
- if (format.thousandsSeparator) {
648
- formattedValue = formattedValue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
649
- }
650
- if (format.symbol) {
651
- formattedValue = `${format.symbol} ${formattedValue}`;
652
- }
653
- return formattedValue;
324
+ function formatNumber(e, t) {
325
+ let o = e;
326
+ return o || (o = 0), t.scientific && (o = Number(e).toExponential(t.scientificNum)), t.decimalDigit && (o = Number(e).toFixed(t.decimalDigit)), t.thousandsSeparator && (o = o.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")), t.symbol && (o = `${t.symbol} ${o}`), o;
654
327
  }
655
- function formatCurrency(value, format) {
656
- let formattedValue = value;
657
- if (!formattedValue) {
658
- formattedValue = 0;
659
- }
660
- if (format.decimalDigit) {
661
- formattedValue = Number(value).toFixed(format.decimalDigit);
662
- }
663
- if (format.symbol) {
664
- formattedValue = `${format.symbol} ${formattedValue}`;
665
- }
666
- return formattedValue;
328
+ function formatCurrency(e, t) {
329
+ let o = e;
330
+ return o || (o = 0), t.decimalDigit && (o = Number(e).toFixed(t.decimalDigit)), t.symbol && (o = `${t.symbol} ${o}`), o;
667
331
  }
668
- function formatPercent(value, format) {
669
- let formattedValue = value;
670
- if (!formattedValue) {
671
- formattedValue = 0;
672
- }
673
- if (format.decimalDigit) {
674
- formattedValue = Number(value).toFixed(format.decimalDigit);
675
- }
676
- return formattedValue + " %";
332
+ function formatPercent(e, t) {
333
+ let o = e;
334
+ return o || (o = 0), t.decimalDigit && (o = Number(e).toFixed(t.decimalDigit)), o + " %";
677
335
  }
678
- function formatCustomFunc(row, format, column, pageContext, configure) {
679
- const func = getCustomFunc(pageContext, format.customFunc);
680
- if (func) {
336
+ function formatCustomFunc(e, t, o, r, a) {
337
+ const n = getCustomFunc(r, t.customFunc);
338
+ if (n) {
681
339
  try {
682
- const resultValue = func.apply(func, [
683
- {
684
- pageContext,
685
- configureObj: configure,
686
- row,
687
- prop: column.props.base.prop
688
- }
689
- ]);
690
- return resultValue;
691
- } catch (error) {
692
- console.error("自定义函数脚本错误:", row, error);
340
+ return n.apply(n, [{ pageContext: r, configureObj: a, row: e, prop: o.props.base.prop }]);
341
+ } catch (e2) {
693
342
  }
694
343
  return "";
695
344
  }