refactor(web): 工作台与监控视图 UI 优化

- MonitorSelectionPanel / VehicleMonitorPanel / SelectionDetailPanel 等工作台面板交互与展示优化
- carActionExecute:前往站点遇 404(旧 DLL 无 goto-site 路由)时回退 WebGotoSite,并给出热更新指引
- 地图监控、任务分配、反射管理等视图细节调整;theme.css 补充样式
This commit is contained in:
zhaowei.huang
2026-05-29 23:52:42 +08:00
parent ea036760cb
commit 7877146934
18 changed files with 660 additions and 442 deletions
@@ -47,14 +47,41 @@ export async function pickTargetSiteOnMap(): Promise<number | null> {
}
}
function isHttp404(e: unknown): boolean {
if (e && typeof e === 'object' && 'response' in e) {
const status = (e as { response?: { status?: number } }).response?.status
if (status === 404) return true
}
const msg = e instanceof Error ? e.message : String(e)
return /status code 404/i.test(msg)
}
export async function executeCarGotoSite(carId: number, siteId: number): Promise<boolean> {
try {
const r = await reflectionApi.gotoCarSite(carId, siteId)
ElMessage.success(r.message || `已下发前往站点 #${siteId}`)
return true
} catch (e) {
ElMessage.error(`前往站点失败:${e instanceof Error ? e.message : String(e)}`)
return false
if (!isHttp404(e)) {
ElMessage.error(`前往站点失败:${e instanceof Error ? e.message : String(e)}`)
return false
}
// goto-site 路由未加载(旧 DLL):回退 execute WebGotoSiteDummyCar / Car 上均有)
try {
const r2 = await reflectionApi.execute('car', carId, 'WebGotoSite', { siteId })
ElMessage.success(r2.returnValue ? `已执行:${r2.returnValue}` : `已下发前往站点 #${siteId}`)
return true
} catch (e2) {
const msg2 = e2 instanceof Error ? e2.message : String(e2)
const needDeploy =
/WebGotoSite|goto-site|不存在可调用方法/i.test(msg2)
ElMessage.error(
needDeploy
? `${msg2}。当前 SimpleLite 仍是旧版 DLL:请先完全关闭 SimpleLite 窗口,再在 PowerShell 执行 Migu2.0/scripts/redeploy-simplelite.ps1,然后重新登录;或调用 POST /api/health/simplelite/restart-for-update`
: `前往站点失败:${msg2}`
)
return false
}
}
}