hy-dispatch-ui-v3 0.2.63 → 0.2.65

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.
@@ -6,7 +6,6 @@ require('../../../utils/index.js');
6
6
  require('../../index.js');
7
7
  var is = require('../../../utils/is.js');
8
8
  var useLocale = require('../../../hooks/useLocale.js');
9
- var usePermissionMap = require('../../../hooks/usePermissionMap.js');
10
9
  var index = require('../../hyLoading/index.js');
11
10
 
12
11
  function tableColumnShowHandler(column) {
@@ -155,7 +154,6 @@ const useAppTableWrapper = (hy) => {
155
154
  tableDropdownRef,
156
155
  operatorDropdownRef
157
156
  } = hy;
158
- const { permissionMap } = usePermissionMap.usePermissionMap();
159
157
  const { t } = useLocale.useLocale();
160
158
  const CACHE_COLUMNS_KEY = props.controller || props.url || "CACHE_COLUMNS_KEY";
161
159
  const tableDataSource = vue.ref([]);
@@ -265,6 +263,73 @@ const useAppTableWrapper = (hy) => {
265
263
  operatorDropdownRef.value?.handleClose();
266
264
  }
267
265
  }
266
+ const expandRowKeys = vue.ref([]);
267
+ const expandRowKeyMap = vue.computed(() => {
268
+ return expandRowKeys.value.reduce((keyMap, key, index) => {
269
+ keyMap.set(key, index);
270
+ return keyMap;
271
+ }, /* @__PURE__ */ new Map());
272
+ });
273
+ const isExpandTable = vue.computed(() => {
274
+ if (props.type === "default") {
275
+ return tableColumnsList.value.some((column) => column.type === "expand");
276
+ } else if (props.type === "virtual") {
277
+ return tableColumnsList.value.some(
278
+ (column) => column.type === "expand" && column.expandType === "expand"
279
+ );
280
+ }
281
+ return false;
282
+ });
283
+ const isAccordionMode = vue.computed(() => {
284
+ return isExpandTable.value && props.expandMode === "accordion";
285
+ });
286
+ function setRowExpansion(list = []) {
287
+ const keys = (list || []).map((item) => {
288
+ return is.isString(item) || is.isNumber(item) ? item : getRowKey(item);
289
+ }).filter(Boolean);
290
+ expandRowKeys.value = isAccordionMode.value ? [keys[0]] : keys;
291
+ }
292
+ function toggleRowExpansion(row, expanded) {
293
+ const key = is.isString(row) || is.isNumber(row) ? row : getRowKey(row);
294
+ const index = expandRowKeyMap.value.get(key);
295
+ const isExpanded = is.isBoolean(expanded) ? expanded : !is.isNumber(index);
296
+ if (isAccordionMode.value) {
297
+ if (isExpanded) {
298
+ expandRowKeys.value = [key];
299
+ } else if (index >= 0) {
300
+ expandRowKeys.value = [];
301
+ }
302
+ } else {
303
+ if (isExpanded && !is.isNumber(index)) {
304
+ expandRowKeys.value.push(key);
305
+ } else if (!isExpanded && is.isNumber(index)) {
306
+ expandRowKeys.value.splice(index, 1);
307
+ }
308
+ }
309
+ emits("expand-change", row, isExpanded);
310
+ }
311
+ function onTableRowExpandChangeHandler(row, expandedRows) {
312
+ if (props.type === "virtual") {
313
+ toggleRowExpansion(row, expandedRows);
314
+ } else {
315
+ let isExpanded = false;
316
+ if (!isExpandTable.value) {
317
+ const key = getRowKey(row);
318
+ const index = expandRowKeyMap.value.get(key);
319
+ if (expandedRows && !is.isNumber(index)) {
320
+ expandRowKeys.value.push(key);
321
+ isExpanded = true;
322
+ } else if (!expandedRows && is.isNumber(index)) {
323
+ expandRowKeys.value.splice(index, 1);
324
+ isExpanded = false;
325
+ }
326
+ } else {
327
+ isExpanded = isAccordionMode.value && expandedRows.length > 1 || expandRowKeys.value.length > expandedRows.length;
328
+ expandRowKeys.value = isAccordionMode.value && expandedRows.length > 1 ? [getRowKey(row)] : expandedRows.map((item) => getRowKey(item));
329
+ }
330
+ emits("expand-change", row, isExpanded);
331
+ }
332
+ }
268
333
  const selectedList = vue.ref([]);
