refactor(projects): 1 工作台缓存优化;2 工作日志总工时下进度显示

This commit is contained in:
2026-06-22 19:28:39 +08:00
parent 61fe9ef143
commit 4a7f54b0ed
8 changed files with 242 additions and 86 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue';
import { computed, onActivated, ref, watch } from 'vue';
import { useRouter } from 'vue-router';
import { RDMS_REQ_PRIORITY_DICT_CODE } from '@/constants/dict';
import { OBJECT_CONTEXT_QUERY_KEY } from '@/constants/object-context';
@@ -31,7 +31,8 @@ const { loading, refresh } = useWorkbenchRefresh(async () => {
items.value = buildWorkbenchMyExecutionItems(data?.list ?? []);
});
onMounted(refresh);
// 工作台路由 keepAlive切回不重挂用 onActivated 替代 onMounted每次激活重拉首挂也会触发不漏首屏
onActivated(refresh);
// 按项目归类:未完成执行数多的项目在前;项目内按计划结束日升序(更紧的在前)
const groups = computed<Array<{ projectId: string; projectName: string; items: MyExecutionItem[] }>>(() => {

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue';
import { computed, onActivated, ref, watch } from 'vue';
import { fetchGetMyOwnedProjectPage, fetchGetMyParticipatedProjectPage } from '@/service/api';
import { useRouterPush } from '@/hooks/common/router';
import {
@@ -46,7 +46,8 @@ const { loading, refresh } = useWorkbenchRefresh(async () => {
}
});
onMounted(refresh);
// 工作台路由 keepAlive切回不重挂用 onActivated 替代 onMounted每次激活重拉首挂也会触发不漏首屏
onActivated(refresh);
const currentOwnedId = ref<string>('');
watch(ownedItems, list => {

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { computed, onActivated, ref } from 'vue';
import { fetchGetMyTeamLoad } from '@/service/api';
import { getWorkbenchItemColor } from '../composables/use-workbench-colors';
import {
@@ -45,7 +45,8 @@ function toTeamLoadSource(member: Api.Project.TeamLoadMember, index: number): Wo
const view = computed(() => buildWorkbenchTeamLoadView({ members: teamLoadMembers.value.map(toTeamLoadSource) }));
onMounted(loadTeamLoad);
// 工作台路由 keepAlive切回不重挂用 onActivated 替代 onMounted每次激活经 refresh 重拉(首挂也会触发,不漏首屏)
onActivated(refresh);
const LEVEL_LABEL: Record<WorkbenchTeamLoadLevel, string> = {
high: '高负载',

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { type Component, computed, markRaw, onMounted, ref, watch } from 'vue';
import { type Component, computed, markRaw, onActivated, ref, watch } from 'vue';
import { useRouter } from 'vue-router';
import type { RouteKey } from '@elegant-router/types';
import { OBJECT_CONTEXT_QUERY_KEY } from '@/constants/object-context';
@@ -865,14 +865,8 @@ function getDeadlineToneClass(item: WorkbenchTodoItem) {
return 'workbench-todo__deadline--slate';
}
onMounted(async () => {
await Promise.all([
loadMyTaskItems(),
loadPersonalTodoItems(),
loadOvertimeApprovalItems(),
loadWorkReportApprovalItems()
]);
});
// 工作台路由 keepAlive切回不重挂用 onActivated 替代 onMounted每次激活经 refresh 重拉(首挂也会触发,不漏首屏)
onActivated(refresh);
</script>
<template>