This commit is contained in:
Your Name
2026-08-07 14:54:05 +08:00
parent 58a7197d3e
commit 6ce58bcd85
337 changed files with 325 additions and 309 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import request from '@/utils/request'
/** 角色数据驾驶舱:服务端统一按当前管理员的数据范围聚合。 */
export function performanceDashboardOverview(params?: { ranking_dept_id?: number }) {
export function performanceDashboardOverview(params?: { ranking_dept_id?: number; _t?: number }) {
return request.get(
{ url: '/stats.performanceDashboard/overview', params, timeout: 120000 },
{ ignoreCancelToken: true }
@@ -314,7 +314,7 @@
</template>
<script setup lang="ts" name="performanceDashboardPage">
import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue'
import { computed, onActivated, onBeforeUnmount, onMounted, reactive, ref } from 'vue'
import {
CaretBottom,
CaretTop,
@@ -655,7 +655,11 @@ const loadDashboard = async () => {
loading.value = true
errorMessage.value = ''
try {
const res: any = await performanceDashboardOverview({ ranking_dept_id: rankingDeptId.value })
const res: any = await performanceDashboardOverview({
ranking_dept_id: rankingDeptId.value,
// 驾驶舱是实时数据,避免浏览器或反向代理复用旧的 GET 响应。
_t: Date.now(),
})
Object.assign(dashboard, createInitialDashboard(), res || {})
rankingDeptId.value = Number(dashboard.filters.ranking_dept_id || 0) || undefined
loaded.value = true
@@ -677,6 +681,11 @@ onMounted(() => {
}, 1000)
})
// 后台标签页使用 KeepAlive;从其它菜单返回驾驶舱时必须重新取实时数据。
onActivated(() => {
if (loaded.value) loadDashboard()
})
onBeforeUnmount(() => {
if (clockTimer) clearInterval(clockTimer)
})