imatrix-ui 0.2.4-up → 0.2.6-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.
@@ -190,7 +190,8 @@
190
190
  }
191
191
 
192
192
  .el-pagination {
193
- text-align: right;
193
+ display: flex;
194
+ justify-content: flex-end;
194
195
  }
195
196
 
196
197
  .el-table td {
@@ -209,7 +210,7 @@
209
210
  /**表格内容纵向分隔线去掉**/
210
211
  .el-table--border td,
211
212
  .el-table--border th,
212
- .el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed {
213
+ .el-table__body-wrapper .el-table--border.is-scrolling-left ~ .el-table__fixed {
213
214
  border-right: 0px
214
215
  }
215
216
 
@@ -217,7 +218,7 @@
217
218
  .el-table--border td,
218
219
  .el-table--border th,
219
220
  .el-table--border th.is-leaf,
220
- .el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed {
221
+ .el-table__body-wrapper .el-table--border.is-scrolling-left ~ .el-table__fixed {
221
222
  border-right: 1px solid #fefefe;
222
223
  }
223
224
 
@@ -231,7 +232,7 @@
231
232
  text-align: left;
232
233
  }
233
234
 
234
- .el-button+.el-button {
235
+ .el-button + .el-button {
235
236
  margin-left: 10px;
236
237
  }
237
238
 
@@ -269,4 +270,4 @@
269
270
  border-radius: 0;
270
271
  box-shadow: 0 0px 0px #ccc;
271
272
  }
272
- }
273
+ }
@@ -1,4 +1,4 @@
1
- import * as Cookies from 'js-cookie'
1
+ import Cookies from 'js-cookie'
2
2
  // const Cookies = require('js-cookie')
3
3
 
4
4
  const jwtKey = 'JWT'
@@ -71,7 +71,8 @@ function removeCurrentUser() {
71
71
  }
72
72
 
73
73
  function getCookieCache(key) {
74
- console.log('%c描述-120304', 'color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px', Cookies);
74
+ console.log('%c描述-173122', 'color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px', Cookies);
75
+ console.dir(Cookies);
75
76
  return Cookies.get(key)
76
77
  }
77
78
 
@@ -1,228 +1,229 @@
1
1
  <template>
2
- <div>
3
- <el-scrollbar wrap-class="scrollbar-wrapper">
4
- <keep-alive>
5
- <el-menu
6
- :show-timeout="200"
7
- :default-active="getDefaultActive()"
8
- :collapse="isCollapse"
9
- mode="vertical"
10
- @select="selectMenu"
11
- >
12
- <sidebar-item v-for="menu in menus" :key="menu.code" :item="menu" />
13
- </el-menu>
14
- </keep-alive>
15
- </el-scrollbar>
16
- <hamburger
17
- :is-active="sidebar.opened"
18
- class="hamburger-container"
19
- @toggleClick="toggleSideBar"
20
- />
21
- </div>
2
+ <div>
3
+ <el-scrollbar wrap-class="scrollbar-wrapper">
4
+ <keep-alive>
5
+ <el-menu
6
+ :collapse="isCollapse"
7
+ :default-active="getDefaultActive()"
8
+ :show-timeout="200"
9
+ mode="vertical"
10
+ @select="selectMenu"
11
+ >
12
+ <sidebar-item v-for="menu in menus" :key="menu.code" :item="menu"/>
13
+ </el-menu>
14
+ </keep-alive>
15
+ </el-scrollbar>
16
+ <hamburger
17
+ :is-active="sidebar.opened"
18
+ class="hamburger-container"
19
+ @toggleClick="toggleSideBar"
20
+ />
21
+ </div>
22
22
  </template>
23
23
 
24
24
  <script>
25
- import { mapGetters } from 'vuex'
25
+ import {mapGetters} from 'vuex'
26
26
  import SidebarItem from './SidebarItem'
27
- import * as Cookies from 'js-cookie'
27
+ import Cookies from 'js-cookie'
28
28
  import tabJs from '../../../api/tab'
