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,264 @@
1
+ const en = {
2
+ imatrixUIPublicModel: {
3
+ sure: 'Sure',
4
+ cancel: 'Cancel',
5
+ allDepartments: 'All Departments',
6
+ allUsers: 'All Users',
7
+ reset: 'Reset',
8
+ to: 'To',
9
+ edit: 'Edit',
10
+ clear: 'Clear',
11
+ download: 'Download',
12
+ delete: 'Delete',
13
+ preview: 'Preview',
14
+ add: 'Add',
15
+ graphView: 'Graphic view',
16
+ listView: 'List View',
17
+ fieldName: 'Field Name',
18
+ operator: 'Operator',
19
+ value: 'Value',
20
+ andOr: 'And/Or',
21
+ whenTheVariableIsEmpty: 'When The Variable Is Empty',
22
+ perhaps: 'Perhaps',
23
+ also: 'Also',
24
+ greaterThan: 'Greater Than',
25
+ lessThan: 'Less Than',
26
+ beEqualTo: 'Be Equal To',
27
+ notGreaterThan: 'Not Greater Than',
28
+ notLessThan: 'Not Less Than',
29
+ notEqualTo: 'Not Equal To',
30
+ contain: 'Contain',
31
+ notIncluded: 'Not Included',
32
+ laterThan: 'Later Than',
33
+ earlierThan: 'Earlier Than',
34
+ noLaterThan: 'No Later Than',
35
+ noEarlierThan: 'No Earlier Than',
36
+ ignore11: 'Ignore (1 = 1)',
37
+ nonConformity: 'Non Conformity (1 < > 1)',
38
+ switchToNormalQuery: 'Switch To Normal Query',
39
+ switchToAdvancedQuery: 'Switch To Advanced Query',
40
+ isNull: 'Is Null',
41
+ isNotNull: 'Is Not Null',
42
+ previewImage: 'Preview image',
43
+ fullScreen: 'Full Screen',
44
+ },
45
+ imatrixUIMessage: {
46
+ whetherToConfirmDeletion: 'Whether To Confirm Deletion',
47
+ tips: 'Tips',
48
+ pleaseEnterContent: 'Please Enter Content',
49
+ internalServerError: 'Server error',
50
+ pleaseSelectDepartment: 'Please Select Department',
51
+ pleaseSelectPersonnel: 'Please Select Personnel',
52
+ pleaseRemoveallpersonnelBeforeSelectingSpecificPersonnel:
53
+ 'Please Remove All Personnel Before Selecting Specific Personnel',
54
+ queryResultIsEmpty: 'Query Result Is Empty',
55
+ pleaseSelectATeam: 'Please Select A Team',
56
+ pleaseEnterTeamName: 'Please Enter Team Name',
57
+ validationFailed: 'Validation Failed',
58
+ selectionDate: 'Selection Date',
59
+ selectTime: 'Select Time',
60
+ pleaseEnterATimePoint: 'Please Enter A Time Point',
61
+ pleaseSelect: 'Please Select',
62
+ startDate: 'Start Date',
63
+ endDate: 'End Date',
64
+ noExportColumnsConfigured: 'No Export Columns Configured',
65
+ organizationTreeNoResultNotRemove:
66
+ 'No information selected, no need to remove',
67
+ exceedFileSize: 'File size limit {filesize} M exceeded',
68
+ upload: 'Upload',
69
+ invalideDoubleValue: '{num} is not a legal decimal',
70
+ noJumpPage: 'Jump page not configured',
71
+ saveSuccessfully: 'Savee successfully',
72
+ pleaseInputSearchCondition: 'Please enter the query criteria',
73
+ fileUpload: 'File Upload',
74
+ selectYear: 'Select Year',
75
+ search: 'Search',
76
+ forbiddenException: 'You do not have permission to access this resource',
77
+ theButtonIsNotBoundToAResource:
78
+ 'The button is not bound to a resource, Bind the resource first',
79
+ asyncExport: 'Asynchronous export, please wait for message notification!',
80
+ },
81
+ superGrid: {
82
+ columnConfig: 'Column Config',
83
+ pleaseSaveOrCancelEditingLine:
84
+ 'Please Save Or Cancel Editing Line {row} Data First',
85
+ pleaseSaveLine: 'Please Save Line {row} Data First',
86
+ noNeedToSaveRow: 'No Need To Save Row {row} Data',
87
+ pleaseSetURLToSaveRowInformation:
88
+ 'Please set "URL to save row information"',
89
+ lineSavedSuccessfully: 'Line {row} Saved Successfully',
90
+ theReturnValueOfTheBeforesaveCallbackMethodIsFalse:
91
+ 'The Return Value Of The Beforesave Callback Method Is False',
92
+ lineNoNeedToUndoEdit: 'Line {row} No Need To Undo Edit',
93
+ lineCancelledSuccessfully: 'Line {row} cancelled successfully',
94
+ label: 'Label',
95
+ isShow: 'Is Show',
96
+ isExportable: 'Is Exportable',
97
+ recordLine: 'Record line {row}',
98
+ pageRecordLine: 'Record in row {row} of page {pageNum}',
99
+ fileName: 'File Name',
100
+ deleteSuccessful: 'Deleted successfully',
101
+ index: 'No.',
102
+ searchConditionName: 'Search Condition Name',
103
+ pleaseInputSearchConditionName:
104
+ 'Please enter the name of the query criteria',
105
+ saveCondition: 'Save Condition',
106
+ saveConditionTitle: 'Save Condition',
107
+ displayOrder: 'Display Order',
108
+ width: 'Column Width',
109
+ default: 'Default',
110
+ custom: 'Custom',
111
+ show: 'Show',
112
+ hidden: 'Hidden',
113
+ export: 'Export',
114
+ unExport: 'Not Export',
115
+ whetherToConfirmReset: 'Are you sure you want to reset?',
116
+ resetSuccessful: 'Reset successfully',
117
+ dragColumnOrderMessage: 'Supports dragging to change column order',
118
+ selectAll: 'Select All',
119
+ viewImage: 'View Image',
120
+ previewTitleWhenNotImg: 'Non picture format, preview in other ways',
121
+ refresh: 'Refresh',
122
+ open: 'Open',
123
+ fold: 'Fold',
124
+ },
125
+ departmentTree: {},
126
+ departmentTreeInline: {
127
+ pleaseEnterDepartmentName: 'Please Enter Department Name',
128
+ name: 'Department Name',
129
+ code: 'Department Code',
130
+ removeDepartment: 'Remove Department',
131
+ selectedDept: 'Selected Departments',
132
+ namePath: 'Name Path',
133
+ },
134
+ // 用户树
135
+ departmentUserTree: {
136
+ pleaseEnterUserInformation: 'Please Enter User Information',
137
+ selectedPeople: 'Selected People',
138
+ searchFieldUserName: 'Name',
139
+ searchFieldLoginName: 'Login Name',
140
+ searchFieldEmail: 'Email',
141
+ searchFieldTelephone: 'Telephone',
142
+ searchFieldJobNumber: 'Job Number',
143
+ searchFieldHonorificName: 'Honorific',
144
+ },
145
+ // 嵌入用户树
146
+ departmentUserTreeInline: {
147
+ name: 'Name',
148
+ department: 'Department',
149
+ branch: 'Branch',
150
+ removeUser: 'Remove User',
151
+ email: 'Email',
152
+ loginName: 'Login Name',
153
+ },
154
+ // 工作组树
155
+ workgroupTree: {
156
+ allTeamMembers: 'All Team Members',
157
+ name: 'Workgroup Name',
158
+ code: 'Workgroup Code',
159
+ removeWorkgroup: 'Remove Workgroup',
160
+ },
161
+ // 流程按钮组件。save、submit等属性名不能随便改,和后台的ButtonType枚举名保持一致
162
+ workflowButton: {
163
+ save: 'Save',
164
+ submit: 'Submit',
165
+ approve: 'Approve',
166
+ refuse: 'Refuse',
167
+ agreement: 'Agree',
168
+ oppose: 'Opposition',
169
+ kiken: 'Abstention',
170
+ get_back_button: 'Retrieve',
171
+ copy: 'Copy',
172
+ draw: 'Draw',
173
+ abandon_draw: 'Give Up Draw',
174
+ add_sign: 'Additional Signature',
175
+ remove_sign: 'Reduction Of Signature',
176
+ signoff: 'Sign For',
177
+ assign: 'Hand over',
178
+ assign_task: 'Transfer',
179
+ readed: 'Readed',
180
+ export_report: 'Export Report',
181
+ draw_dept_task: 'Draw Department',
182
+ abandon_draw_dept_task: 'Give Up Draw Department',
183
+ },
184
+ // 流转历史文本组件
185
+ workflowHistoryList: {
186
+ specailText: 'specail',
187
+ index: 'Index',
188
+ taskName: 'Task Name',
189
+ operation: 'Operation',
190
+ opinion: 'Opinion',
191
+ processStart: 'Process Start',
192
+ processEnd: 'Process End',
193
+ process_start: '[{1}] process start',
194
+ prcoess_end: '[{1}] process End',
195
+ force_end_process:
196
+ '{1}forced to end the process, and the task of [{2}] was canceled',
197
+ history_jump: 'Process {3} to [{1}], [{2}] task cancelled',
198
+ history_back: '{1} returned to task,process returned to [{2}]',
199
+ history_removesign: '{1} minus [{2}]',
200
+ history_changetransactor_and_delegate:
201
+ '{1} changed the handler [{2}] to [{3}], [{4}] delegated the task to [{5}]',
202
+ history_changetransactor: '{1} changed handler [{2}] to [{3}]',
203
+ history_addsign: '{1} sign [{2}]',
204
+ history_addtransactor: '{1} add handler [{2}]',
205
+ history_removetransactor: '{1} decrease handler [{2}]',
206
+ history_delegate_and_assign:
207
+ '{1} assigned tasks to [{2}], [{3}] delegated tasks to [{4}]',
208
+ history_assign: '{1} assigned task to [{2}]',
209
+ transfer: '{1} transferred to [{2}]',
210
+ history_complete_transfer:
211
+ '{1} execute [{2}] operation and canceled the task of other receivers [{3}]',
212
+ history_delegate_receive: '{1} retracts the task entrusted to [{2}]',
213
+ history_delegate: '{1} has delegated task [{2}] to [{3}]',
214
+ history_quit_transfer:
215
+ '{1} Resignation, has transferred task [{2}] to [{3}',
216
+ history_change_job_transfer:
217
+ '{1} Change job,has transferred task [{2}] to [{3}',
218
+ commonButtonOperation: '{1} execute [{2}] operation',
219
+ history_draw_task:
220
+ '{1} received the task and cancelled the task of the candidate [{2}]',
221
+ history_abandon_draw:
222
+ '{1} gives up the task and restores the task of candidate [{2}]',
223
+ create_copy_task: '{1} The task was copied to [{2}',
224
+ toDoText: 'Todo',
225
+ operator: 'Operator',
226
+ operatorDept: 'Operator Dept',
227
+ operationTime: 'Operation Time',
228
+ history_draw_dept_task: '{1} Received tasks from department [{2}]',
229
+ history_abandon_draw_dept_task:
230
+ '{1} Abandon the task of receiving department [{2}]',
231
+ },
232
+ gateway: {
233
+ timeout: 'Interface call timeout',
234
+ callFailed: 'Interface call failed',
235
+ },
236
+ // 九宫格列表组件
237
+ superNineGrid: {
238
+ add: 'Create',
239
+ },
240
+ fsUpload: {
241
+ upload: 'Upload',
242
+ download: 'Download',
243
+ delete: 'Delete',
244
+ preview: 'Preview',
245
+ name: 'Name',
246
+ picture: 'Picture',
247
+ operating: 'Operating',
248
+ uploadSucceeded: 'Upload succeeded',
249
+ theNumberOfUploadsExceedsTheLimitTheLimitIs:
250
+ 'The number of uploads exceeds the limit. The limit is',
251
+ },
252
+ messageVideo: {
253
+ attemptingToIdentify: 'Attempting to identify',
254
+ callingRearCamera: 'Calling rear camera',
255
+ identificationFailed: 'Identification failed',
256
+ },
257
+ IntervalSelection: {
258
+ year: 'year',
259
+ quarter: 'quarter',
260
+ auxiliary: 'auxiliary word for ordinal numbers',
261
+ week: 'week',
262
+ },
263
+ }
264
+ export default en
package/src/permission.js CHANGED
@@ -1,71 +1,157 @@
1
- import NProgress from 'nprogress' // Progress 进度条
2
- import 'nprogress/nprogress.css'// Progress 进度条样式
3
- import { Message } from 'element-ui'
4
- import { getToken } from './utils/auth' // 验权
5
- import store from './store'
6
- import router, { errorRouterMap } from './router'
7
- NProgress.configure({ showSpinner: false })// NProgress Configuration
8
-
9
- const whiteList = ['/login'] // 不重定向白名单
10
- router.beforeEach((to, from, next) => {
11
- NProgress.start()
12
- if (getToken()) {
13
- if (to.path === '/login') {
14
- next({ path: '/' })
15
- NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it
16
- } else {
17
- if (store.getters.name === '') {
18
- store.dispatch('getCurrentUser').then(res => { // 拉取用户信息
19
- // TODO:后台返回这种格式的数据就能动态控制菜单了
20
- const currentUserPermissions = [
21
- 'index',
22
- 'acs.department.list',
23
- 'acs.department.create',
24
- 'acs.department.get',
25
- 'acs.department.update',
26
- 'acs.department.delete',
27
- 'acs.workgroup.list',
28
- 'acs.workgroup.create',
29
- 'acs.workgroup.get',
30
- 'acs.workgroup.update',
31
- 'acs.workgroup.delete',
32
- 'portal.dashboard',
33
- 'portal.nested.menu1-1',
34
- 'portal.nested.menu1-2-1',
35
- 'portal.nested.menu1-2-2',
36
- 'portal.nested.menu1-3',
37
- 'portal.nested.menu2',
38
- 'portal.external-link',
39
- 'wf.editor.save'
40
- ]
41
-
42
- store.dispatch('generateRoutes', currentUserPermissions).then(() => { // 根据roles权限生成可访问的路由表
43
- console.log(store.getters.protectedRouters)
44
- router.addRoutes(store.getters.protectedRouters) // 动态添加可访问路由表
45
- // 404等错误路由一定要放到受权限保护的路由之后
46
- router.addRoutes(errorRouterMap)
47
- next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
48
- })
49
- }).catch((err) => {
50
- store.dispatch('clearToken').then(() => {
51
- Message.error(err || 'Verification failed, please login again')
52
- next({ path: '/' })
53
- })
54
- })
55
- } else {
56
- next()
57
- }
58
- }
59
- } else {
60
- if (whiteList.indexOf(to.path) !== -1) {
61
- next()
62
- } else {
63
- next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页
64
- NProgress.done()
65
- }
66
- }
67
- })
68
-
69
- router.afterEach(() => {
70
- NProgress.done() // 结束Progress
71
- })
1
+ import NProgress from 'nprogress' // Progress 进度条
2
+ import 'nprogress/nprogress.css' // Progress 进度条样式
3
+ import { getToken, setToken } from './utils/auth' // 验权
4
+ import store from './store'
5
+ import router, { errorRouterMap } from './router'
6
+ NProgress.configure({ showSpinner: false }) // NProgress Configuration
7
+ import { ElMessage as Message } from 'element-plus'
8
+ import * as Vue from 'vue'
9
+
10
+ const whiteList = [
11
+ '/login',
12
+ '/update-password',
13
+ '/forget-password',
14
+ '/reset-password',
15
+ '/redirect',
16
+ ] // 不重定向白名单
17
+ router.beforeEach((to, from, next) => {
18
+ // next()
19
+ NProgress.start()
20
+ console.log('router.beforeEach-to=', to)
21
+ console.log('router.beforeEach-from=', from)
22
+ // console.log('router.beforeEach-to.path=', to.path)
23
+ let token = getToken()
24
+ // console.log('router.beforeEach-to.query.JWT=', to.query.JWT)
25
+ if (!token && to.query && to.query.JWT) {
26
+ token = to.query.JWT
27
+ if (token) {
28
+ // 微信小程序web-view直接访问路径时使用?将JWT传过来
29
+ setToken(token)
30
+ }
31
+ }
32
+ if (!token && to.query && to.query.jwt) {
33
+ token = to.query.jwt
34
+ if (token) {
35
+ // 微信小程序web-view直接访问路径时使用?将JWT传过来
36
+ setToken(token)
37
+ }
38
+ }
39
+ if (to.query && to.query._systemName_) {
40
+ // 表示需要设置浏览器页签名
41
+ document.title = to.query._systemName_
42
+ }
43
+ // console.log('router.beforeEach-getToken()=', token)
44
+ if (
45
+ ([
46
+ '/update-password',
47
+ '/forget-password',
48
+ '/reset-password',
49
+ '/redirect',
50
+ ].indexOf(to.path) === -1 ||
51
+ store.getters.whiteList.indexOf(to.path) !== -1) &&
52
+ token
53
+ ) {
54
+ if (to.path === '/login') {
55
+ next({ path: '/', query: to.query })
56
+ NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it
57
+ } else {
58
+ console.log('router.beforeEach-to.path!=login')
59
+ if (store.getters.name === '') {
60
+ // 表示刷新了页面(例如点击了一级菜单)后,会重新走该方法
61
+ console.log('router.beforeEach-store.getters.name === ""')
62
+ store
63
+ .dispatch('isLoginTimeOut')
64
+ .then((result) => {
65
+ if (result === true) {
66
+ store.dispatch('clearToken').then(() => {
67
+ next({ path: '/', replace: true })
68
+ NProgress.done()
69
+ })
70
+ } else {
71
+ store.dispatch('getCurrentUser').then((user) => {
72
+ console.log('router.beforeEach-getCurrentUser')
73
+ return store.dispatch(
74
+ 'getCurrentUserPermissions',
75
+ user.loginName
76
+ )
77
+ }).then((permissions) => {
78
+ console.log(
79
+ 'router.beforeEach-getCurrentUserPermissions-result=='
80
+ )
81
+ return store.dispatch('generateRoutes', permissions)
82
+ }).then(() => {
83
+ console.log('iMatrix-router.beforeEach2-getPermissionMenus')
84
+ return store.dispatch(
85
+ 'getPermissionMenus',
86
+ window.$vueApp.config.globalProperties.currentSystem
87
+ )
88
+ }).then(() => {
89
+ // 根据roles权限生成可访问的路由表
90
+ console.log(
91
+ 'router.beforeEach-generateRoutes==to=',
92
+ to,
93
+ ',from=',
94
+ from
95
+ )
96
+ store.getters.protectedRouters.forEach(item =>{
97
+ router.addRoute(item)
98
+ })
99
+ console.log('%c描述-170412','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',router.options.routes);
100
+ // 404等错误路由一定要放到受权限保护的路由之后
101
+ // todo 添加404控制台会报错
102
+ // router.addRoute(errorRouterMap[0])
103
+ window.sessionStorage.setItem(
104
+ new Date().getTime() + '-name=null-from~~toPath',
105
+ from.path + '~~' + to.path
106
+ )
107
+ console.log(
108
+ 'router.beforeEach-generateRoutes==to.path=',
109
+ to.path
110
+ )
111
+ next({ ...to, replace: true })
112
+ }).catch((err) => {
113
+ console.log('%c描述-094344','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px','走到了err');
114
+ store.dispatch('clearToken').then(() => {
115
+ Message.error(
116
+ err || 'Verification failed, please login again'
117
+ )
118
+ next({ path: '/' })
119
+ })
120
+ })
121
+ }
122
+ })
123
+ .catch((err) => {
124
+ store.dispatch('clearToken').then(() => {
125
+ Message.error(err || 'Verification failed, please login again')
126
+ next({ path: '/' })
127
+ })
128
+ })
129
+ } else {
130
+ window.sessionStorage.setItem(
131
+ new Date().getTime() + '-name!==null-from~~toPath',
132
+ from.path + '~~' + to.path
133
+ )
134
+ console.log(
135
+ 'router.beforeEach-store.getters.name ==',
136
+ store.getters.name
137
+ )
138
+ next()
139
+ }
140
+ }
141
+ } else {
142
+ if (
143
+ whiteList.indexOf(to.path) !== -1 ||
144
+ store.getters.whiteList.indexOf(to.path) !== -1
145
+ ) {
146
+ next()
147
+ } else {
148
+ // 必须使用to.fullPath,fullPath是带有参数的,to.path没有参数,会导致跳转到的页面参数丢失
149
+ next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
150
+ NProgress.done()
151
+ }
152
+ }
153
+ })
154
+
155
+ router.afterEach(() => {
156
+ NProgress.done() // 结束Progress
157
+ })
package/src/plugins.js CHANGED
@@ -1,18 +1,18 @@
1
- import Vue from 'vue'
2
-
3
- import 'normalize.css/normalize.css' // A modern alternative to CSS resets
4
- import './styles/index.scss' // global css
5
-
6
- import ElementUI from 'element-ui'
7
- import 'element-ui/lib/theme-chalk/index.css'
8
- import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n
9
-
10
- import SuperUI from 'imatrix-ui'
11
- import 'imatrix-ui/lib/super-ui.css'
12
-
13
- import 'imatrix-ui/src/permission' // permission control
14
- import permission from 'imatrix-ui/src/directives/permission'
15
-
16
- Vue.use(ElementUI, { locale })
17
- Vue.use(SuperUI)
18
- permission.install(Vue)
1
+ import * as Vue from 'vue'
2
+
3
+ import 'normalize.css/normalize.css' // A modern alternative to CSS resets
4
+ import './styles/index.scss' // global css
5
+
6
+ import ElementUI from 'element-plus'
7
+ import 'element-plus/dist/index.css'
8
+ // import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n plus 在页面中引用
9
+
10
+ // import SuperUI from 'imatrix-ui'
11
+ // import 'imatrix-ui/lib/super-ui.css'
12
+
13
+ import 'imatrix-ui/src/permission' // permission control
14
+ // import permission from 'imatrix-ui/src/directives/permission'
15
+
16
+ // window.$vueApp.use(ElementUI, { locale })
17
+ // window.$vueApp.use(SuperUI)
18
+ // permission.install(Vue)