diff --git a/src/utils/agvRuntimeStatus.js b/src/utils/agvRuntimeStatus.js new file mode 100644 index 0000000..5d34334 --- /dev/null +++ b/src/utils/agvRuntimeStatus.js @@ -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