5196a72ac2
Co-Authored-By: Claude Code <noreply@anthropic.com>
50 lines
1.5 KiB
Vue
50 lines
1.5 KiB
Vue
<template>
|
|
<span class="data-asof">
|
|
<el-tag v-if="asOfText" size="small" type="info" effect="plain">数据截至 {{ asOfText }}</el-tag>
|
|
<el-tag v-else size="small" type="info">无数据</el-tag>
|
|
<el-tag
|
|
v-if="metricVersion"
|
|
size="small"
|
|
effect="plain"
|
|
class="asof-tag"
|
|
:title="configSource === 'db' ? '口径配置:自定义(数据库)' : '口径配置:默认'"
|
|
>口径 {{ metricVersion }}</el-tag>
|
|
<el-tag v-if="trial" size="small" type="warning" class="asof-tag">试算</el-tag>
|
|
</span>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
// 数据截至角标(批次C 驾驶舱/员工页共用):数据时间 + 指标版本 + 试算标记。
|
|
// 纯展示——数据由父级从 dashboard/employees 载荷透传(data_as_of/metric_version/
|
|
// trial/config_source),不自行请求。configSource 无独立标签(避免噪音),
|
|
// 挂在口径版本 tag 的 title 提示上。
|
|
import { computed } from 'vue'
|
|
import { formatTime } from '@/utils/format'
|
|
|
|
const props = defineProps<{
|
|
dataAsOf?: number | null
|
|
metricVersion?: string
|
|
trial?: boolean
|
|
configSource?: 'db' | 'default'
|
|
}>()
|
|
|
|
// ms 时间戳 → `YYYY-MM-DD HH:mm`(formatTime 去秒);缺失/非法 → 灰 tag「无数据」
|
|
const asOfText = computed(() => {
|
|
const v = props.dataAsOf
|
|
if (v == null || !Number.isFinite(v) || v <= 0) return ''
|
|
return formatTime(v).slice(0, 16)
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
.data-asof {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
white-space: nowrap;
|
|
}
|
|
.asof-tag {
|
|
margin-left: 0;
|
|
}
|
|
</style>
|