打点连续点击bug,建图调重启接口

This commit is contained in:
2026-01-27 13:28:00 +08:00
parent 51f91b4cc9
commit ece75ff87a
6 changed files with 124 additions and 21 deletions

View File

@@ -13,6 +13,8 @@ export const setStation = (sn, code) => post('teaching/setStation?stationName='
export const stopMapping = () => post('teaching/stopMapping', {}) export const stopMapping = () => post('teaching/stopMapping', {})
export const getLocalMaps = () => post('teaching/getLocalMaps', {}) export const getLocalMaps = () => post('teaching/getLocalMaps', {})
export const oneClickDeployment = (map) => post('teaching/oneClickDeployment?mapName=' + map, {}) export const oneClickDeployment = (map) => post('teaching/oneClickDeployment?mapName=' + map, {})
export const teachingRestart = () => post('teaching/restart', {})
export const teachingStartingPointRelocate = () => post('teaching/startingPointRelocate', {})
export const abandonMapping = () => post('teaching/abandonMapping', {}) export const abandonMapping = () => post('teaching/abandonMapping', {})
export const sendAutoBack = (is) => post('teaching/sendAutoBack?isBack=' + is, {}) export const sendAutoBack = (is) => post('teaching/sendAutoBack?isBack=' + is, {})

View File

@@ -757,6 +757,15 @@ export const getMappingStatus = () => {
} }
return res return res
} }
export const teachingStartingPointRelocate = () => {
let res = {
code: 200,
message: 'ok',
mapping_return: '1',
mapping_percent: '50'
}
return res
}
export const queryErrorDataByCode = (code) => { export const queryErrorDataByCode = (code) => {
let res = { let res = {
"error_id": "1", "error_id": "1",
@@ -841,6 +850,13 @@ export const oneClickDeployment = (sn, code) => {
} }
return res return res
} }
export const teachingRestart = (sn, code) => {
let res = {
code: 200,
message: 'ok'
}
return res
}
export const abandonMapping = (sn, code) => { export const abandonMapping = (sn, code) => {
let res = { let res = {
code: 200, code: 200,

View File

@@ -31,7 +31,7 @@
</el-form> </el-form>
<el-row type="flex" justify="space-around" style="margin-top: .3rem"> <el-row type="flex" justify="space-around" style="margin-top: .3rem">
<el-col :span="7"><button class="button_control button_control_disabled" @click="dialogVisible = false"><p>{{$t('Cancel')}}</p></button></el-col> <el-col :span="7"><button class="button_control button_control_disabled" @click="dialogVisible = false"><p>{{$t('Cancel')}}</p></button></el-col>
<el-col :span="7"><button class="button_control" @click="stationConfirm"><p>{{$t('Save')}}</p></button></el-col> <el-col :span="7"><button class="button_control" :disabled="disabled" @click="stationConfirm"><p>{{$t('Save')}}</p></button></el-col>
</el-row> </el-row>
</el-dialog> </el-dialog>
<transition name="custom-message" > <transition name="custom-message" >
@@ -52,6 +52,11 @@
></el-progress> ></el-progress>
</div> </div>
</div> </div>
<div v-if="resShow" class="progress-mask">
<div class="progress-container">
<div class="progress_tip">系统正在重启</div>
</div>
</div>
<div v-if="tipShow" class="progress-mask" style="z-index: 2003;"> <div v-if="tipShow" class="progress-mask" style="z-index: 2003;">
<div class="progress-container"> <div class="progress-container">
<div class="progress_tip">{{autoBackFinish === '2' ? $t('autobackfailedmanually') : $t('vehicleautobacknotmanwaitcompleted')}}</div> <div class="progress_tip">{{autoBackFinish === '2' ? $t('autobackfailedmanually') : $t('vehicleautobacknotmanwaitcompleted')}}</div>
@@ -66,7 +71,7 @@
<script> <script>
import DriverModal from './driver-modal.vue' import DriverModal from './driver-modal.vue'
import GlMap from './gl-map.vue' import GlMap from './gl-map.vue'
import { startMapping, stopMapping, getMappingStatus, setStation, oneClickDeployment, abandonMapping, sendAutoBack } from '@/config/getData.js' import { startMapping, stopMapping, getMappingStatus, setStation, oneClickDeployment, teachingRestart, teachingStartingPointRelocate, abandonMapping, sendAutoBack } from '@/config/getData.js'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
name: 'ModuleBuilding', name: 'ModuleBuilding',
@@ -144,27 +149,31 @@ export default {
percentage: 0, percentage: 0,
intervalId: null, // 用于存储定时器ID intervalId: null, // 用于存储定时器ID
backActive: false, // 打点完成后新增一个弹框 提示用户是否自动开回上一个点 backActive: false, // 打点完成后新增一个弹框 提示用户是否自动开回上一个点
tipShow: false // 正在自动回退中的提示 tipShow: false, // 正在自动回退中的提示
resShow: false,
pollingTimer: null,
retryCount: 0,
maxRetryCount: 3
} }
}, },
computed: { computed: {
...mapGetters(['isTop', 'carPosition', 'autoLoopEnable', 'autoBackEnable', 'autoBackFinish']) ...mapGetters(['isTop', 'carPosition', 'autoLoopEnable', 'autoBackEnable', 'autoBackFinish', 'ready'])
}, },
watch: { watch: {
autoBackEnable: { autoBackEnable: {
handler (val) { handler(val) {
this.backHandleChange(this.backActive, val) this.backHandleChange(this.backActive, val)
}, },
deep: true deep: true
}, },
backActive: { backActive: {
handler (val) { handler(val) {
this.backHandleChange(val, this.autoBackEnable) this.backHandleChange(val, this.autoBackEnable)
}, },
deep: true deep: true
}, },
autoBackFinish: { autoBackFinish: {
handler (val) { handler(val) {
if (val === '1') { if (val === '1') {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.glMap.init() this.$refs.glMap.init()
@@ -173,12 +182,25 @@ export default {
} }
}, },
deep: true deep: true
},
ready: {
handler(newVal) {
if (newVal === '1' && this.pollingTimer) {
this._executeTeachingStartingPointRelocate()
}
},
deep: true
} }
}, },
beforeDestroy () { beforeDestroy () {
document.removeEventListener('keydown', this.handleKeydown); document.removeEventListener('keydown', this.handleKeydown);
if (this.intervalId) { if (this.intervalId) {
clearTimeout(this.intervalId) clearTimeout(this.intervalId)
this.intervalId = null
}
if (this.pollingTimer) {
clearTimeout(this.pollingTimer)
this.pollingTimer = null
} }
}, },
mounted() { mounted() {
@@ -277,6 +299,7 @@ export default {
}, },
// 打点->保存 // 打点->保存
stationConfirm () { stationConfirm () {
this.disabled = true
this.$refs.dataForm.validate((valid) => { this.$refs.dataForm.validate((valid) => {
if (valid) { if (valid) {
this.submitSuccess = true this.submitSuccess = true
@@ -285,12 +308,12 @@ export default {
this.submitSuccess = false this.submitSuccess = false
}, 3000) }, 3000)
} else { } else {
this.disabled = false
return false return false
} }
}) })
}, },
async _setStation () { async _setStation () {
this.disabled = true
try { try {
let res = await setStation(this.dataForm.stationName, this.dataForm.stationCode) let res = await setStation(this.dataForm.stationName, this.dataForm.stationCode)
if (res) { if (res) {
@@ -410,12 +433,8 @@ export default {
try { try {
let res = await oneClickDeployment(this.mapName) let res = await oneClickDeployment(this.mapName)
if (res && res.code === 200) { if (res && res.code === 200) {
this.$message({ this._startPolling()
type: 'success', this.resShow = true
message: res.message
})
this.needsConfirmation = false
this.$router.push('/index/home')
} else { } else {
this.$message.error(res.message) this.$message.error(res.message)
} }
@@ -435,6 +454,65 @@ export default {
this.loading.close() this.loading.close()
} }
}, },
_startPolling() {
this.retryCount = 0
if (this.pollingTimer) {
clearTimeout(this.pollingTimer)
this.pollingTimer = null
}
this._pollingStep()
},
_pollingStep() {
if (this.retryCount >= this.maxRetryCount) {
if (this.pollingTimer) {
clearTimeout(this.pollingTimer)
this.pollingTimer = null
}
return
}
this._teachingRestart()
this.pollingTimer = setTimeout(() => {
if (this.ready === '1') {
this._executeTeachingStartingPointRelocate()
} else {
this.retryCount++
this._pollingStep()
}
}, 60000)
},
async _executeTeachingStartingPointRelocate() {
if (this.pollingTimer) {
clearTimeout(this.pollingTimer)
this.pollingTimer = null
}
this.resShow = false
await this._teachingStartingPointRelocate()
},
async _teachingRestart () {
try {
let res = await teachingRestart()
console.log(this.retryCount)
if (this.retryCount === 2) {
this.resShow = false
}
} catch (e) {
this.resShow = false
}
},
async _teachingStartingPointRelocate () {
try {
let res = await teachingStartingPointRelocate()
this.$message({
type: 'success',
message: res.message,
duration: 0
})
this.needsConfirmation = false
this.$router.push('/index/home')
} catch (e) {
console.log(e)
}
},
closeCloud () { closeCloud () {
this.cloudOff = !this.cloudOff this.cloudOff = !this.cloudOff
if (this.cloudOff) { if (this.cloudOff) {
@@ -529,6 +607,7 @@ export default {
/* 进度条容器 */ /* 进度条容器 */
.progress-container .progress-container
min-width 420px
background-color: #fff; background-color: #fff;
padding: 30px 40px; padding: 30px 40px;
border-radius: 8px; border-radius: 8px;

View File

@@ -106,7 +106,7 @@ export default {
// "error_id": "2", // "error_id": "2",
// "error_name": "重定位超时", // "error_name": "重定位超时",
// "zh_error_name": '重定位超时', // "zh_error_name": '重定位超时',
// "en_error_name": '重定位超时error', // "en_error_name": 'out time error',
// "error_code": "2", // "error_code": "2",
// "error_category": 1, // "error_category": 1,
// "error_description": "出现了重定位超时", // "error_description": "出现了重定位超时",
@@ -115,9 +115,10 @@ export default {
// "error_type": 1} // "error_type": 1}
// ], // ],
// forkTipObstacles: '1', // forkTipObstacles: '1',
// auto_loop_enable: '0', // auto_loop_enable: '1',
// auto_back_enable: '', // auto_back_enable: '',
// auto_back_finish: '' // auto_back_finish: '',
// ready: '0'
// }, // },
taskSeq: [], taskSeq: [],
currentStep: null, currentStep: null,

View File

@@ -231,11 +231,11 @@
font-size .2rem font-size .2rem
.el-message-box__headerbtn .el-message-box__headerbtn
font-size .2rem font-size .2rem
.el-message-box__content .el-message-box__content, .el-message__content, .el-message__icon
font-size .2rem font-size .2rem
.el-message-box__message p .el-message-box__message p
font-size .2rem font-size .2rem
line-height: .2rem line-height: .22rem
.el-progress-bar__inner,.el-progress-bar__outer .el-progress-bar__inner,.el-progress-bar__outer
border-radius 0 border-radius 0
.el-progress__text .el-progress__text

View File

@@ -7,7 +7,8 @@ const state = {
backIoStatus: '0', backIoStatus: '0',
autoLoopEnable: '0', autoLoopEnable: '0',
autoBackEnable: '', autoBackEnable: '',
autoBackFinish: '' autoBackFinish: '',
ready: ''
} }
const getters = { const getters = {
@@ -17,7 +18,8 @@ const getters = {
backIoStatus: state => state.backIoStatus, backIoStatus: state => state.backIoStatus,
autoLoopEnable: state => state.autoLoopEnable, autoLoopEnable: state => state.autoLoopEnable,
autoBackEnable: state => state.autoBackEnable, autoBackEnable: state => state.autoBackEnable,
autoBackFinish: state => state.autoBackFinish autoBackFinish: state => state.autoBackFinish,
ready: state => state.ready
} }
const actions = { const actions = {
@@ -52,6 +54,9 @@ const mutations = {
if (Object.prototype.hasOwnProperty.call(data, 'auto_back_finish')) { if (Object.prototype.hasOwnProperty.call(data, 'auto_back_finish')) {
state.autoBackFinish = data.auto_back_finish state.autoBackFinish = data.auto_back_finish
} }
if (Object.prototype.hasOwnProperty.call(data, 'ready')) {
state.ready = data.ready
}
} }
} }