imatrix-ui 0.0.15 → 0.1.1-up

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 (171) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/README.md +7 -0
  3. package/components/dynamic-source-select/dynamic-source-select-service.js +106 -0
  4. package/components/dynamic-source-select/dynamic-source-select.vue +673 -0
  5. package/components/dynamic-source-select/events.js +77 -0
  6. package/components/fs-preview/fs-preview.vue +287 -0
  7. package/components/index.js +26 -0
  8. package/components/plugins/export-data-new.js +623 -0
  9. package/components/plugins/export-data.js +431 -0
  10. package/components/plugins/index.js +15 -0
  11. package/components/plugins/public-method.js +47 -0
  12. package/components/rich-editor/index-bak.vue +306 -0
  13. package/components/rich-editor/index.vue +236 -0
  14. package/components/rich-editor/langs/zh-Hans.js +438 -0
  15. package/components/rich-editor/viewer.vue +105 -0
  16. package/components/super-grid/apis.js +1065 -0
  17. package/components/super-grid/columns-config.vue +430 -0
  18. package/components/super-grid/custom-formatter.js +330 -0
  19. package/components/super-grid/dynamic-input.vue +1706 -0
  20. package/components/super-grid/eventBus.js +2 -0
  21. package/components/super-grid/events.js +56 -0
  22. package/components/super-grid/formValidatorUtil.js +300 -0
  23. package/components/super-grid/formatter.js +190 -0
  24. package/components/super-grid/group-column.vue +100 -0
  25. package/components/super-grid/header-context-menu.vue +82 -0
  26. package/components/super-grid/index-column.vue +69 -0
  27. package/components/super-grid/normal-column.vue +1148 -0
  28. package/components/super-grid/public-methods.js +30 -0
  29. package/components/super-grid/row-operation.vue +193 -0
  30. package/components/super-grid/search-button.vue +74 -0
  31. package/components/super-grid/search-condition-input.vue +73 -0
  32. package/components/super-grid/search-condition-list.vue +68 -0
  33. package/components/super-grid/search-form-advancedQuery.vue +820 -0
  34. package/components/super-grid/search-form-dialog.vue +77 -0
  35. package/components/super-grid/search-form-item.vue +470 -0
  36. package/components/super-grid/search-form-number.vue +111 -0
  37. package/components/super-grid/search-form-open.vue +178 -0
  38. package/components/super-grid/search-form-ordinarySearch.vue +218 -0
  39. package/components/super-grid/search-form.vue +756 -0
  40. package/components/super-grid/search-methods.js +484 -0
  41. package/components/super-grid/selection-column.vue +46 -0
  42. package/components/super-grid/store.js +3 -0
  43. package/components/super-grid/super-grid-service.js +682 -0
  44. package/components/super-grid/super-grid.vue +2893 -0
  45. package/components/super-grid/utils.js +851 -0
  46. package/components/super-grid/view-image-dialog.vue +173 -0
  47. package/components/utils/gogocodeTransfer.js +59 -0
  48. package/components/utils/utils.js +180 -0
  49. package/components/utils/value-set.js +98 -0
  50. package/components/z-test-utton/index.vue +82 -0
  51. package/package.json +29 -40
  52. package/public/index.html +13 -0
  53. package/public/vite.svg +1 -0
  54. package/src/api/sso-service.js +172 -19
  55. package/src/api/tab.js +36 -0
  56. package/src/api/user-service.js +11 -11
  57. package/src/assets/401/401.gif +0 -0
  58. package/src/assets/404/404-cloud.png +0 -0
  59. package/src/assets/404/404.png +0 -0
  60. package/src/assets/cloud.png +0 -0
  61. package/src/directives/permission/index.js +13 -13
  62. package/src/directives/permission/permission.js +20 -15
  63. package/src/i18n/i18n.js +16 -0
  64. package/src/i18n/langs/cn.js +254 -0
  65. package/src/i18n/langs/en.js +264 -0
  66. package/src/permission.js +157 -71
  67. package/src/plugins.js +18 -18
  68. package/src/router/index.js +96 -69
  69. package/src/store/getters.js +15 -10
  70. package/src/store/index.js +19 -19
  71. package/src/store/modules/app.js +54 -42
  72. package/src/store/modules/permission.js +137 -73
  73. package/src/store/modules/tab-content.js +36 -0
  74. package/src/store/modules/user.js +293 -80
  75. package/src/styles/display-layout.scss +34 -0
  76. package/src/styles/element-ui.scss +29 -29
  77. package/src/styles/index.scss +157 -78
  78. package/src/styles/mixin.scss +27 -27
  79. package/src/styles/theme/black/font-style.scss +70 -0
  80. package/src/styles/theme/black/index.scss +306 -0
  81. package/src/styles/theme/black/sidebar.scss +189 -0
  82. package/src/styles/theme/blue/font-style.scss +46 -0
  83. package/src/styles/theme/blue/index.scss +172 -0
  84. package/src/styles/{sidebar.scss → theme/blue/sidebar.scss} +171 -141
  85. package/src/styles/theme/blue2/font-style.scss +70 -0
  86. package/src/styles/theme/blue2/index.scss +188 -0
  87. package/src/styles/theme/blue2/sidebar.scss +201 -0
  88. package/src/styles/theme/dark-blue/button.scss +9 -0
  89. package/src/styles/theme/dark-blue/card.scss +62 -0
  90. package/src/styles/theme/dark-blue/checkbox.scss +10 -0
  91. package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
  92. package/src/styles/theme/dark-blue/dialog.scss +21 -0
  93. package/src/styles/theme/dark-blue/element-variables.scss +7 -0
  94. package/src/styles/theme/dark-blue/font.scss +71 -0
  95. package/src/styles/theme/dark-blue/form.scss +51 -0
  96. package/src/styles/theme/dark-blue/index.scss +269 -0
  97. package/src/styles/theme/dark-blue/input.scss +15 -0
  98. package/src/styles/theme/dark-blue/message.scss +8 -0
  99. package/src/styles/theme/dark-blue/pagination.scss +14 -0
  100. package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
  101. package/src/styles/theme/dark-blue/sidebar.scss +266 -0
  102. package/src/styles/theme/dark-blue/tab.scss +83 -0
  103. package/src/styles/theme/dark-blue/table.scss +60 -0
  104. package/src/styles/theme/dark-blue/tree.scss +31 -0
  105. package/src/styles/theme/dark-blue/var.scss +1028 -0
  106. package/src/styles/theme/gray/card-style.scss +54 -0
  107. package/src/styles/theme/gray/font-style.scss +70 -0
  108. package/src/styles/theme/gray/index.scss +172 -0
  109. package/src/styles/theme/gray/input-style.scss +19 -0
  110. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  111. package/src/styles/theme/gray/sidebar.scss +231 -0
  112. package/src/styles/theme/gray/tab-style.scss +81 -0
  113. package/src/styles/transition.scss +47 -46
  114. package/src/utils/auth-api.js +159 -0
  115. package/src/utils/auth.js +61 -15
  116. package/src/utils/calculator/calculator-factory-wf.js +558 -0
  117. package/src/utils/calculator/calculator-factory.js +145 -0
  118. package/src/utils/calculator/calculator-util.js +166 -0
  119. package/src/utils/common-util.js +305 -0
  120. package/src/utils/eventBus.js +2 -0
  121. package/src/utils/iconUtils.js +28 -0
  122. package/src/utils/index.js +102 -86
  123. package/src/utils/jump-page-utils.js +814 -0
  124. package/src/utils/local-storage.js +33 -31
  125. package/src/utils/menu.js +19 -0
  126. package/src/utils/permission.js +31 -26
  127. package/src/utils/permissionAuth.js +90 -0
  128. package/src/utils/range-selector.js +188 -0
  129. package/src/utils/request.js +270 -116
  130. package/src/utils/restful-interface-utils.js +57 -0
  131. package/src/utils/util.js +698 -0
  132. package/src/utils/validate.js +34 -33
  133. package/src/utils/watermark.js +108 -0
  134. package/src/utils/workflow-util.js +93 -0
  135. package/src/views/404.vue +248 -228
  136. package/src/views/dsc-component/Sidebar/Item.vue +84 -0
  137. package/src/views/dsc-component/Sidebar/Link.vue +38 -0
  138. package/src/views/dsc-component/Sidebar/SidebarItem.vue +196 -0
  139. package/src/views/dsc-component/Sidebar/index.vue +220 -0
  140. package/src/views/dsc-component/tabs/tab-content.vue +199 -0
  141. package/src/views/error-page/401.vue +106 -91
  142. package/src/views/error-page/404.vue +248 -228
  143. package/src/views/layout/EmptyLayout.vue +3 -0
  144. package/src/views/layout/Layout.vue +81 -68
  145. package/src/views/layout/NewLayout.vue +18 -0
  146. package/src/views/layout/components/AppMain.vue +39 -29
  147. package/src/views/layout/components/Breadcrumb/index.vue +156 -0
  148. package/src/views/layout/components/Menubar/Item.vue +57 -0
  149. package/src/views/layout/components/Menubar/Link.vue +38 -0
  150. package/src/views/layout/components/Menubar/SidebarItem.vue +164 -0
  151. package/src/views/layout/components/Menubar/index.vue +210 -0
  152. package/src/views/layout/components/Sidebar/Item.vue +53 -29
  153. package/src/views/layout/components/Sidebar/Link.vue +38 -39
  154. package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -100
  155. package/src/views/layout/components/Sidebar/index.vue +141 -48
  156. package/src/views/layout/components/iframe-page.vue +38 -0
  157. package/src/views/layout/components/index.js +4 -3
  158. package/src/views/layout/components/tabs/tab-content.vue +207 -0
  159. package/src/views/layout/mixin/ResizeHandler.js +41 -41
  160. package/src/views/layout/tab-content-iframe-index.vue +38 -0
  161. package/src/views/layout/tab-content-index.vue +93 -0
  162. package/src/views/login/authredirect.vue +10 -10
  163. package/src/views/login/index.vue +296 -203
  164. package/src/views/login/update-password.vue +243 -0
  165. package/src/views/redirect/index.vue +14 -12
  166. package/src/views/wf-history/tache-subprocess-history.vue +45 -0
  167. package/vite.config.js +31 -0
  168. package/lib/super-ui.css +0 -1
  169. package/lib/super-ui.umd.min.js +0 -2
  170. package/src/styles/variables.scss +0 -4
  171. package/src/views/layout/components/Navbar.vue +0 -92