269
334
  const selectedMap = vue.computed(() => {
270
335
  return (selectedList.value || []).reduce((map, row, index) => {
@@ -341,22 +406,6 @@ const useAppTableWrapper = (hy) => {
341
406
  }
342
407
  return className.filter(Boolean).join(" ");
343
408
  }
344
- function toggleRowExpansion(row) {
345
- if (tableRef.value && tableColumns.value.some((column) => column.type === "expand")) {
346
- tableRef.value.toggleRowExpansion(row);
347
- }
348
- }
349
- function onTableRowExpandChangeHandler(row, expandedRows) {
350
- if (is.isBoolean(expandedRows) || props.expandMode !== "accordion" || expandedRows.length <= 1) {
351
- props.onExpandChange && props.onExpandChange(row, expandedRows);
352
- return;
353
- } else {
354
- expandedRows.forEach((item) => {
355
- if (getRowKey(row) === getRowKey(item)) return;
356
- toggleRowExpansion(item);
357
- });
358
- }
359
- }
360
409
  const isSearchFocus = vue.ref(false);
361
410
  function onSearchInputHandler() {
362
411
  isSearchFocus.value = true;
@@ -388,10 +437,13 @@ const useAppTableWrapper = (hy) => {
388
437
  getSelectedList,
389
438
  clearSelection,
390
439
  clearSelectedList,
440
+ expandRowKeys,
441
+ expandRowKeyMap,
442
+ setRowExpansion,
391
443
  toggleRowExpansion,
444
+ onTableRowExpandChangeHandler,
392
445
  onTableSelectHandler,
393
446
  onTableRowContextmenuHandler,
394
- onTableRowExpandChangeHandler,
395
447
  onTableRowClickHandler,
396
448
  onTableColumnsSelectHandler,
397
449
  // 搜索选中
@@ -28,7 +28,8 @@ function getColumnDefaultConfig(column) {
28
28
  case "operator":
29
29
  return {
30
30
  label: t("table.operator"),
31
- prop: `operator_prop`
31
+ prop: `operator_prop`,
32
+ fixed: "right"
32
33
  };
33
34
  default:
34
35
  return {};
@@ -113,8 +114,8 @@ const useAppTable = (config = {}) => {
113
114
  try {
114
115
  for (let i = 0; i < columns?.length; i++) {
115
116
  const column = columns[i];
116
- if (is.isEmpty(column.prop) && column.type === "default") {
117
- throw Error("\u3010column.prop\u3011\u4E0D\u80FD\u4E3A\u7A7A");
117
+ if (is.isEmpty(column.prop) && !/^(selection|index|expand|operator)$/.test(column.type)) {
118
+ console.error("\u3010column.prop\u3011\u4E0D\u80FD\u4E3A\u7A7A");
118
119
  }
119
120
  const sort = getColumnSort(column);
120
121
  if (!defaultSortInfo && sort.default) {
@@ -192,10 +192,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
192
192
  type: String,
193
193
  default: "default"
194
194
  // deafult-默认 accordion-手风琴
195
- },
196
- onExpandChange: {
197
- // 展开回调
198
- type: Function
199
195
  }
200
196
  }, {
201
197
  "loading": { type: Boolean, default: false },
@@ -204,6 +200,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
204
200
  emits: /* @__PURE__ */ vue.mergeModels([
205
201
  "row-click",
206
202
  "select-all",
203
+ "expand-change",
207
204
  "on-select-checkbox",
208
205
  "reqSuccess",
209
206
  "search-data"
@@ -234,6 +231,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
234
231
  setTableRowClassName,
235
232
  clearSelection,
236
233
  clearSelectedList,
234
+ expandRowKeys,
235
+ expandRowKeyMap,
236
+ setRowExpansion,
237
237
  toggleRowExpansion,
238
238
  onTableRowClickHandler,
239
239
  onTableRowContextmenuHandler,
@@ -285,6 +285,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
285
285
  getTableDataSource,
286
286
  clearSelection,
287
287
  clearSelectedList,
288
+ setRowExpansion,
288
289
  toggleRowExpansion,
289
290
  showAppTableLoading,
290
291
  closeAppTableLoading
@@ -413,6 +414,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
413
414
  style: {
414
415
  "font-size": `${vue.unref(adaptive.parseRem)(__props.fontSize)}rem`
415
416
  },
417
+ "expand-row-keys": vue.unref(expandRowKeys),
416
418
  onSelect: vue.unref(onTableSelectHandler),
417
419
  onSelectAll: vue.unref(onTableSelectHandler),
418
420
  onRowClick: vue.unref(onTableRowClickHandler),
@@ -665,13 +667,16 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
665
667
  ]),
666
668
  _: 3
667
669
  /* FORWARDED */
668
- }, 16, ["row-key", "data", "show-header", "row-class-name", "class", "style", "onSelect", "onSelectAll", "onRowClick", "onRowContextmenu", "onExpandChange"])) : vue.createCommentVNode("v-if", true),
670
+ }, 16, ["row-key", "data", "show-header", "row-class-name", "class", "style", "expand-row-keys", "onSelect", "onSelectAll", "onRowClick", "onRowContextmenu", "onExpandChange"])) : vue.createCommentVNode("v-if", true),
669
671
  __props.type === "virtual" ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElAutoResizer), { key: 1 }, {
670
672
  default: vue.withCtx(({ height, width }) => [
671
673
  vue.createVNode(virtualTable.default, vue.mergeProps({
672
674
  ref_key: "tableRef",
673
675
  ref: tableRef
674
676
  }, _ctx.$attrs, {
677
+ expandedRowKeys: vue.unref(expandRowKeys),
678
+ "onUpdate:expandedRowKeys": ($event) => vue.isRef(expandRowKeys) ? expandRowKeys.value = $event : null,
679
+ expandRowKeyMap: vue.unref(expandRowKeyMap),
675
680
  width,
676
681
  height,
677
682
  data: vue.unref(tableDataSource),
@@ -691,7 +696,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
691
696
  onSelectAll: vue.unref(onTableSelectHandler),
692
697
  onRowClick: vue.unref(onTableRowClickHandler),
693
698
  onRowContextmenu: vue.unref(onTableRowContextmenuHandler),
694
- onExpandChange: __props.onExpandChange
699
+ onExpandClick: vue.unref(onTableRowExpandChangeHandler)
695
700
  }), vue.createSlots({
696
701
  empty: vue.withCtx(() => [
697
702
  vue.createElementVNode("div", { class: "w-full h-full flex items-center justify-center border-b border-border" }, [
@@ -717,7 +722,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
717
722
  ])
718
723
  };
719
724
  })
720
- ]), 1040, ["width", "height", "data", "columns", "columns-editable", "show-header", "row-class-name", "show-all-select", "style", "row-key", "filter-model", "expandMode", "onSearch", "onSelect", "onSelectAll", "onRowClick", "onRowContextmenu", "onExpandChange"])
725
+ ]), 1040, ["expandedRowKeys", "onUpdate:expandedRowKeys", "expandRowKeyMap", "width", "height", "data", "columns", "columns-editable", "show-header", "row-class-name", "show-all-select", "style", "row-key", "filter-model", "expandMode", "onSearch", "onSelect", "onSelectAll", "onRowClick", "onRowContextmenu", "onExpandClick"])
721
726
  ]),
