From 5305f775600086a363f3bf26e35e5affdfd9db41 Mon Sep 17 00:00:00 2001 From: zm2000 <18386612143@163.com> Date: Fri, 27 Mar 2026 16:01:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=85=A5=E5=8F=A3=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E8=B7=AF=E7=94=B1=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 stock.warehouse.search 接口并在收货详情中切换为仓库维度搜索 - 优化用户菜单路径校验,兼容 component/path 及前导斜杠、.vue 后缀 - 首页与全部功能页对商品查询菜单统一跳转到 /pages/work/product/query - pages.json 注册商品查询页面路由 --- core/request/apis.js | 8 +++++++ core/store/modules/user.js | 22 +++++++++++++------ pages.json | 20 ++++++++--------- pages/home/edit-quick-actions.vue | 11 ++++++++-- pages/index/index.vue | 11 ++++++++-- .../storage/receiving/receivingDetail.vue | 2 +- 6 files changed, 51 insertions(+), 23 deletions(-) diff --git a/core/request/apis.js b/core/request/apis.js index 3ef856e..a4db44c 100644 --- a/core/request/apis.js +++ b/core/request/apis.js @@ -133,6 +133,14 @@ export default { auth: true, method: "POST", isSystemApi: true + }, + warehouse: { + search: { + path: "stock.warehouse.search", + auth: true, + method: "POST", + isSystemApi: true + } } }, print: { diff --git a/core/store/modules/user.js b/core/store/modules/user.js index bb4f48c..1a5acc7 100644 --- a/core/store/modules/user.js +++ b/core/store/modules/user.js @@ -145,14 +145,22 @@ const actions = { commit, state },path) { - let has = false; - console.log("所有菜单",state.menus); - for(let i =0;i String(target) + .trim() + .replace(/^\/+/, '') + .replace(/\.vue$/i, ''); + + const targetPath = normalizePath(path); + if (!targetPath) { + return false; } - return has; + + console.log("所有菜单", state.menus); + return (state.menus || []).some(menu => { + const componentPath = normalizePath(menu?.component || ''); + const menuPath = normalizePath(menu?.path || ''); + return componentPath === targetPath || menuPath === targetPath; + }); }, login({ commit, diff --git a/pages.json b/pages.json index 1ef84eb..937e43c 100644 --- a/pages.json +++ b/pages.json @@ -1,14 +1,5 @@ -{ - // "condition": { //模式配置,仅开发期间生效 - // "current": 0, //当前激活的模式(list 的索引项) - // "list": [{ - // "name": "test", //模式名称 - // "path": "pages/componentsA/test/test", //启动页面,必选 - // "query": "" //启动参数,在页面的onLoad函数里面得到 - // }] - // }, - "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages - +{ + "pages": [ { "path": "pages/login/index", @@ -129,6 +120,13 @@ { "titleNView": false } + }, + { + "path" : "pages/work/product/query", + "style" : + { + "titleNView": false + } } ], diff --git a/pages/home/edit-quick-actions.vue b/pages/home/edit-quick-actions.vue index e4bfe45..0d6812a 100644 --- a/pages/home/edit-quick-actions.vue +++ b/pages/home/edit-quick-actions.vue @@ -311,7 +311,14 @@ this.activeNav = group.initial || '全部'; }, toPath(item) { - if (!item || !item.component) { + const menuName = String(item?.name || '').trim(); + const isGoodsQuery = menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询')); + const rawPath = item?.component || item?.path || ''; + const targetPath = isGoodsQuery + ? '/pages/work/product/query' + : (rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : ''); + + if (!targetPath) { uni.showToast({ title: '功能暂未开放', icon: 'none' @@ -320,7 +327,7 @@ } uni.navigateTo({ - url: item.component.startsWith('/') ? item.component : `/${item.component}`, + url: targetPath, animationType: 'slide-in-right' }); }, diff --git a/pages/index/index.vue b/pages/index/index.vue index c01743f..67ee18e 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -334,7 +334,14 @@ }, toPath(item) { - if (!item || !item.component) { + const menuName = String(item?.name || '').trim(); + const isGoodsQuery = menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询')); + const rawPath = item?.component || item?.path || ''; + const targetPath = isGoodsQuery + ? '/pages/work/product/query' + : (rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : ''); + + if (!targetPath) { uni.showToast({ title: '功能暂未开放', icon: 'none', @@ -344,7 +351,7 @@ } uni.navigateTo({ - url: item.component.startsWith('/') ? item.component : `/${item.component}`, + url: targetPath, animationType: 'slide-in-right' }); }, diff --git a/pages/work/storage/receiving/receivingDetail.vue b/pages/work/storage/receiving/receivingDetail.vue index a9ee6de..ee8b0dd 100644 --- a/pages/work/storage/receiving/receivingDetail.vue +++ b/pages/work/storage/receiving/receivingDetail.vue @@ -597,7 +597,7 @@ if(!this.selectedDetail){ return false; } - const stocks = await this.$http("stock.search", { + const stocks = await this.$http("stock.warehouse.search", { keyword: data, store_id: this.receivingInfo.store_id });