From 5426194b8651c9b2e13669940535e32e563964e5 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期日, 07 四月 2024 17:34:41 +0800 Subject: [PATCH] 路由代码上传 --- Source/ProjectWeb/src/store/modules/user.js | 37 ++++++++++++++++--------------------- 1 files changed, 16 insertions(+), 21 deletions(-) diff --git a/Source/ProjectWeb/src/store/modules/user.js b/Source/ProjectWeb/src/store/modules/user.js index f522601..4227cc6 100644 --- a/Source/ProjectWeb/src/store/modules/user.js +++ b/Source/ProjectWeb/src/store/modules/user.js @@ -14,7 +14,7 @@ const propsConfig = menu.props; const propsDefault = { label: propsConfig.label || 'name', - path: 'code', + path: propsConfig.path || 'path', icon: propsConfig.icon || 'icon', children: propsConfig.children || 'children' } @@ -27,9 +27,19 @@ } else { ele[propsDefault.children].forEach(child => { addPath(child); - }) - } + }); + } +} + +function updateCode(items) { + items.forEach(item => { + item.pathValue = item.path; + item.path = '/' + item.code; + if (item.children && item.children.length > 0) { + updateCode(item.children); + } + }); } @@ -356,7 +366,7 @@ "name": "鍏稿瀷瑙勭▼", "parentId": "BDBD6CFA-2F4C-EEF7-C380-5E9BBF6A37B3", "parentName": null, - "path": "bs=?image=typical&type=workorder&context=TypicalProcessLib", + "path": "bs=test?image=typical&type=workorder&context=TypicalProcessLib", "remark": null, "sort": 1, "source": "" @@ -400,24 +410,9 @@ let menu = deepClone(list); menu.forEach(ele => { addPath(ele, true); + updateCode([ele]); }); - updateCode(menu) - function updateCode(items) { - items.forEach(item => { - // 灏嗗瓧绗︿覆鍒嗗壊鎴愭暟缁勶紝浠�'?'浣滀负鍒嗛殧绗� - let parts = item.path.split("?"); - // 濡傛灉鏁扮粍鐨勯暱搴﹀ぇ浜�1锛岃〃绀烘湁'?'锛屽垯鍙栫涓�涓厓绱犵殑绗竴涓儴鍒嗭紝鍚﹀垯鐩存帴鍙栨暣涓瓧绗︿覆 - let bsValue = parts.length > 1 ? parts[0].split("=")[1] : item.path.split("=")[1]; - if (bsValue ==='' || bsValue === undefined || bsValue === null) { - bsValue = "UI"; - } - item.path = bsValue === 'UI' ? '/base/UIContentViewer' : `/custom-ui/${bsValue}`; - // 濡傛灉children涓嶄负绌猴紝閫掑綊璋冪敤杩欎釜鍑芥暟 - if (item.children && item.children.length > 0) { - updateCode(item.children); - } - }); - } + commit('SET_MENU_ALL', menu) commit('SET_MENU', menu) //dispatch('GetButtons');s -- Gitblit v1.9.3