hy-dispatch-ui-v3 0.2.64 → 0.2.66

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 (128) hide show
  1. package/dist/tailwind.css +26 -12
  2. package/es/api/organization.mjs +43 -0
  3. package/es/bussiness/hyAcquisitionStationTree/acquisitionStationTree.vue.mjs +245 -0
  4. package/es/bussiness/hyAcquisitionStationTree/index.mjs +7 -0
  5. package/es/bussiness/hyAcquisitionStationTree/js/index.mjs +124 -0
  6. package/es/bussiness/hyAcquisitionStationTree/style/acquisitionStationTree.scss +0 -0
  7. package/es/bussiness/hyDeviceTree/deviceTree.vue.mjs +249 -0
  8. package/es/bussiness/hyDeviceTree/index.mjs +7 -0
  9. package/es/bussiness/hyDeviceTree/js/index.mjs +126 -0
  10. package/es/bussiness/hyDeviceTree/style/deviceTree.scss +0 -0
  11. package/es/bussiness/hyOrgGroupTree/index.mjs +7 -0
  12. package/es/bussiness/hyOrgGroupTree/js/index.mjs +124 -0
  13. package/es/bussiness/hyOrgGroupTree/orgGroupTree.vue.mjs +245 -0
  14. package/es/bussiness/hyOrgGroupTree/style/orgGroupTree.scss +0 -0
  15. package/es/bussiness/hyPlanGroupDeviceTree/index.mjs +7 -0
  16. package/es/bussiness/hyPlanGroupDeviceTree/js/index.mjs +124 -0
  17. package/es/bussiness/hyPlanGroupDeviceTree/planGroupDeviceTree.vue.mjs +245 -0
  18. package/es/bussiness/hyPlanGroupDeviceTree/style/planGroupDeviceTree.scss +0 -0
  19. package/es/bussiness/hyUserTree/index.mjs +7 -0
  20. package/es/bussiness/hyUserTree/js/index.mjs +126 -0
  21. package/es/bussiness/hyUserTree/style/userTree.scss +0 -0
  22. package/es/bussiness/hyUserTree/userTree.vue.mjs +239 -0
  23. package/es/bussiness/index.mjs +5 -0
  24. package/es/components/hyBatchUploadDialog/batchUploadDialog.vue.mjs +18 -16
  25. package/es/components/hyButton/button.vue.mjs +3 -2
  26. package/es/components/hyButton/style/button.scss +70 -0
  27. package/es/components/hyConfirmDialog/confirmDialog.vue.mjs +1 -2
  28. package/es/components/hyForm/cpns/formItem.vue.mjs +198 -26
  29. package/es/components/hyForm/cpns/locationSelect.vue.mjs +8 -1
  30. package/es/components/hyForm/form.vue.mjs +74 -19
  31. package/es/components/hyForm/js/index.mjs +2 -1
  32. package/es/components/hyForm/js/useAppForm.mjs +2 -2
  33. package/es/components/hyIcon/style/icon.scss +1 -0
  34. package/es/components/hyNoPermissions/noPermissions.vue.mjs +1 -1
  35. package/es/components/hyNoPermissionsMap/noPermissionsMap.vue.mjs +1 -1
  36. package/es/components/hyOrgCascader/orgCascader.vue.mjs +69 -14
  37. package/es/components/hyRadioGroup/radioGroup.vue.mjs +5 -4
  38. package/es/components/hySearch/cpns/searchItem.vue.mjs +167 -11
  39. package/es/components/hySearch/js/index.mjs +2 -1
  40. package/es/components/hySearch/search.vue.mjs +60 -9
  41. package/es/components/hyTable/cpns/columnSelect.vue.mjs +21 -22
  42. package/es/components/hyTable/cpns/virtualTable.vue.mjs +10 -15
  43. package/es/components/hyTable/js/index.mjs +5 -12
  44. package/es/components/hyTable/js/search.mjs +3 -1
  45. package/es/components/hyTable/style/table.scss +13 -0
  46. package/es/components/hyTable/table.vue.mjs +21 -9
  47. package/es/components/hyTableActionButton/tableActionButton.vue.mjs +8 -10
  48. package/es/components/hyTableForm/batchTableForm.vue.mjs +13 -3
  49. package/es/components/hyTableForm/tableForm.vue.mjs +17 -11
  50. package/es/components/hyTour/index.mjs +7 -0
  51. package/es/components/hyTour/style/tour.scss +0 -0
  52. package/es/components/hyTour/tour.vue.mjs +23 -0
  53. package/es/components/hyTree/config/tree-config.mjs +5 -2
  54. package/es/components/hyTree/js/index.mjs +75 -68
  55. package/es/components/hyTree/tree.vue.mjs +19 -36
  56. package/es/components/index.mjs +1 -0
  57. package/es/index.mjs +6 -0
  58. package/es/static/hy-svg-icons/hy-icon-ops-linear-arrow.js +10 -0
  59. package/es/style/element/hy-element.scss +24 -3
  60. package/es/style/theme.scss +1 -0
  61. package/es/utils/map/hook/bigMap.mjs +9 -1
  62. package/es/utils/map/hook/gaode.mjs +9 -1
  63. package/es/utils/map/hook/leafletjs.mjs +10 -1
  64. package/es/version.mjs +1 -1
  65. package/lib/api/organization.js +47 -0
  66. package/lib/bussiness/hyAcquisitionStationTree/acquisitionStationTree.vue.js +249 -0
  67. package/lib/bussiness/hyAcquisitionStationTree/index.js +12 -0
  68. package/lib/bussiness/hyAcquisitionStationTree/js/index.js +126 -0
  69. package/lib/bussiness/hyAcquisitionStationTree/style/acquisitionStationTree.scss +0 -0
  70. package/lib/bussiness/hyDeviceTree/deviceTree.vue.js +253 -0
  71. package/lib/bussiness/hyDeviceTree/index.js +12 -0
  72. package/lib/bussiness/hyDeviceTree/js/index.js +128 -0
  73. package/lib/bussiness/hyDeviceTree/style/deviceTree.scss +0 -0
  74. package/lib/bussiness/hyOrgGroupTree/index.js +12 -0
  75. package/lib/bussiness/hyOrgGroupTree/js/index.js +126 -0
  76. package/lib/bussiness/hyOrgGroupTree/orgGroupTree.vue.js +249 -0
  77. package/lib/bussiness/hyOrgGroupTree/style/orgGroupTree.scss +0 -0
  78. package/lib/bussiness/hyPlanGroupDeviceTree/index.js +12 -0
  79. package/lib/bussiness/hyPlanGroupDeviceTree/js/index.js +126 -0
  80. package/lib/bussiness/hyPlanGroupDeviceTree/planGroupDeviceTree.vue.js +249 -0
  81. package/lib/bussiness/hyPlanGroupDeviceTree/style/planGroupDeviceTree.scss +0 -0
  82. package/lib/bussiness/hyUserTree/index.js +12 -0
  83. package/lib/bussiness/hyUserTree/js/index.js +128 -0
  84. package/lib/bussiness/hyUserTree/style/userTree.scss +0 -0
  85. package/lib/bussiness/hyUserTree/userTree.vue.js +243 -0
  86. package/lib/bussiness/index.js +14 -4
  87. package/lib/components/hyBatchUploadDialog/batchUploadDialog.vue.js +18 -16
  88. package/lib/components/hyButton/button.vue.js +3 -2
  89. package/lib/components/hyButton/style/button.scss +70 -0
  90. package/lib/components/hyConfirmDialog/confirmDialog.vue.js +0 -1
  91. package/lib/components/hyForm/cpns/formItem.vue.js +195 -23
  92. package/lib/components/hyForm/cpns/locationSelect.vue.js +8 -1
  93. package/lib/components/hyForm/form.vue.js +72 -17
  94. package/lib/components/hyForm/js/index.js +2 -0
  95. package/lib/components/hyForm/js/useAppForm.js +2 -2
  96. package/lib/components/hyIcon/style/icon.scss +1 -0
  97. package/lib/components/hyNoPermissions/noPermissions.vue.js +1 -1
  98. package/lib/components/hyNoPermissionsMap/noPermissionsMap.vue.js +1 -1
  99. package/lib/components/hyOrgCascader/orgCascader.vue.js +67 -12
  100. package/lib/components/hyRadioGroup/radioGroup.vue.js +5 -4
  101. package/lib/components/hySearch/cpns/searchItem.vue.js +164 -8
  102. package/lib/components/hySearch/js/index.js +2 -0
  103. package/lib/components/hySearch/search.vue.js +58 -7
  104. package/lib/components/hyTable/cpns/columnSelect.vue.js +20 -21
  105. package/lib/components/hyTable/cpns/virtualTable.vue.js +27 -32
  106. package/lib/components/hyTable/js/index.js +5 -12
  107. package/lib/components/hyTable/js/search.js +3 -1
  108. package/lib/components/hyTable/style/table.scss +13 -0
  109. package/lib/components/hyTable/table.vue.js +20 -8
  110. package/lib/components/hyTableActionButton/tableActionButton.vue.js +7 -9
  111. package/lib/components/hyTableForm/batchTableForm.vue.js +13 -3
  112. package/lib/components/hyTableForm/tableForm.vue.js +18 -12
  113. package/lib/components/hyTour/index.js +12 -0
  114. package/lib/components/hyTour/style/tour.scss +0 -0
  115. package/lib/components/hyTour/tour.vue.js +27 -0
  116. package/lib/components/hyTree/config/tree-config.js +5 -2
  117. package/lib/components/hyTree/js/index.js +75 -68
  118. package/lib/components/hyTree/tree.vue.js +19 -36
  119. package/lib/components/index.js +8 -6
  120. package/lib/index.js +67 -55
  121. package/lib/static/hy-svg-icons/hy-icon-ops-linear-arrow.js +10 -0
  122. package/lib/style/element/hy-element.scss +24 -3
  123. package/lib/style/theme.scss +1 -0
  124. package/lib/utils/map/hook/bigMap.js +9 -1
  125. package/lib/utils/map/hook/gaode.js +9 -1
  126. package/lib/utils/map/hook/leafletjs.js +10 -1
  127. package/lib/version.js +1 -1
  128. package/package.json +1 -1
