@lambo-design/pro-layout 1.0.0-beta.43 → 1.0.0-beta.431

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.
Files changed (39) hide show
  1. package/package.json +11 -4
  2. package/src/components/pro-layout-header/index.vue +218 -0
  3. package/src/components/pro-layout-header/pro-layout-logo/index.vue +206 -0
  4. package/src/components/pro-layout-header/pro-layout-nav/components/pro-layout-nav-slide-menu.vue +360 -0
  5. package/src/components/pro-layout-header/pro-layout-nav/index-slide.vue +225 -0
  6. package/src/components/pro-layout-header/pro-layout-nav/index.vue +526 -0
  7. package/src/components/pro-layout-header/pro-layout-slogan/index.vue +40 -0
  8. package/src/components/pro-layout-header/pro-layout-tools/components/pro-layout-tools-quick-collect.vue +79 -0
  9. package/src/components/pro-layout-header/pro-layout-tools/components/pro-layout-tools-quick-document.vue +20 -0
  10. package/src/components/pro-layout-header/pro-layout-tools/components/pro-layout-tools-quick-fullscreen.vue +144 -0
  11. package/src/components/pro-layout-header/pro-layout-tools/components/pro-layout-tools-quick-icons.vue +99 -0
  12. package/src/components/pro-layout-header/pro-layout-tools/components/pro-layout-tools-quick-intl.vue +91 -0
  13. package/src/components/pro-layout-header/pro-layout-tools/components/pro-layout-tools-quick-notice.vue +133 -0
  14. package/src/components/pro-layout-header/pro-layout-tools/components/pro-layout-tools-quick-search.vue +305 -0
  15. package/src/components/pro-layout-header/pro-layout-tools/components/pro-layout-tools-quick-todo.vue +145 -0
  16. package/src/components/pro-layout-header/pro-layout-tools/components/pro-layout-tools-user.vue +64 -0
  17. package/src/components/pro-layout-header/pro-layout-tools/index.vue +38 -0
  18. package/src/components/pro-layout-header/pro-layout-trigger/index.vue +84 -0
  19. package/src/components/{pro-layout-sider-collapsed-menu.vue → pro-layout-sider/components/pro-layout-sider-collapsed-menu.vue} +30 -11
  20. package/src/components/{pro-layout-sider-icon.vue → pro-layout-sider/components/pro-layout-sider-icon.vue} +2 -2
  21. package/src/components/pro-layout-sider/components/pro-layout-sider-menu-item.vue +137 -0
  22. package/src/components/pro-layout-sider/components/pro-layout-sider-other-menu.vue +140 -0
  23. package/src/components/pro-layout-sider/components/pro-layout-sider-search.vue +345 -0
  24. package/src/components/pro-layout-sider/index.vue +477 -0
  25. package/src/components/{pro-layout-tabs.vue → pro-layout-tabs/index.vue} +85 -13
  26. package/src/index.vue +296 -37
  27. package/src/styles/color.less +267 -0
  28. package/src/styles/images/xiaoxitongzhi.png +0 -0
  29. package/src/styles/other-menu.less +111 -0
  30. package/src/utils/menuItem.js +10 -0
  31. package/src/utils/sider.js +16 -1
  32. package/src/components/pro-layout-header.vue +0 -52
  33. package/src/components/pro-layout-logo.vue +0 -79
  34. package/src/components/pro-layout-nav.vue +0 -150
  35. package/src/components/pro-layout-sider-menu-item.vue +0 -37
  36. package/src/components/pro-layout-sider.vue +0 -240
  37. package/src/components/pro-layout-tools-user.vue +0 -84
  38. package/src/components/pro-layout-tools.vue +0 -21
  39. package/src/components/pro-layout-trigger.vue +0 -48
package/src/index.vue CHANGED
@@ -1,21 +1,47 @@
1
1
  <template>
2
2
  <i-layout class="pro-layout" :class="layoutClass">
