@lambo-design/pro-layout 1.0.0-beta.155 → 1.0.0-beta.157
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@lambo-design/pro-layout",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"@lambo-design/core": "
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@lambo-design/pro-layout",
|
|
3
|
+
"version": "1.0.0-beta.157",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"author": "lambo",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"registry": "https://registry.npmjs.org/"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@lambo-design/shared": "^1.0.0-beta.97",
|
|
14
|
+
"@lambo-design/core": "^4.7.1-beta.105"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {}
|
|
17
|
+
}
|
|
@@ -44,6 +44,10 @@ export default {
|
|
|
44
44
|
serverContext: {
|
|
45
45
|
type: String,
|
|
46
46
|
default: () => config.upmsServerContext
|
|
47
|
+
},
|
|
48
|
+
collectedMenus: {
|
|
49
|
+
type: Object,
|
|
50
|
+
default: () => ({})
|
|
47
51
|
}
|
|
48
52
|
},
|
|
49
53
|
data() {
|
|
@@ -51,31 +55,36 @@ export default {
|
|
|
51
55
|
isCollected: {}, // 使用对象来记录每个子菜单的收藏状态
|
|
52
56
|
};
|
|
53
57
|
},
|
|
54
|
-
mounted() {
|
|
55
|
-
|
|
56
|
-
},
|
|
58
|
+
// mounted() {
|
|
59
|
+
// this.fetchCollectedMenus();
|
|
60
|
+
// },
|
|
57
61
|
methods: {
|
|
58
|
-
fetchCollectedMenus() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
62
|
+
// fetchCollectedMenus() {
|
|
63
|
+
// ajax.get(this.serverContext + "/manage/upmsMenuCollect/list").then(resp => {
|
|
64
|
+
// const collectedMenus = resp.data.data;
|
|
65
|
+
// if (Array.isArray(collectedMenus)) {
|
|
66
|
+
// collectedMenus.forEach(menu => {
|
|
67
|
+
// // 使用 menu 的 name 属性作为键
|
|
68
|
+
// this.$set(this.isCollected, menu.name, true);
|
|
69
|
+
// });
|
|
70
|
+
// } else {
|
|
71
|
+
// console.error("Expected an array but got:", typeof collectedMenus);
|
|
72
|
+
// }
|
|
73
|
+
// ;
|
|
74
|
+
// }).catch(err => {
|
|
75
|
+
// console.error("Error fetching collected menus:", err);
|
|
76
|
+
// });
|
|
77
|
+
// },
|
|
74
78
|
addHistory(item) {
|
|
75
79
|
let res = menuHistory(item.meta.appId, item.meta.pid)
|
|
76
80
|
},
|
|
77
81
|
toggleCollect(item) {
|
|
78
82
|
const self = this;
|
|
83
|
+
self.collectedMenus.forEach(menu => {
|
|
84
|
+
// 使用 menu 的 name 属性作为键
|
|
85
|
+
self.$set(self.isCollected, menu.name, true);
|
|
86
|
+
});
|
|
87
|
+
|
|
79
88
|
let list = this.$store.state.app.originalPermissionList;
|
|
80
89
|
|
|
81
90
|
let item1 = list.find(item1 => item1.name == item.component);
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
<template v-if="item.children && item.children.length === 1">
|
|
9
9
|
<ProLayoutSiderMenuItem v-if="showChildren(item)"
|
|
10
10
|
:key="`menu-${item.name}`"
|
|
11
|
-
:parent-item="item"
|
|
11
|
+
:parent-item="item"
|
|
12
|
+
:collected-menus="collectedMenus"
|
|
13
|
+
:server-context="serverContext">
|
|
12
14
|
</ProLayoutSiderMenuItem>
|
|
13
15
|
<MenuItem v-else :key="`menu-${item.children[0].name}`"
|
|
14
16
|
:name="getNameOrHref(item, true)">
|
|
@@ -68,6 +70,7 @@ import {
|
|
|
68
70
|
tagExists
|
|
69
71
|
} from "@lambo-design/shared/utils/platform";
|
|
70
72
|
import config from "@lambo-design/shared/config/config";
|
|
73
|
+
import ajax from "@lambo-design/shared/utils/ajax";
|
|
71
74
|
|
|
72
75
|
export default {
|
|
73
76
|
name: "pro-layout-sider",
|
|
@@ -101,10 +104,14 @@ export default {
|
|
|
101
104
|
selectedTopParent: '',
|
|
102
105
|
activeIcon: null,
|
|
103
106
|
tagValue: '',
|
|
104
|
-
tagList: []
|
|
107
|
+
tagList: [],
|
|
108
|
+
collectedMenus: [],
|
|
105
109
|
}
|
|
106
110
|
},
|
|
107
111
|
mixins:[sider],
|
|
112
|
+
mounted() {
|
|
113
|
+
this.fetchCollectedMenus();
|
|
114
|
+
},
|
|
108
115
|
methods: {
|
|
109
116
|
initListener(){
|
|
110
117
|
Bus.$on('nav-list',(data)=>{
|
|
@@ -244,7 +251,24 @@ export default {
|
|
|
244
251
|
}
|
|
245
252
|
}
|
|
246
253
|
return openNames
|
|
247
|
-
}
|
|
254
|
+
},
|
|
255
|
+
fetchCollectedMenus() {
|
|
256
|
+
ajax.get(this.serverContext + "/manage/upmsMenuCollect/list").then(resp => {
|
|
257
|
+
const collectedMenus = resp.data.data;
|
|
258
|
+
if (Array.isArray(collectedMenus)) {
|
|
259
|
+
this.collectedMenus = collectedMenus
|
|
260
|
+
// collectedMenus.forEach(menu => {
|
|
261
|
+
// // 使用 menu 的 name 属性作为键
|
|
262
|
+
// this.$set(this.isCollected, menu.name, true);
|
|
263
|
+
// });
|
|
264
|
+
} else {
|
|
265
|
+
console.error("Expected an array but got:", typeof collectedMenus);
|
|
266
|
+
}
|
|
267
|
+
;
|
|
268
|
+
}).catch(err => {
|
|
269
|
+
console.error("Error fetching collected menus:", err);
|
|
270
|
+
});
|
|
271
|
+
},
|
|
248
272
|
},
|
|
249
273
|
watch:{
|
|
250
274
|
activeName(){
|