列车曲线图限制5分钟

This commit is contained in:
dong 2023-10-17 10:28:27 +08:00
parent cd433e70dc
commit 112223b150

View File

@ -107,6 +107,11 @@ export const useLineStore = defineStore('line', {
setTrainStateMap(v: TrainState[]) {
const a = new Date();
this.trainStateMap.set(a, v);
this.trainStateMap.forEach((item, key) => {
if (a.getTime() - key.getTime() > 5 * 60 * 1000) {
this.trainStateMap.delete(key);
}
});
},
clearTrainStateMap() {
this.trainStateMap.clear();