询单页面及菜单

This commit is contained in:
浅念
2025-07-22 16:35:43 +08:00
parent 3b6de4c7fa
commit ca06c9bc46
7 changed files with 663 additions and 30 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ export class CrmService {
//渠道下拉
static getChannel() {
return request.get<Api.Brand.BrandInfo>({
return request.get<any>({
url: '/crm/customer/getChannel'
})
}
+1 -27
View File
@@ -1,32 +1,9 @@
import { asyncRoutes } from '@/router/routes/asyncRoutes'
import { menuDataToRouter } from '@/router/utils/menuToRouter'
import { AppRouteRecord } from '@/types/router'
import { useUserStore } from '@/store/modules/user'
interface MenuResponse {
menuList: AppRouteRecord[]
}
// 合并方法
function mergeRoutes(dynamicRoutes: AppRouteRecord[] = [], staticRoutes: AppRouteRecord[] = []): AppRouteRecord[] {
// 深度合并逻辑
const merged = [...staticRoutes]
dynamicRoutes.forEach(dynamicRoute => {
const existingIndex = merged.findIndex(r => r.path === dynamicRoute.path)
if (existingIndex >= 0) {
// 合并children(如果存在)
if (dynamicRoute.children) {
merged[existingIndex].children = [
...(merged[existingIndex].children || []),
...dynamicRoute.children
]
}
} else {
merged.push(dynamicRoute)
}
})
return merged
}
// 菜单接口
export const menuService = {
async getMenuList(delay = 300): Promise<MenuResponse> {
@@ -38,8 +15,6 @@ export const menuService = {
}
// 模拟接口返回的菜单数据
const menuData = userStore.info.menu
// 2. 合并静态菜单
const finalRoutes = mergeRoutes(menuData, asyncRoutes)
// 验证菜单数据
if (!menuData || !Array.isArray(menuData) || menuData.length === 0) {
ElMessage.error('暂无系统菜单权限')
@@ -47,8 +22,7 @@ export const menuService = {
}
// 处理菜单数据
const menuList = finalRoutes.map((route: any) => menuDataToRouter(route))
const menuList = menuData.map((route: any) => menuDataToRouter(route))
// 验证处理后的菜单列表
if (!menuList || menuList.length === 0) {
ElMessage.error('菜单数据处理失败')