fix: 用户虚拟机详情跳转参数问题
Build and Deploy Vue3 / build (push) Successful in 1m26s
Build and Deploy Vue3 / deploy (push) Successful in 1m17s

This commit is contained in:
2026-04-21 14:13:31 +08:00
parent ab7a8d5cfa
commit 13248468d3
3 changed files with 35 additions and 13 deletions
@@ -131,6 +131,12 @@
<div v-if="spec.attrs && spec.attrs.length > 0 && selectedArgs[spec.id]" class="matched-attr-info">
<el-tag type="success" size="small">匹配区间: {{ getMatchedAttrName(spec, selectedArgs[spec.id]) }}</el-tag>
</div>
<div v-if="getArgKey(spec) === 'system_size'" class="system-size-tip">
<el-tag :type="isSystemSizeTooSmall(spec) ? 'danger' : 'warning'" size="small" effect="light">
<el-icon style="vertical-align: -2px; margin-right: 2px;"><WarningFilled /></el-icon>
{{ isSystemSizeTooSmall(spec) ? '当前系统盘小于30GB,Windows镜像可能无法正常运行' : 'Windows系统镜像建议系统盘不低于30GB' }}
</el-tag>
</div>
</template>
<template v-else>
<el-input v-model="selectedArgs[spec.id]" placeholder="请输入值" size="small" style="width: 200px" @input="updateArgsJson" />
@@ -241,7 +247,7 @@
<script setup>
import { ref, reactive, computed, watch, nextTick } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus, Refresh, Delete, View, CopyDocument, DocumentAdd } from '@element-plus/icons-vue'
import { Plus, Refresh, Delete, View, CopyDocument, DocumentAdd, WarningFilled } from '@element-plus/icons-vue'
import {
getProductParameterList,
getProductPlanList,
@@ -426,6 +432,14 @@ const findMatchingNumberAttr = (spec, numValue) => {
return sortedAttrs[sortedAttrs.length - 1]
}
const isSystemSizeTooSmall = (spec) => {
const val = displayValues[spec.id]
if (val === undefined || val === null) return false
const unit = displayUnits[spec.id]
if (unit === 'TB') return val * 1024 < 30
return val < 30
}
const getMatchedAttrName = (spec, numValue) => {
const matchedAttr = findMatchingNumberAttr(spec, Number(numValue))
if (matchedAttr) { const priceText = matchedAttr.price ? ` (+¥${(matchedAttr.price / 100).toFixed(2)})` : ''; return `${matchedAttr.name}${priceText}` }
@@ -748,6 +762,7 @@ watch(() => props.visible, (val) => {
.number-input-wrapper { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.number-range { color: #909399; font-size: 12px; }
.matched-attr-info { margin-top: 2px; }
.system-size-tip { margin-top: 4px; }
.args-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.args-preview { padding: 0; }
.preview-header { display: flex; justify-content: space-between; align-items: center; }
+8 -2
View File
@@ -440,10 +440,12 @@
<!-- 弹窗 -->
<!-- VNC -->
<el-dialog v-model="vncVisible" title="VNC连接" width="480px" destroy-on-close>
<el-dialog v-model="vncVisible" title="VNC连接" width="480px" destroy-on-close class="vnc-dialog">
<div v-loading="vncLoading">
<el-descriptions :column="1" border v-if="vncResult">
<el-descriptions-item label="VNC地址"><el-link type="primary" :href="vncResult.url" target="_blank">{{ vncResult.url }}</el-link></el-descriptions-item>
<el-descriptions-item label="VNC地址">
<el-link type="primary" :href="vncResult.url" target="_blank" class="vnc-url-link">{{ vncResult.url }}</el-link>
</el-descriptions-item>
<el-descriptions-item label="过期时间">{{ formatVncExpire(vncResult.expire_at) }}</el-descriptions-item>
</el-descriptions>
<el-empty v-else-if="!vncLoading" description="获取失败" :image-size="60" />
@@ -2245,4 +2247,8 @@ onBeforeUnmount(() => { disposeCharts() })
.ip-popover-item:last-child { border-bottom: none; }
.ip-popover-item .ip-text { font-family: 'SF Mono', Consolas, monospace; font-size: 13px; color: #303133; word-break: break-all; }
.ip-popover-item .ip-copy-btn { flex-shrink: 0; margin-left: 8px; }
/* VNC 弹窗 */
.vnc-url-link { word-break: break-all; white-space: normal; }
.vnc-dialog :deep(.el-descriptions__cell) { word-break: break-all; }
</style>
+11 -10
View File
@@ -769,11 +769,7 @@ const fetchUserBalanceList = async (userId) => {
// 刷新数据
const refreshData = () => {
fetchUserInfo()
if (activeTabName.value === '1') {
fetchLoginHistory()
} else if (activeTabName.value === '2') {
fetchOperationHistory()
}
fetchActiveTabData()
}
// 返回上一页
@@ -1409,6 +1405,15 @@ const formatBalance = (price) => {
return (price / 100).toFixed(2)
}
const fetchActiveTabData = () => {
const tab = activeTabName.value
if (tab === '1') fetchLoginHistory()
else if (tab === '2') fetchOperationHistory()
else if (tab === '3') fetchUserOrderList()
else if (tab === '4') fetchUserTicketList()
else if (tab === '5') fetchUserGoodsList()
}
const loadUserData = async () => {
if(!route.query.user_id){
ElMessage.error('缺少用户ID参数');
@@ -1417,11 +1422,7 @@ const loadUserData = async () => {
}
await fetchUserInfo();
await fetchUserBalance();
await fetchLoginHistory();
await fetchOperationHistory();
await fetchUserOrderList();
await fetchUserTicketList();
await fetchUserGoodsList();
fetchActiveTabData();
}
// 初始化