@lambo-design/pro-layout 1.0.0-beta.47 → 1.0.0-beta.470

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 (41) hide show
  1. package/package.json +11 -4
  2. package/src/components/pro-layout-header/index.vue +224 -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 +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 +104 -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-quick-todoCenter.vue +177 -0
  17. package/src/components/pro-layout-header/pro-layout-tools/components/pro-layout-tools-user.vue +86 -0
  18. package/src/components/pro-layout-header/pro-layout-tools/index.vue +32 -0
  19. package/src/components/pro-layout-header/pro-layout-trigger/index.vue +84 -0
  20. package/src/components/{pro-layout-sider-collapsed-menu.vue → pro-layout-sider/components/pro-layout-sider-collapsed-menu.vue} +30 -11
  21. package/src/components/{pro-layout-sider-icon.vue → pro-layout-sider/components/pro-layout-sider-icon.vue} +2 -2
  22. package/src/components/pro-layout-sider/components/pro-layout-sider-menu-item.vue +137 -0
  23. package/src/components/pro-layout-sider/components/pro-layout-sider-other-menu.vue +140 -0
  24. package/src/components/pro-layout-sider/components/pro-layout-sider-search.vue +345 -0
  25. package/src/components/pro-layout-sider/index.vue +484 -0
  26. package/src/components/{pro-layout-tabs.vue → pro-layout-tabs/index.vue} +118 -23
  27. package/src/index.vue +309 -42
  28. package/src/styles/color.less +267 -0
  29. package/src/styles/images/xiaoxitongzhi.png +0 -0
  30. package/src/styles/other-menu.less +63 -111
  31. package/src/utils/menuItem.js +10 -0
  32. package/src/utils/sider.js +16 -1
  33. package/src/components/pro-layout-header.vue +0 -52
  34. package/src/components/pro-layout-logo.vue +0 -79
  35. package/src/components/pro-layout-nav.vue +0 -150
  36. package/src/components/pro-layout-other-menu.vue +0 -137
  37. package/src/components/pro-layout-sider-menu-item.vue +0 -37
  38. package/src/components/pro-layout-sider.vue +0 -240
  39. package/src/components/pro-layout-tools-user.vue +0 -84
  40. package/src/components/pro-layout-tools.vue +0 -21
  41. 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 :is-home="isHome" :is-show-left-menu="isShowLeftMenu" 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="isShowLeftMenu"
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="isShowLeftMenu"
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="isShowLeftMenu">
45
+ <LamboProLayoutTabs ref="tabs" :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
+ isHome: {
84
+ type: Boolean,
85
+ default: true
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
+ isShowLeftMenu: 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
+ collapsed(val) {
200
+ if (val) {
201
+ this.siderWidth = 64
202
+ } else {
203
+ const savedWidth = localStorage.getItem('siderWidth')
204
+ this.siderWidth = savedWidth ? parseInt(savedWidth) : 220
205
+ }
206
+ },
207
+ isHome: {
208
+ handler() {
209
+ if (this.isHome) {
210
+ this.isShowLeftMenu = false
211
+ }
212
+ },
213
+ immediate: true
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最后使用默认值
351
+ if (appConfig && appConfig.hasOwnProperty("is_hide_left_menu")){
352
+ this.isShowLeftMenu = appConfig.is_hide_left_menu != '1'
353
+ } else if (appId == 'backHome'){
354
+ this.isShowLeftMenu = false
355
+ } else {
356
+ this.isShowLeftMenu = true
357
+ }
358
+
168
359
  this.appId = appId;
169
360
  this.$emit('change-app',{appId,appInfo})
170
361
  },
@@ -173,18 +364,21 @@ 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
- openMenuInTabs(menu){
381
+ openMenuInTabs(menu,forceUpdate = false){
188
382
  let name = '';
189
383
  let menuItem = {};
190
384
  if (typeof menu === 'string') {
@@ -194,27 +388,53 @@ export default {
194
388
  menuItem = res[0];
195
389
  }
196
390
  this.$refs.sider.handleSelect(name);
197
- } else {
391
+ } else if (menu && menu.name){
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 (forceUpdate || (!routeEqual(tag,menuItem) && 'home' != name)) {
206
401
  let res = tagList.filter(item => item.name !== name);
207
402
  tag = Object.assign(tag, menu);
403
+ tag.cts = new Date().getTime();
208
404
  res.push(tag);
209
405
  tagList = deepCopy(res);
210
406
  }
211
407
  }
408
+
212
409
  Bus.$emit('tag-list', tagList, name)
213
410
  }
411
+ },
412
+ getHistoryMenuList(){
413
+ this.$emit('get-history-menu-list');
414
+ },
415
+ deleteHistoryMenu(data){
416
+ this.$emit('delete-history-menu',data);
417
+ },
418
+ deleteCollectMenu(data){
419
+ this.$emit('delete-collect-menu',data);
420
+ },
421
+ toggleCollectMenu(actionType,data){
422
+ this.$emit('toggle-collect-menu',actionType,data);
423
+ },
424
+ clickLogo(){
425
+ this.$emit('click-logo')
426
+ },
427
+ otherOperate(type,data){
428
+ this.$emit('other-operate', type, data)
214
429
  }
215
430
  },
