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