超时时间修改

This commit is contained in:
2026-02-27 10:27:04 +08:00
parent 745b224062
commit 27afd728e0

View File

@@ -61,6 +61,12 @@
<script> <script>
import { getCalibrationConfigInfo, calibrationDepthcamera, calibrationLaser, startCalibrationCamera, endCalibrationCamera, getCalibrationByTaskId } from '@/config/getData.js' import { getCalibrationConfigInfo, calibrationDepthcamera, calibrationLaser, startCalibrationCamera, endCalibrationCamera, getCalibrationByTaskId } from '@/config/getData.js'
const POLLING_CONFIG = {
INTERVAL: 1000, // 轮询间隔 1秒
TIMEOUT: 3 * 60 * 1000 // 超时时间 3分钟
}
export default { export default {
name: 'calibration-index', name: 'calibration-index',
data () { data () {
@@ -78,7 +84,8 @@ export default {
taskId: null, taskId: null,
timer: null, timer: null,
isPolling: false, isPolling: false,
dialogVisible: false dialogVisible: false,
timeoutTimer: null
} }
}, },
mounted () { mounted () {
@@ -94,6 +101,10 @@ export default {
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null this.timer = null
} }
if (this.timeoutTimer) {
clearTimeout(this.timeoutTimer)
this.timeoutTimer = null
}
}, },
async _pollTaskStatus(type) { async _pollTaskStatus(type) {
if (!this.taskId) return if (!this.taskId) return
@@ -115,9 +126,9 @@ export default {
} catch (e) { } catch (e) {
console.error('轮询任务状态失败:', e) console.error('轮询任务状态失败:', e)
} }
}, 1000) }, POLLING_CONFIG.INTERVAL)
setTimeout(() => { this.timeoutTimer = setTimeout(() => {
if (this.isPolling) { if (this.isPolling) {
this.isPolling = false this.isPolling = false
this._clearTimer() this._clearTimer()
@@ -128,7 +139,7 @@ export default {
this.disabled5 = false this.disabled5 = false
} }
} }
}, 60000) }, POLLING_CONFIG.TIMEOUT)
}, },
_handleTaskStatus(status, type) { _handleTaskStatus(status, type) {
if (!this.isPolling) return if (!this.isPolling) return