This commit is contained in:
@@ -1479,27 +1479,71 @@
|
||||
|
||||
// ========== 设备操作相关 ==========
|
||||
|
||||
// 获取设备IMEI(通过virtual_no)
|
||||
const getDeviceImei = async (virtualNo: string): Promise<string | null> => {
|
||||
try {
|
||||
const res = await AssetService.resolveAsset(virtualNo)
|
||||
if (res.code === 0 && res.data && res.data.asset_type === 'device') {
|
||||
return res.data.imei || null
|
||||
}
|
||||
return null
|
||||
} catch (error) {
|
||||
console.error('获取设备IMEI失败:', error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
// 设备操作路由
|
||||
const handleDeviceOperation = (command: string, deviceNo: string) => {
|
||||
const handleDeviceOperation = async (command: string, deviceNo: string) => {
|
||||
switch (command) {
|
||||
case 'view-cards':
|
||||
handleViewCardsByDeviceNo(deviceNo)
|
||||
break
|
||||
case 'reboot':
|
||||
handleRebootDevice(deviceNo)
|
||||
case 'reboot': {
|
||||
const imei = await getDeviceImei(deviceNo)
|
||||
if (!imei) {
|
||||
ElMessage.error('无法获取设备IMEI,无法执行重启操作')
|
||||
return
|
||||
}
|
||||
handleRebootDevice(imei)
|
||||
break
|
||||
case 'reset':
|
||||
handleResetDevice(deviceNo)
|
||||
}
|
||||
case 'reset': {
|
||||
const imei = await getDeviceImei(deviceNo)
|
||||
if (!imei) {
|
||||
ElMessage.error('无法获取设备IMEI,无法执行重置操作')
|
||||
return
|
||||
}
|
||||
handleResetDevice(imei)
|
||||
break
|
||||
case 'speed-limit':
|
||||
showSpeedLimitDialog(deviceNo)
|
||||
}
|
||||
case 'speed-limit': {
|
||||
const imei = await getDeviceImei(deviceNo)
|
||||
if (!imei) {
|
||||
ElMessage.error('无法获取设备IMEI,无法执行限速操作')
|
||||
return
|
||||
}
|
||||
showSpeedLimitDialog(imei)
|
||||
break
|
||||
case 'switch-card':
|
||||
showSwitchCardDialog(deviceNo)
|
||||
}
|
||||
case 'switch-card': {
|
||||
const imei = await getDeviceImei(deviceNo)
|
||||
if (!imei) {
|
||||
ElMessage.error('无法获取设备IMEI,无法执行切卡操作')
|
||||
return
|
||||
}
|
||||
showSwitchCardDialog(imei)
|
||||
break
|
||||
case 'set-wifi':
|
||||
showSetWiFiDialog(deviceNo)
|
||||
}
|
||||
case 'set-wifi': {
|
||||
const imei = await getDeviceImei(deviceNo)
|
||||
if (!imei) {
|
||||
ElMessage.error('无法获取设备IMEI,无法执行WiFi设置操作')
|
||||
return
|
||||
}
|
||||
showSetWiFiDialog(imei)
|
||||
break
|
||||
}
|
||||
case 'manual-deactivate':
|
||||
handleManualDeactivateDevice()
|
||||
break
|
||||
@@ -1654,8 +1698,8 @@
|
||||
}
|
||||
|
||||
// 显示切换SIM卡对话框
|
||||
const showSwitchCardDialog = async (deviceNo: string) => {
|
||||
currentOperatingImei.value = deviceNo
|
||||
const showSwitchCardDialog = async (imei: string) => {
|
||||
currentOperatingImei.value = imei
|
||||
switchCardForm.target_iccid = ''
|
||||
deviceBindingCards.value = []
|
||||
switchCardDialogVisible.value = true
|
||||
|
||||
Reference in New Issue
Block a user