@lambo-design/pro-layout 1.0.0-beta.206 → 1.0.0-beta.207
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambo-design/pro-layout",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.207",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"registry": "https://registry.npmjs.org/"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@lambo-design/
|
|
14
|
-
"@lambo-design/
|
|
13
|
+
"@lambo-design/shared": "^1.0.0-beta.115",
|
|
14
|
+
"@lambo-design/core": "^4.7.1-beta.118"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {}
|
|
17
17
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<LamboProLogo @clickLogo="handleClick"></LamboProLogo>
|
|
8
8
|
</div>
|
|
9
9
|
<div class="nav-box">
|
|
10
|
-
<LamboProNav
|
|
10
|
+
<LamboProNav></LamboProNav>
|
|
11
11
|
</div>
|
|
12
12
|
<div class="tools-box">
|
|
13
13
|
<LamboProTools></LamboProTools>
|
|
@@ -66,7 +66,6 @@ export default {
|
|
|
66
66
|
FastSearch
|
|
67
67
|
},
|
|
68
68
|
methods:{
|
|
69
|
-
|
|
70
69
|
handleClick(){
|
|
71
70
|
this.$emit('clickLogo')
|
|
72
71
|
},
|
|
@@ -94,19 +93,18 @@ export default {
|
|
|
94
93
|
});
|
|
95
94
|
},
|
|
96
95
|
destroyListener(){
|
|
96
|
+
Bus.$off('system-info')
|
|
97
97
|
Bus.$off('nav-list')
|
|
98
98
|
Bus.$off('menu-list')
|
|
99
99
|
Bus.$off('trigger-change')
|
|
100
100
|
Bus.$off('change-app')
|
|
101
101
|
Bus.$off('tag-list')
|
|
102
102
|
Bus.$off('menu-click')
|
|
103
|
-
Bus.$off('system-info')
|
|
104
103
|
},
|
|
105
104
|
initSystem(data){
|
|
106
105
|
if (data) {
|
|
107
106
|
this.systemInfo = data;
|
|
108
107
|
if (data.isShowSearch) {
|
|
109
|
-
// console.log('head中的isShowSearch',data.isShowSearch)
|
|
110
108
|
this.isShowSearch = data.isShowSearch;
|
|
111
109
|
}
|
|
112
110
|
}
|
|
@@ -118,7 +116,6 @@ export default {
|
|
|
118
116
|
this.navList = data;
|
|
119
117
|
},
|
|
120
118
|
handleSelect(name,uri,pid){
|
|
121
|
-
//console.log('head中的handleSelect',name,uri,pid)
|
|
122
119
|
let menu = null;
|
|
123
120
|
if (name.indexOf("isTurnByHref_") > -1) {
|
|
124
121
|
name = name.replace("isTurnByHref_","");
|
|
@@ -135,7 +132,6 @@ export default {
|
|
|
135
132
|
}
|
|
136
133
|
if (menu.meta && Array.isArray(menu.meta.crumbs)) {
|
|
137
134
|
let parentMenu = menu.meta.crumbs[0]
|
|
138
|
-
// console.log('parentMenu',parentMenu)
|
|
139
135
|
this.$set(this, 'selectedTopParent', parentMenu.name);
|
|
140
136
|
} else {
|
|
141
137
|
// 处理没有父菜单的情况
|
|
@@ -156,12 +152,9 @@ export default {
|
|
|
156
152
|
this.activeName = menu.name; // 设置当前菜单为激活状态
|
|
157
153
|
}
|
|
158
154
|
}
|
|
159
|
-
// console.log("nextTick之前,openedNames:", this.openedNames);
|
|
160
|
-
|
|
161
155
|
},
|
|
162
156
|
|
|
163
157
|
getTopParent(menu) {
|
|
164
|
-
//console.log('menu',menu)
|
|
165
158
|
return menu.parent ? this.getTopParent(menu.parent) : menu.name;
|
|
166
159
|
},
|
|
167
160
|
initMenu(data){
|
|
@@ -188,7 +181,6 @@ export default {
|
|
|
188
181
|
this.openedNames = this.getOpenedNamesByActiveName();
|
|
189
182
|
},
|
|
190
183
|
activeIconBackground(item) {
|
|
191
|
-
// console.log('activeBack')
|
|
192
184
|
// 如果当前菜单项是激活的,返回一个颜色值,否则返回空
|
|
193
185
|
return this.selectedMenuParent=== item.parent ? '#ff0000' : '';
|
|
194
186
|
},
|
|
@@ -229,7 +221,6 @@ export default {
|
|
|
229
221
|
}
|
|
230
222
|
}
|
|
231
223
|
return openNames
|
|
232
|
-
//console.log('side中getOpenedNamesByActiveNameopenedNames:',openNames)
|
|
233
224
|
},
|
|
234
225
|
updateOpened () {
|
|
235
226
|
const items = findComponentsDownward(this, 'Submenu');
|
|
@@ -244,24 +235,17 @@ export default {
|
|
|
244
235
|
if (this.currentActiveName === undefined) {
|
|
245
236
|
this.currentActiveName = -1;
|
|
246
237
|
}
|
|
247
|
-
// this.broadcast('Submenu', 'on-update-active-name', false);
|
|
248
|
-
// this.broadcast('MenuItem', 'on-update-active-name', this.currentActiveName);
|
|
249
238
|
}
|
|
250
239
|
},
|
|
251
240
|
watch:{
|
|
252
241
|
activeName(){
|
|
253
242
|
this.openedNames = this.getOpenedNamesByActiveName();
|
|
254
|
-
// console.log("head中的gqz1activeName:", this.activeName);
|
|
255
|
-
// console.log("head中的gqz1openedNames:", this.openedNames);
|
|
256
243
|
},
|
|
257
244
|
openedNames() {
|
|
258
|
-
// console.log("head中的gqz3openedNames:", this.openedNames);
|
|
259
245
|
this.$nextTick(() => {
|
|
260
246
|
this.updateOpened()
|
|
261
247
|
this.updateActiveName()
|
|
262
248
|
})
|
|
263
|
-
// console.log("head中的gqz2activeName:", this.activeName);
|
|
264
|
-
// console.log("head中的gqz2openedNames:", this.openedNames);
|
|
265
249
|
}
|
|
266
250
|
},
|
|
267
251
|
created(){
|
|
@@ -24,10 +24,7 @@ import { deepCopy } from '@lambo-design/shared/utils/assist'
|
|
|
24
24
|
export default {
|
|
25
25
|
name: 'pro-layout-',
|
|
26
26
|
props: {
|
|
27
|
-
|
|
28
|
-
type: String,
|
|
29
|
-
default: ''
|
|
30
|
-
}
|
|
27
|
+
|
|
31
28
|
},
|
|
32
29
|
data() {
|
|
33
30
|
return {
|
|
@@ -37,13 +34,14 @@ export default {
|
|
|
37
34
|
activeName: '',
|
|
38
35
|
topMenuNum: 4,
|
|
39
36
|
lastTopMenuNum:-1,
|
|
37
|
+
acceptAppId: '',
|
|
40
38
|
originMenuList: []
|
|
41
39
|
}
|
|
42
40
|
},
|
|
43
41
|
methods: {
|
|
44
42
|
initListener() {
|
|
45
|
-
Bus.$on('
|
|
46
|
-
this.
|
|
43
|
+
Bus.$on('system-info',(data) => {
|
|
44
|
+
this.initSystemInfo();
|
|
47
45
|
})
|
|
48
46
|
Bus.$on('nav-list', (data) => {
|
|
49
47
|
this.initNav(data)
|
|
@@ -57,13 +55,14 @@ export default {
|
|
|
57
55
|
|
|
58
56
|
},
|
|
59
57
|
destroyListener() {
|
|
58
|
+
Bus.$off('system-info')
|
|
60
59
|
Bus.$off('nav-list')
|
|
61
60
|
Bus.$off('menu-list')
|
|
62
61
|
Bus.$off('change-app')
|
|
63
|
-
Bus.$off('top-menu-num')
|
|
64
62
|
},
|
|
65
|
-
|
|
66
|
-
this.topMenuNum = data
|
|
63
|
+
initSystemInfo(data) {
|
|
64
|
+
this.topMenuNum = data.topMenu ? data.topMenu : 4;
|
|
65
|
+
this.acceptAppId = data.acceptAppId ? data.acceptAppId : '';
|
|
67
66
|
this.initNav(this.navList)
|
|
68
67
|
},
|
|
69
68
|
initNav(data) {
|
|
@@ -94,7 +93,6 @@ export default {
|
|
|
94
93
|
},
|
|
95
94
|
initMenu(data) {
|
|
96
95
|
this.originMenuList = deepCopy(data)
|
|
97
|
-
//console.log('nav-list',this.originMenuList)
|
|
98
96
|
},
|
|
99
97
|
selectApp(appId) {
|
|
100
98
|
this.activeName = appId
|
|
@@ -36,13 +36,12 @@ export default {
|
|
|
36
36
|
name: 'pro-layout-tools-user',
|
|
37
37
|
data() {
|
|
38
38
|
return {
|
|
39
|
+
menuList: [],
|
|
40
|
+
currentName: '',
|
|
41
|
+
currentItem: {},
|
|
39
42
|
isFullScreen:false,
|
|
40
|
-
serverContext: config.upmsServerContext,
|
|
41
43
|
isCollected:false,
|
|
42
|
-
rightTopOptButtonList: [],
|
|
43
|
-
collectedMenus:[],
|
|
44
|
-
currentItem:{},
|
|
45
|
-
currentName:'',
|
|
44
|
+
rightTopOptButtonList: ['collect','fullScreen'],
|
|
46
45
|
userInfo: {
|
|
47
46
|
userName: '管理员',
|
|
48
47
|
dropList: [
|
|
@@ -52,96 +51,77 @@ export default {
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
},
|
|
54
|
+
watch: {
|
|
55
|
+
collectMenuList(){
|
|
56
|
+
this.changeCollectMenu();
|
|
57
|
+
},
|
|
58
|
+
currentName(){
|
|
59
|
+
this.changeCollectMenu();
|
|
60
|
+
}
|
|
61
|
+
},
|
|
55
62
|
methods: {
|
|
56
63
|
initListener() {
|
|
64
|
+
Bus.$on('system-info',(data) => {
|
|
65
|
+
this.initSystemInfo();
|
|
66
|
+
})
|
|
57
67
|
Bus.$on('user-info', (data) => {
|
|
58
68
|
this.handleUser(data)
|
|
59
69
|
})
|
|
60
|
-
Bus.$on('
|
|
61
|
-
this.
|
|
70
|
+
Bus.$on('menu-list', (data) => {
|
|
71
|
+
this.initMenu(data);
|
|
62
72
|
})
|
|
63
73
|
Bus.$on('menu-click',(name,item) => {
|
|
64
74
|
this.initMenuClick(name, item)
|
|
65
75
|
})
|
|
66
|
-
Bus.$on('
|
|
67
|
-
this.
|
|
68
|
-
})
|
|
69
|
-
Bus.$on('change-top-collect', (data) => {
|
|
70
|
-
this.changeTopCollect(data)
|
|
71
|
-
})
|
|
76
|
+
Bus.$on('collect-menu-list',(data)=>{
|
|
77
|
+
this.initCollectMenu(data)
|
|
78
|
+
});
|
|
72
79
|
},
|
|
73
80
|
destroyListener() {
|
|
81
|
+
Bus.$off('system-info')
|
|
74
82
|
Bus.$off('user-info')
|
|
75
|
-
Bus.$off('
|
|
83
|
+
Bus.$off('menu-list')
|
|
76
84
|
Bus.$off('menu-click')
|
|
77
|
-
Bus.$off('
|
|
78
|
-
Bus.$off('change-top-collect')
|
|
85
|
+
Bus.$off('collect-menu-list')
|
|
79
86
|
},
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
initSystemInfo(data){
|
|
88
|
+
if (data && data.rightTopOptButtonList) {
|
|
89
|
+
this.rightTopOptButtonList = deepCopy(data.rightTopOptButtonList)
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
handleUser(data) {
|
|
93
|
+
this.userInfo = Object.assign(this.userInfo, data)
|
|
82
94
|
},
|
|
83
|
-
|
|
84
|
-
this.
|
|
95
|
+
initMenu(data){
|
|
96
|
+
this.menuList = deepCopy(data);
|
|
85
97
|
},
|
|
86
98
|
initMenuClick(name, item){
|
|
87
|
-
let self = this
|
|
88
99
|
this.currentName = name
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return
|
|
100
|
+
if(item) {
|
|
101
|
+
this.currentItem = item;
|
|
102
|
+
} else {
|
|
103
|
+
this.currentItem = this.menuList.find(menu => menu.name == name)
|
|
94
104
|
}
|
|
95
|
-
ajax.get(this.serverContext + "/manage/upmsMenuCollect/queryIsCollected",{
|
|
96
|
-
params:{
|
|
97
|
-
appId: item1.appId,
|
|
98
|
-
permissionId: item1.permissionId
|
|
99
|
-
}
|
|
100
|
-
}).then(resp => {
|
|
101
|
-
if (resp.data && resp.data.code == 1){
|
|
102
|
-
self.isCollected = resp.data.data === null ? false : true
|
|
103
|
-
}
|
|
104
|
-
}).catch(err => {
|
|
105
|
-
console.error(err);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
105
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
this.rightTopOptButtonList = deepCopy(data)
|
|
106
|
+
initCollectMenu(data){
|
|
107
|
+
this.collectMenuList = data;
|
|
112
108
|
},
|
|
113
|
-
|
|
114
|
-
this.
|
|
109
|
+
changeCollectMenu(){
|
|
110
|
+
this.isCollected = false
|
|
111
|
+
let collectMenu = this.collectMenuList.find(item => item.name == this.currentName)
|
|
112
|
+
this.isCollected = !!collectMenu;
|
|
115
113
|
},
|
|
116
114
|
handleClick(name) {
|
|
117
115
|
Bus.$emit('user-action', name)
|
|
118
116
|
},
|
|
119
117
|
collectEvent(){
|
|
120
|
-
let
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const data = {
|
|
125
|
-
appId: this.currentItem.appId,
|
|
118
|
+
let data = {
|
|
119
|
+
meta: {
|
|
120
|
+
appId: this.currentItem.appId
|
|
121
|
+
},
|
|
126
122
|
permissionId: this.currentItem.permissionId
|
|
127
123
|
}
|
|
128
|
-
|
|
129
|
-
if (resp.data.code == 1) {
|
|
130
|
-
self.isCollected = !self.isCollected
|
|
131
|
-
const message = self.isCollected ? '收藏成功' : '取消收藏成功'
|
|
132
|
-
Bus.$emit('change-side-collect',self.currentItem)
|
|
133
|
-
self.$Message.success(message)
|
|
134
|
-
|
|
135
|
-
} else {
|
|
136
|
-
const message = self.isCollected ? '取消收藏失败' : '收藏失败'
|
|
137
|
-
self.$Message.error(message + ', 请联系系统管理员')
|
|
138
|
-
}
|
|
139
|
-
}).catch(function (err) {
|
|
140
|
-
console.error('收藏操作失败:', err)
|
|
141
|
-
self.$Message.error('操作失败, 请联系系统管理员')
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
|
|
124
|
+
Bus.$emit('toggle-collect-menu',!this.isCollected,data)
|
|
145
125
|
},
|
|
146
126
|
handleKeyPress(event){
|
|
147
127
|
// 按下 F11 键时触发全屏切换
|
|
@@ -150,7 +130,6 @@ export default {
|
|
|
150
130
|
this.handleFullScreen();
|
|
151
131
|
}
|
|
152
132
|
},
|
|
153
|
-
|
|
154
133
|
// 全屏事件
|
|
155
134
|
handleFullScreen() {
|
|
156
135
|
let element = document.documentElement;
|
|
@@ -219,12 +198,9 @@ export default {
|
|
|
219
198
|
}, 0);
|
|
220
199
|
});
|
|
221
200
|
},
|
|
222
|
-
|
|
223
201
|
beforeDestroy() {
|
|
224
202
|
this.destroyListener()
|
|
225
203
|
document.removeEventListener('keydown', this.handleKeyPress);
|
|
226
|
-
// window.removeEventListener('resize', this.handleResize)
|
|
227
|
-
|
|
228
204
|
}
|
|
229
205
|
}
|
|
230
206
|
</script>
|
package/src/index.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<i-layout class="pro-layout" :class="layoutClass">
|
|
3
3
|
<i-header class="pro-layout-header">
|
|
4
|
-
<LamboProLayoutHeader
|
|
4
|
+
<LamboProLayoutHeader @clickLogo="handleClick" @on-select="handleSelect"></LamboProLayoutHeader>
|
|
5
5
|
</i-header>
|
|
6
6
|
<i-layout>
|
|
7
7
|
<i-sider
|
|
@@ -40,14 +40,6 @@ import {
|
|
|
40
40
|
import {deepCopy} from "@lambo-design/shared/utils/assist";
|
|
41
41
|
export default {
|
|
42
42
|
props:{
|
|
43
|
-
acceptAppId: {
|
|
44
|
-
type: String,
|
|
45
|
-
default:''
|
|
46
|
-
},
|
|
47
|
-
topMenuNum: {
|
|
48
|
-
type: Number,
|
|
49
|
-
default: 4
|
|
50
|
-
},
|
|
51
43
|
systemInfo: {
|
|
52
44
|
type: Object,
|
|
53
45
|
default: () => {
|
|
@@ -55,14 +47,13 @@ export default {
|
|
|
55
47
|
systemName: '后台管理系统',
|
|
56
48
|
systemLogo: '',
|
|
57
49
|
layoutSize: '',
|
|
50
|
+
acceptAppId: '',
|
|
58
51
|
tabNum: 8,
|
|
52
|
+
topMenu: 4,
|
|
53
|
+
rightTopOptButtonList: []
|
|
59
54
|
}
|
|
60
55
|
}
|
|
61
56
|
},
|
|
62
|
-
serverContext: {
|
|
63
|
-
type: String,
|
|
64
|
-
default: () => config.upmsServerContext // 设置默认值
|
|
65
|
-
},
|
|
66
57
|
userInfo: {
|
|
67
58
|
type: Object,
|
|
68
59
|
default: () => {}
|
|
@@ -88,12 +79,7 @@ export default {
|
|
|
88
79
|
default: () => {
|
|
89
80
|
return config.homeRouter
|
|
90
81
|
}
|
|
91
|
-
}
|
|
92
|
-
//右上角按钮列表
|
|
93
|
-
rightTopOptButtonList: {
|
|
94
|
-
type: Array,
|
|
95
|
-
default: () => []
|
|
96
|
-
},
|
|
82
|
+
}
|
|
97
83
|
},
|
|
98
84
|
data(){
|
|
99
85
|
return {
|
|
@@ -190,10 +176,6 @@ export default {
|
|
|
190
176
|
Bus.$emit('system-info',this.systemInfo)
|
|
191
177
|
Bus.$emit('user-info',this.userInfo)
|
|
192
178
|
Bus.$emit('nav-list',this.navList)
|
|
193
|
-
Bus.$emit('right-top-opt-button-list',this.rightTopOptButtonList)
|
|
194
|
-
Bus.$emit('top-menu-num',this.topMenuNum)
|
|
195
|
-
Bus.$emit('server-context',this.serverContext)
|
|
196
|
-
|
|
197
179
|
this.menuList.map(item => {
|
|
198
180
|
// 如果 uri 不以 '/' 开头,添加 '/'
|
|
199
181
|
if (item.uri&&!item.uri.startsWith('/')&&!item.uri.startsWith('http')) {
|