hy-dispatch-ui-v3 0.2.66 → 0.2.67

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 (62) hide show
  1. package/dist/tailwind.css +25 -1
  2. package/es/components/hyBatchUploadDialog/batchUploadDialog.vue.mjs +174 -142
  3. package/es/components/hyButton/button.vue.mjs +16 -3
  4. package/es/components/hyButton/style/button.scss +2 -0
  5. package/es/components/hyForm/cpns/formItem.vue.mjs +96 -46
  6. package/es/components/hyForm/form.vue.mjs +22 -8
  7. package/es/components/hyForm/js/useAppForm.mjs +1 -1
  8. package/es/components/hyMap/js/index.mjs +6 -6
  9. package/es/components/hyMap/map.vue.mjs +14 -4
  10. package/es/components/hyOrgCascader/orgCascader.vue.mjs +7 -2
  11. package/es/components/hySearch/cpns/searchItem.vue.mjs +396 -324
  12. package/es/components/hySearch/search.vue.mjs +17 -7
  13. package/es/components/hySearch/style/search.scss +7 -0
  14. package/es/components/hyTable/cpns/virtualTable.vue.mjs +25 -6
  15. package/es/components/hyTable/js/index.mjs +11 -5
  16. package/es/components/hyTable/js/search.mjs +25 -1
  17. package/es/components/hyTable/table.vue.mjs +34 -13
  18. package/es/components/hyTableActionButton/tableActionButton.vue.mjs +9 -2
  19. package/es/components/hyTableForm/batchTableForm.vue.mjs +23 -2
  20. package/es/components/hyTableForm/js/useAppTableForm.mjs +1 -1
  21. package/es/components/hyTableForm/tableForm.vue.mjs +79 -33
  22. package/es/components/hyTree/js/index.mjs +118 -50
  23. package/es/components/hyTree/tree.vue.mjs +4 -2
  24. package/es/style/index.scss +0 -1
  25. package/es/style/tailwind.scss +0 -1
  26. package/es/utils/is.mjs +3 -1
  27. package/es/utils/map/hook/bigMap.mjs +2 -0
  28. package/es/utils/map/hook/gaode.mjs +51 -16
  29. package/es/utils/map/hook/leafletjs.mjs +15 -3
  30. package/es/utils/map/index.mjs +1 -1
  31. package/es/version.mjs +1 -1
  32. package/lib/components/hyBatchUploadDialog/batchUploadDialog.vue.js +173 -141
  33. package/lib/components/hyButton/button.vue.js +15 -2
  34. package/lib/components/hyButton/style/button.scss +2 -0
  35. package/lib/components/hyForm/cpns/formItem.vue.js +93 -43
  36. package/lib/components/hyForm/form.vue.js +21 -7
  37. package/lib/components/hyForm/js/useAppForm.js +1 -1
  38. package/lib/components/hyMap/js/index.js +5 -5
  39. package/lib/components/hyMap/map.vue.js +13 -3
  40. package/lib/components/hyOrgCascader/orgCascader.vue.js +7 -2
  41. package/lib/components/hySearch/cpns/searchItem.vue.js +394 -322
  42. package/lib/components/hySearch/search.vue.js +17 -7
  43. package/lib/components/hySearch/style/search.scss +7 -0
  44. package/lib/components/hyTable/cpns/virtualTable.vue.js +24 -5
  45. package/lib/components/hyTable/js/index.js +11 -4
  46. package/lib/components/hyTable/js/search.js +25 -1
  47. package/lib/components/hyTable/table.vue.js +33 -12
  48. package/lib/components/hyTableActionButton/tableActionButton.vue.js +9 -2
  49. package/lib/components/hyTableForm/batchTableForm.vue.js +23 -2
  50. package/lib/components/hyTableForm/js/useAppTableForm.js +1 -1
  51. package/lib/components/hyTableForm/tableForm.vue.js +78 -32
  52. package/lib/components/hyTree/js/index.js +118 -50
  53. package/lib/components/hyTree/tree.vue.js +4 -2
  54. package/lib/style/index.scss +0 -1
  55. package/lib/style/tailwind.scss +0 -1
  56. package/lib/utils/is.js +5 -3
  57. package/lib/utils/map/hook/bigMap.js +2 -0
  58. package/lib/utils/map/hook/gaode.js +51 -16
  59. package/lib/utils/map/hook/leafletjs.js +15 -3
  60. package/lib/utils/map/index.js +1 -1
  61. package/lib/version.js +1 -1
  62. package/package.json +2 -2
