diff --git a/package.json b/package.json index f4868c2..32d3218 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,10 @@ } }, "lint-staged": { + "*.{js,ts,vue}": [ + "eslint --fix --quiet", + "prettier --write" + ], "*.{js,ts,mjs,mts,tsx}": [ "eslint --fix", "prettier --write" diff --git a/src/api/crmApi.ts b/src/api/crmApi.ts index e8bd557..8cf0dda 100644 --- a/src/api/crmApi.ts +++ b/src/api/crmApi.ts @@ -42,7 +42,7 @@ export class CrmService { //渠道下拉 static getChannel() { - return request.get({ + return request.get({ url: '/crm/customer/getChannel' }) } diff --git a/src/api/menuApi.ts b/src/api/menuApi.ts index 925346b..1a442eb 100644 --- a/src/api/menuApi.ts +++ b/src/api/menuApi.ts @@ -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 { @@ -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('菜单数据处理失败') diff --git a/src/components/core/layouts/art-page-content/index.vue b/src/components/core/layouts/art-page-content/index.vue index 6fcb81e..b9a1879 100644 --- a/src/components/core/layouts/art-page-content/index.vue +++ b/src/components/core/layouts/art-page-content/index.vue @@ -6,6 +6,7 @@ diff --git a/src/router/routes/asyncRoutes.ts b/src/router/routes/asyncRoutes.ts index d1d3d17..de4c62b 100644 --- a/src/router/routes/asyncRoutes.ts +++ b/src/router/routes/asyncRoutes.ts @@ -1,7 +1,5 @@ import { RoutesAlias } from '../routesAlias' import { AppRouteRecord } from '@/types/router' -import { WEB_LINKS } from '@/utils/constants' - /** * 菜单列表、异步路由 * @@ -13,6 +11,14 @@ import { WEB_LINKS } from '@/utils/constants' * 可以是 i18n 的 key,也可以是字符串,比如:'用户列表' */ export const asyncRoutes: AppRouteRecord[] = [ + { + path: '/admin/inquiry_system', + name: 'Inquiry_system', + component: RoutesAlias.inquirySystem, + meta: { + title: '询单系统', + } + }, { path: '/crmpc/customer/add', name: 'CrmpcustomerAdd', diff --git a/src/router/routesAlias.ts b/src/router/routesAlias.ts index 38f5f17..fd149b8 100644 --- a/src/router/routesAlias.ts +++ b/src/router/routesAlias.ts @@ -60,6 +60,7 @@ export enum RoutesAlias { CrmpcustomerFollowadd = '/crmpc/customer/Followadd',//添加跟进 recycle = '/crmpc/recycle',//回收站 UserCenter = '/system/user-center', // 用户中心 + inquirySystem = '/admin/inquiry_system', // 询单系统 } // 主页路由 diff --git a/src/views/admin/inquiry_system/index.vue b/src/views/admin/inquiry_system/index.vue new file mode 100644 index 0000000..fdde659 --- /dev/null +++ b/src/views/admin/inquiry_system/index.vue @@ -0,0 +1,647 @@ + + + + + \ No newline at end of file