feat: 新增商品查询入口并优化菜单路由匹配

- 新增 stock.warehouse.search 接口并在收货详情中切换为仓库维度搜索

- 优化用户菜单路径校验,兼容 component/path 及前导斜杠、.vue 后缀

- 首页与全部功能页对商品查询菜单统一跳转到 /pages/work/product/query

- pages.json 注册商品查询页面路由
This commit is contained in:
zm2000 2026-03-27 16:01:35 +08:00
parent 34adbce776
commit 5305f77560
6 changed files with 51 additions and 23 deletions

View File

@ -133,6 +133,14 @@ export default {
auth: true, auth: true,
method: "POST", method: "POST",
isSystemApi: true isSystemApi: true
},
warehouse: {
search: {
path: "stock.warehouse.search",
auth: true,
method: "POST",
isSystemApi: true
}
} }
}, },
print: { print: {

View File

@ -145,14 +145,22 @@ const actions = {
commit, commit,
state state
},path) { },path) {
let has = false; const normalizePath = (target = '') => String(target)
console.log("所有菜单",state.menus); .trim()
for(let i =0;i<state.menus.length;i++){ .replace(/^\/+/, '')
if(state.menus[i].component==path){ .replace(/\.vue$/i, '');
has = true;
} 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({ login({
commit, commit,

View File

@ -1,14 +1,5 @@
{ {
// "condition": { //模式配置,仅开发期间生效 "pages": [
// "current": 0, //当前激活的模式(list 的索引项)
// "list": [{
// "name": "test", //模式名称
// "path": "pages/componentsA/test/test", //启动页面,必选
// "query": "" //启动参数,在页面的onLoad函数里面得到
// }]
// },
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{ {
"path": "pages/login/index", "path": "pages/login/index",
@ -129,6 +120,13 @@
{ {
"titleNView": false "titleNView": false
} }
},
{
"path" : "pages/work/product/query",
"style" :
{
"titleNView": false
}
} }
], ],

View File

@ -311,7 +311,14 @@
this.activeNav = group.initial || '全部'; this.activeNav = group.initial || '全部';
}, },
toPath(item) { 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({ uni.showToast({
title: '功能暂未开放', title: '功能暂未开放',
icon: 'none' icon: 'none'
@ -320,7 +327,7 @@
} }
uni.navigateTo({ uni.navigateTo({
url: item.component.startsWith('/') ? item.component : `/${item.component}`, url: targetPath,
animationType: 'slide-in-right' animationType: 'slide-in-right'
}); });
}, },

View File

@ -334,7 +334,14 @@
}, },
toPath(item) { 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({ uni.showToast({
title: '功能暂未开放', title: '功能暂未开放',
icon: 'none', icon: 'none',
@ -344,7 +351,7 @@
} }
uni.navigateTo({ uni.navigateTo({
url: item.component.startsWith('/') ? item.component : `/${item.component}`, url: targetPath,
animationType: 'slide-in-right' animationType: 'slide-in-right'
}); });
}, },

View File

@ -597,7 +597,7 @@
if(!this.selectedDetail){ if(!this.selectedDetail){
return false; return false;
} }
const stocks = await this.$http("stock.search", { const stocks = await this.$http("stock.warehouse.search", {
keyword: data, keyword: data,
store_id: this.receivingInfo.store_id store_id: this.receivingInfo.store_id
}); });