super-page-runtime 2.0.43-beta3 → 2.0.43-beta5

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 (21) hide show
  1. package/dist/es/components/runtime/utils/charts/chart-columnline-util.js +77 -39
  2. package/dist/es/components/runtime/utils/charts/chart-pie-util.js +54 -8
  3. package/dist/es/components/runtime/utils/charts/chart-radar-util.js +39 -7
  4. package/dist/es/components/runtime/utils/charts/chart-scatter-util.js +44 -10
  5. package/dist/es/components/runtime/utils/charts/chart-util.d.ts +18 -1
  6. package/dist/es/components/runtime/utils/charts/chart-util.js +135 -15
  7. package/dist/es/components/runtime/utils/events/event-util.d.ts +6 -0
  8. package/dist/es/components/runtime/utils/events/event-util.js +63 -43
  9. package/dist/es/components/runtime/utils/events/standard-event.js +4 -1
  10. package/dist/es/components/runtime/utils/events/validator-util.js +12 -1
  11. package/dist/es/components/runtime/utils/page-helper-util.d.ts +6 -0
  12. package/dist/es/components/runtime/utils/page-helper-util.js +3 -1
  13. package/dist/es/components/runtime/utils/page-permission-util.js +3 -3
  14. package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +8 -10
  15. package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue2.js +14 -10
  16. package/dist/es/components/runtime/views/assemblys/workflow/picture-flow/pictureflow-runtime.vue2.js +5 -4
  17. package/dist/es/components/runtime/views/assemblys/workflow/text-history/textflow-runtime.vue2.js +5 -4
  18. package/dist/es/components/runtime/views/super-page.vue.js +1 -0
  19. package/dist/es/i18n/langs/cn.js +2 -1
  20. package/dist/es/i18n/langs/en.js +2 -1
  21. package/package.json +2 -2
@@ -1,12 +1,12 @@
1
1
  import { getValueFromSource, formatVariableValue, setValueForVariableName } from "../page-helper-util.js";
2
2
  import { deepCopy } from "../common-util.js";
