From 9e50046f723cc851ba97c2a4a8edabe85ec2030b Mon Sep 17 00:00:00 2001 From: yyy <2605810609@qq.com> Date: Fri, 28 Feb 2025 10:19:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E5=9B=9E=E9=87=8D=E5=81=9Abug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mapPage/realTimeMap/editMap.vue | 47 ++++--- src/views/mapPage/realTimeMap/test.vue | 161 +++++++++------------- 2 files changed, 92 insertions(+), 116 deletions(-) diff --git a/src/views/mapPage/realTimeMap/editMap.vue b/src/views/mapPage/realTimeMap/editMap.vue index 7c5b4520..c854927b 100644 --- a/src/views/mapPage/realTimeMap/editMap.vue +++ b/src/views/mapPage/realTimeMap/editMap.vue @@ -770,32 +770,31 @@ const deactivatedHandle = () => {} //添加历史记录 const addEditHistory = () => { //要判断是不是在最新的记录上修改 如果不是 要把currentIndex之后的记录都删掉 保持当前修改是最新的 - if (state.currentIndex !== state.allHistoryList.length - 1) { - state.allHistoryList = state.allHistoryList.splice(0, state.currentIndex) - state.currentIndex = state.allHistoryList.length - state.allHistoryList.push({ - allMapPointInfo: JSON.parse(JSON.stringify(state.allMapPointInfo)), - mapRouteList: JSON.parse(JSON.stringify(state.mapRouteList)) - }) - } else { - state.allHistoryList.push({ - allMapPointInfo: JSON.parse(JSON.stringify(state.allMapPointInfo)), - mapRouteList: JSON.parse(JSON.stringify(state.mapRouteList)) - }) - state.currentIndex++ + if (state.currentIndex < state.allHistoryList.length - 1) { + state.allHistoryList.splice(state.currentIndex + 1) } + state.allHistoryList.push({ + allMapPointInfo: JSON.parse(JSON.stringify(state.allMapPointInfo)), + mapRouteList: JSON.parse(JSON.stringify(state.mapRouteList)) + }) + state.currentIndex = state.allHistoryList.length - 1 interfaceRefreshed.value = true } //上一步 const backPreviousStep = () => { - console.log(state.currentIndex) - console.log(state.allMapPointInfo) - console.log(state.allHistoryList) if (state.currentIndex > 0) { state.currentIndex-- - state.allMapPointInfo = state.allHistoryList[state.currentIndex]?.allMapPointInfo || [] - state.mapRouteList = state.allHistoryList[state.currentIndex]?.mapRouteList || [] + state.allMapPointInfo.splice( + 0, + state.allMapPointInfo.length, + ...JSON.parse(JSON.stringify(state.allHistoryList[state.currentIndex]?.allMapPointInfo)) + ) + state.mapRouteList.splice( + 0, + state.mapRouteList.length, + ...JSON.parse(JSON.stringify(state.allHistoryList[state.currentIndex]?.mapRouteList)) + ) } else { message.warning('没了老铁') } @@ -804,8 +803,16 @@ const backPreviousStep = () => { const backNextStep = () => { if (state.currentIndex < state.allHistoryList.length - 1) { state.currentIndex++ - state.allMapPointInfo = state.allHistoryList[state.currentIndex]?.allMapPointInfo || [] - state.mapRouteList = state.allHistoryList[state.currentIndex]?.mapRouteList || [] + state.allMapPointInfo.splice( + 0, + state.allMapPointInfo.length, + ...JSON.parse(JSON.stringify(state.allHistoryList[state.currentIndex]?.allMapPointInfo)) + ) + state.mapRouteList.splice( + 0, + state.mapRouteList.length, + ...JSON.parse(JSON.stringify(state.allHistoryList[state.currentIndex]?.mapRouteList)) + ) } else { message.warning('没了老铁') } diff --git a/src/views/mapPage/realTimeMap/test.vue b/src/views/mapPage/realTimeMap/test.vue index 8c7afb5b..1aa08b6a 100644 --- a/src/views/mapPage/realTimeMap/test.vue +++ b/src/views/mapPage/realTimeMap/test.vue @@ -1,110 +1,79 @@