super-page-runtime 2.0.9 → 2.0.13
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/components/runtime/utils/api/api-util.d.ts +6 -1
- package/dist/es/components/runtime/utils/api/api-util.js +140 -2
- package/dist/es/components/runtime/utils/charts/chart-columnline-util.js +279 -0
- package/dist/es/components/runtime/utils/charts/chart-gauge-util.js +74 -0
- package/dist/es/components/runtime/utils/charts/chart-pie-util.js +118 -0
- package/dist/es/components/runtime/utils/charts/chart-radar-util.js +100 -0
- package/dist/es/components/runtime/utils/charts/chart-scatter-util.js +74 -0
- package/dist/es/components/runtime/utils/charts/chart-util.d.ts +40 -0
- package/dist/es/components/runtime/utils/charts/chart-util.js +288 -14
- package/dist/es/components/runtime/utils/events/event-util.d.ts +5 -0
- package/dist/es/components/runtime/utils/events/event-util.js +42 -10
- package/dist/es/components/runtime/utils/events/standard-event.d.ts +1 -0
- package/dist/es/components/runtime/utils/events/standard-event.js +54 -5
- package/dist/es/components/runtime/utils/events/validator-util.d.ts +8 -0
- package/dist/es/components/runtime/utils/events/validator-util.js +83 -57
- package/dist/es/components/runtime/utils/interfaces/page-design-types.d.ts +0 -1
- package/dist/es/components/runtime/utils/page-helper-util.d.ts +22 -0
- package/dist/es/components/runtime/utils/page-helper-util.js +59 -50
- package/dist/es/components/runtime/utils/page-init-util.d.ts +1 -0
- package/dist/es/components/runtime/utils/page-init-util.js +29 -4
- package/dist/es/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue2.js +8 -3
- package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue2.js +34 -322
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header.vue.js +2 -1
- package/dist/es/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue2.js +66 -12
- package/dist/es/components/runtime/views/assemblys/chart/pie/pie-runtime.vue2.js +91 -4
- package/dist/es/components/runtime/views/assemblys/chart/radar/radar-runtime.vue2.js +65 -4
- package/dist/es/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue2.js +65 -4
- package/dist/es/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue2.js +36 -1
- package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +1 -1
- package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +2 -4
- package/dist/es/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue2.js +22 -58
- package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +16 -3
- package/dist/es/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue2.js +10 -1
- package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue2.js +25 -2
- package/dist/es/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue2.js +5 -1
- package/dist/es/components/runtime/views/assemblys/form/link/link-runtime.vue2.js +3 -2
- package/dist/es/components/runtime/views/assemblys/form/radio/radio-runtime.vue2.js +14 -11
- package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue2.js +2 -0
- package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue2.js +14 -11
- package/dist/es/components/runtime/views/assemblys/form/switch/switch-runtime.vue2.js +3 -1
- package/dist/es/components/runtime/views/assemblys/form/tag/tag-runtime.vue2.js +4 -1
- package/dist/es/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue2.js +7 -1
- package/dist/es/components/runtime/views/assemblys/object-render.vue.js +2 -1
- package/dist/es/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue2.js +1 -1
- package/dist/es/components/runtime/views/super-page-dialog.vue.js +3 -0
- package/dist/es/components/runtime/views/super-page.vue.js +84 -130
- package/dist/es/index.d.ts +2 -2
- package/dist/es/index.js +2 -1
- package/package.json +2 -2
package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue2.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, onMounted, watch, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createVNode, vShow } from "vue";
|
|
2
|
-
import { getCustomTheme } from "../../../../utils/charts/chart-util.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { getCustomTheme, initChartOption, monitorChartClickToVariable } from "../../../../utils/charts/chart-util.js";
|
|
3
|
+
import { getChartDatasFromPage, updateChartDatasources, monitorFieldChange } from "../../../../utils/page-helper-util.js";
|
|
4
|
+
import { updateChartOption } from "../../../../utils/charts/chart-columnline-util.js";
|
|
5
5
|
import _sfc_main$1 from "../common/common-chart-header.vue.js";
|
|
6
6
|
import { use } from "echarts/core";
|
|
7
7
|
import { CanvasRenderer } from "echarts/renderers";
|
|
@@ -31,50 +31,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
31
31
|
const chartRef = ref(null);
|
|
32
32
|
const headerRef = ref(null);
|
|
33
33
|
const enableDrill = props.configure.props ? props.configure.props.enableDrill : null;
|
|
34
|
+
const drillEndTrigger = props.configure.props ? props.configure.props.drillEndTrigger : null;
|
|
35
|
+
const selGroupVariable = props.configure.props ? props.configure.props.selGroupVariable : null;
|
|
34
36
|
const runtimeInfo = props.configure.runtime ? props.configure.runtime : {};
|
|
35
37
|
const runtimeStyle = runtimeInfo.style;
|
|
36
38
|
const runtimeClass = runtimeInfo.class;
|
|
37
39
|
const dataConfig = runtimeInfo.dataConfig;
|
|
38
40
|
const headerInfo = runtimeInfo.headerInfo ? runtimeInfo.headerInfo : {};
|
|
39
|
-
let cacheDatas = null;
|
|
40
41
|
const chartOption = runtimeInfo.chartOption;
|
|
41
|
-
const defaultSeries = chartOption.series;
|
|
42
|
-
if (defaultSeries && defaultSeries.length > 0) {
|
|
43
|
-
for (let s of defaultSeries) {
|
|
44
|
-
s.data = [];
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const defaultXaxis = chartOption.xAxis;
|
|
48
|
-
if (defaultXaxis && defaultXaxis.length > 0 && defaultXaxis[0].data) {
|
|
49
|
-
defaultXaxis[0].data = [];
|
|
50
|
-
}
|
|
51
|
-
const defaultYaxis = chartOption.yAxis;
|
|
52
|
-
if (defaultYaxis) {
|
|
53
|
-
for (let yAxis of defaultYaxis) {
|
|
54
|
-
if (yAxis.data) {
|
|
55
|
-
yAxis.data = [];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
console.log("chartOption", chartOption);
|
|
60
42
|
const configureProps = props.configure.props ? props.configure.props : {};
|
|
61
43
|
const customTheme = getCustomTheme(configureProps.customTheme);
|
|
62
|
-
|
|
63
|
-
if (!resultData) {
|
|
64
|
-
resultData = [];
|
|
65
|
-
}
|
|
66
|
-
resultData = resultData.length > 0 ? resultData[0] : {};
|
|
67
|
-
if (!resultData) {
|
|
68
|
-
resultData = {};
|
|
69
|
-
}
|
|
70
|
-
if (resultData.hasRender) {
|
|
71
|
-
resultData.hasRender = true;
|
|
72
|
-
console.log("重复更新!", resultData);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
resultData.hasRender = true;
|
|
76
|
-
updateChartOption(resultData);
|
|
77
|
-
}
|
|
44
|
+
initChartOption(props.configure, chartOption);
|
|
78
45
|
onMounted(() => {
|
|
79
46
|
const resultData = getChartDatasFromPage(props.pageContext, props.configure);
|
|
80
47
|
if (resultData) {
|
|
@@ -83,12 +50,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
83
50
|
if (enableDrill && chartRef.value) {
|
|
84
51
|
chartRef.value.chart.on("click", function(params) {
|
|
85
52
|
if (headerRef.value && headerRef.value.drill) {
|
|
86
|
-
headerRef.value.drill(params, cacheDatas);
|
|
53
|
+
headerRef.value.drill(params, props.configure.cacheDatas);
|
|
87
54
|
}
|
|
88
55
|
});
|
|
89
56
|
}
|
|
57
|
+
if (!enableDrill && selGroupVariable && chartRef.value) {
|
|
58
|
+
monitorChartClickToVariable(
|
|
59
|
+
props.pageContext,
|
|
60
|
+
props.configure,
|
|
61
|
+
chartRef.value.chart,
|
|
62
|
+
selGroupVariable
|
|
63
|
+
);
|
|
64
|
+
}
|
|
90
65
|
});
|
|
91
66
|
function onDrillEnd(params) {
|
|
67
|
+
if (drillEndTrigger == "clearDrill") {
|
|
68
|
+
if (headerRef.value && headerRef.value.closeDrill) {
|
|
69
|
+
headerRef.value.closeDrill(0);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
92
72
|
}
|
|
93
73
|
let hisGroupValue = headerInfo.groupValue;
|
|
94
74
|
watch(headerInfo, () => {
|
|
@@ -106,292 +86,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
106
86
|
dataConfig.services[0].groupValue = headerInfo.groupValue;
|
|
107
87
|
updateChartDatasources(props.pageContext, [dataConfig], headerInfo.drillParams);
|
|
108
88
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const groupValue = resultData && resultData.groupValue ? resultData.groupValue : [];
|
|
115
|
-
const dataSetField = props.configure.serviceDataField;
|
|
116
|
-
let datas = null;
|
|
117
|
-
if (dataSetField) {
|
|
118
|
-
datas = result[dataSetField];
|
|
119
|
-
} else {
|
|
120
|
-
if (result) {
|
|
121
|
-
if (Array.isArray(result)) {
|
|
122
|
-
datas = result;
|
|
123
|
-
} else {
|
|
124
|
-
datas = [result];
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (!datas) {
|
|
129
|
-
datas = [];
|
|
130
|
-
}
|
|
131
|
-
let confGroups = props.configure.props ? props.configure.props.groups : null;
|
|
132
|
-
if (!confGroups) {
|
|
133
|
-
confGroups = [];
|
|
134
|
-
}
|
|
135
|
-
const groupMap = {};
|
|
136
|
-
const groupFields = [];
|
|
137
|
-
for (let g of confGroups) {
|
|
138
|
-
groupMap[g.group] = g.target;
|
|
139
|
-
if (g.target && !groupFields.includes(g.target)) {
|
|
140
|
-
groupFields.push(g.target);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
let mulGroupShow = props.configure.props ? props.configure.props.mulGroupShow : "";
|
|
144
|
-
mulGroupShow = mulGroupShow == "break" ? "<br/>" : " ";
|
|
145
|
-
const xFieldName = "__x";
|
|
146
|
-
for (let d of datas) {
|
|
147
|
-
if (!d) {
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
const xValues2 = [];
|
|
151
|
-
for (let g of groupValue) {
|
|
152
|
-
const fieldName = groupMap[g];
|
|
153
|
-
const value = getValueFromSource(d, fieldName, void 0);
|
|
154
|
-
if (value) {
|
|
155
|
-
xValues2.push(value);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
const xValue = xValues2.join(mulGroupShow);
|
|
159
|
-
d[xFieldName] = xValue;
|
|
160
|
-
}
|
|
161
|
-
const itemConfs = props.configure.items ? props.configure.items : [];
|
|
162
|
-
const serieValues = [];
|
|
163
|
-
const serieValueMap = {};
|
|
164
|
-
const dynamicFileds = [];
|
|
165
|
-
const dynamicValueField = {};
|
|
166
|
-
const allValueFields = [];
|
|
167
|
-
for (let item of itemConfs) {
|
|
168
|
-
const itemProps = item.props ? item.props : {};
|
|
169
|
-
const sourceType = itemProps.yaxisSource;
|
|
170
|
-
const yaxisField = itemProps.yaxisField;
|
|
171
|
-
let serieValue = null;
|
|
172
|
-
if (yaxisField && (!sourceType || sourceType == "variable")) {
|
|
173
|
-
serieValue = {
|
|
174
|
-
uuid: item.uuid,
|
|
175
|
-
type: "variable",
|
|
176
|
-
field: yaxisField,
|
|
177
|
-
data: [],
|
|
178
|
-
dynamicDatas: []
|
|
179
|
-
//动态系列数据
|
|
180
|
-
};
|
|
181
|
-
if (yaxisField && !allValueFields.includes(yaxisField)) {
|
|
182
|
-
allValueFields.push(yaxisField);
|
|
183
|
-
}
|
|
184
|
-
} else {
|
|
185
|
-
serieValue = {
|
|
186
|
-
uuid: item.uuid,
|
|
187
|
-
type: "fixed",
|
|
188
|
-
field: itemProps.yaxisFix,
|
|
189
|
-
data: [],
|
|
190
|
-
dynamicDatas: []
|
|
191
|
-
//动态系列数据
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
if (serieValue != null) {
|
|
195
|
-
serieValues.push(serieValue);
|
|
196
|
-
serieValueMap[item.uuid] = serieValue;
|
|
197
|
-
}
|
|
198
|
-
if (itemProps.dynamicSeriesField && // !groupFields.includes(itemProps.dynamicSeriesField) &&
|
|
199
|
-
!dynamicFileds.includes(itemProps.dynamicSeriesField) && serieValue && yaxisField) {
|
|
200
|
-
serieValue.dynamicField = itemProps.dynamicSeriesField;
|
|
201
|
-
serieValue.dynamicSeriesTitle = itemProps.dynamicSeriesTitle;
|
|
202
|
-
serieValue.dynamicShowStack = itemProps.dynamicShowStack;
|
|
203
|
-
dynamicFileds.push(itemProps.dynamicSeriesField);
|
|
204
|
-
dynamicValueField[itemProps.dynamicSeriesField] = yaxisField;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
const dynamicLabelMap = {};
|
|
208
|
-
if (dynamicFileds.length > 0) {
|
|
209
|
-
const newDatas = [];
|
|
210
|
-
const dataMap = {};
|
|
211
|
-
for (let d of datas) {
|
|
212
|
-
if (!d) {
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
for (let valueField of allValueFields) {
|
|
216
|
-
const groupValue2 = d[xFieldName];
|
|
217
|
-
let newData = dataMap[groupValue2];
|
|
218
|
-
if (!newData) {
|
|
219
|
-
newData = {};
|
|
220
|
-
for (let gField of groupFields) {
|
|
221
|
-
newData[gField] = d[gField];
|
|
222
|
-
}
|
|
223
|
-
newData[xFieldName] = d[xFieldName];
|
|
224
|
-
dataMap[groupValue2] = newData;
|
|
225
|
-
newDatas.push(newData);
|
|
226
|
-
}
|
|
227
|
-
let newValue = getValueFromSource(d, valueField, void 0);
|
|
228
|
-
if (!isNaN(newValue)) {
|
|
229
|
-
const hisValue = newData[valueField];
|
|
230
|
-
if (!isNaN) {
|
|
231
|
-
newValue += hisValue;
|
|
232
|
-
}
|
|
233
|
-
newData[valueField] = newValue;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
for (let dynamicField of dynamicFileds) {
|
|
238
|
-
const dynamicLabels = [];
|
|
239
|
-
for (let d of datas) {
|
|
240
|
-
if (!d) {
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
const groupValue2 = d[xFieldName];
|
|
244
|
-
let newData = dataMap[groupValue2];
|
|
245
|
-
if (!newData) {
|
|
246
|
-
continue;
|
|
247
|
-
}
|
|
248
|
-
let dynamicLabel = getValueFromSource(d, dynamicField, void 0);
|
|
249
|
-
dynamicLabel = dynamicLabel == null || dynamicLabel == void 0 ? "" : dynamicLabel;
|
|
250
|
-
if (!dynamicLabels.includes(dynamicLabel)) {
|
|
251
|
-
dynamicLabels.push(dynamicLabel);
|
|
252
|
-
}
|
|
253
|
-
const valueField = dynamicValueField[dynamicField];
|
|
254
|
-
let newValue = getValueFromSource(d, valueField, void 0);
|
|
255
|
-
if (!isNaN(newValue)) {
|
|
256
|
-
const hisValue = newData[dynamicLabel];
|
|
257
|
-
if (!isNaN) {
|
|
258
|
-
newValue += hisValue;
|
|
259
|
-
}
|
|
260
|
-
newData[dynamicLabel] = newValue;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
dynamicLabelMap[dynamicField] = dynamicLabels;
|
|
264
|
-
}
|
|
265
|
-
datas = newDatas;
|
|
266
|
-
}
|
|
267
|
-
sortDatas(datas);
|
|
268
|
-
const xValues = [];
|
|
269
|
-
for (let data of datas) {
|
|
270
|
-
if (!data) {
|
|
271
|
-
continue;
|
|
272
|
-
}
|
|
273
|
-
xValues.push(data[xFieldName]);
|
|
274
|
-
for (let item of serieValues) {
|
|
275
|
-
let serieData = item.data;
|
|
276
|
-
const dynamicDatas = item.dynamicDatas;
|
|
277
|
-
if (item.dynamicField) {
|
|
278
|
-
let dynamicLabels = dynamicLabelMap[item.dynamicField];
|
|
279
|
-
dynamicLabels = dynamicLabels ? dynamicLabels : [];
|
|
280
|
-
for (let i = 0; i < dynamicLabels.length; i++) {
|
|
281
|
-
if (i >= dynamicDatas.length) {
|
|
282
|
-
dynamicDatas.push([]);
|
|
283
|
-
}
|
|
284
|
-
serieData = dynamicDatas[i];
|
|
285
|
-
const fieldName = dynamicLabels[i];
|
|
286
|
-
const value = getValueFromSource(data, fieldName, void 0);
|
|
287
|
-
serieData.push(value);
|
|
288
|
-
}
|
|
289
|
-
} else if (item.type == "fixed") {
|
|
290
|
-
serieData.push(item.field);
|
|
291
|
-
} else if (item.type == "variable") {
|
|
292
|
-
const value = getValueFromSource(data, item.field, void 0);
|
|
293
|
-
serieData.push(value);
|
|
294
|
-
} else {
|
|
295
|
-
serieData.push(void 0);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
const tempSeries = deepCopy(defaultSeries == null ? [] : defaultSeries);
|
|
300
|
-
const newSeries = [];
|
|
301
|
-
for (let serie of tempSeries) {
|
|
302
|
-
const serieValue = serieValueMap[serie.uuid];
|
|
303
|
-
if (serieValue.dynamicField) {
|
|
304
|
-
let dynamicLabels = dynamicLabelMap[serieValue.dynamicField];
|
|
305
|
-
dynamicLabels = dynamicLabels ? dynamicLabels : [];
|
|
306
|
-
const dynamicDatas = serieValue.dynamicDatas ? serieValue.dynamicDatas : [];
|
|
307
|
-
for (let i = 0; i < dynamicLabels.length; i++) {
|
|
308
|
-
let label = dynamicLabels[i];
|
|
309
|
-
const newSerie = deepCopy(serie);
|
|
310
|
-
if (serieValue.dynamicSeriesTitle) {
|
|
311
|
-
const dynamicSeriesTitle = serieValue.dynamicSeriesTitle.replace("${name}", label);
|
|
312
|
-
newSerie.name = formatVariableValue(props.pageContext, dynamicSeriesTitle);
|
|
313
|
-
} else {
|
|
314
|
-
newSerie.name = label;
|
|
315
|
-
}
|
|
316
|
-
newSerie.data = i < dynamicDatas.length ? dynamicDatas[i] : [];
|
|
317
|
-
if (serie.type == "bar" && serieValue.dynamicShowStack) {
|
|
318
|
-
newSerie.stack = serie.uuid;
|
|
319
|
-
}
|
|
320
|
-
newSeries.push(newSerie);
|
|
321
|
-
}
|
|
322
|
-
} else {
|
|
323
|
-
serie.data = serieValue ? serieValue.data : [];
|
|
324
|
-
newSeries.push(serie);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
chartOption.series = newSeries;
|
|
328
|
-
if (chartOption.isBar) {
|
|
329
|
-
if (defaultYaxis) {
|
|
330
|
-
for (let tempYaxis of defaultYaxis) {
|
|
331
|
-
tempYaxis.data = xValues;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
chartOption.xAxis = defaultXaxis;
|
|
335
|
-
chartOption.yAxis = defaultYaxis;
|
|
336
|
-
} else {
|
|
337
|
-
if (defaultXaxis && defaultXaxis.length > 0) {
|
|
338
|
-
defaultXaxis[0].data = xValues;
|
|
339
|
-
}
|
|
340
|
-
chartOption.xAxis = defaultXaxis;
|
|
341
|
-
chartOption.yAxis = defaultYaxis;
|
|
89
|
+
const monitorFields = headerInfo.monitorFields;
|
|
90
|
+
monitorFieldChange(props.pageContext, monitorFields, refresh);
|
|
91
|
+
function updateChartDatas(resultData) {
|
|
92
|
+
if (!resultData) {
|
|
93
|
+
resultData = [];
|
|
342
94
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
function sortDatas(datas) {
|
|
347
|
-
const itemConfs = props.configure.items ? props.configure.items : [];
|
|
348
|
-
let orderByTarget = props.configure.props ? props.configure.props.orderByTarget : "";
|
|
349
|
-
let orderField = null;
|
|
350
|
-
if (orderByTarget == "x" || orderByTarget == "X") {
|
|
351
|
-
orderField = "__x";
|
|
352
|
-
} else if (orderByTarget) {
|
|
353
|
-
for (let item of itemConfs) {
|
|
354
|
-
if (item.uuid == orderByTarget) {
|
|
355
|
-
const itemProps = item.props ? item.props : {};
|
|
356
|
-
const sourceType = itemProps.yaxisSource;
|
|
357
|
-
const yaxisField = itemProps.yaxisField;
|
|
358
|
-
if (yaxisField && (!sourceType || sourceType == "variable")) {
|
|
359
|
-
orderField = yaxisField;
|
|
360
|
-
break;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
95
|
+
resultData = resultData.length > 0 ? resultData[0] : {};
|
|
96
|
+
if (!resultData) {
|
|
97
|
+
resultData = {};
|
|
364
98
|
}
|
|
365
|
-
if (
|
|
99
|
+
if (resultData.hasRender) {
|
|
100
|
+
resultData.hasRender = true;
|
|
101
|
+
console.log("重复更新!", resultData);
|
|
366
102
|
return;
|
|
367
103
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
let orderVariable = props.configure.props ? props.configure.props.orderVariable : "";
|
|
372
|
-
orderValue = formatVariableValue(props.pageContext, orderVariable);
|
|
373
|
-
}
|
|
374
|
-
orderValue = orderValue == "desc" || orderValue == "DESC" ? "desc" : "asc";
|
|
375
|
-
let maxLen = datas.length;
|
|
376
|
-
for (let i = 0; i < maxLen - 1; i++) {
|
|
377
|
-
let vali = getValueFromSource(datas[i], orderField, void 0);
|
|
378
|
-
for (let j = i + 1; j < maxLen; j++) {
|
|
379
|
-
let valj = getValueFromSource(datas[j], orderField, void 0);
|
|
380
|
-
let isSwap = false;
|
|
381
|
-
if ("desc" == orderValue) {
|
|
382
|
-
if (vali < valj) {
|
|
383
|
-
isSwap = true;
|
|
384
|
-
}
|
|
385
|
-
} else {
|
|
386
|
-
if (vali > valj) {
|
|
387
|
-
isSwap = true;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
if (isSwap) {
|
|
391
|
-
[datas[i], datas[j]] = [datas[j], datas[i]];
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
104
|
+
resultData.hasRender = true;
|
|
105
|
+
updateChartOption(props.pageContext, props.configure, chartOption, resultData);
|
|
106
|
+
console.log("chartOption", chartOption);
|
|
395
107
|
}
|
|
396
108
|
__expose({
|
|
397
109
|
updateChartDatas
|
|
@@ -60,7 +60,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
60
60
|
props.headerInfo.groupValue = props.headerInfo.options[drillIndex].value;
|
|
61
61
|
}
|
|
62
62
|
__expose({
|
|
63
|
-
drill
|
|
63
|
+
drill,
|
|
64
|
+
closeDrill
|
|
64
65
|
});
|
|
65
66
|
return (_ctx, _cache) => {
|
|
66
67
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { defineComponent, ref, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, createVNode } from "vue";
|
|
2
|
-
import { getCustomTheme } from "../../../../utils/charts/chart-util.js";
|
|
1
|
+
import { defineComponent, ref, onMounted, watch, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createVNode, vShow } from "vue";
|
|
2
|
+
import { getCustomTheme, initChartOption } from "../../../../utils/charts/chart-util.js";
|
|
3
|
+
import { getChartDatasFromPage, updateChartDatasources, monitorFieldChange } from "../../../../utils/page-helper-util.js";
|
|
4
|
+
import { updateChartOption } from "../../../../utils/charts/chart-gauge-util.js";
|
|
5
|
+
import _sfc_main$1 from "../common/common-chart-header.vue.js";
|
|
3
6
|
import { use } from "echarts/core";
|
|
4
7
|
import { CanvasRenderer } from "echarts/renderers";
|
|
5
8
|
import { GaugeChart } from "echarts/charts";
|
|
@@ -11,23 +14,66 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11
14
|
pageContext: {},
|
|
12
15
|
configure: {}
|
|
13
16
|
},
|
|
14
|
-
setup(__props) {
|
|
15
|
-
use([
|
|
16
|
-
CanvasRenderer,
|
|
17
|
-
GaugeChart,
|
|
18
|
-
GridComponent,
|
|
19
|
-
TitleComponent,
|
|
20
|
-
TooltipComponent,
|
|
21
|
-
ToolboxComponent
|
|
22
|
-
]);
|
|
17
|
+
setup(__props, { expose: __expose }) {
|
|
18
|
+
use([CanvasRenderer, GaugeChart, GridComponent, TitleComponent, TooltipComponent, ToolboxComponent]);
|
|
23
19
|
const props = __props;
|
|
24
20
|
const thisRef = ref(null);
|
|
21
|
+
const chartRef = ref(null);
|
|
22
|
+
const headerRef = ref(null);
|
|
25
23
|
const runtimeInfo = props.configure.runtime ? props.configure.runtime : {};
|
|
26
24
|
const runtimeStyle = runtimeInfo.style;
|
|
27
25
|
const runtimeClass = runtimeInfo.class;
|
|
26
|
+
const dataConfig = runtimeInfo.dataConfig;
|
|
27
|
+
const headerInfo = runtimeInfo.headerInfo ? runtimeInfo.headerInfo : {};
|
|
28
28
|
const chartOption = runtimeInfo.chartOption;
|
|
29
29
|
const configureProps = props.configure.props ? props.configure.props : {};
|
|
30
30
|
const customTheme = getCustomTheme(configureProps.customTheme);
|
|
31
|
+
initChartOption(props.configure, chartOption);
|
|
32
|
+
onMounted(() => {
|
|
33
|
+
const resultData = getChartDatasFromPage(props.pageContext, props.configure);
|
|
34
|
+
if (resultData) {
|
|
35
|
+
updateChartDatas(resultData);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
let hisGroupValue = headerInfo.groupValue;
|
|
39
|
+
watch(headerInfo, () => {
|
|
40
|
+
if (hisGroupValue == headerInfo.groupValue) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
hisGroupValue = headerInfo.groupValue;
|
|
44
|
+
refresh();
|
|
45
|
+
});
|
|
46
|
+
function refresh() {
|
|
47
|
+
if (!dataConfig) {
|
|
48
|
+
console.log("无数据源配置,不需要查询!");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
dataConfig.services[0].groupValue = headerInfo.groupValue;
|
|
52
|
+
updateChartDatasources(props.pageContext, [dataConfig], headerInfo.drillParams);
|
|
53
|
+
}
|
|
54
|
+
const monitorFields = headerInfo.monitorFields;
|
|
55
|
+
monitorFieldChange(props.pageContext, monitorFields, refresh);
|
|
56
|
+
function updateChartDatas(resultData) {
|
|
57
|
+
if (!resultData) {
|
|
58
|
+
resultData = [];
|
|
59
|
+
}
|
|
60
|
+
resultData = resultData.length > 0 ? resultData[0] : {};
|
|
61
|
+
if (!resultData) {
|
|
62
|
+
resultData = {};
|
|
63
|
+
}
|
|
64
|
+
if (resultData.hasRender) {
|
|
65
|
+
resultData.hasRender = true;
|
|
66
|
+
console.log("重复更新!", resultData);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
resultData.hasRender = true;
|
|
70
|
+
console.log("gauge resultData", resultData);
|
|
71
|
+
updateChartOption(props.pageContext, props.configure, chartOption, resultData);
|
|
72
|
+
console.log("chartOption", chartOption);
|
|
73
|
+
}
|
|
74
|
+
__expose({
|
|
75
|
+
updateChartDatas
|
|
76
|
+
});
|
|
31
77
|
return (_ctx, _cache) => {
|
|
32
78
|
return openBlock(), createElementBlock("div", {
|
|
33
79
|
style: normalizeStyle(unref(runtimeStyle)),
|
|
@@ -35,8 +81,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
35
81
|
ref_key: "thisRef",
|
|
36
82
|
ref: thisRef
|
|
37
83
|
}, [
|
|
84
|
+
withDirectives(createVNode(_sfc_main$1, {
|
|
85
|
+
ref_key: "headerRef",
|
|
86
|
+
ref: headerRef,
|
|
87
|
+
headerInfo: unref(headerInfo)
|
|
88
|
+
}, null, 8, ["headerInfo"]), [
|
|
89
|
+
[vShow, unref(headerInfo).showHeader]
|
|
90
|
+
]),
|
|
38
91
|
createVNode(unref(VChart), {
|
|
39
|
-
|
|
92
|
+
ref_key: "chartRef",
|
|
93
|
+
ref: chartRef,
|
|
40
94
|
theme: unref(customTheme),
|
|
41
95
|
option: unref(chartOption),
|
|
42
96
|
autoresize: ""
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { defineComponent, ref, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, createVNode } from "vue";
|
|
2
|
-
import { getCustomTheme } from "../../../../utils/charts/chart-util.js";
|
|
1
|
+
import { defineComponent, ref, onMounted, watch, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createVNode, vShow } from "vue";
|
|
2
|
+
import { getCustomTheme, initChartOption, monitorChartClickToVariable } from "../../../../utils/charts/chart-util.js";
|
|
3
|
+
import { updateChartOption } from "../../../../utils/charts/chart-pie-util.js";
|
|
4
|
+
import { getChartDatasFromPage, updateChartDatasources, monitorFieldChange } from "../../../../utils/page-helper-util.js";
|
|
5
|
+
import _sfc_main$1 from "../common/common-chart-header.vue.js";
|
|
3
6
|
import { use } from "echarts/core";
|
|
4
7
|
import { CanvasRenderer } from "echarts/renderers";
|
|
5
8
|
import { PieChart } from "echarts/charts";
|
|
@@ -11,7 +14,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
11
14
|
pageContext: {},
|
|
12
15
|
configure: {}
|
|
13
16
|
},
|
|
14
|
-
setup(__props) {
|
|
17
|
+
setup(__props, { expose: __expose }) {
|
|
15
18
|
use([
|
|
16
19
|
CanvasRenderer,
|
|
17
20
|
PieChart,
|
|
@@ -23,12 +26,87 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
23
26
|
]);
|
|
24
27
|
const props = __props;
|
|
25
28
|
const thisRef = ref(null);
|
|
29
|
+
const chartRef = ref(null);
|
|
30
|
+
const headerRef = ref(null);
|
|
31
|
+
const enableDrill = props.configure.props ? props.configure.props.enableDrill : null;
|
|
32
|
+
const drillEndTrigger = props.configure.props ? props.configure.props.drillEndTrigger : null;
|
|
33
|
+
const selGroupVariable = props.configure.props ? props.configure.props.selGroupVariable : null;
|
|
26
34
|
const runtimeInfo = props.configure.runtime ? props.configure.runtime : {};
|
|
27
35
|
const runtimeStyle = runtimeInfo.style;
|
|
28
36
|
const runtimeClass = runtimeInfo.class;
|
|
37
|
+
const dataConfig = runtimeInfo.dataConfig;
|
|
38
|
+
const headerInfo = runtimeInfo.headerInfo ? runtimeInfo.headerInfo : {};
|
|
29
39
|
const chartOption = runtimeInfo.chartOption;
|
|
30
40
|
const configureProps = props.configure.props ? props.configure.props : {};
|
|
31
41
|
const customTheme = getCustomTheme(configureProps.customTheme);
|
|
42
|
+
initChartOption(props.configure, chartOption);
|
|
43
|
+
onMounted(() => {
|
|
44
|
+
const resultData = getChartDatasFromPage(props.pageContext, props.configure);
|
|
45
|
+
if (resultData) {
|
|
46
|
+
updateChartDatas(resultData);
|
|
47
|
+
}
|
|
48
|
+
if (enableDrill && chartRef.value) {
|
|
49
|
+
chartRef.value.chart.on("click", function(params) {
|
|
50
|
+
if (headerRef.value && headerRef.value.drill) {
|
|
51
|
+
headerRef.value.drill(params, props.configure.cacheDatas);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (!enableDrill && selGroupVariable && chartRef.value) {
|
|
56
|
+
monitorChartClickToVariable(
|
|
57
|
+
props.pageContext,
|
|
58
|
+
props.configure,
|
|
59
|
+
chartRef.value.chart,
|
|
60
|
+
selGroupVariable
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
function onDrillEnd(params) {
|
|
65
|
+
if (drillEndTrigger == "clearDrill") {
|
|
66
|
+
if (headerRef.value && headerRef.value.closeDrill) {
|
|
67
|
+
headerRef.value.closeDrill(0);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
let hisGroupValue = headerInfo.groupValue;
|
|
72
|
+
watch(headerInfo, () => {
|
|
73
|
+
if (hisGroupValue == headerInfo.groupValue) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
hisGroupValue = headerInfo.groupValue;
|
|
77
|
+
refresh();
|
|
78
|
+
});
|
|
79
|
+
function refresh() {
|
|
80
|
+
if (!dataConfig) {
|
|
81
|
+
console.log("无数据源配置,不需要查询!");
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
dataConfig.services[0].groupValue = headerInfo.groupValue;
|
|
85
|
+
updateChartDatasources(props.pageContext, [dataConfig], headerInfo.drillParams);
|
|
86
|
+
}
|
|
87
|
+
const monitorFields = headerInfo.monitorFields;
|
|
88
|
+
monitorFieldChange(props.pageContext, monitorFields, refresh);
|
|
89
|
+
function updateChartDatas(resultData) {
|
|
90
|
+
if (!resultData) {
|
|
91
|
+
resultData = [];
|
|
92
|
+
}
|
|
93
|
+
resultData = resultData.length > 0 ? resultData[0] : {};
|
|
94
|
+
if (!resultData) {
|
|
95
|
+
resultData = {};
|
|
96
|
+
}
|
|
97
|
+
if (resultData.hasRender) {
|
|
98
|
+
resultData.hasRender = true;
|
|
99
|
+
console.log("重复更新!", resultData);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
resultData.hasRender = true;
|
|
103
|
+
console.log("pie resultData", resultData);
|
|
104
|
+
updateChartOption(props.pageContext, props.configure, chartOption, resultData);
|
|
105
|
+
console.log("chartOption", chartOption);
|
|
106
|
+
}
|
|
107
|
+
__expose({
|
|
108
|
+
updateChartDatas
|
|
109
|
+
});
|
|
32
110
|
return (_ctx, _cache) => {
|
|
33
111
|
return openBlock(), createElementBlock("div", {
|
|
34
112
|
style: normalizeStyle(unref(runtimeStyle)),
|
|
@@ -36,8 +114,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
36
114
|
ref_key: "thisRef",
|
|
37
115
|
ref: thisRef
|
|
38
116
|
}, [
|
|
117
|
+
withDirectives(createVNode(_sfc_main$1, {
|
|
118
|
+
ref_key: "headerRef",
|
|
119
|
+
ref: headerRef,
|
|
120
|
+
headerInfo: unref(headerInfo),
|
|
121
|
+
onDrillEnd
|
|
122
|
+
}, null, 8, ["headerInfo"]), [
|
|
123
|
+
[vShow, unref(headerInfo).showHeader]
|
|
124
|
+
]),
|
|
39
125
|
createVNode(unref(VChart), {
|
|
40
|
-
|
|
126
|
+
ref_key: "chartRef",
|
|
127
|
+
ref: chartRef,
|
|
41
128
|
theme: unref(customTheme),
|
|
42
129
|
option: unref(chartOption),
|
|
43
130
|
autoresize: ""
|