/* 总览视图 */ const DashboardView = { template: `
另有 项已过期

到期日历({{ 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(' · '); } // 卡片点击:带上对应筛选条件跳到目标视图,数字点一下就能看到背后的具体清单 function goTotal() { openAssetsWithFilter({}); } function goExpiring30() { openMonitorWithExpiryFilter('soon30'); } function goOverdue() { openMonitorWithExpiryFilter('expired'); } function goYearCost() { openAssetsWithFilter({ assetTab: 'subscription' }); } function goAbnormal() { openAssetsWithFilter({ filterStatus: 'abnormal' }); } return { store, Fmt, expiryList, noExpiryCount, meta, goTotal, goExpiring30, goOverdue, goYearCost, goAbnormal }; }, };