216
431
  mounted(){
217
432
  this.initTags();
433
+ const savedWidth = localStorage.getItem('siderWidth')
434
+ if (savedWidth) {
435
+ this.siderWidth = parseInt(savedWidth)
436
+ }
437
+ this.initEmit();
218
438
  },
219
439
  created(){
220
440
  this.initListener();
@@ -227,36 +447,70 @@ export default {
227
447
 
228
448
  <style lang="less">
229
449
  @import "@lambo-design/core/src/styles/default";
230
- .pro-layout{
231
- color: #ffffff;
450
+ @import "styles/color";
451
+ .resize-mask {
452
+ position: fixed;
453
+ left: 0;
454
+ top: 0;
455
+ width: 100vw;
456
+ height: 100vh;
457
+ z-index: 999999; /* 比所有菜单、浮层都高 */
458
+ background: transparent;
459
+ cursor: col-resize;
460
+ }
461
+ .sider-resize-bar {
462
+ position: absolute;
463
+ right: -3px;
464
+ top: 0;
465
+ width: 6px;
466
+ height: 100%;
467
+ cursor: col-resize;
468
+ z-index: 99999;
469
+ background: transparent;
470
+ }
471
+
472
+ .sider-resize-bar:hover {
473
+ background: #ddd;
474
+ }
475
+
476
+ .sider-resize-bar:hover {
477
+ background: #ddd;
478
+ }
479
+ .pro-layout {
232
480
  height: 100vh;
233
481
  width: 100%;
234
482
  overflow: hidden;
483
+ min-width: 1100px;
235
484
  .ivu-layout-header{
236
485
  padding: 0;
237
486
  }
238
- .pro-layout-sider{
487
+ .pro-layout-sider {
239
488
  overflow: hidden;
240
- .ivu-layout-sider-children{
489
+ position: relative;
490
+ .ivu-layout-sider-children {
241
491
  height: calc(100vh - 65px);
242
492
  overflow-y: scroll;
243
493
  margin-right: -18px;
494
+ padding-right: 17px;
495
+ }
496
+ .ivu-layout-sider-children::-webkit-scrollbar {
497
+ /* 隐藏默认的滚动条 */
498
+ display: none;
244
499
  }
245
500
  }
246
- .pro-layout-content{
247
- .pro-layout-content-layout{
248
- height: ~"calc(100vh - 53px)";
501
+ .pro-layout-content {
502
+ .pro-layout-content-layout {
503
+ height: calc(100vh - 65px);
249
504
  .pro-layout-page{
250
505
  overflow: hidden;
251
- color: var(--text-color,@_text-color);
252
506
  }
253
507
  }
254
508
  }
255
509
  &.small {
256
- .ivu-layout-header{
510
+ .ivu-layout-header {
257
511
  height: 50px;
258
512
  line-height: 50px;
259
- .pro-layout-header-wrapper{
513
+ .pro-layout-header-wrapper {
260
514
  height: 50px;
261
515
  .trigger-box{
262
516
  .sider-trigger-a{
@@ -265,31 +519,44 @@ export default {
265
519
  height: 50px;
266
520
  }
267
521
  }
268
- .logo-box{
269
- .pro-layout-logo-wrapper{
270
- .logo{
271
- height: 45px;
272
- margin-top: 14px;
522
+ .logo-box {
523
+ .pro-layout-logo-wrapper {
524
+ .logo {
525
+ height: 40px;
526
+ //margin-top: 14px;
273
527
  }
274
- .divider{
528
+ .divider {
275
529
  height: 26px;
276
530
  margin: 12px;
277
531
  }
278
532
  }
279
533
  }
280
- .nav-box{
281
- .pro-layout-nav-wrapper{
282
- .ivu-menu-horizontal{
534
+ .nav-box {
535
+ .pro-layout-nav-wrapper {
536
+ .ivu-menu-horizontal {
283
537
  height: 46px;
284
- line-height: 46px;
538
+ line-height: var(--layout-menu-item-horizontal-line-height,@_layout-menu-item-horizontal-line-height);
285
539
  }
286
540
  }
287
541
  }
288
542
  }
289
543
  }
290
- .pro-layout-sider{
291
- .ivu-layout-sider-children{
544
+ .pro-layout-sider {
545
+ .ivu-layout-sider-children {
292
546
  height: calc(100vh - 50px);
547
+ padding-right: 17px;
548
+ }
549
+ .ivu-layout-sider-children::-webkit-scrollbar {
550
+ /* 隐藏默认的滚动条 */
551
+ display: none;
552
+ }
553
+ }
554
+ .pro-layout-content {
555
+ .pro-layout-content-layout {
556
+ height: calc(100vh - 50px);
557
+ .pro-layout-page{
558
+ overflow: hidden;
559
+ }
293
560
  }
294
561
  }
295
562
  }