fix: 修改新增用户商品的配置项逻辑
Build and Deploy Vue3 / build (push) Successful in 4m9s
Build and Deploy Vue3 / deploy (push) Successful in 1m3s

This commit is contained in:
2026-04-06 18:44:11 +08:00
parent c07e09c151
commit f0e89695f4
36 changed files with 2078 additions and 190 deletions
+52
View File
@@ -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'
}