@lambo-design/pro-layout 1.0.0-beta.44 → 1.0.0-beta.441

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 +398 -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 +564 -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 +82 -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 +109 -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} +115 -22
  26. package/src/index.vue +302 -38
  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,
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,12 +291,31 @@ 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
321
  let tagList = getTagNavListFromLocalstorage(config.routerBase + '-tagNavList');
@@ -165,6 +336,25 @@ export default {
165
336
  if (!appInfo) {
166
337
  appInfo = this.navList.filter(item => item.appId == appId)[0];
167
338
  }
339
+ let appConfig={}
340
+ //sc中台
341
+ if(appInfo && appInfo.extendProps){
342
+ appConfig=appInfo.extendProps
343
+ }
344
+ //x1中台
345
+ if(appInfo && appInfo.setting){
346
+ appConfig=JSON.parse(appInfo.setting)
347
+ }
348
+
349
+ // 优先使用 appConfig,其次使用传入的 showLeftMenu prop,最后使用默认值
350
+ if (appConfig && appConfig.is_hide_left_menu){
351
+ this.isHideLeftMenu=appConfig.is_hide_left_menu!='1'
352
+ } else if (this.showLeftMenu !== null) {
353
+ this.isHideLeftMenu = this.showLeftMenu;
354
+ } else{
355
+ this.isHideLeftMenu=true
356
+ }
357
+
168
358
  this.appId = appId;
169
359
  this.$emit('change-app',{appId,appInfo})
170
360
  },
@@ -173,15 +363,18 @@ export default {
173
363
  },
174
364
  menuClick(name, item){
175
365
  if (!item) {
176
- let res = this.menuList.filter(item => item.name == name);
366
+ let res = this.menuList.filter(item => item.name == name );
177
367
  if (res && res.length > 0) {
178
368
  item = res[0];
179
369
  }
180
370
  }
181
- sessionStorage.setItem('activeName',name);
371
+ if (!isOpenBlank(item)) {
372
+ sessionStorage.setItem('activeName',name);
373
+ }
182
374
  this.$emit('menu-click', name, item)
183
375
  },
184
376
  changeTabs(data,current){
377
+ // data = data.filter(item => item.name === current);
185
378
  this.$emit('change-tabs',data,current)
186
379
  },
187
380
  openMenuInTabs(menu){
@@ -202,19 +395,43 @@ export default {
202
395
  tagList.push(menuItem);
203
396
  } else {
204
397
  let tag = tagList.filter(item => item.name == name)[0];
205
- if (!routeEqual(tag,menuItem)) {
398
+ if (!routeEqual(tag,menuItem) && 'home' != name) {
206
399
  let res = tagList.filter(item => item.name !== name);
207
400
  tag = Object.assign(tag, menu);
208
401
  res.push(tag);
209
402
  tagList = deepCopy(res);
210
403
  }
211
404
  }
405
+
212
406
  Bus.$emit('tag-list', tagList, name)
213
407
  }
408
+ },
409
+ getHistoryMenuList(){
410
+ this.$emit('get-history-menu-list');
411
+ },
412
+ deleteHistoryMenu(data){
413
+ this.$emit('delete-history-menu',data);
414
+ },
415
+ deleteCollectMenu(data){
416
+ this.$emit('delete-collect-menu',data);
417
+ },
418
+ toggleCollectMenu(actionType,data){
419
+ this.$emit('toggle-collect-menu',actionType,data);
420
+ },
421
+ clickLogo(){
422
+ this.$emit('click-logo')
423
+ },
424
+ otherOperate(type,data){
425
+ this.$emit('other-operate', type, data)
214
426
  }
215
427
  },
216
428
  mounted(){
217
429
  this.initTags();
430
+ const savedWidth = localStorage.getItem('siderWidth')
431
+ if (savedWidth) {
432
+ this.siderWidth = parseInt(savedWidth)
433
+ }
434
+ this.initEmit();
218
435
  },
