feat: 平台卡片「关联N个资产」点击跳转资产页并按平台筛选(后端/api/assets新增provider参数,资产页可清除筛选标签)
This commit is contained in:
@@ -14,6 +14,14 @@ const AssetsView = {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 平台筛选标签(从平台页跳转而来,点 ✕ 取消) -->
|
||||
<div v-if="store.filterProvider" class="flex items-center">
|
||||
<span class="inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400">
|
||||
🏢 平台:{{ providerName(store.filterProvider) }}
|
||||
<button @click="clearProvider" class="font-bold hover:opacity-70" title="取消平台筛选">✕</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- 通用列表(全部 / VPS) -->
|
||||
<template v-if="store.assetTab==='' || store.assetTab==='vps'">
|
||||
<div class="flex flex-wrap gap-2 items-center">
|
||||
@@ -116,6 +124,11 @@ const AssetsView = {
|
||||
// 专有视图需要全量数据;若此前按类型过滤过则清空重载
|
||||
if (k !== '' && k !== 'vps' && store.filterType) { store.filterType = ''; loadAssets(); }
|
||||
}
|
||||
// 平台筛选标签显示名:filterProvider 存 slug,回退显示原值
|
||||
function providerName(slug) {
|
||||
const p = store.providers.find(x => x.slug === slug);
|
||||
return p ? p.name : slug;
|
||||
}
|
||||
async function refreshBalance(a) {
|
||||
if (!confirm('刷新「' + a.name + '」的余额?')) return;
|
||||
try {
|
||||
@@ -132,6 +145,6 @@ const AssetsView = {
|
||||
await loadAssets();
|
||||
} catch (e) { alert('同步失败:' + e.message); }
|
||||
}
|
||||
return { store, Fmt, tabs, tabView, list, switchTab, reload: loadAssets, edit: openAssetEdit, del: deleteAsset, viewServer, refreshBalance, syncAllAI };
|
||||
return { store, Fmt, tabs, tabView, list, switchTab, providerName, reload: loadAssets, clearProvider: clearProviderFilter, edit: openAssetEdit, del: deleteAsset, viewServer, refreshBalance, syncAllAI };
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user