3
- <i-header class="pro-layout-header">
4
- <LamboProLayoutHeader></LamboProLayoutHeader>
3
+ <i-header class="pro-layout-header" :style="systemInfo.headBackground ? headBackgroundStyle : ''">
4
+ <LamboProLayoutHeader :hide-menu-logo="isHideLeftMenu">
5
+ <template slot = "pro-layout-trigger">
6
+ <slot name="pro-layout-trigger"></slot>
7
+ </template>
8
+ <template slot = "pro-layout-logo">
9
+ <slot name="pro-layout-logo"></slot>
10
+ </template>
11
+ <template slot = "pro-layout-nav">
12
+ <slot name="pro-layout-nav"></slot>
13
+ </template>
14
+ <template slot = "pro-layout-icons">
15
+ <slot name="pro-layout-icons"></slot>
16
+ </template>
17
+ <template slot="pro-layout-custom-icons">
18
+ <slot name="pro-layout-custom-icons"></slot>
19
+ </template>
20
+ <template slot = "pro-layout-user">
21
+ <slot name="pro-layout-user"></slot>
22
+ </template>
23
+ </LamboProLayoutHeader>
5
24
  </i-header>
6
25
  <i-layout>
7
26
  <i-sider
27
+ v-show="isHideLeftMenu"
8
28
  class="pro-layout-sider"
9
29
  hide-trigger
10
30
  collapsible
11
- :width="220"
31
+ :width="siderWidth"
12
32
  :collapsed-width="64"
13
33
  v-model="collapsed">
14
34
  <LamboProLayoutSider ref="sider"></LamboProLayoutSider>
35
+ <!-- 拖拽条 -->
36
+ <div
37
+ v-show="isHideLeftMenu"
38
+ class="sider-resize-bar"
39
+ @mousedown.stop.prevent="startResize"
40
+ ></div>
15
41
  </i-sider>
16
42
  <i-content class="pro-layout-content">
17
43
  <i-layout class="pro-layout-content-layout">
18
- <div class="pro-layout-tabs">
44
+ <div class="pro-layout-tabs" v-show="isHideLeftMenu">
19
45
  <LamboProLayoutTabs></LamboProLayoutTabs>
20
46
  </div>
21
47
  <i-content class="pro-layout-page">
@@ -25,6 +51,13 @@
25
51
  </i-layout>
26
52
  </i-content>
27
53
  </i-layout>
54
+ <!-- 拖拽时的全局捕获层 -->
55
+ <div
56
+ v-if="isResizing"
57
+ class="resize-mask"
58
+ @mousemove="onMouseMove"
59
+ @mouseup="stopResize"
60
+ ></div>
28
61
  </i-layout>
29
62
  </template>
30
63
 
@@ -35,19 +68,33 @@ import LamboProLayoutTabs from './components/pro-layout-tabs'
35
68
  import Bus from '@lambo-design/shared/utils/bus'
36
69
  import config from "@lambo-design/shared/config/config";
37
70
  import {
38
- getTagNavListFromLocalstorage, routeEqual, tagExists,
71
+ getTagNavListFromLocalstorage, isOpenBlank, routeEqual, tagExists,
39
72
  } from "@lambo-design/shared/utils/platform";
40
73
  import {deepCopy} from "@lambo-design/shared/utils/assist";
