@ganwei-web/gw-base-components-plus 1.0.0

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 (59) hide show
  1. package/echartList/barEchart/dist/index.es.js +152 -0
  2. package/echartList/barEchart/dist/index.umd.js +1 -0
  3. package/echartList/barEchart/dist/style.css +1 -0
  4. package/echartList/curve/dist/index.es.js +217 -0
  5. package/echartList/curve/dist/index.umd.js +1 -0
  6. package/echartList/curve/dist/style.css +1 -0
  7. package/echartList/historyEchart/dist/index.es.js +292 -0
  8. package/echartList/historyEchart/dist/index.umd.js +10 -0
  9. package/echartList/historyEchart/dist/style.css +1 -0
  10. package/echartList/solid-bar/dist/index.es.js +290 -0
  11. package/echartList/solid-bar/dist/index.umd.js +1 -0
  12. package/echartList/solid-bar/dist/style.css +1 -0
  13. package/echartList/solid-circle/dist/index.es.js +332 -0
  14. package/echartList/solid-circle/dist/index.umd.js +6 -0
  15. package/echartList/solid-circle/dist/style.css +1 -0
  16. package/echartList/solid-pie/dist/index.es.js +336 -0
  17. package/echartList/solid-pie/dist/index.umd.js +6 -0
  18. package/echartList/solid-pie/dist/style.css +1 -0
  19. package/element-plus-adapter/dist/ElementPlusAdapter.cjs +902 -0
  20. package/element-plus-adapter/dist/ElementPlusAdapter.cjs.map +1 -0
  21. package/element-plus-adapter/dist/ElementPlusAdapter.css +789 -0
  22. package/element-plus-adapter/dist/ElementPlusAdapter.iife.js +903 -0
  23. package/element-plus-adapter/dist/ElementPlusAdapter.iife.js.map +1 -0
  24. package/element-plus-adapter/dist/ElementPlusAdapter.js +902 -0
  25. package/element-plus-adapter/dist/ElementPlusAdapter.js.map +1 -0
  26. package/equip-list-vue2/dist/index.es.js +1275 -0
  27. package/equip-list-vue2/dist/index.umd.js +1 -0
  28. package/equip-list-vue2/dist/style.css +1 -0
  29. package/equip-list-vue3/dist/index.es.js +1510 -0
  30. package/equip-list-vue3/dist/index.umd.js +1 -0
  31. package/equip-list-vue3/dist/style.css +1 -0
  32. package/equip-select-vue2/dist/index.es.js +231 -0
  33. package/equip-select-vue2/dist/index.umd.js +1 -0
  34. package/equip-select-vue2/dist/style.css +1 -0
  35. package/equip-select-vue3/dist/index.es.js +231 -0
  36. package/equip-select-vue3/dist/index.umd.js +1 -0
  37. package/equip-select-vue3/dist/style.css +1 -0
  38. package/equipProcessing/dist/index.es.js +203 -0
  39. package/equipProcessing/dist/index.umd.js +1 -0
  40. package/loadMore/dist/index.es.js +12 -0
  41. package/loadMore/dist/index.umd.js +1 -0
  42. package/loading/dist/index.es.js +25 -0
  43. package/loading/dist/index.umd.js +1 -0
  44. package/loading/dist/style.css +1 -0
  45. package/package.json +11 -0
  46. package/player/dist/index.es.js +1080 -0
  47. package/player/dist/index.umd.js +14 -0
  48. package/player/dist/style.css +1 -0
  49. package/selectV2/dist/index.es.js +190 -0
  50. package/selectV2/dist/index.umd.js +1 -0
  51. package/selectV2/dist/style.css +1 -0
  52. package/showPassword/dist/index.es.js +72 -0
  53. package/showPassword/dist/index.umd.js +1 -0
  54. package/table/dist/index.es.js +182 -0
  55. package/table/dist/index.umd.js +1 -0
  56. package/table/dist/style.css +1 -0
  57. package/widthSetting/dist/index.es.js +113 -0
  58. package/widthSetting/dist/index.umd.js +1 -0
  59. package/widthSetting/dist/style.css +1 -0
