anytrek-front-public-component 1.11.13 → 1.11.15

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