74
+ import Locale from '@lambo-design/core/src/mixins/locale';
75
+
41
76
  export default {
77
+ mixins: [Locale],
42
78
  props:{
79
+ showLeftMenu: {
80
+ type: Boolean,
81
+ default: null
82
+ },
43
83
  systemInfo: {
44
84
  type: Object,
45
85
  default: () => {
46
86
  return {
47
- systemName: '后台管理系统',
87
+ systemName: this.t('pro-layout.common.systemName'),
48
88
  systemLogo: '',
49
89
  layoutSize: '',
50
- tabNum: 8,
90
+ acceptAppId: '',
91
+ tabNum: 5,
92
+ topMenu: 4,
93
+ rightTopOptButtonList: [],
94
+ menuScaling:'1',
95
+ headBackground:'',
96
+ menuLogo: '1',
97
+ titleShow:'wrap'
51
98
  }
52
99
  }
53
100
  },
@@ -59,15 +106,31 @@ export default {
59
106
  type: Array,
60
107
  default: () => []
61
108
  },
109
+ originalAllMenuList: {
110
+ type: Array,
111
+ default: () => []
112
+ },
62
113
  menuList: {
63
114
  type: Array,
64
115
  default: () => []
65
116
  },
117
+ historyMenuList: {
118
+ type: Array,
119
+ default: () => []
120
+ },
121
+ collectMenuList: {
122
+ type: Array,
123
+ default: () => []
124
+ },
66
125
  homeRouter: {
67
126
  type: Object,
68
127
  default: () => {
69
128
  return config.homeRouter
70
129
  }
130
+ },
131
+ otherDatas: {
132
+ type: Object,
133
+ default: () => {}
71
134
  }
72
135
  },
73
136
  data(){
@@ -75,7 +138,12 @@ export default {
75
138
  collapsed: false,
76
139
  appId: '',
77
140
  activeName: '',
78
- tagList: []
141
+ tagList: [],
142
+ isHideLeftMenu: true,
143
+ siderWidth: 220,
144
+ isResizing: false,
145
+ minWidth: 180,
146
+ maxWidth: 600,
79
147
  }
80
148
  },
81
149
  components: {
@@ -85,19 +153,29 @@ export default {
85
153
  },
86
154
  computed: {
87
155
  allData(){
88
- const { systemInfo, userInfo, navList, menuList, homeRouter} = this;
156
+ const { systemInfo, userInfo, navList, originalAllMenuList, menuList, historyMenuList, collectMenuList, homeRouter, otherDatas} = this;
89
157
  return {
90
158
  systemInfo,
91
159
  userInfo,
92
160
  navList,
161
+ originalAllMenuList,
93
162
  menuList,
94
- homeRouter
163
+ historyMenuList,
164
+ collectMenuList,
165
+ homeRouter,
166
+ otherDatas
167
+ }
168
+ },
169
+ headBackgroundStyle(){
170
+ return{
171
+ background: `url(${this.systemInfo.headBackground}) no-repeat`,
172
+ backgroundSize: 'cover',
95
173
  }
96
174
  },
97
175
  layoutClass(){
98
176
  if (this.systemInfo && this.systemInfo.layoutSize) {
99
177
  let layoutSize = this.systemInfo.layoutSize;
100
- if (layoutSize == 'default') {
178
+ if (layoutSize === 'default') {
101
179
  return '';
102
180
  } else {
103
181
  return 'small';
@@ -113,9 +191,49 @@ export default {
113
191
  },
114
192
  immediate: true,
115
193
  deep: true
194
+ },
195
+ showLeftMenu: {
196
+ handler(val) {
197
+ if (val !== null) {
198
+ this.isHideLeftMenu = val;
199
+ }
200
+ },
201
+ immediate: true
202
+ },
203
+ collapsed(val) {
204
+ if (val) {
205
+ this.siderWidth = 64
206
+ } else {
207
+ const savedWidth = localStorage.getItem('siderWidth')
208
+ this.siderWidth = savedWidth ? parseInt(savedWidth) : 220
209
+ }
116
210
  }
117
211
  },
118
212
  methods: {
213
+ startResize(e) {
214
+ e.preventDefault()
215
+ e.stopPropagation()
216
+
217
+ this.isResizing = true
218
+ this.startX = e.clientX
219
+ this.startWidth = this.siderWidth
220
+ },
221
+
222
+ onMouseMove(e) {
223
+ if (!this.isResizing) return
224
+
225
+ const moveX = e.clientX - this.startX
226
+ const newWidth = this.startWidth + moveX
227
+
228
+ if (newWidth < this.minWidth) return
229
+ if (newWidth > this.maxWidth) return
230
+
231
+ this.siderWidth = newWidth
232
+ },
233
+
234
+ stopResize() {
235
+ this.isResizing = false
236
+ },
119
237
  initListener(){
120
238
  Bus.$on('trigger-change',(data)=>{
121
239
  this.triggerChange(data)
@@ -132,6 +250,36 @@ export default {
132
250
  Bus.$on('tag-list',(data,current)=>{
133
251
  this.changeTabs(data,current)
134
252
  });
253
+ Bus.$on('get-history-menu-list',() => {
254
+ this.getHistoryMenuList()
255
+ })
256
+ Bus.$on('delete-history-menu',(data) => {
257
+ this.deleteHistoryMenu(data)
258
+ })
259
+ Bus.$on('delete-collect-menu',(data) => {
260
+ this.deleteCollectMenu(data)
261
+ })
262
+ Bus.$on('toggle-collect-menu',(actionType,data) => {
263
+ this.toggleCollectMenu(actionType,data)
264
+ })
265
+ Bus.$on('click-logo',()=>{
266
+ this.clickLogo();
267
+ })
268
+ Bus.$on('other-operate',(type,data)=>{
269
+ this.otherOperate(type,data);
270
+ })
271
+ Bus.$on('change-search-keyword',(keyword,tab)=>{
272
+ this.$emit('other-operate','search-keyword',{
273
+ keyword:keyword,
274
+ tab:tab
275
+ })
276
+ })
277
+ Bus.$on('change-search-tab',(keyword,tab)=>{
278
+ this.$emit('other-operate','search-keyword',{
279
+ keyword:keyword,
280
+ tab:tab
281
+ })
282
+ })
135
283
  },
136
284
  destroyListener(){
137
285
  Bus.$off('trigger-change')
@@ -139,12 +287,31 @@ export default {
139
287
  Bus.$off('user-action')
140
288
  Bus.$off('menu-click')
141
289
  Bus.$off('tag-list')
290
+ Bus.$off('get-history-menu-list')
291
+ Bus.$off('delete-history-menu')
292
+ Bus.$off('delete-collect-menu')
293
+ Bus.$off('toggle-collect-menu')
294
+ Bus.$off('click-logo')
295
+ Bus.$off('other-operate')
296
+ Bus.$off('change-keyword')
297
+ Bus.$off('change-tab')
142
298
  },
143
299
  initEmit(){
300
+ //在这里改this.menuList
144
301
  Bus.$emit('system-info',this.systemInfo)
145
302
  Bus.$emit('user-info',this.userInfo)
146
303
  Bus.$emit('nav-list',this.navList)
147
- Bus.$emit('menu-list',this.menuList)
304
+ this.menuList.map(item => {
305
+ // 如果 uri 不以 '/' 开头,添加 '/'
306
+ if (item.uri&&!item.uri.startsWith('/')&&!item.uri.startsWith('http')) {
307
+ item.uri = '/' + item.uri;
308
+ }
309
+ });
310
+ Bus.$emit('origin-all-menu-list',this.originalAllMenuList);
311
+ Bus.$emit('menu-list',this.menuList);
312
+ Bus.$emit('history-menu-list',this.historyMenuList);
313
+ Bus.$emit('collect-menu-list',this.collectMenuList);
314
+ Bus.$emit('other-datas',this.otherDatas)
148
315
  },
149
316
  initTags(){
150
317
  let tagList = getTagNavListFromLocalstorage(config.routerBase + '-tagNavList');
@@ -165,6 +332,24 @@ export default {
165
332
  if (!appInfo) {
166
333
  appInfo = this.navList.filter(item => item.appId == appId)[0];
167
334
  }
335
+ let appConfig={}
336
+ //sc中台
337
+ if(appInfo && appInfo.extendProps){
338
+ appConfig=appInfo.extendProps
339
+ }
340
+ //x1中台
341
+ if(appInfo && appInfo.setting){
342
+ appConfig=JSON.parse(appInfo.setting)
343
+ }
344
+ // 优先使用传入的 showLeftMenu prop,其次使用 appConfig,最后使用默认值
345
+ if (this.showLeftMenu !== null) {
346
+ this.isHideLeftMenu = this.showLeftMenu;
347
+ } else if (appConfig && appConfig.is_hide_left_menu){
348
+ this.isHideLeftMenu=appConfig.is_hide_left_menu!='1'
349
+ }else{
350
+ this.isHideLeftMenu=true
351
+ }
352
+
168
353
  this.appId = appId;
169
354
  this.$emit('change-app',{appId,appInfo})
170
355
  },
@@ -173,15 +358,18 @@ export default {
173
358
  },
174
359
  menuClick(name, item){
175
360
  if (!item) {
176
- let res = this.menuList.filter(item => item.name == name);
361
+ let res = this.menuList.filter(item => item.name == name );
177
362
  if (res && res.length > 0) {
178
363
  item = res[0];
179
364
  }
180
365
  }
181
- sessionStorage.setItem('activeName',name);
366
+ if (!isOpenBlank(item)) {
367
+ sessionStorage.setItem('activeName',name);
368
+ }
182
369
  this.$emit('menu-click', name, item)
183
370
  },
184
371
  changeTabs(data,current){
372
+ // data = data.filter(item => item.name === current);
185
373
  this.$emit('change-tabs',data,current)
186
374
  },
187
375
  openMenuInTabs(menu){
@@ -202,19 +390,43 @@ export default {
202
390
  tagList.push(menuItem);
203
391
  } else {
204
392
  let tag = tagList.filter(item => item.name == name)[0];
205
- if (!routeEqual(tag,menuItem)) {
393
+ if (!routeEqual(tag,menuItem) && 'home' != name) {
206
394
  let res = tagList.filter(item => item.name !== name);
207
395
  tag = Object.assign(tag, menu);
208
396
  res.push(tag);
209
397
  tagList = deepCopy(res);
210
398
  }
211
399
  }
400
+
212
401
  Bus.$emit('tag-list', tagList, name)
213
402
  }
403
+ },
404
+ getHistoryMenuList(){
405
+ this.$emit('get-history-menu-list');
406
+ },
407
+ deleteHistoryMenu(data){
408
+ this.$emit('delete-history-menu',data);
409
+ },
410
+ deleteCollectMenu(data){
411
+ this.$emit('delete-collect-menu',data);
412
+ },
413
+ toggleCollectMenu(actionType,data){
414
+ this.$emit('toggle-collect-menu',actionType,data);
415
+ },
416
+ clickLogo(){
417
+ this.$emit('click-logo')
418
+ },
419
+ otherOperate(type,data){
420
+ this.$emit('other-operate', type, data)
214
421
  }
215
422
  },
216
423
  mounted(){
217
424
  this.initTags();
425
+ const savedWidth = localStorage.getItem('siderWidth')
426
+ if (savedWidth) {
427
+ this.siderWidth = parseInt(savedWidth)
428
+ }
429
+ this.initEmit();
218
430
  },
219
431
  created(){
220
432
  this.initListener();
@@ -227,36 +439,70 @@ export default {
227
439
 
228
440
  <style lang="less">
229
441
  @import "@lambo-design/core/src/styles/default";
230
- .pro-layout{
231
- color: #ffffff;
442
+ @import "styles/color";
443
+ .resize-mask {
444
+ position: fixed;
445
+ left: 0;
446
+ top: 0;
447
+ width: 100vw;
448
+ height: 100vh;
449
+ z-index: 999999; /* 比所有菜单、浮层都高 */
450
+ background: transparent;
451
+ cursor: col-resize;
452
+ }
453
+ .sider-resize-bar {
454
+ position: absolute;
455
+ right: -3px;
456
+ top: 0;
457
+ width: 6px;
458
+ height: 100%;
459
+ cursor: col-resize;
460
+ z-index: 99999;
461
+ background: transparent;
462
+ }
463
+
464
+ .sider-resize-bar:hover {
465
+ background: #ddd;
466
+ }
467
+
468
+ .sider-resize-bar:hover {
469
+ background: #ddd;
470
+ }
471
+ .pro-layout {
232
472
  height: 100vh;
233
473
  width: 100%;
234
474
  overflow: hidden;
475
+ min-width: 1100px;
235
476
  .ivu-layout-header{
236
477
  padding: 0;
237
478
  }
238
- .pro-layout-sider{
479
+ .pro-layout-sider {
239
480
  overflow: hidden;
240
- .ivu-layout-sider-children{
481
+ position: relative;
482
+ .ivu-layout-sider-children {
241
483
  height: calc(100vh - 65px);
242
484
  overflow-y: scroll;
243
485
  margin-right: -18px;
486
+ padding-right: 17px;
487
+ }
488
+ .ivu-layout-sider-children::-webkit-scrollbar {
489
+ /* 隐藏默认的滚动条 */
490
+ display: none;
244
491
  }
245
492
  }
246
- .pro-layout-content{
247
- .pro-layout-content-layout{
248
- height: ~"calc(100vh - 53px)";
493
+ .pro-layout-content {
494
+ .pro-layout-content-layout {
495
+ height: calc(100vh - 65px);
249
496
  .pro-layout-page{
250
497
  overflow: hidden;
251
- color: var(--text-color,@_text-color);
252
498
  }
253
499
  }
254
500
  }
255
501
  &.small {
256
- .ivu-layout-header{
502
+ .ivu-layout-header {
257
503
  height: 50px;
258
504
  line-height: 50px;
259
- .pro-layout-header-wrapper{
505
+ .pro-layout-header-wrapper {
260
506
  height: 50px;
261
507
  .trigger-box{
262
508
  .sider-trigger-a{
@@ -265,31 +511,44 @@ export default {
265
511
  height: 50px;
266
512
  }
267
513
  }
268
- .logo-box{
269
- .pro-layout-logo-wrapper{
270
- .logo{
271
- height: 45px;
272
- margin-top: 14px;
514
+ .logo-box {
515
+ .pro-layout-logo-wrapper {
516
+ .logo {
517
+ height: 40px;
518
+ //margin-top: 14px;
273
519
  }
274
- .divider{
520
+ .divider {
275
521
  height: 26px;
276
522
  margin: 12px;
277
523
  }
278
524
  }
279
525
  }
280
- .nav-box{
281
- .pro-layout-nav-wrapper{
282
- .ivu-menu-horizontal{
526
+ .nav-box {
527
+ .pro-layout-nav-wrapper {
528
+ .ivu-menu-horizontal {
283
529
  height: 46px;
284
- line-height: 46px;
530
+ line-height: var(--layout-menu-item-horizontal-line-height,@_layout-menu-item-horizontal-line-height);
285
531
  }
286
532
  }
287
533
  }
288
534
  }
289
535
  }
290
- .pro-layout-sider{
291
- .ivu-layout-sider-children{
536
+ .pro-layout-sider {
537
+ .ivu-layout-sider-children {
538
+ height: calc(100vh - 50px);
539
+ padding-right: 17px;
540
+ }
541
+ .ivu-layout-sider-children::-webkit-scrollbar {
542
+ /* 隐藏默认的滚动条 */
543
+ display: none;
544
+ }
545
+ }
546
+ .pro-layout-content {
547
+ .pro-layout-content-layout {
292
548
  height: calc(100vh - 50px);
549
+ .pro-layout-page{
550
+ overflow: hidden;
551
+ }
293
552
  }
294
553
  }
295
554
  }