hanbaoshan
2020-12-25 027d977d6b89cf4706fa6d07279014bb44fdd363
全景追踪过滤数据
1个文件已修改
53 ■■■■■ 已修改文件
src/pages/panoramicView/components/TracePlot.vue 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/panoramicView/components/TracePlot.vue
@@ -19,7 +19,7 @@
      :width="cW"
      :height="cH"
      :style="{backgroundImage:`url(${panoramaPath})`}"
    ></canvas> -->
    ></canvas>-->
    <canvas
      ref="trackArea"
      :width="fixedW"
@@ -76,13 +76,13 @@
        _this.cW = width;
        _this.cH = height;
        //判断长宽比
        let ratio = res.data.width/res.data.height;
        if(ratio > (_this.fixedW/_this.fixedH)){
        let ratio = res.data.width / res.data.height;
        if (ratio > (_this.fixedW / _this.fixedH)) {
          _this.bgW = _this.fixedW;
          _this.bgH = _this.bgW*res.data.height/res.data.width;
        }else{
          _this.bgH = _this.bgW * res.data.height / res.data.width;
        } else {
          _this.bgH = _this.fixedH;
          _this.bgW = res.data.width*_this.bgH/res.data.height;
          _this.bgW = res.data.width * _this.bgH / res.data.height;
        }
      })
    },
@@ -123,7 +123,7 @@
      let _this = this;
      var param = {
        page: 1,
        size: 100,
        size: 500,
        searchTime: this.searchTime,
        alarmlevel: [],
        inputValue: '',
@@ -134,37 +134,54 @@
      };
      getSearchList(param).then(res => {
        let filterArr = [];
        if(Date.parse(_this.searchTime[0]) > _this.searchEndTimeStamp || Date.parse(_this.searchTime[1]) < _this.searchStartTimeStamp){
          _this.activeObjHashMap = [];
        if(!res.data.datalist){
          _this.activeObjHashMap = {};
          _this.actObj = {}
        }
        for(var key in _this.activeObjHashMap){
          let innerKey = res.data.datalist&&res.data.datalist.find(obj => obj.activeObject.id == key);
          if(!innerKey){
            delete _this.activeObjHashMap[key];
            delete _this.actObj[key];
          }
        }
        res.data.datalist && res.data.datalist.forEach(obj => {
          if (_this.activeObjHashMap[obj.activeObject.id] !== 1) {
            _this.activeObjHashMap[obj.activeObject.id] = 1
            filterArr.push(obj)
          }
        });
        _this.searchStartTimeStamp = Date.parse(_this.searchTime[0]);
        _this.searchEndTimeStamp = Date.parse(_this.searchTime[1]);
        console.log(_this.actObj)
        filterArr.forEach(item => {
          item.activeObject.targetInfo.forEach(target => {
            if (target.targetType == 'UniquelID') {
              let attribute = JSON.parse(target.attribute)
              if (_this.actObj[target.targetId]) {
                _this.actObj[target.targetId].unshift({ globalCoordX: attribute.globalCoordX, globalCoordY: attribute.globalCoordY });
                _this.actObj[target.targetId].unshift({ globalCoordX: attribute.globalCoordX, globalCoordY: attribute.globalCoordY, timeStamp: Date.parse(item.activeObject.picDate) });
              } else {
                _this.actObj[target.targetId] = [{ globalCoordX: attribute.globalCoordX, globalCoordY: attribute.globalCoordY }];
                _this.actObj[target.targetId] = [{ globalCoordX: attribute.globalCoordX, globalCoordY: attribute.globalCoordY, timeStamp: Date.parse(item.activeObject.picDate) }];
              }
            }
          })
        });
        _this.searchStartTimeStamp = Date.parse(_this.searchTime[0]);
        _this.searchEndTimeStamp = Date.parse(_this.searchTime[1]);
        for (var target in _this.actObj) {
          _this.actObj[target] = _this.actObj[target].filter(item =>
            item.timeStamp >= _this.searchStartTimeStamp && item.timeStamp <= _this.searchEndTimeStamp
          )
          if(_this.actObj[target].length == 0){
            delete _this.actObj[target]
          }
        }
        var keyArr = Object.keys(_this.actObj);
        for(var i = 0; i < keyArr.length; i++){
          _this.actObj[keyArr[i]].forEach(dot=>{
            dot.color = _this.colorArr[i%10];
        for (var i = 0; i < keyArr.length; i++) {
          _this.actObj[keyArr[i]].forEach(dot => {
            dot.color = _this.colorArr[i % 10];
          })
        }
        console.log(new Date().getTime(), _this.actObj)