hy-dispatch-ui-v3 0.1.6 → 0.2.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 (160) hide show
  1. package/README.md +47 -0
  2. package/dist/tailwind.css +349 -4
  3. package/es/components/appAudioPlayer/appAudioPlayer.vue.mjs +462 -0
  4. package/es/components/appAudioPlayer/index.mjs +6 -0
  5. package/es/components/appAudioPlayer/js/index.mjs +327 -0
  6. package/es/components/appAudioPlayer/style/appAudioPlayer.scss +319 -0
  7. package/es/components/appButton/style/appButton.scss +0 -1
  8. package/es/components/appConfigProvider/appConfigProvider.vue.mjs +22 -1
  9. package/es/components/appCutter/appCutter.vue.mjs +202 -129
  10. package/es/components/appDatePicker/appDatePicker.vue.mjs +1 -1
  11. package/es/components/appForm/appForm.vue.mjs +132 -209
  12. package/es/components/appForm/cpns/appFormItem.vue.mjs +312 -0
  13. package/es/components/appForm/cpns/arrayItem.vue.mjs +305 -0
  14. package/es/components/appForm/cpns/extraItem.vue.mjs +140 -0
  15. package/es/components/appForm/js/index.mjs +46 -24
  16. package/es/components/appForm/js/useAppForm.mjs +30 -6
  17. package/es/components/appForm/style/appForm.scss +53 -0
  18. package/es/components/appIcon/appIcon.vue.mjs +2 -1
  19. package/es/components/appIconBox/style/appIconBox.scss +0 -1
  20. package/es/components/appInput/appInput.vue.mjs +99 -0
  21. package/es/components/appInput/index.mjs +6 -0
  22. package/es/components/appMenu/appMenu.vue.mjs +129 -0
  23. package/es/components/appMenu/index.mjs +6 -0
  24. package/es/components/appMenu/style/appMenu.scss +145 -0
  25. package/es/components/appOrgCascader/appOrgCascader.vue.mjs +14 -10
  26. package/es/components/appSearch/appSearch.vue.mjs +55 -211
  27. package/es/components/appSearch/cpns/appSearchItem.vue.mjs +238 -0
  28. package/es/components/appSearch/js/index.mjs +20 -8
  29. package/es/components/appSearch/js/useAppSearch.mjs +10 -5
  30. package/es/components/appSearch/style/appSearch.scss +10 -0
  31. package/es/components/appTable/appTable.vue.mjs +312 -158
  32. package/es/components/appTable/cpns/columnSelect.vue.mjs +151 -156
  33. package/es/components/appTable/cpns/columnSelectItem.vue2.mjs +104 -110
  34. package/es/components/appTable/cpns/headerItem.vue.mjs +98 -0
  35. package/es/components/appTable/cpns/virtualTable.vue.mjs +560 -0
  36. package/es/components/appTable/js/index.mjs +46 -20
  37. package/es/components/appTable/js/search.mjs +1 -2
  38. package/es/components/appTable/js/useAppTable.mjs +58 -14
  39. package/es/components/appTable/style/appTable.scss +16 -0
  40. package/es/components/appTooltip/appTooltip.vue.mjs +24 -13
  41. package/es/components/appTree/appTree.vue.mjs +304 -0
  42. package/es/components/appTree/index.mjs +6 -0
  43. package/es/components/appTree/js/index.mjs +531 -0
  44. package/es/components/appUserAvatar/appUserAvatar.vue.mjs +9 -8
  45. package/es/components/appUserAvatar/style/appUserAvatar.scss +0 -1
  46. package/es/components/appVideoPlayer/appVideoPlayer.vue.mjs +647 -0
  47. package/es/components/appVideoPlayer/cpns/mediaLoading.vue.mjs +35 -0
  48. package/es/components/appVideoPlayer/index.mjs +6 -0
  49. package/es/components/appVideoPlayer/js/index.mjs +426 -0
  50. package/es/components/appVideoPlayer/style/appVideoPlayer.scss +275 -0
  51. package/es/components/appVideoPlayer/style/mediaLoading.scss +62 -0
  52. package/es/components/index.mjs +5 -0
  53. package/es/hooks/index.mjs +3 -0
  54. package/es/hooks/useApi.mjs +4 -4
  55. package/es/hooks/useAudioPlayerConfig.mjs +12 -0
  56. package/es/hooks/useGlobalConfig.mjs +18 -7
  57. package/es/hooks/useLocale.mjs +3 -11
  58. package/es/hooks/useMixins.mjs +1 -1
  59. package/es/hooks/usePermissionMap.mjs +12 -0
  60. package/es/hooks/useUserAvatarMap.mjs +2 -3
  61. package/es/hooks/useVideoPlayerConfig.mjs +12 -0
  62. package/es/index.mjs +14 -4
  63. package/es/locale/en.mjs +52 -3
  64. package/es/locale/zh_CN.mjs +48 -3
  65. package/es/make-installer.mjs +2 -0
  66. package/es/static/hy-svg-icons.js +462 -0
  67. package/es/static/protocolcheck.js +247 -0
  68. package/es/style/element/element.scss +9 -0
  69. package/es/style/element/index.scss +6 -3
  70. package/es/style/index.scss +11 -0
  71. package/es/style/theme.scss +73 -0
  72. package/es/utils/date.mjs +25 -1
  73. package/es/utils/file.mjs +5 -4
  74. package/es/utils/form.mjs +52 -0
  75. package/es/utils/handler.mjs +22 -2
  76. package/es/utils/index.mjs +6 -4
  77. package/es/utils/is.mjs +23 -2
  78. package/es/utils/loadScript.mjs +33 -0
  79. package/es/version.mjs +1 -1
  80. package/lib/components/appAudioPlayer/appAudioPlayer.vue.js +466 -0
  81. package/lib/components/appAudioPlayer/index.js +11 -0
  82. package/lib/components/appAudioPlayer/js/index.js +329 -0
  83. package/lib/components/appAudioPlayer/style/appAudioPlayer.scss +319 -0
  84. package/lib/components/appButton/style/appButton.scss +0 -1
  85. package/lib/components/appConfigProvider/appConfigProvider.vue.js +22 -1
  86. package/lib/components/appCutter/appCutter.vue.js +201 -128
  87. package/lib/components/appDatePicker/appDatePicker.vue.js +1 -1
  88. package/lib/components/appForm/appForm.vue.js +129 -206
  89. package/lib/components/appForm/cpns/appFormItem.vue.js +316 -0
  90. package/lib/components/appForm/cpns/arrayItem.vue.js +309 -0
  91. package/lib/components/appForm/cpns/extraItem.vue.js +144 -0
  92. package/lib/components/appForm/js/index.js +48 -23
  93. package/lib/components/appForm/js/useAppForm.js +30 -6
  94. package/lib/components/appForm/style/appForm.scss +53 -0
  95. package/lib/components/appIcon/appIcon.vue.js +2 -1
  96. package/lib/components/appIconBox/style/appIconBox.scss +0 -1
  97. package/lib/components/appInput/appInput.vue.js +103 -0
  98. package/lib/components/appInput/index.js +11 -0
  99. package/lib/components/appMenu/appMenu.vue.js +133 -0
  100. package/lib/components/appMenu/index.js +11 -0
  101. package/lib/components/appMenu/style/appMenu.scss +145 -0
  102. package/lib/components/appOrgCascader/appOrgCascader.vue.js +14 -10
  103. package/lib/components/appSearch/appSearch.vue.js +51 -207
  104. package/lib/components/appSearch/cpns/appSearchItem.vue.js +242 -0
  105. package/lib/components/appSearch/js/index.js +20 -7
  106. package/lib/components/appSearch/js/useAppSearch.js +10 -5
  107. package/lib/components/appSearch/style/appSearch.scss +10 -0
  108. package/lib/components/appTable/appTable.vue.js +319 -165
  109. package/lib/components/appTable/cpns/columnSelect.vue.js +151 -156
  110. package/lib/components/appTable/cpns/columnSelectItem.vue2.js +105 -111
  111. package/lib/components/appTable/cpns/headerItem.vue.js +102 -0
  112. package/lib/components/appTable/cpns/virtualTable.vue.js +564 -0
  113. package/lib/components/appTable/js/index.js +47 -19
  114. package/lib/components/appTable/js/search.js +1 -2
  115. package/lib/components/appTable/js/useAppTable.js +57 -13
  116. package/lib/components/appTable/style/appTable.scss +16 -0
  117. package/lib/components/appTooltip/appTooltip.vue.js +23 -12
  118. package/lib/components/appTree/appTree.vue.js +308 -0
  119. package/lib/components/appTree/index.js +11 -0
  120. package/lib/components/appTree/js/index.js +533 -0
  121. package/lib/components/appUserAvatar/appUserAvatar.vue.js +9 -8
  122. package/lib/components/appUserAvatar/style/appUserAvatar.scss +0 -1
  123. package/lib/components/appVideoPlayer/appVideoPlayer.vue.js +651 -0
  124. package/lib/components/appVideoPlayer/cpns/mediaLoading.vue.js +39 -0
  125. package/lib/components/appVideoPlayer/index.js +11 -0
  126. package/lib/components/appVideoPlayer/js/index.js +429 -0
  127. package/lib/components/appVideoPlayer/style/appVideoPlayer.scss +275 -0
  128. package/lib/components/appVideoPlayer/style/mediaLoading.scss +62 -0
  129. package/lib/components/index.js +42 -32
  130. package/lib/hooks/index.js +9 -0
  131. package/lib/hooks/useApi.js +4 -4
  132. package/lib/hooks/useAudioPlayerConfig.js +15 -0
  133. package/lib/hooks/useGlobalConfig.js +18 -7
  134. package/lib/hooks/useLocale.js +3 -11
  135. package/lib/hooks/useMixins.js +1 -1
  136. package/lib/hooks/usePermissionMap.js +15 -0
  137. package/lib/hooks/useUserAvatarMap.js +1 -2
  138. package/lib/hooks/useVideoPlayerConfig.js +15 -0
  139. package/lib/index.js +62 -33
  140. package/lib/locale/en.js +52 -3
  141. package/lib/locale/zh_CN.js +48 -3
  142. package/lib/make-installer.js +2 -0
  143. package/lib/static/hy-svg-icons.js +459 -8
  144. package/lib/static/protocolcheck.js +249 -0
  145. package/lib/style/element/element.scss +9 -0
  146. package/lib/style/element/index.scss +6 -3
  147. package/lib/style/index.scss +11 -0
  148. package/lib/style/theme.scss +73 -0
  149. package/lib/utils/date.js +25 -0
  150. package/lib/utils/file.js +4 -4
  151. package/lib/utils/form.js +57 -0
  152. package/lib/utils/handler.js +22 -1
  153. package/lib/utils/index.js +11 -1
  154. package/lib/utils/is.js +23 -1
  155. package/lib/utils/loadScript.js +37 -0
  156. package/lib/version.js +1 -1
  157. package/package.json +12 -10
  158. package/es/config/index.mjs +0 -1
  159. package/es/static/hy-svg-icons.mjs +0 -11
  160. package/lib/config/index.js +0 -2