@@ -0,0 +1,1510 @@
1
+ import { createBlock as S, createCommentVNode as f, createElementBlock as l, createElementVNode as C, createTextVNode as k, createVNode as q, mergeProps as x, normalizeClass as G, normalizeStyle as O, openBlock as n, resolveComponent as g, toDisplayString as b, toHandlers as T, withCtx as w, withModifiers as M } from "vue";
2
+ import I from "vue3-virtual-scroll-list";
3
+ import * as y from "@aspnet/signalr";
4
+
5
+ import "./style.css";
6
+ class _ {
7
+ // 分组节点扁平化对象、设备扁平化对象、window缓存设备扁平化对象
8
+ constructor(e, t, i) {
9
+ this.groupNodeObject = e, this.nodesMap = t, this.controlObject = i;
10
+ }
11
+ // 增加映射
12
+ addNodesMap(e) {
13
+ e && e.forEach((t) => {
14
+ this.nodesMap[t.key] = t;
15
+ });
16
+ }
17
+ // 移除映射
18
+ removeNodesMap(e) {
19
+ e && e.forEach((t) => {
20
+ delete this.nodesMap[t.key];
21
+ });
22
+ }
23
+ // 回收所有分组节点缓存
24
+ recycleAllNodeCache(e) {
25
+ for (let t in this.groupNodeObject) { this.groupNodeObject[t].expand = !1, this.groupNodeObject[t].count = 0, this.recycleGroupCache(this.groupNodeObject[t].key), e && delete this.groupNodeObject[t]; }
26
+ }
27
+ // 回收分组节点内存
28
+ recycleGroupCache(e) {
29
+ if (this.groupNodeObject[e]) {
30
+ this.groupNodeObject[e].children = [], this.removeNodesMap(this.groupNodeObject[e].equips), this.groupNodeObject[e].equips = [], this.groupNodeObject[e].equips.length = 0, this.groupNodeObject[e].expand = !1;
31
+ for (let t in this.groupNodeObject) { this.groupNodeObject[t].groupId == e && this.recycleGroupCache(this.groupNodeObject[t].key); }
32
+ }
33
+ }
34
+ // 关闭兄弟分组节点及回收内存
35
+ closeBrotherNode(e) {
36
+ if (e && this.groupNodeObject[e]) {
37
+ let t = this.groupNodeObject[e].groupId;
38
+ for (let i in this.groupNodeObject) { this.groupNodeObject[i].groupId == t && this.groupNodeObject[i].key != e && this.groupNodeObject[i].expand && (this.groupNodeObject[i].expand = !1, this.recycleGroupCache(this.groupNodeObject[i].key)); }
39
+ }
40
+ }
41
+ }
42
+ class N {
43
+ constructor() {
44
+ this.window = window;
45
+ try {
46
+ window.top.equipGroup, this.window = window.top;
47
+ } catch {
48
+ this.window = window;
49
+ }
50
+ }
51
+ }
52
+ const m = {
53
+ data() {
54
+ return {
55
+ window: null
56
+ };
57
+ },
58
+ created() {
59
+ this.window = window;
60
+ try {
61
+ window.top.equipGroup, this.window = window.top;
62
+ } catch {
63
+ this.window = window;
64
+ }
65
+ }
66
+ };
67
+ class L extends N {
68
+ constructor(e, t, i, o, u, a) {
69
+ super(), this.equipControllObject = i, this.groupNodeObject = e, this.nodesMap = t, this.controlObject = o, this.equipCheckObject = u, this.isSearchStatus = !1, this.searchStatusGroupObject = {}, this.aliasName = a;
70
+ }
71
+ resetCheckedStatus() {
72
+ Object.values(this.nodesMap).forEach((e) => {
73
+ this.setCheckStatus(e.key, !1, !1), e.isGroup && !e.isEquip && (this.clearCheckedEquips(e.key), this.updateEquipSelectCount(e.key, !0)), e.halfCheckedEquips && (e.halfCheckedEquips = []);
74
+ }), Object.keys(this.equipCheckObject).forEach((e) => {
75
+ this.setEquipCheckObject(e, !1, !1, this.equipCheckObject[e].groupId);
76
+ });
77
+ }
78
+ // 搜索状态下,更新分组选中状态
79
+ /**
80
+ * 1:备份原有选中的设备数据量,父级分组Id
81
+ * 2:清空之前分组的设备选中数量
82
+ * 3:依照搜索结果,重新计算分组选中的设备数据量
83
+ * */
84
+ reComputedCheckNum(e) {
85
+ this.isSearchStatus = e, this.isSearchStatus ? (Object.values(this.groupNodeObject).forEach((t) => {
86
+ this.searchStatusGroupObject[t.key] = {
87
+ groupId: t.groupId,
88
+ equipSelectCount: t.equipSelectCount,
89
+ halfCheckedEquips: t.halfCheckedEquips,
90
+ ...this.searchStatusGroupObject[t.key]
91
+ };
92
+ }), Object.values(this.groupNodeObject).forEach((t) => {
93
+ this.updateEquipSelectCount(t.key, !0), t.halfCheckedEquips = [];
94
+ }), Object.values(this.groupNodeObject).forEach((t) => {
95
+ (this.window[`group-${t.key}-search`] || []).forEach((o) => {
96
+ this.equipCheckObject[o.equipNo] && this.equipCheckObject[o.equipNo].checked ? this.updateEquipSelectCount(t.key, !1, 1) : this.equipCheckObject[o.equipNo] && this.equipCheckObject[o.equipNo].indeterminate && t.halfCheckedEquips.push(o.equipNo);
97
+ });
98
+ })) : (Object.values(this.groupNodeObject).forEach((t) => {
99
+ let i = this.searchStatusGroupObject[t.key];
100
+ i && (t.equipSelectCount = i.equipSelectCount, t.halfCheckedEquips = [...i.halfCheckedEquips, ...t.halfCheckedEquips], t.halfCheckedEquips = [...new Set(t.halfCheckedEquips)]);
101
+ }), this.searchStatusGroupObject = {});
102
+ }
103
+ // 根据传过来的设备选中数据、回显选中状态
104
+ /**
105
+ * 1:记录进全局设备选中状态
106
+ * 2:设备设备选中状态
107
+ * 3:更新分组选中的设备数量
108
+ * 4:更新展开的设备控制项选中状态
109
+ * 5:更新分组选中状态
110
+ * */
111
+ updateCheckedStatusWithEquips(e) {
112
+ window.setTimeout(() => {
113
+ for (let t = 0, i = e.length; t < i; t++) {
114
+ let o = this.window.equipCache && this.window.equipCache[e[t]];
115
+ o && o.groupId && (this.setEquipCheckObject(e[t], !0, !1, o.groupId), this.setCheckStatus(`${o.groupId}-${e[t]}`, !0, !1), this.updateEquipSelectCount(o.groupId, !1, 1), this.updateExpandControlCheckStatus(o.groupId, e[t]));
116
+ }
117
+ this.updateGroupCheckStatus();
118
+ }, 200);
119
+ }
120
+ // 更新展开的设备控制项选中状态
121
+ updateExpandControlCheckStatus(e, t) {
122
+ let i = this.nodesMap[`${e}-${t}`];
123
+ i && i.settings && i.settings.length && i.settings.forEach((o) => {
124
+ this.nodesMap[`${e}-${t}-${o.setNo}`] && this.setCheckStatus(`${e}-${t}-${o.setNo}`, !0, !1);
125
+ });
126
+ }
127
+ // 根据传过来的设备控制项,回显设备分组选中状态
128
+ /**
129
+ * 1:记录全局设备控制项选中
130
+ * 2:设置设备和设备控制项选中状态
131
+ * 3:记录分组的半选设备
132
+ * 4:记录全局设备半选状态
133
+ * 5:更新分组选中状态
134
+ * */
135
+ updateCheckedStatusWithControls(e) {
136
+ window.setTimeout(() => {
137
+ for (let t = 0, i = e.length; t < i; t++) {
138
+ let o = e[t].split("."), u = o[0], a = o[1];
139
+ if (this.equipControllObject[u] || (this.equipControllObject[u] = []), this.equipControllObject[u].push(Number(a)), this.window.equipCache && this.window.equipCache[u]) {
140
+ let r = this.window.equipCache[u].groupId, h = `${r}-${u}-${a}`;
141
+ this.nodesMap[h] && this.setCheckStatus(h, !0, !1), this.nodesMap[`${r}-${u}`] && this.setCheckStatus(`${r}-${u}`, !1, !0), this.nodesMap[`${r}`].halfCheckedEquips && this.nodesMap[`${r}`].halfCheckedEquips.push(u), this.setEquipCheckObject(u, !1, !0, r);
142
+ }
143
+ }
144
+ this.updateGroupCheckStatus();
145
+ }, 100);
146
+ }
147
+ // 更新分组选中状态
148
+ updateGroupCheckStatus() {
149
+ Object.values(this.groupNodeObject).forEach((e) => {
150
+ e.count > 0 && e.count == e.equipSelectCount ? this.setCheckStatus(e.key, !0, !1) : e.count && e.equipSelectCount && e.count > e.equipSelectCount || e.halfCheckedEquips.length ? this.setGroupHalfChecked(e.key) : this.setCheckStatus(e.key, !1, !1);
151
+ });
152
+ }
153
+ // 设置父级分组半选状态
154
+ setGroupHalfChecked(e) {
155
+ this.nodesMap[e] && this.setCheckStatus(e, !1, !0), this.nodesMap[e].groupId && this.setGroupHalfChecked(this.nodesMap[e].groupId);
156
+ }
157
+ // 设置设备控制项状态
158
+ setControlStatus(e, t, i, o) {
159
+ e && e.forEach((u) => {
160
+ this.nodesMap[`${t}-${i}-${u.setNo}`] && this.setCheckStatus(`${t}-${i}-${u.setNo}`, o, !1);
161
+ });
162
+ }
163
+ // 更新设备控制项选中状态
164
+ updateControlCheckStatus() {
165
+ Object.keys(this.controlObject).forEach((e) => {
166
+ let t = this.nodesMap[`${this.controlObject[e].groupId}-${e}`];
167
+ if (t) {
168
+ if (t.checked) {
169
+ let i = t.settings;
170
+ this.setControlStatus(i, this.controlObject[e].groupId, e, !0);
171
+ } else if (!t.checked && !t.indeterminate) {
172
+ let i = t.settings;
173
+ this.setControlStatus(i, this.controlObject[e].groupId, e, !1);
174
+ } else {
175
+ this.equipControllObject[e] && this.equipControllObject[e].forEach((i) => {
176
+ let o = `${this.controlObject[e].groupId}-${e}-${i}`;
177
+ this.nodesMap[o] && this.setCheckStatus(o, !0, !1);
178
+ });
179
+ }
180
+ }
181
+ });
182
+ }
183
+ // 获取选中的分组
184
+ getGroupChecked() {
185
+ let e = [];
186
+ return Object.keys(this.groupNodeObject).forEach((t) => {
187
+ this.groupNodeObject[t].checked && e.push(t);
188
+ }), e;
189
+ }
190
+ // 获取选中设备
191
+ getEquipSelectd() {
192
+ let e = [];
193
+ return Object.keys(this.equipCheckObject).forEach((t) => {
194
+ this.equipCheckObject[t].checked && e.push(Number(t));
195
+ }), e;
196
+ }
197
+ // 获取选中的设备控制箱
198
+ getControlSelected() {
199
+ let e = [];
200
+ return Object.keys(this.equipControllObject).forEach((t) => {
201
+ e.push(...this.equipControllObject[t].map((i) => `${t}.${i}`));
202
+ }), e;
203
+ }
204
+ // 点击选中
205
+ /**
206
+ * 1:如果是分组选择,触发分组选中事件
207
+ * 2:如果是设备选择,触发设备选中事件
208
+ * 3:如果是设备控制项选择,触发设备控制项选中事件
209
+ * */
210
+ onChecked(e, t) {
211
+ this.isSearchStatus = t || !1, e.isGroup && !e.isEquip ? this.selectGroup(e) : e.isEquip ? this.selectEquip(e) : e.isSetting && this.selectControl(e);
212
+ }
213
+ // 从全局映射中,设置节点选中状态
214
+ setCheckStatus(e, t, i) {
215
+ this.nodesMap[e] && (this.nodesMap[e].checked = t, this.nodesMap[e].isGroup && (this.nodesMap[e].indeterminate = i));
216
+ }
217
+ // 清除选中的设备
218
+ clearCheckedEquips(e) {
219
+ this.groupNodeObject[e] && (this.groupNodeObject[e].equipSelectCount = 0, this.groupNodeObject[e].halfCheckedEquips && this.groupNodeObject[e].halfCheckedEquips.forEach((t) => {
220
+ this.equipControllObject[t] && this.equipControllObject[t].forEach((i) => {
221
+ this.setCheckStatus(`${e}-${t}-${i}`, !1, !1);
222
+ });
223
+ }), this.groupNodeObject[e].halfCheckedEquips = [], this.groupNodeObject[e].groupId && this.clearCheckedEquips(this.groupNodeObject[e].groupId));
224
+ }
225
+ // 搜索状态下,更新分组选中的设备数量
226
+ updateSearchStatusObject(e, t) {
227
+ this.searchStatusGroupObject[e] && (this.searchStatusGroupObject[e].equipSelectCount = this.searchStatusGroupObject[e].equipSelectCount + t, this.searchStatusGroupObject[e].groupId && this.updateSearchStatusObject(this.searchStatusGroupObject[e].groupId, t));
228
+ }
229
+ // 更新分组设备选中数量
230
+ updateEquipSelectCount(e, t, i) {
231
+ this.nodesMap[e] && (t ? this.nodesMap[e].equipSelectCount = 0 : this.nodesMap[e].equipSelectCount = this.nodesMap[e].equipSelectCount + i, this.nodesMap[e].groupId && this.updateEquipSelectCount(this.nodesMap[e].groupId, t, i));
232
+ }
233
+ // 保存全局设备选中状态
234
+ setEquipCheckObject(e, t, i, o) {
235
+ this.equipCheckObject[e] || (this.equipCheckObject[e] = {}), this.equipCheckObject[e].checked = t, this.equipCheckObject[e].indeterminate = i, this.equipCheckObject[e].groupId = o;
236
+ }
237
+ // 更新当前展开的分组所选中的设备、设置分组选中的设备数量、更新选中状态(已经实例化的节点)
238
+ updateEquipSelect(e, t, i, o) {
239
+ this.nodesMap[e] && t.length && t.forEach((u) => {
240
+ i ? (this.setEquipCheckObject(u.equipNo, !0, !1, e), this.nodesMap[`${e}-${u.equipNo}`] && this.setCheckStatus(`${e}-${u.equipNo}`, !0, !1)) : (this.setEquipCheckObject(u.equipNo, !1, !1, e), this.nodesMap[`${e}-${u.equipNo}`] && this.setCheckStatus(`${e}-${u.equipNo}`, !1, !1)), this.equipControllObject[u.equipNo] && delete this.equipControllObject[u.equipNo], this.nodesMap[e].halfCheckedEquips.includes(u.equipNo) && (this.nodesMap[e].halfCheckedEquips = this.nodesMap[e].halfCheckedEquips.filter((a) => a != u.equipNo), this.searchStatusGroupObject[e] && (this.searchStatusGroupObject[e].halfCheckedEquips = this.nodesMap[e].halfCheckedEquips));
241
+ });
242
+ }
243
+ // 根据分组更新选中的设备,全选分组或者取消选择分组时调用
244
+ /**
245
+ * 1:统计需要更新的设备数量
246
+ * 2:把所有子孙分组设备全部统计,并且记录所有当前分组选中的设备,更新除分组之外的选中状态(已经实例化的节点)
247
+ * 3:更新自身设备选择数量、向上级分组累加已经选中的设备数量
248
+ * 4:更新搜索状态下分组副本数据
249
+ * */
250
+ // list(Array):所要更新的分组,type(String):更新类型,add为新增,delete为删除;
251
+ updateGroupSelect(e, t) {
252
+ e.forEach((i) => {
253
+ if (this.groupNodeObject[i]) {
254
+ this.groupNodeObject[i].groups && this.groupNodeObject[i].groups.length > 0 && this.updateGroupSelect(this.groupNodeObject[i].groups.map((h) => h.key), t);
255
+ let o = this.window[`group-${i}${this.aliasName}`] || [];
256
+ this.isSearchStatus && (o = this.window[`group-${i}-search`] || []);
257
+ let u = 0, a = 0;
258
+ o.forEach((h) => {
259
+ let c = this.equipCheckObject[h.equipNo];
260
+ !c || !c.checked ? u++ : a--;
261
+ });
262
+ let r = t ? u : a;
263
+ this.updateEquipSelect(i, o, t, r), this.updateEquipSelectCount(i, !1, r), this.updateSearchStatusObject(i, r);
264
+ }
265
+ });
266
+ }
267
+ // 清除分组挂载的半选设备
268
+ clearHalfCheckedEquips(e) {
269
+ e.forEach((t) => {
270
+ this.groupNodeObject[t].halfCheckedEquips && this.groupNodeObject[t].halfCheckedEquips.forEach((i) => {
271
+ this.equipControllObject[i] && this.equipControllObject[i].forEach((o) => {
272
+ this.setCheckStatus(`${t}-${i}-${o}`, !1, !1);
273
+ });
274
+ }), this.groupNodeObject[t].halfCheckedEquips = [], this.groupNodeObject[t].groups && this.groupNodeObject[t].groups.length > 0 && this.clearHalfCheckedEquips(this.groupNodeObject[t].groups.map((i) => i.key));
275
+ });
276
+ }
277
+ // 触发分组选择
278
+ /**
279
+ * 1:清除之前半选设备
280
+ * 2:更新分组中设备选择
281
+ * 3:更新所有分组选中状态
282
+ * 4:更新控制项选中状态
283
+ * */
284
+ selectGroup(e) {
285
+ this.clearHalfCheckedEquips([e.key]), this.updateGroupSelect([e.key], e.checked), this.updateControlCheckStatus(), this.updateGroupCheckStatus();
286
+ }
287
+ // 触发设备选择
288
+ /**
289
+ * 1:更新分组选择的设备
290
+ * 2:更新分组所选择的设备数量
291
+ * 3:更新控制项选中状态
292
+ * 4:更新分组状态
293
+ * */
294
+ selectEquip(e) {
295
+ if (this.nodesMap[e.groupId]) {
296
+ let t = [{ equipNo: e.equipNo }], i = (e.checked ? 1 : -1) * t.length;
297
+ this.updateEquipSelect(e.groupId, t, e.checked, i), this.updateEquipSelectCount(e.groupId, !1, i), this.updateSearchStatusObject(e.groupId, i), this.updateControlCheckStatus(), this.updateGroupCheckStatus();
298
+ }
299
+ }
300
+ // 更新设备控制项存储
301
+ updateEquipControl(e, t, i) {
302
+ this.equipControllObject[e] || (this.equipControllObject[e] = []), i ? this.equipControllObject[e].push(t) : this.equipControllObject[e] = this.equipControllObject[e].filter((o) => o != t);
303
+ }
304
+ // 触发控制项选择
305
+ /**
306
+ * 1:更新设备控制项
307
+ * 2:更新设备选中状态
308
+ (1)选择情况下:
309
+ 1)如果设备即将全选,清除分组中半选设备、清除设备控制项记录(equipControllObject),分组全选设备数组+1,半选设备数组中有则-1,设置设备全选
310
+ 2) 如果之前设备没选择情况下(非半选情况下),分组中半选设备数组+1,设置设备半选
311
+ 3)如果设备是半选状态。不做处理
312
+ (2)取消选择情况下
313
+ 1)如果设备是全选情况下、分组全选设备数组-1
314
+ 1)如果不仅有一个测点,设备半选分组+1,设备控制项(equipControllObject)记录剩余设备,设置设备半选
315
+ 2)如果仅有一个测点,设置设备不选
316
+ 2) 如果设备是半选情况下,如果还是半选,不做处理,如果从半选到不选情况下,分组挂载的半选分组-1,设备控制项有则-1,设置设备不选
317
+ * 3:更新分组状态
318
+ * */
319
+ selectControl(e) {
320
+ let t = this.nodesMap[`${e.groupId}-${e.equipNo}`];
321
+ t && (this.updateEquipControl(e.equipNo, e.setNo, e.checked), e.checked ? t.settings && t.settings.length == this.equipControllObject[e.equipNo].length ? (delete this.equipControllObject[e.equipNo], this.updateEquipSelectCount(e.groupId, !1, 1), this.updateSearchStatusObject(e.groupId, 1), this.nodesMap[e.groupId].halfCheckedEquips = this.nodesMap[e.groupId].halfCheckedEquips.filter((i) => i != e.equipNo), this.setEquipCheckObject(e.equipNo, !0, !1, e.groupId), this.setCheckStatus(`${e.groupId}-${e.equipNo}`, !0, !1)) : t && !t.indeterminate && (this.nodesMap[`${e.groupId}`].halfCheckedEquips.push(e.equipNo), this.setCheckStatus(`${e.groupId}-${e.equipNo}`, !1, !0), this.setEquipCheckObject(e.equipNo, !1, !0, e.groupId)) : t.checked ? (this.updateEquipSelectCount(e.groupId, !1, -1), this.updateSearchStatusObject(e.groupId, -1), t.settings.length > 1 ? (this.nodesMap[e.groupId].halfCheckedEquips.push(e.equipNo), t.settings.map((o) => o.setNo).filter((o) => o != e.setNo).forEach((o) => {
322
+ this.updateEquipControl(e.equipNo, o, !0);
323
+ }), this.setEquipCheckObject(e.equipNo, !1, !0, e.groupId), this.setCheckStatus(`${e.groupId}-${e.equipNo}`, !1, !0)) : (this.setEquipCheckObject(e.equipNo, !1, !1, e.groupId), this.setCheckStatus(`${e.groupId}-${e.equipNo}`, !1, !1))) : t.indeterminate && this.equipControllObject[e.equipNo] && !this.equipControllObject[e.equipNo].length && (this.nodesMap[e.groupId].halfCheckedEquips = this.nodesMap[e.groupId].halfCheckedEquips.filter((i) => i != e.equipNo), this.setEquipCheckObject(e.equipNo, !1, !1, e.groupId), this.setCheckStatus(`${e.groupId}-${e.equipNo}`, !1, !1)), this.updateGroupCheckStatus());
324
+ }
325
+ }
326
+ class v extends N {
327
+ // 分组节点扁平化对象、设备扁平化对象、window缓存设备扁平化对象
328
+ constructor(e, t) {
329
+ super(), this.aliasName = t, this.groupNodeObject = e;
330
+ }
331
+ // 重新计算分组设备数量
332
+ resetGroupNum(e) {
333
+ this.clearAllEquipNum();
334
+ for (let t in this.groupNodeObject) {
335
+ let i = [];
336
+ e ? i = this.window[`group-${t}-search`] : i = this.window[`group-${t}${this.aliasName}`];
337
+ let o = i ? i.length : 0;
338
+ o && (this.groupNodeObject[t].equipCount = o, this.setGroupNum(t, o));
339
+ }
340
+ }
341
+ clearAllEquipNum() {
342
+ for (let e in this.groupNodeObject) { this.groupNodeObject[e].equipCount = 0, this.groupNodeObject[e].count = 0; }
343
+ }
344
+ // 设置分组设备数量
345
+ setGroupNum(e, t) {
346
+ this.groupNodeObject[e] && (this.groupNodeObject[e].count = Number(this.groupNodeObject[e].count) + Number(t), this.setGroupNum(this.groupNodeObject[e].groupId, t));
347
+ }
348
+ // 获取设备总数
349
+ getAllEquipsNum() {
350
+ let e = 0;
351
+ for (let t in this.groupNodeObject) { this.window[`group-${this.groupNodeObject[t].key}${this.aliasName}`] && (e = e + this.window[`group-${this.groupNodeObject[t].key}${this.aliasName}`].length); }
352
+ return e;
353
+ }
354
+ }
355
+ class $ {
356
+ constructor(e, t, i) {
357
+ this.url = e, this.connectionId = t, this.equipNo = i, this.signalr = null;
358
+ }
359
+ openConnect() {
360
+ return this.signalr && (this.signalr.stop(), this.signalr = null), this.signalr = new y.HubConnectionBuilder().withUrl(this.url).build(), this.signalr.serverTimeoutInMilliseconds = 5e8, this.signalr.keepaliveintervalinmilliseconds = 5e8, new Promise((e) => {
361
+ this.signalr.start().then(() => {
362
+ this.connectionId && this.send(), e(this.signalr);
363
+ }).catch((t) => {
364
+ console.log(t);
365
+ });
366
+ });
367
+ }
368
+ async send() {
369
+ try {
370
+ await this.signalr.invoke(this.connectionId, this.equipNo);
371
+ } catch (e) {
372
+ console.log("connectHub 连接失败" + e);
373
+ }
374
+ }
375
+ }
376
+ class A extends N {
377
+ constructor(e, t, i, o, u) {
378
+ super(), this.equipStatusObject = t, this.groupNodeObject = i, this.aleadyUpdateStatus = {}, this.isGetAllEquipStatus = !1, this.nodesMap = e, this.statusChange = o, this.openSignlr(), this.aliasName = u;
379
+ }
380
+ openSignlr() {
381
+ this.equipStatusSignlr = new $("/equipStatusMonitor", "", ""), this.equipStatusSignlr.openConnect().then((e) => {
382
+ try {
383
+ e.invoke("GetAllEquipStatus");
384
+ } catch (t) {
385
+ console.log(t);
386
+ }
387
+ this.subscribeTo(e, "GetAllEquipStatus");
388
+ try {
389
+ e.invoke("GetEquipChangeStatus");
390
+ } catch (t) {
391
+ console.log(t);
392
+ }
393
+ e.onclose(() => {
394
+ this.openSignlr();
395
+ }), this.subscribeTo(e, "GetEquipChangeStatus");
396
+ });
397
+ }
398
+ subscribeTo(e, t) {
399
+ e.off(t), e.on(t, (i) => {
400
+ i && i.isSuccess && i.data && (this[t] ? this[t](i.data) : this.notice({ func: t, data: i.data, key: i.groupId }));
401
+ });
402
+ }
403
+ GetAllEquipStatus(e) {
404
+ this.isGetAllEquipStatus = !0, this.resetGroupStatus(), Object.keys(e).forEach((t) => {
405
+ this.equipStatusObject[t] = e[t];
406
+ }), Object.keys(this.groupNodeObject).forEach((t) => {
407
+ this.updateByGroup(t);
408
+ });
409
+ }
410
+ updateByGroup(e) {
411
+ if (!this.aleadyUpdateStatus[e]) {
412
+ let t = this.window[`group-${e}${this.aliasName}`] || [];
413
+ t.length && (this.aleadyUpdateStatus[e] = !0, t.forEach((i) => {
414
+ this.equipStatusObject[i.equipNo] == 0 || this.equipStatusObject[i.equipNo] == 2 ? this.setGroupStatus(e, !0, 2) : this.equipStatusObject[i.equipNo] == 6 && this.setGroupStatus(e, !0, 6), this.nodesMap[`${e}-${i.equipNo}`] && (this.nodesMap[`${e}-${i.equipNo}`].status = this.equipStatusObject[i.equipNo]);
415
+ }));
416
+ }
417
+ }
418
+ updateGroupStatus(e) {
419
+ this.isGetAllEquipStatus && this.updateByGroup(e);
420
+ }
421
+ GetEquipChangeStatus(e) {
422
+ this.setStatus(e);
423
+ }
424
+ // 设置分组状态 key:扁平化数据中节点索引;type:类型(增加,减少);status:状态(报警2、双机热备6)
425
+ setGroupStatus(e, t, i) {
426
+ t ? i == 2 ? (this.nodesMap[e].alarmCounts = this.nodesMap[e].alarmCounts + 1, this.nodesMap[e].alarmCounts > 0 && (this.nodesMap[e].status = 2)) : (this.nodesMap[e].backUpCounts = this.nodesMap[e].backUpCounts + 1, this.nodesMap[e].alarmCounts == 0 && this.nodesMap[e].backUpCounts > 0 && (this.nodesMap[e].status = 6)) : i == 2 ? (this.nodesMap[e].alarmCounts = this.nodesMap[e].alarmCounts - 1, this.nodesMap[e].alarmCounts == 0 && (this.nodesMap[e].status = 1)) : (this.nodesMap[e].backUpCounts = this.nodesMap[e].backUpCounts - 1, this.nodesMap[e].alarmCounts == 0 && (this.nodesMap[e].backUpCounts == 0 ? this.nodesMap[e].status = 1 : this.nodesMap[e].status = 6)), this.nodesMap[e].groupId && this.setGroupStatus(this.nodesMap[e].groupId, t, i);
427
+ }
428
+ setStatus(e) {
429
+ let t = this.equipStatusObject[e.equipNo], i = this.window.equipCache && this.window.equipCache[e.equipNo] && this.window.equipCache[e.equipNo].groupId;
430
+ if (e.status != 3 && i) {
431
+ switch (e.status) {
432
+ case 0:
433
+ t != 0 && this.setGroupStatus(i, !0, 2), t == 6 && this.setGroupStatus(i, !1, 6);
434
+ break;
435
+ case 1:
436
+ t == 6 ? this.setGroupStatus(i, !1, 6) : (t == 2 || t == 0) && this.setGroupStatus(i, !1, 2);
437
+ break;
438
+ case 2:
439
+ t != 2 && this.setGroupStatus(i, !0, 2), t == 6 && this.setGroupStatus(i, !1, 6);
440
+ break;
441
+ case 6:
442
+ (t == 2 || t == 0) && this.setGroupStatus(i, !1, 2), t != 6 && this.setGroupStatus(i, !0, 6);
443
+ break;
444
+ }
445
+ this.equipStatusObject[e.equipNo] = e.status;
446
+ let o = `${i}-${e.equipNo}`;
447
+ this.nodesMap[o] && (this.nodesMap[o].status = e.status), this.statusChange(i, e.equipNo, e.status);
448
+ }
449
+ }
450
+ // 重置分组状态
451
+ resetGroupStatus() {
452
+ for (let e in this.groupNodeObject) { this.groupNodeObject[e].alarmCounts = 0, this.groupNodeObject[e].backUpCount = 0; }
453
+ }
454
+ }
455
+ const B = {
456
+ getSetParm(s) {
457
+ if (window.axios) {
458
+ return window.axios({
459
+ method: "post",
460
+ url: "/IoT/api/v3/EquipList/GetFullSetParmByEquipNo",
461
+ params: s,
462
+ data: s
463
+ });
464
+ }
465
+ }
466
+ }, U = Object.assign(
467
+ {},
468
+ B
469
+ );
470
+ class W {
471
+ constructor(e, t) {
472
+ this.nodesMap = e, this.equipControllObject = t;
473
+ }
474
+ // 获取设备控制项
475
+ async getSetting(e, t, i, o) {
476
+ let [u, a] = String(e).split("-"), r = {
477
+ equipNo: a
478
+ };
479
+ await U.getSetParm(r).then((h) => {
480
+ if (h.data.code == 200) {
481
+ let c = h && h.data && h.data.data && h.data.data.rows || [];
482
+ this.nodesMap[e].settings || (this.nodesMap[e].settings = []), c && c.length > 0 && this.nodesMap[e] && (c.forEach((p) => {
483
+ p.title = p.setNm, p.key = `${u}-${a}-${p.setNo}`, p.level = Number(i) + 1, p.checked = o || this.equipControllObject[a] && this.equipControllObject[a].includes(p.setNo), p.isSetting = !0, p.equipNo = a, p.groupId = u, p.equipName = t;
484
+ }), this.nodesMap[e].settings = [...c]);
485
+ }
486
+ });
487
+ }
488
+ }
489
+ class d {
490
+ static formateList(e, t) {
491
+ let i = [];
492
+ for (const o of e) {
493
+ let u = {};
494
+ u.count = 0, u.equipSelectCount = 0, u.controlSelectCount = 0, u.equipCount = o.equipCount || 0, u.title = o.name, u.key = o.id, u.isGroup = !0, u.children = [], u.status = 1, u.level = t || 1, u.expand = !t, u.equips = [], u.groupId = o.parentId, u.groups = [], u.alarmCounts = 0, u.backUpCounts = 0, u.indeterminate = !1, u.checked = !1, u.visible = !0, u.nodeEquipSelectCount = 0, u.checkedEquips = [], u.halfCheckedEquips = [], u.selectControlCount = 0, o.children && o.children.length > 0 && (u.groups = [
495
+ ...this.formateList(o.children, t ? t + 1 : 2)
496
+ ]), i.push(u);
497
+ }
498
+ return i;
499
+ }
500
+ static deepClone(e, t, i, o, u, a) {
501
+ let r = [];
502
+ if (e) {
503
+ for (let h = 0, c = e.length; h < c; h++) {
504
+ r.push(
505
+ {
506
+ isGroup: i,
507
+ key: `${o}-${e[h].id}`,
508
+ status: a[e[h].id] || 0,
509
+ title: e[h].title,
510
+ level: t,
511
+ expand: !1,
512
+ isEquip: !0,
513
+ loading: !1,
514
+ indeterminate: u[e[h].equipNo] && u[e[h].equipNo].indeterminate || !1,
515
+ checked: u[e[h].equipNo] && u[e[h].equipNo].checked || !1,
516
+ groupId: o,
517
+ equipNo: e[h].id,
518
+ visible: !0,
519
+ settings: []
520
+ }
521
+ );
522
+ }
523
+ }
524
+ return r;
525
+ }
526
+ static copyOrigin(e) {
527
+ let t = [];
528
+ return e.forEach((i) => {
529
+ t.push({ ...i });
530
+ }), t;
531
+ }
532
+ // 获取分组位置
533
+ static getPosition(e, t) {
534
+ let i = 0;
535
+ for (let o = 0, u = t.length; o < u; o++) {
536
+ if (t[o].key == e) {
537
+ i = o - 30;
538
+ break;
539
+ }
540
+ }
541
+ return i;
542
+ }
543
+ // 扁平化
544
+ static flattern(e, t) {
545
+ e.forEach((i) => {
546
+ i.isGroup && (t[`${i.key}`] = null, t[`${i.key}`] = i), i.groups && i.groups.length && this.flattern(i.groups, t);
547
+ });
548
+ }
549
+
550
+ /**
551
+ * @description 生成唯一Id
552
+ * @param {} 不用传参
553
+ * @return {string}
554
+ */
555
+ static generateUUID() {
556
+ let e = (/* @__PURE__ */ new Date()).getTime();
557
+ return window.performance && typeof window.performance.now == "function" && (e += performance.now()), "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(i) {
558
+ let o = (e + Math.random() * 16) % 16 | 0;
559
+ return e = Math.floor(e / 16), (i === "x" ? o : o & 3 | 8).toString(16);
560
+ });
561
+ }
562
+
563
+ /**
564
+ * @description 将普通列表转换为树结构的列表
565
+ * @param {list} 可构建树形结构的普通列表
566
+ * @return {string}
567
+ */
568
+ static listToTreeList(e) {
569
+ const t = e, i = [], o = {};
570
+ return t.forEach((u) => {
571
+ o[u.id] = u;
572
+ }), t.forEach((u) => {
573
+ const a = o[u.parentId];
574
+ a ? (a.children || (a.children = [])).push(u) : i.push(u);
575
+ }), i;
576
+ }
577
+ }
578
+ class D extends N {
579
+ // 分组节点扁平化对象、设备扁平化对象、window缓存设备扁平化对象
580
+ constructor(e, t, i) {
581
+ super(), this.showSettings = t, this.groupNodeObject = e, this.aliasName = i;
582
+ }
583
+ // 触发搜索
584
+ filterMethod(e) {
585
+ for (let t in this.groupNodeObject) { e && this.updateBySearch(t, e); }
586
+ }
587
+ // 搜索状态将搜索的结果存放缓存中
588
+ updateBySearch(e, t) {
589
+ let i = this.window[`group-${this.groupNodeObject[e].key}${this.aliasName}`];
590
+ i && (i = i.filter((o) => o.title.includes(t)), this.window[`group-${this.groupNodeObject[e].key}-search`] = d.copyOrigin(i));
591
+ }
592
+ }
593
+ const E = (s, e) => {
594
+ const t = s.__vccOpts || s;
595
+ for (const [i, o] of e) { t[i] = o; }
596
+ return t;
597
+ }, K = {
598
+ props: {
599
+ source: {
600
+ type: Object
601
+ },
602
+ groupEditAndNew: {
603
+ type: Function
604
+ },
605
+ deleteGroup: {
606
+ type: Function
607
+ }
608
+ }
609
+ }, F = { class: "operates" };
610
+ function J(s, e, t, i, o, u) {
611
+ const a = g("el-button"), r = g("el-button-group"), h = g("el-popover");
612
+ return n(), l("div", F, [
613
+ q(h, {
614
+ placement: "bottom",
615
+ trigger: "hover"
616
+ }, {
617
+ reference: w(() => e[3] || (e[3] = [
618
+ C("i", { class: "el-icon-more" }, null, -1)
619
+ ])),
620
+ default: w(() => [
621
+ q(r, { class: "new-button-group setModule" }, {
622
+ default: w(() => [
623
+ q(a, {
624
+ type: "text",
625
+ size: "small",
626
+ class: "elBtn",
627
+ icon: " iconfont icon-tubiao20_bianji",
628
+ onClick: e[0] || (e[0] = M((c) => t.groupEditAndNew(!1, t.source), ["stop"]))
629
+ }, {
630
+ default: w(() => [
631
+ k(b(s.$t("equipInfo.poverTips.rename")), 1)
632
+ ]),
633
+ _: 1
634
+ }),
635
+ q(a, {
636
+ type: "text",
637
+ size: "small",
638
+ class: "elBtn",
639
+ icon: " iconfont icon-gw-icon-tianjia1",
640
+ onClick: e[1] || (e[1] = (c) => t.groupEditAndNew(!0, t.source))
641
+ }, {
642
+ default: w(() => [
643
+ k(b(s.$t("equipInfo.poverTips.newChildGroup")), 1)
644
+ ]),
645
+ _: 1
646
+ }),
647
+ t.source.level != 1 ? (n(), S(a, {
648
+ key: 0,
649
+ type: "danger",
650
+ size: "small",
651
+ onClick: e[2] || (e[2] = M((c) => t.deleteGroup(t.source), ["stop"])),
652
+ icon: " iconfont icon-tubiao20_shanchu"
653
+ }, {
654
+ default: w(() => [
655
+ k(b(s.$t("publics.button.deletes")), 1)
656
+ ]),
657
+ _: 1
658
+ })) : f("", !0)
659
+ ]),
660
+ _: 1
661
+ })
662
+ ]),
663
+ _: 1
664
+ })
665
+ ]);
666
+ }
667
+ const V = /* @__PURE__ */ E(K, [["render", J]]), P = {
668
+ name: "ElTreeVirtualNode",
669
+ componentName: "ElTreeVirtualNode",
670
+ props: {
671
+ searchName: {
672
+ type: String,
673
+ default: ""
674
+ },
675
+ expanding: {
676
+ type: Boolean,
677
+ default: !1
678
+ },
679
+ aleadyLoadAll: {
680
+ type: Boolean,
681
+ default: !1
682
+ },
683
+ groupLoading: {
684
+ type: Boolean,
685
+ default: !1
686
+ },
687
+ source: {
688
+ type: Object,
689
+ default() {
690
+ return {};
691
+ }
692
+ },
693
+ showCheckbox: {
694
+ type: Boolean,
695
+ default: !1
696
+ },
697
+ showStatus: {
698
+ type: Boolean,
699
+ default: !1
700
+ },
701
+ showOperate: {
702
+ type: Boolean,
703
+ default: !1
704
+ },
705
+ currentSelect: {
706
+ type: [Number, String],
707
+ default: -1
708
+ },
709
+ nodeClick: {
710
+ type: Function
711
+ },
712
+ onChecked: {
713
+ type: Function
714
+ },
715
+ groupEditAndNew: {
716
+ type: Function
717
+ },
718
+ deleteGroup: {
719
+ type: Function
720
+ },
721
+ colorConfig: {
722
+ type: Object
723
+ },
724
+ index: {
725
+ type: Number,
726
+ default: -1
727
+ }
728
+ },
729
+ components: {
730
+ oparate: V
731
+ },
732
+ computed: {
733
+ getColor() {
734
+ return function(s) {
735
+ let e;
736
+ switch (s) {
737
+ case 0:
738
+ e = this.colorConfig.noComm;
739
+ break;
740
+ case 1:
741
+ e = this.colorConfig.normal;
742
+ break;
743
+ case 2:
744
+ e = this.colorConfig.alarm;
745
+ break;
746
+ case 3:
747
+ e = this.colorConfig.lsSet;
748
+ break;
749
+ case 4:
750
+ e = this.colorConfig.initialize;
751
+ break;
752
+ case 5:
753
+ e = this.colorConfig.withdraw;
754
+ break;
755
+ case 6:
756
+ e = this.colorConfig.BackUp;
757
+ break;
758
+ default:
759
+ e = this.colorConfig.noComm;
760
+ break;
761
+ }
762
+ return e;
763
+ };
764
+ }
765
+ },
766
+ data() {
767
+ return {
768
+ indent: 13
769
+ };
770
+ },
771
+ methods: {
772
+ clickFunction() {
773
+ this.source.expand = !this.source.expand, this.nodeClick(this.source, this.index, this.source.level, this.source.checked);
774
+ },
775
+ checkedChange(s) {
776
+ this.onChecked(this.source);
777
+ }
778
+ }
779
+ }, H = { class: "el-tree-node__content" }, z = { class: "nodeContent" }, R = {
780
+ key: 1,
781
+ class: "circle"
782
+ }, Q = { class: "label" }, X = {
783
+ key: 2,
784
+ class: "equipNumber"
785
+ }, Y = {
786
+ key: 4,
787
+ class: "el-tree-node__loading-icon el-icon-loading"
788
+ };
789
+ function Z(s, e, t, i, o, u) {
790
+ const a = g("el-checkbox"), r = g("oparate");
791
+ return n(), l("div", {
792
+ class: G(["el-tree-node", {
793
+ parent_tag: t.source.isGroup,
794
+ child_tags: !t.source.isGroup,
795
+ selectedColor: t.currentSelect === t.source.key && !t.source.isGroup
796
+ }]),
797
+ onClick: e[1] || (e[1] = (...h) => u.clickFunction && u.clickFunction(...h))
798
+ }, [
799
+ C("div", H, [
800
+ C("span", {
801
+ class: "el-tree__indent",
802
+ "aria-hidden": "true",
803
+ style: O({ width: (t.source.level - 1) * o.indent + "px" })
804
+ }, null, 4),
805
+ t.source.isGroup ? (n(), l("span", {
806
+ key: 0,
807
+ class: G([
808
+ {
809
+ "is-leaf": !t.source.isGroup,
810
+ expanded: t.source.isGroup && t.source.expand
811
+ },
812
+ "el-tree-node__expand-icon",
813
+ "el-icon-arrow-right"
814
+ ])
815
+ }, null, 2)) : f("", !0),
816
+ C("div", z, [
817
+ t.showCheckbox ? (n(), S(a, {
818
+ key: 0,
819
+ modelValue: t.source.checked,
820
+ "onUpdate:modelValue": e[0] || (e[0] = (h) => t.source.checked = h),
821
+ indeterminate: t.source.indeterminate,
822
+ onChange: u.checkedChange
823
+ }, null, 8, ["modelValue", "indeterminate", "onChange"])) : f("", !0),
824
+ t.showStatus ? (n(), l("span", R, [
825
+ t.source.status != 6 ? (n(), l("span", {
826
+ key: 0,
827
+ class: "yd",
828
+ style: O({ backgroundColor: u.getColor(t.source.status) })
829
+ }, null, 4)) : (n(), l("i", {
830
+ key: 1,
831
+ style: O({ color: t.colorConfig.BackUp }),
832
+ class: "iconfont icon-gw-icon-beiji2"
833
+ }, null, 4))
834
+ ])) : f("", !0),
835
+ C("span", Q, b(t.source.title), 1),
836
+ t.source.isGroup && !t.source.isEquip || t.source.isGroup && !t.source.isEquip ? (n(), l("span", X, b(t.source.count), 1)) : f("", !0),
837
+ t.source.isGroup && t.showOperate ? (n(), S(r, {
838
+ key: 3,
839
+ source: t.source,
840
+ groupEditAndNew: t.groupEditAndNew,
841
+ deleteGroup: t.deleteGroup
842
+ }, null, 8, ["source", "groupEditAndNew", "deleteGroup"])) : f("", !0),
843
+ t.source.loading ? (n(), l("span", Y)) : f("", !0)
844
+ ])
845
+ ])
846
+ ], 2);
847
+ }
848
+ const ee = /* @__PURE__ */ E(P, [["render", Z]]), te = {
849
+ components: {
850
+ VirtualList: I
851
+ },
852
+ mixins: [m],
853
+ data() {
854
+ return {
855
+ itemComponent: ee,
856
+ //节点组件
857
+ visibleList: [],
858
+ //虚拟滚动所需要的列表
859
+ currentSelect: -1,
860
+ //当前选中的节点(不包含分组节点)
861
+ equipStatusManage: null,
862
+ //设备状态管理工具
863
+ cacheManage: null,
864
+ //内存管理工具
865
+ searchManage: null,
866
+ //搜索管理工具
867
+ equipNumManage: null,
868
+ //设备数量管理工具
869
+ requestManage: null,
870
+ //请求管理工具
871
+ checkStatusManage: null,
872
+ //请求管理工具
873
+ groupNodeObject: {},
874
+ //所有分组扁平化所保存的存储的地方
875
+ nodesMap: {},
876
+ //所有实例化对象映射
877
+ equipCheckObject: {},
878
+ //设备选中状态记录 equipCheckObject:{xxx设备号:{indeterminate: false,checked: false,groupId:xxx}}
879
+ equipStatusObject: {},
880
+ //记录设备状态,从后台推送的初始化全量状态,增量更新需要实时维护
881
+ controlObject: {},
882
+ //展开的控制项,controlObject:{xxx设备号:{groupId:xxx}}用于设置当前展开设置选中,如果依赖与equipControlObject筛选设置选中,性能差
883
+ isSearchStatus: !1,
884
+ //是否是搜索状态
885
+ equipControllObject: {},
886
+ //绑定所有的已选中的设备控制项
887
+ expandGroup: [],
888
+ //记录已展开的分组
889
+ updateJob: null
890
+ };
891
+ },
892
+ props: {
893
+ data: {
894
+ //分组列表
895
+ type: Array
896
+ },
897
+ selectEquips: {
898
+ //设备选中列表,用于回显,如权限管理
899
+ type: Array,
900
+ default: () => []
901
+ },
902
+ controllList: {
903
+ //控制项选中列表,用于回显,如权限管理
904
+ type: Array,
905
+ default: () => []
906
+ },
907
+ showSettings: {
908
+ //是否需要加载设备控制项,如权限管理
909
+ type: Boolean,
910
+ default: !1
911
+ },
912
+ showSelectNum: {
913
+ //是否在树形结构顶部展示已选设备数量,如设备管理
914
+ type: Boolean,
915
+ default() {
916
+ return !1;
917
+ }
918
+ },
919
+ showCheckbox: {
920
+ //是否展示checkbox
921
+ type: Boolean,
922
+ default: !1
923
+ },
924
+ showStatus: {
925
+ //是否展示设备状态
926
+ type: Boolean,
927
+ default: !1
928
+ },
929
+ showOperate: {
930
+ // 是否展示操作按钮
931
+ type: Boolean,
932
+ default: !1
933
+ },
934
+ defaultExpandAll: {
935
+ type: Boolean,
936
+ default: !1
937
+ },
938
+ currentNodeKey: [String, Number],
939
+ colorConfig: {
940
+ type: Object,
941
+ default: () => ({
942
+ noComm: "#a0a0a0",
943
+ normal: "#63e03f",
944
+ alarm: "#f22433",
945
+ lsSet: "#bebcaa",
946
+ initialize: "#289ac0",
947
+ withdraw: "#ffc0cb",
948
+ BackUp: "#f8901c"
949
+ })
950
+ },
951
+ treeType: {
952
+ type: String,
953
+ default: ""
954
+ },
955
+ buildTree: {
956
+ type: Function
957
+ },
958
+ filterData: {
959
+ type: Function
960
+ },
961
+ alias: {
962
+ type: String,
963
+ default: ""
964
+ }
965
+ },
966
+ watch: {
967
+ data(s) {
968
+ s && s.length && (d.flattern(this.data, this.groupNodeObject), this.cacheManage.addNodesMap(Object.values(this.groupNodeObject).map((e) => e)), this.init());
969
+ },
970
+ controllList(s) {
971
+ this.updateCheckedStatusWithControls();
972
+ },
973
+ selectEquips(s) {
974
+ this.updateCheckedStatusWithEquips();
975
+ }
976
+ },
977
+ computed: {
978
+ aliasName() {
979
+ return this.alias ? `-${this.alias}` : "";
980
+ }
981
+ },
982
+ created() {
983
+ this.showCheckbox && (this.checkStatusManage = new L(this.groupNodeObject, this.nodesMap, this.equipControllObject, this.controlObject, this.equipCheckObject, this.aliasName)), this.cacheManage = new _(this.groupNodeObject, this.nodesMap, this.controlObject, this.equipCheckObject), this.searchManage = new D(this.groupNodeObject, this.showSettings, this.aliasName), this.equipNumManage = new v(this.groupNodeObject, this.aliasName), this.requestManage = new W(this.nodesMap, this.equipControllObject);
984
+ },
985
+ mounted() {
986
+ this.updateCheckedStatusWithControls(), this.updateCheckedStatusWithEquips(), window.addEventListener("message", (s) => {
987
+ s.data.type && this[s.data.type] && this[s.data.type](s.data.data);
988
+ });
989
+ },
990
+ methods: {
991
+ // 初始化
992
+ init() {
993
+ this.data[0].expand = !0, this.updateTreeList(), setTimeout(() => {
994
+ Object.values(this.groupNodeObject).forEach((s) => {
995
+ !s.expand && this.expandGroup.includes(s.key) && (s.expand = !0), this.filterWithAlias(s.key), this.updateGroupEquips(s.key, !0);
996
+ }), this.equipNumManage.resetGroupNum(this.isSearchStatus), this.showStatus && !this.equipStatusManage && (this.equipStatusManage = new A(this.nodesMap, this.equipStatusObject, this.groupNodeObject, this.statusChange, this.aliasName));
997
+ }, 100);
998
+ },
999
+ // 根据条件过滤
1000
+ filterWithAlias(s) {
1001
+ if (this.aliasName) {
1002
+ let e = this.window[`group-${s}`] || [];
1003
+ this.window[`group-${s}${this.aliasName}`] = this.filterData(e);
1004
+ }
1005
+ },
1006
+ // 更新当前选中
1007
+ updateCurrentSelect() {
1008
+ this.window.equipCache && this.window.equipCache[this.currentNodeKey] && (this.currentSelect = `${this.window.equipCache[this.currentNodeKey].groupId}-${this.currentNodeKey}`);
1009
+ },
1010
+ // 设备状态变化
1011
+ statusChange(s, e, t) {
1012
+ this.currentSelect == `${s}-${e}` && this.$emit("statusChange", e, t);
1013
+ },
1014
+ // 更新checkbox选中状态
1015
+ updateCheckWidthJob() {
1016
+ this.showCheckbox && (this.checkStatusManage.resetCheckedStatus(), this.updateCheckedStatusWithControls(), this.updateCheckedStatusWithEquips());
1017
+ },
1018
+ // 通过外框更新设备
1019
+ updateGroupEquips(s, e) {
1020
+ if (!this.isSearchStatus && this.groupNodeObject[s]) {
1021
+ let t = this.equipNumManage.getAllEquipsNum();
1022
+ this.$emit("getTotal", t);
1023
+ }
1024
+ if (e) {
1025
+ let t = this.window[`group-${s}${this.aliasName}`] || [];
1026
+ this.equipNumManage.setGroupNum(s, t.length);
1027
+ }
1028
+ this.groupNodeObject[s].expand && this.updateList(s, this.groupNodeObject[s].level, null, !1);
1029
+ },
1030
+ // 展开的时候从缓存中拿设备数据到equips中并更新视图
1031
+ updateList(s) {
1032
+ if (this.groupNodeObject[s]) {
1033
+ let e = [];
1034
+ this.isSearchStatus ? (e = this.window[`group-${s}-search`], this.groupNodeObject[s].equips = [...d.deepClone(e, Number(this.groupNodeObject[s].level) + 1, this.showSettings, s, this.equipCheckObject, this.equipStatusObject)]) : (e = this.window[`group-${s}${this.aliasName}`], this.groupNodeObject[s].equips = [...d.deepClone(e, Number(this.groupNodeObject[s].level) + 1, this.showSettings, s, this.equipCheckObject, this.equipStatusObject)]), this.cacheManage.addNodesMap(this.groupNodeObject[s].equips), this.cacheManage.closeBrotherNode(s), this.visibleList = [], this.updateTreeList(this.data), this.showStatus && this.equipStatusManage && this.equipStatusManage.updateGroupStatus(s), this.updateCurrentSelect();
1035
+ }
1036
+ },
1037
+ // 更新整个树形结构
1038
+ updateTreeList(s) {
1039
+ s && s.forEach((e) => {
1040
+ this.visibleList.push(e), e.expand ? e.isEquip ? (e.children || (e.children = []), e.settings && (e.children = [...e.settings || []])) : e.children = [...e.equips || [], ...e.groups || []] : e.children = [], this.updateTreeList(e.children || []);
1041
+ });
1042
+ },
1043
+ // 节点点击事件
1044
+ nodeClick(s, e, t, i) {
1045
+ this.$emit("node-click", { ...s, key: s.isEquip ? s.equipNo : s.key }), s.isGroup ? s.isEquip ? this.equipClick(s, e, i) : this.groupClick(s, e, i) : this.currentSelect = s.key;
1046
+ },
1047
+ groupClick(s, e, t) {
1048
+ s.expand ? this.updateList(s.key, s.level, e, t) : (this.cacheManage.recycleGroupCache(s.key), this.visibleList = [], this.updateTreeList(this.data));
1049
+ },
1050
+ async equipClick(s, e, t) {
1051
+ this.showSettings && (s.expand ? (s.loading = !0, await this.requestManage.getSetting(s.key, s.title, s.level, t), this.controlObject[s.equipNo] = { groupId: s.groupId }, s.loading = !1, this.visibleList.splice(e + 1, 0, ...this.nodesMap[s.key].settings), this.cacheManage.addNodesMap(this.nodesMap[s.key].settings)) : (this.visibleList.splice(e + 1, this.nodesMap[s.key].settings.length), this.cacheManage.removeNodesMap(this.nodesMap[s.key].settings), this.nodesMap[s.key].settings = [], delete this.controlObject[s.equipNo]));
1052
+ },
1053
+ onChecked(s) {
1054
+ this.checkStatusManage && this.checkStatusManage.onChecked(s, this.isSearchStatus), this.$emit("onCheck");
1055
+ },
1056
+ groupEditAndNew(s, e) {
1057
+ this.$emit("groupEditAndNew", { isGroupNew: s, node: e });
1058
+ },
1059
+ deleteGroup(s) {
1060
+ this.$emit("deleteGroup", s);
1061
+ },
1062
+ updateCheckedStatusWithControls() {
1063
+ this.controllList && this.controllList.length && this.checkStatusManage && this.checkStatusManage && this.checkStatusManage.updateCheckedStatusWithControls(this.controllList);
1064
+ },
1065
+ updateCheckedStatusWithEquips() {
1066
+ this.selectEquips && this.selectEquips.length && this.checkStatusManage && this.checkStatusManage && this.checkStatusManage.updateCheckedStatusWithEquips(this.selectEquips);
1067
+ },
1068
+ resetCheckedStatus() {
1069
+ this.checkStatusManage && this.checkStatusManage.resetCheckedStatus();
1070
+ },
1071
+
1072
+ /**
1073
+ * @description 获取选择的设备
1074
+ * @return Array
1075
+ */
1076
+ getEquipSelectd() {
1077
+ return this.checkStatusManage && this.checkStatusManage.getEquipSelectd();
1078
+ },
1079
+
1080
+ /**
1081
+ * @description 获取选择的设备控制项
1082
+ * @return Array
1083
+ */
1084
+ getControlSelected() {
1085
+ return this.checkStatusManage && this.checkStatusManage.getControlSelected();
1086
+ },
1087
+
1088
+ /**
1089
+ * @description 记录已展开的分组
1090
+ * @return 无
1091
+ */
1092
+ recordExpandGroup() {
1093
+ this.expandGroup = [], Object.values(this.groupNodeObject).forEach((s) => {
1094
+ s.expand && this.expandGroup.push(s.key);
1095
+ });
1096
+ },
1097
+
1098
+ /**
1099
+ * @description 清除已展开的分组
1100
+ * @return
1101
+ */
1102
+ removeExpandGroup() {
1103
+ this.$nextTick(() => {
1104
+ this.expandGroup = [];
1105
+ });
1106
+ },
1107
+
1108
+ /**
1109
+ * @description 搜索设备
1110
+ * 1:清除所有节点缓存
1111
+ 2: 设置搜索状态为true,搜索状态下所有操作全部不更新
1112
+ 3: 非搜索状态,需要清除搜索缓存
1113
+ * @param {searchName} 搜索名称
1114
+ * @return 无返回值
1115
+ */
1116
+ filterMethod(s) {
1117
+ this.visibleList = [], this.cacheManage.recycleAllNodeCache(), s ? (this.isSearchStatus = !0, this.searchManage.filterMethod(s)) : this.isSearchStatus = !1, this.init(), this.$nextTick(() => {
1118
+ this.$refs.virtualList.scrollToIndex(0);
1119
+ }), this.equipNumManage.resetGroupNum(this.isSearchStatus), this.showCheckbox && (this.checkStatusManage && this.checkStatusManage.reComputedCheckNum(this.isSearchStatus), this.checkStatusManage && this.checkStatusManage.updateGroupCheckStatus());
1120
+ },
1121
+ // 重新构建树
1122
+ rebuildTree() {
1123
+ this.recordExpandGroup(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus(), this.cacheManage.recycleAllNodeCache(!0), this.$nextTick(() => {
1124
+ this.buildTree(), this.removeExpandGroup();
1125
+ });
1126
+ },
1127
+ // 树形结构销毁
1128
+ destroyTree() {
1129
+ this.cacheManage.recycleAllNodeCache(!0), this.visibleList = [], this.updateTreeList(this.data);
1130
+ },
1131
+ // 通过外框事件更新树形结构数据--start
1132
+ /**
1133
+ * @description 获取分组设备
1134
+ * @param {data} {分组Id}
1135
+ * @return 无返回值
1136
+ */
1137
+ GetGroupEquips(s) {
1138
+ s.groupId && this.groupNodeObject[s.groupId] && !this.isSearchStatus && (this.updateGroupEquips(s.groupId, !0), this.updateJob && clearTimeout(this.updateJob), this.updateJob = setTimeout(() => {
1139
+ this.updateCheckWidthJob();
1140
+ }, 500));
1141
+ },
1142
+
1143
+ /**
1144
+ * @description 删除设备
1145
+ * @param {data} {groupId,equips}
1146
+ * @return 无返回值
1147
+ */
1148
+ DeleteEquip(s) {
1149
+ const { groupId: e, equips: t } = s || {};
1150
+ e && this.groupNodeObject[e] && (this.updateGroupEquips(s.groupId), this.equipNumManage.resetGroupNum(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus()), t.length && t.forEach((i) => {
1151
+ let o = this.nodesMap[`${e}-${i.id}`];
1152
+ o && (this.currentSelect.toString().includes(i.id) && this.$emit("currentDelete"), this.showStatus && (o.status == 2 || o.status == 0 ? this.equipStatusManage.setGroupStatus(e, !1, 2) : o.status == 6 && this.equipStatusManage.setGroupStatus(e, !1, 6)), delete this.nodesMap[`${e}-${i.id}`], delete this.equipCheckObject[i.id]), delete this.equipStatusObject[i.id];
1153
+ });
1154
+ },
1155
+
1156
+ /**
1157
+ * @description 移动设备
1158
+ * @param {data} {updateGroups} 需要更新的分组列表
1159
+ * @return 无返回值
1160
+ */
1161
+ moveEquips(s) {
1162
+ const { updateGroups: e, buildTree: t } = s || {};
1163
+ !t && e ? e.forEach((i) => {
1164
+ i && this.groupNodeObject[i] && (this.updateGroupEquips(i), this.equipNumManage.resetGroupNum(), this.checkStatusManage && this.checkStatusManage.resetCheckedStatus());
1165
+ }) : t && this.rebuildTree();
1166
+ },
1167
+
1168
+ /**
1169
+ * @description 删除分组
1170
+ * @param {data} {groupId,parentGroupId}
1171
+ * @return 无返回值
1172
+ */
1173
+ DeleteEquipGroup(s) {
1174
+ s.forEach((e) => {
1175
+ e.groupId && this.nodesMap[e.groupId] && (this.isSearchStatus || this.rebuildTree());
1176
+ });
1177
+ },
1178
+
1179
+ /**
1180
+ * @description 新增分组
1181
+ * @param {data} {groupId,parentGroupId}
1182
+ * @return 无返回值
1183
+ */
1184
+ AddEquipGroup(s) {
1185
+ const { parentGroupId: e, groupId: t } = s || {};
1186
+ t && this.nodesMap[e] && this.treeType && (this.isSearchStatus || this.rebuildTree());
1187
+ },
1188
+
1189
+ /** 编辑分组
1190
+ * @description 新增分组
1191
+ * @param {data} {groupId,parentGroupId}
1192
+ * @return 无返回值
1193
+ */
1194
+ EditEquipGroup(s) {
1195
+ const { groupId: e, groupName: t } = s;
1196
+ this.nodesMap[e] && (this.nodesMap[e].title = t);
1197
+ },
1198
+
1199
+ /**
1200
+ * @description 新增分组设备
1201
+ * @param {data} {分组Id,设备}
1202
+ * @return 无返回值
1203
+ */
1204
+ AddEquip(s) {
1205
+ const { groupId: e } = s || {};
1206
+ e && (this.isSearchStatus || this.rebuildTree());
1207
+ },
1208
+
1209
+ /**
1210
+ * @description 新增分组设备
1211
+ * @param {data} {分组Id,设备}
1212
+ * @return 无返回值
1213
+ */
1214
+ EditEquip(s) {
1215
+ const { equipNo: e, groupId: t, equipName: i } = s || {};
1216
+ this.nodesMap[`${t}-${e}`] && (this.isSearchStatus || (this.nodesMap[`${t}-${e}`].title = i));
1217
+ }
1218
+ // 通过外框事件更新树形结构数据--end
1219
+ }
1220
+ }, ie = {
1221
+ class: "gw-tree",
1222
+ style: { height: "100%" }
1223
+ }, se = {
1224
+ class: "tree",
1225
+ style: { height: "100%" }
1226
+ };
1227
+ function oe(s, e, t, i, o, u) {
1228
+ const a = g("virtual-list", !0);
1229
+ return n(), l("div", ie, [
1230
+ C("div", se, [
1231
+ q(a, {
1232
+ ref: "virtualList",
1233
+ class: "virtualList",
1234
+ "data-key": "key",
1235
+ "data-sources": o.visibleList,
1236
+ "data-component": o.itemComponent,
1237
+ keeps: 40,
1238
+ "extra-props": {
1239
+ currentSelect: o.currentSelect,
1240
+ nodeClick: u.nodeClick,
1241
+ showStatus: t.showStatus,
1242
+ showSettings: t.showSettings,
1243
+ showCheckbox: t.showCheckbox,
1244
+ onChecked: u.onChecked,
1245
+ showOperate: t.showOperate,
1246
+ groupEditAndNew: u.groupEditAndNew,
1247
+ deleteGroup: u.deleteGroup,
1248
+ colorConfig: t.colorConfig
1249
+ }
1250
+ }, null, 8, ["data-sources", "data-component", "extra-props"])
1251
+ ])
1252
+ ]);
1253
+ }
1254
+ const ue = /* @__PURE__ */ E(te, [["render", oe]]);
1255
+ class ae {
1256
+ constructor() {
1257
+ this.eGroupNotify = new $("/eGroupNotify", "", ""), this.alreadyUpdate = {}, this.notify = null, this.window = window;
1258
+ try {
1259
+ window.top.equipGroup, this.window = window.top;
1260
+ } catch {
1261
+ this.window = window;
1262
+ }
1263
+ }
1264
+ stop() {
1265
+ this.notify && this.notify.stop();
1266
+ }
1267
+ Init() {
1268
+ this.eGroupNotify.openConnect().then((e) => {
1269
+ this.notify = e;
1270
+ try {
1271
+ e.invoke("GetEquipGroupTree"), e.invoke("GetAllEquipGroupTree");
1272
+ } catch (t) {
1273
+ console.log(t);
1274
+ }
1275
+ this.subscribeTo(e, "GetEquipGroupTree"), this.subscribeTo(e, "AddEquipGroup"), this.subscribeTo(e, "EditEquipGroup"), this.subscribeTo(e, "DeleteEquipGroup");
1276
+ try {
1277
+ e.invoke("GetGroupEquips");
1278
+ } catch (t) {
1279
+ console.log(t);
1280
+ }
1281
+ this.subscribeTo(e, "GetGroupEquips"), this.subscribeTo(e, "AddEquip"), this.subscribeTo(e, "DeleteEquip"), this.subscribeTo(e, "EditEquip"), this.subscribeTo(e, "moveEquips"), this.subscribeTo(e, "GetAllEquipGroupTree"), e.onclose((t) => {
1282
+ try {
1283
+ this.Init();
1284
+ } catch (i) {
1285
+ console.log(i);
1286
+ }
1287
+ console.log("重连", t);
1288
+ });
1289
+ }).catch((e) => {
1290
+ console.error(e);
1291
+ });
1292
+ }
1293
+ subscribeTo(e, t) {
1294
+ e.off(t), e.on(t, (i) => {
1295
+ i && i.isSuccess && (this[t] ? this[t](i.data) : this.notice({ func: t, data: i.data, key: i.groupId }));
1296
+ });
1297
+ }
1298
+ // 获取分组---无权限管理的分组列表--空设备分组不展示
1299
+ GetEquipGroupTree(e) {
1300
+ this.window.groupList || (this.window.groupList = e, this.notice({ type: "GetEquipGroupTree" }));
1301
+ }
1302
+ // 获取全量分组---设备管理使用
1303
+ GetAllEquipGroupTree(e) {
1304
+ this.window.groupList_manageMent || (this.window.groupList_manageMent = e, this.notice({ type: "GetEquipGroupTreeWidthTreeType" }));
1305
+ }
1306
+ // 新增分组
1307
+ AddEquipGroup(e) {
1308
+ const { parentGroupId: t, groupId: i, groupName: o } = e || {};
1309
+ i && (this.window.groupList_manageMent || (this.window.groupList_manageMent = []), this.window.groupList_manageMent.push({
1310
+ parentId: t,
1311
+ id: i,
1312
+ name: o,
1313
+ equipCount: 0
1314
+ }), this.notice({ type: "AddEquipGroup", data: e }));
1315
+ }
1316
+ // 编辑分组
1317
+ EditEquipGroup(e) {
1318
+ const { groupId: t, groupName: i } = e;
1319
+ this.window.groupList && window.groupList.forEach((o) => {
1320
+ o.id == t && (o.name = i);
1321
+ }), this.window.groupList_manageMent && window.groupList_manageMent.forEach((o) => {
1322
+ o.id == t && (o.name = i);
1323
+ }), this.notice({ type: "EditEquipGroup", data: e });
1324
+ }
1325
+ deleteChildGroup(e, t) {
1326
+ let i = [];
1327
+ t.forEach((o) => {
1328
+ o.parentId == e && i.push(o.id);
1329
+ }), i.forEach((o) => {
1330
+ let u = t.findIndex((a) => a.id == o);
1331
+ u > -1 && t.splice(u, 1), this.deleteChildGroup(o, t);
1332
+ });
1333
+ }
1334
+ // 删除分组
1335
+ DeleteEquipGroup(e) {
1336
+ e.forEach((t) => {
1337
+ if (this.window.groupList) {
1338
+ let i = this.window.groupList.findIndex((o) => o.id == t.groupId);
1339
+ i > -1 && this.window.groupList.splice(i, 1), this.deleteChildGroup(t.groupId, this.window.groupList);
1340
+ }
1341
+ if (this.window.groupList_manageMent) {
1342
+ let i = this.window.groupList_manageMent.findIndex((o) => o.id == t.groupId);
1343
+ i > -1 && this.window.groupList_manageMent.splice(i, 1), this.deleteChildGroup(t.groupId, this.window.groupList_manageMent);
1344
+ }
1345
+ }), this.notice({ type: "DeleteEquipGroup", data: e });
1346
+ }
1347
+ // 获取设备
1348
+ GetGroupEquips(e) {
1349
+ const { groupId: t, equips: i } = e || {};
1350
+ this.alreadyUpdate[t] || (this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[t] = {}, t && i && i instanceof Array && (i.forEach((o) => {
1351
+ o.title = o.name, o.groupId = t, o.equipNo = o.id, delete o.name, window.equipCache || (this.window.equipCache = {}), this.window.equipCache[o.id] = o, this.window.groupCache[t][o.id] = o;
1352
+ }), this.window[`group-${t}`] = i, this.notice({ type: "GetGroupEquips", data: { groupId: t } }), this.alreadyUpdate[t] = !0));
1353
+ }
1354
+ // 新增设备
1355
+ AddEquip(e) {
1356
+ const { groupId: t, equips: i } = e || {};
1357
+ this.window[`group-${t}`] || (this.window[`group-${t}`] = []), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[t] || (this.window.groupCache[t] = {}), this.window.equipCache || (this.window.equipCache = {});
1358
+ let o = this.window[`group-${t}`].length;
1359
+ if (t && i) {
1360
+ if (i.forEach((u, a) => {
1361
+ this.window[`group-${t}`].push(
1362
+ {
1363
+ equipNo: u.id,
1364
+ groupId: t,
1365
+ id: u.id,
1366
+ title: u.name
1367
+ }
1368
+ ), this.window.equipCache[u.id] = this.window[`group-${t}`][o + a], this.window.groupCache[t][u.id] = this.window[`group-${t}`][o + a];
1369
+ }), !this.exist(t, this.window.groupList)) {
1370
+ let u = this.findParentList(t, this.window.groupList_manageMent);
1371
+ this.window.groupList.push(...u);
1372
+ }
1373
+ this.notice({ type: "AddEquip", data: e });
1374
+ }
1375
+ }
1376
+ moveEquips(e) {
1377
+ let t = [], i = !0, o = [];
1378
+ const { sourceGroup: u, targetGroupId: a } = e || {};
1379
+ a && t.push(a), u.forEach((r) => {
1380
+ if (t.push(r.groupId), (!this.window[`group-${a}`] || !this.window[`group-${a}`].length) && (this.window[`group-${a}`] = [], o.push(a)), this.window.groupCache || (this.window.groupCache = {}), this.window.groupCache[a] || (this.window.groupCache[a] = {}), r.equips.forEach((h) => {
1381
+ if (h.title = h.name, h.groupId = a, h.equipNo = h.id, this.window[`group-${r.groupId}`]) {
1382
+ let c = this.window[`group-${r.groupId}`].findIndex((p) => p.id == h.id);
1383
+ c > -1 && this.window[`group-${r.groupId}`].splice(c, 1);
1384
+ }
1385
+ window.equipCache || (this.window.equipCache = {}), this.window.equipCache[h.id] = h, this.window.groupCache[a][h.id] = h, this.window[`group-${a}`].push(h);
1386
+ }), !this.window[`group-${r.groupId}`].length) {
1387
+ let h = this.window.groupList.findIndex((c) => c.id == r.groupId);
1388
+ h > -1 && this.window.groupList.splice(h, 1), this.deleteChildGroup(r.groupId, this.window.groupList);
1389
+ }
1390
+ }), o.forEach((r) => {
1391
+ if (!this.exist(r, this.window.groupList)) {
1392
+ let h = this.findParentList(r, this.window.groupList_manageMent);
1393
+ this.window.groupList.push(...h);
1394
+ }
1395
+ }), this.notice({ type: "moveEquips", data: { updateGroups: t, buildTree: i } });
1396
+ }
1397
+ exist(e, t) {
1398
+ return t ? t.some((i) => i.id == e) : !1;
1399
+ }
1400
+ findParentList(e, t) {
1401
+ let i = [];
1402
+ if (t) {
1403
+ let o = t.findIndex((u) => u.id == e);
1404
+ o > -1 && i.push({ ...t[o] }), t[o].parentId && !this.exist(t[o].parentId, this.window.groupList) && i.push(...this.findParentList(t[o].parentId, this.window.groupList_manageMent));
1405
+ }
1406
+ return i;
1407
+ }
1408
+ // 删除设备
1409
+ DeleteEquip(e) {
1410
+ const { groupId: t, equips: i } = e || {};
1411
+ if (t && i && i instanceof Array) {
1412
+ if (this.window[`group-${t}`]) {
1413
+ for (let o = 0, u = i.length; o < u; o++) {
1414
+ let a = this.window[`group-${t}`].findIndex((r) => r.id == i[o].id);
1415
+ a > -1 && this.window[`group-${t}`].splice(a, 1), delete this.window.equipCache[i[o].id], delete this.window.groupCache[t][i[o].id];
1416
+ }
1417
+ }
1418
+ this.notice({ type: "DeleteEquip", data: e });
1419
+ }
1420
+ }
1421
+ // 编辑设备
1422
+ EditEquip(e) {
1423
+ const { equipNo: t, groupId: i, equipName: o } = e || {};
1424
+ i && t && (window[`group-${i}`] && (this.window.equipCache[t] = o), this.notice({ type: "EditEquip", data: e }));
1425
+ }
1426
+ notice(e) {
1427
+ if (this.window.hasIframe) {
1428
+ let t = document.getElementsByTagName("iframe");
1429
+ for (let i of t) { i.contentWindow.postMessage(e); }
1430
+ } else { window.postMessage(e, "*"); }
1431
+ }
1432
+ }
1433
+ const he = {
1434
+ name: "treeV2",
1435
+ components: {
1436
+ tree: ue
1437
+ },
1438
+ mixins: [m],
1439
+ data() {
1440
+ return {
1441
+ list: [],
1442
+ refId: d.generateUUID(),
1443
+ treeKey: null,
1444
+ listKey: null,
1445
+ hasBuildTree: !1
1446
+ };
1447
+ },
1448
+ props: {
1449
+ treeType: {
1450
+ type: String,
1451
+ default: ""
1452
+ }
1453
+ },
1454
+ mounted() {
1455
+ this.treeKey = `equipGroup${this.treeType}`, this.listKey = `groupList${this.treeType}`, this.window[this.treeKey] ? this.list = d.formateList(JSON.parse(JSON.stringify(this.window[this.treeKey]))) : this.window[this.listKey] && this.buildTree(), window.executeQueue || (window.executeQueues = {}), window.executeQueues[this.refId] = this.destroyTree, window.addEventListener("message", (s) => {
1456
+ s && s.data && s.data.type && this[s.data.type] && this[s.data.type]();
1457
+ });
1458
+ try {
1459
+ this.window.hasIframe || this.selfRequest();
1460
+ } catch {
1461
+ this.selfRequest();
1462
+ }
1463
+ },
1464
+ methods: {
1465
+ selfRequest() {
1466
+ new ae().Init();
1467
+ },
1468
+ GetEquipGroupTreeWidthTreeType() {
1469
+ this.treeType && this.window[this.listKey] && this.buildTree();
1470
+ },
1471
+ GetEquipGroupTree() {
1472
+ !this.treeType && this.window[this.listKey] && this.buildTree();
1473
+ },
1474
+ buildTree() {
1475
+ if (this.window[this.listKey]) {
1476
+ let s = d.listToTreeList(JSON.parse(JSON.stringify(this.window[this.listKey])));
1477
+ this.list = d.formateList(JSON.parse(JSON.stringify(s))), this.window[`equipGroup${this.treeType}`] = s, this.hasBuildTree = !0;
1478
+ }
1479
+ },
1480
+ filterMethod(s) {
1481
+ this.$refs[this.refId].filterMethod(s);
1482
+ },
1483
+ resetCheckedStatus() {
1484
+ this.$refs[this.refId].resetCheckedStatus();
1485
+ },
1486
+ getEquipSelectd() {
1487
+ return this.$refs[this.refId].getEquipSelectd();
1488
+ },
1489
+ getControlSelected() {
1490
+ return this.$refs[this.refId].getControlSelected();
1491
+ },
1492
+ destroyTree() {
1493
+ this.$refs[this.refId].destroyTree();
1494
+ }
1495
+ }
1496
+ };
1497
+ function re(s, e, t, i, o, u) {
1498
+ const a = g("tree");
1499
+ return n(), S(a, x({
1500
+ ref: o.refId,
1501
+ data: o.list
1502
+ }, { ...s.$attrs, ...s.$props }, T(s.$listeners), { buildTree: u.buildTree }), null, 16, ["data", "buildTree"]);
1503
+ }
1504
+ const j = /* @__PURE__ */ E(he, [["render", re]]);
1505
+ j.install = function(s) {
1506
+ s.component(j.name, j);
1507
+ };
1508
+ export {
1509
+ j as default
1510
+ };