fix(ui/enterprise): type filter keys so computed arrays match ref unions

This commit is contained in:
matevip 2026-05-13 11:30:52 +08:00
parent d5d301037e
commit 32507d2157
6 changed files with 24 additions and 16 deletions

View File

@ -123,16 +123,19 @@ import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const listFilter = ref<'all' | 'hot' | 'cooling'>('all')
const tlFilter = ref<'all' | 'public' | 'meeting' | 'doc'>('all')
type ListFilterKey = 'all' | 'hot' | 'cooling'
type TlFilterKey = 'all' | 'public' | 'meeting' | 'doc'
const listFilters = computed(() => [
const listFilter = ref<ListFilterKey>('all')
const tlFilter = ref<TlFilterKey>('all')
const listFilters = computed<{ key: ListFilterKey; label: string; count: number }[]>(() => [
{ key: 'all', label: t('enterprise.account.filterAll'), count: 14 },
{ key: 'hot', label: t('enterprise.account.filterHot'), count: 4 },
{ key: 'cooling', label: t('enterprise.account.filterCooling'), count: 3 },
])
const tlFilters = computed(() => [
const tlFilters = computed<{ key: TlFilterKey; label: string }[]>(() => [
{ key: 'all', label: t('enterprise.account.tlAll') },
{ key: 'public', label: t('enterprise.account.tlPublic') },
{ key: 'meeting', label: t('enterprise.account.tlMeeting') },

View File

@ -84,9 +84,10 @@ import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const filter = ref<'mine' | 'all' | 'high'>('mine')
type FilterKey = 'mine' | 'all' | 'high'
const filter = ref<FilterKey>('mine')
const filters = computed(() => [
const filters = computed<{ key: FilterKey; label: string; count: number }[]>(() => [
{ key: 'mine', label: t('enterprise.approvals.filterMine'), count: 3 },
{ key: 'all', label: t('enterprise.approvals.filterAll'), count: 5 },
{ key: 'high', label: t('enterprise.approvals.filterHigh'), count: 2 },

View File

@ -43,9 +43,10 @@ import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const scope = ref<'all' | 'contract' | 'account' | 'tool'>('all')
type ScopeKey = 'all' | 'contract' | 'account' | 'tool'
const scope = ref<ScopeKey>('all')
const scopeFilters = computed(() => [
const scopeFilters = computed<{ key: ScopeKey; label: string }[]>(() => [
{ key: 'all', label: t('enterprise.audit.scopeAll') },
{ key: 'contract', label: t('enterprise.audit.scopeContract') },
{ key: 'account', label: t('enterprise.audit.scopeAccount') },

View File

@ -144,9 +144,10 @@ import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const props = defineProps<{ focus: string | null }>()
const listFilter = ref<'all' | 'high' | 'pending'>('all')
type ListFilterKey = 'all' | 'high' | 'pending'
const listFilter = ref<ListFilterKey>('all')
const listFilters = computed(() => [
const listFilters = computed<{ key: ListFilterKey; label: string; count: number }[]>(() => [
{ key: 'all', label: t('enterprise.contract.filterAll'), count: 23 },
{ key: 'high', label: t('enterprise.contract.filterHigh'), count: 7 },
{ key: 'pending', label: t('enterprise.contract.filterPending'), count: 12 },

View File

@ -109,7 +109,8 @@ import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const emit = defineEmits<{ (e: 'open-case', id: string): void }>()
const activeFilter = ref<'all' | 'high' | 'pending' | 'today'>('all')
type QueueFilterKey = 'all' | 'high' | 'pending' | 'today'
const activeFilter = ref<QueueFilterKey>('all')
const metrics = computed(() => [
{ key: 'pending', label: t('enterprise.overview.metricPending'), value: '23', delta: '+4', deltaTone: 'up', tone: '' },
@ -118,7 +119,7 @@ const metrics = computed(() => [
{ key: 'cited', label: t('enterprise.overview.metricCited'), value: '98%', delta: '+3pp', deltaTone: 'up', tone: 'tone-good' },
])
const queueFilters = computed(() => [
const queueFilters = computed<{ key: QueueFilterKey; label: string; count: number }[]>(() => [
{ key: 'all', label: t('enterprise.overview.filterAll'), count: 23 },
{ key: 'high', label: t('enterprise.overview.filterHighRisk'), count: 7 },
{ key: 'pending', label: t('enterprise.overview.filterPending'), count: 12 },

View File

@ -37,15 +37,16 @@ import Approvals from './Approvals.vue'
import Audit from './Audit.vue'
const { t } = useI18n()
const activeTab = ref<'overview' | 'contract' | 'account' | 'approvals' | 'audit'>('overview')
type TabKey = 'overview' | 'contract' | 'account' | 'approvals' | 'audit'
const activeTab = ref<TabKey>('overview')
const caseFocus = ref<string | null>(null)
const tabs = computed(() => [
{ key: 'overview', label: t('enterprise.tabs.overview'), count: null as number | null },
const tabs = computed<{ key: TabKey; label: string; count: number | null }[]>(() => [
{ key: 'overview', label: t('enterprise.tabs.overview'), count: null },
{ key: 'contract', label: t('enterprise.tabs.contract'), count: 23 },
{ key: 'account', label: t('enterprise.tabs.account'), count: 14 },
{ key: 'approvals', label: t('enterprise.tabs.approvals'), count: 5 },
{ key: 'audit', label: t('enterprise.tabs.audit'), count: null as number | null },
{ key: 'audit', label: t('enterprise.tabs.audit'), count: null },
])
function onOpenCase(id: string) {