Files
shanxia2.0/mobile-h5/src/api/menuApi.ts
T
zlwuandCursor db06fea45a feat(mobile-h5): wire select-only master data into business forms
Replace master-data CRUD pickers with CRM/PL selectors, require productId, drop auto vehicle create, and remove 基础资料 routes/menu.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 22:42:24 +08:00

56 lines
1.4 KiB
TypeScript
Executable File

import { MenuListType } from '@/types/menu'
import { processRoute } from '@/utils/menu'
import { showLoadingToast, closeToast } from 'vant'
// 简单的路由数据(移动端不需要复杂的路由配置)
const simpleRoutes: any[] = [
{
path: '/dashboard',
name: 'Dashboard',
meta: { title: '工作台', icon: '', isHide: false }
},
{
path: '/plans',
name: 'Plans',
meta: { title: '计划管理', icon: '', isHide: false }
},
{
path: '/inventory',
name: 'Inventory',
meta: { title: '出入库管理', icon: '', isHide: false }
},
{
path: '/weighing',
name: 'Weighing',
meta: { title: '地磅单管理', icon: '', isHide: false }
}
]
// 菜单接口
export const menuService = {
// 获取菜单列表,模拟网络请求
getMenuList(
delay: number = 300
): Promise<{ menuList: MenuListType[]; closeLoading: () => void }> {
// 获取到的菜单数据
const menuList = simpleRoutes
// 处理后的菜单数据
const processedMenuList: MenuListType[] = menuList.map((route: any) => processRoute(route))
showLoadingToast({
message: '加载中...',
forbidClick: true,
duration: 0
})
return new Promise((resolve) => {
setTimeout(() => {
resolve({
menuList: processedMenuList,
closeLoading: () => closeToast()
})
}, delay)
})
}
}