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
@@ -1,29 +1,39 @@
1
- <template>
2
- <section class="app-main">
3
- <transition name="fade-transform" mode="out-in">
4
- <!-- or name="fade" -->
5
- <!-- <router-view :key="key"></router-view> -->
6
- <router-view/>
7
- </transition>
8
- </section>
9
- </template>
10
-
11
- <script>
12
- export default {
13
- name: 'AppMain',
14
- computed: {
15
- // key() {
16
- // return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date()
17
- // }
18
- }
19
- }
20
- </script>
21
-
22
- <style scoped>
23
- .app-main {
24
- /*50 = navbar */
25
- height: calc(100vh - 50px);
26
- position: relative;
27
- overflow: hidden;
28
- }
29
- </style>
1
+ <template>
2
+ <section class="app-main">
3
+ <router-view v-slot="{ Component }">
4
+ <transition name="fade-transform" mode="out-in">
5
+ <component :is="Component"></component>
6
+ </transition>
7
+ </router-view>
8
+ </section>
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ name: 'AppMain',
14
+ computed: {
15
+ // key() {
16
+ // return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date()
17
+ // }
18
+
19
+ // 解决的问题如下:
20
+ // 改变路由参数(page?pageCode=xx)去获取对应数据,然后渲染到页面(用的是同一套组件),
21
+ // 问题来了:当切换菜单时,数据并没有更新,后来看了Vue-router官网,
22
+ // 有这么一句话:提醒一下,当使用路由参数时,例如从 /user/foo 导航到 user/bar,原来的组件实例会被复用。
23
+ // 因为两个路由都渲染同个组件,比起销毁再创建,复用则显得更加高效。不过,这也意味着组件的生命周期钩子不会再被调用
24
+ key() {
25
+ return this.$route.name !== undefined
26
+ ? this.$route.name + +new Date()
27
+ : this.$route + +new Date()
28
+ },
29
+ },
30
+ }
31
+ </script>
32
+
33
+ <style scoped>
34
+ .app-main {
35
+ height: calc(100vh - 10px);
36
+ position: relative;
37
+ overflow: hidden;
38
+ }
39
+ </style>
@@ -0,0 +1,156 @@
1
+ <template>
2
+ <el-breadcrumb class="app-breadcrumb" separator=">">
3
+ <transition-group tag="span" name="breadcrumb">
4
+ <el-breadcrumb-item
5
+ v-for="(item, index) in levelListWithTitle"
6
+ :key="item.path + '-' + index"
7
+ >
8
+ <span class="no-redirect">
9
+ {{ $t(item.meta.title) }}
10
+ </span>
11
+ </el-breadcrumb-item>
12
+ </transition-group>
13
+ </el-breadcrumb>
14
+ </template>
15
+
16
+ <script>
17
+ import * as Vue from 'vue'
18
+ import { getLanguageWithLocale } from '../../../../utils/util'
19
+ import * as pathToRegexp from 'path-to-regexp'
20
+ import Cookies from 'js-cookie'
21
+
22
+ export default {
23
+ name: 'Breadcrumb',
24
+ data() {
25
+ return {
26
+ levelList: null,
27
+ }
28
+ },
29
+ computed: {
30
+ levelListWithTitle() {
31
+ return this.levelList.filter(
32
+ (item) => item.meta.title !== undefined && item.meta.title !== null
33
+ )
34
+ },
35
+ },
36
+ watch: {
37
+ $route() {
38
+ this.getBreadcrumb()
39
+ },
40
+ },
41
+ created() {
42
+ this.getBreadcrumb()
43
+ },
44
+ methods: {
45
+ getBreadcrumb() {
46
+ const { params } = this.$route
47
+ console.log('this.$route.matched==', this.$route.matched)
48
+ let matched = this.$route.matched.filter((item) => {
49
+ if (item.name) {
50
+ // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
51
+ var toPath = pathToRegexp.compile(item.path)
52
+ item.path = toPath(params)
53
+ return true
54
+ }
55
+ })
56
+ // const first = matched[0]
57
+ if (matched) {
58
+ let systemName
59
+ const language = getLanguageWithLocale()
60
+ const systemNameObj =
61
+ window.$vueApp.config.globalProperties.systemNameObj
62
+ if (systemNameObj) {
63
+ systemName = systemNameObj[language]
64
+ }
65
+ matched = [
66
+ { path: '/', redirect: 'noredirect', meta: { title: systemName } },
67
+ ].concat(matched)
68
+ const cookieMenu = Cookies.get('selectMenu')
69
+ const leftSelectMenu =
70
+ window.$vueApp.config.globalProperties._selectMenu
71
+ let selectMenu
72
+ if (leftSelectMenu) {
73
+ selectMenu = leftSelectMenu
74
+ } else if (cookieMenu) {
75
+ selectMenu = cookieMenu
76
+ }
77
+ if (selectMenu) {
78
+ // 解决表单页面无法获得列表路由
79
+ const path = selectMenu.substring(0, selectMenu.indexOf('~~'))
80
+ const title = selectMenu.substring(selectMenu.indexOf('~~') + 2)
81
+ if (matched && matched.length > 0) {
82
+ const lastRoute = matched[matched.length - 1]
83
+ if (this.isShouldConcatLastMenu(title, path, lastRoute)) {
84
+ matched.push({ path: path, meta: { title: title } })
85
+ }
86
+ } else {
87
+ matched.push({ path: path, meta: { title: title } })
88
+ }
89
+ }
90
+ }
91
+ this.levelList = matched
92
+ },
93
+ // 新建页面时会把列表页面路由刷没,导致菜单路径缺少最后一层菜单问题
94
+ isShouldConcatLastMenu(title, path, lastRoute) {
95
+ if (
96
+ this.isTitleNotEqual(title, lastRoute) &&
97
+ this.isPathNotEqual(path, lastRoute)
98
+ ) {
99
+ // title和path都不同,表示是不同的页面,需要添加到matched集合中
100
+ return true
101
+ }
102
+ return false
103
+ },
104
+ /**
105
+ * Vue.prototype._selectMenu的菜单标题是否与最后的路由页面标题一致
106
+ * 返回true表示不一样,返回false表示一样
107
+ */
108
+ isTitleNotEqual(title, lastRoute) {
109
+ if (
110
+ title &&
111
+ lastRoute.meta &&
112
+ title !== lastRoute.meta.title &&
113
+ title !== this.$t(lastRoute.meta.title)
114
+ ) {
115
+ // 表示title不一样,当前可能是在表单页面,需要添加到matched集合中
116
+ return true
117
+ }
118
+ return false
119
+ },
120
+ /**
121
+ * Vue.prototype._selectMenu的菜单的访问路径是否与最后的路由页面的路径一致
122
+ * 返回true表示不一样,返回false表示一样
123
+ */
124
+ isPathNotEqual(path, lastRoute) {
125
+ if (path && lastRoute.path && path !== lastRoute.path) {
126
+ // 表示path不一样,当前可能是在表单页面,需要添加到matched集合中
127
+ return true
128
+ }
129
+ return false
130
+ },
131
+ },
132
+ }
133
+ </script>
134
+
135
+ <style lang="scss" rel="stylesheet/scss" scoped>
136
+ .app-breadcrumb.el-breadcrumb {
137
+ background-color: #eee;
138
+ width: 100%;
139
+ border: 1px solid #ccc;
140
+ bottom: 2px;
141
+ margin-left: 2px;
142
+ display: inline-block;
143
+ font-size: 14px;
144
+ line-height: 40px;
145
+ .no-redirect {
146
+ color: #333;
147
+ cursor: text;
148
+ }
149
+ .el-breadcrumb__item {
150
+ padding-left: 5px;
151
+ }
152
+ .el-breadcrumb__separator {
153
+ margin: 0 5px;
154
+ }
155
+ }
156
+ </style>
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <div>
3
+ <div v-if="icon">
4
+ <div v-if="icon.indexOf('fa-') === 0" style="display: inline-block;overflow:hidden;">
5
+ <i :class="`fa${icon}`"/>
6
+ </div>
7
+ <div v-else-if="icon.indexOf('svg-') === 0" style="display: inline-block;overflow:hidden;">
8
+ <svg-icon :icon-class={icon} />
9
+ </div>
10
+ <div v-else style="display: inline-block;overflow:hidden;">
11
+ <i class="svg-icon" />
12
+ </div>
13
+ </div>
14
+
15
+ <div v-else-if="title">
16
+ <div v-if="isRoot" style="display: inline-block">
17
+ <div
18
+ :title=title
19
+ :style="{'display':'inline-block','width':hasChildren?'100px':'130px','overflow':'hidden','text-overflow':'ellipsis','white-space':'nowrap','word-break':'keep-all'}"
20
+ >
21
+ {{ title }}
22
+ </div>
23
+ </div>
24
+ <div v-else style="display: inline-block">
25
+ <div
26
+ :title=title
27
+ :style="{'display':'inline-block','width':hasChildren?'100px':'130px','overflow':'hidden','text-overflow':'ellipsis','white-space':'nowrap','word-break':'keep-all'}"
28
+ >
29
+ {{ title }}
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </template>
35
+
36
+ <script>
37
+ export default {
38
+ props: {
39
+ icon: {
40
+ type: String,
41
+ default: ''
42
+ },
43
+ title: {
44
+ type: String,
45
+ default: ''
46
+ },
47
+ hasChildren: {
48
+ type: Boolean,
49
+ default: false
50
+ },
51
+ isRoot: {
52
+ type: Boolean,
53
+ default: false
54
+ }
55
+ }
56
+ }
57
+ </script>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div>
3
+ <!-- eslint-disable vue/require-component-is-->
4
+ <!-- <a v-if="isExter" :href="to.path" target="_blank" rel="noopener">
5
+ <slot />
6
+ </a> -->
7
+
8
+ <router-link v-if="!isOpenNewTab" :to="to">
9
+ <slot />
10
+ </router-link>
11
+ <div v-else>
12
+ <slot />
13
+ </div>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ export default {
19
+ props: {
20
+ to: {
21
+ type: Object,
22
+ required: true,
23
+ },
24
+ },
25
+ data() {
26
+ const isExter = this.to.isExternal
27
+ const openWay = this.to.openWay
28
+ let isOpenNewTab = false
29
+ if (openWay && openWay === 'NEW_PAGE_OPEN') {
30
+ isOpenNewTab = true
31
+ }
32
+ return {
33
+ isExter,
34
+ isOpenNewTab,
35
+ }
36
+ },
37
+ }
38
+ </script>
@@ -0,0 +1,164 @@
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="item.fullPath + '~~' + item.i18nValue"
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 v-else :index="item.fullPath + '~~' + item.i18nValue">
19
+ <template v-slot:title>
20
+ <item
21
+ :icon="item.iconName"
22
+ :title="getI18nName(item)"
23
+ :has-children="item.children.length > 0 ? true : false"
24
+ />
25
+ </template>
26
+
27
+ <template v-for="child in item.children">
28
+ <sidebar-item
29
+ v-if="child.children && child.children.length > 0"
30
+ :is-nest="true"
31
+ :item="child"
32
+ class="nest-menu"
33
+ />
34
+ <app-link v-else :to="toPath(child)" @click="clickMenu(toPath(child))">
35
+ <el-menu-item :index="child.fullPath + '~~' + child.i18nValue">
36
+ <item :icon="child.iconName" :title="getI18nName(child)" />
37
+ </el-menu-item>
38
+ </app-link>
39
+ </template>
40
+ </el-sub-menu>
41
+ </div>
42
+ </template>
43
+
44
+ <script>
45
+ import Item from './Item.vue'
46
+ import AppLink from './Link.vue'
47
+ import * as Vue from 'vue'
48
+ import { getI18nName } from 'imatrix-ui/src/utils/menu'
49
+ import tabJs from '../../../../api/tab'
50
+
51
+ export default {
52
+ name: 'SidebarItem',
53
+ components: { Item, AppLink },
54
+ props: {
55
+ // route object
56
+ item: {
57
+ type: Object,
58
+ required: true,
59
+ },
60
+ isNest: {
61
+ type: Boolean,
62
+ default: false,
63
+ },
64
+ basePath: {
65
+ type: String,
66
+ default: '',
67
+ },
68
+ },
69
+ data() {
70
+ return {
71
+ onlyOneChild: null,
72
+ }
73
+ },
74
+ methods: {
75
+ ...tabJs,
76
+ hasOneShowingChild(children, parent) {
77
+ if (children && children.length > 0) {
78
+ this.onlyOneChild = children[0]
79
+ }
80
+ // When there is only one child router, the child router is displayed by default
81
+ if (children.length === 1) {
82
+ return true
83
+ }
84
+
85
+ // Show parent if there are no child router to display
86
+ if (!children || children.length === 0) {
87
+ // children不存在
88
+ this.onlyOneChild = { ...parent, path: '', noShowingChildren: true }
89
+ return true
90
+ }
91
+
92
+ return false
93
+ },
94
+ toPath(menu) {
95
+ const toPathObj = {}
96
+ const routePath = menu.fullPath
97
+ toPathObj.openWay = menu.openWay
98
+ if (this.isExternalLink(menu.pageType)) {
99
+ toPathObj.path = '/tab-content-iframe-index'
100
+ toPathObj.tabPath = '/iframe-page/page'
101
+ toPathObj.query = {}
102
+ toPathObj.query.src = routePath
103
+ toPathObj.isExternal = true
104
+ // 如果路径中没有拼系统编码,才需要把系统编码放到参数中
105
+ toPathObj.query.customSystem =
106
+ window.$vueApp.config.globalProperties.customSystem
107
+ toPathObj.query._menuCode = menu.code
108
+ toPathObj.query._menuName = getI18nName(menu)
109
+ } else {
110
+ toPathObj.path = '/tab-content-index'
111
+ toPathObj.tabPath = routePath
112
+ toPathObj.query = {}
113
+ toPathObj.query.customSystem =
114
+ window.$vueApp.config.globalProperties.customSystem
115
+ toPathObj.query._menuCode = menu.code
116
+ toPathObj.query._menuName = getI18nName(menu)
117
+ }
118
+ return toPathObj
119
+ },
120
+ isExternalLink(pageType) {
121
+ if (pageType && pageType === 'iframe') {
122
+ return true
123
+ }
124
+ return false
125
+ },
126
+ clickMenu(toPathObj) {
127
+ // console.log('clickMenu----toPathObj=', toPathObj)
128
+ if (
129
+ toPathObj.openWay &&
130
+ toPathObj.openWay === 'NEW_PAGE_OPEN' &&
131
+ toPathObj.query
132
+ ) {
133
+ // 新页签打开菜单
134
+ let url = toPathObj.query.src
135
+ if (url && url.indexOf('?') > 0) {
136
+ url += '&'
137
+ } else {
138
+ url += '?'
139
+ }
140
+ if (toPathObj.query.customSystem) {
141
+ url += 'customSystem=' + toPathObj.query.customSystem
142
+ }
143
+ if (toPathObj.query._menuCode) {
144
+ url += '_menuCode=' + toPathObj.query._menuCode
145
+ }
146
+ if (toPathObj.query._menuCode) {
147
+ url += '_menuName=' + toPathObj.query._menuName
148
+ }
149
+ window.open(url, toPathObj.query._menuCode)
150
+ } else {
151
+ // 刷新页签打开菜单
152
+ this.addTabs(
153
+ toPathObj.query,
154
+ this.$store.state.tabContent.openTab,
155
+ toPathObj.tabPath
156
+ )
157
+ }
158
+ },
159
+ getI18nName(menu) {
160
+ return getI18nName(menu)
161
+ },
162
+ },
163
+ }
164
+ </script>
@@ -0,0 +1,210 @@
1
+ <template>
2
+ <div>
3
+ <el-scrollbar wrap-class="scrollbar-wrapper">
4
+ <el-menu
5
+ :show-timeout="200"
6
+ :default-active="defaultActive ? defaultActive : ''"
7
+ :collapse="isCollapse"
8
+ mode="vertical"
9
+ @select="selectMenu"
10
+ >
11
+ <el-menu-item
12
+ v-if="systemName"
13
+ :title="systemName"
14
+ index="1"
15
+ disabled
16
+ class="system-item"
17
+ style="padding-left: 10px"
18
+ >
19
+ {{ systemName }}
20
+ </el-menu-item>
21
+ <sidebar-item v-for="menu in menus" :key="menu.code" :item="menu" />
22
+ </el-menu>
23
+ </el-scrollbar>
24
+ <hamburger
25
+ :is-active="sidebar.opened"
26
+ class="hamburger-container"
27
+ @toggleClick="toggleSideBar"
28
+ />
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+ import { mapGetters } from 'vuex'
34
+ import SidebarItem from './SidebarItem.vue'
35
+ import * as Vue from 'vue'
36
+ import { getLanguageWithLocale } from '../../../../utils/util'
37
+ import { isShowSystemMenu } from '../../../../utils/common-util'
38
+ import tabJs from '../../../../api/tab'
39
+ import { getI18nName } from '../../../../utils/menu'
40
+ import Cookies from 'js-cookie'
41
+ import { getMenus } from '../../../../utils/permissionAuth'
42
+ export default {
43
+ name: 'Menubar',
44
+ components: {
45
+ SidebarItem,
46
+ },
47
+ props: {
48
+ systemCode: {
49
+ type: String,
50
+ default: null,
51
+ },
52
+ collapse: {
53
+ type: Boolean,
54
+ default: false,
55
+ },
56
+ },
57
+ data() {
58
+ let systemName
59
+ if (isShowSystemMenu() === true) {
60
+ const language = getLanguageWithLocale()
61
+ const systemNameObj = window.$vueApp.config.globalProperties.systemNameObj
62
+ if (systemNameObj) {
63
+ systemName = systemNameObj[language]
64
+ }
65
+ }
66
+ const menus = getMenus()
67
+ return {
68
+ firstLeafMenu: null, // 第一个有权限的叶子菜单,用于默认展开第一个父菜单
69
+ systemName,
70
+ defaultActive: '',
71
+ menus,
72
+ }
73
+ },
74
+ computed: {
75
+ ...mapGetters(['sidebar']),
76
+ isCollapse() {
77
+ if (this.collapse === false) {
78
+ return !this.sidebar.opened
79
+ }
80
+ return true
81
+ },
82
+ },
83
+ watch: {
84
+ $route() {
85
+ this.firstLeafMenu = this.getFirstMenu(this.menus)
86
+ if (this.firstLeafMenu) {
87
+ // Breadcrumb组件需要使用Vue.prototype._selectMenu的值,格式为:fullPath~~title
88
+ this.defaultActive =
89
+ this.firstLeafMenu.fullPath + '~~' + this.firstLeafMenu.i18nValue
90
+ window.$vueApp.config.globalProperties._selectMenu = this.defaultActive
91
+ }
92
+ },
93
+ },
94
+ created() {
95
+ this.firstLeafMenu = this.getFirstMenu(this.menus)
96
+ if (this.firstLeafMenu) {
97
+ // Breadcrumb组件需要使用Vue.prototype._selectMenu的值,格式为:fullPath~~title
98
+ this.defaultActive =
99
+ this.firstLeafMenu.fullPath + '~~' + this.firstLeafMenu.i18nValue
100
+ window.$vueApp.config.globalProperties._selectMenu = this.defaultActive
101
+ }
102
+ if (this.firstLeafMenu && this.firstLeafMenu.fullPath) {
103
+ // 跳转到第一个页面
104
+ if (
105
+ this.firstLeafMenu.pageType &&
106
+ this.firstLeafMenu.pageType === 'iframe'
107
+ ) {
108
+ const iframeSrc = this.firstLeafMenu.fullPath
109
+ // this.$router.push({ path: '/iframe-page/page', query: { src: iframeSrc }})
110
+ const query = {
111
+ src: iframeSrc,
112
+ customSystem: this.systemCode,
113
+ _menuCode: this.firstLeafMenu.code,
114
+ _menuName: getI18nName(this.firstLeafMenu),
115
+ }
116
+ this.addTabs(
117
+ query,
118
+ this.$store.state.tabContent.openTab,
119
+ '/iframe-page/page',
120
+ '/iframe-page/page'
121
+ )
122
+ // this.$router.push({ path: '/iframe-page/page', query: query })
123
+ this.$router.push({ path: '/tab-content-iframe-index', query: query })
124
+ } else {
125
+ const query = {
126
+ customSystem: this.systemCode,
127
+ _menuCode: this.firstLeafMenu.code,
128
+ _menuName: getI18nName(this.firstLeafMenu),
129
+ }
130
+ const path = this.firstLeafMenu.fullPath
131
+ this.addTabs(query, this.$store.state.tabContent.openTab, path, path)
132
+ this.$router.push({ path: '/tab-content-index', query: query })
133
+ // this.$router.push({ path: this.firstLeafMenu.fullPath })
134
+ }
135
+ }
136
+ },
137
+ methods: {
138
+ ...tabJs,
139
+ toggleSideBar() {
140
+ this.$store.dispatch('toggleSidebar')
141
+ },
142
+ selectMenu(index, indexPath) {
143
+ window.$vueApp.config.globalProperties._selectMenu = index
144
+ Cookies.set('selectMenu', index)
145
+ },
146
+ getFirstMenu(menus) {
147
+ if (menus && menus.length > 0) {
148
+ let shouldSelectMenu
149
+ for (let i = 0; i < menus.length; i++) {
150
+ const menu = menus[i]
151
+ shouldSelectMenu = this.getShouldSelectMenu(menu)
152
+ if (shouldSelectMenu) {
153
+ // 表示获得到了应该选中的菜单
154
+ break
155
+ }
156
+ }
157
+ // if (!shouldSelectMenu) {
158
+ // // 如果没有获得默认选中的菜单,则默认选中第一个菜单
159
+ // shouldSelectMenu = this.getSelectMenuWithFirstMenu(menus[0])
160
+ // }
161
+ return shouldSelectMenu
162
+ }
163
+ },
164
+ getShouldSelectMenu(menu) {
165
+ const currentMenuCode = this.$route.query
166
+ ? this.$route.query._menuCode
167
+ : null
168
+ if (menu && currentMenuCode) {
169
+ let shouldSelectMenu
170
+ const children = menu.children
171
+ if (children && children.length > 0) {
172
+ shouldSelectMenu = this.getFirstMenu(children)
173
+ } else if (menu.code && menu.code === currentMenuCode) {
174
+ shouldSelectMenu = menu
175
+ }
176
+ return shouldSelectMenu
177
+ }
178
+ // if (menu) {
179
+ // const cookieMenu = Cookies.get('selectMenu')
180
+ // let currentRoute = this.$route.path
181
+ // if (cookieMenu && cookieMenu.indexOf('~~') > 0) {
182
+ // // cookie中记录了选中的菜单路径
183
+ // const path = cookieMenu.substring(0, cookieMenu.lastIndexOf('~~'))
184
+ // currentRoute = path
185
+ // }
186
+ // let shouldSelectMenu
187
+ // const children = menu.children
188
+ // if (children && children.length > 0) {
189
+ // shouldSelectMenu = this.getFirstMenu(children)
190
+ // } else if (menu.fullPath && menu.fullPath === currentRoute) {
191
+ // shouldSelectMenu = menu
192
+ // }
193
+ // return shouldSelectMenu
194
+ // }
195
+ },
196
+ getSelectMenuWithFirstMenu(menu) {
197
+ if (menu) {
198
+ let shouldSelectMenu
199
+ const children = menu.children
200
+ if (children && children.length > 0) {
201
+ shouldSelectMenu = this.getFirstMenu(children)
202
+ } else {
203
+ shouldSelectMenu = menu
204
+ }
205
+ return shouldSelectMenu
206
+ }
207
+ },
208
+ },
209
+ }
210
+ </script>