@vtx/modals2 2.15.9 → 2.15.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/lib/typings.d.ts +1 -0
  2. package/lib/vm-hooks/useSettings.js +4 -2
  3. package/lib/vm-hooks/useSettings.js.map +1 -1
  4. package/lib/vm-iframe-modal/index.js +20 -9
  5. package/lib/vm-iframe-modal/index.js.map +1 -1
  6. package/lib/vm-info-collection/index.js +3 -1
  7. package/lib/vm-info-collection/index.js.map +1 -1
  8. package/lib/vtx-base-modal/index.js +8 -4
  9. package/lib/vtx-base-modal/index.js.map +1 -1
  10. package/lib/vtx-car-modal/api.js +2 -1
  11. package/lib/vtx-car-modal/api.js.map +1 -1
  12. package/lib/vtx-car-modal/components/BaseInfo/TodayWorkJXH.js +23 -44
  13. package/lib/vtx-car-modal/components/BaseInfo/TodayWorkJXH.js.map +1 -1
  14. package/lib/vtx-car-modal/components/BaseInfo/WorkSummaryJxh.js +4 -3
  15. package/lib/vtx-car-modal/components/BaseInfo/WorkSummaryJxh.js.map +1 -1
  16. package/lib/vtx-car-modal/components/BaseInfo/ZyfxJXH.js +13 -6
  17. package/lib/vtx-car-modal/components/BaseInfo/ZyfxJXH.js.map +1 -1
  18. package/lib/vtx-car-modal/components/BaseInfo/index.js +2 -1
  19. package/lib/vtx-car-modal/components/BaseInfo/index.js.map +1 -1
  20. package/lib/vtx-car-modal/components/WorkInfo/WorkJxh.js +28 -11
  21. package/lib/vtx-car-modal/components/WorkInfo/WorkJxh.js.map +1 -1
  22. package/lib/vtx-car-modal/components/WorkInfo/Zylc.js +123 -0
  23. package/lib/vtx-car-modal/components/WorkInfo/Zylc.js.map +1 -0
  24. package/lib/vtx-device-modal/api.js +525 -140
  25. package/lib/vtx-device-modal/api.js.map +1 -1
  26. package/lib/vtx-device-modal/components/BaseInfo/RealTimeList.js +384 -0
  27. package/lib/vtx-device-modal/components/BaseInfo/RealTimeList.js.map +1 -0
  28. package/lib/vtx-device-modal/components/BaseInfo/index.css +66 -0
  29. package/lib/vtx-device-modal/components/BaseInfo/index.js +91 -36
  30. package/lib/vtx-device-modal/components/BaseInfo/index.js.map +1 -1
  31. package/lib/vtx-device-modal/components/BaseInfo/index.less +45 -0
  32. package/lib/vtx-device-modal/components/DataAnalysis/Chart.js +893 -0
  33. package/lib/vtx-device-modal/components/DataAnalysis/Chart.js.map +1 -0
  34. package/lib/vtx-device-modal/components/DataAnalysis/index.css +70 -0
  35. package/lib/vtx-device-modal/components/DataAnalysis/index.js +121 -58
  36. package/lib/vtx-device-modal/components/DataAnalysis/index.js.map +1 -1
  37. package/lib/vtx-device-modal/components/DataAnalysis/index.less +46 -0
  38. package/lib/vtx-device-modal/config.js +22 -1
  39. package/lib/vtx-device-modal/config.js.map +1 -1
  40. package/lib/vtx-device-modal/index.js +77 -34
  41. package/lib/vtx-device-modal/index.js.map +1 -1
  42. package/lib/vtx-device-modal/style/css.js +1 -0
  43. package/lib/vtx-device-modal/style/css.js.map +1 -1
  44. package/lib/vtx-device-modal/style/index.css +0 -11
  45. package/lib/vtx-device-modal/style/index.js +1 -0
  46. package/lib/vtx-device-modal/style/index.js.map +1 -1
  47. package/lib/vtx-device-modal/style/index.less +0 -6
  48. package/lib/vtx-road-modal/components/BaseInfo/TodayWork.js +17 -3
  49. package/lib/vtx-road-modal/components/BaseInfo/TodayWork.js.map +1 -1
  50. package/lib/vtx-road-modal/components/BaseInfo/TodayWorkTable.js +16 -3
  51. package/lib/vtx-road-modal/components/BaseInfo/TodayWorkTable.js.map +1 -1
  52. package/lib/vtx-road-modal/components/Statistical/Zylc.js +2 -2
  53. package/lib/vtx-road-modal/components/Statistical/Zylc.js.map +1 -1
  54. package/lib/vtx-road-modal/components/Statistical/index.js +1 -1
  55. package/lib/vtx-road-modal/components/Statistical/index.js.map +1 -1
  56. package/lib/vtx-staff-modal/components/BaseInfo/index.css +6 -0
  57. package/lib/vtx-staff-modal/components/BaseInfo/index.js +14 -3
  58. package/lib/vtx-staff-modal/components/BaseInfo/index.js.map +1 -1
  59. package/lib/vtx-staff-modal/components/BaseInfo/index.less +8 -0
  60. package/lib/vtx-staff-modal/components/DetailInfo/index.js +2 -3
  61. package/lib/vtx-staff-modal/components/DetailInfo/index.js.map +1 -1
  62. package/lib/vtx-staff-modal/imgs/yl.png +0 -0
  63. package/lib/vtx-staff-modal/imgs/zhzf.png +0 -0
  64. package/lib/vtx-staff-modal/index.js +6 -2
  65. package/lib/vtx-staff-modal/index.js.map +1 -1
  66. package/lib/vtx-theme-provider/index.js +1 -0
  67. package/lib/vtx-theme-provider/index.js.map +1 -1
  68. package/package.json +2 -1
  69. package/lib/vtx-device-modal/components/FacilityFile/index.js +0 -47
  70. package/lib/vtx-device-modal/components/FacilityFile/index.js.map +0 -1
  71. package/lib/vtx-device-modal/components/LiftInfo/index.js +0 -31
  72. package/lib/vtx-device-modal/components/LiftInfo/index.js.map +0 -1
  73. package/lib/vtx-device-modal/components/OverViewInfo/Left.js +0 -28
  74. package/lib/vtx-device-modal/components/OverViewInfo/Left.js.map +0 -1
  75. package/lib/vtx-device-modal/components/OverViewInfo/index.js +0 -102
  76. package/lib/vtx-device-modal/components/OverViewInfo/index.js.map +0 -1
  77. package/lib/vtx-device-modal/components/VideoInfo/index.js +0 -35
  78. package/lib/vtx-device-modal/components/VideoInfo/index.js.map +0 -1