@@ -0,0 +1,249 @@
1
+ import { defineComponent, useSlots, openBlock, createElementBlock, createCommentVNode, createVNode, unref, mergeProps, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps } from 'vue';
2
+ import '../../components/index.mjs';
3
+ import '../../hooks/index.mjs';
4
+ import { useDeviceTree } from './js/index.mjs';
5
+ import { useMixins } from '../../hooks/useMixins.mjs';
6
+ import { HyTree } from '../../components/hyTree/index.mjs';
7
+
8
+ import "./style/deviceTree.scss";
9
+
10
+ const __default__ = defineComponent({
11
+ name: "HyDeviceTree"
12
+ });
13
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
14
+ props: {
15
+ // 数据获取类型 custom 自定义数据
16
+ type: {
17
+ type: String,
18
+ default: "default"
19
+ },
20
+ // 树形类型
21
+ treeType: {
22
+ type: String,
23
+ default: "device"
24
+ },
25
+ // 请求的额外参数
26
+ requestParams: {
27
+ type: Object,
28
+ default: () => ({})
29
+ },
30
+ /* 禁止选择 */
31
+ disableSelection: {
32
+ type: Array,
33
+ default: () => {
34
+ return [];
35
+ }
36
+ },
37
+ // 是否开启按照设备在线和离线状态排序,仅支持 device 和 groupDevice 业务类型
38
+ deviceOrderSort: {
39
+ type: Boolean,
40
+ default: true
41
+ },
42
+ // 设置勤务状态
43
+ getDutyRoster: {
44
+ type: Boolean,
45
+ default: false
46
+ },
47
+ // 仅展示在线数据
48
+ showOnlineOnly: {
49
+ type: Boolean,
50
+ default: false
51
+ },
52
+ /* 是否开启多选框 */
53
+ showCheckbox: {
54
+ type: Boolean,
55
+ default: true
56
+ },
57
+ /* 是否开启单选框 */
58
+ showSinglebox: {
59
+ type: Boolean,
60
+ default: false
61
+ },
62
+ // 是否清除无数据的部门
63
+ clearEmptyBusiness: {
64
+ type: Boolean,
65
+ default: false
66
+ },
67
+ // 是否显示通道节点的选择框
68
+ isShowChannelSelect: {
69
+ type: Boolean,
70
+ default: false
71
+ },
72
+ // 是否显示自定义空数据显示
73
+ showCustomEmpty: {
74
+ type: Boolean,
75
+ default: false
76
+ },
77
+ placeholder: {
78
+ type: String,
79
+ default: "\u8BF7\u8F93\u5165"
80
+ },
81
+ // 是否返回默认选择的数据
82
+ isBackDefaultSelected: {
83
+ type: Boolean,
84
+ default: false
85
+ },
86
+ /* 默认选中列表 */
87
+ selectedByDefault: {
88
+ type: Array,
89
+ default: () => {
90
+ return [];
91
+ }
92
+ },
93
+ // 默认需要选中的部门ID
94
+ defaultSelectedOrgID: {
95
+ default: null
96
+ },
97
+ // 搜索类型
98
+ searchType: {
99
+ type: Number,
100
+ default: 1
101
+ },
102
+ // 筛选列表
103
+ selectFilterList: {
104
+ type: Array,
105
+ default: () => []
106
+ },
107
+ // 是否高亮选中节点
108
+ highlight: {
109
+ type: Boolean,
110
+ default: false
111
+ },
112
+ // 是否严格的遵循父子不互相关联
113
+ checkStrictly: {
114
+ type: Boolean,
115
+ default: false
116
+ },
117
+ // 单选时可以取消选中
118
+ cancelable: {
119
+ type: Boolean,
120
+ default: true
121
+ },
122
+ // 是否显示多选框或单选框
123
+ showSelectBox: {
124
+ type: Boolean,
125
+ default: true
126
+ },
127
+ // 是否在点击节点的时候展开或者收缩节点
128
+ expandOnClickNode: {
129
+ type: Boolean,
130
+ default: true
131
+ },
132
+ // 是否在点击节点的时候选中节点
133
+ checkOnClickNode: {
134
+ type: Boolean,
135
+ default: false
136
+ },
137
+ // 点击叶节点(最后一个子节点)时是否检查或取消节点
138
+ checkOnClickLeaf: {
139
+ type: Boolean,
140
+ default: true
141
+ },
142
+ // 双击父节点会触发选中功能
143
+ checkOnDblclickParentNode: {
144
+ type: Boolean,
145
+ default: true
146
+ },
147
+ // 初始化过滤数据
148
+ filterConfig: {
149
+ type: Array,
150
+ default: () => []
151
+ },
152
+ // 外部自定义过滤函数
153
+ filterMethod: {
154
+ type: Function,
155
+ default: null
156
+ }
157
+ },
158
+ emits: [
159
+ "on-load",
160
+ "onRefreshData",
161
+ "on-click-delete",
162
+ "on-click",
163
+ "on-check-tree",
164
+ "on-department-click",
165
+ "on-click-device",
166
+ "on-contextmenu",
167
+ "on-dblclick",
168
+ "on-selectedDataList"
169
+ ],
170
+ setup(__props, { expose: __expose, emit: __emit }) {
171
+ const props = __props;
172
+ const emits = __emit;
173
+ const slots = useSlots();
174
+ const {
175
+ containerRef,
176
+ hyTreeRef,
177
+ treeHeight,
178
+ setData,
179
+ getData,
180
+ onClickDelete,
181
+ onClick,
182
+ onCheckTree,
183
+ onDepartmentClick,
184
+ onClickDevice,
185
+ onContextmenu,
186
+ onDblclick,
187
+ onSelectedDataList,
188
+ singleRemovalFn,
189
+ setCheckedKeys,
190
+ setChecked,
191
+ getSelectedDataList,
192
+ refreshData,
193
+ getNode
194
+ } = useMixins({ props, emits }, [useDeviceTree]);
195
+ __expose({
196
+ getData,
197
+ singleRemovalFn,
198
+ setCheckedKeys,
199
+ setChecked,
200
+ getSelectedDataList,
201
+ refreshData,
202
+ getNode
203
+ });
204
+ return (_ctx, _cache) => {
205
+ return openBlock(), createElementBlock(
206
+ "div",
207
+ {
208
+ ref_key: "containerRef",
209
+ ref: containerRef,
210
+ class: "w-full h-full"
211
+ },
212
+ [
213
+ createCommentVNode(" HyDeviceTree \u8BBE\u5907\u6811\u5F62 "),
214
+ createVNode(unref(HyTree), mergeProps({
215
+ ref_key: "hyTreeRef",
216
+ ref: hyTreeRef
217
+ }, { ...props }, {
218
+ treeHeight: unref(treeHeight),
219
+ onOnRefreshData: unref(setData),
220
+ onOnClickDelete: unref(onClickDelete),
221
+ onOnClick: unref(onClick),
222
+ onOnCheckTree: unref(onCheckTree),
223
+ onOnDepartmentClick: unref(onDepartmentClick),
224
+ onOnClickDevice: unref(onClickDevice),
225
+ onOnContextmenu: unref(onContextmenu),
226
+ onOnDblclick: unref(onDblclick),
227
+ onOnSelectedDataList: unref(onSelectedDataList)
228
+ }), createSlots({
229
+ _: 2
230
+ /* DYNAMIC */
231
+ }, [
232
+ renderList(unref(slots), (_, slotName) => {
233
+ return {
234
+ name: slotName,
235
+ fn: withCtx((scope) => [
236
+ renderSlot(_ctx.$slots, slotName, normalizeProps(guardReactiveProps(scope)))
237
+ ])
238
+ };
239
+ })
240
+ ]), 1040, ["treeHeight", "onOnRefreshData", "onOnClickDelete", "onOnClick", "onOnCheckTree", "onOnDepartmentClick", "onOnClickDevice", "onOnContextmenu", "onOnDblclick", "onOnSelectedDataList"])
241
+ ],
242
+ 512
243
+ /* NEED_PATCH */
244
+ );
245
+ };
246
+ }
247
+ });
248
+
249
+ export { _sfc_main as default };
@@ -0,0 +1,7 @@
1
+ import _sfc_main from './deviceTree.vue.mjs';
2
+ import '../../utils/index.mjs';
3
+ import { withInstall } from '../../utils/handler.mjs';
4
+
5
+ const HyDeviceTree = withInstall(_sfc_main);
6
+
7
+ export { HyDeviceTree, HyDeviceTree as default };
@@ -0,0 +1,126 @@
1
+ import { useTemplateRef, ref, onMounted, nextTick, onUnmounted } from 'vue';
2
+ import { orgListWithDev3Api } from '../../../api/organization.mjs';
3
+
4
+ function useDeviceTree(hy) {
5
+ const emits = hy.emits;
6
+ const props = hy.props;
7
+ const hyTreeRef = useTemplateRef("hyTreeRef");
8
+ const containerRef = useTemplateRef("containerRef");
9
+ const treeHeight = ref(400);
10
+ let resizeObserver;
11
+ function updateTreeHeight() {
12
+ const height = hy.containerRef.value?.getBoundingClientRect().height;
13
+ if (height > 0 && height - 12 !== hy.treeHeight.value) {
14
+ hy.treeHeight.value = Math.round(height) - 12;
15
+ }
16
+ }
17
+ async function setData() {
18
+ if (props.type === "custom") {
19
+ emits("onRefreshData");
20
+ return;
21
+ }
22
+ const data = await orgListWithDev3Api({
23
+ showDevice: true,
24
+ showGroup: false,
25
+ ...props.requestParams
26
+ });
27
+ hy.hyTreeRef.value.getData(data).then(() => {
28
+ emits("on-load");
29
+ });
30
+ }
31
+ function getData(data) {
32
+ return new Promise((resolve) => {
33
+ hy.hyTreeRef.value.getData(data).then(() => {
34
+ emits("on-load");
35
+ resolve(200);
36
+ });
37
+ });
38
+ }
39
+ onMounted(() => {
40
+ if (props.type !== "custom") {
41
+ hy.setData();
42
+ }
43
+ nextTick(() => {
44
+ hy.updateTreeHeight();
45
+ if (typeof ResizeObserver === "function" && hy.containerRef.value) {
46
+ hy.resizeObserver = new ResizeObserver(hy.updateTreeHeight);
47
+ hy.resizeObserver.observe(hy.containerRef.value);
48
+ } else if (typeof window !== "undefined") {
49
+ window.addEventListener("resize", hy.updateTreeHeight);
50
+ }
51
+ });
52
+ });
53
+ onUnmounted(() => {
54
+ hy.resizeObserver?.disconnect();
55
+ if (typeof window !== "undefined") {
56
+ window.removeEventListener("resize", hy.updateTreeHeight);
57
+ }
58
+ });
59
+ function onClickDelete(data) {
60
+ emits("on-click-delete", data);
61
+ }
62
+ function onClick(data) {
63
+ emits("on-click", data);
64
+ }
65
+ function onCheckTree(list, checkObj) {
66
+ emits("on-check-tree", list, checkObj);
67
+ }
68
+ function onDepartmentClick(data) {
69
+ emits("on-department-click", data);
70
+ }
71
+ function onClickDevice(data) {
72
+ emits("on-click-device", data);
73
+ }
74
+ function onContextmenu(data) {
75
+ emits("on-contextmenu", data);
76
+ }
77
+ function onDblclick(list) {
78
+ emits("on-dblclick", list);
79
+ }
80
+ function onSelectedDataList(list) {
81
+ emits("on-selectedDataList", list);
82
+ }
83
+ function singleRemovalFn(row, isForce = false) {
84
+ hy.hyTreeRef.value.singleRemovalFn(row, isForce);
85
+ }
86
+ function setCheckedKeys(dataList, isForce = false) {
87
+ hy.hyTreeRef.value.setCheckedKeys(dataList, isForce);
88
+ }
89
+ function setChecked(data, type = true) {
90
+ hy.hyTreeRef.value.setChecked(data, type);
91
+ }
92
+ function getSelectedDataList(leafOnly = false) {
93
+ return hy.hyTreeRef.value.getSelectedDataList(leafOnly);
94
+ }
95
+ function refreshData() {
96
+ hy.hyTreeRef.value.refreshData();
97
+ }
98
+ function getNode(id) {
99
+ return hy.hyTreeRef.value.getNode(id);
100
+ }
101
+ return {
102
+ hyTreeRef,
103
+ containerRef,
104
+ treeHeight,
105
+ resizeObserver,
106
+ updateTreeHeight,
107
+ setData,
108
+ getData,
109
+ onClickDelete,
110
+ onClick,
111
+ onCheckTree,
112
+ onDepartmentClick,
113
+ onClickDevice,
114
+ onContextmenu,
115
+ onDblclick,
116
+ onSelectedDataList,
117
+ singleRemovalFn,
118
+ setCheckedKeys,
119
+ setChecked,
120
+ getSelectedDataList,
121
+ refreshData,
122
+ getNode
123
+ };
124
+ }
125
+
126
+ export { useDeviceTree };
@@ -0,0 +1,7 @@
1
+ import _sfc_main from './orgGroupTree.vue.mjs';
2
+ import '../../utils/index.mjs';
3
+ import { withInstall } from '../../utils/handler.mjs';
4
+
5
+ const HyOrgGroupTree = withInstall(_sfc_main);
6
+
7
+ export { HyOrgGroupTree, HyOrgGroupTree as default };
@@ -0,0 +1,124 @@
1
+ import { useTemplateRef, ref, onMounted, nextTick, onUnmounted } from 'vue';
2
+ import { orgTreeWithGroupAndDeviceApi } from '../../../api/organization.mjs';
3
+
4
+ function useOrgGroupTree(hy) {
5
+ const emits = hy.emits;
6
+ const props = hy.props;
7
+ const hyTreeRef = useTemplateRef("hyTreeRef");
8
+ const containerRef = useTemplateRef("containerRef");
9
+ const treeHeight = ref(400);
10
+ let resizeObserver;
11
+ function updateTreeHeight() {
12
+ const height = hy.containerRef.value?.getBoundingClientRect().height;
13
+ if (height > 0 && height - 12 !== hy.treeHeight.value) {
14
+ hy.treeHeight.value = Math.round(height) - 12;
15
+ }
16
+ }
17
+ async function setData() {
18
+ if (props.type === "custom") {
19
+ emits("onRefreshData");
20
+ return;
21
+ }
22
+ const data = await orgTreeWithGroupAndDeviceApi({
23
+ ...props.requestParams
24
+ });
25
+ hy.hyTreeRef.value.getData(data).then(() => {
26
+ emits("on-load");
27
+ });
28
+ }
29
+ function getData(data) {
30
+ return new Promise((resolve) => {
31
+ hy.hyTreeRef.value.getData(data).then(() => {
32
+ emits("on-load");
33
+ resolve(200);
34
+ });
35
+ });
36
+ }
37
+ onMounted(() => {
38
+ if (props.type !== "custom") {
39
+ hy.setData();
40
+ }
41
+ nextTick(() => {
42
+ hy.updateTreeHeight();
43
+ if (typeof ResizeObserver === "function" && hy.containerRef.value) {
44
+ hy.resizeObserver = new ResizeObserver(hy.updateTreeHeight);
45
+ hy.resizeObserver.observe(hy.containerRef.value);
46
+ } else if (typeof window !== "undefined") {
47
+ window.addEventListener("resize", hy.updateTreeHeight);
48
+ }
49
+ });
50
+ });
51
+ onUnmounted(() => {
52
+ hy.resizeObserver?.disconnect();
53
+ if (typeof window !== "undefined") {
54
+ window.removeEventListener("resize", hy.updateTreeHeight);
55
+ }
56
+ });
57
+ function onClickDelete(data) {
58
+ emits("on-click-delete", data);
59
+ }
60
+ function onClick(data) {
61
+ emits("on-click", data);
62
+ }
63
+ function onCheckTree(list, checkObj) {
64
+ emits("on-check-tree", list, checkObj);
65
+ }
66
+ function onDepartmentClick(data) {
67
+ emits("on-department-click", data);
68
+ }
69
+ function onClickDevice(data) {
70
+ emits("on-click-device", data);
71
+ }
72
+ function onContextmenu(data) {
73
+ emits("on-contextmenu", data);
74
+ }
75
+ function onDblclick(list) {
76
+ emits("on-dblclick", list);
77
+ }
78
+ function onSelectedDataList(list) {
79
+ emits("on-selectedDataList", list);
80
+ }
81
+ function singleRemovalFn(row, isForce = false) {
82
+ hy.hyTreeRef.value.singleRemovalFn(row, isForce);
83
+ }
84
+ function setCheckedKeys(dataList, isForce = false) {
85
+ hy.hyTreeRef.value.setCheckedKeys(dataList, isForce);
86
+ }
87
+ function setChecked(data, type = true) {
88
+ hy.hyTreeRef.value.setChecked(data, type);
89
+ }
90
+ function getSelectedDataList(leafOnly = false) {
91
+ return hy.hyTreeRef.value.getSelectedDataList(leafOnly);
92
+ }
93
+ function refreshData() {
94
+ hy.hyTreeRef.value.refreshData();
95
+ }
96
+ function getNode(id) {
97
+ return hy.hyTreeRef.value.getNode(id);
98
+ }
99
+ return {
100
+ hyTreeRef,
101
+ containerRef,
102
+ treeHeight,
103
+ resizeObserver,
104
+ updateTreeHeight,
105
+ setData,
106
+ getData,
107
+ onClickDelete,
108
+ onClick,
109
+ onCheckTree,
110
+ onDepartmentClick,
111
+ onClickDevice,
112
+ onContextmenu,
113
+ onDblclick,
114
+ onSelectedDataList,
115
+ singleRemovalFn,
116
+ setCheckedKeys,
117
+ setChecked,
118
+ getSelectedDataList,
119
+ refreshData,
120
+ getNode
121
+ };
122
+ }
123
+
124
+ export { useOrgGroupTree };