@@ -0,0 +1,196 @@
1
+ <template>
2
+ <div class="menu-wrapper">
3
+ <template v-if="!item.children || item.children.lenght === 0">
4
+ <app-link :to="toPath(item)" @click="clickMenu(toPath(item))">
5
+ <el-menu-item
6
+ :index="resolvePath(item.code, item.path, item.pageType)"
7
+ :class="{ 'submenu-title-noDropdown': !isNest }"
8
+ >
9
+ <item
10
+ :icon="item.iconName"
11
+ :title="getI18nName(item)"
12
+ :is-root="true"
13
+ />
14
+ </el-menu-item>
15
+ </app-link>
16
+ </template>
17
+
18
+ <el-sub-menu
19
+ v-else
20
+ :index="resolvePath(item.code, item.path, item.pageType)"
21
+ :show-timeout="0"
22
+ :hide-timeout="50"
23
+ popper-class="sidebar-container-popper"
24
+ >
25
+ <template v-slot:title>
26
+ <item
27
+ :icon="item.iconName"
28
+ :title="getI18nName(item)"
29
+ :has-children="item.children.length > 0 ? true : false"
30
+ />
31
+ </template>
32
+
33
+ <template v-for="child in item.children">
34
+ <sidebar-item
35
+ v-if="child.children && child.children.length > 0"
36
+ :is-nest="true"
37
+ :item="child"
38
+ class="nest-menu"
39
+ />
40
+ <app-link v-else :to="toPath(child)" @click="clickMenu(toPath(child))">
41
+ <el-menu-item
42
+ :index="resolvePath(child.code, child.path, child.pageType)"
43
+ >
44
+ <item :icon="child.iconName" :title="getI18nName(child)" />
45
+ </el-menu-item>
46
+ </app-link>
47
+ </template>
48
+ </el-sub-menu>
49
+ </div>
50
+ </template>
51
+
52
+ <script>
53
+ // import { isExternal } from 'imatrix-ui/src/utils'
54
+ import Item from './Item.vue'
55
+ import AppLink from './Link.vue'
56
+ import * as Vue from 'vue'
57
+ import tabJs from '../../../api/tab'
58
+ import { getI18nName } from '../../../utils/menu'
59
+ export default {
60
+ name: 'SidebarItem',
61
+ components: { Item, AppLink },
62
+ props: {
63
+ // route object
64
+ item: {
65
+ type: Object,
66
+ required: true,
67
+ },
68
+ isNest: {
69
+ type: Boolean,
70
+ default: false,
71
+ },
72
+ // basePath: {
73
+ // type: String,
74
+ // default: ''
75
+ // }
76
+ },
77
+ data() {
78
+ return {
79
+ onlyOneChild: null,
80
+ }
81
+ },
82
+ methods: {
83
+ ...tabJs,
84
+ hasOneShowingChild(children, parent) {
85
+ if (children && children.length > 0) {
86
+ this.onlyOneChild = children[0]
87
+ }
88
+ // When there is only one child router, the child router is displayed by default
89
+ if (children.length === 1) {
90
+ return true
91
+ }
92
+
93
+ // Show parent if there are no child router to display
94
+ if (!children || children.length === 0) {
95
+ // children不存在
96
+ this.onlyOneChild = { ...parent, path: '', noShowingChildren: true }
97
+ return true
98
+ }
99
+
100
+ return false
101
+ },
102
+ resolvePath(menuCode, pageCode, pageType) {
103
+ if (this.isExternalLink(pageType)) {
104
+ return '/dsc/' + menuCode + '~~'
105
+ } else {
106
+ return '/dsc/' + menuCode + '~~' + pageCode
107
+ }
108
+ },
109
+ toPath(menu) {
110
+ const toPathObj = {}
111
+ const routePath = menu.path
112
+ toPathObj.openWay = menu.openWay
113
+ if (this.isExternalLink(menu.pageType)) {
114
+ toPathObj.path = '/dsc-index/iframe-page'
115
+ toPathObj.tabPath = '/dsc/iframe-page'
116
+ toPathObj.query = {}
117
+ toPathObj.query.src = routePath
118
+ toPathObj.isExternal = true
119
+ // 如果路径中没有拼系统编码,才需要把系统编码放到参数中
120
+ toPathObj.query.customSystem =
121
+ window.$vueApp.config.globalProperties.customSystem
122
+ toPathObj.query._menuCode = menu.code
123
+ toPathObj.query._menuName = getI18nName(menu)
124
+ } else {
125
+ const pageCode = routePath
126
+ toPathObj.path = '/dsc-index/page'
127
+ toPathObj.tabPath = '/dsc/page'
128
+ toPathObj.query = {}
129
+ toPathObj.query.pageCode = pageCode
130
+ toPathObj.query.customSystem =
131
+ window.$vueApp.config.globalProperties.customSystem
132
+ toPathObj.query._menuCode = menu.code
133
+ toPathObj.query._menuName = getI18nName(menu)
134
+ }
135
+ return toPathObj
136
+ },
137
+ // 是否已存在customSystem参数
138
+ isHasCustomSystem(routePath) {
139
+ if (routePath && routePath.indexOf('?') > 0) {
140
+ const params = routePath.substring(routePath.indexOf('?') + 1)
141
+ const paramArr = params.split('&')
142
+ for (let i = 0; i < paramArr.length; i++) {
143
+ const item = paramArr[i]
144
+ const key = item.split('=')[0]
145
+ if (key === 'customSystem') {
146
+ return true
147
+ }
148
+ }
149
+ }
150
+ return false
151
+ },
152
+ clickMenu(toPathObj) {
153
+ // console.log('clickMenu----toPathObj=', toPathObj)
154
+ if (
155
+ toPathObj.openWay &&
156
+ toPathObj.openWay === 'NEW_PAGE_OPEN' &&
157
+ toPathObj.query
158
+ ) {
159
+ // 新页签打开菜单
160
+ let url = toPathObj.query.src
161
+ if (url && url.indexOf('?') > 0) {
162
+ url += '&'
163
+ } else {
164
+ url += '?'
165
+ }
166
+ if (toPathObj.query.customSystem) {
167
+ url += 'customSystem=' + toPathObj.query.customSystem
168
+ }
169
+ if (toPathObj.query._menuCode) {
170
+ url += '_menuCode=' + toPathObj.query._menuCode
171
+ }
172
+ if (toPathObj.query._menuCode) {
173
+ url += '_menuName=' + toPathObj.query._menuName
174
+ }
175
+ window.open(url, toPathObj.query._menuCode)
176
+ } else {
177
+ // 刷新页签打开菜单
178
+ this.addTabs(
179
+ toPathObj.query,
180
+ this.$store.state.tabContent.openTab,
181
+ toPathObj.tabPath
182
+ )
183
+ }
184
+ },
185
+ isExternalLink(pageType) {
186
+ if (pageType && pageType === 'iframe') {
187
+ return true
188
+ }
189
+ return false
190
+ },
191
+ getI18nName(menu) {
192
+ return getI18nName(menu)
193
+ },
194
+ },
195
+ }
196
+ </script>
@@ -0,0 +1,220 @@
1
+ <template>
2
+ <div>
3
+ <el-scrollbar wrap-class="scrollbar-wrapper">
4
+ <el-menu
5
+ :show-timeout="200"
6
+ :default-active="getDefaultActive()"
7
+ :collapse="isCollapse"
8
+ mode="vertical"
9
+ @select="selectMenu"
10
+ >
11
+ <sidebar-item v-for="menu in menus" :key="menu.code" :item="menu" />
12
+ </el-menu>
13
+ </el-scrollbar>
14
+ <hamburger
15
+ :is-active="sidebar.opened"
16
+ class="hamburger-container"
17
+ @toggleClick="toggleSideBar"
18
+ />
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ import { mapGetters } from 'vuex'
24
+ import SidebarItem from './SidebarItem.vue'
25
+ import Cookies from 'js-cookie'
26
+ import tabJs from '../../../api/tab'
27
+ import { getMenus } from '../../../utils/permissionAuth'
28
+ import { getI18nName } from '../../../utils/menu'
29
+ export default {
30
+ name: 'Sidebar',
31
+ components: {
32
+ SidebarItem,
33
+ },
34
+ props: {
35
+ systemCode: {
36
+ type: String,
37
+ default: null,
38
+ },
39
+ collapse: {
40
+ type: Boolean,
41
+ default: false,
42
+ },
43
+ },
44
+ data() {
45
+ const menus = getMenus()
46
+ return {
47
+ menus,
48
+ }
49
+ },
50
+ computed: {
51
+ ...mapGetters(['sidebar']),
52
+ isCollapse() {
53
+ if (this.collapse === false) {
54
+ return !this.sidebar.opened
55
+ }
56
+ return true
57
+ },
58
+ },
59
+ created() {
60
+ this.firstLeafMenu = this.getMyFirstMenu(this.menus)
61
+ if (this.firstLeafMenu && this.firstLeafMenu.fullPath) {
62
+ // 跳转到第一个页面
63
+ if (
64
+ this.firstLeafMenu.pageType &&
65
+ this.firstLeafMenu.pageType === 'iframe'
66
+ ) {
67
+ const iframeSrc = this.firstLeafMenu.fullPath
68
+ const pageCode = this.firstLeafMenu.path
69
+ const query = {
70
+ src: iframeSrc,
71
+ customSystem: this.systemCode,
72
+ pageCode: pageCode,
73
+ _menuCode: this.firstLeafMenu.code,
74
+ _menuName: getI18nName(this.firstLeafMenu),
75
+ }
76
+ this.addTabs(
77
+ query,
78
+ this.$store.state.tabContent.openTab,
79
+ '/dsc/iframe-page',
80
+ '/dsc/iframe-page'
81
+ )
82
+ this.$router.push({ path: '/dsc-index/iframe-page', query: query })
83
+ } else {
84
+ const pageCode = this.firstLeafMenu.path
85
+ const query = {
86
+ customSystem: this.systemCode,
87
+ pageCode: pageCode,
88
+ _menuCode: this.firstLeafMenu.code,
89
+ _menuName: getI18nName(this.firstLeafMenu),
90
+ }
91
+ this.addTabs(
92
+ query,
93
+ this.$store.state.tabContent.openTab,
94
+ '/dsc/page',
95
+ '/dsc/page'
96
+ )
97
+ this.$router.push({ path: '/dsc-index/page', query: query })
98
+ // this.$router.push({ path: this.firstLeafMenu.fullPath })
99
+ }
100
+ }
101
+ },
102
+ methods: {
103
+ ...tabJs,
104
+ getDefaultActive() {
105
+ if (this.firstLeafMenu && this.firstLeafMenu.pageType !== 'iframe') {
106
+ const pageCode = this.firstLeafMenu.path
107
+ return '/dsc/' + this.firstLeafMenu.code + '~~' + pageCode
108
+ } else if (
109
+ this.firstLeafMenu &&
110
+ this.firstLeafMenu.pageType === 'iframe'
111
+ ) {
112
+ return '/dsc/' + this.firstLeafMenu.code + '~~'
113
+ } else {
114
+ return ''
115
+ }
116
+ },
117
+ toggleSideBar() {
118
+ this.$store.dispatch('toggleSidebar')
119
+ },
120
+ selectMenu(index, indexPath) {
121
+ Cookies.set('selectMenu', index)
122
+ },
123
+ getMyFirstMenu(menus) {
124
+ if (menus && menus.length > 0) {
125
+ let shouldSelectMenu = this.getFirstMenu(menus)
126
+ if (!shouldSelectMenu) {
127
+ shouldSelectMenu = this.getFirstMenuWithCookie(menus)
128
+ }
129
+ // 默认不展示第一个有权限的菜单了,可以去掉下面的代码
130
+ // if (!shouldSelectMenu) {
131
+ // shouldSelectMenu = this.getSelectMenuWithFirstMenu(menus[0])
132
+ // }
133
+ return shouldSelectMenu
134
+ }
135
+ },
136
+ getFirstMenu(menus) {
137
+ if (menus && menus.length > 0) {
138
+ let shouldSelectMenu
139
+ for (let i = 0; i < menus.length; i++) {
140
+ const menu = menus[i]
141
+ shouldSelectMenu = this.getShouldSelectMenu(menu)
142
+ if (shouldSelectMenu) {
143
+ // 表示获得到了应该选中的菜单
144
+ break
145
+ }
146
+ }
147
+ return shouldSelectMenu
148
+ }
149
+ },
150
+ getShouldSelectMenu(menu) {
151
+ // console.log('dsc--getShouldSelectMenu--this.$route=', this.$route)
152
+ const currentMenuCode = this.$route.query
153
+ ? this.$route.query._menuCode
154
+ : null
155
+ if (menu && currentMenuCode) {
156
+ let shouldSelectMenu
157
+ const children = menu.children
158
+ if (children && children.length > 0) {
159
+ shouldSelectMenu = this.getFirstMenu(children)
160
+ } else if (menu.code && menu.code === currentMenuCode) {
161
+ shouldSelectMenu = menu
162
+ }
163
+ return shouldSelectMenu
164
+ }
165
+ },
166
+ getSelectMenuWithFirstMenu(menu) {
167
+ if (menu) {
168
+ let shouldSelectMenu
169
+ const children = menu.children
170
+ if (children && children.length > 0) {
171
+ shouldSelectMenu = this.getFirstMenu(children)
172
+ } else {
173
+ shouldSelectMenu = menu
174
+ }
175
+ return shouldSelectMenu
176
+ }
177
+ },
178
+ getFirstMenuWithCookie(menus) {
179
+ if (menus && menus.length > 0) {
180
+ const cookieMenu = Cookies.get('selectMenu')
181
+ if (cookieMenu) {
182
+ // // 表示缓存中存储了menu,格式为:/dsc/菜单编码~~pageCode
183
+ const prefix = '/dsc/'
184
+ const menuCode = cookieMenu.substring(
185
+ cookieMenu.indexOf(prefix) + prefix.length,
186
+ cookieMenu.lastIndexOf('~~')
187
+ )
188
+
189
+ let shouldSelectMenu
190
+ for (let i = 0; i < menus.length; i++) {
191
+ const menu = menus[i]
192
+ shouldSelectMenu = this.getShouldSelectMenuWithCookie(
193
+ menu,
194
+ menuCode
195
+ )
196
+ if (shouldSelectMenu) {
197
+ // 表示获得到了应该选中的菜单
198
+ break
199
+ }
200
+ }
201
+ return shouldSelectMenu
202
+ }
203
+ }
204
+ },
205
+ getShouldSelectMenuWithCookie(menu, menuCode) {
206
+ if (menu) {
207
+ // console.log('dsc--getShouldSelectMenuWithCookie--this.$route=', this.$route)
208
+ let shouldSelectMenu
209
+ const children = menu.children
210
+ if (children && children.length > 0) {
211
+ shouldSelectMenu = this.getFirstMenuWithCookie(children)
212
+ } else if (menu.code && menu.code === menuCode) {
213
+ shouldSelectMenu = menu
214
+ }
215
+ return shouldSelectMenu
216
+ }
217
+ },
218
+ },
219
+ }
220
+ </script>
@@ -0,0 +1,199 @@
1
+ <template>
2
+ <div>
3
+ <el-tabs
4
+ v-if="openTab && openTab.length > 0"
5
+ v-model="activeIndex"
6
+ class="nav-tab menu-tab-container"
7
+ closable
8
+ @tab-remove="closeSelectedTag"
9
+ >
10
+ <el-tab-pane
11
+ v-for="tag in openTab"
12
+ :key="tag.code"
13
+ :label="tag.name"
14
+ :name="tag.code"
15
+ >
16
+ <iframe
17
+ ref="tabMainContent"
18
+ :src="getFullPath(tag)"
19
+ class="tab-main-content"
20
+ name="tab-main-content"
21
+ frameborder="0"
22
+ />
23
+ </el-tab-pane>
24
+ </el-tabs>
25
+ <div class="default-page-tip">
26
+ <div class="default-page-tip-msg">
27
+ <div class="default-page-tip-item">
28
+ {{ defaultPageTipCn }}
29
+ </div>
30
+ <div class="default-page-tip-item">
31
+ {{ defaultPageTipEn }}
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </template>
37
+
38
+ <script>
39
+ import * as Vue from 'vue'
40
+ import { mapGetters } from 'vuex'
41
+ export default {
42
+ name: 'TabContent',
43
+ data() {
44
+ let defaultPageTip = window.$vueApp.config.globalProperties.defaultPageTip
45
+ if (!defaultPageTip) {
46
+ defaultPageTip =
47
+ '欢迎访问质量管理系统/Welcome to Quality Management System'
48
+ }
49
+ let defaultPageTipCn = defaultPageTip
50
+ let defaultPageTipEn
51
+ if (defaultPageTip && defaultPageTip.indexOf('/') > 0) {
52
+ defaultPageTipCn = defaultPageTip.substring(
53
+ 0,
54
+ defaultPageTip.lastIndexOf('/')
55
+ )
56
+ defaultPageTipEn = defaultPageTip.substring(
57
+ defaultPageTip.lastIndexOf('/') + 1
58
+ )
59
+ }
60
+ return {
61
+ defaultPageTipCn,
62
+ defaultPageTipEn,
63
+ }
64
+ },
65
+ computed: {
66
+ ...mapGetters(['openTab']),
67
+ activeIndex: {
68
+ get() {
69
+ return this.$store.state.tabContent.activeIndex
70
+ },
71
+ set(val) {
72
+ this.$store.commit('set_active_index', val)
73
+ },
74
+ },
75
+ },
76
+ created() {
77
+ // 登录超时,给父iframe发送信号
78
+ window.addEventListener('message', this.recieveMessage)
79
+ },
80
+ methods: {
81
+ closeSelectedTag(tagName) {
82
+ const index = this.$store.state.tabContent.openTab.findIndex(
83
+ (item) => item.code === tagName
84
+ )
85
+ const view = this.$store.state.tabContent.openTab[index]
86
+ this.$store.commit('delete_tabs', view)
87
+ if (tagName === this.activeIndex) {
88
+ // 表示删除的是当前选中的菜单,选中前面的菜单
89
+ this.toLastView(
90
+ this.$store.state.tabContent.openTab,
91
+ index > 0 ? index - 1 : 0
92
+ )
93
+ }
94
+ },
95
+ toLastView(visitedViews, lastIndex) {
96
+ if (
97
+ visitedViews &&
98
+ visitedViews.length > 0 &&
99
+ visitedViews.length > lastIndex
100
+ ) {
101
+ const latestView = visitedViews[lastIndex]
102
+ if (latestView) {
103
+ this.$store.commit('set_active_index', latestView.code)
104
+ }
105
+ }
106
+ },
107
+ getFullPath(tag) {
108
+ let path
109
+ if (tag.routePath === '/dsc/iframe-page') {
110
+ // 表示是iframe页面
111
+ let src
112
+ let params = ''
113
+ if (tag.routeQuery) {
114
+ for (const key in tag.routeQuery) {
115
+ if (key === 'src') {
116
+ src = tag.routeQuery[key]
117
+ } else {
118
+ params += key + '=' + tag.routeQuery[key] + '&'
119
+ }
120
+ }
121
+ }
122
+ if (src) {
123
+ path = src
124
+ }
125
+ if (params) {
126
+ path += '?' + params
127
+ }
128
+ } else {
129
+ // 表示页面跳转
130
+ path = '#' + tag.routePath + '?'
131
+ if (tag.routeQuery) {
132
+ for (const key in tag.routeQuery) {
133
+ path += key + '=' + tag.routeQuery[key] + '&'
134
+ }
135
+ }
136
+ }
137
+ if (
138
+ path &&
139
+ path.length > 0 &&
140
+ path.lastIndexOf('&') === path.length - 1
141
+ ) {
142
+ path = path.substring(0, path.lastIndexOf('&'))
143
+ }
144
+ return path
145
+ },
146
+ recieveMessage(event) {
147
+ if (
148
+ event &&
149
+ typeof event.data === 'string' &&
150
+ event.data.indexOf('loginTimeout') >= 0
151
+ ) {
152
+ // 表示iframe中的页面发送了登录超时的信号,将信号传给最外层window
153
+ console.log(
154
+ 'tab-content-接收到登录超时的信息---event.data=',
155
+ event.data
156
+ )
157
+ window.parent.postMessage(event.data, '*')
158
+ }
159
+ },
160
+ },
161
+ }
162
+ </script>
163
+
164
+ <style lang="scss" rel="stylesheet/scss" scoped>
165
+ iframe.tab-main-content {
166
+ width: 100%;
167
+ height: calc(100vh - 53px);
168
+ }
169
+ </style>
170
+
171
+ <style>
172
+ .nav-tab {
173
+ padding-top: 5px;
174
+ padding-left: 5px;
175
+ }
176
+ .nav-tab .el-tabs__header {
177
+ margin: 0;
178
+ /* border-bottom: 0px; */
179
+ }
180
+ .menu-tab-container .el-tabs__content {
181
+ padding: 0;
182
+ }
183
+ .default-page-tip {
184
+ width: 100%;
185
+ height: 100%;
186
+ background: #f7f7f8;
187
+ }
188
+ .default-page-tip-msg {
189
+ padding-top: 25%;
190
+ padding-bottom: 30%;
191
+ font-size: 24px;
192
+ font-weight: 600;
193
+ text-align: center;
194
+ color: gray;
195
+ }
196
+ .default-page-tip-item {
197
+ padding-top: 10px;
198
+ }
199
+ </style>