yh-report 2.0.19 → 2.0.21

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.
@@ -1,3337 +0,0 @@
1
- import { ref, computed, defineComponent, watch, nextTick, openBlock, createElementBlock, createVNode, unref, withCtx, Fragment, renderList, withDirectives, createBlock, normalizeStyle, resolveDynamicComponent, createElementVNode, withKeys, vShow, renderSlot, reactive, onMounted, resolveComponent, resolveDirective, createTextVNode, createCommentVNode, onUnmounted, toDisplayString, h } from "vue";
2
- import { ElMessage, ElForm, ElFormItem, ElOption, ElEmpty, ElButton } from "element-plus";
3
- import axios from "@/libs/api.request.js";
4
- import { cloneDeep, get } from "lodash-es";
5
- import { useRouter } from "vue-router";
6
- import * as echarts from "echarts";
7
- const statementDesign = "";
8
- var CellType = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COL = "col", t.CELL = "cell", t.HEAD = "head", t.TEXT = "text", t.ICON = "icon", t.FUN = "fun", t.IMAGE = "img", t.FIELD = "field", t))(CellType || {}), FormatType = /* @__PURE__ */ ((t) => (t.TEXT = "text", t.NUMBER = "number", t.CURRENCY = "currency", t.PERCENT = "percent", t.PROMILLE = "promille", t.SCIENTIFIC = "scientific", t.DATETIME = "datetime", t.STRING = "string", t))(FormatType || {}), DataSourceColumnDataType = /* @__PURE__ */ ((t) => (t[t.STRING = 0] = "STRING", t[t.PLONG = 1] = "PLONG", t[t.LONG = 2] = "LONG", t[t.DOUBLE = 3] = "DOUBLE", t[t.TEXT = 4] = "TEXT", t[t.BOOL = 5] = "BOOL", t[t.DATE = 6] = "DATE", t[t.TIME = 7] = "TIME", t[t.DATETIME = 8] = "DATETIME", t[t.PASSWORD = 9] = "PASSWORD", t[t.ID = 10] = "ID", t[t.LIST = 11] = "LIST", t[t.TABLE = 12] = "TABLE", t[t.TREE = 13] = "TREE", t[t.IMG = 14] = "IMG", t[t.OPEN = 15] = "OPEN", t[t.SQL = 16] = "SQL", t[t.COLOR = 17] = "COLOR", t[t.EDITOR = 18] = "EDITOR", t))(DataSourceColumnDataType || {});
9
- const defaultCell = {
10
- type: CellType.TEXT,
11
- format: FormatType.TEXT,
12
- formatType: {
13
- date: "",
14
- numberDecimal: "",
15
- numberUseGrouping: "",
16
- currencySymbol: "",
17
- scientificNotation: ""
18
- },
19
- style: {},
20
- colSpan: 1,
21
- rowSpan: 1,
22
- col: 1,
23
- row: 1,
24
- text: "",
25
- data: void 0
26
- }, defaultRow = {
27
- size: 25,
28
- data: void 0,
29
- loop: !1,
30
- index: 0
31
- }, defaultCol = {
32
- size: 80,
33
- data: void 0,
34
- loop: !1,
35
- index: 0
36
- };
37
- function validateAndCompleteStatementOption(t) {
38
- Object.keys(defaultReport).length, Object.keys(t).length;
39
- const e = {
40
- ...defaultReport,
41
- ...t,
42
- id: `report-${Date.now()}`
43
- };
44
- e.rowConfig.length === 0 && (e.rowConfig = Array.from({ length: 5 }, (n, d) => ({
45
- size: 25,
46
- data: void 0,
47
- loop: !1,
48
- index: d
49
- }))), e.colConfig.length === 0 && (e.colConfig = Array.from({ length: 10 }, (n, d) => ({
50
- ...defaultCol
51
- })));
52
- const r = e.rowConfig.length, a = e.colConfig.length;
53
- return e.config.length, e.config = e.config.map((n, d) => (n.length, n.slice(0, a).map((s, g) => (Object.keys(s).length, Object.keys(defaultCell).length, {
54
- ...defaultCell,
55
- ...s,
56
- row: d,
57
- col: g
58
- })).concat(
59
- Array.from({ length: a - n.length }, (s, g) => ({
60
- ...defaultCell,
61
- row: d,
62
- col: n.length + g
63
- // 填充列时,列索引从当前行已有列数开始
64
- }))
65
- ))).concat(
66
- Array.from({ length: r - e.config.length }, (n, d) => {
67
- const s = e.config.length + d;
68
- return Array(a).fill(0).map((g, u) => ({
69
- ...defaultCell,
70
- row: s,
71
- col: u
72
- }));
73
- })
74
- ), e.rowConfig = e.rowConfig.map((n) => (Object.keys(n).length, Object.keys(defaultRow).length, {
75
- ...defaultRow,
76
- ...n
77
- })), e.colConfig = e.colConfig.map((n) => ({
78
- ...defaultCol,
79
- ...n
80
- })), e;
81
- }
82
- const TypeItems = ref([
83
- {
84
- name: "报表",
85
- icon: "icon-table",
86
- type: "report"
87
- },
88
- {
89
- name: "折线图",
90
- icon: "icon-linechart",
91
- type: "line"
92
- },
93
- {
94
- name: "条形图",
95
- icon: "icon-align-left",
96
- type: "rowBar"
97
- },
98
- {
99
- name: "柱状图",
100
- icon: "icon-barchart",
101
- type: "bar"
102
- },
103
- {
104
- name: "饼状图",
105
- icon: "icon-piechart",
106
- type: "pie"
107
- },
108
- {
109
- name: "散点图",
110
- icon: "icon-chart-bubble",
111
- type: "scatter"
112
- },
113
- {
114
- name: "雷达图",
115
- icon: "icon-radarchart",
116
- type: "radar"
117
- },
118
- {
119
- name: "矩形树图",
120
- icon: "icon-s-grid",
121
- type: "treemap"
122
- },
123
- {
124
- name: "自定义标签",
125
- icon: "icon-books",
126
- type: "label"
127
- }
128
- ]), ItemTypes = computed(() => TypeItems.value.map((t) => t.type)), colors = ["#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de", "#3ba272"], renderItem = (t, e) => {
129
- const r = t.dataIndex, a = e.value();
130
- let n = e.value(1);
131
- Array.isArray(n) && (n = n.map((M) => String.fromCharCode(M)).join(""));
132
- const d = e.getWidth(), s = e.getHeight(), g = colors[r % 6], u = t.dataInsideLength;
133
- let E = d * 0.01;
134
- E < 10 && (E = 10), E > 15 && (E = 15);
135
- let C = s * 0.5;
136
- C < 60 && (C = 60);
137
- const x = (d - E * 2 - E * (u - 1)) / u, k = 8, m = E + r * (x + E), w = (e.getHeight() - C) / 2;
138
- return {
139
- type: "group",
140
- children: [
141
- {
142
- type: "rect",
143
- shape: {
144
- x: m,
145
- y: w,
146
- width: x,
147
- height: C,
148
- r: k
149
- },
150
- style: {
151
- fill: g,
152
- stroke: "#fff",
153
- lineWidth: 1,
154
- shadowBlur: 4,
155
- shadowColor: "rgba(0,0,0,0.1)"
156
- }
157
- },
158
- {
159
- type: "text",
160
- style: {
161
- text: `${n}
162
-
163
- ${a}`,
164
- fill: "#fff",
165
- // 自动反色可改为:echarts.color.lift(color, 0.8)
166
- fontSize: 14,
167
- fontWeight: "bold",
168
- align: "center",
169
- verticalAlign: "middle"
170
- },
171
- position: [m + x / 2, w + C / 2]
172
- }
173
- ]
174
- };
175
- }, chartsOption = {
176
- line: {
177
- backgroundColor: "#fff",
178
- title: {
179
- text: "Title Line"
180
- },
181
- tooltip: {
182
- trigger: "axis"
183
- },
184
- legend: {
185
- top: "8%"
186
- },
187
- grid: {
188
- left: "3%",
189
- right: "9%",
190
- top: "20%",
191
- bottom: "3%",
192
- containLabel: !0
193
- },
194
- xAxis: {
195
- name: "天",
196
- type: "category",
197
- boundaryGap: !1,
198
- data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
199
- },
200
- yAxis: {
201
- name: "值",
202
- type: "value"
203
- },
204
- dataZoom: [
205
- {
206
- type: "inside",
207
- start: 0,
208
- end: 100
209
- }
210
- ],
211
- series: [
212
- {
213
- name: "Email",
214
- type: "line",
215
- stack: "Total",
216
- data: [120, 132, 101, 134, 90, 230, 210]
217
- },
218
- {
219
- name: "Union",
220
- type: "line",
221
- stack: "Total",
222
- data: [220, 182, 191, 234, 290, 330, 310]
223
- },
224
- {
225
- name: "Video",
226
- type: "line",
227
- stack: "Total",
228
- data: [150, 232, 201, 154, 190, 330, 410]
229
- }
230
- ]
231
- },
232
- rowBar: {
233
- backgroundColor: "#fff",
234
- title: {
235
- text: "Title Bar"
236
- },
237
- tooltip: {
238
- trigger: "axis",
239
- axisPointer: {
240
- type: "shadow"
241
- }
242
- },
243
- legend: {
244
- top: "8%"
245
- },
246
- grid: {
247
- left: "3%",
248
- right: "9%",
249
- top: "20%",
250
- bottom: "3%",
251
- containLabel: !0
252
- },
253
- yAxis: {
254
- name: "天",
255
- type: "category",
256
- axisTick: {
257
- alignWithLabel: !0
258
- },
259
- data: ["2012", "2013", "2014", "2015", "2016"]
260
- },
261
- xAxis: {
262
- name: "值",
263
- type: "value"
264
- },
265
- dataZoom: [
266
- {
267
- type: "inside",
268
- start: 0,
269
- end: 100
270
- }
271
- ],
272
- series: [
273
- {
274
- name: "Forest",
275
- type: "bar",
276
- barGap: 0,
277
- emphasis: {
278
- focus: "series"
279
- },
280
- data: [320, 332, 301, 334, 390]
281
- },
282
- {
283
- name: "Steppe",
284
- type: "bar",
285
- emphasis: {
286
- focus: "series"
287
- },
288
- data: [220, 182, 191, 234, 290]
289
- },
290
- {
291
- name: "Desert",
292
- type: "bar",
293
- emphasis: {
294
- focus: "series"
295
- },
296
- data: [150, 232, 201, 154, 190]
297
- }
298
- ]
299
- },
300
- bar: {
301
- backgroundColor: "#fff",
302
- title: {
303
- text: "Title Bar"
304
- },
305
- tooltip: {
306
- trigger: "axis",
307
- axisPointer: {
308
- type: "shadow"
309
- }
310
- },
311
- legend: {
312
- top: "8%"
313
- },
314
- grid: {
315
- left: "3%",
316
- right: "9%",
317
- top: "20%",
318
- bottom: "3%",
319
- containLabel: !0
320
- },
321
- xAxis: {
322
- name: "天",
323
- type: "category",
324
- axisTick: {
325
- alignWithLabel: !0
326
- },
327
- data: ["2012", "2013", "2014", "2015", "2016"]
328
- },
329
- yAxis: {
330
- name: "值",
331
- type: "value"
332
- },
333
- dataZoom: [
334
- {
335
- type: "inside",
336
- start: 0,
337
- end: 100
338
- }
339
- ],
340
- series: [
341
- {
342
- name: "Forest",
343
- type: "bar",
344
- barGap: 0,
345
- emphasis: {
346
- focus: "series"
347
- },
348
- data: [320, 332, 301, 334, 390]
349
- },
350
- {
351
- name: "Steppe",
352
- type: "bar",
353
- emphasis: {
354
- focus: "series"
355
- },
356
- data: [220, 182, 191, 234, 290]
357
- },
358
- {
359
- name: "Desert",
360
- type: "bar",
361
- emphasis: {
362
- focus: "series"
363
- },
364
- data: [150, 232, 201, 154, 190]
365
- }
366
- ]
367
- },
368
- pie: {
369
- backgroundColor: "#fff",
370
- title: {
371
- text: "Title Pie"
372
- },
373
- tooltip: {
374
- trigger: "item"
375
- },
376
- legend: {
377
- top: "8%"
378
- },
379
- xAxis: {
380
- show: !1
381
- },
382
- yAxis: {
383
- show: !1
384
- },
385
- series: [
386
- {
387
- name: "Access From",
388
- type: "pie",
389
- radius: "50%",
390
- top: "10%",
391
- data: [
392
- { value: 1048, name: "Search" },
393
- { value: 735, name: "Direct" },
394
- { value: 580, name: "Email" },
395
- { value: 484, name: "Union" },
396
- { value: 300, name: "Video" }
397
- ],
398
- labelLine: {
399
- show: !0
400
- },
401
- emphasis: {
402
- itemStyle: {
403
- shadowBlur: 10,
404
- shadowOffsetX: 0,
405
- shadowColor: "rgba(0, 0, 0, 0.5)"
406
- }
407
- }
408
- }
409
- ]
410
- },
411
- scatter: {
412
- backgroundColor: "#fff",
413
- title: {
414
- text: "Title Scatter"
415
- },
416
- tooltip: {},
417
- legend: {
418
- top: "8%",
419
- data: ["1990", "2015"]
420
- },
421
- grid: {
422
- left: "5%",
423
- right: "5%",
424
- top: "20%",
425
- bottom: "3%",
426
- containLabel: !0
427
- },
428
- xAxis: {
429
- splitLine: {
430
- lineStyle: {
431
- type: "dashed"
432
- }
433
- }
434
- },
435
- yAxis: {
436
- splitLine: {
437
- lineStyle: {
438
- type: "dashed"
439
- }
440
- },
441
- scale: !0
442
- },
443
- dataZoom: [
444
- {
445
- type: "inside",
446
- start: 0,
447
- end: 100
448
- }
449
- ],
450
- series: [
451
- {
452
- name: "1990",
453
- data: [
454
- [1516, 68],
455
- [13670, 74.7],
456
- [28599, 75],
457
- [29476, 77.1],
458
- [31476, 75.4],
459
- [28666, 78.1],
460
- [1777, 57.7],
461
- [29550, 79.1],
462
- [2076, 67.9],
463
- [12087, 72],
464
- [24021, 75.4],
465
- [43296, 76.8],
466
- [10088, 70.8],
467
- [19349, 69.6],
468
- [10670, 67.3],
469
- [26424, 75.7],
470
- [37062, 75.4]
471
- ],
472
- type: "scatter",
473
- symbolSize: 20,
474
- emphasis: {
475
- focus: "series",
476
- label: {
477
- show: !0,
478
- position: "top"
479
- }
480
- },
481
- itemStyle: {
482
- shadowBlur: 10,
483
- shadowColor: "rgba(0, 0, 0, 0.2)",
484
- shadowOffsetY: 5
485
- }
486
- },
487
- {
488
- name: "2015",
489
- data: [
490
- [13334, 76.9],
491
- [21291, 78.5],
492
- [38923, 80.8],
493
- [37599, 81.9],
494
- [44053, 81.1],
495
- [42182, 82.8],
496
- [5903, 66.8],
497
- [36162, 83.5],
498
- [1390, 71.4],
499
- [34644, 80.7],
500
- [34186, 80.6],
501
- [64304, 81.6],
502
- [24787, 77.3],
503
- [23038, 73.13],
504
- [19360, 76.5],
505
- [38225, 81.4],
506
- [53354, 79.1]
507
- ],
508
- type: "scatter",
509
- symbolSize: 20,
510
- emphasis: {
511
- focus: "series",
512
- label: {
513
- show: !0,
514
- position: "top"
515
- }
516
- },
517
- itemStyle: {
518
- shadowBlur: 10,
519
- shadowColor: "rgba(0, 0, 0, 0.2)",
520
- shadowOffsetY: 5
521
- }
522
- }
523
- ]
524
- },
525
- radar: {
526
- backgroundColor: "#fff",
527
- title: {
528
- text: "Title Radar"
529
- },
530
- tooltip: {
531
- trigger: "axis"
532
- },
533
- legend: {
534
- top: "8%",
535
- data: ["Budget", "Spending"]
536
- },
537
- radar: {
538
- indicator: [{ name: "Sales" }, { name: "Administration" }, { name: "Technology" }, { name: "Customer" }, { name: "Development" }, { name: "Marketing" }],
539
- radius: 80
540
- },
541
- series: [
542
- {
543
- name: "Radar",
544
- type: "radar",
545
- tooltip: {
546
- trigger: "item"
547
- },
548
- areaStyle: {},
549
- data: [
550
- {
551
- value: [4200, 3e3, 2e4, 35e3, 5e4, 18e3],
552
- name: "Budget"
553
- },
554
- {
555
- value: [5e3, 14e3, 28e3, 26e3, 42e3, 21e3],
556
- name: "Spending"
557
- }
558
- ]
559
- }
560
- ]
561
- },
562
- treemap: {
563
- backgroundColor: "#fff",
564
- title: {
565
- show: !1
566
- },
567
- legend: {
568
- show: !1
569
- },
570
- grid: {
571
- left: "0px",
572
- right: "0px",
573
- top: "0px",
574
- bottom: "0px"
575
- },
576
- series: [
577
- {
578
- type: "treemap",
579
- label: {
580
- fontSize: 50
581
- },
582
- width: "100%",
583
- height: "100%",
584
- breadcrumb: {
585
- show: !1
586
- },
587
- data: [
588
- {
589
- name: "标签",
590
- value: 20
591
- }
592
- ],
593
- symbol: "none",
594
- areaStyle: null
595
- }
596
- ]
597
- },
598
- label: {
599
- backgroundColor: "#fff",
600
- title: {
601
- show: !1
602
- },
603
- legend: {
604
- show: !1
605
- },
606
- grid: {
607
- left: "0px",
608
- right: "0px",
609
- top: "0px",
610
- bottom: "0px"
611
- },
612
- xAxis: {
613
- show: !1,
614
- type: "category",
615
- data: []
616
- },
617
- yAxis: {
618
- show: !1,
619
- type: "category",
620
- data: []
621
- },
622
- series: [
623
- {
624
- type: "custom",
625
- renderItem,
626
- data: [
627
- [20, "标签1:20"],
628
- [35, "标签2: 35"],
629
- [15, "标签3: 15"]
630
- ]
631
- }
632
- ]
633
- }
634
- }, defaultChart = {
635
- type: "chart",
636
- data: {
637
- source: []
638
- },
639
- xAisData: "",
640
- yAisData: "",
641
- name: "",
642
- icon: "",
643
- id: "",
644
- left: 0,
645
- top: 0,
646
- smooth: !1,
647
- symbol: "",
648
- showLabel: !1,
649
- areaStyle: "",
650
- labelColor: "",
651
- labelPosition: "",
652
- radius: !1,
653
- widthUnit: "px",
654
- width: 600,
655
- heightUnit: "px",
656
- height: 400,
657
- isSuspend: !1,
658
- zIndex: 0,
659
- option: void 0,
660
- seriesData: "",
661
- groupBy: !1,
662
- orderBy: "NONE",
663
- cutLength: 5
664
- }, defaultReport = {
665
- id: "",
666
- type: "report",
667
- config: [],
668
- widthType: "px",
669
- width: 600,
670
- fullHeight: !1,
671
- height: 400,
672
- seriesEnable: !0,
673
- seriesHeadText: "#",
674
- frozen: {
675
- rowCount: 0,
676
- colCount: 0,
677
- trailingColCount: 0,
678
- trailingRowCount: 0
679
- },
680
- params: [],
681
- theme: "blue",
682
- data: {
683
- source: [],
684
- pagination: !0,
685
- pageSize: 10,
686
- processData: ""
687
- },
688
- rowConfig: [],
689
- colConfig: []
690
- }, setXAxisData = (t, e) => {
691
- let { option: r } = t, { xDataId: a } = r, n, d;
692
- if (a.length === 3 ? (e && e[a[0]] && (n = e[a[0]][a[1]]), d = a[2]) : (n = e[a[0]], d = a[1]), !n)
693
- return r;
694
- let s = [];
695
- if (t.groupBy) {
696
- let g = /* @__PURE__ */ new Set();
697
- n.forEach((u) => {
698
- g.add(u[d]);
699
- }), s = [...g];
700
- } else
701
- s = n.map((g) => g[d]);
702
- return t.type == "rowBar" ? r.yAxis.data = s : ["line", "bar"].includes(t.type) ? r.xAxis.data = s : t.type == "radar" && (r.radar.indicator = s), r;
703
- }, setYAxisData = (t, e) => {
704
- let { option: r } = t, { yDataId: a } = r, n = [], d = "";
705
- if (r.xDataId && (r.xDataId.length === 3 ? (e && e[r.xDataId[0]] && (n = e[r.xDataId[0]][r.xDataId[1]]), d = r.xDataId[2]) : (n = e[r.xDataId[0]], d = r.xDataId[1])), n)
706
- if (t.groupBy) {
707
- let s = /* @__PURE__ */ new Set();
708
- n.forEach((g) => {
709
- s.add(g[d]);
710
- }), n = [...s];
711
- } else
712
- n = n.map((s) => s[d]);
713
- if (t.type == "radar") {
714
- r.series[0].data = [];
715
- for (let s of a) {
716
- let g, u;
717
- s.length === 3 ? (e[s[0]] && (g = e[s[0]][s[1]]), u = s[2]) : (g = e[s[0]], u = s[1]);
718
- let E = [];
719
- if (t.groupBy && n) {
720
- let C = {};
721
- g.forEach((x) => {
722
- let k = x[d], m = x[u];
723
- k && !isNaN(m) && (C[k] || (C[k] = 0), C[k] = m);
724
- }), E = n.map((x) => C[x]);
725
- } else
726
- E = g.map((C) => C[u]);
727
- t.orderBy && t.orderBy !== "NONE" && (E = E.sort((C, x) => t.orderBy === "ASC" ? C - x : x - C), !isNaN(t.cutLength) && t.cutLength > 0 && (E = E.slice(0, t.cutLength))), r.series[0].data.push({
728
- value: E
729
- });
730
- }
731
- } else if (t.type == "treemap") {
732
- if (a && a.length) {
733
- let [s, g] = a[0];
734
- if (e[s][0]) {
735
- let u = e[s][0][g];
736
- if (u) {
737
- let E = r.series[0].data[0].name.split(":")[0];
738
- r.series[0].data[0].name = `${E}:${u}`;
739
- }
740
- }
741
- }
742
- } else {
743
- let s = cloneDeep(r.series);
744
- a.length && (r.series = []);
745
- for (let g = 0; g < a.length; g++) {
746
- let u = a[g], E, C;
747
- u.length === 3 ? (e[u[0]] && (E = e[u[0]][u[1]]), C = u[2]) : (E = e[u[0]], C = u[1]);
748
- let x = cloneDeep(s[0]);
749
- x.data = [];
750
- let k = [];
751
- if (E && d && n) {
752
- switch (t.type) {
753
- case "line":
754
- case "rowBar":
755
- case "bar":
756
- if (t.groupBy) {
757
- let m = {};
758
- E.forEach((w) => {
759
- let M = w[d], B = w[C];
760
- M && !isNaN(B) && (m[M] || (m[M] = 0), m[M] = B);
761
- }), k = n.map((w) => m[w]);
762
- } else
763
- k = E.map((m) => m[C]);
764
- t.orderBy && t.orderBy !== "NONE" && (k = k.sort((m, w) => t.orderBy === "ASC" ? m - w : w - m), !isNaN(t.cutLength) && t.cutLength > 0 && (k = k.slice(0, t.cutLength)));
765
- break;
766
- case "pie":
767
- if (t.groupBy) {
768
- let m = {};
769
- E.forEach((w) => {
770
- let M = w[d], B = w[C];
771
- M && !isNaN(B) && (m[M] || (m[M] = 0), m[M] = B);
772
- }), k = n.map((w) => ({ value: m[w], name: w }));
773
- } else
774
- k = E.map((m) => ({ value: m[C], name: m[d] }));
775
- t.orderBy && t.orderBy !== "NONE" && (k = k.sort((m, w) => t.orderBy === "ASC" ? m - w : w - m), !isNaN(t.cutLength) && t.cutLength > 0 && (k = k.slice(0, t.cutLength)));
776
- break;
777
- case "scatter":
778
- if (t.groupBy) {
779
- let m = {};
780
- E.forEach((w) => {
781
- let M = w[d], B = w[C];
782
- M && !isNaN(B) && (m[M] || (m[M] = 0), m[M] = B);
783
- }), k = n.map((w) => [w, m[w]]);
784
- } else
785
- k = E.map((m) => [m[d], m[C]]);
786
- t.orderBy && t.orderBy !== "NONE" && (k = k.sort((m, w) => t.orderBy === "ASC" ? m - w : w - m), !isNaN(t.cutLength) && t.cutLength > 0 && (k = k.slice(0, t.cutLength)));
787
- break;
788
- case "label":
789
- if (t.groupBy) {
790
- let m = {};
791
- E.forEach((w) => {
792
- let M = w[d], B = w[C];
793
- M && !isNaN(B) && (m[M] || (m[M] = 0), m[M] = B);
794
- }), k = n.map((w) => {
795
- const M = w ? w.split("").map((B) => B.charCodeAt()) : [];
796
- return [m[w], M];
797
- });
798
- } else
799
- k = E.map((m) => {
800
- const w = m[d] ? m[d].split("").map((M) => M.charCodeAt()) : [];
801
- return [m[C], w];
802
- });
803
- t.orderBy && t.orderBy !== "NONE" && (k = k.sort((m, w) => t.orderBy === "ASC" ? m - w : w - m), !isNaN(t.cutLength) && t.cutLength > 0 && (k = k.slice(0, t.cutLength))), x.renderItem = renderItem;
804
- break;
805
- }
806
- x.data = k;
807
- }
808
- r.series.push(x);
809
- }
810
- }
811
- return r;
812
- };
813
- function getReportDefaultOption(t) {
814
- if (t === "report")
815
- return validateAndCompleteStatementOption(defaultReport);
816
- {
817
- let e = cloneDeep(defaultChart);
818
- return e.id = `${t}-${Date.now()}`, e.type = t, e.option = chartsOption[t], e;
819
- }
820
- }
821
- function getList(t) {
822
- return axios.request({
823
- url: "sysReport/list",
824
- method: "post",
825
- type: "form",
826
- data: t
827
- });
828
- }
829
- function getConfig(t) {
830
- return axios.request({
831
- url: "sysReport/config",
832
- method: "post",
833
- params: {
834
- id: t
835
- }
836
- }).then((e) => {
837
- let r = JSON.parse(e.data.info), { id: a, name: n, code: d, description: s, config: g, chartConfig: u } = r, E = [];
838
- if (g && (g = JSON.parse(g), Array.isArray(g) && g.length)) {
839
- if (g[0].type === "tableSheet")
840
- throw ElMessage.error("当前报表版本不支持老版本数据,请等待老版本数据转换工具上线"), useRouter().back(), new Error("当前报表版本不支持老版本数据,请等待老版本数据转换工具上线");
841
- g = g.map((C) => (ItemTypes.value.includes(C.type) || (C.type = "report"), C)), E = E.concat(g);
842
- }
843
- return u && (u = JSON.parse(u), Array.isArray(u) && (u.forEach((C) => {
844
- C.data || (C.data = { source: [] });
845
- }), E = E.concat(u))), Promise.resolve({
846
- id: a,
847
- name: n,
848
- code: d,
849
- description: s,
850
- remoteOptions: E
851
- });
852
- });
853
- }
854
- function save(t) {
855
- return axios.request({
856
- url: "sysReport/save",
857
- method: "post",
858
- type: "json",
859
- data: t
860
- });
861
- }
862
- function del(t) {
863
- return axios.request({
864
- url: "sysReport/delete",
865
- method: "post",
866
- type: "form",
867
- data: { id: t }
868
- });
869
- }
870
- var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
871
- function getDefaultExportFromCjs(t) {
872
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
873
- }
874
- var dayjs_min = { exports: {} };
875
- (function(t, e) {
876
- (function(r, a) {
877
- t.exports = a();
878
- })(commonjsGlobal, function() {
879
- var r = 1e3, a = 6e4, n = 36e5, d = "millisecond", s = "second", g = "minute", u = "hour", E = "day", C = "week", x = "month", k = "quarter", m = "year", w = "date", M = "Invalid Date", B = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, J = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, j = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(p) {
880
- var c = ["th", "st", "nd", "rd"], o = p % 100;
881
- return "[" + p + (c[(o - 20) % 10] || c[o] || c[0]) + "]";
882
- } }, W = function(p, c, o) {
883
- var f = String(p);
884
- return !f || f.length >= c ? p : "" + Array(c + 1 - f.length).join(o) + p;
885
- }, ae = { s: W, z: function(p) {
886
- var c = -p.utcOffset(), o = Math.abs(c), f = Math.floor(o / 60), l = o % 60;
887
- return (c <= 0 ? "+" : "-") + W(f, 2, "0") + ":" + W(l, 2, "0");
888
- }, m: function p(c, o) {
889
- if (c.date() < o.date())
890
- return -p(o, c);
891
- var f = 12 * (o.year() - c.year()) + (o.month() - c.month()), l = c.clone().add(f, x), y = o - l < 0, i = c.clone().add(f + (y ? -1 : 1), x);
892
- return +(-(f + (o - l) / (y ? l - i : i - l)) || 0);
893
- }, a: function(p) {
894
- return p < 0 ? Math.ceil(p) || 0 : Math.floor(p);
895
- }, p: function(p) {
896
- return { M: x, y: m, w: C, d: E, D: w, h: u, m: g, s, ms: d, Q: k }[p] || String(p || "").toLowerCase().replace(/s$/, "");
897
- }, u: function(p) {
898
- return p === void 0;
899
- } }, Q = "en", q = {};
900
- q[Q] = j;
901
- var re = "$isDayjsObject", Z = function(p) {
902
- return p instanceof v || !(!p || !p[re]);
903
- }, ee = function p(c, o, f) {
904
- var l;
905
- if (!c)
906
- return Q;
907
- if (typeof c == "string") {
908
- var y = c.toLowerCase();
909
- q[y] && (l = y), o && (q[y] = o, l = y);
910
- var i = c.split("-");
911
- if (!l && i.length > 1)
912
- return p(i[0]);
913
- } else {
914
- var D = c.name;
915
- q[D] = c, l = D;
916
- }
917
- return !f && l && (Q = l), l || !f && Q;
918
- }, X = function(p, c) {
919
- if (Z(p))
920
- return p.clone();
921
- var o = typeof c == "object" ? c : {};
922
- return o.date = p, o.args = arguments, new v(o);
923
- }, H = ae;
924
- H.l = ee, H.i = Z, H.w = function(p, c) {
925
- return X(p, { locale: c.$L, utc: c.$u, x: c.$x, $offset: c.$offset });
926
- };
927
- var v = function() {
928
- function p(o) {
929
- this.$L = ee(o.locale, null, !0), this.parse(o), this.$x = this.$x || o.x || {}, this[re] = !0;
930
- }
931
- var c = p.prototype;
932
- return c.parse = function(o) {
933
- this.$d = function(f) {
934
- var l = f.date, y = f.utc;
935
- if (l === null)
936
- return /* @__PURE__ */ new Date(NaN);
937
- if (H.u(l))
938
- return /* @__PURE__ */ new Date();
939
- if (l instanceof Date)
940
- return new Date(l);
941
- if (typeof l == "string" && !/Z$/i.test(l)) {
942
- var i = l.match(B);
943
- if (i) {
944
- var D = i[2] - 1 || 0, S = (i[7] || "0").substring(0, 3);
945
- return y ? new Date(Date.UTC(i[1], D, i[3] || 1, i[4] || 0, i[5] || 0, i[6] || 0, S)) : new Date(i[1], D, i[3] || 1, i[4] || 0, i[5] || 0, i[6] || 0, S);
946
- }
947
- }
948
- return new Date(l);
949
- }(o), this.init();
950
- }, c.init = function() {
951
- var o = this.$d;
952
- this.$y = o.getFullYear(), this.$M = o.getMonth(), this.$D = o.getDate(), this.$W = o.getDay(), this.$H = o.getHours(), this.$m = o.getMinutes(), this.$s = o.getSeconds(), this.$ms = o.getMilliseconds();
953
- }, c.$utils = function() {
954
- return H;
955
- }, c.isValid = function() {
956
- return this.$d.toString() !== M;
957
- }, c.isSame = function(o, f) {
958
- var l = X(o);
959
- return this.startOf(f) <= l && l <= this.endOf(f);
960
- }, c.isAfter = function(o, f) {
961
- return X(o) < this.startOf(f);
962
- }, c.isBefore = function(o, f) {
963
- return this.endOf(f) < X(o);
964
- }, c.$g = function(o, f, l) {
965
- return H.u(o) ? this[f] : this.set(l, o);
966
- }, c.unix = function() {
967
- return Math.floor(this.valueOf() / 1e3);
968
- }, c.valueOf = function() {
969
- return this.$d.getTime();
970
- }, c.startOf = function(o, f) {
971
- var l = this, y = !!H.u(f) || f, i = H.p(o), D = function(T, _) {
972
- var I = H.w(l.$u ? Date.UTC(l.$y, _, T) : new Date(l.$y, _, T), l);
973
- return y ? I : I.endOf(E);
974
- }, S = function(T, _) {
975
- return H.w(l.toDate()[T].apply(l.toDate("s"), (y ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(_)), l);
976
- }, P = this.$W, U = this.$M, L = this.$D, N = "set" + (this.$u ? "UTC" : "");
977
- switch (i) {
978
- case m:
979
- return y ? D(1, 0) : D(31, 11);
980
- case x:
981
- return y ? D(1, U) : D(0, U + 1);
982
- case C:
983
- var F = this.$locale().weekStart || 0, O = (P < F ? P + 7 : P) - F;
984
- return D(y ? L - O : L + (6 - O), U);
985
- case E:
986
- case w:
987
- return S(N + "Hours", 0);
988
- case u:
989
- return S(N + "Minutes", 1);
990
- case g:
991
- return S(N + "Seconds", 2);
992
- case s:
993
- return S(N + "Milliseconds", 3);
994
- default:
995
- return this.clone();
996
- }
997
- }, c.endOf = function(o) {
998
- return this.startOf(o, !1);
999
- }, c.$set = function(o, f) {
1000
- var l, y = H.p(o), i = "set" + (this.$u ? "UTC" : ""), D = (l = {}, l[E] = i + "Date", l[w] = i + "Date", l[x] = i + "Month", l[m] = i + "FullYear", l[u] = i + "Hours", l[g] = i + "Minutes", l[s] = i + "Seconds", l[d] = i + "Milliseconds", l)[y], S = y === E ? this.$D + (f - this.$W) : f;
1001
- if (y === x || y === m) {
1002
- var P = this.clone().set(w, 1);
1003
- P.$d[D](S), P.init(), this.$d = P.set(w, Math.min(this.$D, P.daysInMonth())).$d;
1004
- } else
1005
- D && this.$d[D](S);
1006
- return this.init(), this;
1007
- }, c.set = function(o, f) {
1008
- return this.clone().$set(o, f);
1009
- }, c.get = function(o) {
1010
- return this[H.p(o)]();
1011
- }, c.add = function(o, f) {
1012
- var l, y = this;
1013
- o = Number(o);
1014
- var i = H.p(f), D = function(U) {
1015
- var L = X(y);
1016
- return H.w(L.date(L.date() + Math.round(U * o)), y);
1017
- };
1018
- if (i === x)
1019
- return this.set(x, this.$M + o);
1020
- if (i === m)
1021
- return this.set(m, this.$y + o);
1022
- if (i === E)
1023
- return D(1);
1024
- if (i === C)
1025
- return D(7);
1026
- var S = (l = {}, l[g] = a, l[u] = n, l[s] = r, l)[i] || 1, P = this.$d.getTime() + o * S;
1027
- return H.w(P, this);
1028
- }, c.subtract = function(o, f) {
1029
- return this.add(-1 * o, f);
1030
- }, c.format = function(o) {
1031
- var f = this, l = this.$locale();
1032
- if (!this.isValid())
1033
- return l.invalidDate || M;
1034
- var y = o || "YYYY-MM-DDTHH:mm:ssZ", i = H.z(this), D = this.$H, S = this.$m, P = this.$M, U = l.weekdays, L = l.months, N = l.meridiem, F = function(_, I, A, $) {
1035
- return _ && (_[I] || _(f, y)) || A[I].slice(0, $);
1036
- }, O = function(_) {
1037
- return H.s(D % 12 || 12, _, "0");
1038
- }, T = N || function(_, I, A) {
1039
- var $ = _ < 12 ? "AM" : "PM";
1040
- return A ? $.toLowerCase() : $;
1041
- };
1042
- return y.replace(J, function(_, I) {
1043
- return I || function(A) {
1044
- switch (A) {
1045
- case "YY":
1046
- return String(f.$y).slice(-2);
1047
- case "YYYY":
1048
- return H.s(f.$y, 4, "0");
1049
- case "M":
1050
- return P + 1;
1051
- case "MM":
1052
- return H.s(P + 1, 2, "0");
1053
- case "MMM":
1054
- return F(l.monthsShort, P, L, 3);
1055
- case "MMMM":
1056
- return F(L, P);
1057
- case "D":
1058
- return f.$D;
1059
- case "DD":
1060
- return H.s(f.$D, 2, "0");
1061
- case "d":
1062
- return String(f.$W);
1063
- case "dd":
1064
- return F(l.weekdaysMin, f.$W, U, 2);
1065
- case "ddd":
1066
- return F(l.weekdaysShort, f.$W, U, 3);
1067
- case "dddd":
1068
- return U[f.$W];
1069
- case "H":
1070
- return String(D);
1071
- case "HH":
1072
- return H.s(D, 2, "0");
1073
- case "h":
1074
- return O(1);
1075
- case "hh":
1076
- return O(2);
1077
- case "a":
1078
- return T(D, S, !0);
1079
- case "A":
1080
- return T(D, S, !1);
1081
- case "m":
1082
- return String(S);
1083
- case "mm":
1084
- return H.s(S, 2, "0");
1085
- case "s":
1086
- return String(f.$s);
1087
- case "ss":
1088
- return H.s(f.$s, 2, "0");
1089
- case "SSS":
1090
- return H.s(f.$ms, 3, "0");
1091
- case "Z":
1092
- return i;
1093
- }
1094
- return null;
1095
- }(_) || i.replace(":", "");
1096
- });
1097
- }, c.utcOffset = function() {
1098
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
1099
- }, c.diff = function(o, f, l) {
1100
- var y, i = this, D = H.p(f), S = X(o), P = (S.utcOffset() - this.utcOffset()) * a, U = this - S, L = function() {
1101
- return H.m(i, S);
1102
- };
1103
- switch (D) {
1104
- case m:
1105
- y = L() / 12;
1106
- break;
1107
- case x:
1108
- y = L();
1109
- break;
1110
- case k:
1111
- y = L() / 3;
1112
- break;
1113
- case C:
1114
- y = (U - P) / 6048e5;
1115
- break;
1116
- case E:
1117
- y = (U - P) / 864e5;
1118
- break;
1119
- case u:
1120
- y = U / n;
1121
- break;
1122
- case g:
1123
- y = U / a;
1124
- break;
1125
- case s:
1126
- y = U / r;
1127
- break;
1128
- default:
1129
- y = U;
1130
- }
1131
- return l ? y : H.a(y);
1132
- }, c.daysInMonth = function() {
1133
- return this.endOf(x).$D;
1134
- }, c.$locale = function() {
1135
- return q[this.$L];
1136
- }, c.locale = function(o, f) {
1137
- if (!o)
1138
- return this.$L;
1139
- var l = this.clone(), y = ee(o, f, !0);
1140
- return y && (l.$L = y), l;
1141
- }, c.clone = function() {
1142
- return H.w(this.$d, this);
1143
- }, c.toDate = function() {
1144
- return new Date(this.valueOf());
1145
- }, c.toJSON = function() {
1146
- return this.isValid() ? this.toISOString() : null;
1147
- }, c.toISOString = function() {
1148
- return this.$d.toISOString();
1149
- }, c.toString = function() {
1150
- return this.$d.toUTCString();
1151
- }, p;
1152
- }(), b = v.prototype;
1153
- return X.prototype = b, [["$ms", d], ["$s", s], ["$m", g], ["$H", u], ["$W", E], ["$M", x], ["$y", m], ["$D", w]].forEach(function(p) {
1154
- b[p[1]] = function(c) {
1155
- return this.$g(c, p[0], p[1]);
1156
- };
1157
- }), X.extend = function(p, c) {
1158
- return p.$i || (p(c, v, X), p.$i = !0), X;
1159
- }, X.locale = ee, X.isDayjs = Z, X.unix = function(p) {
1160
- return X(1e3 * p);
1161
- }, X.en = q[Q], X.Ls = q, X.p = {}, X;
1162
- });
1163
- })(dayjs_min);
1164
- var dayjs_minExports = dayjs_min.exports;
1165
- const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
1166
- function copyString(t) {
1167
- if (navigator.clipboard && window.isSecureContext)
1168
- return navigator.clipboard.writeText(t), Promise.resolve();
1169
- {
1170
- let e = document.createElement("textarea");
1171
- e.value = t, e.style.position = "absolute", e.style.opacity = "0", e.style.left = "-200%", e.style.top = "-200%", document.body.appendChild(e), e.focus(), e.select();
1172
- let r = document.execCommand("copy");
1173
- return e.remove(), r ? Promise.resolve() : Promise.reject(new Error("copy error"));
1174
- }
1175
- }
1176
- function componentTransition(t, e = "date") {
1177
- let r = "ElInput", a = "筛选", n = "";
1178
- switch (t) {
1179
- case "STRING":
1180
- r = "ElInput", a = "筛选", n = "text";
1181
- break;
1182
- case "LIST":
1183
- r = "ElSelect", a = "请选择";
1184
- break;
1185
- case "TABLE":
1186
- r = "ElSelect", a = "请选择";
1187
- break;
1188
- case "TREE":
1189
- r = "ElTreeSelect", a = "请选择";
1190
- break;
1191
- case "EDITOR":
1192
- r = "ElInput", a = "筛选", n = "textarea";
1193
- break;
1194
- case "BOOL":
1195
- r = "ElSwitch", a = "请选择";
1196
- break;
1197
- case "LONG":
1198
- r = "ElInputNumber", a = "筛选";
1199
- break;
1200
- case "PLONG":
1201
- r = "ElInputNumber", a = "筛选";
1202
- break;
1203
- case "DOUBLE":
1204
- r = "ElInputNumber", a = "筛选";
1205
- break;
1206
- case "DATE":
1207
- r = "ElDatePicker", a = "请选择", n = e;
1208
- break;
1209
- case "DATETIME":
1210
- r = "ElDatePicker", a = "请选择", n = e;
1211
- break;
1212
- case "TIME":
1213
- r = "ElTimePicker", a = "请选择", n = "time";
1214
- break;
1215
- case "TEXT":
1216
- r = "ElInput", a = "筛选", n = "text";
1217
- break;
1218
- case "COLOR":
1219
- r = "ElColorPicker", a = "请选择";
1220
- break;
1221
- default:
1222
- r = "ElInput", a = "筛选", n = "text";
1223
- break;
1224
- }
1225
- return { componentName: r, placeholerPrefix: a, type: n };
1226
- }
1227
- const _hoisted_1$1 = { class: "yh-statement-view-conditions" }, _sfc_main$4 = /* @__PURE__ */ defineComponent({
1228
- __name: "report-conditions",
1229
- props: {
1230
- config: null
1231
- },
1232
- emits: ["change"],
1233
- setup(t, { emit: e }) {
1234
- const r = t, a = dayjs().startOf("day").format("YYYY-MM-DD HH:mm:ss"), n = dayjs().endOf("day").format("YYYY-MM-DD HH:mm:ss"), d = dayjs().startOf("month").format("YYYY-MM-DD HH:mm:ss"), s = dayjs().endOf("month").format("YYYY-MM-DD HH:mm:ss"), g = dayjs().add(-2, "month").startOf("month").format("YYYY-MM-DD HH:mm:ss"), u = dayjs().endOf("month").format("YYYY-MM-DD HH:mm:ss"), E = dayjs().startOf("year").format("YYYY-MM-DD HH:mm:ss"), C = dayjs().endOf("year").format("YYYY-MM-DD HH:mm:ss"), x = ref([]), k = ref([]);
1235
- watch(
1236
- () => r.config,
1237
- () => {
1238
- m();
1239
- },
1240
- {
1241
- immediate: !0,
1242
- deep: !0
1243
- }
1244
- );
1245
- function m() {
1246
- let B = [];
1247
- if (x.value = [], r.config && r.config.length) {
1248
- for (let J = 0; J < r.config.length; J++) {
1249
- const j = cloneDeep(r.config[J]);
1250
- let { dataType: W, dateType: ae, type: Q, selectorId: q, name: re, columnName: Z, defaultValue: ee, isNull: X } = j, H = [DataSourceColumnDataType.DATE, DataSourceColumnDataType.DATETIME].includes(W);
1251
- const { componentName: v, placeholerPrefix: b, type: p } = componentTransition(W, ae);
1252
- j.formItemType = v, j.placeholder = b + re || Z, p && (j.type = p), j.optionData = [];
1253
- let c = ee || "";
1254
- if (H)
1255
- switch (ee) {
1256
- case "today":
1257
- c = a;
1258
- break;
1259
- case "thisMonth":
1260
- c = d;
1261
- break;
1262
- case "threeMonth":
1263
- c = g;
1264
- break;
1265
- case "thisYear":
1266
- c = E;
1267
- break;
1268
- }
1269
- if (j.value = c, x.value.push({
1270
- name: Z,
1271
- value: c,
1272
- type: Q,
1273
- isNull: X
1274
- }), q && axios.request({
1275
- url: `/windowDesign/getSelectorList?selectorId=${q}`,
1276
- method: "POST"
1277
- }).then((o) => {
1278
- o.data && o.data.data && (j.optionData = o.data.data.map(({ name: f, value: l }) => ({
1279
- label: f,
1280
- value: l
1281
- })));
1282
- }), B.push(j), Q === "LT_GT_EQ") {
1283
- j.placeholder = b + "开始";
1284
- const o = cloneDeep(j);
1285
- o.name = "-", o.columnName = `end_${Z}`, o.placeholder = b + "结束";
1286
- let f = ee || "";
1287
- if (H)
1288
- switch (ee) {
1289
- case "today":
1290
- f = n;
1291
- break;
1292
- case "thisMonth":
1293
- f = s;
1294
- break;
1295
- case "threeMonth":
1296
- f = u;
1297
- break;
1298
- case "thisYear":
1299
- f = C;
1300
- break;
1301
- }
1302
- x.value.push({
1303
- name: `end_${Z}`,
1304
- value: f,
1305
- type: Q,
1306
- isNull: X
1307
- }), q && axios.request({
1308
- url: `/windowDesign/getSelectorList?selectorId=${q}`,
1309
- method: "POST"
1310
- }).then((l) => {
1311
- l.data && l.data.data && (o.optionData = l.data.data.map(({ name: y, value: i }) => ({
1312
- label: y,
1313
- value: i
1314
- })));
1315
- }), B.push(o);
1316
- }
1317
- }
1318
- r.config.map((J) => J.isNull).includes(!0) && nextTick(() => {
1319
- e("change", x.value);
1320
- });
1321
- }
1322
- k.value = B;
1323
- }
1324
- function w(B, J) {
1325
- let j = x.value.findIndex((W) => W.name === J.columnName);
1326
- J.value = B, x.value[j].value = B, ["ElSelect", "ElTreeSelect", "ElSwitch", "ElDatePicker", "ElTimePicker", "ElColorPicker"].includes(J.formItemType) && e("change", x.value);
1327
- }
1328
- function M(B) {
1329
- ["ElInput", "ElInputNumber"].includes(B.formItemType) && e("change", x.value);
1330
- }
1331
- return (B, J) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
1332
- createVNode(unref(ElForm), { inline: "" }, {
1333
- default: withCtx(() => [
1334
- (openBlock(!0), createElementBlock(Fragment, null, renderList(k.value, (j) => withDirectives((openBlock(), createBlock(unref(ElFormItem), {
1335
- label: j.name,
1336
- style: normalizeStyle(j.columnName.indexOf("end_") > -1 ? { marginLeft: "-22px" } : {})
1337
- }, {
1338
- default: withCtx(() => [
1339
- j.formItemType === "ElSelect" ? (openBlock(), createBlock(resolveDynamicComponent(j.formItemType), {
1340
- key: 0,
1341
- "model-value": j.value,
1342
- type: j.type,
1343
- clearable: "",
1344
- placeholder: j.placeholder,
1345
- "onUpdate:modelValue": (W) => w(W, j)
1346
- }, {
1347
- default: withCtx(() => [
1348
- createElementVNode("template", null, [
1349
- (openBlock(!0), createElementBlock(Fragment, null, renderList(j.optionData, (W) => (openBlock(), createBlock(unref(ElOption), {
1350
- label: W.label,
1351
- value: W.value
1352
- }, null, 8, ["label", "value"]))), 256))
1353
- ])
1354
- ]),
1355
- _: 2
1356
- }, 1032, ["model-value", "type", "placeholder", "onUpdate:modelValue"])) : (openBlock(), createBlock(resolveDynamicComponent(j.formItemType), {
1357
- key: 1,
1358
- "model-value": j.value,
1359
- type: j.type,
1360
- clearable: "",
1361
- "value-format": "YYYY-MM-DD HH:mm:ss",
1362
- placeholder: j.placeholder,
1363
- onBlur: (W) => M(j),
1364
- onKeyup: withKeys((W) => M(j), ["enter"]),
1365
- "onUpdate:modelValue": (W) => w(W, j)
1366
- }, null, 40, ["model-value", "type", "placeholder", "onBlur", "onKeyup", "onUpdate:modelValue"]))
1367
- ]),
1368
- _: 2
1369
- }, 1032, ["label", "style"])), [
1370
- [vShow, j.isShow]
1371
- ])), 256))
1372
- ]),
1373
- _: 1
1374
- }),
1375
- renderSlot(B.$slots, "search")
1376
- ]));
1377
- }
1378
- }), reportConditions_vue_vue_type_style_index_0_lang = "";
1379
- function getDateSourceList() {
1380
- return axios.request({
1381
- url: "/windowDesign/getDatasourceList",
1382
- method: "POST"
1383
- });
1384
- }
1385
- function getDateSourceColumns(t) {
1386
- return axios.request({
1387
- url: "/windowDesign/getColumns",
1388
- method: "POST",
1389
- data: {
1390
- datasourceId: t
1391
- }
1392
- }).then((e) => e.data && e.data.data ? Promise.resolve(e.data.data) : Promise.resolve([]));
1393
- }
1394
- function getDateSourceData(t, e = {
1395
- pageNumber: 1,
1396
- pageSize: 100
1397
- }) {
1398
- return axios.request({
1399
- url: `/report/data/${t}`,
1400
- type: "json",
1401
- method: "POST",
1402
- data: e
1403
- }).then((r) => {
1404
- var a;
1405
- return r != null && r.data && ((a = r.data) != null && a.data) ? Promise.resolve(r.data) : Promise.resolve([]);
1406
- });
1407
- }
1408
- function renderCellStyle(t) {
1409
- let e = "";
1410
- return Object.keys(t).forEach((r) => {
1411
- if (t[r])
1412
- switch (r) {
1413
- case "color":
1414
- e += `color:${t[r]};`;
1415
- break;
1416
- case "backgroundColor":
1417
- e += `background-color:${t[r]};`;
1418
- break;
1419
- case "fontWeight":
1420
- e += `font-weight:${t[r]};`;
1421
- break;
1422
- case "fontSize":
1423
- e += `font-size:${t[r]}px;`;
1424
- break;
1425
- case "textAlign":
1426
- e += `text-align:${t[r]};`;
1427
- break;
1428
- case "verticalAlign":
1429
- e += `vertical-align:${t[r]};`;
1430
- break;
1431
- case "fontFamily":
1432
- e += `font-family:${t[r]};`;
1433
- break;
1434
- }
1435
- }), e;
1436
- }
1437
- function formatNumber(t, { numberDecimal: e, numberUseGrouping: r } = {}) {
1438
- typeof t == "string" && (t = t.replace(/,/g, "")), t = parseFloat(t), isNaN(t) && (t = 0);
1439
- const a = e === 0 ? Math.round(t) : t.toFixed(e);
1440
- if (r) {
1441
- const n = a.toString().split(".");
1442
- return n[0] = n[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), n.join(".");
1443
- } else
1444
- return a;
1445
- }
1446
- function formatCurrency(t, { numberDecimal: e, currencySymbol: r, numberUseGrouping: a } = {}) {
1447
- if (typeof t == "string" && (t = t.replace(/,/g, "")), t = parseFloat(t), isNaN(t))
1448
- throw new Error("Invalid number input");
1449
- const n = e === 0 ? Math.round(t) : parseFloat(t.toFixed(e));
1450
- let [d, s] = n.toString().split(".");
1451
- a && (d = d.replace(/\B(?=(\d{3})+(?!\d))/g, ","));
1452
- let g = `${r}${d}`;
1453
- return e > 0 && (g += `.${s}`), g;
1454
- }
1455
- function formatPercentage(t, { numberDecimal: e } = {}, r = !1) {
1456
- if (typeof t == "string" && (t = t.replace(/,/g, "")), t = parseFloat(t), isNaN(t))
1457
- return t;
1458
- const a = e === 0 ? Math.round(t) : t.toFixed(e);
1459
- return r ? `${a}‰` : `${a}%`;
1460
- }
1461
- function formatScientific(t, { scientificNotation: e = "e", digits: r = 6 } = {}) {
1462
- return typeof t == "string" && (t = t.replace(/,/g, "")), t = parseFloat(t), isNaN(t) ? t : t.toExponential(r).replace(/e/, e);
1463
- }
1464
- function formatDatetime(t, { date: e = "YYYY-MM-DD HH:mm:ss" } = {}) {
1465
- if (t == null)
1466
- return t;
1467
- let r;
1468
- if (typeof t == "number") {
1469
- const a = t < 1e10 ? t * 1e3 : t;
1470
- r = dayjs(a);
1471
- } else if (typeof t == "string") {
1472
- const a = Number(t);
1473
- if (isNaN(a))
1474
- r = dayjs(t);
1475
- else {
1476
- const n = a < 1e10 ? a * 1e3 : a;
1477
- r = dayjs(n);
1478
- }
1479
- } else
1480
- return t;
1481
- return r.isValid() ? r.format(e) : t;
1482
- }
1483
- function formatCellValue(t, e, r) {
1484
- switch (e) {
1485
- case "number":
1486
- return formatNumber(t, r);
1487
- case "currency":
1488
- return formatCurrency(t, r);
1489
- case "percent":
1490
- return formatPercentage(t, r, !1);
1491
- case "promille":
1492
- return formatPercentage(t, r, !0);
1493
- case "scientific":
1494
- return formatScientific(t, r);
1495
- case "datetime":
1496
- return formatDatetime(t, r);
1497
- default:
1498
- return t;
1499
- }
1500
- }
1501
- var zhCn$1 = { exports: {} };
1502
- (function(t, e) {
1503
- (function(r, a) {
1504
- t.exports = a(dayjs_minExports);
1505
- })(commonjsGlobal, function(r) {
1506
- function a(s) {
1507
- return s && typeof s == "object" && "default" in s ? s : { default: s };
1508
- }
1509
- var n = a(r), d = { name: "zh-cn", weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"), weekdaysShort: "周日_周一_周二_周三_周四_周五_周六".split("_"), weekdaysMin: "日_一_二_三_四_五_六".split("_"), months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), ordinal: function(s, g) {
1510
- return g === "W" ? s + "周" : s + "日";
1511
- }, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY年M月D日", LLL: "YYYY年M月D日Ah点mm分", LLLL: "YYYY年M月D日ddddAh点mm分", l: "YYYY/M/D", ll: "YYYY年M月D日", lll: "YYYY年M月D日 HH:mm", llll: "YYYY年M月D日dddd HH:mm" }, relativeTime: { future: "%s内", past: "%s前", s: "几秒", m: "1 分钟", mm: "%d 分钟", h: "1 小时", hh: "%d 小时", d: "1 天", dd: "%d 天", M: "1 个月", MM: "%d 个月", y: "1 年", yy: "%d 年" }, meridiem: function(s, g) {
1512
- var u = 100 * s + g;
1513
- return u < 600 ? "凌晨" : u < 900 ? "早上" : u < 1100 ? "上午" : u < 1300 ? "中午" : u < 1800 ? "下午" : "晚上";
1514
- } };
1515
- return n.default.locale(d, null, !0), d;
1516
- });
1517
- })(zhCn$1);
1518
- var zhCnExports = zhCn$1.exports;
1519
- const zhCn = /* @__PURE__ */ getDefaultExportFromCjs(zhCnExports);
1520
- dayjs.locale(zhCn);
1521
- async function getProcessData(processData, data, params) {
1522
- try {
1523
- const fun = function(axios, dayjs) {
1524
- return eval(
1525
- `async (allData, params) => {
1526
- ${processData}
1527
- }`
1528
- );
1529
- }(axios, dayjs);
1530
- return await fun.call(this, data, params);
1531
- } catch (t) {
1532
- return console.error(t), data;
1533
- }
1534
- }
1535
- class Hooks {
1536
- /**
1537
- * @callback HookCallback
1538
- * @this {*|Jsep} this
1539
- * @param {Jsep} env
1540
- * @returns: void
1541
- */
1542
- /**
1543
- * Adds the given callback to the list of callbacks for the given hook.
1544
- *
1545
- * The callback will be invoked when the hook it is registered for is run.
1546
- *
1547
- * One callback function can be registered to multiple hooks and the same hook multiple times.
1548
- *
1549
- * @param {string|object} name The name of the hook, or an object of callbacks keyed by name
1550
- * @param {HookCallback|boolean} callback The callback function which is given environment variables.
1551
- * @param {?boolean} [first=false] Will add the hook to the top of the list (defaults to the bottom)
1552
- * @public
1553
- */
1554
- add(e, r, a) {
1555
- if (typeof arguments[0] != "string")
1556
- for (let n in arguments[0])
1557
- this.add(n, arguments[0][n], arguments[1]);
1558
- else
1559
- (Array.isArray(e) ? e : [e]).forEach(function(n) {
1560
- this[n] = this[n] || [], r && this[n][a ? "unshift" : "push"](r);
1561
- }, this);
1562
- }
1563
- /**
1564
- * Runs a hook invoking all registered callbacks with the given environment variables.
1565
- *
1566
- * Callbacks will be invoked synchronously and in the order in which they were registered.
1567
- *
1568
- * @param {string} name The name of the hook.
1569
- * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
1570
- * @public
1571
- */
1572
- run(e, r) {
1573
- this[e] = this[e] || [], this[e].forEach(function(a) {
1574
- a.call(r && r.context ? r.context : r, r);
1575
- });
1576
- }
1577
- }
1578
- class Plugins {
1579
- constructor(e) {
1580
- this.jsep = e, this.registered = {};
1581
- }
1582
- /**
1583
- * @callback PluginSetup
1584
- * @this {Jsep} jsep
1585
- * @returns: void
1586
- */
1587
- /**
1588
- * Adds the given plugin(s) to the registry
1589
- *
1590
- * @param {object} plugins
1591
- * @param {string} plugins.name The name of the plugin
1592
- * @param {PluginSetup} plugins.init The init function
1593
- * @public
1594
- */
1595
- register(...e) {
1596
- e.forEach((r) => {
1597
- if (typeof r != "object" || !r.name || !r.init)
1598
- throw new Error("Invalid JSEP plugin format");
1599
- this.registered[r.name] || (r.init(this.jsep), this.registered[r.name] = r);
1600
- });
1601
- }
1602
- }
1603
- class Jsep {
1604
- /**
1605
- * @returns {string}
1606
- */
1607
- static get version() {
1608
- return "1.4.0";
1609
- }
1610
- /**
1611
- * @returns {string}
1612
- */
1613
- static toString() {
1614
- return "JavaScript Expression Parser (JSEP) v" + Jsep.version;
1615
- }
1616
- // ==================== CONFIG ================================
1617
- /**
1618
- * @method addUnaryOp
1619
- * @param {string} op_name The name of the unary op to add
1620
- * @returns {Jsep}
1621
- */
1622
- static addUnaryOp(e) {
1623
- return Jsep.max_unop_len = Math.max(e.length, Jsep.max_unop_len), Jsep.unary_ops[e] = 1, Jsep;
1624
- }
1625
- /**
1626
- * @method jsep.addBinaryOp
1627
- * @param {string} op_name The name of the binary op to add
1628
- * @param {number} precedence The precedence of the binary op (can be a float). Higher number = higher precedence
1629
- * @param {boolean} [isRightAssociative=false] whether operator is right-associative
1630
- * @returns {Jsep}
1631
- */
1632
- static addBinaryOp(e, r, a) {
1633
- return Jsep.max_binop_len = Math.max(e.length, Jsep.max_binop_len), Jsep.binary_ops[e] = r, a ? Jsep.right_associative.add(e) : Jsep.right_associative.delete(e), Jsep;
1634
- }
1635
- /**
1636
- * @method addIdentifierChar
1637
- * @param {string} char The additional character to treat as a valid part of an identifier
1638
- * @returns {Jsep}
1639
- */
1640
- static addIdentifierChar(e) {
1641
- return Jsep.additional_identifier_chars.add(e), Jsep;
1642
- }
1643
- /**
1644
- * @method addLiteral
1645
- * @param {string} literal_name The name of the literal to add
1646
- * @param {*} literal_value The value of the literal
1647
- * @returns {Jsep}
1648
- */
1649
- static addLiteral(e, r) {
1650
- return Jsep.literals[e] = r, Jsep;
1651
- }
1652
- /**
1653
- * @method removeUnaryOp
1654
- * @param {string} op_name The name of the unary op to remove
1655
- * @returns {Jsep}
1656
- */
1657
- static removeUnaryOp(e) {
1658
- return delete Jsep.unary_ops[e], e.length === Jsep.max_unop_len && (Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops)), Jsep;
1659
- }
1660
- /**
1661
- * @method removeAllUnaryOps
1662
- * @returns {Jsep}
1663
- */
1664
- static removeAllUnaryOps() {
1665
- return Jsep.unary_ops = {}, Jsep.max_unop_len = 0, Jsep;
1666
- }
1667
- /**
1668
- * @method removeIdentifierChar
1669
- * @param {string} char The additional character to stop treating as a valid part of an identifier
1670
- * @returns {Jsep}
1671
- */
1672
- static removeIdentifierChar(e) {
1673
- return Jsep.additional_identifier_chars.delete(e), Jsep;
1674
- }
1675
- /**
1676
- * @method removeBinaryOp
1677
- * @param {string} op_name The name of the binary op to remove
1678
- * @returns {Jsep}
1679
- */
1680
- static removeBinaryOp(e) {
1681
- return delete Jsep.binary_ops[e], e.length === Jsep.max_binop_len && (Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops)), Jsep.right_associative.delete(e), Jsep;
1682
- }
1683
- /**
1684
- * @method removeAllBinaryOps
1685
- * @returns {Jsep}
1686
- */
1687
- static removeAllBinaryOps() {
1688
- return Jsep.binary_ops = {}, Jsep.max_binop_len = 0, Jsep;
1689
- }
1690
- /**
1691
- * @method removeLiteral
1692
- * @param {string} literal_name The name of the literal to remove
1693
- * @returns {Jsep}
1694
- */
1695
- static removeLiteral(e) {
1696
- return delete Jsep.literals[e], Jsep;
1697
- }
1698
- /**
1699
- * @method removeAllLiterals
1700
- * @returns {Jsep}
1701
- */
1702
- static removeAllLiterals() {
1703
- return Jsep.literals = {}, Jsep;
1704
- }
1705
- // ==================== END CONFIG ============================
1706
- /**
1707
- * @returns {string}
1708
- */
1709
- get char() {
1710
- return this.expr.charAt(this.index);
1711
- }
1712
- /**
1713
- * @returns {number}
1714
- */
1715
- get code() {
1716
- return this.expr.charCodeAt(this.index);
1717
- }
1718
- /**
1719
- * @param {string} expr a string with the passed in express
1720
- * @returns Jsep
1721
- */
1722
- constructor(e) {
1723
- this.expr = e, this.index = 0;
1724
- }
1725
- /**
1726
- * static top-level parser
1727
- * @returns {jsep.Expression}
1728
- */
1729
- static parse(e) {
1730
- return new Jsep(e).parse();
1731
- }
1732
- /**
1733
- * Get the longest key length of any object
1734
- * @param {object} obj
1735
- * @returns {number}
1736
- */
1737
- static getMaxKeyLen(e) {
1738
- return Math.max(0, ...Object.keys(e).map((r) => r.length));
1739
- }
1740
- /**
1741
- * `ch` is a character code in the next three functions
1742
- * @param {number} ch
1743
- * @returns {boolean}
1744
- */
1745
- static isDecimalDigit(e) {
1746
- return e >= 48 && e <= 57;
1747
- }
1748
- /**
1749
- * Returns the precedence of a binary operator or `0` if it isn't a binary operator. Can be float.
1750
- * @param {string} op_val
1751
- * @returns {number}
1752
- */
1753
- static binaryPrecedence(e) {
1754
- return Jsep.binary_ops[e] || 0;
1755
- }
1756
- /**
1757
- * Looks for start of identifier
1758
- * @param {number} ch
1759
- * @returns {boolean}
1760
- */
1761
- static isIdentifierStart(e) {
1762
- return e >= 65 && e <= 90 || // A...Z
1763
- e >= 97 && e <= 122 || // a...z
1764
- e >= 128 && !Jsep.binary_ops[String.fromCharCode(e)] || // any non-ASCII that is not an operator
1765
- Jsep.additional_identifier_chars.has(String.fromCharCode(e));
1766
- }
1767
- /**
1768
- * @param {number} ch
1769
- * @returns {boolean}
1770
- */
1771
- static isIdentifierPart(e) {
1772
- return Jsep.isIdentifierStart(e) || Jsep.isDecimalDigit(e);
1773
- }
1774
- /**
1775
- * throw error at index of the expression
1776
- * @param {string} message
1777
- * @throws
1778
- */
1779
- throwError(e) {
1780
- const r = new Error(e + " at character " + this.index);
1781
- throw r.index = this.index, r.description = e, r;
1782
- }
1783
- /**
1784
- * Run a given hook
1785
- * @param {string} name
1786
- * @param {jsep.Expression|false} [node]
1787
- * @returns {?jsep.Expression}
1788
- */
1789
- runHook(e, r) {
1790
- if (Jsep.hooks[e]) {
1791
- const a = { context: this, node: r };
1792
- return Jsep.hooks.run(e, a), a.node;
1793
- }
1794
- return r;
1795
- }
1796
- /**
1797
- * Runs a given hook until one returns a node
1798
- * @param {string} name
1799
- * @returns {?jsep.Expression}
1800
- */
1801
- searchHook(e) {
1802
- if (Jsep.hooks[e]) {
1803
- const r = { context: this };
1804
- return Jsep.hooks[e].find(function(a) {
1805
- return a.call(r.context, r), r.node;
1806
- }), r.node;
1807
- }
1808
- }
1809
- /**
1810
- * Push `index` up to the next non-space character
1811
- */
1812
- gobbleSpaces() {
1813
- let e = this.code;
1814
- for (; e === Jsep.SPACE_CODE || e === Jsep.TAB_CODE || e === Jsep.LF_CODE || e === Jsep.CR_CODE; )
1815
- e = this.expr.charCodeAt(++this.index);
1816
- this.runHook("gobble-spaces");
1817
- }
1818
- /**
1819
- * Top-level method to parse all expressions and returns compound or single node
1820
- * @returns {jsep.Expression}
1821
- */
1822
- parse() {
1823
- this.runHook("before-all");
1824
- const e = this.gobbleExpressions(), r = e.length === 1 ? e[0] : {
1825
- type: Jsep.COMPOUND,
1826
- body: e
1827
- };
1828
- return this.runHook("after-all", r);
1829
- }
1830
- /**
1831
- * top-level parser (but can be reused within as well)
1832
- * @param {number} [untilICode]
1833
- * @returns {jsep.Expression[]}
1834
- */
1835
- gobbleExpressions(e) {
1836
- let r = [], a, n;
1837
- for (; this.index < this.expr.length; )
1838
- if (a = this.code, a === Jsep.SEMCOL_CODE || a === Jsep.COMMA_CODE)
1839
- this.index++;
1840
- else if (n = this.gobbleExpression())
1841
- r.push(n);
1842
- else if (this.index < this.expr.length) {
1843
- if (a === e)
1844
- break;
1845
- this.throwError('Unexpected "' + this.char + '"');
1846
- }
1847
- return r;
1848
- }
1849
- /**
1850
- * The main parsing function.
1851
- * @returns {?jsep.Expression}
1852
- */
1853
- gobbleExpression() {
1854
- const e = this.searchHook("gobble-expression") || this.gobbleBinaryExpression();
1855
- return this.gobbleSpaces(), this.runHook("after-expression", e);
1856
- }
1857
- /**
1858
- * Search for the operation portion of the string (e.g. `+`, `===`)
1859
- * Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`)
1860
- * and move down from 3 to 2 to 1 character until a matching binary operation is found
1861
- * then, return that binary operation
1862
- * @returns {string|boolean}
1863
- */
1864
- gobbleBinaryOp() {
1865
- this.gobbleSpaces();
1866
- let e = this.expr.substr(this.index, Jsep.max_binop_len), r = e.length;
1867
- for (; r > 0; ) {
1868
- if (Jsep.binary_ops.hasOwnProperty(e) && (!Jsep.isIdentifierStart(this.code) || this.index + e.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + e.length))))
1869
- return this.index += r, e;
1870
- e = e.substr(0, --r);
1871
- }
1872
- return !1;
1873
- }
1874
- /**
1875
- * This function is responsible for gobbling an individual expression,
1876
- * e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)`
1877
- * @returns {?jsep.BinaryExpression}
1878
- */
1879
- gobbleBinaryExpression() {
1880
- let e, r, a, n, d, s, g, u, E;
1881
- if (s = this.gobbleToken(), !s || (r = this.gobbleBinaryOp(), !r))
1882
- return s;
1883
- for (d = { value: r, prec: Jsep.binaryPrecedence(r), right_a: Jsep.right_associative.has(r) }, g = this.gobbleToken(), g || this.throwError("Expected expression after " + r), n = [s, d, g]; r = this.gobbleBinaryOp(); ) {
1884
- if (a = Jsep.binaryPrecedence(r), a === 0) {
1885
- this.index -= r.length;
1886
- break;
1887
- }
1888
- d = { value: r, prec: a, right_a: Jsep.right_associative.has(r) }, E = r;
1889
- const C = (x) => d.right_a && x.right_a ? a > x.prec : a <= x.prec;
1890
- for (; n.length > 2 && C(n[n.length - 2]); )
1891
- g = n.pop(), r = n.pop().value, s = n.pop(), e = {
1892
- type: Jsep.BINARY_EXP,
1893
- operator: r,
1894
- left: s,
1895
- right: g
1896
- }, n.push(e);
1897
- e = this.gobbleToken(), e || this.throwError("Expected expression after " + E), n.push(d, e);
1898
- }
1899
- for (u = n.length - 1, e = n[u]; u > 1; )
1900
- e = {
1901
- type: Jsep.BINARY_EXP,
1902
- operator: n[u - 1].value,
1903
- left: n[u - 2],
1904
- right: e
1905
- }, u -= 2;
1906
- return e;
1907
- }
1908
- /**
1909
- * An individual part of a binary expression:
1910
- * e.g. `foo.bar(baz)`, `1`, `"abc"`, `(a % 2)` (because it's in parenthesis)
1911
- * @returns {boolean|jsep.Expression}
1912
- */
1913
- gobbleToken() {
1914
- let e, r, a, n;
1915
- if (this.gobbleSpaces(), n = this.searchHook("gobble-token"), n)
1916
- return this.runHook("after-token", n);
1917
- if (e = this.code, Jsep.isDecimalDigit(e) || e === Jsep.PERIOD_CODE)
1918
- return this.gobbleNumericLiteral();
1919
- if (e === Jsep.SQUOTE_CODE || e === Jsep.DQUOTE_CODE)
1920
- n = this.gobbleStringLiteral();
1921
- else if (e === Jsep.OBRACK_CODE)
1922
- n = this.gobbleArray();
1923
- else {
1924
- for (r = this.expr.substr(this.index, Jsep.max_unop_len), a = r.length; a > 0; ) {
1925
- if (Jsep.unary_ops.hasOwnProperty(r) && (!Jsep.isIdentifierStart(this.code) || this.index + r.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + r.length)))) {
1926
- this.index += a;
1927
- const d = this.gobbleToken();
1928
- return d || this.throwError("missing unaryOp argument"), this.runHook("after-token", {
1929
- type: Jsep.UNARY_EXP,
1930
- operator: r,
1931
- argument: d,
1932
- prefix: !0
1933
- });
1934
- }
1935
- r = r.substr(0, --a);
1936
- }
1937
- Jsep.isIdentifierStart(e) ? (n = this.gobbleIdentifier(), Jsep.literals.hasOwnProperty(n.name) ? n = {
1938
- type: Jsep.LITERAL,
1939
- value: Jsep.literals[n.name],
1940
- raw: n.name
1941
- } : n.name === Jsep.this_str && (n = { type: Jsep.THIS_EXP })) : e === Jsep.OPAREN_CODE && (n = this.gobbleGroup());
1942
- }
1943
- return n ? (n = this.gobbleTokenProperty(n), this.runHook("after-token", n)) : this.runHook("after-token", !1);
1944
- }
1945
- /**
1946
- * Gobble properties of of identifiers/strings/arrays/groups.
1947
- * e.g. `foo`, `bar.baz`, `foo['bar'].baz`
1948
- * It also gobbles function calls:
1949
- * e.g. `Math.acos(obj.angle)`
1950
- * @param {jsep.Expression} node
1951
- * @returns {jsep.Expression}
1952
- */
1953
- gobbleTokenProperty(e) {
1954
- this.gobbleSpaces();
1955
- let r = this.code;
1956
- for (; r === Jsep.PERIOD_CODE || r === Jsep.OBRACK_CODE || r === Jsep.OPAREN_CODE || r === Jsep.QUMARK_CODE; ) {
1957
- let a;
1958
- if (r === Jsep.QUMARK_CODE) {
1959
- if (this.expr.charCodeAt(this.index + 1) !== Jsep.PERIOD_CODE)
1960
- break;
1961
- a = !0, this.index += 2, this.gobbleSpaces(), r = this.code;
1962
- }
1963
- this.index++, r === Jsep.OBRACK_CODE ? (e = {
1964
- type: Jsep.MEMBER_EXP,
1965
- computed: !0,
1966
- object: e,
1967
- property: this.gobbleExpression()
1968
- }, e.property || this.throwError('Unexpected "' + this.char + '"'), this.gobbleSpaces(), r = this.code, r !== Jsep.CBRACK_CODE && this.throwError("Unclosed ["), this.index++) : r === Jsep.OPAREN_CODE ? e = {
1969
- type: Jsep.CALL_EXP,
1970
- arguments: this.gobbleArguments(Jsep.CPAREN_CODE),
1971
- callee: e
1972
- } : (r === Jsep.PERIOD_CODE || a) && (a && this.index--, this.gobbleSpaces(), e = {
1973
- type: Jsep.MEMBER_EXP,
1974
- computed: !1,
1975
- object: e,
1976
- property: this.gobbleIdentifier()
1977
- }), a && (e.optional = !0), this.gobbleSpaces(), r = this.code;
1978
- }
1979
- return e;
1980
- }
1981
- /**
1982
- * Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to
1983
- * keep track of everything in the numeric literal and then calling `parseFloat` on that string
1984
- * @returns {jsep.Literal}
1985
- */
1986
- gobbleNumericLiteral() {
1987
- let e = "", r, a;
1988
- for (; Jsep.isDecimalDigit(this.code); )
1989
- e += this.expr.charAt(this.index++);
1990
- if (this.code === Jsep.PERIOD_CODE)
1991
- for (e += this.expr.charAt(this.index++); Jsep.isDecimalDigit(this.code); )
1992
- e += this.expr.charAt(this.index++);
1993
- if (r = this.char, r === "e" || r === "E") {
1994
- for (e += this.expr.charAt(this.index++), r = this.char, (r === "+" || r === "-") && (e += this.expr.charAt(this.index++)); Jsep.isDecimalDigit(this.code); )
1995
- e += this.expr.charAt(this.index++);
1996
- Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) || this.throwError("Expected exponent (" + e + this.char + ")");
1997
- }
1998
- return a = this.code, Jsep.isIdentifierStart(a) ? this.throwError("Variable names cannot start with a number (" + e + this.char + ")") : (a === Jsep.PERIOD_CODE || e.length === 1 && e.charCodeAt(0) === Jsep.PERIOD_CODE) && this.throwError("Unexpected period"), {
1999
- type: Jsep.LITERAL,
2000
- value: parseFloat(e),
2001
- raw: e
2002
- };
2003
- }
2004
- /**
2005
- * Parses a string literal, staring with single or double quotes with basic support for escape codes
2006
- * e.g. `"hello world"`, `'this is\nJSEP'`
2007
- * @returns {jsep.Literal}
2008
- */
2009
- gobbleStringLiteral() {
2010
- let e = "";
2011
- const r = this.index, a = this.expr.charAt(this.index++);
2012
- let n = !1;
2013
- for (; this.index < this.expr.length; ) {
2014
- let d = this.expr.charAt(this.index++);
2015
- if (d === a) {
2016
- n = !0;
2017
- break;
2018
- } else if (d === "\\")
2019
- switch (d = this.expr.charAt(this.index++), d) {
2020
- case "n":
2021
- e += `
2022
- `;
2023
- break;
2024
- case "r":
2025
- e += "\r";
2026
- break;
2027
- case "t":
2028
- e += " ";
2029
- break;
2030
- case "b":
2031
- e += "\b";
2032
- break;
2033
- case "f":
2034
- e += "\f";
2035
- break;
2036
- case "v":
2037
- e += "\v";
2038
- break;
2039
- default:
2040
- e += d;
2041
- }
2042
- else
2043
- e += d;
2044
- }
2045
- return n || this.throwError('Unclosed quote after "' + e + '"'), {
2046
- type: Jsep.LITERAL,
2047
- value: e,
2048
- raw: this.expr.substring(r, this.index)
2049
- };
2050
- }
2051
- /**
2052
- * Gobbles only identifiers
2053
- * e.g.: `foo`, `_value`, `$x1`
2054
- * Also, this function checks if that identifier is a literal:
2055
- * (e.g. `true`, `false`, `null`) or `this`
2056
- * @returns {jsep.Identifier}
2057
- */
2058
- gobbleIdentifier() {
2059
- let e = this.code, r = this.index;
2060
- for (Jsep.isIdentifierStart(e) ? this.index++ : this.throwError("Unexpected " + this.char); this.index < this.expr.length && (e = this.code, Jsep.isIdentifierPart(e)); )
2061
- this.index++;
2062
- return {
2063
- type: Jsep.IDENTIFIER,
2064
- name: this.expr.slice(r, this.index)
2065
- };
2066
- }
2067
- /**
2068
- * Gobbles a list of arguments within the context of a function call
2069
- * or array literal. This function also assumes that the opening character
2070
- * `(` or `[` has already been gobbled, and gobbles expressions and commas
2071
- * until the terminator character `)` or `]` is encountered.
2072
- * e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]`
2073
- * @param {number} termination
2074
- * @returns {jsep.Expression[]}
2075
- */
2076
- gobbleArguments(e) {
2077
- const r = [];
2078
- let a = !1, n = 0;
2079
- for (; this.index < this.expr.length; ) {
2080
- this.gobbleSpaces();
2081
- let d = this.code;
2082
- if (d === e) {
2083
- a = !0, this.index++, e === Jsep.CPAREN_CODE && n && n >= r.length && this.throwError("Unexpected token " + String.fromCharCode(e));
2084
- break;
2085
- } else if (d === Jsep.COMMA_CODE) {
2086
- if (this.index++, n++, n !== r.length) {
2087
- if (e === Jsep.CPAREN_CODE)
2088
- this.throwError("Unexpected token ,");
2089
- else if (e === Jsep.CBRACK_CODE)
2090
- for (let s = r.length; s < n; s++)
2091
- r.push(null);
2092
- }
2093
- } else if (r.length !== n && n !== 0)
2094
- this.throwError("Expected comma");
2095
- else {
2096
- const s = this.gobbleExpression();
2097
- (!s || s.type === Jsep.COMPOUND) && this.throwError("Expected comma"), r.push(s);
2098
- }
2099
- }
2100
- return a || this.throwError("Expected " + String.fromCharCode(e)), r;
2101
- }
2102
- /**
2103
- * Responsible for parsing a group of things within parentheses `()`
2104
- * that have no identifier in front (so not a function call)
2105
- * This function assumes that it needs to gobble the opening parenthesis
2106
- * and then tries to gobble everything within that parenthesis, assuming
2107
- * that the next thing it should see is the close parenthesis. If not,
2108
- * then the expression probably doesn't have a `)`
2109
- * @returns {boolean|jsep.Expression}
2110
- */
2111
- gobbleGroup() {
2112
- this.index++;
2113
- let e = this.gobbleExpressions(Jsep.CPAREN_CODE);
2114
- if (this.code === Jsep.CPAREN_CODE)
2115
- return this.index++, e.length === 1 ? e[0] : e.length ? {
2116
- type: Jsep.SEQUENCE_EXP,
2117
- expressions: e
2118
- } : !1;
2119
- this.throwError("Unclosed (");
2120
- }
2121
- /**
2122
- * Responsible for parsing Array literals `[1, 2, 3]`
2123
- * This function assumes that it needs to gobble the opening bracket
2124
- * and then tries to gobble the expressions as arguments.
2125
- * @returns {jsep.ArrayExpression}
2126
- */
2127
- gobbleArray() {
2128
- return this.index++, {
2129
- type: Jsep.ARRAY_EXP,
2130
- elements: this.gobbleArguments(Jsep.CBRACK_CODE)
2131
- };
2132
- }
2133
- }
2134
- const hooks = new Hooks();
2135
- Object.assign(Jsep, {
2136
- hooks,
2137
- plugins: new Plugins(Jsep),
2138
- // Node Types
2139
- // ----------
2140
- // This is the full set of types that any JSEP node can be.
2141
- // Store them here to save space when minified
2142
- COMPOUND: "Compound",
2143
- SEQUENCE_EXP: "SequenceExpression",
2144
- IDENTIFIER: "Identifier",
2145
- MEMBER_EXP: "MemberExpression",
2146
- LITERAL: "Literal",
2147
- THIS_EXP: "ThisExpression",
2148
- CALL_EXP: "CallExpression",
2149
- UNARY_EXP: "UnaryExpression",
2150
- BINARY_EXP: "BinaryExpression",
2151
- ARRAY_EXP: "ArrayExpression",
2152
- TAB_CODE: 9,
2153
- LF_CODE: 10,
2154
- CR_CODE: 13,
2155
- SPACE_CODE: 32,
2156
- PERIOD_CODE: 46,
2157
- // '.'
2158
- COMMA_CODE: 44,
2159
- // ','
2160
- SQUOTE_CODE: 39,
2161
- // single quote
2162
- DQUOTE_CODE: 34,
2163
- // double quotes
2164
- OPAREN_CODE: 40,
2165
- // (
2166
- CPAREN_CODE: 41,
2167
- // )
2168
- OBRACK_CODE: 91,
2169
- // [
2170
- CBRACK_CODE: 93,
2171
- // ]
2172
- QUMARK_CODE: 63,
2173
- // ?
2174
- SEMCOL_CODE: 59,
2175
- // ;
2176
- COLON_CODE: 58,
2177
- // :
2178
- // Operations
2179
- // ----------
2180
- // Use a quickly-accessible map to store all of the unary operators
2181
- // Values are set to `1` (it really doesn't matter)
2182
- unary_ops: {
2183
- "-": 1,
2184
- "!": 1,
2185
- "~": 1,
2186
- "+": 1
2187
- },
2188
- // Also use a map for the binary operations but set their values to their
2189
- // binary precedence for quick reference (higher number = higher precedence)
2190
- // see [Order of operations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)
2191
- binary_ops: {
2192
- "||": 1,
2193
- "??": 1,
2194
- "&&": 2,
2195
- "|": 3,
2196
- "^": 4,
2197
- "&": 5,
2198
- "==": 6,
2199
- "!=": 6,
2200
- "===": 6,
2201
- "!==": 6,
2202
- "<": 7,
2203
- ">": 7,
2204
- "<=": 7,
2205
- ">=": 7,
2206
- "<<": 8,
2207
- ">>": 8,
2208
- ">>>": 8,
2209
- "+": 9,
2210
- "-": 9,
2211
- "*": 10,
2212
- "/": 10,
2213
- "%": 10,
2214
- "**": 11
2215
- },
2216
- // sets specific binary_ops as right-associative
2217
- right_associative: /* @__PURE__ */ new Set(["**"]),
2218
- // Additional valid identifier chars, apart from a-z, A-Z and 0-9 (except on the starting char)
2219
- additional_identifier_chars: /* @__PURE__ */ new Set(["$", "_"]),
2220
- // Literals
2221
- // ----------
2222
- // Store the values to return for the various literals we may encounter
2223
- literals: {
2224
- true: !0,
2225
- false: !1,
2226
- null: null
2227
- },
2228
- // Except for `this`, which is special. This could be changed to something like `'self'` as well
2229
- this_str: "this"
2230
- });
2231
- Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);
2232
- Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);
2233
- const jsep = (t) => new Jsep(t).parse(), stdClassProps = Object.getOwnPropertyNames(class {
2234
- });
2235
- Object.getOwnPropertyNames(Jsep).filter((t) => !stdClassProps.includes(t) && jsep[t] === void 0).forEach((t) => {
2236
- jsep[t] = Jsep[t];
2237
- });
2238
- jsep.Jsep = Jsep;
2239
- const CONDITIONAL_EXP = "ConditionalExpression";
2240
- var ternary = {
2241
- name: "ternary",
2242
- init(t) {
2243
- t.hooks.add("after-expression", function(r) {
2244
- if (r.node && this.code === t.QUMARK_CODE) {
2245
- this.index++;
2246
- const a = r.node, n = this.gobbleExpression();
2247
- if (n || this.throwError("Expected expression"), this.gobbleSpaces(), this.code === t.COLON_CODE) {
2248
- this.index++;
2249
- const d = this.gobbleExpression();
2250
- if (d || this.throwError("Expected expression"), r.node = {
2251
- type: CONDITIONAL_EXP,
2252
- test: a,
2253
- consequent: n,
2254
- alternate: d
2255
- }, a.operator && t.binary_ops[a.operator] <= 0.9) {
2256
- let s = a;
2257
- for (; s.right.operator && t.binary_ops[s.right.operator] <= 0.9; )
2258
- s = s.right;
2259
- r.node.test = s.right, s.right = r.node, r.node = a;
2260
- }
2261
- } else
2262
- this.throwError("Expected :");
2263
- }
2264
- });
2265
- }
2266
- };
2267
- jsep.plugins.register(ternary);
2268
- jsep.addBinaryOp("=", 0, (t, e) => t === e);
2269
- jsep.addBinaryOp("<>", 0, (t, e) => t !== e);
2270
- jsep.addBinaryOp(">", 0, (t, e) => t > e);
2271
- jsep.addBinaryOp("<", 0, (t, e) => t < e);
2272
- jsep.addBinaryOp(">=", 0, (t, e) => t >= e);
2273
- jsep.addBinaryOp("<=", 0, (t, e) => t <= e);
2274
- let innerConfig = {}, needComputedCell = /* @__PURE__ */ new Map();
2275
- function changeConfig(config) {
2276
- config.flat().forEach((cell) => {
2277
- let key = `${cell.row}:${cell.col}`;
2278
- if (cell.type === CellType.FUN && needComputedCell.set(key, cell), cell.colSpan !== 0 && cell.rowSpan !== 0) {
2279
- if (cell.type === CellType.FIELD && (cell.colData || cell.rowData)) {
2280
- let t = {
2281
- ...cell.colData,
2282
- ...cell.rowData
2283
- };
2284
- if (cell.format === FormatType.STRING && cell.fun)
2285
- cell.text = cell.fun.replace(/\$\{([a-zA-Z0-9\_\-]+)\}/g, (e, r) => (r = r.toUpperCase(), get(t, r, e)));
2286
- else if (cell.isStaticData && cell.data && cell.data.startsWith("row:")) {
2287
- let e = cell.data.replace("row:", "").toUpperCase();
2288
- cell.text = t[e];
2289
- }
2290
- }
2291
- if (cell.format && (cell.text = formatCellValue(cell.text || "", cell.format, cell.formatType)), cell.customRender) {
2292
- let data = {
2293
- ...cell.colData,
2294
- ...cell.rowData
2295
- };
2296
- console.log(cell);
2297
- const fun = function() {
2298
- return eval(
2299
- `async (cell,data) => {
2300
- let style = {
2301
- ...cell.style
2302
- }
2303
- ${cell.customRender}
2304
- cell.style = style
2305
- return cell
2306
- }`
2307
- );
2308
- }();
2309
- cell = fun.call(this, cell, data);
2310
- }
2311
- }
2312
- innerConfig[key] ? innerConfig[key].push(cell) : innerConfig[key] = [cell];
2313
- });
2314
- }
2315
- function computeCell(t) {
2316
- changeConfig(t), Array.from(needComputedCell.values()).forEach((e) => {
2317
- if (e.type === CellType.FUN && e.fun) {
2318
- const { isError: r, result: a } = parseExpression(e.fun, !0);
2319
- r || (e.text = a, e.type = CellType.TEXT);
2320
- }
2321
- }), innerConfig = {}, needComputedCell = /* @__PURE__ */ new Map();
2322
- }
2323
- function parseExpression(t, e = !1) {
2324
- try {
2325
- const r = t.trim();
2326
- if (!r)
2327
- throw new Error("请输入一个表达式");
2328
- const a = r.startsWith("=") ? r.slice(1) : r, n = jsep(a);
2329
- let d = null;
2330
- return e && (d = evaluateExpression(n)), {
2331
- isError: !1,
2332
- result: d
2333
- };
2334
- } catch (r) {
2335
- return console.error(r), {
2336
- isError: !0,
2337
- result: r.message
2338
- };
2339
- }
2340
- }
2341
- function evaluateExpression(t) {
2342
- if (!t)
2343
- throw new Error("空节点");
2344
- switch (t.type) {
2345
- case "Literal":
2346
- if (typeof t.value == "string") {
2347
- const d = t.value.match(/^(['"]?)([A-Z]+\d+):([A-Z]+\d+)\1$/i);
2348
- if (d)
2349
- return getRangeValues(d[2], d[3]);
2350
- }
2351
- return t.value;
2352
- case "Identifier":
2353
- if (/^[A-Z]+\d+$/.test(t.name))
2354
- return getCellValue(t.name);
2355
- throw new Error(`未定义的标识符: ${t.name}`);
2356
- case "BinaryExpression":
2357
- const e = evaluateExpression(t.left), r = evaluateExpression(t.right);
2358
- switch (t.operator) {
2359
- case "+":
2360
- return e + r;
2361
- case "-":
2362
- return e - r;
2363
- case "*":
2364
- return e * r;
2365
- case "/":
2366
- return e / r;
2367
- case "^":
2368
- return Math.pow(e, r);
2369
- case "=":
2370
- return e === r ? 1 : 0;
2371
- case "<>":
2372
- return e !== r ? 1 : 0;
2373
- case ">":
2374
- return e > r ? 1 : 0;
2375
- case "<":
2376
- return e < r ? 1 : 0;
2377
- case ">=":
2378
- return e >= r ? 1 : 0;
2379
- case "<=":
2380
- return e <= r ? 1 : 0;
2381
- default:
2382
- throw new Error(`不支持的操作符: ${t.operator}`);
2383
- }
2384
- case "CallExpression":
2385
- return evaluateFunction(t.callee.name, t.arguments);
2386
- case "MemberExpression":
2387
- if (t.computed && t.property && t.property.type === "Literal") {
2388
- const s = t.property.value.match(/^(['"]?)([A-Z]+\d+):([A-Z]+\d+)\1$/i);
2389
- if (s)
2390
- return getRangeValues(s[2], s[3]);
2391
- }
2392
- const a = evaluateExpression(t.object), n = t.computed ? evaluateExpression(t.property) : t.property.name;
2393
- if (typeof a == "object" && a !== null)
2394
- return a[n];
2395
- throw new Error(`无法获取非对象值的属性: ${n}`);
2396
- default:
2397
- throw new Error(`不支持的节点类型: ${t.type}`);
2398
- }
2399
- }
2400
- function getRangeValues(t, e) {
2401
- let r = -1;
2402
- const a = t.match(/[A-Z]+/);
2403
- a && (r = columnToNumber(a[0]));
2404
- let n = -1;
2405
- const d = t.match(/\d+/);
2406
- d && (n = parseInt(d[0]) - 1);
2407
- let s = -1;
2408
- const g = e.match(/[A-Z]+/);
2409
- g && (s = columnToNumber(g[0]));
2410
- let u = -1;
2411
- const E = e.match(/\d+/);
2412
- E && (u = parseInt(E[0]) - 1);
2413
- const C = [];
2414
- for (let x = n; x <= u; x++)
2415
- for (let k = r; k <= s; k++) {
2416
- const m = `${x}:${k}`;
2417
- C.push(...getCellValue(m));
2418
- }
2419
- return C;
2420
- }
2421
- function evaluateFunction(t, e) {
2422
- const r = e.map((a) => evaluateExpression(a));
2423
- switch (t.toUpperCase()) {
2424
- case "SUM":
2425
- return r.flat().reduce((s, g) => {
2426
- const u = parseFloat(g);
2427
- return s + (isNaN(u) ? 0 : u);
2428
- }, 0);
2429
- case "AVERAGE":
2430
- case "AVG":
2431
- const n = r.flat().filter((s) => !isNaN(parseFloat(s)));
2432
- return n.length > 0 ? n.reduce((s, g) => s + parseFloat(g), 0) / n.length : 0;
2433
- case "IF":
2434
- if (r.length !== 3)
2435
- throw new Error(`IF函数需要3个参数,但提供了${r.length}个`);
2436
- return r[0] ? r[1] : r[2];
2437
- case "NOW":
2438
- return (/* @__PURE__ */ new Date()).toLocaleString();
2439
- case "TODAY":
2440
- const d = /* @__PURE__ */ new Date();
2441
- return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
2442
- case "MAX":
2443
- return Math.max(
2444
- ...r.flat().map(Number).filter((s) => !isNaN(s))
2445
- );
2446
- case "MIN":
2447
- return Math.min(
2448
- ...r.flat().map(Number).filter((s) => !isNaN(s))
2449
- );
2450
- case "COUNT":
2451
- return r.flat().length;
2452
- case "CONCATENATE":
2453
- case "TEXTJOIN":
2454
- return r.map(String).join("");
2455
- default:
2456
- throw new Error(`不支持的函数: ${t}`);
2457
- }
2458
- }
2459
- function getCellValue(t) {
2460
- try {
2461
- return innerConfig[t].map((e) => e.text);
2462
- } catch (e) {
2463
- console.warn(`无法解析单元格: ${t}`, e);
2464
- }
2465
- return [];
2466
- }
2467
- function columnToNumber(t) {
2468
- let e = 0;
2469
- for (let r = 0; r < t.length; r++)
2470
- e = e * 26 + (t.charCodeAt(r) - 64) - 1;
2471
- return e;
2472
- }
2473
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2474
- __name: "report-view-item",
2475
- props: {
2476
- config: null,
2477
- index: null
2478
- },
2479
- emits: ["updateData"],
2480
- setup(t, { emit: e }) {
2481
- const r = t, a = ref(), n = ref(), d = computed(() => ({
2482
- width: r.config.widthType === "%" ? `calc(${r.config.width}% - 10px)` : `${r.config.width - 10}px`,
2483
- height: r.config.fullHeight ? "calc(100% - 8px)" : `${r.config.height}px`
2484
- })), s = computed(() => r.config && r.config.data ? !!r.config.data.pagination : !1), g = computed(() => r.config.params && Array.isArray(r.config.params) && r.config.params.length > 0), u = reactive({
2485
- pageSize: 100,
2486
- pageSizes: [10, 20, 50, 100, 200, 1e4],
2487
- pageIndex: 1,
2488
- total: 0
2489
- }), E = ref([]);
2490
- function C(v) {
2491
- E.value = v, u.pageIndex = 1, Z();
2492
- }
2493
- let x = !1;
2494
- watch(
2495
- () => [u.pageSize, u.pageIndex],
2496
- (v, b) => {
2497
- if (v && b) {
2498
- let [p, c] = v, [o, f] = v;
2499
- p !== o && (u.pageIndex = 1), x && Z();
2500
- }
2501
- },
2502
- {
2503
- immediate: !0,
2504
- deep: !0
2505
- }
2506
- );
2507
- function k() {
2508
- u.pageIndex = 1, Z();
2509
- }
2510
- const m = ref(!1);
2511
- function w(v, b, p, c) {
2512
- return v.reduce((f, l) => {
2513
- if (l.loop)
2514
- return f.push(l), f;
2515
- if (!l.data)
2516
- return f;
2517
- const y = b[l.data];
2518
- if (!y)
2519
- return f;
2520
- let i;
2521
- if (l.dataIndex !== void 0 && !isNaN(l.dataIndex))
2522
- Array.isArray(y) && l.dataIndex >= 0 && l.dataIndex < y.length ? i = y[l.dataIndex] : i = void 0;
2523
- else if (typeof y == "object" && y !== null)
2524
- i = y;
2525
- else
2526
- return f;
2527
- if (i) {
2528
- if (l = { ...l, data: i }, p === "row" && l.index !== void 0 && l.index >= 0 && l.index < c.length) {
2529
- const D = c[l.index], S = D.length;
2530
- for (let P = 0; P < S; P++) {
2531
- const U = D[P];
2532
- U.data && (U.rowData = l.data, U.isStaticData = !0);
2533
- }
2534
- } else if (p === "col" && l.index !== void 0 && l.index >= 0) {
2535
- const D = c.length;
2536
- for (let S = 0; S < D; S++) {
2537
- const P = c[S];
2538
- if (l.index < P.length) {
2539
- const U = P[l.index];
2540
- U.data && (U.colData = l.data, U.isStaticData = !0);
2541
- }
2542
- }
2543
- }
2544
- }
2545
- return f;
2546
- }, []);
2547
- }
2548
- function M(v) {
2549
- const b = v.length, p = v[0].length, c = [];
2550
- for (let o = 0; o < p; o++) {
2551
- c[o] = [];
2552
- for (let f = 0; f < b; f++)
2553
- c[o][f] = v[f][o];
2554
- }
2555
- return c;
2556
- }
2557
- function B(v, b, p, c, o) {
2558
- if (c) {
2559
- let i = o.findIndex((D) => D === p);
2560
- p = o[i - 1];
2561
- }
2562
- let f = v[b], l = `${p}-${f.join("-")}`;
2563
- return Object.keys(v).filter((i) => i.indexOf(l) > -1).map((i) => v[i]).reduce((i, D) => i + D.length, 0);
2564
- }
2565
- function J(v, b) {
2566
- const p = v.filter((c) => c < b);
2567
- return p.length === 0 ? null : Math.max(...p);
2568
- }
2569
- function j(v, b, p, c) {
2570
- b.forEach((o) => {
2571
- let f = c[o.data], l = p[o.index], y = [];
2572
- l.forEach((O, T) => {
2573
- O.type === CellType.FIELD && O.data && O.isGroup && y.push(T);
2574
- });
2575
- let i = {};
2576
- y.forEach((O, T) => {
2577
- i[O] || (i[O] = /* @__PURE__ */ new Set());
2578
- let I = l[O].data.replace("row:", "").toUpperCase();
2579
- if (T === 0)
2580
- f.forEach((A) => {
2581
- if (I) {
2582
- let $ = A[I];
2583
- if ($) {
2584
- const Y = `${O}-${$}`;
2585
- i[Y] ? i[Y].push(A) : i[Y] = [A], i[O].add($), i[$] = [$], i[`${$}-data`] = [A];
2586
- }
2587
- }
2588
- });
2589
- else {
2590
- let A = y[T - 1];
2591
- Array.from(i[A]).forEach((Y) => {
2592
- const z = `${A}-${Y}`;
2593
- let V = i[z].map((G) => {
2594
- if (I) {
2595
- let K = G[I];
2596
- if (K) {
2597
- let te = !1;
2598
- const ie = `${O}-${Y}-${K}`, ne = `${Y}-${K}`;
2599
- return i[ie] ? i[ie].push(G) : i[ie] = [G], i[ne + "-data"] ? i[ne + "-data"].push(G) : i[ne + "-data"] = [G], i[O].has(ne) || (te = !0), i[O].add(ne), i[ne] = i[Y].concat([K]), te ? K : null;
2600
- }
2601
- }
2602
- }).filter((G) => !!G);
2603
- i[z] = V;
2604
- });
2605
- }
2606
- });
2607
- let D = 1, S = Math.max(...y);
2608
- const P = l.some((O) => O.isRowColCombine);
2609
- y.length > 0 ? P ? D = i[S].size : D = Array.from(i[S]).reduce((O, T) => {
2610
- let _ = i[`${S}-${T}`];
2611
- return O + _.length;
2612
- }, 0) : D = f.length;
2613
- const U = {
2614
- ...o,
2615
- loop: !1
2616
- }, L = Array.from({ length: D }, () => cloneDeep(U));
2617
- v.splice(o.index, 1, ...L);
2618
- const N = Array.from({ length: l.length }, () => []);
2619
- l.forEach((O, T) => {
2620
- let _ = N[T];
2621
- if (y.includes(O.col))
2622
- console.log(i[O.col], T, O.col), Array.from(i[O.col]).forEach((A, $) => {
2623
- let Y = P && T === S ? 1 : B(i, A, S, P, y), z = i[A + "-data"], R = i[A][i[A].length - 1], V = {
2624
- ...O,
2625
- text: R,
2626
- rowSpan: Y,
2627
- rowData: z
2628
- };
2629
- _.push(V);
2630
- let G = {
2631
- ...O,
2632
- text: R,
2633
- type: "",
2634
- colSpan: 0,
2635
- rowSpan: 0
2636
- };
2637
- for (let K = 0; K < Y - 1; K++)
2638
- _.push(G);
2639
- });
2640
- else if (O.data) {
2641
- let I = i[S] ? Array.from(i[S]) : [], A = O.data.replace("row:", "").toUpperCase();
2642
- O.isRowColCombine ? I.length ? I.forEach(($, Y) => {
2643
- let z = i[`${S}-${$}`], R = O.combineKeys.map((K, te) => {
2644
- const ie = O.combineValues[te];
2645
- return {
2646
- key: K,
2647
- val: ie
2648
- };
2649
- });
2650
- const V = z.filter((K) => R.every((te) => K[te.key] === te.val));
2651
- let G = {
2652
- ...O
2653
- };
2654
- if (delete G.combineKeys, delete G.combineValues, delete G.isRowColCombine, V && V.length) {
2655
- const K = V[0];
2656
- G.text = K[A], G.rowData = K;
2657
- } else
2658
- G.text = "", G.rowData = {};
2659
- _.push(G);
2660
- }) : f.forEach(($) => {
2661
- let z = O.combineKeys.map((V, G) => {
2662
- const K = O.combineValues[G];
2663
- return {
2664
- key: V,
2665
- val: K
2666
- };
2667
- }).every((V) => $[V.key] === V.val), R = {
2668
- ...O
2669
- };
2670
- delete R.combineKeys, delete R.combineValues, delete R.isRowColCombine, z ? (R.text = $[A], R.rowData = $) : R.text = "", _.push(R);
2671
- }) : I.length ? I.forEach(($, Y) => {
2672
- i[`${S}-${$}`].forEach((R) => {
2673
- let V = {
2674
- ...O
2675
- };
2676
- delete V.combineKeys, delete V.combineValues, delete V.isRowColCombine, R[A] ? (V.text = R[A], V.rowData = R) : V.text = "", _.push(V);
2677
- });
2678
- }) : f.forEach(($) => {
2679
- let Y = {
2680
- ...O
2681
- };
2682
- delete Y.combineKeys, delete Y.combineValues, delete Y.isRowColCombine, $[A] ? (Y.text = $[A], Y.rowData = $) : Y.text = "", _.push(Y);
2683
- });
2684
- } else {
2685
- const I = {
2686
- ...O,
2687
- rowData: f[0]
2688
- };
2689
- if (O.rowSpan === 0 && O.mergeTarget && O.mergeTarget.length === 2) {
2690
- let [Y, z] = O.mergeTarget, R = p.reduce((V, G) => V.concat(G), []).filter((V) => V.row === Y && V.col === z)[0];
2691
- R && (R.rowSpan += D - 1);
2692
- } else
2693
- I.rowSpan += D - 1;
2694
- const A = {
2695
- ...O,
2696
- type: "",
2697
- colSpan: 0,
2698
- rowSpan: 0
2699
- };
2700
- delete I.isRowColCombine;
2701
- let $ = Array.from({ length: D - 1 }, () => cloneDeep(A));
2702
- _.push(I, ...$);
2703
- }
2704
- });
2705
- const F = M(N);
2706
- p.splice(o.index, 1, ...F);
2707
- });
2708
- }
2709
- function W(v, b, p, c) {
2710
- b.forEach((o) => {
2711
- let f = c[o.data], l = [], y = [];
2712
- p.forEach((L, N) => {
2713
- let F = L[o.index];
2714
- F.type === CellType.FIELD && F.data && F.isGroup && y.push(N), l.push(F);
2715
- });
2716
- let i = {};
2717
- y.forEach((L, N) => {
2718
- i[L] || (i[L] = /* @__PURE__ */ new Set());
2719
- let O = l[L].data.replace("col:", "").toUpperCase();
2720
- if (N === 0)
2721
- f.forEach((T) => {
2722
- if (O) {
2723
- let _ = T[O];
2724
- if (_) {
2725
- const I = `${L}-${_}`;
2726
- i[I] ? i[I].push(T) : i[I] = [T], i[L].add(_), i[_] = [_], i[`${_}-data`] = [T];
2727
- }
2728
- }
2729
- });
2730
- else {
2731
- let T = y[N - 1];
2732
- Array.from(i[T]).forEach((I) => {
2733
- const A = `${T}-${I}`;
2734
- let Y = i[A].map((z) => {
2735
- if (O) {
2736
- let R = z[O];
2737
- if (R) {
2738
- let V = !1;
2739
- const G = `${L}-${I}-${R}`, K = `${I}-${R}`;
2740
- return i[G] ? i[G].push(z) : i[G] = [z], i[K + "-data"] ? i[K + "-data"].push(z) : i[K + "-data"] = [z], i[L].has(K) || (V = !0), i[L].add(K), i[K] = i[I].concat([R]), V ? R : null;
2741
- }
2742
- }
2743
- }).filter((z) => !!z);
2744
- i[A] = Y;
2745
- });
2746
- }
2747
- });
2748
- let D = 1, S = Math.max(...y), P = Math.min(...y);
2749
- const U = l.some((L) => L.isRowColCombine);
2750
- y.length > 0 ? U ? D = i[S].size : D = Array.from(i[S]).reduce((L, N) => {
2751
- let F = i[`${S}-${N}`];
2752
- return L + F.length;
2753
- }, 0) : D = f.length;
2754
- for (let L = 0; L < l.length; L++) {
2755
- const N = l[L];
2756
- if (L === 0) {
2757
- const O = {
2758
- ...o,
2759
- loop: !1
2760
- }, T = Array.from({ length: D }, () => cloneDeep(O));
2761
- v.splice(o.index, 1, ...T);
2762
- }
2763
- let F = p[N.row];
2764
- if (F && Array.isArray(F)) {
2765
- let O = [];
2766
- if (y.includes(L))
2767
- Array.from(i[N.row]).forEach((_, I) => {
2768
- let A = U && L === S ? 1 : B(i, _, S, U, y), $ = i[_][i[_].length - 1], Y = {
2769
- ...N,
2770
- text: $,
2771
- colSpan: A,
2772
- colData: i[_ + "-data"]
2773
- };
2774
- if (O.push(Y), A > 1) {
2775
- let z = {
2776
- ...N,
2777
- text: $,
2778
- type: "",
2779
- colSpan: 0,
2780
- rowSpan: 0
2781
- };
2782
- for (let R = 0; R < A - 1; R++)
2783
- O.push(z);
2784
- }
2785
- }), F.splice(N.col, 1, ...O);
2786
- else {
2787
- if (L > P && L < S) {
2788
- let T = J(y, L);
2789
- if (T !== null) {
2790
- let _ = p[T].slice(o.index, o.index + D);
2791
- _ = _.map((I) => {
2792
- let A = I.colData;
2793
- return Array.isArray(A) && (A = A[0]), {
2794
- ...N,
2795
- colData: A,
2796
- colSpan: I.colSpan,
2797
- rowSpan: I.rowSpan
2798
- };
2799
- }), F.splice(o.index, 1, ..._);
2800
- continue;
2801
- }
2802
- }
2803
- if (N.data) {
2804
- let T = i[S] ? Array.from(i[S]) : [], _ = N.data.replace("col:", "").toUpperCase();
2805
- if (N.isRowColCombine) {
2806
- let I = y.map(($) => l[$].data.replace("col:", "").toUpperCase()), A = [];
2807
- T.forEach(($, Y) => {
2808
- let z = {
2809
- ...N,
2810
- combineKeys: I,
2811
- combineValues: i[$]
2812
- };
2813
- A.push(z);
2814
- }), F.splice(N.col, 1, ...A);
2815
- } else if (T.length)
2816
- T.forEach((I, A) => {
2817
- let $ = i[`${S}-${I}`], Y = [];
2818
- $.forEach((z) => {
2819
- let R = {
2820
- ...N
2821
- };
2822
- delete R.combineKeys, delete R.combineValues, delete R.isRowColCombine, z[_] ? (R.text = z[_], R.colData = z) : R.text = "", Y.push(R);
2823
- }), F.splice(N.col, 1, ...Y);
2824
- });
2825
- else {
2826
- let I = [];
2827
- f.forEach((A) => {
2828
- let $ = {
2829
- ...N
2830
- };
2831
- delete $.combineKeys, delete $.combineValues, delete $.isRowColCombine, A[_] ? ($.text = A[_], $.colData = A) : $.text = "", I.push($);
2832
- }), F.splice(N.col, 1, ...I);
2833
- }
2834
- } else {
2835
- const T = {
2836
- ...N,
2837
- colData: f[0]
2838
- };
2839
- if (N.colSpan === 0 && N.mergeTarget && N.mergeTarget.length === 2 && N.row === N.mergeTarget[0]) {
2840
- let [A, $] = N.mergeTarget, Y = p.reduce((z, R) => z.concat(R), []).filter((z) => z.row === A && z.col === $)[0];
2841
- Y && (Y.colSpan += D - 1);
2842
- } else
2843
- (!Array.isArray(N.mergeTarget) || N.mergeTarget.length !== 2) && (T.colSpan = D);
2844
- const _ = {
2845
- ...N,
2846
- colSpan: 0,
2847
- rowSpan: 0
2848
- };
2849
- let I = Array.from({ length: D - 1 }, () => cloneDeep(_));
2850
- F.splice(N.col, 1, T, ...I);
2851
- }
2852
- }
2853
- }
2854
- }
2855
- });
2856
- }
2857
- function ae(v) {
2858
- if (r.config && n.value) {
2859
- n.value.innerHTML = "", console.time("transformConfig");
2860
- let { rowConfig: b, colConfig: p, config: c } = cloneDeep(r.config), o = w(p, v, "col", c), f = w(b, v, "row", c);
2861
- o && W(p, o, c, v), f && j(b, f, c, v), computeCell(c), console.timeEnd("transformConfig"), console.time("renderReportByDom"), re(b, p, c, n), console.timeEnd("renderReportByDom");
2862
- }
2863
- }
2864
- function Q(v) {
2865
- const b = document.createElement("colgroup");
2866
- let p = 0;
2867
- return v.forEach((c) => {
2868
- const o = document.createElement("col");
2869
- p += c.size, o.style.width = `${c.size}px`, b.appendChild(o);
2870
- }), n.value && (n.value.style.width = `${p}px`), b;
2871
- }
2872
- function q(v, b) {
2873
- const p = document.createElement("td");
2874
- p.setAttribute("data-cell-config", `${b.row}-${b.col}`), p.setAttribute("rowspan", b.rowSpan), p.setAttribute("colspan", b.colSpan);
2875
- let c = "";
2876
- switch (b.type) {
2877
- case "icon":
2878
- p.innerHTML = `<i class="iconfont ${b.data}"></i>`;
2879
- break;
2880
- case "image":
2881
- p.innerHTML = `<img src="${b.data}" alt="">`;
2882
- break;
2883
- default:
2884
- c = b.text !== void 0 && b.text !== null ? b.text : "";
2885
- break;
2886
- }
2887
- return [CellType.TEXT, CellType.FIELD, CellType.ICON, CellType.FUN].includes(b.type) && b.style && p.setAttribute("style", renderCellStyle(b.style)), p.innerText = c, p;
2888
- }
2889
- function re(v, b, p, c) {
2890
- const o = Q(b);
2891
- c.value.appendChild(o);
2892
- let f = 0;
2893
- const l = document.createDocumentFragment();
2894
- for (let y = 0; y < v.length; y++) {
2895
- const i = v[y], D = document.createElement("tr");
2896
- i.isFixed && (D.style.top = `${f - 1}px`, D.classList.add("fixed-row")), f += i.size, D.style.height = `${i.size}px`;
2897
- for (let S = 0; S < b.length; S++) {
2898
- const P = p[y][S];
2899
- if (i && P && i.size > 0) {
2900
- const U = q(i, P);
2901
- U.setAttribute("data-cell-data", `${y}-${S}`), P.rowSpan === 0 || P.colSpan === 0 || D.appendChild(U);
2902
- }
2903
- }
2904
- l.appendChild(D);
2905
- }
2906
- c.value.appendChild(l);
2907
- }
2908
- async function Z() {
2909
- m.value = !0;
2910
- let v = await X(), b = ee(v);
2911
- r.config.data.processData && (b = await getProcessData(r.config.data.processData, b, E.value)), ae(b), m.value = !1;
2912
- }
2913
- function ee(v) {
2914
- let b = {};
2915
- return Array.isArray(v) || (v = [v]), v.map(({ key: p, data: c }) => {
2916
- let o = c.filter((f) => f);
2917
- b[p] = o;
2918
- }), e("updateData", {
2919
- key: r.config.id,
2920
- data: b
2921
- }), b;
2922
- }
2923
- async function X() {
2924
- if (r.config.data.source) {
2925
- let v = {};
2926
- g.value && (v.params = cloneDeep(E.value)), s.value && (v.pageSize = u.pageSize, v.pageNumber = u.pageIndex);
2927
- let b = [];
2928
- for (let p = 0; p < r.config.data.source.length; p++) {
2929
- const { key: c, url: o } = r.config.data.source[p];
2930
- if (o) {
2931
- const f = await getDateSourceData(o, v);
2932
- b.push({ key: c, data: f.data }), s.value && (u.total = f.count || f.data.length);
2933
- }
2934
- }
2935
- return b;
2936
- } else
2937
- return [];
2938
- }
2939
- async function H() {
2940
- if (r.config.data.pagination) {
2941
- if (r.config.data.pageSize !== void 0 && (u.pageSize = isNaN(r.config.data.pageSize) ? 10 : r.config.data.pageSize), r.config.data.pageSizes !== void 0) {
2942
- let v = r.config.data.pageSizes.split(",").map((b) => parseInt(b));
2943
- u.pageSizes = Array.isArray(v) ? v : [10, 20, 50, 100, 200];
2944
- }
2945
- x = !0;
2946
- } else
2947
- x = !0, Z();
2948
- }
2949
- return onMounted(async () => {
2950
- H();
2951
- }), (v, b) => {
2952
- const p = resolveComponent("el-button"), c = resolveComponent("el-pagination"), o = resolveDirective("loading");
2953
- return openBlock(), createElementBlock("div", {
2954
- class: "yh-report-view-container",
2955
- style: normalizeStyle(unref(d))
2956
- }, [
2957
- createVNode(_sfc_main$4, {
2958
- config: r.config.params,
2959
- onChange: C
2960
- }, {
2961
- search: withCtx(() => [
2962
- unref(g) ? (openBlock(), createBlock(p, {
2963
- key: 0,
2964
- type: "primary",
2965
- onClick: k
2966
- }, {
2967
- default: withCtx(() => [
2968
- createTextVNode(" 搜索 ")
2969
- ]),
2970
- _: 1
2971
- })) : createCommentVNode("", !0)
2972
- ]),
2973
- _: 1
2974
- }, 8, ["config"]),
2975
- withDirectives((openBlock(), createElementBlock("div", {
2976
- class: "yh-statement-table-container",
2977
- ref_key: "statementTableRef",
2978
- ref: a
2979
- }, [
2980
- createElementVNode("table", {
2981
- ref_key: "tableBodyRef",
2982
- ref: n
2983
- }, null, 512)
2984
- ])), [
2985
- [o, m.value]
2986
- ]),
2987
- unref(s) ? (openBlock(), createBlock(c, {
2988
- key: 0,
2989
- pageSize: u.pageSize,
2990
- "onUpdate:pageSize": b[0] || (b[0] = (f) => u.pageSize = f),
2991
- "current-page": u.pageIndex,
2992
- "onUpdate:currentPage": b[1] || (b[1] = (f) => u.pageIndex = f),
2993
- "page-sizes": u.pageSizes,
2994
- total: u.total,
2995
- layout: "total, jumper, prev, pager, next, sizes"
2996
- }, null, 8, ["pageSize", "current-page", "page-sizes", "total"])) : createCommentVNode("", !0)
2997
- ], 4);
2998
- };
2999
- }
3000
- }), chartsTypeList = ["line", "rowBar", "bar", "scatter", "treemap", "label"], getChartData = async (t, e) => {
3001
- const {
3002
- data: { source: r },
3003
- seriesData: a,
3004
- xAisData: n,
3005
- yAisData: d,
3006
- type: s
3007
- } = t;
3008
- let g = {
3009
- ...e
3010
- };
3011
- for (let u = 0; u < r.length; u++) {
3012
- const { key: E, url: C } = r[u], x = (await getDateSourceData(C, {})).data;
3013
- g[E] = x;
3014
- }
3015
- if (Object.keys(g).length === 0)
3016
- return !1;
3017
- if (a) {
3018
- const E = new Function("allData", a)(g);
3019
- t.option.series.forEach((C) => {
3020
- C.data = E;
3021
- });
3022
- } else
3023
- t.option = setYAxisData(t, g);
3024
- if (chartsTypeList.includes(s)) {
3025
- if (n) {
3026
- const u = new Function("allData", n);
3027
- t.option.xAxis.data = u(g);
3028
- } else
3029
- t.option = setXAxisData(t, g);
3030
- if (d) {
3031
- const E = new Function("allData", d)(g);
3032
- t.option.yAxis.data = E;
3033
- }
3034
- }
3035
- }, chartItem_vue_vue_type_style_index_0_scoped_5bbf4c7d_lang = "", _export_sfc = (t, e) => {
3036
- const r = t.__vccOpts || t;
3037
- for (const [a, n] of e)
3038
- r[a] = n;
3039
- return r;
3040
- }, _sfc_main$2 = {
3041
- __name: "chart-item",
3042
- props: {
3043
- chartData: {
3044
- type: Object,
3045
- require: !0
3046
- },
3047
- isView: {
3048
- type: Boolean,
3049
- default: !1
3050
- }
3051
- },
3052
- setup(t, { expose: e }) {
3053
- const r = t, a = ref(), n = ref(null);
3054
- let d = null;
3055
- watch(
3056
- () => r.chartData.option,
3057
- (x) => {
3058
- d && d.setOption(x, {
3059
- notMerge: !0
3060
- });
3061
- },
3062
- { deep: !0 }
3063
- ), watch(
3064
- () => r.chartData.isSuspend,
3065
- (x) => {
3066
- x && C();
3067
- },
3068
- { deep: !0 }
3069
- );
3070
- const s = ref(!1), g = (x) => {
3071
- if (n.value = x, x && Object.keys(x).length > 0) {
3072
- const k = cloneDeep(r.chartData);
3073
- u(k);
3074
- }
3075
- }, u = async (x) => {
3076
- r.isView && await getChartData(x, n.value), x.type === "label" && x.option.series.forEach((k) => {
3077
- k.renderItem = renderItem;
3078
- }), d.setOption(x.option), s.value = !1;
3079
- }, E = async () => {
3080
- s.value = !0, d = echarts.init(a.value);
3081
- let x = cloneDeep(r.chartData);
3082
- await u(x);
3083
- }, C = () => {
3084
- nextTick(() => {
3085
- d.resize();
3086
- });
3087
- };
3088
- return e({
3089
- setOutData: g
3090
- }), onMounted(() => {
3091
- E(), window.addEventListener("resize", C);
3092
- }), onUnmounted(() => {
3093
- window.removeEventListener("resize", C);
3094
- }), (x, k) => {
3095
- const m = resolveDirective("loading");
3096
- return withDirectives((openBlock(), createElementBlock("div", {
3097
- ref_key: "chartRef",
3098
- ref: a,
3099
- "element-loading-text": "正在加载数据......",
3100
- class: "chart chart-common"
3101
- }, null, 512)), [
3102
- [m, s.value]
3103
- ]);
3104
- };
3105
- }
3106
- }, chartItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-5bbf4c7d"]]), _sfc_main$1 = /* @__PURE__ */ defineComponent({
3107
- __name: "chart-view-item",
3108
- props: {
3109
- index: null,
3110
- config: null,
3111
- outData: null
3112
- },
3113
- setup(t, { expose: e }) {
3114
- const r = t, a = ref();
3115
- watch(
3116
- () => r.outData,
3117
- (s) => {
3118
- console.log("chart-view-item:", s);
3119
- },
3120
- { deep: !0 }
3121
- );
3122
- const n = computed(() => {
3123
- let s = r.config.widthUnit || "px", g = r.config.heightUnit || "px";
3124
- if (r.config.isSuspend) {
3125
- let u = {
3126
- position: "absolute",
3127
- left: r.config.left + "px",
3128
- top: r.config.top + "px",
3129
- zIndex: 100,
3130
- height: r.config.height + g
3131
- };
3132
- return s === "%" ? u.width = `calc( ${r.config.width}${s} - 10px)` : u.width = `${r.config.width - 10}${s}`, u;
3133
- } else {
3134
- let u = {
3135
- height: r.config.height + g
3136
- };
3137
- return s === "%" ? u.width = `calc( ${r.config.width}${s} - 10px)` : u.width = `${r.config.width - 10}${s}`, u;
3138
- }
3139
- });
3140
- return e({
3141
- setOutData: (s) => {
3142
- var g;
3143
- (g = a.value) == null || g.setOutData(s);
3144
- }
3145
- }), (s, g) => (openBlock(), createElementBlock("div", {
3146
- class: "yh-report-view-container chart-view-item",
3147
- style: normalizeStyle(unref(n))
3148
- }, [
3149
- createVNode(chartItem, {
3150
- "is-view": "",
3151
- ref_key: "chartItemRef",
3152
- ref: a,
3153
- "chart-data": r.config
3154
- }, null, 8, ["chart-data"])
3155
- ], 4));
3156
- }
3157
- }), _hoisted_1 = { class: "yh-statement-table-title" }, _hoisted_2 = { class: "back-top" }, _hoisted_3 = /* @__PURE__ */ createElementVNode("i", { class: "iconfont icon-backtop" }, null, -1), _hoisted_4 = [
3158
- _hoisted_3
3159
- ], _sfc_main = /* @__PURE__ */ defineComponent({
3160
- __name: "report-run",
3161
- props: {
3162
- id: null
3163
- },
3164
- emits: ["updateData"],
3165
- setup(t, { emit: e }) {
3166
- const r = t;
3167
- ref();
3168
- const a = ref(!1), n = ref(!1), d = ref(""), s = ref(), g = ref(), u = ref([]), E = {};
3169
- watch(
3170
- () => r.id,
3171
- (m) => {
3172
- C(m);
3173
- }
3174
- );
3175
- function C(m) {
3176
- m ? (n.value = !1, a.value = !0, getConfig(m).then(async (w) => {
3177
- let { name: M, remoteOptions: B } = w;
3178
- d.value = M, u.value = B;
3179
- }).finally(() => {
3180
- a.value = !1;
3181
- })) : n.value = !0;
3182
- }
3183
- const x = ref(!1);
3184
- function k(m) {
3185
- var w;
3186
- E[m.key] = m.data, (w = g.value) == null || w.forEach((M) => {
3187
- M.setOutData(E);
3188
- });
3189
- }
3190
- return onMounted(() => {
3191
- C(r.id);
3192
- }), (m, w) => {
3193
- const M = resolveDirective("loading");
3194
- return openBlock(), createElementBlock(Fragment, null, [
3195
- createElementVNode("div", _hoisted_1, toDisplayString(d.value), 1),
3196
- n.value ? (openBlock(), createBlock(unref(ElEmpty), {
3197
- key: 1,
3198
- class: "yh-statement-table-viewer-container",
3199
- description: "获取配置时出现错误"
3200
- }, {
3201
- default: withCtx(() => [
3202
- createVNode(unref(ElButton), {
3203
- type: "primary",
3204
- onClick: w[0] || (w[0] = (B) => m.$router.back())
3205
- }, {
3206
- default: withCtx(() => [
3207
- createTextVNode(" 返回 ")
3208
- ]),
3209
- _: 1
3210
- })
3211
- ]),
3212
- _: 1
3213
- })) : withDirectives((openBlock(), createElementBlock("section", {
3214
- key: 0,
3215
- class: "yh-report-viewer-wrapper",
3216
- ref_key: "viewWrapper",
3217
- ref: s
3218
- }, [
3219
- (openBlock(!0), createElementBlock(Fragment, null, renderList(u.value, (B, J) => (openBlock(), createElementBlock(Fragment, null, [
3220
- B.type === "report" ? (openBlock(), createBlock(_sfc_main$3, {
3221
- key: 0,
3222
- index: J,
3223
- config: B,
3224
- onUpdateData: k
3225
- }, null, 8, ["index", "config"])) : (openBlock(), createBlock(_sfc_main$1, {
3226
- key: 1,
3227
- config: B,
3228
- ref_for: !0,
3229
- ref_key: "chartViewItemRef",
3230
- ref: g,
3231
- index: J
3232
- }, null, 8, ["config", "index"]))
3233
- ], 64))), 256)),
3234
- withDirectives(createElementVNode("div", _hoisted_2, _hoisted_4, 512), [
3235
- [vShow, x.value]
3236
- ])
3237
- ])), [
3238
- [M, a.value]
3239
- ])
3240
- ], 64);
3241
- };
3242
- }
3243
- }), reportRun_vue_vue_type_style_index_0_lang = "", index = {
3244
- install(t, e) {
3245
- let { router: r, pinia: a, isAdmin: n = !1 } = e;
3246
- n && (r.addRoute("Index", {
3247
- path: "statement/list",
3248
- name: "报表列表",
3249
- meta: {
3250
- id: "Statement",
3251
- title: "报表列表",
3252
- icon: "iconfont icon-s-grid"
3253
- },
3254
- component: () => import("./StatementList-ba318e74.mjs")
3255
- }), r.addRoute("Index", {
3256
- path: "statement/design/:id",
3257
- name: "报表设计",
3258
- meta: {
3259
- id: "StatementDesign",
3260
- title: "报表设计",
3261
- icon: "iconfont icon-s-grid"
3262
- },
3263
- component: () => import("./StatementDesign-885718f0.mjs")
3264
- }), r.addRoute("Index", {
3265
- path: "statement/detail/:id",
3266
- name: "后台报表查看",
3267
- meta: {
3268
- id: "StatementDetail",
3269
- title: "后台报表查看",
3270
- icon: "iconfont icon-s-grid"
3271
- },
3272
- component: () => import("./StatementDetail-5756056a.mjs")
3273
- })), r.addRoute({
3274
- path: "/statementdetail/:id",
3275
- name: "报表查看",
3276
- meta: {
3277
- id: "StatementDetail",
3278
- title: "报表查看",
3279
- icon: "iconfont icon-s-grid"
3280
- },
3281
- component: () => import("./StatementDetail-5756056a.mjs")
3282
- });
3283
- }
3284
- };
3285
- let dynamicReportIndex = 0;
3286
- function dynamicReportView(t) {
3287
- return dynamicReportIndex++, async () => Promise.resolve(
3288
- defineComponent({
3289
- name: t || `report${dynamicReportIndex}`,
3290
- data() {
3291
- return {
3292
- id: ""
3293
- };
3294
- },
3295
- activated() {
3296
- var e;
3297
- (e = document.querySelector(".main-container")) == null || e.classList.add("statement-design-main");
3298
- },
3299
- deactivated() {
3300
- var e;
3301
- (e = document.querySelector(".main-container")) == null || e.classList.add("statement-design-main");
3302
- },
3303
- render(e) {
3304
- return h("section", { class: "statement-detail-container" }, [h(_sfc_main, { id: this.id })]);
3305
- },
3306
- mounted() {
3307
- this.id = this.$route.fullPath.replace("/innerStatementdetail/", "");
3308
- }
3309
- })
3310
- );
3311
- }
3312
- export {
3313
- CellType as C,
3314
- DataSourceColumnDataType as D,
3315
- FormatType as F,
3316
- ItemTypes as I,
3317
- TypeItems as T,
3318
- _export_sfc as _,
3319
- del as a,
3320
- getConfig as b,
3321
- copyString as c,
3322
- dayjs as d,
3323
- componentTransition as e,
3324
- chartItem as f,
3325
- getList as g,
3326
- chartsTypeList as h,
3327
- getDateSourceColumns as i,
3328
- getDateSourceList as j,
3329
- _sfc_main as k,
3330
- getReportDefaultOption as l,
3331
- index as m,
3332
- dynamicReportView as n,
3333
- parseExpression as p,
3334
- renderCellStyle as r,
3335
- save as s
3336
- };
3337
- //# sourceMappingURL=index-d5e71e5f.mjs.map