From 53d5f677c4651c7f89f535e7a464a86f2a889b75 Mon Sep 17 00:00:00 2001 From: taoge1020 Date: Thu, 28 Aug 2025 15:35:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- src/components/TopNav/index.vue | 61 ++++++++++++++++++- src/layout/components/Sidebar/SidebarItem.vue | 7 ++- src/permission.ts | 1 - src/views/materials/batchPlan/index.vue | 5 +- 5 files changed, 68 insertions(+), 8 deletions(-) diff --git a/.env.development b/.env.development index 99e7d78..d557820 100644 --- a/.env.development +++ b/.env.development @@ -6,7 +6,7 @@ VITE_APP_ENV = 'development' # 开发环境 # 李陈杰 209 -VITE_APP_BASE_API = 'http://192.168.110.209:8899' +VITE_APP_BASE_API = 'http://192.168.110.180:8899' # 曾涛 # VITE_APP_BASE_API = 'http://192.168.110.180:8899' # 罗成 diff --git a/src/components/TopNav/index.vue b/src/components/TopNav/index.vue index fe3aa66..32357e3 100644 --- a/src/components/TopNav/index.vue +++ b/src/components/TopNav/index.vue @@ -4,6 +4,7 @@ {{ item.meta?.title }} + @@ -26,20 +27,27 @@ import useAppStore from '@/store/modules/app'; import useSettingsStore from '@/store/modules/settings'; import usePermissionStore from '@/store/modules/permission'; import { RouteRecordRaw } from 'vue-router'; - +import useUserStore from '@/store/modules/user'; +import useNoticeStore from '@/store/modules/notice'; +import { pageByTaskWait } from '@/api/workflow/task'; +const userStore = useUserStore(); +const noticeStore = storeToRefs(useNoticeStore()); // 顶部栏初始数 const visibleNumber = ref(-1); // 当前激活菜单的 index const currentIndex = ref(); // 隐藏侧边栏路由 const hideList = ['/index', '/user/profile']; - +const total = ref(1); const appStore = useAppStore(); const settingsStore = useSettingsStore(); const permissionStore = usePermissionStore(); const route = useRoute(); const router = useRouter(); - +onMounted(() => { + console.log(33333); + getWaitingList(); +}); // 主题颜色 const theme = computed(() => settingsStore.theme); // 所有的路由信息 @@ -158,6 +166,26 @@ onBeforeUnmount(() => { onMounted(() => { setVisibleNumber(); }); +// 获取我的待办 +//分页 +const getWaitingList = () => { + pageByTaskWait({ pageNum: 1, pageSize: 10 }).then((resp) => { + console.log(resp); + + total.value = resp.total; + }); +}; +//用深度监听 消息 +watch( + () => noticeStore.state.value.notices, + (newVal) => { + let time = setTimeout(() => { + getWaitingList(); + clearTimeout(time); + }, 500); + }, + { deep: true } +); diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index 648eba2..8703d66 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -57,7 +57,9 @@ const props = defineProps({ }); const total = ref(0); onMounted(() => { - if (onlyOneChild.value.meta?.title == '我的待办') { + if (onlyOneChild.value.meta?.title == '我的待办' || props.item.meta?.title == '我的任务') { + console.log(44444444); + getWaitingList(); } }); @@ -123,7 +125,8 @@ watch( () => noticeStore.state.value.notices, (newVal) => { if (onlyOneChild.value.meta?.title == '我的待办') { - // 延迟1秒 + console.log(121212121); + let time = setTimeout(() => { getWaitingList(); clearTimeout(time); diff --git a/src/permission.ts b/src/permission.ts index b3a14d7..4a7ff0e 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -45,7 +45,6 @@ router.beforeEach(async (to, from, next) => { accessRoutes.forEach((route) => { if (!isHttp(route.path)) { router.addRoute(route); // 动态添加可访问路由表 - console.log('🚀 ~ route:', route); } }); $cache.local.remove('isCheckRole'); diff --git a/src/views/materials/batchPlan/index.vue b/src/views/materials/batchPlan/index.vue index b301a4e..a21a726 100644 --- a/src/views/materials/batchPlan/index.vue +++ b/src/views/materials/batchPlan/index.vue @@ -136,7 +136,9 @@