fix dashboard refresh

This commit is contained in:
jxxghp
2024-05-12 20:22:20 +08:00
parent 33cdf672b3
commit d2049f7839
+7 -2
View File
@@ -197,8 +197,13 @@ async function getPluginDashboard(id: string) {
try { try {
api.get(`/plugin/dashboard/${id}`).then((res: any) => { api.get(`/plugin/dashboard/${id}`).then((res: any) => {
if (res) { if (res) {
// 保存到仪表板配置中 // 保存到仪表板配置中,如果已经存在则替换
dashboardConfigs.value.push(res) const index = dashboardConfigs.value.findIndex((item: { id: string }) => item.id === id)
if (index !== -1) {
dashboardConfigs.value[index] = res
} else {
dashboardConfigs.value.push(res)
}
// 排序 // 排序
sortDashboardConfigs() sortDashboardConfigs()
// 定时刷新 // 定时刷新