feat: 用户商品状态筛选与统计对接
- 新增 getUserGoodsCount 接口对接,列表页/虚拟机列表页增加状态筛选与统计卡片 - 已删除/已到期商品适配及相关页面更新 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="uvm-detail">
|
||||
<div class="page-header">
|
||||
<div class="uvm-detail" :class="{ 'is-embedded': embedded }">
|
||||
<div class="page-header" v-if="!embedded">
|
||||
<div class="header-left">
|
||||
<el-button link @click="goBack"><el-icon><ArrowLeft /></el-icon>返回列表</el-button>
|
||||
<el-divider direction="vertical" />
|
||||
@@ -1182,6 +1182,11 @@ import { ref, reactive, computed, watch, onMounted, onBeforeUnmount, onActivated
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ArrowLeft, Refresh, ArrowDown, Monitor, WarningFilled, View, Hide, CopyDocument, Edit, Delete } from '@element-plus/icons-vue'
|
||||
|
||||
const props = defineProps({
|
||||
embedded: { type: Boolean, default: false },
|
||||
goodsId: { type: Number, default: 0 }
|
||||
})
|
||||
import {
|
||||
getUserVmDetail, getUserVmVnc, getUserVmHostImages,
|
||||
startUserVm, stopUserVm, rebootUserVm, suspendUserVm, resumeUserVm, rescueUserVm, exitRescueUserVm, rebuildUserVm, deleteUserVm,
|
||||
@@ -1211,7 +1216,7 @@ import * as echarts from 'echarts'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const userGoodsId = ref(parseInt(route.query.id) || 0)
|
||||
const userGoodsId = ref(props.embedded ? props.goodsId : (parseInt(route.query.id) || 0))
|
||||
|
||||
const loading = ref(false)
|
||||
const actionLoading = ref(false)
|
||||
@@ -1319,7 +1324,7 @@ const vmStatusType = (s) => vmStatusTypeUtil(s)
|
||||
const vmStatusLabel = (s) => vmStatusLabelUtil(s)
|
||||
const taskStatusType = (s) => ({ running: 'primary', completed: 'success', ready: 'success', failed: 'danger', error: 'danger', pending: 'info' }[s] || 'info')
|
||||
|
||||
const goBack = () => router.back()
|
||||
const goBack = () => { if (!props.embedded) router.back() }
|
||||
|
||||
const loadDetail = async () => {
|
||||
if (!userGoodsId.value) return
|
||||
@@ -2673,16 +2678,22 @@ const reloadWithNewId = (newId) => {
|
||||
loadDetail()
|
||||
}
|
||||
|
||||
watch(() => route.query.id, (newVal) => {
|
||||
if (route.path === '/user-goods/vm-detail') {
|
||||
if (props.embedded) {
|
||||
watch(() => props.goodsId, (newVal) => {
|
||||
reloadWithNewId(newVal || 0)
|
||||
})
|
||||
} else {
|
||||
watch(() => route.query.id, (newVal) => {
|
||||
reloadWithNewId(parseInt(newVal) || 0)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => { loadDetail() })
|
||||
|
||||
onActivated(() => {
|
||||
reloadWithNewId(parseInt(route.query.id) || 0)
|
||||
if (!props.embedded) {
|
||||
reloadWithNewId(parseInt(route.query.id) || 0)
|
||||
}
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => { disposeCharts() })
|
||||
@@ -2690,6 +2701,7 @@ onBeforeUnmount(() => { disposeCharts() })
|
||||
|
||||
<style scoped>
|
||||
.uvm-detail { padding: 0; }
|
||||
.uvm-detail.is-embedded .main-content { padding: 0; }
|
||||
.page-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: #fff; border-bottom: 1px solid #ebeef5; }
|
||||
.header-left { display: flex; align-items: center; gap: 0; }
|
||||
.page-title { font-size: 16px; font-weight: 600; color: #303133; }
|
||||
|
||||
Reference in New Issue
Block a user