@@ -0,0 +1,531 @@
1
+ import { ElMessage } from 'element-plus';
2
+ import { getCurrentInstance, ref, watch, computed, h, render } from 'vue';
3
+
4
+ const deviceStatus = {
5
+ 7: "SOS",
6
+ 8: "\u97F3\u9891\u4E2D...",
7
+ 2: "\u76D1\u63A7\u4E2D",
8
+ 3: "\u901A\u8BDD\u4E2D",
9
+ 4: "\u5F55\u50CF\u4E2D",
10
+ 5: "\u5F55\u97F3\u4E2D",
11
+ 6: "\u5E7F\u64AD\u4E2D",
12
+ 0: "\u79BB\u7EBF",
13
+ 1: "\u5728\u7EBF"
14
+ };
15
+ const useAppTreeWrapper = (hy) => {
16
+ const { props, emits, slots, treeRef, VirtualTree } = hy;
17
+ const instance = getCurrentInstance();
18
+ const slotAppContext = instance ? {
19
+ ...instance.appContext,
20
+ // 用实例的 provides 链覆盖应用级 provides,才能拿到 ElConfigProvider 注入的 namespace
21
+ provides: instance.provides
22
+ } : null;
23
+ const permissionIdList = JSON.parse(
24
+ window.sessionStorage.getItem("permissionIdList") || "[]"
25
+ );
26
+ let virtualTree = null;
27
+ const filterValue = ref("");
28
+ const disableSelectionMap = ref(null);
29
+ const addDeviceDom = ref();
30
+ const selectedDataList = ref([]);
31
+ const selectFilterType = ref(null);
32
+ const selectFilterList = ref([]);
33
+ watch(
34
+ () => props.showCheckbox,
35
+ (newVal) => {
36
+ virtualTree?.setRowSelection({
37
+ type: props.showCheckbox ? "checkbox" : "radio"
38
+ });
39
+ }
40
+ );
41
+ function getData(dataList) {
42
+ return new Promise((resolve) => {
43
+ if (props.disableSelection?.length) {
44
+ setDisAbleSelectionMap();
45
+ }
46
+ if (!virtualTree) {
47
+ virtualTree = new VirtualTree({
48
+ // 指定容器
49
+ container: treeRef.value,
50
+ // 数据
51
+ data: dataList,
52
+ // 每一项的高度
53
+ itemHeight: 30,
54
+ // 可视区域外的缓冲项数量
55
+ bufferSize: 10,
56
+ // 可视区域外的缓冲项数量
57
+ indent: 16,
58
+ emptyText: "\u6682\u65E0\u6570\u636E",
59
+ business: props.treeType,
60
+ // 自定义整体的插槽
61
+ renderItem: props.treeType === "user" ? (data, node) => setUserSlot(data) : setSlot("treeParentSlot"),
62
+ // // 自定义状态右侧插槽
63
+ renderRight: (data) => {
64
+ let renderRight = setSlot("renderRight");
65
+ if (renderRight) return renderRight(data);
66
+ if (data.dataType === 1) {
67
+ let departmentRight = setSlot("departmentRight");
68
+ if (departmentRight) {
69
+ return departmentRight(data);
70
+ }
71
+ }
72
+ if (data.dataType === 3) {
73
+ let deviceOnlineRight = setSlot("deviceOnlineRight");
74
+ if (deviceOnlineRight) {
75
+ return deviceOnlineRight(data);
76
+ }
77
+ }
78
+ if ([11].includes(data.dataType)) {
79
+ let planGroupRight = setSlot("planGroupRight");
80
+ if (planGroupRight) {
81
+ return planGroupRight(data);
82
+ }
83
+ }
84
+ return true;
85
+ },
86
+ // // 自定义状态模块
87
+ renderStatus: props.treeType === "device" || props.treeType === "channel" ? (data) => setRenderStatus(data) : null,
88
+ renderEmpty: () => {
89
+ if (!props.showCustomEmpty || hy.filterValue.value) return true;
90
+ let renderEmpty = setSlot("renderEmpty");
91
+ if (renderEmpty) {
92
+ const target = renderEmpty();
93
+ return target.el;
94
+ }
95
+ return setEmpty();
96
+ },
97
+ props: {
98
+ showStatus: true,
99
+ disabled: (data) => {
100
+ if (data.dataType === 3 || data.dataType === 5) {
101
+ if (hy.disableSelectionMap.value) {
102
+ return hy.disableSelectionMap.value.get(data.id);
103
+ }
104
+ return false;
105
+ }
106
+ return false;
107
+ }
108
+ },
109
+ rowSelection: {
110
+ type: props.showCheckbox ? "checkbox" : "radio",
111
+ highlight: props.highlight,
112
+ // 是否显示选项 showSinglebox 单选为true时部门不显示其他节点显示选择框
113
+ showSelect: (data) => {
114
+ if (data.dataType === 1) {
115
+ return props.showCheckbox;
116
+ }
117
+ return props.showCheckbox || props.showSinglebox;
118
+ },
119
+ // 单选时是否可以取消选择
120
+ cancelable: true,
121
+ // 选中回调
122
+ onCheckChange: (data, info, checked) => {
123
+ if (data.dataType === 3 && !checked) {
124
+ emits("on-click-delete", JSON.parse(JSON.stringify(data)));
125
+ } else if (data.dataType === 3) {
126
+ emits("on-click", data);
127
+ }
128
+ emits(
129
+ "on-check-tree",
130
+ JSON.parse(JSON.stringify(info.checkedBusinessNodes))
131
+ );
132
+ }
133
+ },
134
+ // 筛选方法
135
+ filterMethod: ({ filterValue: filterValue2 }, data) => {
136
+ let isFilter = true;
137
+ if (filterValue2) {
138
+ isFilter = isFilter && !!filterNodeMethod(data, filterValue2);
139
+ }
140
+ return isFilter;
141
+ },
142
+ businessConfig: {
143
+ // 是否开启按在线离线状态排序
144
+ sortByStatus: props.deviceOrderSort,
145
+ // 是否只显示在线设备
146
+ showOnlineState: props.showOnlineOnly,
147
+ // 是否清空没有业务项(设备、用户、采集器)的部门和群组
148
+ clearEmptyBusiness: props.clearEmptyBusiness,
149
+ // 是否显示通道节点的选择框
150
+ isShowChannelSelect: props.isShowChannelSelect
151
+ },
152
+ // 初始化时处理数据,想回显必须return值,若想要过滤,可不return
153
+ handleMethod: (data) => {
154
+ return data;
155
+ },
156
+ // 自定义点击事件
157
+ onNodeClick: (data, node, e) => {
158
+ if (data.children?.length && data.dataType === 1) {
159
+ emits("on-department-click", data);
160
+ } else {
161
+ emits("on-click-device", data);
162
+ }
163
+ document.body.click();
164
+ },
165
+ // 右击事件
166
+ onNodeContextmenu: (res, node, event) => {
167
+ emits("on-contextmenu", { event, res });
168
+ },
169
+ // 双击事件
170
+ onNodeDblClick: (data, node, event) => {
171
+ if (props.treeType !== "channel") {
172
+ emits("on-dblclick", [{ ...data }]);
173
+ } else {
174
+ if (data.channelId) {
175
+ emits("on-dblclick", [
176
+ {
177
+ ...node.parent.data,
178
+ channelId: data.channelId,
179
+ channelName: data.channelName
180
+ // type: data.dataType
181
+ }
182
+ ]);
183
+ } else {
184
+ const channelList = data.videoChannelList?.filter(
185
+ (v) => v.onlineState === 1
186
+ );
187
+ if (channelList && channelList.length) {
188
+ emits(
189
+ "on-dblclick",
190
+ channelList.map((v) => ({
191
+ ...data,
192
+ channelId: v.channelId,
193
+ channelName: v.channelName
194
+ }))
195
+ );
196
+ } else {
197
+ emits("on-dblclick", [data]);
198
+ }
199
+ }
200
+ }
201
+ },
202
+ // 节点展开回调
203
+ onNodeExpand: (data, node) => {
204
+ document.body.click();
205
+ },
206
+ // 节点收起回调
207
+ onNodeCollapse: (data, node) => {
208
+ document.body.click();
209
+ },
210
+ onLoad: () => {
211
+ if (props.showOnlineOnly && !virtualTree._flattenTree?.length && !hy.filterValue.value) {
212
+ ElMessage.warning("\u6682\u65E0\u8BBE\u5907\u5904\u4E8E\u5728\u7EBF\u72B6\u6001");
213
+ }
214
+ if (props.defaultSelectedOrgID && props.showCheckbox && props.treeType === "device") {
215
+ setSelectedOrg(dataList);
216
+ } else if (props.selectedByDefault?.length) {
217
+ setCheckedKeys(props.selectedByDefault);
218
+ }
219
+ if (hy.filterValue.value) {
220
+ getFilterValue();
221
+ }
222
+ resolve(200);
223
+ }
224
+ });
225
+ } else {
226
+ virtualTree.setData(
227
+ {
228
+ data: dataList,
229
+ businessConfig: {
230
+ sortByStatus: props.deviceOrderSort,
231
+ showOnlineState: props.showOnlineOnly,
232
+ clearEmptyBusiness: props.clearEmptyBusiness
233
+ }
234
+ },
235
+ () => {
236
+ if (props.showOnlineOnly && !virtualTree._flattenTree?.length && !hy.filterValue.value) {
237
+ ElMessage.success("\u6682\u65E0\u8BBE\u5907\u5904\u4E8E\u5728\u7EBF\u72B6\u6001");
238
+ }
239
+ if (hy.filterValue.value) {
240
+ getFilterValue();
241
+ }
242
+ resolve(200);
243
+ }
244
+ );
245
+ }
246
+ });
247
+ }
248
+ function setEmpty() {
249
+ let content = ``;
250
+ if (!props.showOnlineOnly) {
251
+ setTimeout(() => {
252
+ if (hy.addDeviceDom.value) {
253
+ hy.addDeviceDom.value.removeEventListener("click", addDevice);
254
+ }
255
+ hy.addDeviceDom.value = document.getElementById("dispatch-add-device");
256
+ if (hy.addDeviceDom.value) {
257
+ hy.addDeviceDom.value.addEventListener("click", addDevice);
258
+ }
259
+ });
260
+ content = `<div class="w-full h-full flex flex-col justify-center items-center">
261
+ <svg data-v-19e5a669="" data-v-56505d40="" aria-hidden="true" svgName="map_service" class="svg-icon" style="width: 40px; height: 48px"><use data-v-19e5a669="" xlink:href="#icon-noData"></use></svg>
262
+ <span class="text-auxiliary text-sm mt-2">\u60A8\u5C1A\u672A\u6DFB\u52A0\u4EFB\u52A1\u8BBE\u5907</span>
263
+ ${permissionIdList.includes("operator_deviceManage") ? '<span id="dispatch-add-device" class="inline-block border-b border-theme text-theme text-sm mt-2 cursor-pointer">\u53BB\u6DFB\u52A0</span>' : ""}
264
+ </div>`;
265
+ } else {
266
+ content = `<div class="w-full h-full flex flex-col justify-center items-center">
267
+ <svg data-v-19e5a669="" data-v-56505d40="" aria-hidden="true" svgName="map_service" class="svg-icon" style="width: 40px; height: 40px"><use data-v-19e5a669="" xlink:href="#icon-v3-card-device-offline"></use></svg>
268
+ <span class="text-auxiliary text-sm mt-2">\u6682\u65E0\u8BBE\u5907\u5904\u4E8E\u5728\u7EBF\u72B6\u6001</span>
269
+ <span class="text-auxiliary text-sm whitespace-nowrap">\u8BF7\u68C0\u67E5\u8BBE\u5907\u72B6\u6001\u6216\u7F51\u7EDC\u8FDE\u63A5</span>
270
+ </div>`;
271
+ }
272
+ return content;
273
+ }
274
+ function getFilterValue() {
275
+ virtualTree.filter({ filterValue: hy.filterValue.value }, false);
276
+ }
277
+ function setDisAbleSelectionMap() {
278
+ const map = /* @__PURE__ */ new Map();
279
+ props.disableSelection.forEach((v) => {
280
+ map.set(v.id, true);
281
+ });
282
+ hy.disableSelectionMap.value = map;
283
+ }
284
+ function refreshData() {
285
+ emits("on-refreshData");
286
+ }
287
+ function setRenderStatus(data) {
288
+ const slot = setSlot("renderStatus");
289
+ if (slot) {
290
+ return slot(data);
291
+ }
292
+ if (data.dataType === 3) {
293
+ return setDutyStatus(data);
294
+ }
295
+ return true;
296
+ }
297
+ function setDutyStatus(data) {
298
+ let container = document.createElement("div");
299
+ container.style.display = "flex";
300
+ container.style.width = "100%";
301
+ const dutyHtml = `<div class="flex treeDeviceBox">
302
+ ${props.getDutyRoster === 1 && data.rosterContent ? `<span class="w-[22px] h-[22px] text-xs rounded border box-border text-main flex justify-center items-center mr-1"
303
+ style="border-color: ${data.rosterContentColor};background-color: ${data.rosterContentColor}70;">
304
+ ${data.rosterContentSimple}
305
+ </span>` : ""}
306
+ ${data.deviceStatus === 7 ? `<span class="deviceType-sos spanBox">SOS</span>` : data.deviceStatus === 1 ? `<span style="color: rgba(var(--hy-success), 1)" class="spanBox">${deviceStatus[data.deviceStatus]}</span>` : data.deviceStatus === 0 ? `<span style="color: rgba(var(--hy-info), 1)" class="spanBox whitespace-nowrap">${deviceStatus[data.deviceStatus]}</span>` : `<span class="deviceType spanBox">${deviceStatus[data.deviceStatus]}</span>`}
307
+ </div>`;
308
+ container.innerHTML = dutyHtml;
309
+ return {
310
+ el: container,
311
+ $destroy: () => {
312
+ container = null;
313
+ }
314
+ };
315
+ }
316
+ function setUserSlot(data) {
317
+ if (data.dataType === 1) {
318
+ const slot2 = setSlot("treeParentSlot");
319
+ if (slot2) {
320
+ return slot2(data);
321
+ }
322
+ return true;
323
+ }
324
+ const slot = setSlot("treeSelectedSlot");
325
+ if (slot) {
326
+ return slot(data);
327
+ }
328
+ return true;
329
+ }
330
+ function setSlot(slotName) {
331
+ if (!slotName || !slots[slotName]) return null;
332
+ return (data, node) => {
333
+ let container = document.createElement("div");
334
+ container.style.display = "flex";
335
+ container.style.width = "100%";
336
+ const vnode = h({
337
+ setup() {
338
+ return () => h(
339
+ "div",
340
+ {
341
+ style: {
342
+ width: "100%",
343
+ display: "flex"
344
+ }
345
+ },
346
+ [
347
+ slots[slotName]({
348
+ row: { ...data, childrenDeviceNum: node?.total }
349
+ })
350
+ ]
351
+ );
352
+ }
353
+ });
354
+ if (slotAppContext) {
355
+ vnode.appContext = slotAppContext;
356
+ }
357
+ render(vnode, container);
358
+ return {
359
+ el: container,
360
+ $destroy: () => {
361
+ render(null, container);
362
+ container = null;
363
+ }
364
+ };
365
+ };
366
+ }
367
+ function addDevice() {
368
+ emits("on-addDevice");
369
+ }
370
+ function singleRemovalFn(row) {
371
+ if (props.treeType === "user") {
372
+ virtualTree.setChecked(row.id, false, true);
373
+ } else {
374
+ virtualTree.setChecked(row.deviceId, false, true);
375
+ }
376
+ }
377
+ function setCheckedKeys(dataList) {
378
+ if (props.treeType === "user") {
379
+ virtualTree?.setCheckedKeys(
380
+ dataList.map((v) => v.id),
381
+ true
382
+ );
383
+ } else {
384
+ virtualTree?.setCheckedKeys(
385
+ dataList.map((v) => v.deviceId),
386
+ true
387
+ );
388
+ }
389
+ if (props.isBackDefaultSelected) {
390
+ setTimeout(() => {
391
+ const deviceList = virtualTree?.getCheckedBusinessNodes(true) || [];
392
+ emits("on-selectedDataList", deviceList);
393
+ });
394
+ }
395
+ }
396
+ function setChecked(data, type) {
397
+ if (props.treeType === "user") {
398
+ virtualTree?.setChecked(data.id, type, true);
399
+ } else {
400
+ virtualTree?.setChecked(data.deviceId, type, true);
401
+ }
402
+ }
403
+ function setSelectedOrg(deviceList) {
404
+ for (let i = 0; i < deviceList.length; i++) {
405
+ if (props.defaultSelectedOrgID === deviceList[i].id) {
406
+ if (deviceList[i].deviceList?.length) {
407
+ virtualTree.setCheckedNodes(deviceList[i].deviceList, true);
408
+ setSelectedDataList(deviceList[i].deviceList);
409
+ }
410
+ return true;
411
+ }
412
+ if (deviceList[i].children?.length) {
413
+ const org = setSelectedOrg(deviceList[i].children);
414
+ if (org) return true;
415
+ }
416
+ }
417
+ }
418
+ function setSelectedDataList(inSelectedDataList = [], notify = true) {
419
+ hy.selectedDataList.value = [...inSelectedDataList];
420
+ if (notify) {
421
+ emits("on-selectedDataList", hy.selectedDataList.value);
422
+ }
423
+ }
424
+ function setFilterListType(type) {
425
+ if (props.selectFilterList?.length) {
426
+ hy.selectFilterList.value = JSON.parse(
427
+ JSON.stringify(props.selectFilterList)
428
+ );
429
+ return;
430
+ }
431
+ if (props.treeType === "device") {
432
+ hy.selectFilterList.value = [
433
+ {
434
+ label: "\u5168\u90E8",
435
+ value: null,
436
+ placeholder: "\u8F93\u5165 \u90E8\u95E8\u540D\u79F0\u3001\u8BBE\u5907\u53F7|\u540D\u79F0|\u7F16\u7801\u3001\u7528\u6237\u540D\u79F0 \u8FDB\u884C\u7B5B\u9009"
437
+ },
438
+ {
439
+ label: "\u90E8\u95E8",
440
+ value: 1,
441
+ placeholder: "\u90E8\u95E8\u540D\u79F0\u8FDB\u884C\u7B5B\u9009"
442
+ },
443
+ {
444
+ label: "\u8BBE\u5907",
445
+ value: 3,
446
+ placeholder: "\u8BBE\u5907\u53F7\u3001\u8BBE\u5907\u540D\u79F0\u8FDB\u884C\u7B5B\u9009"
447
+ }
448
+ ];
449
+ } else if (props.treeType === "user") {
450
+ hy.selectFilterList.value = [
451
+ {
452
+ label: "\u5168\u90E8",
453
+ value: null,
454
+ placeholder: "\u8F93\u5165 \u90E8\u95E8\u540D\u79F0\u3001\u4EBA\u5458\u5DE5\u53F7|\u540D\u79F0|\u8D26\u53F7 \u8FDB\u884C\u7B5B\u9009"
455
+ },
456
+ {
457
+ label: "\u90E8\u95E8",
458
+ value: 1,
459
+ placeholder: "\u90E8\u95E8\u540D\u79F0\u8FDB\u884C\u7B5B\u9009"
460
+ },
461
+ {
462
+ label: "\u4EBA\u5458",
463
+ value: 5,
464
+ placeholder: "\u4EBA\u5458\u540D\u79F0\u8FDB\u884C\u7B5B\u9009"
465
+ }
466
+ ];
467
+ }
468
+ }
469
+ const getInputPlaceholder = computed(() => {
470
+ const item = hy.selectFilterList.value.find(
471
+ (v) => v.value === hy.selectFilterType.value
472
+ );
473
+ if (item && item.placeholder) {
474
+ return item.placeholder;
475
+ }
476
+ return "\u8BF7\u8F93\u5165\u5185\u5BB9\u8FDB\u884C\u641C\u7D22";
477
+ });
478
+ function onChange() {
479
+ if (hy.filterValue.value.length) {
480
+ refreshData();
481
+ }
482
+ }
483
+ return {
484
+ filterValue,
485
+ virtualTree,
486
+ permissionIdList,
487
+ disableSelectionMap,
488
+ addDeviceDom,
489
+ getData,
490
+ getFilterValue,
491
+ refreshData,
492
+ singleRemovalFn,
493
+ setCheckedKeys,
494
+ setChecked,
495
+ setFilterListType,
496
+ getInputPlaceholder,
497
+ onChange,
498
+ selectFilterList,
499
+ selectFilterType,
500
+ selectedDataList
501
+ };
502
+ };
503
+ function filterNodeMethod(data, value, selectFilterType) {
504
+ data.dataType;
505
+ const includesValue = (field) => {
506
+ return field && field.toString().includes(value.toString());
507
+ };
508
+ switch (data.dataType) {
509
+ case 7:
510
+ if (data.typeName === "workOrderList") {
511
+ return includesValue(data.workTimeName);
512
+ } else {
513
+ return includesValue(data.dailyCheckName);
514
+ }
515
+ case 6:
516
+ return includesValue(data.deviceUserName) || includesValue(data.item?.deviceId);
517
+ case 5:
518
+ return includesValue(data.jobNum) || includesValue(data.name) || includesValue(data.phone);
519
+ case 4:
520
+ case 11:
521
+ return includesValue(data.groupName);
522
+ case 8:
523
+ return includesValue(data.sname);
524
+ case 3:
525
+ return includesValue(data.deviceId) || includesValue(data.devName) || includesValue(data.name) || includesValue(data.deviceCode) || includesValue(data.imei);
526
+ default:
527
+ return includesValue(data.companyName) || includesValue(data.orgName);
528
+ }
529
+ }
530
+
531
+ export { useAppTreeWrapper };
@@ -55,9 +55,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
55
55
  const props = __props;
