@lambo-design/pro-layout 1.0.0-beta.434 → 1.0.0-beta.436

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.434",
3
+ "version": "1.0.0-beta.436",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -281,7 +281,21 @@ export default {
281
281
  const currentApp = appList.find(app => app.appId === this.activeName);
282
282
  // 如果找到应用且隐藏了左侧菜单,该应用应该保持激活状态
283
283
  if (currentApp) {
284
- const isHideLeftMenu = currentApp.extendProps?.is_hide_left_menu || currentApp.setting?.is_hide_left_menu;
284
+ let isHideLeftMenu;
285
+ if (currentApp.extendProps) {
286
+ if (typeof currentApp.extendProps === 'string') {
287
+ isHideLeftMenu = JSON.parse(currentApp.extendProps)?.is_hide_left_menu;
288
+ } else {
289
+ isHideLeftMenu = currentApp.extendProps.is_hide_left_menu;
290
+ }
291
+ }
292
+ if (!isHideLeftMenu && currentApp.setting) {
293
+ if (typeof currentApp.setting === 'string') {
294
+ isHideLeftMenu = JSON.parse(currentApp.setting)?.is_hide_left_menu;
295
+ } else {
296
+ isHideLeftMenu = currentApp.setting.is_hide_left_menu;
297
+ }
298
+ }
285
299
  if ((isHideLeftMenu === '1' || isHideLeftMenu === 1) && this.activeName === item.appId) {
286
300
  return true;
287
301
  }
@@ -449,7 +449,21 @@ export default {
449
449
  const currentApp = appList.find(app => app.appId === this.activeName);
450
450
  // 如果找到应用且隐藏了左侧菜单,返回 activeName
451
451
  if (currentApp) {
452
- const isHideLeftMenu = currentApp.extendProps?.is_hide_left_menu || currentApp.setting?.is_hide_left_menu;
452
+ let isHideLeftMenu;
453
+ if (currentApp.extendProps) {
454
+ if (typeof currentApp.extendProps === 'string') {
455
+ isHideLeftMenu = JSON.parse(currentApp.extendProps)?.is_hide_left_menu;
456
+ } else {
457
+ isHideLeftMenu = currentApp.extendProps.is_hide_left_menu;
458
+ }
459
+ }
460
+ if (!isHideLeftMenu && currentApp.setting) {
461
+ if (typeof currentApp.setting === 'string') {
462
+ isHideLeftMenu = JSON.parse(currentApp.setting)?.is_hide_left_menu;
463
+ } else {
464
+ isHideLeftMenu = currentApp.setting.is_hide_left_menu;
465
+ }
466
+ }
453
467
  if (isHideLeftMenu === '1' || isHideLeftMenu === 1) {
454
468
  return this.activeName;
455
469
  }
@@ -46,7 +46,7 @@ import {
46
46
  getPreviousTagIndex,
47
47
  getDelTagIndex,
48
48
  setTagNavListInLocalstorage,
49
- showTitle
49
+ showTitle, getRootPermission
50
50
  } from '@lambo-design/shared/utils/platform'
51
51
  import beforeClose from '@lambo-design/shared/utils/menu/before-close'
52
52
  import Bus from "@lambo-design/shared/utils/bus";
@@ -81,6 +81,12 @@ export default {
81
81
  tabsHeight: 46
82
82
  }
83
83
  },
84
+ props: {
85
+ notSingleApp: {
86
+ type: Boolean,
87
+ default: true
88
+ }
89
+ },
84
90
  methods: {
85
91
  initListener(){
86
92
  Bus.$on('system-info',(data)=>{
@@ -233,14 +239,29 @@ export default {
233
239
  this.emitTags(res, value);
234
240
  },
235
241
  handleClick(item) {
236
- if (item.meta && item.meta.appId
237
- && item.meta.appId != this.appId
238
- && item.meta.appId != config.homeRouter.meta.appId) {
239
- let appInfo = this.navList.filter(app => app.appId === item.meta.appId);
240
- if (appInfo && appInfo.length > 0) {
241
- Bus.$emit('change-app', {appId:appInfo[0].appId,appInfo:appInfo[0]})
242
- } else {
243
- Bus.$emit('change-app', {appId:item.meta.appId,appInfo:null})
242
+ if (item.meta && item.meta.appId && item.meta.appId != config.homeRouter.meta.appId) {
243
+ let appIdInner = item.meta.appId;
244
+ if (!this.notSingleApp) {
245
+ // 如果是单应用模式,根据permissionId找到最上层目录(即导航栏中的应用)的permissionId
246
+ const permissionList = this.$store.getters.getOriginalPermissionList;
247
+ if (permissionList && permissionList.length > 0) {
248
+ const permission = {
249
+ pid: item.pid,
250
+ appId: item.meta ? item.meta.appId : item.appId
251
+ }
252
+ const rootPermission = getRootPermission(permissionList, permission);
253
+ if (rootPermission && rootPermission.permissionId) {
254
+ appIdInner = rootPermission.permissionId
255
+ }
256
+ }
257
+ }
258
+ if (appIdInner != this.appId) {
259
+ let appInfo = this.navList.filter(app => app.appId === appIdInner);
260
+ if (appInfo && appInfo.length > 0) {
261
+ Bus.$emit('change-app', {appId: appInfo[0].appId, appInfo: appInfo[0]})
262
+ } else {
263
+ Bus.$emit('change-app', {appId: appIdInner, appInfo: null})
264
+ }
244
265
  }
245
266
  }
246
267
  this.value = item.name
package/src/index.vue CHANGED
@@ -42,7 +42,7 @@
42
42
  <i-content class="pro-layout-content">
43
43
  <i-layout class="pro-layout-content-layout">
44
44
  <div class="pro-layout-tabs" v-show="isHideLeftMenu">
45
- <LamboProLayoutTabs></LamboProLayoutTabs>
45
+ <LamboProLayoutTabs :not-single-app="notSingleApp"></LamboProLayoutTabs>
46
46
  </div>
47
47
  <i-content class="pro-layout-page">
48
48
  <slot>
@@ -76,6 +76,10 @@ import Locale from '@lambo-design/core/src/mixins/locale';
76
76
  export default {
77
77
  mixins: [Locale],
78
78
  props:{
79
+ notSingleApp: {
80
+ type: Boolean,
81
+ default: true
82
+ },
79
83
  showLeftMenu: {
80
84
  type: Boolean,
81
85
  default: null