3
- import { CommonName, sortDatas, limitDatas } from "./chart-util.js";
3
+ import { CommonName, caculateFormulaValue, sortDatas, limitDatas, executeChartFormula } from "./chart-util.js";
4
4
  function updateChartOption(pageContext, configure, chartOption, resultData) {
5
5
  if (!resultData || !resultData.result) {
6
6
  return;
7
7
  }
8
8
  const result = resultData && resultData.result ? resultData.result : {};
9
- const groupValue = resultData && resultData.groupValue ? resultData.groupValue : [];
9
+ let groupValue = resultData && resultData.groupValue ? resultData.groupValue : void 0;
10
10
  const dataSetField = configure.serviceDataField;
11
11
  let datas = null;
12
12
  if (dataSetField) {
@@ -27,10 +27,16 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
27
27
  if (!confGroups) {
28
28
  confGroups = [];
29
29
  }
30
+ if (!groupValue || groupValue.length === 0) {
31
+ groupValue = [];
32
+ for (const g of confGroups) {
33
+ groupValue.push(g.group);
34
+ }
35
+ }
30
36
  const groupMap = {};
31
37
  const groupFields = [];
32
38
  const realGroupFilds = [];
33
- for (let g of confGroups) {
39
+ for (const g of confGroups) {
34
40
  groupMap[g.group] = g.target;
35
41
  if (g.target && !groupFields.includes(g.target)) {
36
42
  groupFields.push(g.target);
@@ -41,12 +47,12 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
41
47
  }
42
48
  let mulGroupShow = configure.props ? configure.props.mulGroupShow : "";
43
49
  mulGroupShow = mulGroupShow == "break" ? "\r\n" : " ";
44
- for (let d of datas) {
50
+ for (const d of datas) {
45
51
  if (!d) {
46
52
  continue;
47
53
  }
48
54
  const xValues2 = [];
49
- for (let g of groupValue) {
55
+ for (const g of groupValue) {
50
56
  const fieldName = groupMap[g];
51
57
  const value = getValueFromSource(d, fieldName, void 0);
52
58
  if (value) {
@@ -63,7 +69,12 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
63
69
  const dynamicValueField = {};
64
70
  const allValueFields = [];
65
71
  const limitValueFields = [];
66
- for (let item of itemConfs) {
72
+ const accumulateFields = [];
73
+ const totalValueMap = caculateFormulaValue(itemConfs, datas, accumulateFields);
74
+ for (const f of accumulateFields) {
75
+ allValueFields.push(f);
76
+ }
77
+ for (const item of itemConfs) {
67
78
  const itemProps = item.props ? item.props : {};
68
79
  const sourceType = itemProps.yaxisSource;
69
80
  const yaxisField = itemProps.yaxisField;
@@ -83,6 +94,25 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
83
94
  allValueFields.push(yaxisField);
84
95
  limitValueFields.push(yaxisField);
85
96
  }
97
+ if (isCumulative && !accumulateFields.includes(yaxisField)) {
98
+ accumulateFields.push(yaxisField);
99
+ }
100
+ } else if (sourceType == "formula") {
101
+ let formula = itemProps.formula ? itemProps.formula : "";
102
+ for (const paramName in totalValueMap) {
103
+ formula = formula.replace(
104
+ new RegExp(paramName.replace("$", "\\$"), "g"),
105
+ totalValueMap[paramName]
106
+ );
107
+ }
108
+ serieValue = {
109
+ uuid: item.uuid,
110
+ type: "formula",
111
+ formula,
112
+ data: [],
113
+ dynamicDatas: []
114
+ //动态系列数据
115
+ };
86
116
  } else {
87
117
  serieValue = {
88
118
  uuid: item.uuid,
@@ -97,8 +127,7 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
97
127
  serieValues.push(serieValue);
98
128
  serieValueMap[item.uuid] = serieValue;
99
129
  }
100
- if (itemProps.dynamicSeriesField && // !groupFields.includes(itemProps.dynamicSeriesField) &&
101
- !dynamicFileds.includes(itemProps.dynamicSeriesField) && serieValue && yaxisField) {
130
+ if (itemProps.dynamicSeriesField && !dynamicFileds.includes(itemProps.dynamicSeriesField) && serieValue) {
102
131
  serieValue.dynamicField = itemProps.dynamicSeriesField;
103
132
  serieValue.dynamicSeriesTitle = itemProps.dynamicSeriesTitle;
104
133
  serieValue.dynamicShowStack = itemProps.dynamicShowStack;
@@ -110,16 +139,16 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
110
139
  if (dynamicFileds.length > 0) {
111
140
  const newDatas = [];
112
141
  const dataMap = {};
113
- for (let d of datas) {
142
+ for (const d of datas) {
114
143
  if (!d) {
115
144
  continue;
116
145
  }
117
- for (let valueField of allValueFields) {
146
+ for (const valueField of allValueFields) {
118
147
  const groupValue2 = d[CommonName.X_FIELD_NAME];
119
148
  let newData = dataMap[groupValue2];
120
149
  if (!newData) {
121
150
  newData = {};
122
- for (let gField of groupFields) {
151
+ for (const gField of groupFields) {
123
152
  newData[gField] = d[gField];
124
153
  }
125
154
  newData[CommonName.X_FIELD_NAME] = d[CommonName.X_FIELD_NAME];
@@ -136,14 +165,14 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
136
165
  }
137
166
  }
138
167
  }
139
- for (let dynamicField of dynamicFileds) {
168
+ for (const dynamicField of dynamicFileds) {
140
169
  const dynamicLabels = [];
141
- for (let d of datas) {
170
+ for (const d of datas) {
142
171
  if (!d) {
143
172
  continue;
144
173
  }
145
174
  const groupValue2 = d[CommonName.X_FIELD_NAME];
146
- let newData = dataMap[groupValue2];
175
+ const newData = dataMap[groupValue2];
147
176
  if (!newData) {
148
177
  continue;
149
178
  }
@@ -152,15 +181,18 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
152
181
  if (!dynamicLabels.includes(dynamicLabel)) {
153
182
  dynamicLabels.push(dynamicLabel);
154
183
  limitValueFields.push(dynamicLabel);
184
+ accumulateFields.push(dynamicLabel);
155
185
  }
156
186
  const valueField = dynamicValueField[dynamicField];
157
- let newValue = getValueFromSource(d, valueField, void 0);
158
- if (!isNaN(newValue)) {
159
- const hisValue = newData[dynamicLabel];
160
- if (!isNaN) {
161
- newValue += hisValue;
187
+ if (valueField !== void 0) {
188
+ const newValue = getValueFromSource(d, valueField, void 0);
189
+ let hisValue = newData[dynamicLabel];
190
+ if (hisValue === void 0) {
191
+ hisValue = newValue;
192
+ } else if (!isNaN(newValue)) {
193
+ hisValue += newValue;
162
194
  }
163
- newData[dynamicLabel] = newValue;
195
+ newData[dynamicLabel] = hisValue;
164
196
  }
165
197
  }
166
198
  dynamicLabelMap[dynamicField] = dynamicLabels;
@@ -170,13 +202,26 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
170
202
  sortDatas(pageContext, configure, datas);
171
203
  datas = limitDatas(pageContext, configure, datas, groupFields, limitValueFields);
172
204
  const xValues = [];
205
+ console.log("accumulateFields", accumulateFields);
173
206
  const cumulativeMap = {};
174
- for (let data of datas) {
207
+ for (const data of datas) {
175
208
  if (!data) {
176
209
  continue;
177
210
  }
211
+ for (const cumulativeField of accumulateFields) {
212
+ const value = getValueFromSource(data, cumulativeField, void 0);
213
+ let hisValue = cumulativeMap[cumulativeField];
214
+ if (value !== void 0 && !isNaN(value)) {
215
+ if (hisValue === void 0) {
216
+ hisValue = value;
217
+ } else {
218
+ hisValue = hisValue + value;
219
+ }
220
+ }
221
+ cumulativeMap[cumulativeField] = hisValue;
222
+ }
178
223
  xValues.push(data[CommonName.X_FIELD_NAME]);
179
- for (let item of serieValues) {
224
+ for (const item of serieValues) {
180
225
  let serieData = item.data;
181
226
  const dynamicDatas = item.dynamicDatas;
182
227
  if (item.dynamicField) {
@@ -190,28 +235,21 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
190
235
  const fieldName = dynamicLabels[i];
191
236
  let value = getValueFromSource(data, fieldName, void 0);
192
237
  if (item.isCumulative) {
193
- const hisKey = item.uuid + "_" + fieldName;
194
- const hisValue = cumulativeMap[hisKey];
195
- if (hisValue) {
196
- value = hisValue + value;
197
- }
198
- cumulativeMap[hisKey] = value;
238
+ value = cumulativeMap[fieldName];
199
239
  }
200
240
  serieData.push(value);
201
241
  }
202
- } else if (item.type == "fixed") {
242
+ } else if (item.type === "fixed") {
203
243
  serieData.push(item.field);
204
- } else if (item.type == "variable") {
244
+ } else if (item.type === "variable") {
205
245
  let value = getValueFromSource(data, item.field, void 0);
206
246
  if (item.isCumulative) {
207
- const hisKey = item.uuid + "_field";
208
- const hisValue = cumulativeMap[hisKey];
209
- if (hisValue) {
210
- value = hisValue + value;
211
- }
212
- cumulativeMap[hisKey] = value;
247
+ value = cumulativeMap[item.field];
213
248
  }
214
249
  serieData.push(value);
250
+ } else if (item.type === "formula") {
251
+ const value = executeChartFormula(item.formula, cumulativeMap, data, pageContext);
252
+ serieData.push(value);
215
253
  } else {
216
254
  serieData.push(void 0);
217
255
  }
@@ -220,14 +258,14 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
220
258
  const defaultSeries = configure.defaultSeries;
221
259
  const tempSeries = deepCopy(defaultSeries == null ? [] : defaultSeries);
222
260
  const newSeries = [];
223
- for (let serie of tempSeries) {
261
+ for (const serie of tempSeries) {
224
262
  const serieValue = serieValueMap[serie.uuid];
225
263
  if (serieValue.dynamicField) {
226
264
  let dynamicLabels = dynamicLabelMap[serieValue.dynamicField];
227
265
  dynamicLabels = dynamicLabels ? dynamicLabels : [];
228
266
  const dynamicDatas = serieValue.dynamicDatas ? serieValue.dynamicDatas : [];
229
267
  for (let i = 0; i < dynamicLabels.length; i++) {
230
- let label = dynamicLabels[i];
268
+ const label = dynamicLabels[i];
231
269
  const newSerie = deepCopy(serie);
232
270
  if (serieValue.dynamicSeriesTitle) {
233
271
  const dynamicSeriesTitle = serieValue.dynamicSeriesTitle.replace("${name}", label);
@@ -251,7 +289,7 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
251
289
  const defaultYaxis = configure.defaultYaxis;
252
290
  if (chartOption.isBar) {
253
291
  if (defaultYaxis) {
254
- for (let tempYaxis of defaultYaxis) {
292
+ for (const tempYaxis of defaultYaxis) {
255
293
  tempYaxis.data = xValues;
256
294
  }
257
295
  }
@@ -1,12 +1,12 @@
1
1
  import { getValueFromSource, setValueForVariableName } from "../page-helper-util.js";
2
2
  import { deepCopy } from "../common-util.js";
3
- import { CommonName, sortDatas, limitDatas } from "./chart-util.js";
3
+ import { CommonName, caculateFormulaValue, executeChartFormula, sortDatas, limitDatas } from "./chart-util.js";
4
4
  function updateChartOption(pageContext, configure, chartOption, resultData) {
5
5
  if (!resultData || !resultData.result) {
6
6
  return;
7
7
  }
8
8
  const result = resultData && resultData.result ? resultData.result : {};
9
- const groupValue = resultData && resultData.groupValue ? resultData.groupValue : [];
9
+ let groupValue = resultData && resultData.groupValue ? resultData.groupValue : void 0;
10
10
  const dataSetField = configure.serviceDataField;
11
11
  let datas = null;
12
12
  if (dataSetField) {
@@ -27,10 +27,16 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
27
27
  if (!confGroups) {
28
28
  confGroups = [];
29
29
  }
30
+ if (!groupValue || groupValue.length === 0) {
31
+ groupValue = [];
32
+ for (const g of confGroups) {
33
+ groupValue.push(g.group);
34
+ }
35
+ }
30
36
  const groupMap = {};
31
37
  const groupFields = [];
32
38
  const realGroupFilds = [];
33
- for (let g of confGroups) {
39
+ for (const g of confGroups) {
34
40
  groupMap[g.group] = g.target;
35
41
  if (g.target && !groupFields.includes(g.target)) {
36
42
  groupFields.push(g.target);
@@ -41,12 +47,13 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
41
47
  }
42
48
  let mulGroupShow = configure.props ? configure.props.mulGroupShow : "";
43
49
  mulGroupShow = mulGroupShow == "break" ? "\r\n" : " ";
44
- for (let d of datas) {
50
+ console.log("groupValue", groupValue);
51
+ for (const d of datas) {
45
52
  if (!d) {
46
53
  continue;
47
54
  }
48
55
  const xValues2 = [];
49
- for (let g of groupValue) {
56
+ for (const g of groupValue) {
50
57
  const fieldName = groupMap[g];
51
58
  const value = getValueFromSource(d, fieldName, void 0);
52
59
  if (value) {
@@ -61,19 +68,58 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
61
68
  console.log("饼图的系列为空,操作失败!", configure);
62
69
  return;
63
70
  }
64
- const valueField = configure.props ? configure.props.yaxisField : null;
71
+ const confProps = configure.props ? configure.props : {};
72
+ let valueField = confProps.yaxisField;
65
73
  console.log("valueField", valueField);
66
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
+ );
86
+ }
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 = "";
67
113
  sortDatas(pageContext, configure, datas);
68
114
  datas = limitDatas(pageContext, configure, datas, groupFields, [valueField]);
69
115
  const xValues = [];
70
116
  const yValues = [];
71
- for (let data of datas) {
117
+ for (const data of datas) {
72
118
  if (!data) {
73
119
  continue;
74
120
  }
75
121
  xValues.push(data[CommonName.X_FIELD_NAME]);
76
- let value = getValueFromSource(data, valueField, void 0);
122
+ const value = getValueFromSource(data, valueField, void 0);
77
123
  yValues.push(value);
78
124
  }
79
125
  const defaultSeries = configure.defaultSeries;
@@ -1,5 +1,6 @@
1
1
  import { getValueFromSource } from "../page-helper-util.js";
2
2
  import { deepCopy } from "../common-util.js";
3
+ import { caculateFormulaValue, executeChartFormula } from "./chart-util.js";
3
4
  function updateChartOption(pageContext, configure, chartOption, resultData) {
4
5
  if (!resultData || !resultData.result) {
5
6
  return;
@@ -24,7 +25,9 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
24
25
  const itemConfs = configure.items ? configure.items : [];
25
26
  const dataConfs = [];
26
27
  const dataValueMap = {};
27
- for (let item of itemConfs) {
28
+ const accumulateFields = [];
29
+ const totalValueMap = caculateFormulaValue(itemConfs, datas, accumulateFields);
30
+ for (const item of itemConfs) {
28
31
  const itemProps = item.props ? item.props : {};
29
32
  const sourceType = itemProps.yaxisSource;
30
33
  const yaxisField = itemProps.yaxisField;
@@ -36,6 +39,20 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
36
39
  field: yaxisField,
37
40
  data: []
38
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
+ };
39
56
  } else {
40
57
  dataConf = {
41
58
  uuid: item.uuid,
@@ -55,7 +72,8 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
55
72
  const maxField = confProps.maxField;
56
73
  const maxFixed = confProps.maxFixed;
57
74
  const indicators = [];
58
- for (let d of datas) {
75
+ const cumulativeMap = {};
76
+ for (const d of datas) {
59
77
  if (!d) {
60
78
  continue;
61
79
  }
@@ -70,12 +88,27 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
70
88
  text: name,
71
89
  max: maxValue
72
90
  });
73
- for (let item of dataConfs) {
74
- let data = item.data;
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;
75
105
  if (item.type == "fixed") {
76
106
  data.push(item.field);
77
107
  } else if (item.type == "variable") {
78
- let value = getValueFromSource(d, item.field, void 0);
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);
79
112
  data.push(value);
80
113
  } else {
81
114
  data.push(void 0);
@@ -84,10 +117,9 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
84
117
  }
85
118
  chartOption.radar[0].indicator = indicators;
86
119
  const defaultSeries = configure.defaultSeries;
87
- console.log("defaultSeries", defaultSeries);
88
120
  const tempSeries = deepCopy(defaultSeries);
89
121
  const serieDatas = tempSeries[0].data;
90
- for (let serieData of serieDatas) {
122
+ for (const serieData of serieDatas) {
91
123
  const dataValue = dataValueMap[serieData.uuid];
92
124
  serieData.value = dataValue.data;
93
125
  }
@@ -1,5 +1,6 @@
1
1
  import { getValueFromSource } from "../page-helper-util.js";
2
2
  import { deepCopy } from "../common-util.js";
3
+ import { caculateFormulaValue, executeChartFormula } from "./chart-util.js";
3
4
  function updateChartOption(pageContext, configure, chartOption, resultData) {
4
5
  if (!resultData || !resultData.result) {
5
6
  return;
@@ -24,16 +25,17 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
24
25
  const itemConfs = configure.items ? configure.items : [];
25
26
  const dataConfs = [];
26
27
  const dataValueMap = {};
27
- for (let item of itemConfs) {
28
+ for (const item of itemConfs) {
28
29
  const itemProps = item.props ? item.props : {};
29
30
  const itemStyle = item.props ? item.style : {};
30
- const xaxisField = itemProps.yaxisField;
31
- const yaxisField = itemProps.yaxisField;
31
+ const xaxisField = itemProps.xaxisField;
32
32
  const sizeField = itemProps.sizeField;
33
- let dataConf = {
33
+ const dataConf = {
34
34
  uuid: item.uuid,
35
35
  xaxisField,
36
- yaxisField,
36
+ yaxisField: itemProps.yaxisField,
37
+ yaxisSource: itemProps.yaxisSource,
38
+ formula: itemProps.formula,
37
39
  sizeField,
38
40
  symbolSize: itemStyle.symbolSize,
39
41
  data: []
@@ -41,15 +43,47 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
41
43
  dataConfs.push(dataConf);
42
44
  dataValueMap[dataConf.uuid] = dataConf;
43
45
  }
44
- for (let d of datas) {
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) {
45
62
  if (!d) {
46
63
  continue;
47
64
  }
48
- for (let item of dataConfs) {
49
- let data = item.data;
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;
76
+ }
77
+ for (const item of dataConfs) {
78
+ const data = item.data;
50
79
  const values = [];
51
80
  values.push(getValueFromSource(d, item.xaxisField, void 0));
52
- values.push(getValueFromSource(d, item.yaxisField, 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
+ }
53
87
  if (item.sizeField) {
54
88
  values.push(getValueFromSource(d, item.xaxisField, void 0));
55
89
  } else {
@@ -61,7 +95,7 @@ function updateChartOption(pageContext, configure, chartOption, resultData) {
61
95
  const defaultSeries = configure.defaultSeries;
62
96
  console.log("defaultSeries", defaultSeries);
63
97
  const tempSeries = deepCopy(defaultSeries);
64
- for (let serie of tempSeries) {
98
+ for (const serie of tempSeries) {
65
99
  const dataValue = dataValueMap[serie.uuid];
66
100
  serie.data = dataValue.data;
67
101
  }
@@ -4,7 +4,8 @@ import { PageContext, Component } from '../interfaces/page-design-types';
4
4
  * 统计图通用字段名
5
5
  */
6
6
  export declare enum CommonName {
7
- X_FIELD_NAME = "__x"
7
+ X_FIELD_NAME = "__x",//横坐标字段名
8
+ Y_TEMP_NAME = "__y"
8
9
  }
9
10
  /**
10
11
  * 获取主题对象
@@ -49,3 +50,19 @@ export declare function sortDatas(pageContext: PageContext, configure: Component
49
50
  * @param limitNum
50
51
  */
51
52
  export declare function limitDatas(pageContext: PageContext, configure: Component, datas: Array<any>, groupFields: Array<string>, numFields: Array<string>): Array<any>;
53
+ /**
54
+ * 提前计算公式中用到的汇总变量
55
+ * @param itemConfs
56
+ * @param datas
57
+ * @param accumulateFields 累计计算的字段
58
+ * @returns
59
+ */
60
+ export declare function caculateFormulaValue(itemConfs: any, datas: any, accumulateFields: any): any;
61
+ /**
62
+ * 执行统计图的计算公式
63
+ * @param formulaStr 计算公式
64
+ * @param accumulateMap 累计存储
65
+ * @param rowData 行记录
66
+ * @param pageContext 页面对象
67
+ */
68
+ export declare function executeChartFormula(formulaStr: string, accumulateMap: any, rowData: any, pageContext: PageContext): any;
@@ -1,9 +1,12 @@
1
+ import "../../../../node_modules/.pnpm/@jsplumb_browser-ui@6.2.10/node_modules/@jsplumb/browser-ui/js/jsplumb.browser-ui.es.js";
1
2
  import theme1 from "../../../../assets/chart-themes/theme1.js";
2
3
  import theme2 from "../../../../assets/chart-themes/theme2.js";
3
4
  import theme3 from "../../../../assets/chart-themes/theme3.js";
4
- import { getValueFromSource, setValueForVariableName, formatVariableValue } from "../page-helper-util.js";
5
+ import { getValueFromSource, setValueForVariableName, formatVariableValue, getParamNames, getValueFromVariable } from "../page-helper-util.js";
6
+ import { appendDefaultMethods } from "../events/event-util.js";
5
7
  var CommonName = /* @__PURE__ */ ((CommonName2) => {
6
8
  CommonName2["X_FIELD_NAME"] = "__x";
9
+ CommonName2["Y_TEMP_NAME"] = "__y";
7
10
  return CommonName2;
8
11
  })(CommonName || {});
9
12
  const themeMap = {
@@ -82,7 +85,7 @@ function initChartOption(configure, chartOption) {
82
85
  if (chartOption.series) {
83
86
  const enableDrill = configure.props ? configure.props.enableDrill : null;
84
87
  const selGroupVariable = configure.props ? configure.props.selGroupVariable : null;
85
- for (let s of chartOption.series) {
88
+ for (const s of chartOption.series) {
86
89
  if (!chartOption.radar) {
87
90
  s.data = [];
88
91
  }
@@ -100,7 +103,7 @@ function initChartOption(configure, chartOption) {
100
103
  }
101
104
  }
102
105
  if (chartOption.radar) {
103
- for (let r of chartOption.radar) {
106
+ for (const r of chartOption.radar) {
104
107
  r.indicator = [];
105
108
  }
106
109
  }
@@ -113,7 +116,7 @@ function initChartOption(configure, chartOption) {
113
116
  configure.defaultXaxis = defaultXaxis;
114
117
  const defaultYaxis = chartOption.yAxis;
115
118
  if (defaultYaxis) {
116
- for (let yAxis of defaultYaxis) {
119
+ for (const yAxis of defaultYaxis) {
117
120
  if (yAxis.data) {
118
121
  yAxis.data = [];
119
122
  }
@@ -131,7 +134,7 @@ function monitorChartClickToVariable(pageContext, configure, chart, variable) {
131
134
  let selGroupValue = null;
132
135
  if (highlightInfos) {
133
136
  for (let i = 0; i < highlightInfos.length; i++) {
134
- let info = highlightInfos[i];
137
+ const info = highlightInfos[i];
135
138
  chart.dispatchAction({
136
139
  type: "downplay",
137
140
  seriesIndex: info.seriesIndex,
@@ -168,12 +171,12 @@ function monitorChartClickToVariable(pageContext, configure, chart, variable) {
168
171
  }
169
172
  function sortDatas(pageContext, configure, datas) {
170
173
  const itemConfs = configure.items ? configure.items : [];
171
- let orderByTarget = configure.props ? configure.props.orderByTarget : "";
174
+ const orderByTarget = configure.props ? configure.props.orderByTarget : "";
172
175
  let orderField = null;
173
176
  if (orderByTarget == "x" || orderByTarget == "X") {
174
177
  orderField = "__x";
175
178
  } else if (orderByTarget) {
176
- for (let item of itemConfs) {
179
+ for (const item of itemConfs) {
177
180
  if (item.uuid == orderByTarget) {
178
181
  const itemProps = item.props ? item.props : {};
179
182
  const sourceType = itemProps.yaxisSource;
@@ -188,18 +191,18 @@ function sortDatas(pageContext, configure, datas) {
188
191
  if (!orderField) {
189
192
  return;
190
193
  }
191
- let orderSource = configure.props ? configure.props.orderSource : "";
194
+ const orderSource = configure.props ? configure.props.orderSource : "";
192
195
  let orderValue = configure.props ? configure.props.orderFix : "";
193
196
  if (orderSource == "variable") {
194
- let orderVariable = configure.props ? configure.props.orderVariable : "";
197
+ const orderVariable = configure.props ? configure.props.orderVariable : "";
195
198
  orderValue = formatVariableValue(pageContext, orderVariable);
196
199
  }
197
200
  orderValue = orderValue == "desc" || orderValue == "DESC" ? "desc" : "asc";
198
- let maxLen = datas.length;
201
+ const maxLen = datas.length;
199
202
  for (let i = 0; i < maxLen - 1; i++) {
200
- let vali = getValueFromSource(datas[i], orderField, void 0);
203
+ const vali = getValueFromSource(datas[i], orderField, void 0);
201
204
  for (let j = i + 1; j < maxLen; j++) {
202
- let valj = getValueFromSource(datas[j], orderField, void 0);
205
+ const valj = getValueFromSource(datas[j], orderField, void 0);
203
206
  let isSwap = false;
204
207
  if ("desc" == orderValue) {
205
208
  if (vali < valj) {
@@ -251,7 +254,7 @@ function limitDatas(pageContext, configure, datas, groupFields, numFields) {
251
254
  if (!overItemAlias) {
252
255
  break;
253
256
  }
254
- for (let groupField of groupFields) {
257
+ for (const groupField of groupFields) {
255
258
  if (!groupField) {
256
259
  continue;
257
260
  }
@@ -265,11 +268,11 @@ function limitDatas(pageContext, configure, datas, groupFields, numFields) {
265
268
  existValues.push(value);
266
269
  }
267
270
  }
268
- for (let numField of numFields) {
271
+ for (const numField of numFields) {
269
272
  if (!numField) {
270
273
  continue;
271
274
  }
272
- let value = getValueFromSource(data, numField, void 0);
275
+ const value = getValueFromSource(data, numField, void 0);
273
276
  if (isNaN(value)) {
274
277
  continue;
275
278
  }
@@ -290,8 +293,125 @@ function limitDatas(pageContext, configure, datas, groupFields, numFields) {
290
293
  }
291
294
  return newDatas;
292
295
  }
296
+ function caculateFormulaValue(itemConfs, datas, accumulateFields) {
297
+ const totalValueMap = {};
298
+ for (const item of itemConfs) {
299
+ const itemProps = item.props ? item.props : {};
300
+ const sourceType = itemProps.yaxisSource;
301
+ if (sourceType === "formula") {
302
+ const paramNames = getParamNames(itemProps.formula);
303
+ for (const paramName of paramNames) {
304
+ if (paramName in totalValueMap) {
305
+ continue;
306
+ }
307
+ if (paramName.startsWith("${min.")) {
308
+ totalValueMap[paramName] = getMinValue(
309
+ datas,
310
+ paramName.substring(6, paramName.length - 1)
311
+ );
312
+ } else if (paramName.startsWith("${max.")) {
313
+ totalValueMap[paramName] = getMaxValue(
314
+ datas,
315
+ paramName.substring(6, paramName.length - 1)
316
+ );
317
+ } else if (paramName.startsWith("${sum.")) {
318
+ totalValueMap[paramName] = getSumValue(
319
+ datas,
320
+ paramName.substring(6, paramName.length - 1)
321
+ );
322
+ } else if (paramName.startsWith("${avg.")) {
323
+ totalValueMap[paramName] = getAvgValue(
324
+ datas,
325
+ paramName.substring(6, paramName.length - 1)
326
+ );
327
+ } else if (paramName.startsWith("${add.")) {
328
+ const fieldName = paramName.substring(6, paramName.length - 1);
329
+ accumulateFields.push(fieldName);
330
+ }
331
+ }
332
+ }
333
+ }
334
+ return totalValueMap;
335
+ }
336
+ function getMinValue(datas, fieldName) {
337
+ let minValue = void 0;
338
+ for (const d of datas) {
339
+ const value = parseFloat(getValueFromSource(d, fieldName, null));
340
+ if (minValue === void 0) {
341
+ minValue = value;
342
+ } else if (!isNaN(value) && value < minValue) {
343
+ minValue = value;
344
+ }
345
+ }
346
+ return minValue;
347
+ }
348
+ function getMaxValue(datas, fieldName) {
349
+ let maxValue = void 0;
350
+ for (const d of datas) {
351
+ const value = parseFloat(getValueFromSource(d, fieldName, null));
352
+ if (maxValue === void 0) {
353
+ maxValue = value;
354
+ } else if (!isNaN(value) && value > maxValue) {
355
+ maxValue = value;
356
+ }
357
+ }
358
+ return maxValue;
359
+ }
360
+ function getSumValue(datas, fieldName) {
361
+ let sumValue = void 0;
362
+ for (const d of datas) {
363
+ const value = parseFloat(getValueFromSource(d, fieldName, null));
364
+ if (sumValue === void 0) {
365
+ sumValue = value;
366
+ } else if (!isNaN(value)) {
367
+ sumValue += value;
368
+ }
369
+ }
370
+ return sumValue;
371
+ }
372
+ function getAvgValue(datas, fieldName) {
373
+ const sumValue = getSumValue(datas, fieldName);
374
+ if (sumValue === void 0 || datas.length === 0) {
375
+ return sumValue;
376
+ }
377
+ return parseFloat((sumValue / datas.length).toFixed(5));
378
+ }
379
+ function executeChartFormula(formulaStr, accumulateMap, rowData, pageContext) {
380
+ if (!formulaStr) {
381
+ return void 0;
382
+ }
383
+ if (accumulateMap) {
384
+ for (const accumulateField in accumulateMap) {
385
+ formulaStr = formulaStr.replace(
386
+ new RegExp("\\${add." + accumulateField + "}", "g"),
387
+ accumulateMap[accumulateField]
388
+ );
389
+ }
390
+ }
391
+ const paramNames = getParamNames(formulaStr);
392
+ for (const paramName of paramNames) {
393
+ let value = null;
394
+ if (paramName.startsWith("${row.")) {
395
+ value = getValueFromSource(rowData, paramName.substring(6, paramName.length - 1), null);
396
+ } else {
397
+ value = getValueFromVariable(pageContext.entity, paramName);
398
+ }
399
+ formulaStr = formulaStr.replace(new RegExp(paramName.replace("$", "\\$"), "g"), value);
400
+ }
401
+ if (!formulaStr.includes("return ")) {
402
+ formulaStr = "return " + formulaStr;
403
+ }
404
+ const newFunc = new Function("params", formulaStr);
405
+ appendDefaultMethods(newFunc, pageContext);
406
+ return newFunc({
407
+ pageContext,
408
+ row: rowData
409
+ });
410
+ }
293
411
  export {
294
412
  CommonName,
413
+ caculateFormulaValue,
414
+ executeChartFormula,
295
415
  getCustomTheme,
296
416
  getCustomThemeOptions,
297
417
  getNumFormatter,
@@ -12,6 +12,12 @@ export declare function initPageEvents(pageDesign: PageDesign, pageContext: Page
12
12
  * @returns
13
13
  */
14
14
  export declare function getCustomFunc(pageContext: PageContext, funcName: any): any;
15
+ /**
16
+ * 为功能添加默认的方法
17
+ * @param func 函数
18
+ * @param pageContext
19
+ */
20
+ export declare function appendDefaultMethods(func: any, pageContext: PageContext): void;
15
21
  /**
16
22
  * 页面销毁时,将window上注册的函数移除掉
17
23
  * @param pageDesign
@@ -7,6 +7,14 @@ import { analysisCondition } from "agilebuilder-ui/src/utils/util";
7
7
  import { getListCode } from "../common-util.js";
8
8
  import eventBus from "../eventBus.js";
9
9
  import { getValueFromSource } from "../page-helper-util.js";
10
+ const skipValidateEvents = [
11
+ "downloadTemplate",
12
+ "back",
13
+ "exportForm",
14
+ "exportPDF",
15
+ "lineEditCreate",
16
+ "workflowSave"
17
+ ];
10
18
  function initPageEvents(pageDesign, pageContext) {
11
19
  if (pageDesign && pageDesign.customEvents) {
12
20
  const customEvents = transferToFunction(pageDesign.customEvents);
@@ -26,48 +34,51 @@ function appendDefaultMethod(pageContext, customEvents) {
26
34
  }
27
35
  for (const pro in customEvents) {
28
36
  const func = customEvents[pro];
29
- func.get = function(code) {
30
- if (code) {
31
- return getComponentRefByCode(pageContext, code);
32
- } else {
33
- return void 0;
34
- }
35
- };
36
- func.getByUuid = function(uuid) {
37
- if (uuid) {
38
- return getComponentRef(pageContext, uuid);
39
- } else {
40
- return void 0;
41
- }
42
- };
43
- func.getPageContext = function() {
44
- return pageContext;
45
- };
46
- func.getContextValue = function(fieldName) {
47
- let contextData = pageContext && pageContext.entity ? pageContext.entity.context : null;
48
- contextData = contextData ? contextData : {};
49
- return getValueFromSource(contextData, fieldName, "context");
50
- };
51
- func.getContext = function() {
52
- return pageContext && pageContext.entity ? pageContext.entity.context : {};
53
- };
54
- func.getSystem = function() {
55
- return pageContext && pageContext.entity ? pageContext.entity.system : {};
56
- };
57
- func.getTask = function() {
58
- return pageContext && pageContext.entity ? pageContext.entity.task : {};
59
- };
60
- func.getRequest = function() {
61
- return pageContext && pageContext.entity ? pageContext.entity.request : {};
62
- };
63
- func.getPage = function() {
64
- return pageContext && pageContext.entity ? pageContext.entity.page : {};
65
- };
66
- func.getCustomFunc = function(funcName) {
67
- return getCustomFunc(pageContext, funcName);
68
- };
37
+ appendDefaultMethods(func, pageContext);
69
38
  }
70
39
  }
40
+ function appendDefaultMethods(func, pageContext) {
41
+ func.get = function(code) {
42
+ if (code) {
43
+ return getComponentRefByCode(pageContext, code);
44
+ } else {
45
+ return void 0;
46
+ }
47
+ };
48
+ func.getByUuid = function(uuid) {
49
+ if (uuid) {
50
+ return getComponentRef(pageContext, uuid);
51
+ } else {
52
+ return void 0;
53
+ }
54
+ };
55
+ func.getPageContext = function() {
56
+ return pageContext;
57
+ };
58
+ func.getContextValue = function(fieldName) {
59
+ let contextData = pageContext && pageContext.entity ? pageContext.entity.context : null;
60
+ contextData = contextData ? contextData : {};
61
+ return getValueFromSource(contextData, fieldName, "context");
62
+ };
63
+ func.getContext = function() {
64
+ return pageContext && pageContext.entity ? pageContext.entity.context : {};
65
+ };
66
+ func.getSystem = function() {
67
+ return pageContext && pageContext.entity ? pageContext.entity.system : {};
68
+ };
69
+ func.getTask = function() {
70
+ return pageContext && pageContext.entity ? pageContext.entity.task : {};
71
+ };
72
+ func.getRequest = function() {
73
+ return pageContext && pageContext.entity ? pageContext.entity.request : {};
74
+ };
75
+ func.getPage = function() {
76
+ return pageContext && pageContext.entity ? pageContext.entity.page : {};
77
+ };
78
+ func.getCustomFunc = function(funcName) {
79
+ return getCustomFunc(pageContext, funcName);
80
+ };
81
+ }
71
82
  function removeCustomFuncFromWindow(pageDesign) {
72
83
  if (pageDesign && pageDesign.customEvents) {
73
84
  const customEvents = pageDesign.customEvents;
@@ -116,6 +127,7 @@ function handleEventUtil($event, pageContext, configure, eventType, isExecute, o
116
127
  const eventParams = packageEventParams(pageContext, configure, $event, otherParams);
117
128
  buttonClickEvent(pageContext, configure, eventParams);
118
129
  } else {
130
+ debugger;
119
131
  eventFun = getEventFuncByType(pageContext, events, eventType);
120
132
  if (isExecute) {
121
133
  const eventParams = packageEventParams(pageContext, configure, $event, otherParams);
@@ -184,13 +196,20 @@ function buttonClickEvent(pageContext, configure, eventParams) {
184
196
  }
185
197
  function doValidateForm(pageContext, configure, eventParams) {
186
198
  const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
199
+ let isEnableRequired = true;
187
200
  const clickEventFunObj = getClickEventFuncByType(pageContext, events, "click");
188
201
  if (clickEventFunObj) {
189
202
  const isStandardEvent = clickEventFunObj.isStandard;
190
203
  const event = clickEventFunObj.event;
191
- isNotNeedValidateRequired(isStandardEvent, event);
204
+ const isNotNeedValidate = isNotNeedValidateRequired(isStandardEvent, event);
205
+ if (isNotNeedValidate) {
206
+ isEnableRequired = false;
207
+ }
192
208
  }
193
- validateDataModelFunc(pageContext, configure, true).then(() => {
209
+ validateDataModelFunc(pageContext, configure, isEnableRequired).then((validateReslut) => {
210
+ if (!validateReslut) {
211
+ return;
212
+ }
194
213
  const beforeClickResult = doBeforeClickEvent(pageContext, configure, eventParams);
195
214
  if (!beforeClickResult) {
196
215
  return;
@@ -271,7 +290,7 @@ function isNotDoAfterClick(isStandardEvent, clickEvent) {
271
290
  return isStandardEvent && (clickEvent.eventName === "exportForm" || clickEvent.eventName === "exportPDF" || clickEvent.eventName === "import" || clickEvent.eventName === "assign" || clickEvent.eventName === "copyTask" || clickEvent.eventName === "addSigner" || clickEvent.eventName === "returnTaskTo" || clickEvent.eventName === "removeSigner");
272
291
  }
273
292
  function isNotNeedValidateRequired(isStandardEvent, clickEvent) {
274
- return isStandardEvent && (clickEvent.eventName === "downloadTemplate" || clickEvent.eventName === "back" || clickEvent.eventName === "exportForm" || clickEvent.eventName === "exportPDF" || clickEvent.eventName === "lineEditCreate");
293
+ return isStandardEvent && skipValidateEvents.includes(clickEvent.eventName);
275
294
  }
276
295
  function doAfterClickEvent(pageContext, configure, otherParams) {
277
296
  const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
@@ -594,6 +613,7 @@ function fileUploadBeforeUpload(params) {
594
613
  return getHandleEvent(null, params.pageContext, params.configureObj, "before-upload", params);
595
614
  }
596
615
  export {
616
+ appendDefaultMethods,
597
617
  canExecuteButton,
598
618
  cellClick,
599
619
  cellDblClick,
@@ -598,10 +598,13 @@ function dealAfterWithList(pageContext, configureObj, row, successTip) {
598
598
  }
599
599
  function refreshFormOrListPage(pageContext, configureObj) {
600
600
  let successOperation = configureObj.props.base.successOperation;
601
- const buttonForPageType = getPageType(pageContext, configureObj, false);
601
+ console.log("refreshFormOrListPage22=====successOperation=", successOperation);
602
+ const buttonForPageType = getPageType(pageContext, configureObj);
603
+ console.log("refreshFormOrListPage22=====buttonForPageType=", buttonForPageType);
602
604
  if (buttonForPageType && buttonForPageType === "list" && !successOperation) {
603
605
  successOperation = "refresh";
604
606
  }
607
+ console.log("refreshFormOrListPage33=====successOperation=", successOperation);
605
608
  if (successOperation === "refresh") {
606
609
  if (buttonForPageType && buttonForPageType === "list") {
607
610
  const tableUuid = getTableUuid(pageContext, configureObj);
@@ -149,16 +149,27 @@ function validateDataModelFunc(pageContext, configureObj, isEnableRequired) {
149
149
  const pageModel = pageContext.entity.page;
150
150
  const data = { ...pageModel, ...dataModel };
151
151
  const rules = pageContext.rules;
152
+ const isEnableRequiredSetting = configureObj.props.base ? configureObj.props.base.isEnableRequired : null;
153
+ if (isEnableRequiredSetting !== void 0 && isEnableRequiredSetting !== null) {
154
+ isEnableRequired = isEnableRequiredSetting;
155
+ }
156
+ if (typeof isEnableRequired === "undefined" || isEnableRequired === null) {
157
+ isEnableRequired = false;
158
+ }
152
159
  return validateDataModel(isEnableRequired, data, rules, pageContext);
153
160
  }
154
161
  function validateDataModel(isEnableRequired, dataModel, rules, pageContext) {
155
- {
162
+ if (isEnableRequired) {
156
163
  const isWorkflow = pageContext.workflowCode ? true : false;
157
164
  if (isWorkflow) {
158
165
  return validateWorkflowFormDataModel(dataModel, pageContext);
159
166
  } else {
160
167
  return validateCommonFormDataModel(dataModel, pageContext, rules);
161
168
  }
169
+ } else {
170
+ return new Promise((resolve, reject) => {
171
+ resolve(true);
172
+ });
162
173
  }
163
174
  }
164
175
  function validateWorkflowFormDataModel(dataModel, pageContext) {
@@ -91,6 +91,12 @@ export declare function setVariableValueWithProp(entity: any, prop: string, newV
91
91
  * @param variable
92
92
  */
93
93
  export declare function formatVariableValue(pageContext: PageContext, variable: string): any;
94
+ /**
95
+ * 获取参数名
96
+ * @param variable
97
+ * @returns
98
+ */
99
+ export declare function getParamNames(variable: string): any[] | RegExpMatchArray;
94
100
  /**
95
101
  * 根据类型格式化对象
96
102
  * @param value
@@ -376,7 +376,8 @@ function getParamNames(variable) {
376
376
  return [];
377
377
  }
378
378
  const reg = /\$\{[^\{|\}]+\}/g;
379
- return variable.match(reg);
379
+ const paramNames = variable.match(reg);
380
+ return paramNames ? paramNames : [];
380
381
  }
381
382
  function formatValueByType(value, formatType, formatInfo) {
382
383
  if (!formatType || value == "" || value == null || value == void 0) {
@@ -654,6 +655,7 @@ export {
654
655
  getComponentOptionConfigs,
655
656
  getFormPropName,
656
657
  getOptionDatasFromPage,
658
+ getParamNames,
657
659
  getValueFromSource,
658
660
  getValueFromVariable,
659
661
  getVariableValue,
@@ -416,7 +416,7 @@ const standardFuncUrlMap = {
416
416
  label: "导出",
417
417
  functions: [
418
418
  {
419
- path: "/commons/export-list-data$POST /commons/export-reports$POST"
419
+ path: "/commons/export-list-data$POST"
420
420
  }
421
421
  ]
422
422
  },
@@ -498,12 +498,12 @@ function getFunctionInfo(simpleCode) {
498
498
  }
499
499
  let funcInfo = functionMap[simpleCode];
500
500
  if (funcInfo == void 0) {
501
- for (let eventName in standardFuncUrlMap) {
501
+ for (const eventName in standardFuncUrlMap) {
502
502
  const functions = standardFuncUrlMap[eventName].functions;
503
503
  if (!functions) {
504
504
  continue;
505
505
  }
506
- for (let f of functions) {
506
+ for (const f of functions) {
507
507
  const tempCode = f.code ? f.code : eventName;
508
508
  if (simpleCode === tempCode) {
509
509
  funcInfo = f;
@@ -134,9 +134,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
134
134
  onChange: _cache[1] || (_cache[1] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "change")),
135
135
  onBlur: _cache[2] || (_cache[2] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "blur")),
136
136
  onFocus: _cache[3] || (_cache[3] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "focus")),
137
- onCalendarChange: _cache[4] || (_cache[4] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "calendar-change")),
138
- onVisibleChange: _cache[5] || (_cache[5] = ($event) => _ctx.handleEhandleFormEventvent($event, _ctx.pageContext, _ctx.configure, "visible-change")),
139
- onPanelChange: _cache[6] || (_cache[6] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "panel-change"))
137
+ onVisibleChange: _cache[4] || (_cache[4] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "visible-change")),
138
+ onPanelChange: _cache[5] || (_cache[5] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "panel-change"))
140
139
  }, null, 8, ["is-range", "clearable", "disabled", "readonly", "size", "placeholder", "start-placeholder", "end-placeholder", "format", "modelValue", "shortcuts", "type"])) : (openBlock(), createBlock(_component_el_date_picker, {
141
140
  key: 1,
142
141
  clearable: designProperty.value.clearable,
@@ -148,15 +147,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
148
147
  "end-placeholder": designProperty.value.endPlaceholder,
149
148
  format: designProperty.value.format,
150
149
  modelValue: dynamicModelMethod.value,
151
- "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => dynamicModelMethod.value = $event),
150
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => dynamicModelMethod.value = $event),
152
151
  shortcuts: shortcuts.value,
153
152
  type: designProperty.value.dateType,
154
- onChange: _cache[8] || (_cache[8] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "change")),
155
- onBlur: _cache[9] || (_cache[9] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "blur")),
156
- onFocus: _cache[10] || (_cache[10] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "focus")),
157
- onCalendarChange: _cache[11] || (_cache[11] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "calendar-change")),
158
- onVisibleChange: _cache[12] || (_cache[12] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "visible-change")),
159
- onPanelChange: _cache[13] || (_cache[13] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "panel-change"))
153
+ onChange: _cache[7] || (_cache[7] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "change")),
154
+ onBlur: _cache[8] || (_cache[8] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "blur")),
155
+ onFocus: _cache[9] || (_cache[9] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "focus")),
156
+ onVisibleChange: _cache[10] || (_cache[10] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "visible-change")),
157
+ onPanelChange: _cache[11] || (_cache[11] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "panel-change"))
160
158
  }, null, 8, ["clearable", "disabled", "readonly", "size", "placeholder", "start-placeholder", "end-placeholder", "format", "modelValue", "shortcuts", "type"]))
161
159
  ]),
162
160
  _: 1
@@ -93,12 +93,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
93
93
  maxlength: designProperty.value.maxLength,
94
94
  "show-word-limit": designProperty.value.showInputNum,
95
95
  modelValue: dynamicModelMethod.value,
96
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dynamicModelMethod.value = $event),
97
- onInput: _cache[1] || (_cache[1] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "input")),
98
- onChange: _cache[2] || (_cache[2] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "change")),
99
- onBlur: _cache[3] || (_cache[3] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "blur")),
100
- onFocus: _cache[4] || (_cache[4] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "focus")),
101
- onClick: _cache[5] || (_cache[5] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "click"))
96
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => dynamicModelMethod.value = $event),
97
+ onInput: _cache[5] || (_cache[5] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "input")),
98
+ onChange: _cache[6] || (_cache[6] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "change")),
99
+ onBlur: _cache[7] || (_cache[7] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "blur")),
100
+ onFocus: _cache[8] || (_cache[8] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "focus")),
101
+ onClick: _cache[9] || (_cache[9] = ($event) => unref(handleFormEvent)($event, _ctx.pageContext, _ctx.configure, "click"))
102
102
  }, createSlots({ _: 2 }, [
103
103
  designProperty.value.iconPosition != "outer" && (designProperty.value.preIconType && designProperty.value.preIconValue || designProperty.value.preText) ? {
104
104
  name: "prefix",
@@ -106,7 +106,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
106
106
  designProperty.value.preIconType && designProperty.value.preIconValue ? (openBlock(), createBlock(unref(SuperIcon), {
107
107
  key: 0,
108
108
  iconType: designProperty.value.preIconType,
109
- iconValue: designProperty.value.preIconValue
109
+ iconValue: designProperty.value.preIconValue,
110
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(handleFormEvent)(dynamicModelMethod.value, _ctx.pageContext, _ctx.configure, "prefixClick"))
110
111
  }, null, 8, ["iconType", "iconValue"])) : createCommentVNode("", true),
111
112
  createTextVNode(" " + toDisplayString(designProperty.value.preText), 1)
112
113
  ]),
@@ -118,7 +119,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
118
119
  designProperty.value.preIconType && designProperty.value.preIconValue ? (openBlock(), createBlock(unref(SuperIcon), {
119
120
  key: 0,
120
121
  iconType: designProperty.value.preIconType,
121
- iconValue: designProperty.value.preIconValue
122
+ iconValue: designProperty.value.preIconValue,
123
+ onClick: _cache[1] || (_cache[1] = ($event) => unref(handleFormEvent)(dynamicModelMethod.value, _ctx.pageContext, _ctx.configure, "prefixClick"))
122
124
  }, null, 8, ["iconType", "iconValue"])) : createCommentVNode("", true),
123
125
  createTextVNode(" " + toDisplayString(designProperty.value.preText), 1)
124
126
  ]),
@@ -130,7 +132,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
130
132
  designProperty.value.sufIconType && designProperty.value.sufIconValue ? (openBlock(), createBlock(unref(SuperIcon), {
131
133
  key: 0,
132
134
  iconType: designProperty.value.sufIconType,
133
- iconValue: designProperty.value.sufIconValue
135
+ iconValue: designProperty.value.sufIconValue,
136
+ onClick: _cache[2] || (_cache[2] = ($event) => unref(handleFormEvent)(dynamicModelMethod.value, _ctx.pageContext, _ctx.configure, "suffixClick"))
134
137
  }, null, 8, ["iconType", "iconValue"])) : createCommentVNode("", true),
135
138
  createTextVNode(" " + toDisplayString(designProperty.value.sufText), 1)
136
139
  ]),
@@ -142,7 +145,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
142
145
  designProperty.value.sufIconType && designProperty.value.sufIconValue ? (openBlock(), createBlock(unref(SuperIcon), {
143
146
  key: 0,
144
147
  iconType: designProperty.value.sufIconType,
145
- iconValue: designProperty.value.sufIconValue
148
+ iconValue: designProperty.value.sufIconValue,
149
+ onClick: _cache[3] || (_cache[3] = ($event) => unref(handleFormEvent)(dynamicModelMethod.value, _ctx.pageContext, _ctx.configure, "suffixClick"))
146
150
  }, null, 8, ["iconType", "iconValue"])) : createCommentVNode("", true),
147
151
  createTextVNode(" " + toDisplayString(designProperty.value.sufText), 1)
148
152
  ]),
@@ -1,6 +1,6 @@
1
- import { defineComponent, ref, watch, resolveComponent, openBlock, createBlock, unref, normalizeStyle } from "vue";
2
- import "../../../../utils/eventBus.js";
1
+ import { defineComponent, ref, watch, resolveComponent, unref, openBlock, createElementBlock, toDisplayString, createBlock, normalizeStyle } from "vue";
3
2
  import { getWorkflowId } from "../../../../utils/common-util.js";
3
+ const _hoisted_1 = { key: 0 };
4
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  __name: "pictureflow-runtime",
6
6
  props: {
@@ -26,12 +26,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
26
26
  }
27
27
  return (_ctx, _cache) => {
28
28
  const _component_workflow_history = resolveComponent("workflow-history");
29
- return openBlock(), createBlock(_component_workflow_history, {
29
+ return !unref(workflowId) ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(_ctx.$t("superPageRuntimeMessage.flowNotStart")), 1)) : (openBlock(), createBlock(_component_workflow_history, {
30
+ key: 1,
30
31
  id: unref(workflowId),
31
32
  ref_key: "historyGraphRef",
32
33
  ref: historyGraphRef,
33
34
  style: normalizeStyle({ maxHeight: maxHeight.value + "px" })
34
- }, null, 8, ["id", "style"]);
35
+ }, null, 8, ["id", "style"]));
35
36
  };
36
37
  }
37
38
  });
@@ -1,6 +1,6 @@
1
- import { defineComponent, ref, watch, resolveComponent, openBlock, createBlock, unref, normalizeStyle } from "vue";
2
- import "../../../../utils/eventBus.js";
1
+ import { defineComponent, ref, watch, resolveComponent, unref, openBlock, createElementBlock, toDisplayString, createBlock, normalizeStyle } from "vue";
3
2
  import { getWorkflowId } from "../../../../utils/common-util.js";
3
+ const _hoisted_1 = { key: 0 };
4
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  __name: "textflow-runtime",
6
6
  props: {
@@ -29,12 +29,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29
29
  }
30
30
  return (_ctx, _cache) => {
31
31
  const _component_workflow_history_list = resolveComponent("workflow-history-list");
32
- return openBlock(), createBlock(_component_workflow_history_list, {
32
+ return !unref(workflowId) ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(_ctx.$t("superPageRuntimeMessage.flowNotStart")), 1)) : (openBlock(), createBlock(_component_workflow_history_list, {
33
+ key: 1,
33
34
  ref_key: "historyList",
34
35
  ref: historyList,
35
36
  "workflow-id": unref(workflowId),
36
37
  style: normalizeStyle({ maxHeight: maxHeight.value + "px" })
37
- }, null, 8, ["workflow-id", "style"]);
38
+ }, null, 8, ["workflow-id", "style"]));
38
39
  };
39
40
  }
40
41
  });
@@ -264,6 +264,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
264
264
  initPageDesign(pageConf).then(() => {
265
265
  sessionCacheDataId();
266
266
  isShowPage.value = true;
267
+ setContextStyle();
267
268
  });
268
269
  }
269
270
  });
@@ -46,7 +46,8 @@ const cn = {
46
46
  required: "{label}必填",
47
47
  formatMismatch: "{label}格式不匹配",
48
48
  overMaxLength: "{label}最多只能输入{value}字符",
49
- limitMinLength: "{label}至少输入{value}字符"
49
+ limitMinLength: "{label}至少输入{value}字符",
50
+ flowNotStart: "流程未提交"
50
51
  }
51
52
  };
52
53
  export {
@@ -46,7 +46,8 @@ const en = {
46
46
  required: "{label} is required",
47
47
  formatMismatch: "{label} Format mismatch",
48
48
  overMaxLength: "{label} can only input a maximum of {value} characters",
49
- limitMinLength: "Enter at least {value} characters for {label}"
49
+ limitMinLength: "Enter at least {value} characters for {label}",
50
+ flowNotStart: "Workflow Not Started"
50
51
  }
51
52
  };
52
53
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "super-page-runtime",
3
- "version": "2.0.43-beta3",
3
+ "version": "2.0.43-beta5",
4
4
  "description": "AgileBuilder super page runtime",
5
5
  "license": "ISC",
6
6
  "main": "dist/es/index.js",
@@ -69,4 +69,4 @@
69
69
  "vue-router": "^4.3.0",
70
70
  "vuex": "^4.1.0"
71
71
  }
72
- }
72
+ }