This commit is contained in:
		
							parent
							
								
									68aacde426
								
							
						
					
					
						commit
						534baec75d
					
				| 
						 | 
				
			
			@ -347,39 +347,45 @@ export default {
 | 
			
		|||
            const match = newVal.some((item) => positionID.includes(item.id));
 | 
			
		||||
            if (match) {
 | 
			
		||||
              newVal.forEach((newItem) => {
 | 
			
		||||
                // 如果已经存在相同BatchId的数据,重置计时器
 | 
			
		||||
                if (newItem.BatchId) {
 | 
			
		||||
                  const existingTimer = this.droneTimers.get(newItem.BatchId);
 | 
			
		||||
                  if (existingTimer) {
 | 
			
		||||
                    clearInterval(existingTimer); // 清除旧计时器
 | 
			
		||||
                  }
 | 
			
		||||
                if (newItem.drone_lon !== 0 && newItem.drone_lat !== 0) {
 | 
			
		||||
                  // 如果已经存在相同BatchId的数据,重置计时器
 | 
			
		||||
                  if (newItem.BatchId) {
 | 
			
		||||
                    const existingTimer = this.droneTimers.get(newItem.BatchId);
 | 
			
		||||
                    if (existingTimer) {
 | 
			
		||||
                      clearInterval(existingTimer); // 清除旧计时器
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                  // 设置15秒初始时间
 | 
			
		||||
                  newItem.currTime = window.mapConfig.currTime;
 | 
			
		||||
                  // 创建新计时器
 | 
			
		||||
                  const timer = this.startTimer(newItem);
 | 
			
		||||
                  this.droneTimers.set(newItem.BatchId, timer);
 | 
			
		||||
                    // 设置15秒初始时间
 | 
			
		||||
                    newItem.currTime = window.mapConfig.currTime;
 | 
			
		||||
                    // 创建新计时器
 | 
			
		||||
                    const timer = this.startTimer(newItem);
 | 
			
		||||
                    this.droneTimers.set(newItem.BatchId, timer);
 | 
			
		||||
 | 
			
		||||
                  // 初始化 detailsShow(仅首次)
 | 
			
		||||
                  if (!(newItem.BatchId in this.droneStates)) {
 | 
			
		||||
                    this.$set(this.droneStates, newItem.BatchId, true);
 | 
			
		||||
                  }
 | 
			
		||||
                  // 默认隐藏 navigation-content
 | 
			
		||||
                  if (!(newItem.BatchId in this.navigationStates)) {
 | 
			
		||||
                    this.$set(this.navigationStates, newItem.BatchId, false);
 | 
			
		||||
                  }
 | 
			
		||||
                    // 初始化 detailsShow(仅首次)
 | 
			
		||||
                    if (!(newItem.BatchId in this.droneStates)) {
 | 
			
		||||
                      this.$set(this.droneStates, newItem.BatchId, true);
 | 
			
		||||
                    }
 | 
			
		||||
                    // 默认隐藏 navigation-content
 | 
			
		||||
                    if (!(newItem.BatchId in this.navigationStates)) {
 | 
			
		||||
                      this.$set(this.navigationStates, newItem.BatchId, false);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                  // 更新无人机列表
 | 
			
		||||
                  const existingIndex = this.drones.findIndex(
 | 
			
		||||
                    (d) => d.BatchId === newItem.BatchId
 | 
			
		||||
                  );
 | 
			
		||||
                  newItem.times = moment(newItem.CreateTime).format("HH:mm:ss");
 | 
			
		||||
                  newItem.distance = parseInt(newItem.distance.toFixed(0));
 | 
			
		||||
                    // 更新无人机列表
 | 
			
		||||
                    const existingIndex = this.drones.findIndex(
 | 
			
		||||
                      (d) => d.BatchId === newItem.BatchId
 | 
			
		||||
                    );
 | 
			
		||||
                    newItem.times = moment(newItem.CreateTime).format(
 | 
			
		||||
                      "HH:mm:ss"
 | 
			
		||||
                    );
 | 
			
		||||
                    newItem.distance = parseInt(newItem.distance.toFixed(0));
 | 
			
		||||
 | 
			
		||||
                  if (existingIndex !== -1) {
 | 
			
		||||
                    this.$set(this.drones, existingIndex, { ...newItem });
 | 
			
		||||
                  } else {
 | 
			
		||||
                    this.$set(this.drones, this.drones.length, { ...newItem });
 | 
			
		||||
                    if (existingIndex !== -1) {
 | 
			
		||||
                      this.$set(this.drones, existingIndex, { ...newItem });
 | 
			
		||||
                    } else {
 | 
			
		||||
                      this.$set(this.drones, this.drones.length, {
 | 
			
		||||
                        ...newItem
 | 
			
		||||
                      });
 | 
			
		||||
                    }
 | 
			
		||||
                  }
 | 
			
		||||
                }
 | 
			
		||||
              });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,6 +82,8 @@ export default {
 | 
			
		|||
            zoom: 13
 | 
			
		||||
          });
 | 
			
		||||
          this.$store.commit("SET_POSITIONPOINT", false);
 | 
			
		||||
        } else {
 | 
			
		||||
          this.$message.error("定位失败,请稍后重试");
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      deep: true
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue