diff --git a/src/views/inspection/cockpit/components/ManualTakeover/index.vue b/src/views/inspection/cockpit/components/ManualTakeover/index.vue index fa40298..4cbb293 100644 --- a/src/views/inspection/cockpit/components/ManualTakeover/index.vue +++ b/src/views/inspection/cockpit/components/ManualTakeover/index.vue @@ -11,7 +11,7 @@
{{ item.robotName }}
-
{{ robotStatus[item.status] }}
+
{{ agvRuntimeStatusLabel(item.status) }}
@@ -122,7 +122,7 @@ @@ -224,6 +226,31 @@ onMounted(() => { background: #0f83; color: #0f8; } + + .unknown, + .offline, + .stopped { + background: rgba(148, 163, 184, 0.2); + color: #cbd5e1; + } + + .manual, + .running { + background: rgba(0, 212, 255, 0.18); + color: #00d4ff; + } + + .charging, + .paused { + background: rgba(255, 179, 0, 0.2); + color: #ffb300; + } + + .fault, + .emergency { + background: rgba(255, 77, 79, 0.2); + color: #ff6b6d; + } } .info-box { @@ -403,4 +430,4 @@ onMounted(() => { } } } - \ No newline at end of file + diff --git a/src/views/inspection/robot/index.vue b/src/views/inspection/robot/index.vue index 414f917..f48a64c 100644 --- a/src/views/inspection/robot/index.vue +++ b/src/views/inspection/robot/index.vue @@ -185,6 +185,7 @@ import { computed, getCurrentInstance, onBeforeUnmount, onMounted, reactive, ref import { ElMessage, ElMessageBox } from 'element-plus' import { addRobot, deleteRobot, getRobotDevices, getRobotList, getRobotStatus, updateRobot } from '@/api/inspection/robot' import { getMapList } from '@/api/inspection/map' +import { agvRuntimeStatusLabel, agvRuntimeStatusType } from '@/utils/agvRuntimeStatus' const { proxy } = getCurrentInstance() const { robot_type } = proxy.useDict('robot_type') @@ -256,8 +257,8 @@ async function loadDevices(showLoading = true) { try { const res = await getRobotDevices(activeRobot.value.id); devices.value = res.data || [] } finally { deviceLoading.value = false } } function endpointText(row) { return row.ipAddress && row.port ? `${row.ipAddress}:${row.port}` : '等待连接后自动获取' } -function runtimeStatusLabel(value) { return ({ 0: '在线', 1: '离线', 2: '充电中', 3: '巡检中' })[value] || '未知' } -function runtimeStatusType(value) { return ({ 0: 'success', 1: 'info', 2: 'warning', 3: 'primary' })[value] || 'info' } +const runtimeStatusLabel = agvRuntimeStatusLabel +const runtimeStatusType = agvRuntimeStatusType function hasBattery(row) { return row.batteryLevel !== null && row.batteryLevel !== undefined && row.batteryLevel !== '' } function normalizeBattery(value) { return Math.max(0, Math.min(100, Math.round(Number(value) || 0))) } function batteryColor(value) {