修改运行时显示
This commit is contained in:
@@ -2,8 +2,6 @@ const { createApp } = Vue
|
||||
const API = ''
|
||||
|
||||
createApp({
|
||||
delimiters: ['[[', ']]'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
missionState: 'idle',
|
||||
@@ -15,7 +13,14 @@ createApp({
|
||||
polling: null,
|
||||
logs: [],
|
||||
showQrModal: false,
|
||||
qrSubmitting: false,
|
||||
qrValue: '',
|
||||
// 网格任务显示
|
||||
missionRows: 0,
|
||||
missionCols: 0,
|
||||
missionGrid: [],
|
||||
pointStatus: {},
|
||||
machineStatus: {},
|
||||
// 错误弹窗 / 单步执行
|
||||
waitingError: false,
|
||||
errorMsg: '',
|
||||
@@ -68,6 +73,13 @@ createApp({
|
||||
this.progress = data.progress || 0
|
||||
if (data.tasks) this.tasks = data.tasks
|
||||
|
||||
// 网格数据
|
||||
if (data.rows) this.missionRows = data.rows
|
||||
if (data.cols) this.missionCols = data.cols
|
||||
if (data.grid) this.missionGrid = data.grid
|
||||
if (data.point_status) this.pointStatus = data.point_status
|
||||
if (data.machine_status) this.machineStatus = data.machine_status
|
||||
|
||||
// 错误弹窗
|
||||
if (data.waiting_error) {
|
||||
this.waitingError = true
|
||||
@@ -84,8 +96,11 @@ createApp({
|
||||
this.waitingStep = false
|
||||
}
|
||||
|
||||
// QR 弹窗
|
||||
if (this.missionState === 'waiting_qr' && !this.showQrModal) {
|
||||
// QR 弹窗(防止提交后重复弹出)
|
||||
if (this.missionState !== 'waiting_qr') {
|
||||
this.qrSubmitting = false
|
||||
}
|
||||
if (this.missionState === 'waiting_qr' && !this.showQrModal && !this.qrSubmitting) {
|
||||
this.showQrModal = true
|
||||
this.qrValue = ''
|
||||
}
|
||||
@@ -190,10 +205,12 @@ createApp({
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ qr: val || ' ' })
|
||||
})
|
||||
this.qrSubmitting = true
|
||||
this.showQrModal = false
|
||||
this.qrValue = ''
|
||||
},
|
||||
cancelQr() {
|
||||
this.qrSubmitting = true
|
||||
this.showQrModal = false
|
||||
this.qrValue = ''
|
||||
fetch(API + '/api/mission/manual-qr', {
|
||||
@@ -207,6 +224,36 @@ createApp({
|
||||
},
|
||||
onArmPreviewError(e) {
|
||||
e.target.style.display = 'none'
|
||||
},
|
||||
// ===== 网格任务显示方法 =====
|
||||
getPointStatus(pr, c) {
|
||||
return (this.pointStatus && this.pointStatus[pr + '_' + c]) || 'pending'
|
||||
},
|
||||
navIcon(s) {
|
||||
const m = { pending: '⏳', active: '🔄', done: '✅', skipped: '⏭️' }
|
||||
return m[s] || '⏳'
|
||||
},
|
||||
navLabel(s) {
|
||||
const m = { pending: '等待', active: '导航中', done: '到达', skipped: '空位' }
|
||||
return m[s] || '等待'
|
||||
},
|
||||
hasMachine(r, c) {
|
||||
const key = r + '_' + c
|
||||
const ms = this.machineStatus && this.machineStatus[key]
|
||||
return ms && ms.has_machine
|
||||
},
|
||||
getMachineClass(r, c) {
|
||||
const key = r + '_' + c
|
||||
const ms = this.machineStatus && this.machineStatus[key]
|
||||
if (!ms) return ''
|
||||
const s = ms.status || 'pending'
|
||||
return 'mstatus-' + s
|
||||
},
|
||||
getMachineField(r, c, field) {
|
||||
const key = r + '_' + c
|
||||
const ms = this.machineStatus && this.machineStatus[key]
|
||||
if (!ms) return ''
|
||||
return ms[field] || ''
|
||||
}
|
||||
}
|
||||
}).mount('#app')
|
||||
Reference in New Issue
Block a user