feat(management): 驾驶舱六组件——KPI卡/筛选栏/异常榜/下钻抽屉/口径抽屉/数据截至角标+时长比率格式化共享
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user