@lambo-design/pro-layout 1.0.0-beta.45 → 1.0.0-beta.451

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