/* 总览视图 */ const DashboardView = { template: `
总资产
{{ store.overview.total || 0 }}
30天内到期
{{ store.overview.expiring_30 || 0 }}
另有 {{ store.overview.overdue_count }} 项已过期
本年支出
{{ store.overview.year_cost || 0 }}
异常状态
{{ store.overview.abnormal_count || 0 }}

到期日历({{ expiryList.length }})

全部倒计时 →
{{ a.name }}
{{ meta(a) }}
{{ a.expiry_date }}
{{ Fmt.countdownText(a.days_to_expiry) }}

没有资产设置了到期日,算不出倒计时

另 {{ noExpiryCount }} 个资产未填到期日,不会出现在这里(到资产页编辑补上)

按类型分布

{{ Fmt.TYPE_LABELS[t] }} {{ n }} 暂无数据
`, setup() { // 到期日历:只看未注销且有到期日的资产,最紧急(含已过期)排最前 const expiryList = Vue.computed(() => store.assets .filter(a => a.expiry_date && a.status !== 'cancelled') .sort((x, y) => (x.days_to_expiry ?? 10 ** 9) - (y.days_to_expiry ?? 10 ** 9))); const noExpiryCount = Vue.computed(() => store.assets.filter(a => !a.expiry_date && a.status !== 'cancelled').length); // 副标题:类型 · 平台 · 费用/周期,缺失的字段不占位(避免出现 "VPS · · 3.5USD") function meta(a) { const bits = [Fmt.TYPE_LABELS[a.asset_type] || a.asset_type, a.provider_name || a.provider]; if (a.cost) bits.push(a.cost + (a.currency || '') + '/' + (Fmt.CYCLE_LABELS[a.renewal_cycle] || '未设周期')); return bits.filter(Boolean).join(' · '); } return { store, Fmt, expiryList, noExpiryCount, meta }; }, };