@@ -0,0 +1,893 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _antd = require("antd");
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _components = require("@vtx/components");
11
+ var _ahooks = require("ahooks");
12
+ var _dayjs = _interopRequireDefault(require("dayjs"));
13
+ var _icons = require("@ant-design/icons");
14
+ var _api = require("../../api");
15
+ var _lodash = _interopRequireWildcard(require("lodash"));
16
+ var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
17
+ var _vmNodata = _interopRequireDefault(require("../../../vm-nodata"));
18
+ var echarts = _interopRequireWildcard(require("echarts"));
19
+ var _config = require("../../config");
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
21
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
23
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
24
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
25
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
26
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
27
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
28
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
29
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
30
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
31
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
32
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
33
+ var VtxRangePicker = _components.VtxDatePicker.VtxRangePicker,
34
+ VtxMonthPicker = _components.VtxDatePicker.VtxMonthPicker,
35
+ VtxYearPicker = _components.VtxDatePicker.VtxYearPicker;
36
+ var Option = _components.VtxSelect.Option;
37
+ var Chart = function Chart(_ref) {
38
+ var deviceIds = _ref.deviceIds,
39
+ monitorItemIds = _ref.monitorItemIds;
40
+ var _useSetState = (0, _ahooks.useSetState)({
41
+ timeType: 'danTime',
42
+ danTimeType: '24h',
43
+ duoTimeType: 'day',
44
+ duoTimeList: [{
45
+ time: (0, _dayjs["default"])().format('YYYY-MM-DD')
46
+ }],
47
+ danTimeStartTime: (0, _dayjs["default"])().format('YYYY-MM-DD'),
48
+ danTimeEndTime: (0, _dayjs["default"])().format('YYYY-MM-DD'),
49
+ month: (0, _dayjs["default"])(),
50
+ year: (0, _dayjs["default"])(),
51
+ collectFrequency: ''
52
+ }),
53
+ _useSetState2 = _slicedToArray(_useSetState, 2),
54
+ state = _useSetState2[0],
55
+ setState = _useSetState2[1];
56
+ var timeType = state.timeType,
57
+ danTimeEndTime = state.danTimeEndTime,
58
+ duoTimeType = state.duoTimeType,
59
+ duoTimeList = state.duoTimeList,
60
+ danTimeType = state.danTimeType,
61
+ danTimeStartTime = state.danTimeStartTime,
62
+ month = state.month,
63
+ year = state.year,
64
+ collectFrequency = state.collectFrequency;
65
+ var handleDuoTimeList = function handleDuoTimeList(index, value) {
66
+ var newDuoTimeList = JSON.parse(JSON.stringify(duoTimeList));
67
+ newDuoTimeList[index].time = value;
68
+ setState({
69
+ duoTimeList: newDuoTimeList
70
+ });
71
+ };
72
+ var _useState = (0, _react.useState)(null),
73
+ _useState2 = _slicedToArray(_useState, 2),
74
+ dates = _useState2[0],
75
+ setDates = _useState2[1];
76
+ (0, _react.useEffect)(function () {
77
+ if ((0, _lodash.isEmpty)(deviceIds) || (0, _lodash.isEmpty)(monitorItemIds)) {
78
+ return;
79
+ }
80
+ setState({
81
+ collectFrequency: ''
82
+ });
83
+ }, [JSON.stringify(deviceIds), JSON.stringify(monitorItemIds)]);
84
+ var _BaseService$useColle = _api.BaseService.useCollectList({
85
+ deviceIds: deviceIds,
86
+ monitorItemIds: monitorItemIds
87
+ }),
88
+ _BaseService$useColle2 = _BaseService$useColle.data,
89
+ collectList = _BaseService$useColle2 === void 0 ? [] : _BaseService$useColle2;
90
+ (0, _react.useEffect)(function () {
91
+ var _a;
92
+ if (!(0, _lodash.isEmpty)(collectList)) {
93
+ setState({
94
+ collectFrequency: (_a = collectList === null || collectList === void 0 ? void 0 : collectList[0]) === null || _a === void 0 ? void 0 : _a.id
95
+ });
96
+ }
97
+ }, [JSON.stringify(collectList)]);
98
+ var _BaseService$useGetAn = _api.BaseService.useGetAnalysis({
99
+ timeType: timeType,
100
+ danTimeEndTime: danTimeEndTime,
101
+ duoTimeType: duoTimeType,
102
+ duoTimeList: duoTimeList,
103
+ danTimeType: danTimeType,
104
+ danTimeStartTime: danTimeStartTime,
105
+ month: month,
106
+ year: year,
107
+ collectFrequency: collectFrequency,
108
+ deviceIds: deviceIds,
109
+ monitorItemIds: monitorItemIds
110
+ }),
111
+ chartDataList = _BaseService$useGetAn.data,
112
+ loading = _BaseService$useGetAn.loading;
113
+ var isHasChartData = function isHasChartData() {
114
+ var isHasData = true;
115
+ if (chartDataList.length) {
116
+ isHasData = true;
117
+ if (timeType === 'danTime') {
118
+ if (chartDataList.some(function (item) {
119
+ return item.values && item.values.length;
120
+ })) {
121
+ isHasData = true;
122
+ } else {
123
+ isHasData = false;
124
+ }
125
+ } else {
126
+ if (chartDataList.some(function (item) {
127
+ return item.list && item.list.length;
128
+ })) {
129
+ isHasData = true;
130
+ } else {
131
+ isHasData = false;
132
+ }
133
+ }
134
+ } else {
135
+ isHasData = false;
136
+ }
137
+ return isHasData;
138
+ };
139
+ var isHasChartItemData = function isHasChartItemData(item) {
140
+ // console.log(item);
141
+ var isHasData = true;
142
+ if (timeType === 'danTime') {
143
+ if (item.values.length) {
144
+ isHasData = true;
145
+ } else {
146
+ isHasData = false;
147
+ }
148
+ } else {
149
+ if (item.length) {
150
+ isHasData = true;
151
+ if (item.some(function (each) {
152
+ return each.values.length;
153
+ })) {
154
+ isHasData = true;
155
+ } else {
156
+ isHasData = false;
157
+ }
158
+ } else {
159
+ isHasData = false;
160
+ }
161
+ }
162
+ return isHasData;
163
+ };
164
+ var newList = isHasChartData() ? chartDataList.filter(function (item) {
165
+ return isHasChartItemData(timeType === 'danTime' ? item : item.list);
166
+ }) : null;
167
+ var getGroupDanOption = function getGroupDanOption(list) {
168
+ var xData = _lodash["default"].uniq(_lodash["default"].flatMap(list, 'xData').sort());
169
+ var offsetList = [];
170
+ list.forEach(function (_unused, index) {
171
+ var maxLength = 0;
172
+ if (index === 0) {
173
+ offsetList.push(0);
174
+ return;
175
+ }
176
+ var item = list[index - 1];
177
+ item.yData.map(function (v) {
178
+ maxLength = Math.max(maxLength, v.length);
179
+ });
180
+ offsetList.push(_lodash["default"].last(offsetList) || 0 + (maxLength * 10 + 20));
181
+ });
182
+ var legendData = [];
183
+ list.forEach(function (item, index) {
184
+ if (item.showMode === 'stack') {
185
+ var _state = _lodash["default"].map(_lodash["default"].uniqBy(item.dataList, 'value'));
186
+ var _colors = ['#73a0fa', '#73deb3'];
187
+ var stateColor = {};
188
+ _state.forEach(function (v, index) {
189
+ stateColor[v.value] = _colors[index % 2];
190
+ });
191
+ legendData.push.apply(legendData, _toConsumableArray((_state || []).map(function (item) {
192
+ return {
193
+ name: item.value,
194
+ itemStyle: {
195
+ color: stateColor[item.value]
196
+ }
197
+ };
198
+ })));
199
+ } else {
200
+ legendData.push({
201
+ name: item.newName || item.name || '',
202
+ itemStyle: {
203
+ color: _config.colors[index % 5].lineColor
204
+ }
205
+ });
206
+ }
207
+ });
208
+ return {
209
+ color: _config.colors.map(function (color) {
210
+ return color.lineColor;
211
+ }),
212
+ grid: {
213
+ top: 70,
214
+ left: 100 + offsetList.length * 10,
215
+ right: 50,
216
+ bottom: 50,
217
+ containLabel: true
218
+ },
219
+ toolbox: {
220
+ show: true,
221
+ feature: {
222
+ saveAsImage: {
223
+ show: true
224
+ }
225
+ }
226
+ },
227
+ legend: {
228
+ type: 'scroll',
229
+ itemWidth: 17,
230
+ itemHeight: 10,
231
+ textStyle: {
232
+ color: '#000000A5'
233
+ },
234
+ top: 35,
235
+ left: 'center'
236
+ },
237
+ tooltip: {
238
+ trigger: 'axis',
239
+ formatter: function formatter(data) {
240
+ var circle = "<span style=\"display:inline-block;margin-right:5px;border-radius:50%;width:10px;height:10px;left:5px;background-color:";
241
+ var result = "";
242
+ data.map(function (v) {
243
+ var info = list.find(function (item) {
244
+ return item.name === v.seriesName;
245
+ }) || {};
246
+ if (v.componentSubType === 'custom') {
247
+ result += "".concat(circle + v.color, "\"></span>").concat(v.name, "\uFF1A").concat(v.value.slice(1).join('~')).concat(info.unit || '', "<br/>");
248
+ } else {
249
+ result += "".concat(circle + _config.colors[v.seriesIndex % 5].lineColor, "\"></span>").concat(v.seriesName, "\uFF1A").concat(v.value).concat(info.unit || '', "<br/>");
250
+ }
251
+ });
252
+ return result;
253
+ }
254
+ },
255
+ xAxis: [{
256
+ type: 'category',
257
+ boundaryGap: false,
258
+ axisLine: {
259
+ show: true,
260
+ lineStyle: {
261
+ color: 'color:"#000000A5"'
262
+ }
263
+ },
264
+ axisLabel: {
265
+ textStyle: {
266
+ color: '#000000A5',
267
+ fontSize: 12
268
+ }
269
+ },
270
+ axisTick: {
271
+ show: false
272
+ },
273
+ data: xData
274
+ }],
275
+ yAxis: list.map(function (item, index) {
276
+ return {
277
+ name: "".concat(item.newName || item.name || '').concat(item.unit ? "(".concat(item.unit, ")") : ''),
278
+ minInterval: 1,
279
+ offset: offsetList[index],
280
+ position: 'left',
281
+ // maxInterval: 5,
282
+ nameTextStyle: {
283
+ color: _config.colors[index % 5].lineColor
284
+ },
285
+ nameLocation: 'middle',
286
+ nameGap: 0,
287
+ splitLine: {
288
+ lineStyle: {
289
+ color: '#E8E8E8',
290
+ type: 'dashed'
291
+ }
292
+ },
293
+ axisLine: {
294
+ show: true,
295
+ color: _config.colors[index % 5].lineColor
296
+ },
297
+ axisLabel: {
298
+ color: _config.colors[index % 5].lineColor,
299
+ margin: 20
300
+ },
301
+ axisTick: {
302
+ show: false
303
+ }
304
+ };
305
+ }),
306
+ series: list.flatMap(function (item, index) {
307
+ if (item.showMode === 'stack') {
308
+ var _state2 = _lodash["default"].map(_lodash["default"].uniqBy(item.dataList, 'value'));
309
+ var _colors2 = ['#73a0fa', '#73deb3'];
310
+ var stateColor = {};
311
+ _state2.forEach(function (v, index) {
312
+ stateColor[v.value] = _colors2[index % 2];
313
+ });
314
+ return [].concat(_toConsumableArray((_state2 || []).map(function (v) {
315
+ return {
316
+ name: v.value,
317
+ type: 'bar',
318
+ data: [],
319
+ yAxisIndex: index,
320
+ markLine: {
321
+ symbol: ['none', 'none'],
322
+ data: (item.markLine || []).filter(function (_unused, i) {
323
+ return i !== 0;
324
+ }).map(function (m, i) {
325
+ return {
326
+ name: (0, _dayjs["default"])(m.data).format('YYYY-MM-DD'),
327
+ xAxis: "(".concat(i + 1, ")").concat((0, _dayjs["default"])(m.data).format('HH:mm')),
328
+ lineStyle: {
329
+ color: '#4159A7'
330
+ },
331
+ label: {
332
+ position: 'end',
333
+ formatter: '{b}'
334
+ }
335
+ };
336
+ })
337
+ }
338
+ };
339
+ })), [{
340
+ type: 'custom',
341
+ yAxisIndex: index,
342
+ renderItem: function renderItem(params, api) {
343
+ var categoryIndex = api.value(0);
344
+ var start = api.coord([api.value(1), categoryIndex]);
345
+ var end = api.coord([api.value(2), categoryIndex]);
346
+ var height = 18;
347
+ return {
348
+ type: 'rect',
349
+ shape: echarts.graphic.clipRectByRect({
350
+ x: start[0],
351
+ y: start[1] - height / 2,
352
+ width: end[0] - start[0],
353
+ height: height
354
+ }, {
355
+ x: params.coordSys.x,
356
+ y: params.coordSys.y,
357
+ width: params.coordSys.width,
358
+ height: params.coordSys.height
359
+ }),
360
+ style: api.style()
361
+ };
362
+ },
363
+ encode: {
364
+ x: [1, 2],
365
+ y: 0
366
+ },
367
+ data: (item.dataList || []).map(function (item, index, arr) {
368
+ var _a;
369
+ return {
370
+ itemStyle: {
371
+ normal: {
372
+ color: stateColor[item.originValue]
373
+ }
374
+ },
375
+ color: stateColor[item.originValue],
376
+ name: item.value,
377
+ label: item.value,
378
+ value: [0, item.date, (_a = arr[index + 1]) === null || _a === void 0 ? void 0 : _a.date]
379
+ };
380
+ })
381
+ }]);
382
+ }
383
+ return [{
384
+ type: item.showMode,
385
+ name: item.newName || item.name || '',
386
+ data: (item.yData || []).map(function (y, i) {
387
+ return {
388
+ value: Number(y).toFixed(2),
389
+ name: item.xData[i]
390
+ };
391
+ }),
392
+ animationEasing: 'linear',
393
+ animationDuration: 2000,
394
+ smooth: true,
395
+ // symbol: 'none',
396
+ symbolSize: 1,
397
+ xAxisIndex: 0,
398
+ yAxisIndex: index,
399
+ itemStyle: {
400
+ normal: {
401
+ lineStyle: {
402
+ color: _config.colors[index % 5].lineColor,
403
+ width: 2
404
+ },
405
+ areaStyle: {
406
+ color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
407
+ offset: 0,
408
+ color: _config.colors[index % 5].areaColor0
409
+ }, {
410
+ offset: 1,
411
+ color: _config.colors[index % 5].areaColor1
412
+ }])
413
+ }
414
+ }
415
+ }
416
+ }];
417
+ })
418
+ };
419
+ };
420
+ var getGroupDuoOption = function getGroupDuoOption(list) {
421
+ var newList = list.map(function (item) {
422
+ var xData = _lodash["default"].uniq(_lodash["default"].flatMap(item.list, 'xData').sort());
423
+ var yData = xData.map(function (x) {
424
+ var _a;
425
+ var values = ((_a = item.list.find(function (i) {
426
+ return i.values.find(function (v) {
427
+ return v.x === x;
428
+ });
429
+ })) === null || _a === void 0 ? void 0 : _a.values) || [];
430
+ var keyByValues = _lodash["default"].keyBy(values, 'x');
431
+ return keyByValues[x].y;
432
+ });
433
+ return Object.assign(Object.assign({}, item.list[0]), {
434
+ yData: yData,
435
+ newName: '',
436
+ xData: xData
437
+ });
438
+ });
439
+ var xData = _lodash["default"].uniq(_lodash["default"].flatMap(newList, 'xData').sort());
440
+ var offsetList = [];
441
+ newList.forEach(function (_unused, index) {
442
+ var maxLength = 0;
443
+ if (index === 0) {
444
+ offsetList.push(0);
445
+ return;
446
+ }
447
+ var item = newList[index - 1];
448
+ item.yData.map(function (v) {
449
+ maxLength = Math.max(maxLength, v.length);
450
+ });
451
+ offsetList.push(_lodash["default"].last(offsetList) || 0 + maxLength * 10);
452
+ });
453
+ return {
454
+ color: _config.colors.map(function (color) {
455
+ return color.lineColor;
456
+ }),
457
+ grid: {
458
+ top: 70,
459
+ left: 100 + offsetList.length * 10,
460
+ right: 50,
461
+ bottom: 50,
462
+ containLabel: true
463
+ },
464
+ toolbox: {
465
+ show: true,
466
+ feature: {
467
+ saveAsImage: {
468
+ show: true
469
+ }
470
+ }
471
+ },
472
+ legend: {
473
+ itemWidth: 17,
474
+ itemHeight: 10,
475
+ textStyle: {
476
+ color: '#000000A5'
477
+ },
478
+ top: 35,
479
+ left: 'center'
480
+ },
481
+ tooltip: {
482
+ trigger: 'axis',
483
+ formatter: function formatter(data) {
484
+ var circle = "<span style=\"display:inline-block;margin-right:5px;border-radius:50%;width:10px;height:10px;left:5px;background-color:";
485
+ var result = "".concat(data[0].name, "<br/>");
486
+ data.map(function (v) {
487
+ var info = newList.find(function (item) {
488
+ return item.name === v.seriesName;
489
+ }) || {};
490
+ result += "".concat(circle + _config.colors[v.seriesIndex % 5].lineColor, "\"></span>").concat(v.seriesName, "\uFF1A").concat(v.value).concat(info.unit || '', "<br/>");
491
+ });
492
+ return result;
493
+ }
494
+ },
495
+ xAxis: [{
496
+ type: 'category',
497
+ boundaryGap: false,
498
+ axisLine: {
499
+ show: true,
500
+ lineStyle: {
501
+ color: 'color:"#000000A5"'
502
+ }
503
+ },
504
+ axisLabel: {
505
+ textStyle: {
506
+ color: '#000000A5',
507
+ fontSize: 12
508
+ }
509
+ },
510
+ axisTick: {
511
+ show: false
512
+ },
513
+ data: xData
514
+ }],
515
+ yAxis: newList.map(function (item, index) {
516
+ return {
517
+ name: "".concat(item.newName || item.name || '').concat(item.unit ? "(".concat(item.unit, ")") : ''),
518
+ minInterval: 1,
519
+ offset: offsetList[index],
520
+ position: 'left',
521
+ // maxInterval: 5,
522
+ nameTextStyle: {
523
+ color: _config.colors[index % 5].lineColor
524
+ },
525
+ nameLocation: 'middle',
526
+ nameGap: 0,
527
+ splitLine: {
528
+ lineStyle: {
529
+ color: '#E8E8E8',
530
+ type: 'dashed'
531
+ }
532
+ },
533
+ axisLine: {
534
+ show: true,
535
+ color: _config.colors[index % 5].lineColor
536
+ },
537
+ axisLabel: {
538
+ color: _config.colors[index % 5].lineColor,
539
+ margin: 20
540
+ },
541
+ axisTick: {
542
+ show: false
543
+ }
544
+ };
545
+ }),
546
+ series: newList.flatMap(function (item, index) {
547
+ if (item.showMode === 'stack') {
548
+ var _state3 = _lodash["default"].map(_lodash["default"].uniqBy(item.dataList, 'value'));
549
+ return [].concat(_toConsumableArray((_state3 || []).map(function (v) {
550
+ return {
551
+ name: v.value,
552
+ type: 'bar',
553
+ data: [],
554
+ yAxisIndex: index,
555
+ markLine: {
556
+ symbol: ['none', 'none'],
557
+ data: (item.markLine || []).filter(function (_unused, i) {
558
+ return i !== 0;
559
+ }).map(function (m, i) {
560
+ return {
561
+ name: (0, _dayjs["default"])(m.data).format('YYYY-MM-DD'),
562
+ xAxis: "(".concat(i + 1, ")").concat((0, _dayjs["default"])(m.data).format('HH:mm')),
563
+ lineStyle: {
564
+ color: '#4159A7'
565
+ },
566
+ label: {
567
+ position: 'end',
568
+ formatter: '{b}'
569
+ }
570
+ };
571
+ })
572
+ }
573
+ };
574
+ })), [{
575
+ type: 'custom',
576
+ yAxisIndex: index,
577
+ renderItem: function renderItem(params, api) {
578
+ var categoryIndex = api.value(0);
579
+ var start = api.coord([api.value(1), categoryIndex]);
580
+ var end = api.coord([api.value(2), categoryIndex]);
581
+ var height = 18;
582
+ return {
583
+ type: 'rect',
584
+ shape: echarts.graphic.clipRectByRect({
585
+ x: start[0],
586
+ y: start[1] - height / 2,
587
+ width: end[0] - start[0],
588
+ height: height
589
+ }, {
590
+ x: params.coordSys.x,
591
+ y: params.coordSys.y,
592
+ width: params.coordSys.width,
593
+ height: params.coordSys.height
594
+ }),
595
+ style: api.style()
596
+ };
597
+ },
598
+ encode: {
599
+ x: [1, 2],
600
+ y: 0
601
+ },
602
+ data: (item.dataList || []).map(function (item, index, arr) {
603
+ var _a;
604
+ return {
605
+ itemStyle: {
606
+ normal: {
607
+ color: _config.colors[item.originValue]
608
+ }
609
+ },
610
+ color: _config.colors[item.originValue],
611
+ name: item.value,
612
+ label: item.value,
613
+ value: [0, item.date, (_a = arr[index + 1]) === null || _a === void 0 ? void 0 : _a.date]
614
+ };
615
+ })
616
+ }]);
617
+ }
618
+ return [{
619
+ type: 'line',
620
+ name: item.newName || item.name || '',
621
+ data: (item.yData || []).map(function (y, i) {
622
+ return {
623
+ value: Number(y).toFixed(2),
624
+ name: item.xData[i]
625
+ };
626
+ }),
627
+ animationEasing: 'linear',
628
+ animationDuration: 2000,
629
+ smooth: true,
630
+ // symbol: 'none',
631
+ symbolSize: 5,
632
+ xAxisIndex: 0,
633
+ yAxisIndex: index,
634
+ itemStyle: {
635
+ normal: {
636
+ lineStyle: {
637
+ color: _config.colors[index % 5].lineColor,
638
+ width: 2
639
+ },
640
+ areaStyle: {
641
+ color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
642
+ offset: 0,
643
+ color: _config.colors[index % 5].areaColor0
644
+ }, {
645
+ offset: 1,
646
+ color: _config.colors[index % 5].areaColor1
647
+ }])
648
+ }
649
+ }
650
+ }
651
+ }];
652
+ })
653
+ };
654
+ };
655
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_antd.Space, null, /*#__PURE__*/_react["default"].createElement("span", null, "\u65F6\u95F4\uFF1A"), /*#__PURE__*/_react["default"].createElement(_components.VtxSelect, {
656
+ allowClear: false,
657
+ style: {
658
+ width: 100
659
+ },
660
+ value: timeType,
661
+ onChange: function onChange(e) {
662
+ setState({
663
+ timeType: e
664
+ });
665
+ }
666
+ }, /*#__PURE__*/_react["default"].createElement(Option, {
667
+ value: 'danTime'
668
+ }, "\u5355\u65F6\u6BB5"), /*#__PURE__*/_react["default"].createElement(Option, {
669
+ value: 'duoTime'
670
+ }, "\u591A\u65F6\u6BB5")), timeType === 'danTime' ? (/*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_antd.Radio.Group, {
671
+ optionType: "button",
672
+ value: danTimeType,
673
+ onChange: function onChange(_ref2) {
674
+ var value = _ref2.target.value;
675
+ setState({
676
+ danTimeType: value
677
+ });
678
+ }
679
+ }, [
680
+ // { label: '近1小时', value: '1h' },
681
+ {
682
+ label: '24小时',
683
+ value: '24h'
684
+ }, {
685
+ label: '3天',
686
+ value: '3days'
687
+ }, {
688
+ label: '7天',
689
+ value: '7days'
690
+ }].concat(_toConsumableArray(collectFrequency === 'day' ? [{
691
+ label: '月',
692
+ value: 'month'
693
+ }] : []), _toConsumableArray(collectFrequency === 'month' ? [{
694
+ label: '年',
695
+ value: 'year'
696
+ }] : []), [{
697
+ label: '自定义',
698
+ value: 'self'
699
+ }]).map(function (item) {
700
+ return item.value === 'self' ? (/*#__PURE__*/_react["default"].createElement(_antd.Popover, {
701
+ content: /*#__PURE__*/_react["default"].createElement(VtxRangePicker, {
702
+ allowClear: false,
703
+ style: {
704
+ marginLeft: 10
705
+ },
706
+ value: dates || [danTimeStartTime, danTimeEndTime],
707
+ onChange: function onChange(_unused, dateStr) {
708
+ setState({
709
+ danTimeStartTime: dateStr[0],
710
+ danTimeEndTime: dateStr[1]
711
+ });
712
+ },
713
+ onCalendarChange: function onCalendarChange(val) {
714
+ setDates(val);
715
+ },
716
+ onOpenChange: function onOpenChange(open) {
717
+ if (open) {
718
+ setDates([]);
719
+ } else {
720
+ setDates(null);
721
+ }
722
+ },
723
+ disabledDate: function disabledDate(current) {
724
+ var day = collectFrequency === 'day' ? 31 : 7;
725
+ if (!dates) {
726
+ return false;
727
+ }
728
+ var tooLate = dates[0] && current.diff(dates[0], 'days') > day;
729
+ var tooEarly = dates[1] && dates[1].diff(current, 'days') > day;
730
+ return !!tooEarly || !!tooLate;
731
+ }
732
+ }),
733
+ trigger: "click"
734
+ }, /*#__PURE__*/_react["default"].createElement(_antd.Radio.Button, {
735
+ value: item.value
736
+ }, item.label))) : item.value === 'month' ? (/*#__PURE__*/_react["default"].createElement(_antd.Popover, {
737
+ content: /*#__PURE__*/_react["default"].createElement(VtxMonthPicker, {
738
+ allowClear: false,
739
+ style: {
740
+ marginLeft: 10
741
+ },
742
+ value: month,
743
+ onChange: function onChange(date) {
744
+ setState({
745
+ month: date
746
+ });
747
+ }
748
+ }),
749
+ trigger: "click"
750
+ }, /*#__PURE__*/_react["default"].createElement(_antd.Radio.Button, {
751
+ value: item.value
752
+ }, item.label))) : item.value === 'year' ? (/*#__PURE__*/_react["default"].createElement(_antd.Popover, {
753
+ content: /*#__PURE__*/_react["default"].createElement(VtxYearPicker, {
754
+ allowClear: false,
755
+ style: {
756
+ marginLeft: 10
757
+ },
758
+ value: year,
759
+ onChange: function onChange(date) {
760
+ setState({
761
+ year: date
762
+ });
763
+ },
764
+ disabledDate: function disabledDate(current) {
765
+ return current && current >= (0, _dayjs["default"])().startOf('day');
766
+ }
767
+ }),
768
+ trigger: "click"
769
+ }, /*#__PURE__*/_react["default"].createElement(_antd.Radio.Button, {
770
+ value: item.value
771
+ }, item.label))) : (/*#__PURE__*/_react["default"].createElement(_antd.Radio.Button, {
772
+ value: item.value
773
+ }, item.label));
774
+ })), /*#__PURE__*/_react["default"].createElement(_antd.Tooltip, {
775
+ title: collectFrequency === 'day' ? '自定义时间仅支持查30天' : '自定义时间仅支持查七天'
776
+ }, /*#__PURE__*/_react["default"].createElement(_icons.QuestionCircleOutlined, {
777
+ style: {
778
+ marginLeft: 8,
779
+ fontSize: 16
780
+ }
781
+ })))) : (/*#__PURE__*/_react["default"].createElement("div", {
782
+ style: {
783
+ marginLeft: 10
784
+ }
785
+ }, /*#__PURE__*/_react["default"].createElement(_antd.Radio.Group, {
786
+ options: collectFrequency === 'realtime' ? [{
787
+ label: '日',
788
+ value: 'day'
789
+ }] : [{
790
+ label: '日',
791
+ value: 'day'
792
+ }, {
793
+ label: '月',
794
+ value: 'month'
795
+ }],
796
+ optionType: "button",
797
+ value: duoTimeType,
798
+ onChange: function onChange(_ref3) {
799
+ var value = _ref3.target.value;
800
+ setState({
801
+ duoTimeType: value
802
+ });
803
+ }
804
+ }), duoTimeList.length === 5 ? null : (/*#__PURE__*/_react["default"].createElement(_antd.Button, {
805
+ type: "primary",
806
+ icon: /*#__PURE__*/_react["default"].createElement(_icons.PlusOutlined, null),
807
+ style: {
808
+ marginLeft: 20
809
+ },
810
+ onClick: function onClick() {
811
+ var _a;
812
+ var lastDate = (_a = duoTimeList[(duoTimeList === null || duoTimeList === void 0 ? void 0 : duoTimeList.length) - 1]) === null || _a === void 0 ? void 0 : _a.time;
813
+ var newDate = (0, _dayjs["default"])(lastDate).subtract(1, duoTimeType === 'day' ? 'days' : 'months').format(duoTimeType === 'day' ? 'YYYY-MM-DD' : 'YYYY-MM');
814
+ setState({
815
+ duoTimeList: [].concat(_toConsumableArray(duoTimeList), [{
816
+ time: newDate
817
+ }])
818
+ });
819
+ }
820
+ }, "\u65B0\u589E")))), /*#__PURE__*/_react["default"].createElement("span", null, "\u91C7\u96C6\u5468\u671F\uFF1A"), /*#__PURE__*/_react["default"].createElement(_components.VtxSelect, {
821
+ allowClear: false,
822
+ style: {
823
+ width: 200
824
+ },
825
+ onChange: function onChange(e) {
826
+ return setState({
827
+ collectFrequency: e
828
+ });
829
+ },
830
+ value: collectFrequency
831
+ }, collectList.map(function (item) {
832
+ return /*#__PURE__*/_react["default"].createElement(Option, {
833
+ key: item.id
834
+ }, item.name);
835
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
836
+ style: {
837
+ marginTop: 8
838
+ }
839
+ }, timeType === 'duoTime' && duoTimeList.map(function (item, index) {
840
+ return /*#__PURE__*/_react["default"].createElement("span", {
841
+ style: {
842
+ marginLeft: 20,
843
+ position: 'relative'
844
+ },
845
+ key: index
846
+ }, duoTimeType === 'day' ? (/*#__PURE__*/_react["default"].createElement(_components.VtxDatePicker, {
847
+ allowClear: false,
848
+ value: item.time,
849
+ onChange: function onChange(_unused, dateStr) {
850
+ handleDuoTimeList(index, dateStr);
851
+ }
852
+ })) : (/*#__PURE__*/_react["default"].createElement(VtxMonthPicker, {
853
+ allowClear: false,
854
+ value: item.time,
855
+ onChange: function onChange(_, dateStr) {
856
+ handleDuoTimeList(index, dateStr);
857
+ }
858
+ })), index === 0 ? null : (/*#__PURE__*/_react["default"].createElement(_icons.CloseCircleOutlined, {
859
+ style: {
860
+ color: '#bbb8b8',
861
+ position: 'absolute',
862
+ top: -7,
863
+ right: -15,
864
+ cursor: 'pointer'
865
+ },
866
+ onClick: function onClick() {
867
+ setState({
868
+ duoTimeList: duoTimeList.filter(function (_unused, timeIndex) {
869
+ return timeIndex !== index;
870
+ })
871
+ });
872
+ }
873
+ })));
874
+ })), /*#__PURE__*/_react["default"].createElement("div", {
875
+ className: "vtx-device-modal-analysis-content--chart"
876
+ }, loading ? (/*#__PURE__*/_react["default"].createElement(_antd.Spin, {
877
+ spinning: true
878
+ })) : (0, _lodash.isEmpty)(newList) ? (/*#__PURE__*/_react["default"].createElement(_vmNodata["default"], {
879
+ style: {
880
+ height: 300
881
+ }
882
+ })) : (/*#__PURE__*/_react["default"].createElement(_echartsForReact["default"], {
883
+ option: timeType === 'danTime' ? getGroupDanOption(newList) : getGroupDuoOption(newList),
884
+ notMerge: true,
885
+ lazyUpdate: true,
886
+ style: {
887
+ height: '100%',
888
+ width: '100%'
889
+ }
890
+ }))));
891
+ };
892
+ var _default = exports["default"] = Chart;
893
+ //# sourceMappingURL=Chart.js.map