TS_0001:同步載入資料

琥珀君發表於2024-10-08

1,TS同步載入資料

onMounted(async () => {
  const { data }: any = await getMapExtScript({
    page: 1,
    page_size: 50
  });
  if (data && data.list) {
    scriptData.value = data.list;
    pagination.value.total = data.total;
    allData = data.list;
  }

  // 拼接地圖
  if (mapDrawingStore.mapByDblclick && mapDrawingStore.mapByDblclick.identity) {
    const { data: extData }: any = await getMapTreeExtData(mapDrawingStore.mapByDblclick.identity);
    if (extData && extData['elevators_group']) {
      const elevatorsGroup = extData['elevators_group'];
      mapDrawingStore.$patch((state) => {
        state.elevatorGroup = elevatorsGroup.elevator;
      });
    }
  }

  mapDrawingStore.$patch({
    elevatorId: mapDrawingStore.elevatorGroup[0].id
  });
});

2,

相關文章