super-page-runtime 2.2.26 → 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 -68
- 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 -36
- package/dist/es/components/runtime/utils/charts/chart-util.js +522 -224
- 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 -72
- package/dist/es/components/runtime/utils/events/standard-event.js +2320 -808
- 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 -61
- 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 -279
- package/dist/es/components/runtime/utils/page-init-util.js +406 -141
- 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 -50
- 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 -7
- 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 -52
- 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 -32
- 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 -43
- 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 -32
- 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 -32
- package/dist/es/components/runtime/views/assemblys/chart/table/chart-table-util.js +597 -246
- 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 -212
- package/dist/es/components/runtime/views/assemblys/common/export-form-report-dialog.vue.js +139 -29
- 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 -61
- package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +810 -302
- 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 -262
- 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 -42
- 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 -68
- 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 +245 -57
- 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 -32
- 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 -28
- 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 -64
- 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 -88
- 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 -40
- package/dist/es/components/runtime/views/home-chart.vue2.js +2 -2
- package/dist/es/components/runtime/views/super-page-dialog.vue.js +139 -20
- package/dist/es/components/runtime/views/super-page-dialog.vue2.js +2 -2
- package/dist/es/components/runtime/views/super-page.vue.js +754 -226
- 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
|
@@ -1,80 +1,164 @@
|
|
|
1
|
-
import { getValueFromSource
|
|
2
|
-
import { deepCopy
|
|
3
|
-
import { CommonName
|
|
4
|
-
function
|
|
5
|
-
if (!
|
|
6
|
-
|
|
7
|
-
let g = a && a.groupValue ? a.groupValue : void 0;
|
|
8
|
-
const m = u.serviceDataField;
|
|
9
|
-
let h = null;
|
|
10
|
-
m ? h = f[m] : f && (h = Array.isArray(f) ? f : [f]), h || (h = []);
|
|
11
|
-
let d = u.props ? u.props.groups : null;
|
|
12
|
-
if (d || (d = []), !g || 0 === g.length) {
|
|
13
|
-
g = [];
|
|
14
|
-
for (const o2 of d) g.push(o2.group);
|
|
1
|
+
import { getValueFromSource, setValueForVariableName } from "../page-helper-util.js";
|
|
2
|
+
import { deepCopy } from "../common-util.js";
|
|
3
|
+
import { CommonName, caculateFormulaValue, executeChartFormula, sortDatas, limitDatas } from "./chart-util.js";
|
|
4
|
+
function updateChartOption(pageContext, configure, chartOption, resultData) {
|
|
5
|
+
if (!resultData || !resultData.result) {
|
|
6
|
+
return;
|
|
15
7
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
const result = resultData && resultData.result ? resultData.result : {};
|
|
9
|
+
let groupValue = resultData && resultData.groupValue ? resultData.groupValue : void 0;
|
|
10
|
+
const dataSetField = configure.serviceDataField;
|
|
11
|
+
let datas = null;
|
|
12
|
+
if (dataSetField) {
|
|
13
|
+
datas = result[dataSetField];
|
|
14
|
+
} else {
|
|
15
|
+
if (result) {
|
|
16
|
+
if (Array.isArray(result)) {
|
|
17
|
+
datas = result;
|
|
18
|
+
} else {
|
|
19
|
+
datas = [result];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (!datas) {
|
|
24
|
+
datas = [];
|
|
25
|
+
}
|
|
26
|
+
let confGroups = configure.props ? configure.props.groups : null;
|
|
27
|
+
if (!confGroups) {
|
|
28
|
+
confGroups = [];
|
|
29
|
+
}
|
|
30
|
+
if (!groupValue || groupValue.length === 0) {
|
|
31
|
+
groupValue = [];
|
|
32
|
+
for (const g of confGroups) {
|
|
33
|
+
groupValue.push(g.group);
|
|
26
34
|
}
|
|
27
|
-
const e2 = r2.join(E);
|
|
28
|
-
t2[s.X_FIELD_NAME] = e2;
|
|
29
35
|
}
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const p2 = {};
|
|
40
|
-
for (const r3 of h) {
|
|
41
|
-
if (!r3) continue;
|
|
42
|
-
for (const s3 of t2) {
|
|
43
|
-
const t3 = o(r3, s3, void 0);
|
|
44
|
-
let e2 = p2[s3];
|
|
45
|
-
void 0 === t3 || isNaN(t3) || (void 0 === e2 ? e2 = t3 : e2 += t3), p2[s3] = e2;
|
|
36
|
+
const groupMap = {};
|
|
37
|
+
const groupFields = [];
|
|
38
|
+
const realGroupFilds = [];
|
|
39
|
+
for (const g of confGroups) {
|
|
40
|
+
groupMap[g.group] = g.target;
|
|
41
|
+
if (g.target && !groupFields.includes(g.target)) {
|
|
42
|
+
groupFields.push(g.target);
|
|
43
|
+
if (groupValue.includes(g.group)) {
|
|
44
|
+
realGroupFilds.push(g.target);
|
|
46
45
|
}
|
|
47
|
-
const s2 = l(n2, p2, r3, i2);
|
|
48
|
-
r3[_] = s2;
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
let mulGroupShow = configure.props ? configure.props.mulGroupShow : "";
|
|
49
|
+
mulGroupShow = mulGroupShow == "break" ? "\r\n" : " ";
|
|
50
|
+
console.log("groupValue", groupValue);
|
|
51
|
+
for (const d of datas) {
|
|
52
|
+
if (!d) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const xValues2 = [];
|
|
56
|
+
for (const g of groupValue) {
|
|
57
|
+
const fieldName = groupMap[g];
|
|
58
|
+
const value = getValueFromSource(d, fieldName, void 0);
|
|
59
|
+
if (value) {
|
|
60
|
+
xValues2.push(value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const xValue = xValues2.join(mulGroupShow);
|
|
64
|
+
d[CommonName.X_FIELD_NAME] = xValue;
|
|
58
65
|
}
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
const itemConfs = configure.items ? configure.items : [];
|
|
67
|
+
if (itemConfs.length == 0) {
|
|
68
|
+
console.log("饼图的系列为空,操作失败!", configure);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const confProps = configure.props ? configure.props : {};
|
|
72
|
+
let valueField = confProps.yaxisField;
|
|
73
|
+
console.log("valueField", valueField);
|
|
74
|
+
itemConfs[0].props.yaxisField = valueField;
|
|
75
|
+
itemConfs[0].props.yaxisSource = confProps.yaxisSource;
|
|
76
|
+
itemConfs[0].props.formula = confProps.formula;
|
|
77
|
+
if (confProps.yaxisSource === "formula") {
|
|
78
|
+
const accumulateFields = [];
|
|
79
|
+
const totalValueMap = caculateFormulaValue(itemConfs, datas, accumulateFields);
|
|
80
|
+
let formula = confProps.formula ? confProps.formula : "";
|
|
81
|
+
for (const paramName in totalValueMap) {
|
|
82
|
+
formula = formula.replace(
|
|
83
|
+
new RegExp(paramName.replace("$", "\\$"), "g"),
|
|
84
|
+
totalValueMap[paramName]
|
|
85
|
+
);
|
|
70
86
|
}
|
|
71
|
-
|
|
87
|
+
valueField = CommonName.Y_TEMP_NAME;
|
|
88
|
+
const cumulativeMap = {};
|
|
89
|
+
for (const data of datas) {
|
|
90
|
+
if (!data) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
for (const cumulativeField of accumulateFields) {
|
|
94
|
+
const value2 = getValueFromSource(data, cumulativeField, void 0);
|
|
95
|
+
let hisValue = cumulativeMap[cumulativeField];
|
|
96
|
+
if (value2 !== void 0 && !isNaN(value2)) {
|
|
97
|
+
if (hisValue === void 0) {
|
|
98
|
+
hisValue = value2;
|
|
99
|
+
} else {
|
|
100
|
+
hisValue = hisValue + value2;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
cumulativeMap[cumulativeField] = hisValue;
|
|
104
|
+
}
|
|
105
|
+
console.log("formula", formula);
|
|
106
|
+
const value = executeChartFormula(formula, cumulativeMap, data, pageContext);
|
|
107
|
+
console.log("formula-result", value);
|
|
108
|
+
data[valueField] = value;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
itemConfs[0].props.yaxisField = valueField;
|
|
112
|
+
itemConfs[0].props.yaxisSource = "";
|
|
113
|
+
sortDatas(pageContext, configure, datas);
|
|
114
|
+
datas = limitDatas(pageContext, configure, datas, groupFields, [valueField]);
|
|
115
|
+
const xValues = [];
|
|
116
|
+
const yValues = [];
|
|
117
|
+
for (const data of datas) {
|
|
118
|
+
if (!data) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
xValues.push(data[CommonName.X_FIELD_NAME]);
|
|
122
|
+
const value = getValueFromSource(data, valueField, void 0);
|
|
123
|
+
yValues.push(value);
|
|
124
|
+
}
|
|
125
|
+
const defaultSeries = configure.defaultSeries;
|
|
126
|
+
let pieColors = defaultSeries[0].pieColors;
|
|
127
|
+
pieColors = pieColors ? pieColors : [];
|
|
128
|
+
let pieColorMap = defaultSeries[0].pieColorMap;
|
|
129
|
+
pieColorMap = pieColorMap ? pieColorMap : {};
|
|
130
|
+
const pieDatas = [];
|
|
131
|
+
for (let index = 0; index < xValues.length && index < yValues.length; index++) {
|
|
132
|
+
const data = {
|
|
133
|
+
value: yValues[index],
|
|
134
|
+
name: xValues[index]
|
|
135
|
+
};
|
|
136
|
+
if (index < pieColors.length || pieColorMap[data.name]) {
|
|
137
|
+
let color = pieColorMap[data.name];
|
|
138
|
+
if (!color) {
|
|
139
|
+
color = pieColors[index];
|
|
140
|
+
}
|
|
141
|
+
if (color) {
|
|
142
|
+
data.itemStyle = {
|
|
143
|
+
color
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
pieDatas.push(data);
|
|
148
|
+
}
|
|
149
|
+
const tempSeries = deepCopy(defaultSeries);
|
|
150
|
+
tempSeries[0].data = pieDatas;
|
|
151
|
+
chartOption.series = [tempSeries[0]];
|
|
152
|
+
const selGroupVariable = configure.props ? configure.props.selGroupVariable : null;
|
|
153
|
+
const enableDrill = configure.props ? configure.props.enableDrill : null;
|
|
154
|
+
if (!enableDrill && selGroupVariable) {
|
|
155
|
+
configure.highlightInfos = [];
|
|
156
|
+
setValueForVariableName(pageContext.entity, selGroupVariable, null);
|
|
72
157
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
!(u.props ? u.props.enableDrill : null) && I && (u.highlightInfos = [], t(i2.entity, I, null)), u.groupFields = v, u.cacheDatas = h, u.rawResult = a;
|
|
158
|
+
configure.groupFields = realGroupFilds;
|
|
159
|
+
configure.cacheDatas = datas;
|
|
160
|
+
configure.rawResult = resultData;
|
|
77
161
|
}
|
|
78
162
|
export {
|
|
79
|
-
|
|
163
|
+
updateChartOption
|
|
80
164
|
};
|
|
@@ -1,54 +1,132 @@
|
|
|
1
|
-
import { getValueFromSource
|
|
2
|
-
import { deepCopy
|
|
3
|
-
import { caculateFormulaValue
|
|
4
|
-
function
|
|
5
|
-
if (!
|
|
6
|
-
|
|
7
|
-
let d = null;
|
|
8
|
-
f ? d = u[f] : u && (d = Array.isArray(u) ? u : [u]), d || (d = []);
|
|
9
|
-
const n = s.items ? s.items : [], c = [], p = {}, m = [], x = i(n, d, m);
|
|
10
|
-
for (const e2 of n) {
|
|
11
|
-
const o2 = e2.props ? e2.props : {}, i2 = o2.yaxisSource, t2 = o2.yaxisField;
|
|
12
|
-
let a3 = null;
|
|
13
|
-
if (!t2 || i2 && "variable" != i2) if ("formula" == i2) {
|
|
14
|
-
let i3 = o2.formula ? o2.formula : "";
|
|
15
|
-
for (const e3 in x) i3 = i3.replace(new RegExp(e3.replace("$", "\\$"), "g"), x[e3]);
|
|
16
|
-
a3 = { uuid: e2.uuid, type: "formula", formula: i3, data: [] };
|
|
17
|
-
} else a3 = { uuid: e2.uuid, type: "fixed", field: o2.yaxisFix, data: [] };
|
|
18
|
-
else a3 = { uuid: e2.uuid, type: "variable", field: t2, data: [] };
|
|
19
|
-
a3 && (c.push(a3), p[a3.uuid] = a3);
|
|
1
|
+
import { getValueFromSource } from "../page-helper-util.js";
|
|
2
|
+
import { deepCopy } from "../common-util.js";
|
|
3
|
+
import { caculateFormulaValue, executeChartFormula } from "./chart-util.js";
|
|
4
|
+
function updateChartOption(pageContext, configure, chartOption, resultData) {
|
|
5
|
+
if (!resultData || !resultData.result) {
|
|
6
|
+
return;
|
|
20
7
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
8
|
+
const result = resultData && resultData.result ? resultData.result : {};
|
|
9
|
+
const dataSetField = configure.serviceDataField;
|
|
10
|
+
let datas = null;
|
|
11
|
+
if (dataSetField) {
|
|
12
|
+
datas = result[dataSetField];
|
|
13
|
+
} else {
|
|
14
|
+
if (result) {
|
|
15
|
+
if (Array.isArray(result)) {
|
|
16
|
+
datas = result;
|
|
17
|
+
} else {
|
|
18
|
+
datas = [result];
|
|
19
|
+
}
|
|
31
20
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
21
|
+
}
|
|
22
|
+
if (!datas) {
|
|
23
|
+
datas = [];
|
|
24
|
+
}
|
|
25
|
+
const itemConfs = configure.items ? configure.items : [];
|
|
26
|
+
const dataConfs = [];
|
|
27
|
+
const dataValueMap = {};
|
|
28
|
+
const accumulateFields = [];
|
|
29
|
+
const totalValueMap = caculateFormulaValue(itemConfs, datas, accumulateFields);
|
|
30
|
+
for (const item of itemConfs) {
|
|
31
|
+
const itemProps = item.props ? item.props : {};
|
|
32
|
+
const sourceType = itemProps.yaxisSource;
|
|
33
|
+
const yaxisField = itemProps.yaxisField;
|
|
34
|
+
let dataConf = null;
|
|
35
|
+
if (yaxisField && (!sourceType || sourceType == "variable")) {
|
|
36
|
+
dataConf = {
|
|
37
|
+
uuid: item.uuid,
|
|
38
|
+
type: "variable",
|
|
39
|
+
field: yaxisField,
|
|
40
|
+
data: []
|
|
41
|
+
};
|
|
42
|
+
} else if (sourceType == "formula") {
|
|
43
|
+
let formula = itemProps.formula ? itemProps.formula : "";
|
|
44
|
+
for (const paramName in totalValueMap) {
|
|
45
|
+
formula = formula.replace(
|
|
46
|
+
new RegExp(paramName.replace("$", "\\$"), "g"),
|
|
47
|
+
totalValueMap[paramName]
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
dataConf = {
|
|
51
|
+
uuid: item.uuid,
|
|
52
|
+
type: "formula",
|
|
53
|
+
formula,
|
|
54
|
+
data: []
|
|
55
|
+
};
|
|
56
|
+
} else {
|
|
57
|
+
dataConf = {
|
|
58
|
+
uuid: item.uuid,
|
|
59
|
+
type: "fixed",
|
|
60
|
+
field: itemProps.yaxisFix,
|
|
61
|
+
data: []
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (dataConf) {
|
|
65
|
+
dataConfs.push(dataConf);
|
|
66
|
+
dataValueMap[dataConf.uuid] = dataConf;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const confProps = configure.props ? configure.props : {};
|
|
70
|
+
const nameField = confProps.nameField;
|
|
71
|
+
const maxSource = confProps.maxSource;
|
|
72
|
+
const maxField = confProps.maxField;
|
|
73
|
+
const maxFixed = confProps.maxFixed;
|
|
74
|
+
const indicators = [];
|
|
75
|
+
const cumulativeMap = {};
|
|
76
|
+
for (const d of datas) {
|
|
77
|
+
if (!d) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
const name = getValueFromSource(d, nameField, void 0);
|
|
81
|
+
let maxValue = null;
|
|
82
|
+
if (!maxSource || maxSource == "variable") {
|
|
83
|
+
maxValue = getValueFromSource(d, maxField, void 0);
|
|
84
|
+
} else {
|
|
85
|
+
maxValue = maxFixed;
|
|
86
|
+
}
|
|
87
|
+
indicators.push({
|
|
88
|
+
text: name,
|
|
89
|
+
max: maxValue
|
|
90
|
+
});
|
|
91
|
+
for (const cumulativeField of accumulateFields) {
|
|
92
|
+
const value = getValueFromSource(d, cumulativeField, void 0);
|
|
93
|
+
let hisValue = cumulativeMap[cumulativeField];
|
|
94
|
+
if (value !== void 0 && !isNaN(value)) {
|
|
95
|
+
if (hisValue === void 0) {
|
|
96
|
+
hisValue = value;
|
|
97
|
+
} else {
|
|
98
|
+
hisValue = hisValue + value;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
cumulativeMap[cumulativeField] = hisValue;
|
|
102
|
+
}
|
|
103
|
+
for (const item of dataConfs) {
|
|
104
|
+
const data = item.data;
|
|
105
|
+
if (item.type == "fixed") {
|
|
106
|
+
data.push(item.field);
|
|
107
|
+
} else if (item.type == "variable") {
|
|
108
|
+
const value = getValueFromSource(d, item.field, void 0);
|
|
109
|
+
data.push(value);
|
|
110
|
+
} else if (item.type == "formula") {
|
|
111
|
+
const value = executeChartFormula(item.formula, cumulativeMap, d, pageContext);
|
|
112
|
+
data.push(value);
|
|
113
|
+
} else {
|
|
114
|
+
data.push(void 0);
|
|
115
|
+
}
|
|
42
116
|
}
|
|
43
117
|
}
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
118
|
+
chartOption.radar[0].indicator = indicators;
|
|
119
|
+
const defaultSeries = configure.defaultSeries;
|
|
120
|
+
const tempSeries = deepCopy(defaultSeries);
|
|
121
|
+
const serieDatas = tempSeries[0].data;
|
|
122
|
+
for (const serieData of serieDatas) {
|
|
123
|
+
const dataValue = dataValueMap[serieData.uuid];
|
|
124
|
+
serieData.value = dataValue.data;
|
|
49
125
|
}
|
|
50
|
-
|
|
126
|
+
chartOption.series = tempSeries;
|
|
127
|
+
configure.cacheDatas = datas;
|
|
128
|
+
configure.rawResult = resultData;
|
|
51
129
|
}
|
|
52
130
|
export {
|
|
53
|
-
|
|
131
|
+
updateChartOption
|
|
54
132
|
};
|
|
@@ -1,45 +1,108 @@
|
|
|
1
|
-
import { getValueFromSource
|
|
2
|
-
import { deepCopy
|
|
3
|
-
import { caculateFormulaValue
|
|
4
|
-
function
|
|
5
|
-
if (!
|
|
6
|
-
|
|
7
|
-
let c = null;
|
|
8
|
-
f ? c = u[f] : u && (c = Array.isArray(u) ? u : [u]), c || (c = []);
|
|
9
|
-
const d = t.items ? t.items : [], n = [], p = {};
|
|
10
|
-
for (const o2 of d) {
|
|
11
|
-
const s2 = o2.props ? o2.props : {}, i2 = o2.props ? o2.style : {}, e2 = s2.xaxisField, r3 = s2.sizeField, t2 = { uuid: o2.uuid, xaxisField: e2, yaxisField: s2.yaxisField, yaxisSource: s2.yaxisSource, formula: s2.formula, sizeField: r3, symbolSize: i2.symbolSize, data: [] };
|
|
12
|
-
n.push(t2), p[t2.uuid] = t2;
|
|
1
|
+
import { getValueFromSource } from "../page-helper-util.js";
|
|
2
|
+
import { deepCopy } from "../common-util.js";
|
|
3
|
+
import { caculateFormulaValue, executeChartFormula } from "./chart-util.js";
|
|
4
|
+
function updateChartOption(pageContext, configure, chartOption, resultData) {
|
|
5
|
+
if (!resultData || !resultData.result) {
|
|
6
|
+
return;
|
|
13
7
|
}
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
const result = resultData && resultData.result ? resultData.result : {};
|
|
9
|
+
const dataSetField = configure.serviceDataField;
|
|
10
|
+
let datas = null;
|
|
11
|
+
if (dataSetField) {
|
|
12
|
+
datas = result[dataSetField];
|
|
13
|
+
} else {
|
|
14
|
+
if (result) {
|
|
15
|
+
if (Array.isArray(result)) {
|
|
16
|
+
datas = result;
|
|
17
|
+
} else {
|
|
18
|
+
datas = [result];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (!datas) {
|
|
23
|
+
datas = [];
|
|
24
|
+
}
|
|
25
|
+
const itemConfs = configure.items ? configure.items : [];
|
|
26
|
+
const dataConfs = [];
|
|
27
|
+
const dataValueMap = {};
|
|
28
|
+
for (const item of itemConfs) {
|
|
29
|
+
const itemProps = item.props ? item.props : {};
|
|
30
|
+
const itemStyle = item.props ? item.style : {};
|
|
31
|
+
const xaxisField = itemProps.xaxisField;
|
|
32
|
+
const sizeField = itemProps.sizeField;
|
|
33
|
+
const dataConf = {
|
|
34
|
+
uuid: item.uuid,
|
|
35
|
+
xaxisField,
|
|
36
|
+
yaxisField: itemProps.yaxisField,
|
|
37
|
+
yaxisSource: itemProps.yaxisSource,
|
|
38
|
+
formula: itemProps.formula,
|
|
39
|
+
sizeField,
|
|
40
|
+
symbolSize: itemStyle.symbolSize,
|
|
41
|
+
data: []
|
|
42
|
+
};
|
|
43
|
+
dataConfs.push(dataConf);
|
|
44
|
+
dataValueMap[dataConf.uuid] = dataConf;
|
|
19
45
|
}
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
let
|
|
25
|
-
|
|
46
|
+
const accumulateFields = [];
|
|
47
|
+
const totalValueMap = caculateFormulaValue(itemConfs, datas, accumulateFields);
|
|
48
|
+
for (const dataConf of dataConfs) {
|
|
49
|
+
if (dataConf.yaxisSource === "formula") {
|
|
50
|
+
let formula = dataConf.formula ? dataConf.formula : "";
|
|
51
|
+
for (const paramName in totalValueMap) {
|
|
52
|
+
formula = formula.replace(
|
|
53
|
+
new RegExp(paramName.replace("$", "\\$"), "g"),
|
|
54
|
+
totalValueMap[paramName]
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
dataConf.formula = formula;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const cumulativeMap = {};
|
|
61
|
+
for (const d of datas) {
|
|
62
|
+
if (!d) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
for (const cumulativeField of accumulateFields) {
|
|
66
|
+
const value = getValueFromSource(d, cumulativeField, void 0);
|
|
67
|
+
let hisValue = cumulativeMap[cumulativeField];
|
|
68
|
+
if (value !== void 0 && !isNaN(value)) {
|
|
69
|
+
if (hisValue === void 0) {
|
|
70
|
+
hisValue = value;
|
|
71
|
+
} else {
|
|
72
|
+
hisValue = hisValue + value;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
cumulativeMap[cumulativeField] = hisValue;
|
|
26
76
|
}
|
|
27
|
-
for (const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
77
|
+
for (const item of dataConfs) {
|
|
78
|
+
const data = item.data;
|
|
79
|
+
const values = [];
|
|
80
|
+
values.push(getValueFromSource(d, item.xaxisField, void 0));
|
|
81
|
+
if (item.yaxisSource === "formula") {
|
|
82
|
+
const value = executeChartFormula(item.formula, cumulativeMap, d, pageContext);
|
|
83
|
+
values.push(value);
|
|
84
|
+
} else {
|
|
85
|
+
values.push(getValueFromSource(d, item.yaxisField, void 0));
|
|
86
|
+
}
|
|
87
|
+
if (item.sizeField) {
|
|
88
|
+
values.push(getValueFromSource(d, item.xaxisField, void 0));
|
|
89
|
+
} else {
|
|
90
|
+
values.push(item.symbolSize);
|
|
91
|
+
}
|
|
92
|
+
data.push(values);
|
|
34
93
|
}
|
|
35
94
|
}
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
95
|
+
const defaultSeries = configure.defaultSeries;
|
|
96
|
+
console.log("defaultSeries", defaultSeries);
|
|
97
|
+
const tempSeries = deepCopy(defaultSeries);
|
|
98
|
+
for (const serie of tempSeries) {
|
|
99
|
+
const dataValue = dataValueMap[serie.uuid];
|
|
100
|
+
serie.data = dataValue.data;
|
|
40
101
|
}
|
|
41
|
-
|
|
102
|
+
chartOption.series = tempSeries;
|
|
103
|
+
configure.cacheDatas = datas;
|
|
104
|
+
configure.rawResult = resultData;
|
|
42
105
|
}
|
|
43
106
|
export {
|
|
44
|
-
|
|
107
|
+
updateChartOption
|
|
45
108
|
};
|