riku
2025-03-14 5f44d21b3921abc88506a7ec46b3fe6f078664aa
src/views/realtimemode/RealtimeMode.vue
@@ -26,9 +26,10 @@
<script>
import moment from 'moment';
import mapUtil from '@/utils/map/util';
import { useFetchData } from '@/composables/fetchData';
import { TYPE0 } from '@/constant/device-type';
import { radioOptions } from '@/constant/radio-options';
import { defaultOptions } from '@/constant/radio-options';
import { FactorDatas } from '@/model/FactorDatas';
import DashBoard from './component/DashBoard.vue';
import RealTimeTrend from './component/RealTimeTrend.vue';
@@ -55,7 +56,7 @@
      deviceType: TYPE0,
      deviceCode: '',
      // 监测因子的类型编号
      factorType: radioOptions(TYPE0)[0].value,
      factorType: defaultOptions(TYPE0),
      // 新获取的监测数据
      factorDatas: new FactorDatas(),
      // 全部监测数据
@@ -103,13 +104,16 @@
    },
    fetchRealTimeData() {
      this.fetchData((page) => {
        return fetchHistoryData({
          deviceCode: this.deviceCode,
          // startTime: '2024-08-20 06:00:00',
          // endTime: '2024-08-20 06:02:00',
          page,
          perPage: 100
        }).then((res) => {
        return fetchHistoryData(
          {
            deviceCode: this.deviceCode,
            // startTime: '2024-08-20 06:00:00',
            // endTime: '2024-08-20 06:02:00',
            page,
            perPage: 100
          },
          false
        ).then((res) => {
          this.onFetchData(res.data);
          this.onMapData(res.data);
          // if (res.data.length > 0) {
@@ -146,7 +150,7 @@
        this.notFirstFetch = true;
      }
      startIndex = startIndex < 0 ? 0 : startIndex;
      return new Promise((resolve, reject) => {
      return new Promise(() => {
        this.allFactorDatas.addData(dataList, this.drawMode, () => {
          realTimeMapAnimation.moveAnimation(
            this.allFactorDatas,
@@ -170,6 +174,7 @@
  unmounted() {
    this.clearFetchingTask();
    realTimeMapAnimation.stop();
    mapUtil.clearMap();
  }
};
</script>