imatrix-ui 2.8.5-tmp2 → 2.8.5-tmp3

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": "imatrix-ui",
3
- "version": "2.8.5-tmp2",
3
+ "version": "2.8.5-tmp3",
4
4
  "description": "前端组件库:表格、表单、组织结构树等",
5
5
  "main": "lib/super-ui.umd.min.js",
6
6
  "private": false,
@@ -69,6 +69,16 @@ export const publicRouterMap = [
69
69
  path: '/show-sub-wf-history',
70
70
  component: () => import('../views/wf-history/tache-subprocess-history'),
71
71
  hidden: true
72
+ },
73
+ {
74
+ path: '/tab-content-index',
75
+ component: () => import('../views/layout/tab-content-index'),
76
+ hidden: true
77
+ },
78
+ {
79
+ path: '/tab-content-iframe-index',
80
+ component: () => import('../views/layout/tab-content-iframe-index'),
81
+ hidden: true
72
82
  }
73
83
 
74
84
  ]
@@ -22,6 +22,12 @@ const tabContent = {
22
22
  // 设置当前激活的tab
23
23
  set_active_index(state, index) {
24
24
  state.activeIndex = index
25
+ },
26
+ // 清空tabs
27
+ clear_tabs(state, route) {
28
+ if (state.openTab.length > 0) {
29
+ state.openTab.splice(0, state.openTab.length)
30
+ }
25
31
  }
26
32
  },