722
727
  _: 3
723
728
  /* FORWARDED */
@@ -122,11 +122,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
122
122
  return false;
123
123
  }
124
124
  const show = vue.unref(operate.show);
125
- if (operate.show === null || operate.show === void 0) {
126
- return true;
127
- } else {
128
- return !!show;
129
- }
125
+ if (is.isBoolean(show)) return show;
126
+ if (is.isFunction(show)) return show();
127
+ return true;
130
128
  }
131
129
  vue.watch(() => props.operateList, setSelectedData, { deep: true, immediate: true });
132
130
  __expose({});
@@ -16,7 +16,7 @@ const deviceStatus = {
16
16
  1: "\u5728\u7EBF"
17
17
  };
18
18
  const useAppTreeWrapper = (hy) => {
19
- const { props: props2, emits, slots, treeRef, VirtualTree } = hy;
19
+ const { props, emits, slots, treeRef, VirtualTree } = hy;
20
20
  const instance = vue.getCurrentInstance();
21
21
  const slotAppContext = instance ? {
22
22
  ...instance.appContext,
@@ -35,17 +35,17 @@ const useAppTreeWrapper = (hy) => {
35
35
  const selectFilterList = vue.ref([]);
36
36
  const loading = vue.ref(true);
37
37
  vue.watch(
38
- () => props2.showCheckbox,
38
+ () => props.showCheckbox,
39
39
  (newVal) => {
40
40
  virtualTree?.setRowSelection({
41
- type: props2.showCheckbox ? "checkbox" : "radio"
41
+ type: props.showCheckbox ? "checkbox" : "radio"
42
42
  });
43
43
  }
44
44
  );
45
45
  function getData(dataList) {
46
46
  return new Promise((resolve) => {
47
47
  hy.loading.value = true;
48
- if (props2.disableSelection?.length) {
48
+ if (props.disableSelection?.length) {
49
49
  setDisAbleSelectionMap();
50
50
  }
51
51
  if (!virtualTree) {
@@ -61,9 +61,9 @@ const useAppTreeWrapper = (hy) => {
61
61
  // 可视区域外的缓冲项数量
62
62
  indent: 16,
63
63
  emptyText: "\u6682\u65E0\u6570\u636E",
64
- business: props2.treeType,
64
+ business: props.treeType,
65
65
  // 自定义整体的插槽
66
- renderItem: props2.treeType === treeConfig.treeTypeConfig.user ? (data, node) => setUserSlot(data, node) : setSlot("treeParentSlot"),
66
+ renderItem: props.treeType === treeConfig.treeTypeConfig.user ? (data, node) => setUserSlot(data, node) : setSlot("treeParentSlot"),
67
67
  // // 自定义状态右侧插槽
68
68
  renderRight: (data) => {
69
69
  let renderRight = setSlot("renderRight");
@@ -89,9 +89,9 @@ const useAppTreeWrapper = (hy) => {
89
89
  return true;
90
90
  },
91
91
  // // 自定义状态模块
92
- renderStatus: props2.treeType === treeConfig.treeTypeConfig.device || props2.treeType === treeConfig.treeTypeConfig.channel ? (data) => setRenderStatus(data) : null,
92
+ renderStatus: props.treeType === treeConfig.treeTypeConfig.device || props.treeType === treeConfig.treeTypeConfig.channel ? (data) => setRenderStatus(data) : null,
93
93
  renderEmpty: () => {
94
- if (!props2.showCustomEmpty || hy.filterValue.value) return true;
94
+ if (!props.showCustomEmpty || hy.filterValue.value) return true;
95
95
  let renderEmpty = setSlot("renderEmpty");
96
96
  if (renderEmpty) {
97
97
  const target = renderEmpty();
@@ -110,23 +110,23 @@ const useAppTreeWrapper = (hy) => {
110
110
  }
111
111
  return false;
112
112
  },
113
- ...props2.treeProps
113
+ ...props.treeProps
114
114
  },
115
115
  rowSelection: {
116
- type: props2.showCheckbox ? "checkbox" : "radio",
117
- highlight: props2.highlight,
118
- checkStrictly: props2.checkStrictly,
116
+ type: props.showCheckbox ? "checkbox" : "radio",
117
+ highlight: props.highlight,
118
+ checkStrictly: props.checkStrictly,
119
119
  // 是否显示选项 showSinglebox 单选为true时部门不显示其他节点显示选择框
120
120
  showSelect: (data) => {
121
121
  if (data.dataType === 1) {
122
- return props2.showCheckbox;
122
+ return props.showCheckbox;
123
123
  }
124
- return props2.showCheckbox || props2.showSinglebox;
124
+ return props.showCheckbox || props.showSinglebox;
125
125
  },
126
126
  // 单选时是否可以取消选择
127
- cancelable: props2.cancelable,
127
+ cancelable: props.cancelable,
128
128
  // 是否显示多选框或单选框
129
- showSelectBox: props2.showSelectBox,
129
+ showSelectBox: props.showSelectBox,
130
130
  // 选中回调
131
131
  onCheckChange: (data, info, checked) => {
132
132
  console.log("onCheckChange", info);
@@ -139,42 +139,51 @@ const useAppTreeWrapper = (hy) => {
139
139
  "on-check-tree",
140
140
  JSON.parse(
141
141
  JSON.stringify(info.checkedBusinessNodes || info.checkedNodes)
142
- )
142
+ ),
143
+ {
144
+ data,
145
+ info,
146
+ checked
147
+ }
143
148
  );
144
149
  }
145
150
  },
146
151
  // 是否在点击节点的时候展开或者收缩节点
147
- expandOnClickNode: props2.expandOnClickNode,
152
+ expandOnClickNode: props.expandOnClickNode,
148
153
  // 是否在点击节点的时候选中节点
149
- checkOnClickNode: props2.checkOnClickNode,
154
+ checkOnClickNode: props.checkOnClickNode,
150
155
  // 点击叶节点(最后一个子节点)时是否检查或取消节点
151
- checkOnClickLeaf: props2.checkOnClickLeaf,
156
+ checkOnClickLeaf: props.checkOnClickLeaf,
152
157
  // 双击父节点会触发选中功能
153
- checkOnDblclickParentNode: props2.checkOnDblclickParentNode,
158
+ checkOnDblclickParentNode: props.checkOnDblclickParentNode,
154
159
  // 筛选方法
155
160
  filterMethod: ({ filterValue: filterValue2 }, data) => {
156
161
  let isFilter = true;
157
- if (props2.filterMethod) {
158
- isFilter = props2.filterMethod(data, { filterValue: filterValue2 });
162
+ console.log("111111111", isFilter, props.filterMethod);
163
+ if (props.filterMethod) {
164
+ isFilter = props.filterMethod(data, {
165
+ filterValue: filterValue2
166
+ });
159
167
  }
160
168
  if (filterValue2) {
161
169
  isFilter = isFilter && !!filterNodeMethod(data, filterValue2, {
162
- treeFilterParam: props2.treeFilterParam
170
+ treeFilterParam: props.treeFilterParam,
171
+ treeType: props.treeType
163
172
  });
164
173
  }
165
174
  return isFilter;
166
175
  },
167
176
  businessConfig: {
168
177
  // 是否开启按在线离线状态排序
169
- sortByStatus: props2.deviceOrderSort,
178
+ sortByStatus: props.deviceOrderSort,
170
179
  // 是否只显示在线设备
171
- showOnlineState: props2.showOnlineOnly,
180
+ showOnlineState: props.showOnlineOnly,
172
181
  // 是否清空没有业务项(设备、用户、采集器)的部门和群组
173
- clearEmptyBusiness: props2.clearEmptyBusiness,
182
+ clearEmptyBusiness: props.clearEmptyBusiness,
174
183
  // 是否显示通道节点的选择框
175
- isShowChannelSelect: props2.isShowChannelSelect,
184
+ isShowChannelSelect: props.isShowChannelSelect,
176
185
  // 初始化过滤数据
177
- filterConfig: props2.filterConfig
186
+ filterConfig: props.filterConfig
178
187
  },
179
188
  // 初始化时处理数据,想回显必须return值,若想要过滤,可不return
180
189
  handleMethod: (data) => {
@@ -195,7 +204,7 @@ const useAppTreeWrapper = (hy) => {
195
204
  },
196
205
  // 双击事件
197
206
  onNodeDblClick: (data, node, event) => {
198
- if (props2.treeType !== "channel") {
207
+ if (props.treeType !== "channel") {
199
208
  emits("on-dblclick", [{ ...data }]);
200
209
  } else {
201
210
  if (data.channelId) {
@@ -235,13 +244,13 @@ const useAppTreeWrapper = (hy) => {
235
244
  document.body.click();
236
245
  },
237
246
  onLoad: () => {
238
- if (props2.showOnlineOnly && !virtualTree._flattenTree?.length && !hy.filterValue.value) {
247
+ if (props.showOnlineOnly && !virtualTree._flattenTree?.length && !hy.filterValue.value) {
239
248
  elementPlus.ElMessage.warning("\u6682\u65E0\u8BBE\u5907\u5904\u4E8E\u5728\u7EBF\u72B6\u6001");
240
249
  }
241
- if (props2.defaultSelectedOrgID && props2.showCheckbox && props2.treeType === "device") {
250
+ if (props.defaultSelectedOrgID && props.showCheckbox && props.treeType === "device") {
242
251
  setSelectedOrg(dataList);
243
- } else if (props2.selectedByDefault?.length) {
244
- setCheckedKeys(props2.selectedByDefault);
252
+ } else if (props.selectedByDefault?.length) {
253
+ setCheckedKeys(props.selectedByDefault);
245
254
  }
246
255
  if (hy.filterValue.value) {
247
256
  getFilterValue();
@@ -257,13 +266,13 @@ const useAppTreeWrapper = (hy) => {
257
266
  {
258
267
  data: dataList,
259
268
  businessConfig: {
260
- sortByStatus: props2.deviceOrderSort,
261
- showOnlineState: props2.showOnlineOnly,
262
- clearEmptyBusiness: props2.clearEmptyBusiness
269
+ sortByStatus: props.deviceOrderSort,
270
+ showOnlineState: props.showOnlineOnly,
271
+ clearEmptyBusiness: props.clearEmptyBusiness
263
272
  }
264
273
  },
265
274
  () => {
266
- if (props2.showOnlineOnly && !virtualTree._flattenTree?.length && !hy.filterValue.value) {
275
+ if (props.showOnlineOnly && !virtualTree._flattenTree?.length && !hy.filterValue.value) {
267
276
  elementPlus.ElMessage.success("\u6682\u65E0\u8BBE\u5907\u5904\u4E8E\u5728\u7EBF\u72B6\u6001");
268
277
  }
269
278
  if (hy.filterValue.value) {
@@ -280,7 +289,7 @@ const useAppTreeWrapper = (hy) => {
280
289
  }
281
290
  function setEmpty() {
282
291
  let content = ``;
283
- if (!props2.showOnlineOnly) {
292
+ if (!props.showOnlineOnly) {
284
293
  setTimeout(() => {
285
294
  if (hy.addDeviceDom.value) {
286
295
  hy.addDeviceDom.value.removeEventListener("click", addDevice);
@@ -309,7 +318,7 @@ const useAppTreeWrapper = (hy) => {
309
318
  }
310
319
  function setDisAbleSelectionMap() {
311
320
  const map = /* @__PURE__ */ new Map();
312
- props2.disableSelection.forEach((v) => {
321
+ props.disableSelection.forEach((v) => {
313
322
  map.set(v.id, true);
314
323
  });
315
324
  hy.disableSelectionMap.value = map;
@@ -333,7 +342,7 @@ const useAppTreeWrapper = (hy) => {
333
342
  container.style.display = "flex";
334
343
  container.style.width = "100%";
335
344
  const dutyHtml = `<div class="flex treeDeviceBox">
336
- ${props2.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"
345
+ ${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"
337
346
  style="border-color: ${data.rosterContentColor};background-color: ${data.rosterContentColor}70;">
338
347
  ${data.rosterContentSimple}
339
348
  </span>` : ""}
@@ -411,36 +420,45 @@ const useAppTreeWrapper = (hy) => {
411
420
  function setDeviceStatus(payload) {
412
421
  virtualTree?.updateData([payload]);
413
422
  }
414
- function singleRemovalFn(row) {
415
- if (props2.treeType === "device") {
423
+ function singleRemovalFn(row, isForce = false) {
424
+ if (props.treeType === "device" || props.treeType === "channel") {
416
425
  virtualTree.setChecked(row.channelId || row.deviceId, false, true);
417
- } else if (props2.treeType) {
418
- virtualTree.setChecked(row.id, false, true);
419
- } else if (!props2.treeType && props2.treeProps) {
420
- virtualTree.setChecked(row[`${props2.treeProps.value}`], false, true);
426
+ } else if (props.treeType) {
427
+ virtualTree.setChecked(row.id, false, true, isForce);
428
+ } else if (!props.treeType && props.treeProps) {
429
+ virtualTree.setChecked(
430
+ row[`${props.treeProps.value}`],
431
+ false,
432
+ true,
433
+ isForce
434
+ );
421
435
  }
422
436
  }
423
- function setCheckedKeys(dataList) {
424
- if (props2.treeType === "device" || props2.treeType === "channel") {
437
+ function setCheckedKeys(dataList, isForce = false) {
438
+ if (props.treeType === "device" || props.treeType === "channel") {
425
439
  virtualTree?.setCheckedKeys(
426
440
  dataList.map((v) => v.channelId || v.deviceId),
427
- true
441
+ true,
442
+ isForce
428
443
  );
429
- } else if (props2.treeType) {
444
+ } else if (props.treeType) {
430
445
  virtualTree?.setCheckedKeys(
431
446
  dataList.map((v) => v.id),
432
- true
447
+ true,
448
+ isForce
433
449
  );
434
- } else if (!props2.treeType && props2.treeProps) {
450
+ } else if (!props.treeType && props.treeProps) {
435
451
  console.log(
436
452
  "\u9009\u4E2D\u56DE\u8C03",
437
- dataList.map((v) => v[`${props2.treeProps.value}`])
453
+ dataList.map((v) => v[`${props.treeProps.value}`])
438
454
  );
439
455
  virtualTree?.setCheckedKeys(
440
- dataList.map((v) => v[`${props2.treeProps.value}`])
456
+ dataList.map((v) => v[`${props.treeProps.value}`]),
457
+ false,
458
+ isForce
441
459
  );
442
460
  }
443
- if (props2.isBackDefaultSelected) {
461
+ if (props.isBackDefaultSelected) {
444
462
  setTimeout(() => {
445
463
  const deviceList = virtualTree?.getCheckedBusinessNodes(true) || [];
446
464
  emits("on-selectedDataList", deviceList);
@@ -448,17 +466,17 @@ const useAppTreeWrapper = (hy) => {
448
466
  }
449
467
  }
450
468
  function setChecked(data, type) {
451
- if (props2.treeType === "device") {
469
+ if (props.treeType === "device") {
452
470
  virtualTree?.setChecked(data.channelId || data.deviceId, type, true);
453
- } else if (props2.treeType) {
471
+ } else if (props.treeType) {
454
472
  virtualTree?.setChecked(data.id, type, true);
455
- } else if (!props2.treeType && props2.treeProps) {
456
- virtualTree?.setChecked(data[`${props2.treeProps.value}`], type, true);
473
+ } else if (!props.treeType && props.treeProps) {
474
+ virtualTree?.setChecked(data[`${props.treeProps.value}`], type, true);
457
475
  }
458
476
  }
459
477
  function setSelectedOrg(deviceList) {
460
478
  for (let i = 0; i < deviceList.length; i++) {
461
- if (props2.defaultSelectedOrgID === deviceList[i].id) {
479
+ if (props.defaultSelectedOrgID === deviceList[i].id) {
462
480
  if (deviceList[i].deviceList?.length) {
463
481
  setCheckedKeys(deviceList[i].deviceList);
464
482
  }
@@ -470,17 +488,20 @@ const useAppTreeWrapper = (hy) => {
470
488
  }
471
489
  }
472
490
  }
473
- function getSelectedDataList() {
474
- return virtualTree?.getCheckedBusinessNodes(true) || [];
491
+ function getSelectedDataList(leafOnly = false) {
492
+ if (props.treeType) {
493
+ return virtualTree?.getCheckedBusinessNodes(leafOnly) || [];
494
+ }
495
+ return virtualTree?.getCheckedNodes(leafOnly) || [];
475
496
  }
476
497
  function setFilterListType(type) {
477
- if (props2.selectFilterList?.length) {
498
+ if (props.selectFilterList?.length) {
478
499
  hy.selectFilterList.value = JSON.parse(
479
- JSON.stringify(props2.selectFilterList)
500
+ JSON.stringify(props.selectFilterList)
480
501
  );
481
502
  return;
482
503
  }
483
- if (props2.treeType === "device") {
504
+ if (props.treeType === "device") {
484
505
  hy.selectFilterList.value = [
485
506
  {
486
507
  label: "\u5168\u90E8",
@@ -498,7 +519,7 @@ const useAppTreeWrapper = (hy) => {
498
519
  placeholder: "\u8BBE\u5907\u53F7\u3001\u8BBE\u5907\u540D\u79F0\u8FDB\u884C\u7B5B\u9009"
499
520
  }
500
521
  ];
501
- } else if (props2.treeType === "user") {
522
+ } else if (props.treeType === "user") {
502
523
  hy.selectFilterList.value = [
503
524
  {
504
525
  label: "\u5168\u90E8",
@@ -532,6 +553,9 @@ const useAppTreeWrapper = (hy) => {
532
553
  refreshData();
533
554
  }
534
555
  }
556
+ function getNode(id) {
557
+ return virtualTree.getNode(id);
558
+ }
535
559
  return {
536
560
  filterValue,
537
561
  virtualTree,
@@ -551,16 +575,17 @@ const useAppTreeWrapper = (hy) => {
551
575
  selectFilterType,
552
576
  selectedDataList,
553
577
  getSelectedDataList,
554
- loading
578
+ loading,
579
+ getNode
555
580
  };
556
581
  };
557
- function filterNodeMethod(data, value, { selectFilterType, treeFilterParam = [] }) {
582
+ function filterNodeMethod(data, value, { selectFilterType, treeFilterParam = [], treeType }) {
558
583
  let type = data.dataType;
559
584
  if (selectFilterType) type = selectFilterType;
560
585
  const includesValue = (field) => {
561
586
  return field && field.toString().includes(value.toString());
562
587
  };
563
- if (!props.treeType) {
588
+ if (!treeType) {
564
589
  let filterType = false;
565
590
  for (let i = 0; i < treeFilterParam.length; i++) {
566
591
  const item = treeFilterParam[i];
@@ -187,7 +187,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
187
187
  // 外部自定义过滤函数
188
188
  filterMethod: {
189
189
  type: Function,
190
- default: () => null
190
+ default: null
191
191
  }
192
192
  },
193
193
  emits: [
@@ -222,7 +222,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
222
222
  getInputPlaceholder,
223
223
  onChange,
224
224
  getSelectedDataList,
225
- loading
225
+ loading,
226
+ getNode
226
227
  } = useMixins.useMixins(
227
228
  {
228
229
  props,
@@ -244,7 +245,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
244
245
  setCheckedKeys,
245
246
  setChecked,
246
247
  getSelectedDataList,
247
- refreshData
248
+ refreshData,
249
+ getNode
248
250
  });
249
251
  return (_ctx, _cache) => {
250
252
  const _directive_loading = vue.resolveDirective("loading");
@@ -0,0 +1,14 @@
1
+ export default {
2
+ id: 'hy-icon-ops-list-lod',
3
+ defs: `<linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="hy-icon-ops-list-lod-linearGradient-1">
4
+ <stop stop-color="#FFFFFF" offset="0%"></stop>
5
+ <stop stop-color="#73F6FF" offset="100%"></stop>
6
+ </linearGradient>`,
7
+ symbol: `<symbol id="hy-icon-ops-list-lod" viewBox="0 0 28 7">
8
+ <g id="hy-icon-ops-list-lod-部门管理" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
9
+ <g id="hy-icon-ops-list-lod-缩小化-自适应说明" transform="translate(-1263, -986)" fill="url(#hy-icon-ops-list-lod-linearGradient-1)" fill-rule="nonzero">
10
+ <path d="M1267.42105,986.85 C1268.23495,986.85 1268.89474,987.535564 1268.89474,988.38125 L1268.89474,991.44375 C1268.89474,992.289436 1268.23495,992.975 1267.42105,992.975 L1264.47368,992.975 C1263.65979,992.975 1263,992.289436 1263,991.44375 L1263,988.38125 C1263,987.535564 1263.65979,986.85 1264.47368,986.85 L1267.42105,986.85 L1267.42105,986.85 Z M1278.47368,986.85 C1279.28758,986.85 1279.94737,987.535564 1279.94737,988.38125 L1279.94737,991.44375 C1279.94737,992.289436 1279.28758,992.975 1278.47368,992.975 L1275.52632,992.975 C1274.71242,992.975 1274.05263,992.289436 1274.05263,991.44375 L1274.05263,988.38125 C1274.05263,987.535564 1274.71242,986.85 1275.52632,986.85 L1278.47368,986.85 L1278.47368,986.85 Z M1289.52632,986.85 C1290.34021,986.85 1291,987.535564 1291,988.38125 L1291,991.44375 C1291,992.289436 1290.34021,992.975 1289.52632,992.975 L1286.57895,992.975 C1285.76505,992.975 1285.10526,992.289436 1285.10526,991.44375 L1285.10526,988.38125 C1285.10526,987.535564 1285.76505,986.85 1286.57895,986.85 L1289.52632,986.85 L1289.52632,986.85 Z" id="hy-icon-ops-list-lod-lod"></path>
11
+ </g>
12
+ </g>
13
+ </symbol>`,
14
+ };
package/lib/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const version = "0.2.62";
3
+ const version = "0.2.64";
4
4
 
5
5
  exports.version = version;