219
436
  created(){
220
437
  this.initListener();
@@ -227,36 +444,70 @@ export default {
227
444
 
228
445
  <style lang="less">
229
446
  @import "@lambo-design/core/src/styles/default";
230
- .pro-layout{
231
- color: #ffffff;
447
+ @import "styles/color";
448
+ .resize-mask {
449
+ position: fixed;
450
+ left: 0;
451
+ top: 0;
452
+ width: 100vw;
453
+ height: 100vh;
454
+ z-index: 999999; /* 比所有菜单、浮层都高 */
455
+ background: transparent;
456
+ cursor: col-resize;
457
+ }
458
+ .sider-resize-bar {
459
+ position: absolute;
460
+ right: -3px;
461
+ top: 0;
462
+ width: 6px;
463
+ height: 100%;
464
+ cursor: col-resize;
465
+ z-index: 99999;
466
+ background: transparent;
467
+ }
468
+
469
+ .sider-resize-bar:hover {
470
+ background: #ddd;
471
+ }
472
+
473
+ .sider-resize-bar:hover {
474
+ background: #ddd;
475
+ }
476
+ .pro-layout {
232
477
  height: 100vh;
233
478
  width: 100%;
234
479
  overflow: hidden;
480
+ min-width: 1100px;
235
481
  .ivu-layout-header{
236
482
  padding: 0;
237
483
  }
238
- .pro-layout-sider{
484
+ .pro-layout-sider {
239
485
  overflow: hidden;
240
- .ivu-layout-sider-children{
486
+ position: relative;
487
+ .ivu-layout-sider-children {
241
488
  height: calc(100vh - 65px);
242
489
  overflow-y: scroll;
243
490
  margin-right: -18px;
491
+ padding-right: 17px;
492
+ }
493
+ .ivu-layout-sider-children::-webkit-scrollbar {
494
+ /* 隐藏默认的滚动条 */
495
+ display: none;
244
496
  }
245
497
  }
246
- .pro-layout-content{
247
- .pro-layout-content-layout{
248
- height: ~"calc(100vh - 53px)";
498
+ .pro-layout-content {
499
+ .pro-layout-content-layout {
500
+ height: calc(100vh - 65px);
249
501
  .pro-layout-page{
250
502
  overflow: hidden;
251
- color: var(--text-color,@_text-color);
252
503
  }
253
504
  }
254
505
  }
255
506
  &.small {
256
- .ivu-layout-header{
507
+ .ivu-layout-header {
257
508
  height: 50px;
258
509
  line-height: 50px;
259
- .pro-layout-header-wrapper{
510
+ .pro-layout-header-wrapper {
260
511
  height: 50px;
261
512
  .trigger-box{
262
513
  .sider-trigger-a{
@@ -265,31 +516,44 @@ export default {
265
516
  height: 50px;
266
517
  }
267
518
  }
268
- .logo-box{
269
- .pro-layout-logo-wrapper{
270
- .logo{
271
- height: 45px;
272
- margin-top: 14px;
519
+ .logo-box {
520
+ .pro-layout-logo-wrapper {
521
+ .logo {
522
+ height: 40px;
523
+ //margin-top: 14px;
273
524
  }
274
- .divider{
525
+ .divider {
275
526
  height: 26px;
276
527
  margin: 12px;
277
528
  }
278
529
  }
279
530
  }
280
- .nav-box{
281
- .pro-layout-nav-wrapper{
282
- .ivu-menu-horizontal{
531
+ .nav-box {
532
+ .pro-layout-nav-wrapper {
533
+ .ivu-menu-horizontal {
283
534
  height: 46px;
284
- line-height: 46px;
535
+ line-height: var(--layout-menu-item-horizontal-line-height,@_layout-menu-item-horizontal-line-height);
285
536
  }
286
537
  }
287
538
  }
288
539
  }
289
540
  }
290
- .pro-layout-sider{
291
- .ivu-layout-sider-children{
541
+ .pro-layout-sider {
542
+ .ivu-layout-sider-children {
543
+ height: calc(100vh - 50px);
544
+ padding-right: 17px;
545
+ }
546
+ .ivu-layout-sider-children::-webkit-scrollbar {
547
+ /* 隐藏默认的滚动条 */
548
+ display: none;
549
+ }
550
+ }
551
+ .pro-layout-content {
552
+ .pro-layout-content-layout {
292
553
  height: calc(100vh - 50px);
554
+ .pro-layout-page{
555
+ overflow: hidden;
556
+ }
293
557
  }
294
558
  }
295
559
  }