diff --git a/yunkes/src/views/StaffList.vue b/yunkes/src/views/StaffList.vue index b2a2fb2..6b459ad 100644 --- a/yunkes/src/views/StaffList.vue +++ b/yunkes/src/views/StaffList.vue @@ -371,13 +371,15 @@ function openWechatCommModal(row: Account, metric: ChatMetric): void { // 复用已缓存的 stats;点击早于列表加载完成则按需补拉。 let stats = staffStats.value[row.account_id] if (!stats) { + const start = statsStart.value + const end = statsEnd.value try { - stats = await getStaffChatStats({ - owner_account_id: row.account_id, - start: statsStart.value, - end: statsEnd.value, - }) - staffStats.value[row.account_id] = stats + stats = await getStaffChatStats({ owner_account_id: row.account_id, start, end }) + // 仅当日期窗未变时回写缓存:避免旧窗 on-demand 结果覆盖日期切换后的新数据 + // (loadWechatStats 的 token 守卫负责批量重查)。 + if (statsStart.value === start && statsEnd.value === end) { + staffStats.value[row.account_id] = stats + } } catch { return { items: [], total: 0, page, page_size } }