@@ -32,10 +32,50 @@ const useAppTreeWrapper = (hy) => {
32
32
  const selectFilterType = ref(null);
33
33
  const selectFilterList = ref([]);
34
34
  const loading = ref(true);
35
+ const noTreeSelData = ref([]);
36
+ function getSelectedDataKey(data) {
37
+ if (!data) return void 0;
38
+ if (props.treeType === "device" || props.treeType === "channel") {
39
+ return data.channelId || data.deviceId;
40
+ }
41
+ if (props.treeType) {
42
+ return data.id;
43
+ }
44
+ return data[props.treeProps?.value];
45
+ }
46
+ function deleteNoTreeSelData(item) {
47
+ const index = hy.noTreeSelData.value.findIndex(
48
+ (v) => hy.getSelectedDataKey(v) === hy.getSelectedDataKey(item)
49
+ );
50
+ if (index !== -1) {
51
+ hy.noTreeSelData.value.splice(index, 1);
52
+ }
53
+ }
54
+ function updateNoTreeSelData(dataList) {
55
+ let selList = [];
56
+ if (props.treeType) {
57
+ selList = hy.virtualTree?.getCheckedBusinessNodes(true) || [];
58
+ } else {
59
+ selList = hy.virtualTree?.getCheckedNodes(true) || [];
60
+ }
61
+ const treeMap = /* @__PURE__ */ new Map();
62
+ selList.forEach((item) => {
63
+ const key = hy.getSelectedDataKey(item);
64
+ if (key) {
65
+ treeMap.set(key, true);
66
+ }
67
+ });
68
+ hy.noTreeSelData.value = dataList.filter(
69
+ (item) => !treeMap.get(hy.getSelectedDataKey(item))
70
+ );
71
+ }
72
+ function mergeNoTreeSelData(dataList) {
73
+ return [...hy.noTreeSelData.value, ...dataList];
74
+ }
35
75
  watch(
36
76
  () => props.showCheckbox,
37
77
  (newVal) => {
38
- virtualTree?.setRowSelection({
78
+ hy.virtualTree?.setRowSelection({
39
79
  type: props.showCheckbox ? "checkbox" : "radio"
40
80
  });
41
81
  }
@@ -44,10 +84,10 @@ const useAppTreeWrapper = (hy) => {
44
84
  return new Promise((resolve) => {
45
85
  hy.loading.value = true;
46
86
  if (props.disableSelection?.length) {
47
- setDisAbleSelectionMap();
87
+ hy.setDisAbleSelectionMap();
48
88
  }
49
- if (!virtualTree) {
50
- virtualTree = new VirtualTree({
89
+ if (!hy.virtualTree) {
90
+ hy.virtualTree = new VirtualTree({
51
91
  // 指定容器
52
92
  container: treeRef.value,
53
93
  // 数据
@@ -62,25 +102,25 @@ const useAppTreeWrapper = (hy) => {
62
102
  // 树形业务类型
63
103
  business: props.treeType,
64
104
  // 自定义整体的插槽
65
- renderItem: props.treeType === treeTypeConfig.user ? (data, node) => setUserSlot(data, node) : setSlot("treeParentSlot"),
105
+ renderItem: props.treeType === treeTypeConfig.user ? (data, node) => hy.setUserSlot(data, node) : props.treeType === treeTypeConfig.group ? (data, node) => hy.setGroupRenderItem(data, node) : hy.setSlot("treeParentSlot"),
66
106
  // // 自定义状态右侧插槽
67
107
  renderRight: (data) => {
68
- let renderRight = setSlot("renderRight");
108
+ let renderRight = hy.setSlot("renderRight");
69
109
  if (renderRight) return renderRight(data);
70
110
  if (data.dataType === 1) {
71
- let departmentRight = setSlot("departmentRight");
111
+ let departmentRight = hy.setSlot("departmentRight");
72
112
  if (departmentRight) {
73
113
  return departmentRight(data);
74
114
  }
75
115
  }
76
116
  if (data.dataType === 3) {
77
- let deviceOnlineRight = setSlot("deviceOnlineRight");
117
+ let deviceOnlineRight = hy.setSlot("deviceOnlineRight");
78
118
  if (deviceOnlineRight) {
79
119
  return deviceOnlineRight(data);
80
120
  }
81
121
  }
82
122
  if ([11].includes(data.dataType)) {
83
- let planGroupRight = setSlot("planGroupRight");
123
+ let planGroupRight = hy.setSlot("planGroupRight");
84
124
  if (planGroupRight) {
85
125
  return planGroupRight(data);
86
126
  }
@@ -88,16 +128,16 @@ const useAppTreeWrapper = (hy) => {
88
128
  return true;
89
129
  },
90
130
  // // 自定义状态模块
91
- renderStatus: props.treeType === treeTypeConfig.device || props.treeType === treeTypeConfig.channel ? (data) => setRenderStatus(data) : null,
131
+ renderStatus: props.treeType === treeTypeConfig.device || props.treeType === treeTypeConfig.channel ? (data) => hy.setRenderStatus(data) : null,
92
132
  // 暂无数据插槽
93
133
  renderEmpty: () => {
94
134
  if (!props.showCustomEmpty || hy.filterValue.value) return true;
95
- let renderEmpty = setSlot("renderEmpty");
135
+ let renderEmpty = hy.setSlot("renderEmpty");
96
136
  if (renderEmpty) {
97
137
  const target = renderEmpty();
98
138
  return target.el;
99
139
  }
100
- return setEmpty();
140
+ return hy.setEmpty();
101
141
  },
102
142
  props: {
103
143
  // 是否显示右侧业务状态
@@ -132,7 +172,6 @@ const useAppTreeWrapper = (hy) => {
132
172
  showSelectBox: props.showSelectBox,
133
173
  // 选中回调
134
174
  onCheckChange: (data, info, checked) => {
135
- console.log("onCheckChange", info);
136
175
  if (data.dataType === 3 && !checked) {
137
176
  emits("on-click-delete", JSON.parse(JSON.stringify(data)));
138
177
  } else if (data.dataType === 3) {
@@ -141,7 +180,11 @@ const useAppTreeWrapper = (hy) => {
141
180
  emits(
142
181
  "on-check-tree",
143
182
  JSON.parse(
144
- JSON.stringify(info.checkedBusinessNodes || info.checkedNodes)
183
+ JSON.stringify(
184
+ hy.mergeNoTreeSelData(
185
+ info.checkedBusinessNodes || info.checkedNodes
186
+ )
187
+ )
145
188
  ),
146
189
  {
147
190
  data,
@@ -246,16 +289,16 @@ const useAppTreeWrapper = (hy) => {
246
289
  document.body.click();
247
290
  },
248
291
  onLoad: () => {
249
- if (props.showOnlineOnly && !virtualTree._flattenTree?.length && !hy.filterValue.value) {
292
+ if (props.showOnlineOnly && !hy.virtualTree._flattenTree?.length && !hy.filterValue.value) {
250
293
  ElMessage.warning("\u6682\u65E0\u8BBE\u5907\u5904\u4E8E\u5728\u7EBF\u72B6\u6001");
251
294
  }
252
295
  if (props.defaultSelectedOrgID && props.showCheckbox && props.treeType === "device") {
253
- setSelectedOrg(dataList);
296
+ hy.setSelectedOrg(dataList);
254
297
  } else if (props.selectedByDefault?.length) {
255
- setCheckedKeys(props.selectedByDefault);
298
+ hy.setCheckedKeys(props.selectedByDefault);
256
299
  }
257
300
  if (hy.filterValue.value) {
258
- getFilterValue();
301
+ hy.getFilterValue();
259
302
  }
260
303
  setTimeout(() => {
261
304
  hy.loading.value = false;
@@ -264,7 +307,7 @@ const useAppTreeWrapper = (hy) => {
264
307
  }
265
308
  });
266
309
  } else {
267
- virtualTree.setData(
310
+ hy.virtualTree.setData(
268
311
  {
269
312
  data: dataList,
270
313
  businessConfig: {
@@ -274,11 +317,11 @@ const useAppTreeWrapper = (hy) => {
274
317
  }
275
318
  },
276
319
  () => {
277
- if (props.showOnlineOnly && !virtualTree._flattenTree?.length && !hy.filterValue.value) {
320
+ if (props.showOnlineOnly && !hy.virtualTree._flattenTree?.length && !hy.filterValue.value) {
278
321
  ElMessage.success("\u6682\u65E0\u8BBE\u5907\u5904\u4E8E\u5728\u7EBF\u72B6\u6001");
279
322
  }
280
323
  if (hy.filterValue.value) {
281
- getFilterValue();
324
+ hy.getFilterValue();
282
325
  }
283
326
  setTimeout(() => {
284
327
  hy.loading.value = false;
@@ -316,7 +359,7 @@ const useAppTreeWrapper = (hy) => {
316
359
  return content;
317
360
  }
318
361
  function getFilterValue() {
319
- virtualTree.filter({ filterValue: hy.filterValue.value }, false);
362
+ hy.virtualTree.filter({ filterValue: hy.filterValue.value }, false);
320
363
  }
321
364
  function setDisAbleSelectionMap() {
322
365
  const map = /* @__PURE__ */ new Map();
@@ -330,7 +373,7 @@ const useAppTreeWrapper = (hy) => {
330
373
  emits("on-refreshData");
331
374
  }
332
375
  function setRenderStatus(data) {
333
- const slot = setSlot("renderStatus");
376
+ const slot = hy.setSlot("renderStatus");
334
377
  if (slot) {
335
378
  return slot(data);
336
379
  }
@@ -360,22 +403,24 @@ const useAppTreeWrapper = (hy) => {
360
403
  }
361
404
  function setUserSlot(data) {
362
405
  if (data.dataType === 1) {
363
- const slot2 = setSlot("treeParentSlot");
406
+ const slot2 = hy.setSlot("treeParentSlot");
364
407
  if (slot2) {
365
408
  return slot2(data);
366
409
  }
367
410
  return true;
368
411
  }
369
- const slot = setSlot("treeSelectedSlot");
412
+ const slot = hy.setSlot("treeSelectedSlot");
370
413
  if (slot) {
371
414
  return slot(data);
372
415
  }
373
416
  return true;
374
417
  }
375
418
  function setGroupRenderItem(data, node) {
376
- const slot = setSlot("treeParentSlot");
377
- if (slot) {
378
- return slot(data, node);
419
+ if (data.dataType === 4) {
420
+ const slot = hy.setSlot("treeGroupSlot");
421
+ if (slot) {
422
+ return slot(data, node);
423
+ }
379
424
  }
380
425
  return true;
381
426
  }
@@ -420,81 +465,91 @@ const useAppTreeWrapper = (hy) => {
420
465
  emits("on-addDevice");
421
466
  }
422
467
  function setDeviceStatus(payload) {
423
- virtualTree?.updateData([payload]);
468
+ hy.virtualTree?.updateData([payload]);
424
469
  }
425
470
  function singleRemovalFn(row, isForce = false) {
426
471
  if (props.treeType === "device" || props.treeType === "channel") {
427
- virtualTree.setChecked(row.channelId || row.deviceId, false, true);
472
+ hy.virtualTree.setChecked(row.channelId || row.deviceId, false, true);
428
473
  } else if (props.treeType) {
429
- virtualTree.setChecked(row.id, false, true, isForce);
474
+ hy.virtualTree.setChecked(row.id, false, true, isForce);
430
475
  } else if (!props.treeType && props.treeProps) {
431
- virtualTree.setChecked(
476
+ hy.virtualTree.setChecked(
432
477
  row[`${props.treeProps.value}`],
433
478
  false,
434
479
  true,
435
480
  isForce
436
481
  );
437
482
  }
483
+ hy.deleteNoTreeSelData(row);
438
484
  }
439
485
  function setCheckedKeys(dataList, isForce = false) {
440
486
  if (props.treeType === "device" || props.treeType === "channel") {
441
- virtualTree?.setCheckedKeys(
487
+ hy.virtualTree?.setCheckedKeys(
442
488
  dataList.map((v) => v.channelId || v.deviceId),
443
489
  true,
444
490
  isForce
445
491
  );
446
492
  } else if (props.treeType) {
447
- virtualTree?.setCheckedKeys(
493
+ hy.virtualTree?.setCheckedKeys(
448
494
  dataList.map((v) => v.id),
449
495
  true,
450
496
  isForce
451
497
  );
452
498
  } else if (!props.treeType && props.treeProps) {
453
- console.log(
454
- "\u9009\u4E2D\u56DE\u8C03",
455
- dataList.map((v) => v[`${props.treeProps.value}`])
456
- );
457
- virtualTree?.setCheckedKeys(
499
+ hy.virtualTree?.setCheckedKeys(
458
500
  dataList.map((v) => v[`${props.treeProps.value}`]),
459
501
  false,
460
502
  isForce
461
503
  );
462
504
  }
505
+ hy.updateNoTreeSelData(dataList);
463
506
  if (props.isBackDefaultSelected) {
464
507
  setTimeout(() => {
465
- const deviceList = virtualTree?.getCheckedBusinessNodes(true) || [];
466
- emits("on-selectedDataList", deviceList);
508
+ let deviceList = [];
509
+ if (props.treeType) {
510
+ deviceList = hy.virtualTree?.getCheckedBusinessNodes(true) || [];
511
+ } else {
512
+ deviceList = hy.virtualTree?.getCheckedNodes(true) || [];
513
+ }
514
+ emits("on-selectedDataList", hy.mergeNoTreeSelData(deviceList));
467
515
  });
468
516
  }
469
517
  }
470
518
  function setChecked(data, type = true) {
471
519
  if (props.treeType === "device") {
472
- virtualTree?.setChecked(data.channelId || data.deviceId, type, true);
520
+ hy.virtualTree?.setChecked(data.channelId || data.deviceId, type, true);
473
521
  } else if (props.treeType) {
474
- virtualTree?.setChecked(data.id, type, true);
522
+ hy.virtualTree?.setChecked(data.id, type, true);
475
523
  } else if (!props.treeType && props.treeProps) {
476
- virtualTree?.setChecked(data[`${props.treeProps.value}`], type, false);
524
+ hy.virtualTree?.setChecked(data[`${props.treeProps.value}`], type, false);
525
+ }
526
+ if (!type) {
527
+ hy.deleteNoTreeSelData(data);
477
528
  }
478
529
  }
479
530
  function setSelectedOrg(deviceList) {
480
531
  for (let i = 0; i < deviceList.length; i++) {
481
532
  if (props.defaultSelectedOrgID === deviceList[i].id) {
482
533
  if (deviceList[i].deviceList?.length) {
483
- setCheckedKeys(deviceList[i].deviceList);
534
+ hy.setCheckedKeys(deviceList[i].deviceList);
484
535
  }
485
536
  return true;
486
537
  }
487
538
  if (deviceList[i].children?.length) {
488
- const org = setSelectedOrg(deviceList[i].children);
539
+ const org = hy.setSelectedOrg(deviceList[i].children);
489
540
  if (org) return true;
490
541
  }
491
542
  }
492
543
  }
493
544
  function getSelectedDataList(leafOnly = false) {
494
545
  if (props.treeType) {
495
- return virtualTree?.getCheckedBusinessNodes(leafOnly) || [];
546
+ return hy.mergeNoTreeSelData(
547
+ hy.virtualTree?.getCheckedBusinessNodes(leafOnly) || []
548
+ );
496
549
  }
497
- return virtualTree?.getCheckedNodes(leafOnly) || [];
550
+ return hy.mergeNoTreeSelData(
551
+ hy.virtualTree?.getCheckedNodes(leafOnly) || []
552
+ );
498
553
  }
499
554
  function setFilterListType(type) {
500
555
  if (props.selectFilterList?.length) {
@@ -556,7 +611,7 @@ const useAppTreeWrapper = (hy) => {
556
611
  }
557
612
  }
558
613
  function getNode(id) {
559
- return virtualTree.getNode(id);
614
+ return hy.virtualTree.getNode(id);
560
615
  }
561
616
  return {
562
617
  filterValue,
@@ -564,6 +619,7 @@ const useAppTreeWrapper = (hy) => {
564
619
  permissionIdList,
565
620
  disableSelectionMap,
566
621
  addDeviceDom,
622
+ setDisAbleSelectionMap,
567
623
  getData,
568
624
  getFilterValue,
569
625
  refreshData,
@@ -571,6 +627,11 @@ const useAppTreeWrapper = (hy) => {
571
627
  setCheckedKeys,
572
628
  setChecked,
573
629
  setFilterListType,
630
+ setSelectedOrg,
631
+ setUserSlot,
632
+ setSlot,
633
+ setRenderStatus,
634
+ setEmpty,
574
635
  getInputPlaceholder,
575
636
  onChange,
576
637
  selectFilterList,
@@ -578,7 +639,14 @@ const useAppTreeWrapper = (hy) => {
578
639
  selectedDataList,
579
640
  getSelectedDataList,
580
641
  loading,
581
- getNode
642
+ getNode,
643
+ noTreeSelData,
644
+ updateNoTreeSelData,
645
+ mergeNoTreeSelData,
646
+ getSelectedDataKey,
647
+ deleteNoTreeSelData,
648
+ setDeviceStatus,
649
+ setGroupRenderItem
582
650
  };
583
651
  };
584
652
  function filterNodeMethod(data, value, { selectFilterType, treeFilterParam = [], treeType }) {
@@ -202,7 +202,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
202
202
  onChange,
203
203
  getSelectedDataList,
204
204
  loading,
205
- getNode
205
+ getNode,
206
+ setDeviceStatus
206
207
  } = useMixins(
207
208
  {
208
209
  props,
@@ -225,7 +226,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
225
226
  setChecked,
226
227
  getSelectedDataList,
227
228
  refreshData,
228
- getNode
229
+ getNode,
230
+ setDeviceStatus
229
231
  });
230
232
  return (_ctx, _cache) => {
231
233
  const _directive_loading = resolveDirective("loading");
@@ -3,7 +3,6 @@
3
3
  * {
4
4
  margin: 0;
5
5
  padding: 0;
6
- box-sizing: border-box;
7
6
  }
8
7
  html,
9
8
  body,
@@ -54,7 +54,6 @@
54
54
  *,
55
55
  ::before,
56
56
  ::after {
57
- box-sizing: border-box;
58
57
  /* 1 */
59
58
  border-width: 0;
60
59
  /* 2 */
package/es/utils/is.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  import { isRef, isReactive, isReadonly, isProxy } from 'vue';
2
2
  import '../hooks/index.mjs';
3
+ import './index.mjs';
3
4
  import { usePermissionMap } from '../hooks/usePermissionMap.mjs';
5
+ import { PERMISSION } from './permission.mjs';
4
6
 
5
7
  const isString = (e) => typeof e === "string";
6
8
  const isNumber = (e) => typeof e === "number";
@@ -45,7 +47,7 @@ function isPermission(permission) {
45
47
  if (!permission) {
46
48
  return true;
47
49
  }
48
- return permissionMap.value.has(permission);
50
+ return permissionMap.value.has(PERMISSION[`${permission}`]);
49
51
  }
50
52
 
51
53
  export { isArray, isBoolean, isEmpty, isFile, isFunction, isNull, isNumber, isObject, isOverflowing, isPermission, isString, isSupportH265, isSymbol, isUndefined, isVueProxy };
@@ -343,6 +343,8 @@ class bigMap extends EventEmitter {
343
343
  off: function(target, types, fn, context) {
344
344
  const wrappedFn = wrappedHandlers.take(types, fn);
345
345
  return target.off(types, wrappedFn || fn, context);
346
+ },
347
+ satelliteMapFn: function() {
346
348
  }
347
349
  };
348
350
  return createMapProxy(newMap, handlers);
@@ -94,6 +94,7 @@ class Google extends EventEmitter {
94
94
  return createMapProxy(polygon, handlers);
95
95
  });
96
96
  this.initParams = request;
97
+ this.layerSateGroup = null;
97
98
  }
98
99
  InitMap(domId, option) {
99
100
  const { center } = option;
@@ -110,24 +111,33 @@ class Google extends EventEmitter {
110
111
  resizeEnable: true
111
112
  });
112
113
  newMap.on("complete", (e) => {
113
- if (option.completeCallbacks) {
114
- option.completeCallbacks(e);
115
- }
114
+ newMap.plugin(
115
+ [
116
+ "AMap.MarkerClusterer",
117
+ "AMap.Scale",
118
+ "AMap.LayerGroup",
119
+ "AMap.Circle",
120
+ "AMap.TileLayer",
121
+ "AMap.GeometryUtil",
122
+ "AMap.MouseTool"
123
+ ],
124
+ () => {
125
+ this.layerSateGroup = new window.AMap.LayerGroup([
126
+ new window.AMap.TileLayer.Satellite()
127
+ ]);
128
+ this.layerSateGroup.setMap(newMap);
129
+ this.layerSateGroup.hide();
130
+ setTimeout(() => {
131
+ this.satelliteMapFn(newMap, option.satelliteMap);
132
+ if (option.completeCallbacks) {
133
+ option.completeCallbacks(e);
134
+ }
135
+ });
136
+ }
137
+ );
116
138
  });
117
- newMap.plugin(
118
- [
119
- "AMap.MarkerClusterer",
120
- "AMap.Scale",
121
- "AMap.LayerGroup",
122
- "AMap.Circle",
123
- "AMap.TileLayer",
124
- "AMap.GeometryUtil",
125
- "AMap.MouseTool"
126
- ],
127
- () => {
128
- }
129
- );
130
139
  const wrappedHandlers = createWrappedHandlerStore();
140
+ const _this = this;
131
141
  const handlers = {
132
142
  // return 单位:m
133
143
  distance: function(target, latAndlng1, latAndlng2) {
@@ -178,10 +188,35 @@ class Google extends EventEmitter {
178
188
  // // 四个角
179
189
  getBounds: function(target) {
180
190
  return wrapBounds(target);
191
+ },
192
+ /* 判断地图颜色 */
193
+ satelliteMapFn: function(target, satelliteMap) {
194
+ if (satelliteMap === 3) {
195
+ _this.layerSateGroup.show();
196
+ } else {
197
+ if (satelliteMap === 1) {
198
+ target.setMapStyle(_this.initParams.defaultMapStyle);
199
+ } else {
200
+ target.setMapStyle(_this.initParams.currencyMapStyle);
201
+ }
202
+ _this.layerSateGroup.hide();
203
+ }
181
204
  }
182
205
  };
183
206
  return createMapProxy(newMap, handlers);
184
207
  }
208
+ satelliteMapFn(map, satelliteMap) {
209
+ if (satelliteMap === 3) {
210
+ this.layerSateGroup.show();
211
+ } else {
212
+ if (satelliteMap === 1) {
213
+ map.setMapStyle(this.initParams.defaultMapStyle);
214
+ } else {
215
+ map.setMapStyle(this.initParams.currencyMapStyle);
216
+ }
217
+ this.layerSateGroup.hide();
218
+ }
219
+ }
185
220
  // 地图图层
186
221
  layerGroup(map, markers = []) {
187
222
  const layerGroup = new window.AMap.LayerGroup(markers);
@@ -306,6 +306,7 @@ class Leafletjs extends EventEmitter {
306
306
  return createMapProxy(polygon, handlers);
307
307
  });
308
308
  this.initParams = request;
309
+ this.tileLayerList = [];
309
310
  }
310
311
  // 初始化地图
311
312
  InitMap(domId, option) {
@@ -325,6 +326,7 @@ class Leafletjs extends EventEmitter {
325
326
  const newMap = L.map(domId, option);
326
327
  newMap.getInitMap = () => newMap;
327
328
  const wrappedHandlers = createWrappedHandlerStore();
329
+ const _this = this;
328
330
  const handlers = {
329
331
  // 删除地图
330
332
  removeMap: function(target, params) {
@@ -400,6 +402,10 @@ class Leafletjs extends EventEmitter {
400
402
  off: function(target, types, fn, context) {
401
403
  const wrappedFn = wrappedHandlers.take(types, fn);
402
404
  return target.off(types, wrappedFn || fn, context);
405
+ },
406
+ /* 判断地图颜色 */
407
+ satelliteMapFn: function(target, satelliteMap) {
408
+ _this.setLayersUrl(target, satelliteMap !== 2);
403
409
  }
404
410
  };
405
411
  const map = createMapProxy(newMap, handlers);
@@ -409,7 +415,7 @@ class Leafletjs extends EventEmitter {
409
415
  option.completeCallbacks();
410
416
  }
411
417
  });
412
- this.setLayersUrl(map);
418
+ this.setLayersUrl(map, option.satelliteMap !== 2);
413
419
  return map;
414
420
  }
415
421
  // 设置地图瓦片地址
@@ -424,12 +430,18 @@ class Leafletjs extends EventEmitter {
424
430
  if (mapServerType === "WMTS" || mapServerType === "Dynamic") {
425
431
  return this.createLayers(map, layersUrls);
426
432
  }
433
+ this.tileLayerList.forEach((tileLayer) => {
434
+ tileLayer?.remove();
435
+ });
436
+ this.tileLayerList = [];
427
437
  layersUrls.split(",").forEach((layersUrl) => {
438
+ let tileLayer = null;
428
439
  if (changeColorType) {
429
- this.createCustomLayers(map, layersUrl);
440
+ tileLayer = this.createCustomLayers(map, layersUrl);
430
441
  } else {
431
- this.createLayers(map, layersUrl);
442
+ tileLayer = this.createLayers(map, layersUrl);
432
443
  }
444
+ this.tileLayerList.push(tileLayer);
433
445
  });
434
446
  }
435
447
  // 超图 WMTS 图层(不适用所有的WMTS图层,目前仅支持超图WMTS,因不同的WMTS服务规范不一样,主要体现在路由访问参数)
@@ -230,7 +230,7 @@ class InitMap extends EventEmitter {
230
230
  /* === leafletjs === */
231
231
  ...option
232
232
  };
233
- return this.map.InitMap(domId, option);
233
+ return this.map?.InitMap(domId, option);
234
234
  }
235
235
  // 自定义 h5 图标
236
236
  DivIcon(option) {
package/es/version.mjs CHANGED
@@ -1,3 +1,3 @@
1
- const version = "0.2.65";
1
+ const version = "0.2.66";
2
2
 
3
3
  export { version };