feat: 新增卡视角以及设备视角的实名同步时间,卡状态同步时间,流量同步时间
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m56s

This commit is contained in:
sexygoat
2026-05-18 12:23:35 +08:00
parent 877c741d72
commit 894aea0e74
18 changed files with 544 additions and 63 deletions

View File

@@ -7,7 +7,7 @@
{{ data.package_name }}
</ElDescriptionsItem>
<ElDescriptionsItem label="总使用流量" :span="2">
{{ formatDataSize(data.total_usage_mb) }}
{{ formatDataSize(displayedTotalUsageMb) }}
</ElDescriptionsItem>
</ElDescriptions>
@@ -59,9 +59,9 @@
<ElTableColumn label="使用进度" min-width="200">
<template #default="{ row }">
<ElProgress
:percentage="getUsageProgress(row.cumulative_usage_mb, data.total_usage_mb)"
:percentage="getUsageProgress(row.cumulative_usage_mb, displayedTotalUsageMb)"
:color="
getProgressColor(getUsageProgress(row.cumulative_usage_mb, data.total_usage_mb))
getProgressColor(getUsageProgress(row.cumulative_usage_mb, displayedTotalUsageMb))
"
/>
</template>
@@ -86,14 +86,28 @@
ElTable,
ElTableColumn,
ElProgress,
ElEmpty,
ElMessage
ElEmpty
} from 'element-plus'
import { CardService } from '@/api/modules'
import type { PackageInfo } from '../../types'
interface Props {
modelValue: boolean
packageUsageId?: number
packageRow?: PackageInfo
}
interface DailyRecordItem {
date: string
daily_usage_mb: number
cumulative_usage_mb: number
}
interface DailyRecordsResponseData {
package_name: string
package_usage_id: number
total_usage_mb: number
records: DailyRecordItem[]
}
interface Emits {
@@ -104,16 +118,19 @@
const emit = defineEmits<Emits>()
const loading = ref(false)
const data = ref<any>(null)
const data = ref<DailyRecordsResponseData | null>(null)
const filterType = ref<'all' | 'day' | 'month'>('all')
const selectedDate = ref<string>('')
const selectedMonth = ref<string>('')
const filteredRecords = ref<any[]>([])
const filteredRecords = ref<DailyRecordItem[]>([])
const visible = computed({
get: () => props.modelValue,
set: (value) => emit('update:modelValue', value)
})
const displayedTotalUsageMb = computed(
() => props.packageRow?.real_total_mb ?? data.value?.total_usage_mb ?? 0
)
// 监听对话框打开,加载数据
watch(visible, async (newVal) => {
@@ -168,7 +185,7 @@
return
}
filteredRecords.value = data.value.records.filter((record: any) => {
filteredRecords.value = data.value.records.filter((record) => {
return record.date === selectedDate.value
})
}
@@ -181,7 +198,7 @@
return
}
filteredRecords.value = data.value.records.filter((record: any) => {
filteredRecords.value = data.value.records.filter((record) => {
return record.date.startsWith(selectedMonth.value)
})
}