riku
2025-05-08 6f7bbdd390abdcdb2cdaef980bc69816a3ff2202
src/views/historymode/HistoryMode.vue
@@ -8,6 +8,13 @@
        @search="onSearch"
      ></SearchBar>
      <TrajectoryState v-show="status != 0" :status="status"></TrajectoryState>
      <el-button
        type="primary"
        class="p-events-auto el-button-custom"
        @click="handleClick"
      >
        分析
      </el-button>
    </el-row>
    <el-row class="m-t-2">
      <FactorRadio
@@ -19,6 +26,7 @@
      <FactorLegend
        class="m-t-2"
        :factor="factorDatas.factor[factorType]"
        @change="handleLegendTypeChange"
      ></FactorLegend>
    </el-row>
    <el-row class="historical" justify="center">
@@ -49,6 +57,7 @@
<script>
import Layer from '@/utils/map/3dLayer';
import mapLine from '@/utils/map/line';
import marks from '@/utils/map/marks';
import sector from '@/utils/map/sector';
import mapUtil from '@/utils/map/util';
@@ -56,12 +65,13 @@
import { useFetchData } from '@/composables/fetchData';
import moment from 'moment';
import { TYPE0 } from '@/constant/device-type';
import { radioOptions } from '@/constant/radio-options';
import { defaultOptions } from '@/constant/radio-options';
import { FactorDatas } from '@/model/FactorDatas';
import TrendAnalysis from './component/TrendAnalysis.vue';
import DataSheet from './component/DataSheet.vue';
import { ElMessage } from 'element-plus';
import { fetchHistoryData } from '@/utils/factor/data';
import dataAnalysisApi from '@/api/dataAnalysisApi';
import { mapStores } from 'pinia';
import { useSceneStore } from '@/stores/scene';
@@ -79,7 +89,7 @@
      // 监测设备编号
      deviceCode: '',
      // 监测因子的类型编号
      factorType: radioOptions(TYPE0)[0].value,
      factorType: defaultOptions(TYPE0).value,
      // 监测数据
      factorDatas: new FactorDatas(),
      // 决定绘制3D图形时是否与原图像合并
@@ -133,19 +143,31 @@
        this.sceneStore.searchScene(lng, lat);
      }
    },
    handleLegendTypeChange(value, done) {
      if (value) {
        this.factorDatas.resetRange();
      } else {
        this.factorDatas.standardRange();
      }
      done();
      this.draw();
    },
    draw() {
      // 刷新图例
      const factor = this.factorDatas.factor[this.factorType];
      sector.clearSector();
      // this.drawRoadLine(factor);
      this.drawRoadMap(factor);
      this.drawMassMarks(factor);
    },
    // 绘制3D走行路线图
    drawRoadMap(e) {
      this.factorDatas.refreshHeight(this.factorType);
      Layer.drawRoadMap(this.factorDatas, e, this.merge, this.setCenter);
      // }
    },
    drawRoadLine(e) {
      this.factorDatas.refreshHeight(this.factorType);
      mapLine.drawLine(this.factorDatas, e);
    },
    drawMassMarks(e) {
      marks.drawMassMarks(this.factorDatas, e, (index) => {
@@ -182,9 +204,10 @@
      });
    },
    onSearch(option) {
      const { deviceType, deviceCode, timeArray } = option;
      const { deviceType, deviceCode, timeArray, mission } = option;
      this.deviceType = deviceType;
      this.deviceCode = deviceCode;
      this.mission = mission;
      let startTime, endTime;
      if (timeArray && timeArray.length == 2) {
        startTime = moment(timeArray[0]).format('YYYY-MM-DD HH:mm:ss');
@@ -200,6 +223,19 @@
          perPage: pageSize
        }).then((res) => this.onFetchData(deviceType, res.data));
      });
    },
    handleClick() {
      const { missionCode } = this.mission;
      dataAnalysisApi.pollutionTrace(missionCode).then((res) => {
        res.data.forEach((e) => {
          const fDatas = new FactorDatas();
          fDatas.setData(e.dataVoList, this.drawMode, () => {
            fDatas.refreshHeight(this.factorType);
            Layer.drawHighLight3DLayer(fDatas, fDatas.factor[this.factorType]);
            console.log(e.dataVoList);
          });
        });
      });
    }
  },
  mounted() {