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.
- package/dist/es/_virtual/_plugin-vue_export-helper.js +7 -5
- package/dist/es/assets/chart-themes/theme1.js +6 -2
- package/dist/es/assets/chart-themes/theme2.js +6 -2
- package/dist/es/assets/chart-themes/theme3.js +6 -2
- package/dist/es/components/runtime/utils/api/api-util.js +7 -4
- package/dist/es/components/runtime/utils/api/page-expose-util.js +443 -135
- package/dist/es/components/runtime/utils/assemblys-config.js +369 -13
- package/dist/es/components/runtime/utils/barcode-util.js +33 -9
- package/dist/es/components/runtime/utils/charts/chart-columnline-util.js +306 -122
- package/dist/es/components/runtime/utils/charts/chart-gauge-util.js +68 -29
- package/dist/es/components/runtime/utils/charts/chart-pie-util.js +152 -69
- package/dist/es/components/runtime/utils/charts/chart-radar-util.js +124 -46
- package/dist/es/components/runtime/utils/charts/chart-scatter-util.js +99 -38
- package/dist/es/components/runtime/utils/charts/chart-util.js +522 -226
- package/dist/es/components/runtime/utils/common-util.js +156 -76
- package/dist/es/components/runtime/utils/eventBus.js +8 -3
- package/dist/es/components/runtime/utils/events/event-util.js +775 -362
- package/dist/es/components/runtime/utils/events/print-label.js +140 -73
- package/dist/es/components/runtime/utils/events/standard-event.js +2320 -820
- package/dist/es/components/runtime/utils/events/validator-util.js +560 -224
- package/dist/es/components/runtime/utils/form/date-shortcuts.js +88 -28
- package/dist/es/components/runtime/utils/form/scan-util.js +162 -62
- package/dist/es/components/runtime/utils/global-refs.js +84 -53
- package/dist/es/components/runtime/utils/i18n-util.js +20 -11
- package/dist/es/components/runtime/utils/interfaces/page-design-types.js +7 -2
- package/dist/es/components/runtime/utils/page-helper-util.js +660 -280
- package/dist/es/components/runtime/utils/page-init-util.js +405 -144
- package/dist/es/components/runtime/utils/page-permission-util.js +531 -22
- package/dist/es/components/runtime/utils/page-store.js +68 -23
- package/dist/es/components/runtime/utils/store-util.js +13 -9
- package/dist/es/components/runtime/utils/store.js +2 -2
- package/dist/es/components/runtime/utils/table-utils.js +81 -40
- package/dist/es/components/runtime/utils/tree-utils.js +37 -17
- package/dist/es/components/runtime/views/assemblys/button/button/button-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/button/button/button-runtime.vue2.js +83 -21
- package/dist/es/components/runtime/views/assemblys/button/button-group/buttongroup-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/button/button-group/buttongroup-runtime.vue2.js +46 -14
- package/dist/es/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue2.js +132 -36
- package/dist/es/components/runtime/views/assemblys/button/export-pdf/exportpdf-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/button/export-pdf/exportpdf-runtime.vue2.js +18 -4
- package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue2.js +107 -17
- package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue2.js +198 -54
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-breadcrumb.vue.js +42 -12
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-breadcrumb.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-group.vue.js +60 -11
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-group.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header.vue.js +203 -54
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/common/common-homepage-search.vue.js +4 -4
- package/dist/es/components/runtime/views/assemblys/chart/common/common-homepage-search.vue2.js +162 -46
- package/dist/es/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue2.js +109 -33
- package/dist/es/components/runtime/views/assemblys/chart/pie/pie-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/pie/pie-runtime.vue2.js +166 -44
- package/dist/es/components/runtime/views/assemblys/chart/radar/radar-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/radar/radar-runtime.vue2.js +117 -33
- package/dist/es/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue2.js +118 -33
- package/dist/es/components/runtime/views/assemblys/chart/table/chart-table-util.js +599 -253
- package/dist/es/components/runtime/views/assemblys/chart/table/group-column-item.vue.js +42 -4
- package/dist/es/components/runtime/views/assemblys/chart/table/group-column-item.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/table/group-column.vue.js +62 -8
- package/dist/es/components/runtime/views/assemblys/chart/table/group-column.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue.js +160 -29
- package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/table/table-pageination.vue.js +62 -13
- package/dist/es/components/runtime/views/assemblys/chart/table/table-pageination.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/table/table-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/chart/table/table-runtime.vue2.js +594 -213
- package/dist/es/components/runtime/views/assemblys/common/export-form-report-dialog.vue.js +139 -33
- package/dist/es/components/runtime/views/assemblys/common/export-form-report-dialog.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/common/remove-signer-dialog.vue.js +125 -21
- package/dist/es/components/runtime/views/assemblys/common/remove-signer-dialog.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/common/task-informition-dialog.vue.js +102 -16
- package/dist/es/components/runtime/views/assemblys/common/task-informition-dialog.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/card/card-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/card/card-runtime.vue2.js +81 -18
- package/dist/es/components/runtime/views/assemblys/container/collapse/collapse-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/collapse/collapse-runtime.vue2.js +82 -17
- package/dist/es/components/runtime/views/assemblys/container/container/container-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/container/container-runtime.vue2.js +86 -14
- package/dist/es/components/runtime/views/assemblys/container/flex/flex-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/flex/flex-runtime.vue2.js +79 -21
- package/dist/es/components/runtime/views/assemblys/container/form/form-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/form/form-runtime.vue2.js +61 -16
- package/dist/es/components/runtime/views/assemblys/container/iframe/iframe-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/iframe/iframe-runtime.vue2.js +37 -10
- package/dist/es/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue2.js +127 -38
- package/dist/es/components/runtime/views/assemblys/container/tools/tools-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/container/tools/tools-runtime.vue2.js +76 -28
- package/dist/es/components/runtime/views/assemblys/data/bar-code/barcode-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/data/bar-code/barcode-runtime.vue2.js +178 -63
- package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +810 -305
- package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +635 -265
- package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/data/table/table-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/data/table/table-runtime.vue2.js +115 -40
- package/dist/es/components/runtime/views/assemblys/data/tree/tree-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/data/tree/tree-runtime.vue2.js +215 -56
- package/dist/es/components/runtime/views/assemblys/error-render.vue.js +21 -3
- package/dist/es/components/runtime/views/assemblys/error-render.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue2.js +154 -43
- package/dist/es/components/runtime/views/assemblys/form/common/title-suffix-element.vue.js +98 -34
- package/dist/es/components/runtime/views/assemblys/form/common/title-suffix-element.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/custom/custom-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/custom/custom-runtime.vue2.js +200 -52
- package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +239 -70
- package/dist/es/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue2.js +109 -31
- package/dist/es/components/runtime/views/assemblys/form/divider/divider-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/divider/divider-runtime.vue2.js +59 -21
- package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue2.js +188 -56
- package/dist/es/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue2.js +103 -22
- package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue2.js +246 -59
- package/dist/es/components/runtime/views/assemblys/form/label/label-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/label/label-runtime.vue2.js +174 -34
- package/dist/es/components/runtime/views/assemblys/form/link/link-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/link/link-runtime.vue2.js +107 -29
- package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue.js +4 -4
- package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue2.js +50 -13
- package/dist/es/components/runtime/views/assemblys/form/radio/radio-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/radio/radio-runtime.vue2.js +194 -65
- package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue2.js +249 -89
- package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue2.js +263 -80
- package/dist/es/components/runtime/views/assemblys/form/separatelabel/separatelabel-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/separatelabel/separatelabel-runtime.vue2.js +57 -13
- package/dist/es/components/runtime/views/assemblys/form/switch/switch-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/switch/switch-runtime.vue2.js +155 -30
- package/dist/es/components/runtime/views/assemblys/form/tag/tag-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/tag/tag-runtime.vue2.js +129 -40
- package/dist/es/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue2.js +107 -22
- package/dist/es/components/runtime/views/assemblys/home-chart-render.vue.js +188 -89
- package/dist/es/components/runtime/views/assemblys/home-chart-render.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/object-render.vue.js +272 -133
- package/dist/es/components/runtime/views/assemblys/object-render.vue2.js +2 -2
- package/dist/es/components/runtime/views/assemblys/workflow/picture-flow/pictureflow-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/workflow/picture-flow/pictureflow-runtime.vue2.js +46 -18
- package/dist/es/components/runtime/views/assemblys/workflow/text-history/textflow-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/workflow/text-history/textflow-runtime.vue2.js +49 -21
- package/dist/es/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue2.js +58 -20
- package/dist/es/components/runtime/views/assemblys/workflow/workflow-node/workflownode-runtime.vue.js +2 -2
- package/dist/es/components/runtime/views/assemblys/workflow/workflow-node/workflownode-runtime.vue2.js +53 -16
- package/dist/es/components/runtime/views/home-chart.vue.js +160 -41
- package/dist/es/components/runtime/views/home-chart.vue2.js +2 -2
- package/dist/es/components/runtime/views/super-page-dialog.vue.js +139 -21
- package/dist/es/components/runtime/views/super-page-dialog.vue2.js +2 -2
- package/dist/es/components/runtime/views/super-page.vue.js +756 -230
- package/dist/es/components/runtime/views/super-page.vue2.js +2 -2
- package/dist/es/i18n/langs/cn.js +55 -2
- package/dist/es/i18n/langs/en.js +55 -2
- package/package.json +2 -2
|
@@ -2,348 +2,694 @@ 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(
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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) {
|
|
20
35
|
case "EQ":
|
|
21
|
-
return `${
|
|
36
|
+
return `${parsedValue} === ${parsedPropValue}`;
|
|
22
37
|
case "GT":
|
|
23
|
-
return `${
|
|
38
|
+
return `${parsedValue} > ${parsedPropValue}`;
|
|
24
39
|
case "LT":
|
|
25
|
-
return `${
|
|
40
|
+
return `${parsedValue} < ${parsedPropValue}`;
|
|
26
41
|
case "GET":
|
|
27
|
-
return `${
|
|
42
|
+
return `${parsedValue} >= ${parsedPropValue}`;
|
|
28
43
|
case "LET":
|
|
29
|
-
return `${
|
|
44
|
+
return `${parsedValue} <= ${parsedPropValue}`;
|
|
30
45
|
case "NET":
|
|
31
|
-
return `${
|
|
46
|
+
return `${parsedValue} !== ${parsedPropValue}`;
|
|
32
47
|
case "CONTAIN":
|
|
33
|
-
return `${
|
|
48
|
+
return `${parsedValue}.includes(${parsedPropValue})`;
|
|
34
49
|
case "NOT_CONTAIN":
|
|
35
|
-
return `!${
|
|
50
|
+
return `!${parsedValue}.includes(${parsedPropValue})`;
|
|
36
51
|
case "IS_NULL":
|
|
37
|
-
return `${
|
|
52
|
+
return `${parsedValue} === null`;
|
|
38
53
|
case "IS_NOT_NULL":
|
|
39
|
-
return `${
|
|
54
|
+
return `${parsedValue} !== null`;
|
|
40
55
|
default:
|
|
41
|
-
throw new Error(`比较符号不匹配: ${
|
|
56
|
+
throw new Error(`比较符号不匹配: ${operator}`);
|
|
42
57
|
}
|
|
43
58
|
}
|
|
44
|
-
static changeDataType(
|
|
45
|
-
let
|
|
46
|
-
|
|
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;
|
|
47
71
|
}
|
|
48
|
-
static parseValue(
|
|
49
|
-
|
|
72
|
+
static parseValue(value, dataType) {
|
|
73
|
+
dataType = this.changeDataType(dataType);
|
|
74
|
+
switch (dataType) {
|
|
50
75
|
case "number":
|
|
51
|
-
return Number(
|
|
76
|
+
return Number(value);
|
|
52
77
|
case "date":
|
|
53
|
-
return new Date(
|
|
78
|
+
return new Date(value).getTime();
|
|
54
79
|
case "string":
|
|
55
|
-
return `"${
|
|
80
|
+
return `"${value}"`;
|
|
56
81
|
default:
|
|
57
|
-
throw new Error(`数据类型解析错误: ${
|
|
82
|
+
throw new Error(`数据类型解析错误: ${dataType}`);
|
|
58
83
|
}
|
|
59
84
|
}
|
|
60
85
|
static evaluateExpression(expression) {
|
|
61
86
|
try {
|
|
62
87
|
return eval(expression);
|
|
63
|
-
} catch (
|
|
64
|
-
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.error("表达式错误:", expression, error);
|
|
90
|
+
return false;
|
|
65
91
|
}
|
|
66
92
|
}
|
|
67
93
|
}
|
|
68
|
-
function getSummaryTitleColumn(
|
|
94
|
+
function getSummaryTitleColumn(configure) {
|
|
69
95
|
var _a;
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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;
|
|
74
103
|
}
|
|
75
|
-
function getSummaryDataColumn(
|
|
104
|
+
function getSummaryDataColumn(configure, type) {
|
|
76
105
|
var _a;
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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;
|
|
83
123
|
}
|
|
84
|
-
function summaryStatistics(
|
|
85
|
-
let
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
+
}
|
|
94
162
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
case "sum":
|
|
98
|
-
a = ` ${s.reduce((e2, t2) => e2 + t2, 0)}`;
|
|
99
|
-
break;
|
|
100
|
-
case "avg":
|
|
101
|
-
a = " " + s.reduce((e2, t2) => e2 + t2, 0) / s.length;
|
|
102
|
-
break;
|
|
103
|
-
case "min":
|
|
104
|
-
a = ` ${Math.min(...s)}`;
|
|
105
|
-
break;
|
|
106
|
-
case "max":
|
|
107
|
-
a = ` ${Math.max(...s)}`;
|
|
108
|
-
break;
|
|
109
|
-
default:
|
|
110
|
-
a = " N/A";
|
|
163
|
+
} else {
|
|
164
|
+
sumsIndex = " N/A";
|
|
111
165
|
}
|
|
112
|
-
|
|
113
|
-
return a;
|
|
166
|
+
return sumsIndex;
|
|
114
167
|
}
|
|
115
|
-
function replacePlaceholders(
|
|
116
|
-
if (
|
|
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
|
+
}
|
|
117
174
|
}
|
|
118
|
-
function getHeaderCellStyleUtil(
|
|
175
|
+
function getHeaderCellStyleUtil(data2, runtimeStyle, props) {
|
|
119
176
|
var _a;
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
+
}
|
|
128
196
|
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
const
|
|
132
|
-
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
const cellTitleStytle = getCellStyleUtil(data2, runtimeStyle.cellTitleStyle, props);
|
|
200
|
+
if (cellTitleStytle) {
|
|
201
|
+
Object.assign(headerStyle, cellTitleStytle);
|
|
202
|
+
}
|
|
203
|
+
return headerStyle;
|
|
133
204
|
}
|
|
134
|
-
function getRowStyleUtil(
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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);
|
|
145
242
|
}
|
|
146
|
-
} else if (a.matchingCondition) {
|
|
147
|
-
const t3 = ExpressionEvaluator.evaluate(o.pageContext, a.matchingCondition, e.row);
|
|
148
|
-
(t3 || void 0 === t3) && copyStyle(r, a);
|
|
149
|
-
} else copyStyle(r, a);
|
|
150
|
-
}
|
|
151
|
-
if (t && t.length > 0 && -1 !== t.indexOf(e.rowIndex)) {
|
|
152
|
-
const e2 = {};
|
|
153
|
-
if (o.configure.style.collectStyle && o.configure.style.collectStyle.length > 0) for (let t2 = 0; t2 < o.configure.style.collectStyle.length; t2++) {
|
|
154
|
-
copyStyle(e2, o.configure.style.collectStyle[t2]);
|
|
155
243
|
}
|
|
156
|
-
|
|
244
|
+
if (Object.keys(result).length === 0) {
|
|
245
|
+
result["background-color"] = "var(--el-table-row-hover-bg-color)";
|
|
246
|
+
}
|
|
247
|
+
return result;
|
|
157
248
|
}
|
|
158
|
-
return
|
|
249
|
+
return returnStyle;
|
|
159
250
|
}
|
|
160
|
-
function getCellStyleUtil(
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
+
}
|
|
170
281
|
}
|
|
171
|
-
}
|
|
172
|
-
const t2 = ExpressionEvaluator.evaluate(o.pageContext, n.matchingCondition, e.row);
|
|
173
|
-
(t2 || void 0 === t2) && copyStyle(r, n);
|
|
174
|
-
} else copyStyle(r, n);
|
|
282
|
+
}
|
|
175
283
|
}
|
|
176
|
-
return
|
|
284
|
+
return cellStyle;
|
|
177
285
|
}
|
|
178
|
-
function isSetStyle(
|
|
179
|
-
let
|
|
180
|
-
|
|
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;
|
|
181
295
|
}
|
|
182
|
-
function copyStyle(
|
|
183
|
-
Object.assign(
|
|
296
|
+
function copyStyle(target, source) {
|
|
297
|
+
Object.assign(target, source.style);
|
|
298
|
+
if (source.customStyle) {
|
|
299
|
+
Object.assign(target, JSON.parse(source.customStyle));
|
|
300
|
+
}
|
|
184
301
|
}
|
|
185
|
-
function rowDataToColumn(
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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];
|
|
203
321
|
});
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
322
|
+
});
|
|
323
|
+
} else {
|
|
324
|
+
const titleColProp = [];
|
|
325
|
+
data2.forEach((item) => {
|
|
326
|
+
titleColumns.forEach((titleColumn) => {
|
|
327
|
+
if (item[titleColumn]) {
|
|
328
|
+
titleColProp.push(item[titleColumn]);
|
|
329
|
+
}
|
|
208
330
|
});
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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;
|
|
213
348
|
});
|
|
214
|
-
})
|
|
349
|
+
});
|
|
350
|
+
result.push(rowData);
|
|
215
351
|
});
|
|
216
352
|
}
|
|
217
|
-
return
|
|
353
|
+
return result;
|
|
218
354
|
}
|
|
219
|
-
function colDataToRow(
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
+
}
|
|
235
392
|
}
|
|
236
|
-
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
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);
|
|
243
412
|
});
|
|
244
|
-
})
|
|
413
|
+
});
|
|
414
|
+
return result;
|
|
245
415
|
}
|
|
246
|
-
function getColumnToRowTableConfig(
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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
|
+
}
|
|
252
473
|
}
|
|
253
474
|
});
|
|
254
|
-
return
|
|
255
|
-
if (t) {
|
|
256
|
-
const o2 = t.find((t2) => t2.props.base.prop === e2);
|
|
257
|
-
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: "" } } } });
|
|
258
|
-
}
|
|
259
|
-
}), n;
|
|
475
|
+
return newTableColumns;
|
|
260
476
|
}
|
|
261
|
-
function groupBy(
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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
|
+
});
|
|
491
|
+
}
|
|
492
|
+
grouped[key2].records.push(item);
|
|
493
|
+
});
|
|
494
|
+
return Object.values(grouped).map((group) => ({
|
|
495
|
+
...group,
|
|
496
|
+
// 复制所有分组信息
|
|
497
|
+
records: void 0
|
|
498
|
+
// 移除records字段,因为不需要展示
|
|
499
|
+
}));
|
|
269
500
|
}
|
|
270
501
|
function getIndexColumn() {
|
|
271
|
-
return {
|
|
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
|
+
};
|
|
272
529
|
}
|
|
273
|
-
function getNewColumnConfig(
|
|
274
|
-
return {
|
|
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
|
+
};
|
|
275
566
|
}
|
|
276
567
|
function computeFormula(itemConfs, datas, entity) {
|
|
277
568
|
Object.keys(itemConfs).forEach((key) => {
|
|
278
569
|
const paramNames = getParamNames(itemConfs[key]);
|
|
279
570
|
datas.forEach((data, index) => {
|
|
280
571
|
const totalValueMap = {};
|
|
281
|
-
for (const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
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);
|
|
294
596
|
}
|
|
295
|
-
|
|
296
|
-
} 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));
|
|
597
|
+
}
|
|
297
598
|
let expr = itemConfs[key];
|
|
298
|
-
Object.keys(totalValueMap).forEach((
|
|
299
|
-
expr.indexOf(
|
|
599
|
+
Object.keys(totalValueMap).forEach((exprParam) => {
|
|
600
|
+
if (expr.indexOf(exprParam) > -1) {
|
|
601
|
+
expr = expr.replaceAll(exprParam, totalValueMap[exprParam]);
|
|
602
|
+
}
|
|
300
603
|
});
|
|
301
|
-
for (const
|
|
604
|
+
for (const paramName of paramNames) {
|
|
605
|
+
if (expr.indexOf(paramName) > -1) {
|
|
606
|
+
expr = expr.replaceAll(paramName, 0);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
302
609
|
try {
|
|
303
610
|
data[key] = eval(expr);
|
|
304
611
|
} catch (e) {
|
|
305
|
-
console.error(itemConfs[key] + " 计算错误, 替换后表达式为:" + expr, e)
|
|
612
|
+
console.error(itemConfs[key] + " 计算错误, 替换后表达式为:" + expr, e);
|
|
613
|
+
data[key] = 0;
|
|
306
614
|
}
|
|
307
615
|
});
|
|
308
616
|
});
|
|
309
617
|
}
|
|
310
|
-
function getFieldName(
|
|
311
|
-
return
|
|
618
|
+
function getFieldName(paramName) {
|
|
619
|
+
return paramName.substring(6, paramName.length - 1);
|
|
312
620
|
}
|
|
313
|
-
function formatColContent(
|
|
314
|
-
const
|
|
315
|
-
switch (
|
|
621
|
+
function formatColContent(row, format, column, pageContext, configure) {
|
|
622
|
+
const value = row[column.props.base.prop];
|
|
623
|
+
switch (format.type) {
|
|
316
624
|
case "number":
|
|
317
|
-
return formatNumber(
|
|
625
|
+
return formatNumber(value, format);
|
|
318
626
|
case "currency":
|
|
319
|
-
return formatCurrency(
|
|
627
|
+
return formatCurrency(value, format);
|
|
320
628
|
case "percent":
|
|
321
|
-
return formatPercent(
|
|
629
|
+
return formatPercent(value, format);
|
|
322
630
|
case "custom":
|
|
323
|
-
return formatCustomFunc(
|
|
631
|
+
return formatCustomFunc(row, format, column, pageContext, configure);
|
|
324
632
|
default:
|
|
325
|
-
return
|
|
633
|
+
return value;
|
|
326
634
|
}
|
|
327
635
|
}
|
|
328
|
-
function formatNumber(
|
|
329
|
-
let
|
|
330
|
-
|
|
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;
|
|
331
654
|
}
|
|
332
|
-
function formatCurrency(
|
|
333
|
-
let
|
|
334
|
-
|
|
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;
|
|
335
667
|
}
|
|
336
|
-
function formatPercent(
|
|
337
|
-
let
|
|
338
|
-
|
|
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 + " %";
|
|
339
677
|
}
|
|
340
|
-
function formatCustomFunc(
|
|
341
|
-
const
|
|
342
|
-
if (
|
|
678
|
+
function formatCustomFunc(row, format, column, pageContext, configure) {
|
|
679
|
+
const func = getCustomFunc(pageContext, format.customFunc);
|
|
680
|
+
if (func) {
|
|
343
681
|
try {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
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);
|
|
347
693
|
}
|
|
348
694
|
return "";
|
|
349
695
|
}
|