feat(utils): 添加AGV运行状态工具函数

- 定义AGV运行状态常量映射,包含未知、离线、在线、手动模式等状态
- 实现状态解析函数resolveStatus,支持数字类型转换
- 提供状态标签、类型和CSS类名的导出函数
- 支持11种不同的AGV运行状态及其对应的显示样式
- 添加默认未知状态兜底处理机制
This commit is contained in:
lixiaolong 2026-08-06 11:24:50 +08:00
parent 02706a39a1
commit b332a5461e

View File

@ -0,0 +1,18 @@
const AGV_RUNTIME_STATUS = {
0: { label: '未知', type: 'info', className: 'unknown' },
1: { label: '已断开', type: 'info', className: 'offline' },
2: { label: '空闲', type: 'success', className: 'online' },
3: { label: '手动模式', type: 'primary', className: 'manual' },
4: { label: '自动运行', type: 'primary', className: 'running' },
5: { label: '充电中', type: 'warning', className: 'charging' },
6: { label: '已暂停', type: 'warning', className: 'paused' },
7: { label: '已停止', type: 'info', className: 'stopped' },
8: { label: '故障', type: 'danger', className: 'fault' },
9: { label: '急停', type: 'danger', className: 'emergency' },
}
const resolveStatus = value => AGV_RUNTIME_STATUS[Number(value)] || AGV_RUNTIME_STATUS[0]
export const agvRuntimeStatusLabel = value => resolveStatus(value).label
export const agvRuntimeStatusType = value => resolveStatus(value).type
export const agvRuntimeStatusClass = value => resolveStatus(value).className