anytrek-front-public-component 1.11.13 → 1.11.14

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.
package/README.md CHANGED
@@ -726,7 +726,7 @@ const saveFunctionLandmark = async (
726
726
 
727
727
 
728
728
  ## 🧩 Component: `<ImageDisplay>`
729
- 图片预览弹窗,支持缩放、旋转、地图 MiniMap、AI 分析、图片列表懒加载
729
+ 图片预览弹窗,支持缩放、旋转、地图 MiniMap、AI 分析、图片列表懒加载、多帧图片轮播
730
730
 
731
731
  ```vue
732
732
  <ImageDisplay
@@ -749,6 +749,7 @@ const saveFunctionLandmark = async (
749
749
  @handle-close="onClose"
750
750
  @handle-download="onDownload"
751
751
  @update-cur-img="onUpdateCurImg"
752
+ @updateChildUrl="onUpdateChildUrl"
752
753
  @to-history="onToHistory"
753
754
  />
754
755
  ```
@@ -760,6 +761,9 @@ const visible = ref(false)
760
761
  const imageData = ref<any>({})
761
762
  const previewItem = ref<any>({})//当前设备
762
763
  const imgList = ref<any[]>([]);
764
+ const childImages = ref<any[]>([]);
765
+ const isMutiple = ref(false);
766
+
763
767
  /* 图片宽高 */
764
768
  const curPicWH = ref<any>({
765
769
  imgW: 800,
@@ -767,33 +771,78 @@ const curPicWH = ref<any>({
767
771
  });
768
772
  const showImageDisplay = () => {
769
773
  imageDisplayRef.value?.loadImageListFun();
774
+
770
775
  visible.value = true;
771
776
  }
777
+ /* CargoHandling 相同 uuid 归为一项,新增 imageList 字段存所有帧按 takeTime 最新排序 */
778
+ const groupCargoHandlingImages = (list: any[]): any[] => {
779
+ const groupMap = new Map<string, any[]>();
780
+ list.forEach((item: any) => {
781
+ if (item.triggerType === 'CargoHandling' && item.uuid) {
782
+ const key = item.uuid;
783
+ if (!groupMap.has(key)) groupMap.set(key, []);
784
+ groupMap.get(key)!.push(item);
785
+ }
786
+ });
787
+ const groupedUuids = new Set(groupMap.keys());
788
+ const result: any[] = [];
789
+ groupMap.forEach((items) => {
790
+ items.sort((a: any, b: any) => new Date(b.takeTime).getTime() - new Date(a.takeTime).getTime());
791
+ result.push({ ...items[0], imageList: [...items] });
792
+ });
793
+ list.forEach((item: any) => {
794
+ if (!(item.triggerType === 'CargoHandling' && item.uuid && groupedUuids.has(item.uuid))) {
795
+ result.push(item);
796
+ }
797
+ });
798
+ return result;
799
+ }
800
+
772
801
  const fetchImgList = async (successFun: Function) => {
773
802
  /* 请求图片列表 */
774
803
  const res = await getImgList();
775
804
  if (!res || res.errorCode) {
776
805
  return;
777
806
  }
778
- const list = res.sort(
807
+ const list = groupCargoHandlingImages(res).sort(
779
808
  (a: any, b: any) =>
780
809
  new Date(b.takeTime).getTime() - new Date(a.takeTime).getTime()
781
810
  );
782
811
  if (list[0] && imageData.value?.deviceId !== previewItem.value?.deviceId) {
783
- imageData = list[0];
812
+ imageData.value = list[0];
813
+ childImages.value = imageData.value.imageList?.map((i: any) => i.url) || [];
814
+ isMutiple.value = imageData.value.imageList?.length > 1;
784
815
  }
785
816
  imgList.value = list;
786
817
  successFun();
787
818
  }
788
819
 
789
820
  const onDownload = (data: any) => {
790
- /* 下载图片 */
791
- }
821
+ /* 下载图片,自行根据data数组长度执行下载方法 */
792
822
 
793
- const onUpdateCurImg = (index: number) => {
794
- imageData.value = imgList.value[index];
795
823
  }
796
824
 
825
+ onUpdateCurImg: (index: number) => {
826
+ const img = { ...imgList.value[index] };
827
+ delete img._mainUrl;
828
+ imageData.value = img;
829
+ isMutiple.value = !!(img?.imageList?.length);
830
+ childImages.value = img?.imageList?.map((i: any) => i.url) || [];
831
+ },
832
+ onUpdateChildUrl: (url: string) => {
833
+ const img = imageData.value;
834
+ if (!img._mainUrl) {
835
+ img._mainUrl = img.url;
836
+ }
837
+ if (img.imageList) {
838
+ const child = img.imageList.find((i: any) => i.url === url);
839
+ if (child) {
840
+ Object.assign(img, child);
841
+ img.url = url;
842
+ }
843
+ }
844
+ },
845
+
797
846
  const fetchHistoryTrail = async () => {
798
847
  const res = await getHistoryTrail();
799
848
  if (!res || res.errorCode) {
@@ -846,15 +895,19 @@ const onToHistory = (data: any) => {
846
895
  | `onGetHistoryTrail` | 获取历史轨迹 | `Function` | — |
847
896
  | `onGetHistoryTrailPoint` | 获取轨迹点详情 | `Function` | — |
848
897
  | `getImgList` | 获取图片列表(弹窗打开且列表为空时调用) | `Function` | — |
898
+ | `isMutiple` | 是否开启多帧图片轮播模式 | `Boolean` | `false` |
899
+ | `childImages` | 子图 URL 列表(多帧轮播时使用) | `String[]` | `[]` |
900
+
849
901
 
850
902
  ### 📋 Events Reference
851
903
  | 事件 | 描述 | 参数 |
852
904
  | --- | --- | --- |
853
905
  | `update:modelValue` | 弹窗开关变化 | `Boolean` |
854
906
  | `handleClose` | 弹窗关闭 | — |
855
- | `handleDownload` | 下载图片 | |
907
+ | `handleDownload` | 下载图片,始终返回数组,父组件通过数组长度判断下载方式 | `data: Object[]` |
856
908
  | `updateCurImg` | 切换图片 | `index: Number` |
857
909
  | `toHistory` | 跳转轨迹历史 | `params: Object` |
910
+ | `updateChildUrl` | 多帧轮播切换子图时触发 | `url: String` |
858
911
 
859
912
 
860
913
  ### 📋 Methods Reference (通过 ref 调用)