/* Cloudflare 子资产视图 */ const SUB_TYPE_LABELS = { zone: '解析', worker: 'Worker', r2: 'R2', tunnel: 'Tunnel', mail: 'Mail', dns_record: 'DNS记录', other: '其他' }; const CloudflareView = { template: `
暂无 Cloudflare 子资产(新增资产时选 Cloudflare 类型即可)
☁️ {{ g.account || '未指定账号' }}
{{ g.items.length }} 个子资产
{{ SUB_TYPE_LABELS[a.cloudflare_detail.sub_type] || a.cloudflare_detail.sub_type }} {{ a.cloudflare_detail.sub_name || a.cloudflare_detail.zone_name || a.name }} @{{ a.cloudflare_detail.zone_name }}
{{ a.cloudflare_detail.status }}
`, setup() { const groups = Vue.computed(() => { const cfAssets = store.assets.filter(a => a.asset_type === 'cloudflare' && a.cloudflare_detail); const map = {}; for (const a of cfAssets) { const acc = a.cloudflare_detail.account_email || ''; if (!map[acc]) map[acc] = { account: a.cloudflare_detail.account_email, items: [] }; map[acc].items.push(a); } return Object.values(map); }); function subTypeBadge(t) { return { zone: 'bg-blue-500/10 text-blue-600 dark:text-blue-400', worker: 'bg-orange-500/10 text-orange-600 dark:text-orange-400', r2: 'bg-purple-500/10 text-purple-600 dark:text-purple-400', tunnel: 'bg-emerald-500/10 text-emerald-600 dark:text-emerald-400', mail: 'bg-pink-500/10 text-pink-600 dark:text-pink-400', dns_record: 'bg-slate-500/10 text-slate-600', other: 'bg-slate-500/10 text-slate-500' }[t] || 'bg-slate-500/10 text-slate-500'; } return { store, groups, subTypeBadge, SUB_TYPE_LABELS, edit: openAssetEdit }; }, };