显示机械臂摄像头图片
This commit is contained in:
@@ -57,7 +57,13 @@ createApp({
|
||||
qrScanning: false,
|
||||
qrConfigs: [],
|
||||
qrScanningId: null,
|
||||
showQrInputDialog: false,
|
||||
qrInputId: null,
|
||||
qrInputValue: '',
|
||||
armCameraUrl: API + '/api/camera/arm_preview',
|
||||
armSnapshotUrl: '',
|
||||
showArmSnapshot: false,
|
||||
armSnapshotLoading: false,
|
||||
newQrName: '',
|
||||
armInitialPose: [0, 0, 0, 0, 0, 0],
|
||||
}
|
||||
@@ -1104,10 +1110,39 @@ createApp({
|
||||
if (data.model_name) msg += ' 匹配机型: ' + data.model_name
|
||||
else msg += ' 未匹配到机型'
|
||||
alert(msg)
|
||||
} else { alert(data.error || '扫描失败') }
|
||||
} catch (e) { alert('扫描失败: ' + e.message) }
|
||||
} else {
|
||||
// 自动扫描失败,弹出手动输入框
|
||||
this.qrInputId = qrId
|
||||
this.qrInputValue = ''
|
||||
this.showQrInputDialog = true
|
||||
}
|
||||
} catch (e) {
|
||||
this.qrInputId = qrId
|
||||
this.qrInputValue = ''
|
||||
this.showQrInputDialog = true
|
||||
}
|
||||
this.qrScanningId = null
|
||||
},
|
||||
async submitManualQr() {
|
||||
if (!this.qrInputId || !this.qrInputValue.trim()) return
|
||||
try {
|
||||
const res = await fetch(API + '/api/qr/configs/' + this.qrInputId, {
|
||||
method: 'PUT',
|
||||
headers: {'Content-Type':'application/json'},
|
||||
body: JSON.stringify({ qr_value: this.qrInputValue.trim() })
|
||||
})
|
||||
const data = await res.json()
|
||||
if (data.ok) {
|
||||
await this.loadQrConfigs()
|
||||
alert('✅ 二维码值已保存')
|
||||
} else {
|
||||
alert('保存失败')
|
||||
}
|
||||
} catch (e) { alert('保存失败: ' + e.message) }
|
||||
this.showQrInputDialog = false
|
||||
this.qrInputId = null
|
||||
this.qrInputValue = ''
|
||||
},
|
||||
async applyQrAngles(qrId) {
|
||||
if (!this.armConnected) { alert('机械臂未连接'); return }
|
||||
const q = this.qrConfigs.find(x => x.id === qrId)
|
||||
@@ -1126,6 +1161,12 @@ createApp({
|
||||
onArmPreviewError() {
|
||||
// 机械臂摄像头预览失败,静默处理
|
||||
},
|
||||
async captureArmSnapshot() {
|
||||
this.armSnapshotLoading = true
|
||||
this.armSnapshotUrl = API + '/api/camera/arm_refresh?t=' + Date.now()
|
||||
this.showArmSnapshot = true
|
||||
setTimeout(() => { this.armSnapshotLoading = false }, 500)
|
||||
},
|
||||
async agvResetCollision() {
|
||||
if (!this.agvConnected) {
|
||||
alert('AGV 未连接')
|
||||
|
||||
Reference in New Issue
Block a user