29
- import { getMenus } from '../../../utils/permissionAuth'
30
- import { getI18nName } from '../../../utils/menu'
29
+ import {getMenus} from '../../../utils/permissionAuth'
30
+ import {getI18nName} from '../../../utils/menu'
31
+
31
32
  export default {
32
- name: 'Sidebar',
33
- components: {
34
- SidebarItem,
35
- },
36
- props: {
37
- systemCode: {
38
- type: String,
39
- default: null,
40
- },
41
- collapse: {
42
- type: Boolean,
43
- default: false,
44
- },
45
- },
46
- data() {
47
- const menus = getMenus()
48
- return {
49
- menus: Object.freeze(menus),
50
- }
51
- },
52
- computed: {
53
- ...mapGetters(['sidebar']),
54
- isCollapse() {
55
- if (this.collapse === false) {
56
- return !this.sidebar.opened
57
- }
58
- return true
59
- },
60
- },
61
- created() {
62
- const a = new Date().getTime()
63
- this.firstLeafMenu = this.getMyFirstMenu(this.menus)
64
- if (this.firstLeafMenu && this.firstLeafMenu.fullPath) {
65
- // 跳转到第一个页面
66
- if (
67
- this.firstLeafMenu.pageType &&
68
- this.firstLeafMenu.pageType === 'iframe'
69
- ) {
70
- const iframeSrc = this.firstLeafMenu.fullPath
71
- const path = this.firstLeafMenu.path
72
- const query = {
73
- src: iframeSrc,
74
- customSystem: this.systemCode,
75
- path: path,
76
- _menuCode: this.firstLeafMenu.code,
77
- _menuName: getI18nName(this.firstLeafMenu),
78
- }
79
- this.addTabs(
80
- query,
81
- this.$store.state.tabContent.openTab,
82
- '/dsc/iframe-page',
83
- '/dsc/iframe-page'
84
- )
85
- this.$router.push({ path: '/dsc-index/iframe-page', query: query })
86
- } else {
87
- const pageCode = this.firstLeafMenu.path
88
- const query = {
89
- customSystem: this.systemCode,
90
- pageCode: pageCode,
91
- _menuCode: this.firstLeafMenu.code,
92
- _menuName: getI18nName(this.firstLeafMenu),
93
- }
94
- this.addTabs(
95
- query,
96
- this.$store.state.tabContent.openTab,
97
- '/dsc/page',
98
- '/dsc/page'
99
- )
100
- this.$router.push({ path: '/dsc-index/page', query: query })
101
- // this.$router.push({ path: this.firstLeafMenu.fullPath })
102
- }
103
- const b = new Date().getTime()
104
- console.log('菜单组件==>created==>b-a', b - a)
105
- }
106
- },
107
- methods: {
108
- ...tabJs,
109
- getDefaultActive() {
110
- if (this.firstLeafMenu && this.firstLeafMenu.pageType !== 'iframe') {
111
- const pageCode = this.firstLeafMenu.path
112
- return '/dsc/' + this.firstLeafMenu.code + '~~' + pageCode
113
- } else if (
114
- this.firstLeafMenu &&
115
- this.firstLeafMenu.pageType === 'iframe'
116
- ) {
117
- return '/dsc/' + this.firstLeafMenu.code + '~~'
118
- } else {
119
- return ''
120
- }
121
- },
122
- toggleSideBar() {
123
- this.$store.dispatch('toggleSidebar')
124
- },
125
- selectMenu(index, indexPath) {
126
- Cookies.set('selectMenu', index)
127
- },
128
- getMyFirstMenu(menus) {
129
- const a = new Date().getTime()
130
- if (menus && menus.length > 0) {
131
- let shouldSelectMenu = this.getFirstMenu(menus)
132
- if (!shouldSelectMenu) {
133
- shouldSelectMenu = this.getFirstMenuWithCookie(menus)
134
- }
135
- const b = new Date().getTime()
136
- console.log('菜单组件==>getMyFirstMenu==>b-a', b - a)
137
- // 默认不展示第一个有权限的菜单了,可以去掉下面的代码
138
- // if (!shouldSelectMenu) {
139
- // shouldSelectMenu = this.getSelectMenuWithFirstMenu(menus[0])
140
- // }
141
- return shouldSelectMenu
142
- }
143
- },
144
- getFirstMenu(menus) {
145
- if (menus && menus.length > 0) {
146
- let shouldSelectMenu
147
- for (let i = 0; i < menus.length; i++) {
148
- const menu = menus[i]
149
- shouldSelectMenu = this.getShouldSelectMenu(menu)
150
- if (shouldSelectMenu) {
151
- // 表示获得到了应该选中的菜单
152
- break
153
- }
154
- }
155
- return shouldSelectMenu
156
- }
157
- },
158
- getShouldSelectMenu(menu) {
159
- // console.log('dsc--getShouldSelectMenu--this.$route=', this.$route)
160
- const currentMenuCode = this.$route.query
161
- ? this.$route.query._menuCode
162
- : null
163
- if (menu && currentMenuCode) {
164
- let shouldSelectMenu
165
- const children = menu.children
166
- if (children && children.length > 0) {
167
- shouldSelectMenu = this.getFirstMenu(children)
168
- } else if (menu.code && menu.code === currentMenuCode) {
169
- shouldSelectMenu = menu
170
- }
171
- return shouldSelectMenu
172
- }
173
- },
174
- getSelectMenuWithFirstMenu(menu) {
175
- if (menu) {
176
- let shouldSelectMenu
177
- const children = menu.children
178
- if (children && children.length > 0) {
179
- shouldSelectMenu = this.getFirstMenu(children)
180
- } else {
181
- shouldSelectMenu = menu
182
- }
183
- return shouldSelectMenu
184
- }
185
- },
186
- getFirstMenuWithCookie(menus) {
187
- if (menus && menus.length > 0) {
188
- const cookieMenu = Cookies.get('selectMenu')
189
- if (cookieMenu) {
190
- // // 表示缓存中存储了menu,格式为:/dsc/菜单编码~~pageCode
191
- const prefix = '/dsc/'
192
- const menuCode = cookieMenu.substring(
193
- cookieMenu.indexOf(prefix) + prefix.length,
194
- cookieMenu.lastIndexOf('~~')
195
- )
33
+ name: 'Sidebar',
34
+ components: {
35
+ SidebarItem,
36
+ },
37
+ props: {
38
+ systemCode: {
39
+ type: String,
40
+ default: null,
41
+ },
42
+ collapse: {
43
+ type: Boolean,
44
+ default: false,
45
+ },
46
+ },
47
+ data() {
48
+ const menus = getMenus()
49
+ return {
50
+ menus: Object.freeze(menus),
51
+ }
52
+ },
53
+ computed: {
54
+ ...mapGetters(['sidebar']),
55
+ isCollapse() {
56
+ if (this.collapse === false) {
57
+ return !this.sidebar.opened
58
+ }
59
+ return true
60
+ },
61
+ },
62
+ created() {
63
+ const a = new Date().getTime()
64
+ this.firstLeafMenu = this.getMyFirstMenu(this.menus)
65
+ if (this.firstLeafMenu && this.firstLeafMenu.fullPath) {
66
+ // 跳转到第一个页面
67
+ if (
68
+ this.firstLeafMenu.pageType &&
69
+ this.firstLeafMenu.pageType === 'iframe'
70
+ ) {
71
+ const iframeSrc = this.firstLeafMenu.fullPath
72
+ const path = this.firstLeafMenu.path
73
+ const query = {
74
+ src: iframeSrc,
75
+ customSystem: this.systemCode,
76
+ path: path,
77
+ _menuCode: this.firstLeafMenu.code,
78
+ _menuName: getI18nName(this.firstLeafMenu),
79
+ }
80
+ this.addTabs(
81
+ query,
82
+ this.$store.state.tabContent.openTab,
83
+ '/dsc/iframe-page',
84
+ '/dsc/iframe-page'
85
+ )
86
+ this.$router.push({path: '/dsc-index/iframe-page', query: query})
87
+ } else {
88
+ const pageCode = this.firstLeafMenu.path
89
+ const query = {
90
+ customSystem: this.systemCode,
91
+ pageCode: pageCode,
92
+ _menuCode: this.firstLeafMenu.code,
93
+ _menuName: getI18nName(this.firstLeafMenu),
94
+ }
95
+ this.addTabs(
96
+ query,
97
+ this.$store.state.tabContent.openTab,
98
+ '/dsc/page',
99
+ '/dsc/page'
100
+ )
101
+ this.$router.push({path: '/dsc-index/page', query: query})
102
+ // this.$router.push({ path: this.firstLeafMenu.fullPath })
103
+ }
104
+ const b = new Date().getTime()
105
+ console.log('菜单组件==>created==>b-a', b - a)
106
+ }
107
+ },
108
+ methods: {
109
+ ...tabJs,
110
+ getDefaultActive() {
111
+ if (this.firstLeafMenu && this.firstLeafMenu.pageType !== 'iframe') {
112
+ const pageCode = this.firstLeafMenu.path
113
+ return '/dsc/' + this.firstLeafMenu.code + '~~' + pageCode
114
+ } else if (
115
+ this.firstLeafMenu &&
116
+ this.firstLeafMenu.pageType === 'iframe'
117
+ ) {
118
+ return '/dsc/' + this.firstLeafMenu.code + '~~'
119
+ } else {
120
+ return ''
121
+ }
122
+ },
123
+ toggleSideBar() {
124
+ this.$store.dispatch('toggleSidebar')
125
+ },
126
+ selectMenu(index, indexPath) {
127
+ Cookies.set('selectMenu', index)
128
+ },
129
+ getMyFirstMenu(menus) {
130
+ const a = new Date().getTime()
131
+ if (menus && menus.length > 0) {
132
+ let shouldSelectMenu = this.getFirstMenu(menus)
133
+ if (!shouldSelectMenu) {
134
+ shouldSelectMenu = this.getFirstMenuWithCookie(menus)
135
+ }
136
+ const b = new Date().getTime()
137
+ console.log('菜单组件==>getMyFirstMenu==>b-a', b - a)
138
+ // 默认不展示第一个有权限的菜单了,可以去掉下面的代码
139
+ // if (!shouldSelectMenu) {
140
+ // shouldSelectMenu = this.getSelectMenuWithFirstMenu(menus[0])
141
+ // }
142
+ return shouldSelectMenu
143
+ }
144
+ },
145
+ getFirstMenu(menus) {
146
+ if (menus && menus.length > 0) {
147
+ let shouldSelectMenu
148
+ for (let i = 0; i < menus.length; i++) {
149
+ const menu = menus[i]
150
+ shouldSelectMenu = this.getShouldSelectMenu(menu)
151
+ if (shouldSelectMenu) {
152
+ // 表示获得到了应该选中的菜单
153
+ break
154
+ }
155
+ }
156
+ return shouldSelectMenu
157
+ }
158
+ },
159
+ getShouldSelectMenu(menu) {
160
+ // console.log('dsc--getShouldSelectMenu--this.$route=', this.$route)
161
+ const currentMenuCode = this.$route.query
162
+ ? this.$route.query._menuCode
163
+ : null
164
+ if (menu && currentMenuCode) {
165
+ let shouldSelectMenu
166
+ const children = menu.children
167
+ if (children && children.length > 0) {
168
+ shouldSelectMenu = this.getFirstMenu(children)
169
+ } else if (menu.code && menu.code === currentMenuCode) {
170
+ shouldSelectMenu = menu
171
+ }
172
+ return shouldSelectMenu
173
+ }
174
+ },
175
+ getSelectMenuWithFirstMenu(menu) {
176
+ if (menu) {
177
+ let shouldSelectMenu
178
+ const children = menu.children
179
+ if (children && children.length > 0) {
180
+ shouldSelectMenu = this.getFirstMenu(children)
181
+ } else {
182
+ shouldSelectMenu = menu
183
+ }
184
+ return shouldSelectMenu
185
+ }
186
+ },
187
+ getFirstMenuWithCookie(menus) {
188
+ if (menus && menus.length > 0) {
189
+ const cookieMenu = Cookies.get('selectMenu')
190
+ if (cookieMenu) {
191
+ // // 表示缓存中存储了menu,格式为:/dsc/菜单编码~~pageCode
192
+ const prefix = '/dsc/'
193
+ const menuCode = cookieMenu.substring(
194
+ cookieMenu.indexOf(prefix) + prefix.length,
195
+ cookieMenu.lastIndexOf('~~')
196
+ )
196
197
 
197
- let shouldSelectMenu
198
- for (let i = 0; i < menus.length; i++) {
199
- const menu = menus[i]
200
- shouldSelectMenu = this.getShouldSelectMenuWithCookie(
201
- menu,
202
- menuCode
203
- )
204
- if (shouldSelectMenu) {
205
- // 表示获得到了应该选中的菜单
206
- break
207
- }
208
- }
209
- return shouldSelectMenu
210
- }
211
- }
212
- },
213
- getShouldSelectMenuWithCookie(menu, menuCode) {
214
- if (menu) {
215
- // console.log('dsc--getShouldSelectMenuWithCookie--this.$route=', this.$route)
216
- let shouldSelectMenu
217
- const children = menu.children
218
- if (children && children.length > 0) {
219
- shouldSelectMenu = this.getFirstMenuWithCookie(children)
220
- } else if (menu.code && menu.code === menuCode) {
221
- shouldSelectMenu = menu
222
- }
223
- return shouldSelectMenu
224
- }
225
- },
226
- },
198
+ let shouldSelectMenu
199
+ for (let i = 0; i < menus.length; i++) {
200
+ const menu = menus[i]
201
+ shouldSelectMenu = this.getShouldSelectMenuWithCookie(
202
+ menu,
203
+ menuCode
204
+ )
205
+ if (shouldSelectMenu) {
206
+ // 表示获得到了应该选中的菜单
207
+ break
208
+ }
209
+ }
210
+ return shouldSelectMenu
211
+ }
212
+ }
213
+ },
214
+ getShouldSelectMenuWithCookie(menu, menuCode) {
215
+ if (menu) {
216
+ // console.log('dsc--getShouldSelectMenuWithCookie--this.$route=', this.$route)
217
+ let shouldSelectMenu
218
+ const children = menu.children
219
+ if (children && children.length > 0) {
220
+ shouldSelectMenu = this.getFirstMenuWithCookie(children)
221
+ } else if (menu.code && menu.code === menuCode) {
222
+ shouldSelectMenu = menu
223
+ }
224
+ return shouldSelectMenu
225
+ }
226
+ },
227
+ },
227
228
  }
228
229
  </script>