27
33
  actions: {
@@ -0,0 +1,8 @@
1
+ @import "./dark-blue-var.scss";
2
+
3
+ .dark-blue {
4
+ .operation-area .el-button--primary {
5
+ border-radius: 4px;
6
+ background: $--button-opt-background-color;
7
+ }
8
+ }
@@ -0,0 +1,10 @@
1
+ @import "./dark-blue-var.scss";
2
+
3
+ .dark-blue {
4
+
5
+ .el-checkbox__input.is-checked .el-checkbox__inner,
6
+ .el-checkbox__input.is-indeterminate .el-checkbox__inner {
7
+ background-color: $--color-primary;
8
+ border-color: $--color-primary;
9
+ }
10
+ }
@@ -0,0 +1,8 @@
1
+ /* 改变主题色变量 */
2
+ $--color-primary: #005EBA;
3
+ $--button-default-border-color: $--color-primary;
4
+ $--button-default-font-color: $--color-primary;
5
+ $--button-font-weight: regular;
6
+ $--button-default-font-color: $--color-primary;
7
+ $--button-opt-background-color:#0780ED;
8
+ $th-cell-background: #F0F8FE;
@@ -1,10 +1,7 @@
1
- /* 改变主题色变量 */
2
- $--color-primary: #0780ED;
3
- $--button-default-border-color: #005EBA;
4
- $--button-default-font-color: #005EBA;
5
- $--button-font-weight: regular;
1
+ @import "./dark-blue-var.scss";
6
2
 
7
- /* 改变 icon 字体路径变量,必需 */
8
- $--font-path: '~element-ui/lib/theme-chalk/fonts';
9
-
10
- @import "~element-ui/packages/theme-chalk/src/index";
3
+ .dark-blue {
4
+ /* 改变 icon 字体路径变量,必需 */
5
+ $--font-path: '~element-ui/lib/theme-chalk/fonts';
6
+ @import "~element-ui/packages/theme-chalk/src/index";
7
+ }
@@ -1,10 +1,14 @@
1
- @import './sidebar.scss';
2
- @import './font-style.scss';
3
- @import './card-style.scss';
4
- @import './tab-style.scss';
5
- @import './input-style.scss';
6
- @import './form-style.scss';
7
1
  @import './element-variables.scss';
2
+ @import './table.scss';
3
+ @import './sidebar.scss';
4
+ @import './font.scss';
5
+ @import './card.scss';
6
+ @import './tab.scss';
7
+ @import './input.scss';
8
+ @import './form.scss';
9
+ @import './pagination.scss';
10
+ @import './button.scss';
11
+ @import './checkbox.scss';
8
12
 
9
13
  .dark-blue {
10
14
  font-family: cursive;
@@ -92,6 +96,7 @@
92
96
 
93
97
  .operation-area {
94
98
  margin-bottom: 20px;
99
+
95
100
  }
96
101
 
97
102
  .operation-area-chart {
@@ -145,7 +150,11 @@
145
150
  }
146
151
 
147
152
  .el-tree-node.is-current>.el-tree-node__content {
148
- background-color: #c2d6ea !important;
153
+ background: $th-cell-background;
154
+ }
155
+
156
+ .el-tree-node__content:hover {
157
+ background-color: $th-cell-background;
149
158
  }
150
159
 
151
160
  .menu-tab-container .el-tabs__item {
@@ -173,7 +182,7 @@
173
182
 
174
183
  .el-table td,
175
184
  .el-table th {
176
- height: 48px;
185
+ height: 40px;
177
186
  }
178
187
 
179
188
  .el-table th {
@@ -0,0 +1,13 @@
1
+ @import "./dark-blue-var.scss";
2
+
3
+ .dark-blue {
4
+ .el-pager li:not(.disabled) {
5
+ &:hover {
6
+ //color: $--pagination-hover-color;
7
+ }
8
+
9
+ &.active {
10
+ background-color: $--button-default-font-color;
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,56 @@
1
+ @import "./dark-blue-var.scss";
2
+
3
+ .dark-blue {
4
+
5
+ $table-cell-font-color: #313233;
6
+
7
+ // 表头背景颜色
8
+ .el-table__header-wrapper {
9
+ background: $th-cell-background;
10
+ }
11
+
12
+ .el-table th.el-table__cell {
13
+ background: $th-cell-background;
14
+ }
15
+
16
+ .el-table thead.is-group th.el-table__cell {
17
+ background: $th-cell-background;
18
+ }
19
+
20
+ .el-table .el-table__cell {
21
+ padding: 0;
22
+ }
23
+
24
+ // 表头字体样式
25
+ .el-table th.el-table__cell>.cell {
26
+ color: $table-cell-font-color;
27
+ font-family: Source Han Sans CN;
28
+ font-weight: medium;
29
+ font-size: 14px;
30
+ line-height: 22px;
31
+ letter-spacing: 0px;
32
+ text-align: left;
33
+ }
34
+
35
+ // 表格内容颜色
36
+ .el-table .cell {
37
+ color: $table-cell-font-color;
38
+ font-family: Source Han Sans CN;
39
+ font-weight: regular;
40
+ font-size: 14px;
41
+ line-height: 22px;
42
+ letter-spacing: 0px;
43
+ text-align: left;
44
+
45
+ }
46
+
47
+ .el-button--text {
48
+ color: $--color-primary;
49
+ font-family: Source Han Sans CN;
50
+ font-weight: regular;
51
+ font-size: 14px;
52
+ line-height: 22px;
53
+ letter-spacing: 0px;
54
+ text-align: center;
55
+ }
56
+ }
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <div :class="classObj" class="app-wrapper">
3
+ <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
4
+ <menubar class="sidebar-container" />
5
+ <div class="main-container">
6
+ <breadcrumb v-if="showMenuRoute" />
7
+ <app-main />
8
+ </div>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ import { Menubar, AppMain, Breadcrumb } from './components'
14
+ import ResizeMixin from './mixin/ResizeHandler'
15
+ import { isShowMenuRoute } from '../../../src/utils/common-util'
16
+
17
+ export default {
18
+ name: 'Layout',
19
+ components: {
20
+ Menubar,
21
+ AppMain,
22
+ Breadcrumb
23
+ },
24
+ mixins: [ResizeMixin],
25
+ data() {
26
+ // 是否显示菜单路径,默认是不显示
27
+ const showMenuRoute = isShowMenuRoute()
28
+ return {
29
+ showMenuRoute
30
+ }
31
+ },
32
+ computed: {
33
+ sidebar() {
34
+ return this.$store.state.app.sidebar
35
+ },
36
+ device() {
37
+ return this.$store.state.app.device
38
+ },
39
+ classObj() {
40
+ return {
41
+ hideSidebar: !this.sidebar.opened,
42
+ openSidebar: this.sidebar.opened,
43
+ withoutAnimation: this.sidebar.withoutAnimation,
44
+ mobile: this.device === 'mobile'
45
+ }
46
+ }
47
+ },
48
+ methods: {
49
+ handleClickOutside() {
50
+ this.$store.dispatch('closeSidebar', { withoutAnimation: false })
51
+ }
52
+ }
53
+ }
54
+ </script>
55
+
56
+ <style rel="stylesheet/scss" lang="scss" scoped>
57
+ @import "../../styles/mixin.scss";
58
+ .app-wrapper {
59
+ @include clearfix;
60
+ position: relative;
61
+ height: 100%;
62
+ width: 100%;
63
+ &.mobile.openSidebar{
64
+ position: fixed;
65
+ top: 0;
66
+ }
67
+ }
68
+ .drawer-bg {
69
+ background: #000;
70
+ opacity: 0.3;
71
+ width: 100%;
72
+ top: 0;
73
+ height: 100%;
74
+ position: absolute;
75
+ z-index: 999;
76
+ }
77
+ </style>
@@ -1,77 +1,18 @@
1
1
  <template>
2
- <div :class="classObj" class="app-wrapper">
3
- <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
4
- <menubar class="sidebar-container" />
5
- <div class="main-container">
6
- <breadcrumb v-if="showMenuRoute" />
2
+ <div class="app-wrapper">
3
+ <div class="tab-main-container">
4
+ <!-- <tab-content/> -->
7
5
  <app-main />
8
6
  </div>
9
7
  </div>
10
8
  </template>
11
-
12
9
  <script>
13
- import { Menubar, AppMain, Breadcrumb } from './components'
14
- import ResizeMixin from './mixin/ResizeHandler'
15
- import { isShowMenuRoute } from '../../../src/utils/common-util'
16
-
10
+ import { AppMain } from './components'
17
11
  export default {
18
- name: 'Layout',
12
+ name: 'EmptyLayout',
19
13
  components: {
20
- Menubar,
21
- AppMain,
22
- Breadcrumb
23
- },
24
- mixins: [ResizeMixin],
25
- data() {
26
- // 是否显示菜单路径,默认是不显示
27
- const showMenuRoute = isShowMenuRoute()
28
- return {
29
- showMenuRoute
30
- }
31
- },
32
- computed: {
33
- sidebar() {
34
- return this.$store.state.app.sidebar
35
- },
36
- device() {
37
- return this.$store.state.app.device
38
- },
39
- classObj() {
40
- return {
41
- hideSidebar: !this.sidebar.opened,
42
- openSidebar: this.sidebar.opened,
43
- withoutAnimation: this.sidebar.withoutAnimation,
44
- mobile: this.device === 'mobile'
45
- }
46
- }
47
- },
48
- methods: {
49
- handleClickOutside() {
50
- this.$store.dispatch('closeSidebar', { withoutAnimation: false })
51
- }
14
+ AppMain
52
15
  }
53
16
  }
54
17
  </script>
55
18
 
56
- <style rel="stylesheet/scss" lang="scss" scoped>
57
- @import "../../styles/mixin.scss";
58
- .app-wrapper {
59
- @include clearfix;
60
- position: relative;
61
- height: 100%;
62
- width: 100%;
63
- &.mobile.openSidebar{
64
- position: fixed;
65
- top: 0;
66
- }
67
- }
68
- .drawer-bg {
69
- background: #000;
70
- opacity: 0.3;
71
- width: 100%;
72
- top: 0;
73
- height: 100%;
74
- position: absolute;
75
- z-index: 999;
76
- }
77
- </style>
@@ -14,11 +14,15 @@ export default {
14
14
  hasChildren: {
15
15
  type: Boolean,
16
16
  default: false
17
+ },
18
+ isRoot: {
19
+ type: Boolean,
20
+ default: false
17
21
  }
18
22
  },
19
23
  render(h, context) {
24
+ const { title, hasChildren, isRoot } = context.props
20
25
  let icon = context.props.icon
21
- const { title, hasChildren } = context.props
22
26
  const vnodes = []
23
27
  if (icon) {
24
28
  if (icon.indexOf('fa-') === 0) {
@@ -35,14 +39,23 @@ export default {
35
39
  }
36
40
 
37
41
  if (title) {
42
+ debugger
38
43
  let width = '130px'
39
44
  if (hasChildren) {
40
45
  // 当是父菜单时,为了使后面的三角能显示出来,需要将宽度设小点
41
46
  width = '100px'
42
47
  }
43
- vnodes.push(<div slot='title' style='display: inline-block'>
44
- <div title={title} style={'display: inline-block;width:' + width + ';overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;'}>{(title)}</div>
45
- </div>)
48
+ if (isRoot) {
49
+ // 是否是根目录,没有子菜单时
50
+ vnodes.push(<div style='display: inline-block'>
51
+ <div title={title} style={'display: inline-block;width:' + width + ';overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;'}>{(title)}</div>
52
+ </div>)
53
+ } else {
54
+ // 有子菜单时
55
+ vnodes.push(<div slot='title' style='display: inline-block'>
56
+ <div title={title} style={'display: inline-block;width:' + width + ';overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;'}>{(title)}</div>
57
+ </div>)
58
+ }
46
59
  }
47
60
  return vnodes
48
61
  }
@@ -6,9 +6,12 @@
6
6
  <slot />
7
7
  </a> -->
8
8
 
9
- <router-link :to="to">
9
+ <router-link v-if="!isOpenNewTab" :to="to">
10
10
  <slot />
11
11
  </router-link>
12
+ <div v-else>
13
+ <slot />
14
+ </div>
12
15
  </div>
13
16
  </template>
14
17
 
@@ -23,8 +26,14 @@ export default {
23
26
  },
24
27
  data() {
25
28
  const isExter = this.to.isExternal
29
+ const openWay = this.to.openWay
30
+ let isOpenNewTab = false
31
+ if (openWay && openWay === 'NEW_PAGE_OPEN') {
32
+ isOpenNewTab = true
33
+ }
26
34
  return {
27
- isExter
35
+ isExter,
36
+ isOpenNewTab
28
37
  }
29
38
  }
30
39
  }
@@ -1,16 +1,16 @@
1
1
  <template>
2
2
  <div class="menu-wrapper">
3
3
  <template v-if="!item.children || item.children.lenght === 0">
4
- <app-link :to="toPath(item)">
4
+ <app-link :to="toPath(item)" @click.native="clickMenu(toPath(item))">
5
5
  <el-menu-item :index="item.fullPath+'~~'+item.i18nValue" :class="{'submenu-title-noDropdown':!isNest}">
6
- <item :icon="item.iconName" :title="item.i18nValue" />
6
+ <item :icon="item.iconName" :title="getI18nName(item)" :is-root="true" />
7
7
  </el-menu-item>
8
8
  </app-link>
9
9
  </template>
10
10
 
11
11
  <el-submenu v-else :index="item.fullPath+'~~'+item.i18nValue">
12
12
  <template slot="title">
13
- <item :icon="item.iconName" :title="item.i18nValue" :has-children="item.children.length > 0?true:false" />
13
+ <item :icon="item.iconName" :title="getI18nName(item)" :has-children="item.children.length > 0?true:false" />
14
14
  </template>
15
15
 
16
16
  <template v-for="child in item.children">
@@ -21,9 +21,9 @@
21
21
  :item="child"
22
22
  class="nest-menu"
23
23
  />
24
- <app-link v-else :key="child.code" :to="toPath(child)">
24
+ <app-link v-else :key="child.code" :to="toPath(child)" @click.native="clickMenu(toPath(child))">
25
25
  <el-menu-item :index="child.fullPath+'~~'+child.i18nValue">
26
- <item :icon="child.iconName" :title="child.i18nValue" />
26
+ <item :icon="child.iconName" :title="getI18nName(child)" />
27
27
  </el-menu-item>
28
28
  </app-link>
29
29
  </template>
@@ -34,6 +34,9 @@
34
34
  <script>
35
35
  import Item from './Item'
36
36
  import AppLink from './Link'
37
+ import Vue from 'vue'
38
+ import { getI18nName } from 'imatrix-ui/src/utils/menu'
39
+ import tabJs from '../../../../api/tab'
37
40
 
38
41
  export default {
39
42
  name: 'SidebarItem',
@@ -59,6 +62,7 @@ export default {
59
62
  }
60
63
  },
61
64
  methods: {
65
+ ...tabJs,
62
66
  hasOneShowingChild(children, parent) {
63
67
  if (children && children.length > 0) {
64
68
  this.onlyOneChild = children[0]
@@ -80,13 +84,24 @@ export default {
80
84
  toPath(menu) {
81
85
  const toPathObj = {}
82
86
  const routePath = menu.fullPath
87
+ toPathObj.openWay = menu.openWay
83
88
  if (this.isExternalLink(menu.pageType)) {
84
- toPathObj.path = '/iframe-page/page'
89
+ toPathObj.path = '/tab-content-iframe-index'
90
+ toPathObj.tabPath = '/iframe-page/page'
85
91
  toPathObj.query = {}
86
92
  toPathObj.query.src = routePath
87
93
  toPathObj.isExternal = true
94
+ // 如果路径中没有拼系统编码,才需要把系统编码放到参数中
95
+ toPathObj.query.customSystem = Vue.prototype.customSystem
96
+ toPathObj.query._menuCode = menu.code
97
+ toPathObj.query._menuName = getI18nName(menu)
88
98
  } else {
89
- toPathObj.path = routePath
99
+ toPathObj.path = '/tab-content-index'
100
+ toPathObj.tabPath = routePath
101
+ toPathObj.query = {}
102
+ toPathObj.query.customSystem = Vue.prototype.customSystem
103
+ toPathObj.query._menuCode = menu.code
104
+ toPathObj.query._menuName = getI18nName(menu)
90
105
  }
91
106
  return toPathObj
92
107
  },
@@ -95,6 +110,34 @@ export default {
95
110
  return true
96
111
  }
97
112
  return false
113
+ },
114
+ clickMenu(toPathObj) {
115
+ // console.log('clickMenu----toPathObj=', toPathObj)
116
+ if (toPathObj.openWay && toPathObj.openWay === 'NEW_PAGE_OPEN' && toPathObj.query) {
117
+ // 新页签打开菜单
118
+ let url = toPathObj.query.src
119
+ if (url && url.indexOf('?') > 0) {
120
+ url += '&'
121
+ } else {
122
+ url += '?'
123
+ }
124
+ if (toPathObj.query.customSystem) {
125
+ url += 'customSystem=' + toPathObj.query.customSystem
126
+ }
127
+ if (toPathObj.query._menuCode) {
128
+ url += '_menuCode=' + toPathObj.query._menuCode
129
+ }
130
+ if (toPathObj.query._menuCode) {
131
+ url += '_menuName=' + toPathObj.query._menuName
132
+ }
133
+ window.open(url, toPathObj.query._menuCode)
134
+ } else {
135
+ // 刷新页签打开菜单
136
+ this.addTabs(toPathObj.query, this.$store.state.tabContent.openTab, toPathObj.tabPath)
137
+ }
138
+ },
139
+ getI18nName(menu) {
140
+ return getI18nName(menu)
98
141
  }
99
142
  }
100
143
  }
@@ -24,6 +24,8 @@ import SidebarItem from './SidebarItem'
24
24
  import Vue from 'vue'
25
25
  import { getLanguageWithLocale } from '../../../../utils/util'
26
26
  import { isShowSystemMenu } from '../../../../utils/common-util'
27
+ import tabJs from '../../../../api/tab'
28
+ import { getI18nName } from '../../../../utils/menu'
27
29
  import Cookies from 'js-cookie'
28
30
  import { getMenus } from '../../../../utils/permissionAuth'
29
31
  export default {
@@ -31,6 +33,16 @@ export default {
31
33
  components: {
32
34
  SidebarItem
33
35
  },
36
+ props: {
37
+ systemCode: {
38
+ type: String,
39
+ default: null
40
+ },
41
+ collapse: {
42
+ type: Boolean,
43
+ default: false
44
+ }
45
+ },
34
46
  data() {
35
47
  let systemName
36
48
  if (isShowSystemMenu() === true) {
@@ -53,7 +65,10 @@ export default {
53
65
  'sidebar'
54
66
  ]),
55
67
  isCollapse() {
56
- return !this.sidebar.opened
68
+ if (this.collapse === false) {
69
+ return !this.sidebar.opened
70
+ }
71
+ return true
57
72
  }
58
73
  },
59
74
  watch: {
@@ -77,13 +92,22 @@ export default {
77
92
  // 跳转到第一个页面
78
93
  if (this.firstLeafMenu.pageType && this.firstLeafMenu.pageType === 'iframe') {
79
94
  const iframeSrc = this.firstLeafMenu.fullPath
80
- this.$router.push({ path: '/iframe-page/page', query: { src: iframeSrc }})
95
+ // this.$router.push({ path: '/iframe-page/page', query: { src: iframeSrc }})
96
+ const query = { src: iframeSrc, customSystem: this.systemCode, _menuCode: this.firstLeafMenu.code, _menuName: getI18nName(this.firstLeafMenu) }
97
+ this.addTabs(query, this.$store.state.tabContent.openTab, '/iframe-page/page', '/iframe-page/page')
98
+ // this.$router.push({ path: '/iframe-page/page', query: query })
99
+ this.$router.push({ path: '/tab-content-iframe-index', query: query })
81
100
  } else {
82
- this.$router.push({ path: this.firstLeafMenu.fullPath })
101
+ const query = { customSystem: this.systemCode, _menuCode: this.firstLeafMenu.code, _menuName: getI18nName(this.firstLeafMenu) }
102
+ const path = this.firstLeafMenu.fullPath
103
+ this.addTabs(query, this.$store.state.tabContent.openTab, path, path)
104
+ this.$router.push({ path: '/tab-content-index', query: query })
105
+ // this.$router.push({ path: this.firstLeafMenu.fullPath })
83
106
  }
84
107
  }
85
108
  },
86
109
  methods: {
110
+ ...tabJs,
87
111
  toggleSideBar() {
88
112
  this.$store.dispatch('toggleSidebar')
89
113
  },
@@ -102,31 +126,42 @@ export default {
102
126
  break
103
127
  }
104
128
  }
105
- if (!shouldSelectMenu) {
106
- // 如果没有获得默认选中的菜单,则默认选中第一个菜单
107
- shouldSelectMenu = this.getSelectMenuWithFirstMenu(menus[0])
108
- }
129
+ // if (!shouldSelectMenu) {
130
+ // // 如果没有获得默认选中的菜单,则默认选中第一个菜单
131
+ // shouldSelectMenu = this.getSelectMenuWithFirstMenu(menus[0])
132
+ // }
109
133
  return shouldSelectMenu
110
134
  }
111
135
  },
112
136
  getShouldSelectMenu(menu) {
113
- if (menu) {
114
- const cookieMenu = Cookies.get('selectMenu')
115
- let currentRoute = this.$route.path
116
- if (cookieMenu && cookieMenu.indexOf('~~') > 0) {
117
- // cookie中记录了选中的菜单路径
118
- const path = cookieMenu.substring(0, cookieMenu.lastIndexOf('~~'))
119
- currentRoute = path
120
- }
137
+ const currentMenuCode = this.$route.query ? this.$route.query._menuCode : null
138
+ if (menu && currentMenuCode) {
121
139
  let shouldSelectMenu
122
140
  const children = menu.children
123
141
  if (children && children.length > 0) {
124
142
  shouldSelectMenu = this.getFirstMenu(children)
125
- } else if (menu.fullPath && menu.fullPath === currentRoute) {
143
+ } else if (menu.code && menu.code === currentMenuCode) {
126
144
  shouldSelectMenu = menu
127
145
  }
128
146
  return shouldSelectMenu
129
147
  }
148
+ // if (menu) {
149
+ // const cookieMenu = Cookies.get('selectMenu')
150
+ // let currentRoute = this.$route.path
151
+ // if (cookieMenu && cookieMenu.indexOf('~~') > 0) {
152
+ // // cookie中记录了选中的菜单路径
153
+ // const path = cookieMenu.substring(0, cookieMenu.lastIndexOf('~~'))
154
+ // currentRoute = path
155
+ // }
156
+ // let shouldSelectMenu
157
+ // const children = menu.children
158
+ // if (children && children.length > 0) {
159
+ // shouldSelectMenu = this.getFirstMenu(children)
160
+ // } else if (menu.fullPath && menu.fullPath === currentRoute) {
161
+ // shouldSelectMenu = menu
162
+ // }
163
+ // return shouldSelectMenu
164
+ // }
130
165
  },
131
166
  getSelectMenuWithFirstMenu(menu) {
132
167
  if (menu) {
@@ -0,0 +1,161 @@
1
+ <template>
2
+ <div>
3
+ <el-tabs v-if="openTab && openTab.length > 0" v-model="activeIndex" class="nav-tab menu-tab-container" closable @tab-remove="closeSelectedTag">
4
+ <el-tab-pane v-for="tag in openTab" :key="tag.code" :label="tag.name" :name="tag.code">
5
+ <iframe ref="tabMainContent" :src="getFullPath(tag)" class="tab-main-content" name="tab-main-content" frameborder="0" />
6
+ </el-tab-pane>
7
+ </el-tabs>
8
+ <div class="default-page-tip">
9
+ <div class="default-page-tip-msg">
10
+ <div class="default-page-tip-item">
11
+ {{ defaultPageTipCn }}
12
+ </div>
13
+ <div class="default-page-tip-item">
14
+ {{ defaultPageTipEn }}
15
+ </div>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </template>
20
+ <style rel="stylesheet/scss" lang="scss" scoped>
21
+ iframe.tab-main-content{
22
+ width: 100%;
23
+ height: calc(100vh - 53px);
24
+ }
25
+ </style>
26
+ <script>
27
+ import Vue from 'vue'
28
+ import { mapGetters } from 'vuex'
29
+ export default {
30
+ name: 'TabContent',
31
+ data() {
32
+ let defaultPageTip = Vue.prototype.defaultPageTip
33
+ if (!defaultPageTip) {
34
+ defaultPageTip = '欢迎访问质量管理系统/Welcome to Quality Management System'
35
+ }
36
+ let defaultPageTipCn = defaultPageTip
37
+ let defaultPageTipEn
38
+ if (defaultPageTip && defaultPageTip.indexOf('/') > 0) {
39
+ defaultPageTipCn = defaultPageTip.substring(0, defaultPageTip.lastIndexOf('/'))
40
+ defaultPageTipEn = defaultPageTip.substring(defaultPageTip.lastIndexOf('/') + 1)
41
+ }
42
+ return {
43
+ defaultPageTipCn,
44
+ defaultPageTipEn
45
+ }
46
+ },
47
+ computed: {
48
+ ...mapGetters([
49
+ 'openTab'
50
+ ]),
51
+ activeIndex: {
52
+ get() {
53
+ return this.$store.state.tabContent.activeIndex
54
+ },
55
+ set(val) {
56
+ this.$store.commit('set_active_index', val)
57
+ }
58
+ }
59
+ },
60
+ created() {
61
+ debugger
62
+ // 登录超时,给父iframe发送信号
63
+ window.addEventListener('message', this.recieveMessage)
64
+ },
65
+ methods: {
66
+ closeSelectedTag(tagName) {
67
+ const index = this.$store.state.tabContent.openTab.findIndex((item) => item.code === tagName)
68
+ const view = this.$store.state.tabContent.openTab[index]
69
+ this.$store.commit('delete_tabs', view)
70
+ if (tagName === this.activeIndex) {
71
+ // 表示删除的是当前选中的菜单,选中前面的菜单
72
+ this.toLastView(this.$store.state.tabContent.openTab, index > 0 ? (index - 1) : 0)
73
+ }
74
+ },
75
+ toLastView(visitedViews, lastIndex) {
76
+ if (visitedViews && visitedViews.length > 0 && visitedViews.length > lastIndex) {
77
+ const latestView = visitedViews[lastIndex]
78
+ if (latestView) {
79
+ this.$store.commit('set_active_index', latestView.code)
80
+ }
81
+ }
82
+ },
83
+ getFullPath(tag) {
84
+ let path
85
+ if (tag.routePath === '/iframe-page/page') {
86
+ // 表示是iframe页面
87
+ let src
88
+ let params = ''
89
+ if (tag.routeQuery) {
90
+ for (const key in tag.routeQuery) {
91
+ if (key === 'src') {
92
+ src = tag.routeQuery[key]
93
+ } else {
94
+ params += key + '=' + tag.routeQuery[key] + '&'
95
+ }
96
+ }
97
+ }
98
+ if (src) {
99
+ path = src
100
+ }
101
+ if (params) {
102
+ path += '?' + params
103
+ }
104
+ } else {
105
+ // 表示页面跳转
106
+ path = '#' + tag.routePath + '?'
107
+ if (tag.routeQuery) {
108
+ for (const key in tag.routeQuery) {
109
+ path += key + '=' + tag.routeQuery[key] + '&'
110
+ }
111
+ }
112
+ }
113
+ if (path && path.length > 0 && path.lastIndexOf('&') === path.length - 1) {
114
+ path = path.substring(0, path.lastIndexOf('&'))
115
+ }
116
+ return path
117
+ },
118
+ recieveMessage(event) {
119
+ if (event && typeof event.data === 'string' && event.data.indexOf('loginTimeout') >= 0) {
120
+ // 表示iframe中的页面发送了登录超时的信号,将信号传给最外层window
121
+ console.log('tab-content-接收到登录超时的信息---event.data=', event.data)
122
+ window.parent.postMessage(event.data, '*')
123
+ } else if (event && typeof event.data === 'string' && event.data === 'return-to-system-list') {
124
+ // 表示系统元数据/设计页面点击了“返回“按钮,需要返回到系统九宫格列表页面
125
+ this.$store.commit('clear_tabs')
126
+ this.$router.push({ path: '/mms/systems/list' })
127
+ }
128
+ }
129
+ }
130
+ }
131
+ </script>
132
+
133
+ <style>
134
+ .nav-tab {
135
+ padding-top: 5px;
136
+ padding-left: 5px;
137
+ }
138
+ .nav-tab .el-tabs__header{
139
+ margin: 0;
140
+ /* border-bottom: 0px; */
141
+ }
142
+ .menu-tab-container .el-tabs__content{
143
+ padding: 0;
144
+ }
145
+ .default-page-tip {
146
+ width: 100%;
147
+ height: 100%;
148
+ background: #f7f7f8;
149
+ }
150
+ .default-page-tip-msg {
151
+ padding-top: 25%;
152
+ padding-bottom: 30%;
153
+ font-size: 24px;
154
+ font-weight: 600;
155
+ text-align: center;
156
+ color: gray;
157
+ }
158
+ .default-page-tip-item {
159
+ padding-top: 10px;
160
+ }
161
+ </style>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <div>
3
+ <iframe v-if="src && src!== null" ref="menuContent" :src="src" name="menu-content" title="Main content" frameborder="0" />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ data() {
10
+ return {
11
+ src: null
12
+ }
13
+ },
14
+ watch: {
15
+ $route(to, from) {
16
+ // 必须这样写,否则会在切换页面时无法获得pageCode参数
17
+ this.src = this.$route.query.src
18
+ }
19
+ },
20
+ mounted() {
21
+ this.src = this.$route.query.src
22
+ }
23
+ }
24
+ </script>
25
+
26
+ <style lang="scss" scoped>
27
+ iframe{
28
+ width: 100%;
29
+ height: calc(100vh - 50px);
30
+ }
31
+ </style>
@@ -0,0 +1,85 @@
1
+ <template>
2
+ <div :class="classObj" class="app-wrapper">
3
+ <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
4
+ <menubar :system-code="systemCode" :collapse="true" class="sidebar-container"/>
5
+ <div class="main-container">
6
+ <breadcrumb v-if="showMenuRoute"/>
7
+ <tab-content/>
8
+ <!-- <app-main /> -->
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import { Menubar, Breadcrumb } from './components'
15
+ import ResizeMixin from './mixin/ResizeHandler'
16
+ import { isShowMenuRoute } from 'imatrix-ui/src/utils/common-util'
17
+ import TabContent from './components/tabs/tab-content'
18
+ import Vue from 'vue'
19
+
20
+ export default {
21
+ name: 'Layout',
22
+ components: {
23
+ Menubar,
24
+ Breadcrumb,
25
+ TabContent
26
+ },
27
+ mixins: [ResizeMixin],
28
+ data() {
29
+ // 是否显示菜单路径,默认是不显示
30
+ const showMenuRoute = isShowMenuRoute()
31
+ return {
32
+ showMenuRoute,
33
+ systemCode: null
34
+ }
35
+ },
36
+ computed: {
37
+ sidebar() {
38
+ return this.$store.state.app.sidebar
39
+ },
40
+ device() {
41
+ return this.$store.state.app.device
42
+ },
43
+ classObj() {
44
+ return {
45
+ hideSidebar: !this.sidebar.opened,
46
+ openSidebar: this.sidebar.opened,
47
+ withoutAnimation: this.sidebar.withoutAnimation,
48
+ mobile: this.device === 'mobile'
49
+ }
50
+ }
51
+ },
52
+ created() {
53
+ this.systemCode = Vue.prototype.customSystem
54
+ console.log('新菜单组件-----systemCode====', this.systemCode)
55
+ },
56
+ methods: {
57
+ handleClickOutside() {
58
+ this.$store.dispatch('closeSidebar', { withoutAnimation: false })
59
+ }
60
+ }
61
+ }
62
+ </script>
63
+
64
+ <style rel="stylesheet/scss" lang="scss" scoped>
65
+ @import "imatrix-ui/src/styles/mixin.scss";
66
+ .app-wrapper {
67
+ @include clearfix;
68
+ position: relative;
69
+ height: 100%;
70
+ width: 100%;
71
+ &.mobile.openSidebar{
72
+ position: fixed;
73
+ top: 0;
74
+ }
75
+ }
76
+ .drawer-bg {
77
+ background: #000;
78
+ opacity: 0.3;
79
+ width: 100%;
80
+ top: 0;
81
+ height: 100%;
82
+ position: absolute;
83
+ z-index: 999;
84
+ }
85
+ </style>