From aecf90560bf62fdb7691f72453b18ce14ce076a8 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期日, 07 四月 2024 18:23:13 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/ProjectWeb/src/router/avue-router.js | 15 +-
Source/ProjectWeb/src/store/modules/user.js | 227 +++------------------------------------------
2 files changed, 23 insertions(+), 219 deletions(-)
diff --git a/Source/ProjectWeb/src/router/avue-router.js b/Source/ProjectWeb/src/router/avue-router.js
index 933f2a5..9d2fc30 100644
--- a/Source/ProjectWeb/src/router/avue-router.js
+++ b/Source/ProjectWeb/src/router/avue-router.js
@@ -97,8 +97,9 @@
// 璁剧疆 props榛樿鍊� 浣滅敤灏辨槸灏嗗瓧娈佃缃垚閰嶇疆鐨�
const propsDefault = {
label: propsConfig.label || 'name',
- path: 'code',
- pathValue:propsConfig.path || 'path',
+ path:'code',
+ code: 'code',
+ pathValue:'pathValue',
icon: propsConfig.icon || 'icon',
children: propsConfig.children || 'children',
meta: propsConfig.meta || 'meta',
@@ -119,17 +120,15 @@
}
})();
let code = (() => {
- return oMenu[propsDefault.path]
+ return oMenu[propsDefault.code]
})();
// 灏嗗瓧绗︿覆鍒嗗壊鎴愭暟缁勶紝浠�'?'浣滀负鍒嗛殧绗�
let parts = path.split("?");
// 濡傛灉鏁扮粍鐨勯暱搴﹀ぇ浜�1锛岃〃绀烘湁'?'锛屽垯鍙栫涓�涓厓绱犵殑绗竴涓儴鍒嗭紝鍚﹀垯鐩存帴鍙栨暣涓瓧绗︿覆
let bsValue = parts.length > 1 ? parts[0].split("=")[1] : path.split("=")[1];
-
- if (bsValue ==='' || bsValue === undefined || bsValue === null ) {
+ if (bsValue === '' || bsValue === undefined || bsValue === null) {
bsValue = "UI";
}
-
//鐗规畩澶勭悊缁勪欢 鎵ц瀹岃繖涓� component 涔熷氨鏄簿纭埌鍏蜂綋鐨勬枃浠朵簡 views鏂囦欢澶逛笅闈㈠氨鏄叿浣撶殑椤甸潰浠g爜
let component = bsValue === 'UI' ? 'views/base/UIContentViewer' : `views/custom-ui/${bsValue}`,
name = oMenu[propsDefault.label],
@@ -147,7 +146,7 @@
//鏄惁鏈夊瓙璺敱
const isChild = children.length !== 0;
const oRouter = {
- path: code,
+ path: '/' + code,
component(resolve) {
// 鍒ゆ柇鏄惁涓洪璺敱
if (first) {
@@ -175,7 +174,7 @@
children: !isChild ? (() => {
if (first) {
// 杩欓噷鐨刬sURL鍒ゆ柇锛屽洜涓鸿繖涓綉绔欐湁浣跨敤 iframe銆傛墍浠ラ渶瑕佸垽鏂槸鍚︿负缃戦〉閾炬帴
- if (!isURL(path)) oMenu[propsDefault.path] = `${path}/index`;
+ if (!isURL(path)) oMenu[propsDefault.pathValue] = `${path}/index`;
return [{
component(resolve) {
require([`../${component}.vue`], resolve)
diff --git a/Source/ProjectWeb/src/store/modules/user.js b/Source/ProjectWeb/src/store/modules/user.js
index f522601..3878f5f 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);
+ }
+ });
}
@@ -206,218 +216,13 @@
GetMenu({commit, dispatch}, topMenuId) {
return new Promise(resolve => {
getRoutes('modelManagmentNode').then((res) => {
- const list =[
- {
- "action": null,
- "actionName": null,
- "alias": "璧勬簮搴�",
- "category": null,
- "categoryName": null,
- "children": [
- {
- "action": null,
- "actionName": null,
- "alias": "鐭ヨ瘑搴�",
- "category": null,
- "categoryName": null,
- "children": [
- {
- "action": null,
- "actionName": null,
- "alias": "resourcelib",
- "category": null,
- "categoryName": null,
- "children": [],
- "code": "resourcelib",
- "hasChildren": false,
- "id": "2C5FABD2-535F-8568-8E61-C643BA7D77A1",
- "isOpen": null,
- "isOpenName": null,
- "meta": {
- "keepAlive": false
- },
- "name": "璁惧璧勬簮搴�",
- "parentId": "9B00AD2C-A407-7F71-B35C-58E466E53A33",
- "parentName": null,
- "path": "bs=test?image=resource&type=folder&context=resourcemanager&querytype=0&querytemplate=resourcelibroot",
- "remark": null,
- "sort": 1,
- "source": ""
- },
- {
- "action": null,
- "actionName": null,
- "alias": "宸ヨ壓鐭ヨ瘑搴�",
- "category": null,
- "categoryName": null,
- "children": [],
- "code": "gongyi",
- "hasChildren": false,
- "id": "AC04E222-F14B-F4FF-11BB-DFE8917A2756",
- "isOpen": null,
- "isOpenName": null,
- "meta": {
- "keepAlive": false
- },
- "name": "宸ヨ壓鐭ヨ瘑搴�",
- "parentId": "9B00AD2C-A407-7F71-B35C-58E466E53A33",
- "parentName": null,
- "path": "bs=UI?image=report&type=folder&context=knowledgemanager&querytype=0&querytemplate=knowledgelibroot",
- "remark": null,
- "sort": 2,
- "source": ""
- }
- ],
- "code": "zhishiku",
- "hasChildren": true,
- "id": "9B00AD2C-A407-7F71-B35C-58E466E53A33",
- "isOpen": null,
- "isOpenName": null,
- "meta": {
- "keepAlive": false
- },
- "name": "鐭ヨ瘑搴�",
- "parentId": "4EDC91B8-E3B2-D126-E75C-D2CEC59F53CE",
- "parentName": null,
- "path": "bs=/base",
- "remark": null,
- "sort": 1,
- "source": ""
- },
- {
- "action": null,
- "actionName": null,
- "alias": "TemplateLib",
- "category": null,
- "categoryName": null,
- "children": [
- {
- "action": null,
- "actionName": null,
- "alias": "CardTemplateLib",
- "category": null,
- "categoryName": null,
- "children": [],
- "code": "CardTemplateLib",
- "hasChildren": false,
- "id": "E6E963E7-2DF6-80EE-2A61-FA86E0F3D5F2",
- "isOpen": null,
- "isOpenName": null,
- "meta": {
- "keepAlive": false
- },
- "name": "鍗$墖妯℃澘",
- "parentId": "8493A92A-13DA-8800-140D-9C0C4A722665",
- "parentName": null,
- "path": "bs=?image=card&type=folder&context=cardtemplatemanager&querytype=0&querytemplate=cardtemplateroot",
- "remark": null,
- "sort": 1,
- "source": ""
- }
- ],
- "code": "TemplateLib",
- "hasChildren": true,
- "id": "8493A92A-13DA-8800-140D-9C0C4A722665",
- "isOpen": null,
- "isOpenName": null,
- "meta": {
- "keepAlive": false
- },
- "name": "妯℃澘搴�",
- "parentId": "4EDC91B8-E3B2-D126-E75C-D2CEC59F53CE",
- "parentName": null,
- "path": "bs=mb",
- "remark": null,
- "sort": 2,
- "source": ""
- },
- {
- "action": null,
- "actionName": null,
- "alias": "鍏稿瀷鏁版嵁搴�",
- "category": null,
- "categoryName": null,
- "children": [
- {
- "action": null,
- "actionName": null,
- "alias": "鍏稿瀷瑙勭▼",
- "category": null,
- "categoryName": null,
- "children": [],
- "code": "guicheng",
- "hasChildren": false,
- "id": "B3EC1413-1A33-61E3-DDD1-CB4D0CFD0C6E",
- "isOpen": null,
- "isOpenName": null,
- "meta": {
- "keepAlive": false
- },
- "name": "鍏稿瀷瑙勭▼",
- "parentId": "BDBD6CFA-2F4C-EEF7-C380-5E9BBF6A37B3",
- "parentName": null,
- "path": "bs=?image=typical&type=workorder&context=TypicalProcessLib",
- "remark": null,
- "sort": 1,
- "source": ""
- }
- ],
- "code": "dianxing",
- "hasChildren": true,
- "id": "BDBD6CFA-2F4C-EEF7-C380-5E9BBF6A37B3",
- "isOpen": null,
- "isOpenName": null,
- "meta": {
- "keepAlive": false
- },
- "name": "鍏稿瀷鏁版嵁搴�",
- "parentId": "4EDC91B8-E3B2-D126-E75C-D2CEC59F53CE",
- "parentName": null,
- "path": "bs=dx",
- "remark": null,
- "sort": 3,
- "source": ""
- }
- ],
- "code": "ziyuanku",
- "hasChildren": true,
- "id": "4EDC91B8-E3B2-D126-E75C-D2CEC59F53CE",
- "isOpen": null,
- "isOpenName": null,
- "meta": {
- "keepAlive": false
- },
- "name": "璧勬簮搴�",
- "parentId": "modelManagmentNode",
- "parentName": null,
- "path": "bs=zy",
- "remark": null,
- "sort": 913,
- "source": ""
- }
- ];
const data = res.data.obj;
- let menu = deepClone(list);
+ let menu = deepClone(data);
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