fix: 修改新增用户商品的配置项逻辑
This commit is contained in:
@@ -122,3 +122,55 @@ export function formatToApiTime(time) {
|
||||
const pad = (n) => String(n).padStart(2, '0')
|
||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
|
||||
}
|
||||
|
||||
// ========== 虚拟机状态映射 ==========
|
||||
const VM_STATUS_MAP = {
|
||||
pending: { label: '等待中', type: 'info' },
|
||||
creating: { label: '创建中', type: 'warning' },
|
||||
ready: { label: '就绪', type: 'success' },
|
||||
running: { label: '运行中', type: 'success' },
|
||||
stopped: { label: '已停止', type: 'danger' },
|
||||
stop: { label: '已停止', type: 'danger' },
|
||||
shutoff: { label: '已关闭', type: 'danger' },
|
||||
error: { label: '错误', type: 'danger' },
|
||||
paused: { label: '已暂停', type: 'warning' },
|
||||
reboot: { label: '重启中', type: 'warning' },
|
||||
poweroff: { label: '已关机', type: 'info' },
|
||||
unknown: { label: '未知', type: 'info' }
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取虚拟机状态标签文字
|
||||
*/
|
||||
export function vmStatusLabel(status) {
|
||||
return VM_STATUS_MAP[status]?.label || status || '-'
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取虚拟机状态 Tag 类型
|
||||
*/
|
||||
export function vmStatusType(status) {
|
||||
return VM_STATUS_MAP[status]?.type || 'info'
|
||||
}
|
||||
|
||||
// ========== 磁盘状态映射 ==========
|
||||
const VOLUME_STATUS_MAP = {
|
||||
pending: { label: '等待中', type: 'info' },
|
||||
ready: { label: '就绪', type: 'success' },
|
||||
error: { label: '错误', type: 'danger' },
|
||||
unknown: { label: '未知', type: 'info' }
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取磁盘状态标签文字
|
||||
*/
|
||||
export function volumeStatusLabel(status) {
|
||||
return VOLUME_STATUS_MAP[status]?.label || status || '-'
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取磁盘状态 Tag 类型
|
||||
*/
|
||||
export function volumeStatusType(status) {
|
||||
return VOLUME_STATUS_MAP[status]?.type || 'info'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user