|
@@ -881,6 +881,9 @@ const handleSearch = async () => {
|
|
|
// 将参数保存到 queryParam 以供其他地方使用
|
|
|
Object.assign(queryParam, params);
|
|
|
|
|
|
+ // 清除缓存的分析数据,以便在需要时重新加载
|
|
|
+ monthlyTrendData.value = [];
|
|
|
+
|
|
|
if (activeTabKey.value === 'transaction') {
|
|
|
pagination.value.current = 1; // Reset to first page
|
|
|
await handleTableChange(pagination.value);
|
|
@@ -978,10 +981,16 @@ const handleTabChange = async (key: string) => {
|
|
|
if (key === 'companies') {
|
|
|
|
|
|
} else if (key === 'tradeAnalysis') {
|
|
|
- // Load trade analysis data
|
|
|
- await Promise.all([
|
|
|
- loadMonthlyTrendData(),
|
|
|
- ]);
|
|
|
+ // 只在首次加载或数据为空时请求数据
|
|
|
+ if (monthlyTrendData.value.length === 0) {
|
|
|
+ loading.value = true;
|
|
|
+ try {
|
|
|
+ await loadMonthlyTrendData();
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 否则使用缓存数据
|
|
|
} else if (key === 'shippingAnalysis') {
|
|
|
|
|
|
}
|
|
@@ -1005,9 +1014,8 @@ const loadMonthlyTrendData = async () => {
|
|
|
}));
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.error('Failed to fetch data:', error);
|
|
|
- } finally {
|
|
|
- loading.value = false;
|
|
|
+ console.error('Failed to fetch monthly trend data:', error);
|
|
|
+ createMessage.error('加载月度趋势数据失败');
|
|
|
}
|
|
|
};
|
|
|
|