56
56
  const { t } = useLocale();
57
57
  const { userAvatarMap } = useUserAvatarMap();
58
+ const isGbDevice = computed(
59
+ () => props.device?.gbDevice === 1 && (props.device?.deviceType || props.device?.type) !== 13
60
+ );
58
61
  const headImg = computed(() => {
59
- var _a;
60
- return props.device && ((_a = unref(userAvatarMap)) == null ? void 0 : _a.get(props.device.deviceId));
62
+ return props.device && unref(userAvatarMap)?.get(props.device.deviceId);
61
63
  });
62
64
  function parseRem(res) {
63
65
  let px = res;
@@ -71,24 +73,23 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
71
73
  return "";
72
74
  }
73
75
  return (_ctx, _cache) => {
74
- var _a, _b, _c, _d, _e, _f;
75
76
  return openBlock(), createElementBlock(
76
77
  "div",
77
78
  {
78
79
  style: normalizeStyle({
79
80
  width: `${parseRem(__props.width)}rem`,
80
81
  height: `${parseRem(__props.height)}rem`,
81
- "border-color": ((_a = __props.device) == null ? void 0 : _a.onlineState) === 1 ? __props.audioContextType ? "rgb(var(--hy-theme))" : ((_b = __props.device) == null ? void 0 : _b.gbDevice) === 1 ? "#FDE777" : "rgb(var(--hy-auxiliary))" : "rgb(var(--hy-info))"
82
+ "border-color": __props.device?.onlineState === 1 ? __props.audioContextType ? "rgb(var(--hy-theme))" : isGbDevice.value ? "#FDE777" : "rgb(var(--hy-auxiliary))" : "rgb(var(--hy-info))"
82
83
  }),
83
84
  class: "app-user-avatar"
84
85
  },
85
86
  [
86
- ((_c = __props.device) == null ? void 0 : _c.gbDevice) === 1 ? (openBlock(), createElementBlock(
87
+ isGbDevice.value ? (openBlock(), createElementBlock(
87
88
  "div",
88
89
  {
89
90
  key: 0,
90
91
  style: normalizeStyle(
91
- ((_d = __props.device) == null ? void 0 : _d.onlineState) === 1 ? "background:linear-gradient(180deg, #5A2120 0%, #C81F12 100%); color:#FDE777;" : "background: rgb(var(--hy-background-2)); color: rgb(var(--hy-auxiliary));"
92
+ __props.device?.onlineState === 1 ? "background:linear-gradient(180deg, #5A2120 0%, #C81F12 100%); color:#FDE777;" : "background: rgb(var(--hy-background-2)); color: rgb(var(--hy-auxiliary));"
92
93
  ),
93
94
  class: "user-avatar font-[600] text-base"
94
95
  },
@@ -103,7 +104,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
103
104
  key: 0,
104
105
  src: headImg.value,
105
106
  alt: unref(t)("userAvatar.userAvatar")
106
- }, null, 8, ["src", "alt"])) : ((_e = __props.device) == null ? void 0 : _e.onlineState) === 1 ? (openBlock(), createBlock(unref(AppIcon), {
107
+ }, null, 8, ["src", "alt"])) : __props.device?.onlineState === 1 ? (openBlock(), createBlock(unref(AppIcon), {
107
108
  key: 1,
108
109
  "svg-name": __props.initSelectSvgName,
109
110
  className: "svgBox"
@@ -118,7 +119,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
118
119
  {
119
120
  key: 2,
120
121
  class: normalizeClass(
121
- ((_f = __props.device) == null ? void 0 : _f.onlineState) === 1 ? "bg-success shadow-[0_0_4px_0] shadow-success" : "bg-info"
122
+ __props.device?.onlineState === 1 ? "bg-success shadow-[0_0_4px_0] shadow-success" : "bg-info"
122
123
  )
123
124
  },
124
125
  null,
@@ -2,7 +2,6 @@
2
2
  background: rgb(var(--hy-background-2));
3
3
  position: relative;
4
4
  border: 1px solid rgb(var(--hy-main));
5
- box-sizing: border-box;
6
5
  flex-shrink: 0;
7
6
  border-radius: 50%;
8
7
  .user-avatar {