Merge remote-tracking branch 'origin/main' into feature/v1.2灵机空间-项目管理_rxd
# Conflicts: # src/api/all/common.ts # src/components/_base/navbar/index.vue # src/hooks/useTableSelectionWithPagination.ts # src/router/routes/modules/propertyMarketing.ts # src/stores/modules/side-bar/constants.ts # src/views/property-marketing/media-account/account-manage/components/account-table/index.vue # src/views/property-marketing/media-account/account-manage/components/add-account-modal/index.vue # src/views/property-marketing/put-account/account-data/components/filter-block/index.vue # src/views/property-marketing/put-account/account-manage/components/account-table/index.vue # src/views/property-marketing/put-account/account-manage/components/add-account-modal/index.vue # src/views/property-marketing/put-account/account-manage/components/filter-block/index.vue # src/views/property-marketing/put-account/components/status-select/constants.ts
This commit is contained in:
@ -77,14 +77,14 @@ export const MENU_LIST = [
|
||||
'guideDetail',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '智能方案管理',
|
||||
routeName: 'IntelligentSolutionBusinessAnalysisReport',
|
||||
includeRouteNames: [
|
||||
'IntelligentSolutionBusinessAnalysisReport',
|
||||
'IntelligentSolutionCompetitiveProductAnalysisReport',
|
||||
],
|
||||
},
|
||||
// {
|
||||
// name: '智能方案管理',
|
||||
// routeName: 'IntelligentSolutionBusinessAnalysisReport',
|
||||
// includeRouteNames: [
|
||||
// 'IntelligentSolutionBusinessAnalysisReport',
|
||||
// 'IntelligentSolutionCompetitiveProductAnalysisReport',
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
name: '项目管理',
|
||||
routeName: 'ProjectList',
|
||||
|
||||
@ -7,18 +7,22 @@ import router from '@/router';
|
||||
import type { RouteLocationNormalized } from 'vue-router';
|
||||
import { MENU_LIST } from './constants';
|
||||
import { useEnterpriseStore } from '@/stores/modules/enterprise';
|
||||
import { getTaskUnread, patchTaskRead } from '@/api/all/common';
|
||||
|
||||
interface sidebarState {
|
||||
activeMenuId: number | null;
|
||||
menuList: any[];
|
||||
allowAccessRoutes: any[];
|
||||
unreadInfo: number[];
|
||||
}
|
||||
|
||||
let unreadInfoTimer: number | null = null;
|
||||
|
||||
export const useSidebarStore = defineStore('sidebar', {
|
||||
state: (): sidebarState => ({
|
||||
activeMenuId: null,
|
||||
menuList: [],
|
||||
|
||||
activeMenuId: null, //
|
||||
menuList: [], // 菜单信息
|
||||
unreadInfo: [], // 未读消息
|
||||
allowAccessRoutes: [], // 允许访问的路由列表
|
||||
}),
|
||||
actions: {
|
||||
@ -42,17 +46,13 @@ export const useSidebarStore = defineStore('sidebar', {
|
||||
setActiveMenuIdByRoute(route: RouteLocationNormalized) {
|
||||
const appRoutes = router.options?.routes ?? [];
|
||||
|
||||
// 查找当前路由所属的菜单组
|
||||
const findMenuGroup = (routes: any[]): number | null => {
|
||||
for (const routeItem of routes) {
|
||||
// 检查子路由
|
||||
if (routeItem.children?.length > 0) {
|
||||
// 检查当前路由是否是这个父路由的子路由
|
||||
const isChildRoute = routeItem.children.some((child: any) => child.name === route.name);
|
||||
if (isChildRoute) {
|
||||
return routeItem.meta?.id || null;
|
||||
}
|
||||
// 递归检查更深层的子路由
|
||||
const childResult = findMenuGroup(routeItem.children);
|
||||
if (childResult !== null) {
|
||||
return routeItem.meta?.id || childResult;
|
||||
@ -71,5 +71,31 @@ export const useSidebarStore = defineStore('sidebar', {
|
||||
this.activeMenuId = menuId;
|
||||
}
|
||||
},
|
||||
async getTaskUnreadInfo() {
|
||||
const { code, data } = await getTaskUnread();
|
||||
if (code === 200) {
|
||||
this.unreadInfo = data;
|
||||
}
|
||||
},
|
||||
|
||||
// 查询未读信息
|
||||
startUnreadInfoPolling() {
|
||||
if (unreadInfoTimer) return;
|
||||
this.getTaskUnreadInfo();
|
||||
unreadInfoTimer = window.setInterval(() => {
|
||||
this.getTaskUnreadInfo();
|
||||
}, 30000);
|
||||
},
|
||||
stopUnreadInfoPolling() {
|
||||
this.unreadInfo = [];
|
||||
if (unreadInfoTimer) {
|
||||
clearInterval(unreadInfoTimer);
|
||||
unreadInfoTimer = null;
|
||||
}
|
||||
},
|
||||
async removeTaskUnreadInfo() {
|
||||
patchTaskRead({ ids: this.unreadInfo });
|
||||
this.unreadInfo = [];
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user