@lambo-design/shared 1.0.0-beta.24 → 1.0.0-beta.240

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 (206) hide show
  1. package/config/config.js +51 -37
  2. package/config/env.js +4 -4
  3. package/config/index.js +7 -2
  4. package/config/themes/atrovirens/atrovirens.css +576 -0
  5. package/config/themes/atrovirens/atrovirens.css.map +1 -0
  6. package/config/themes/atrovirens/atrovirens.less +667 -0
  7. package/config/themes/atrovirens/var.less +674 -0
  8. package/config/themes/blue/blue.css +576 -0
  9. package/config/themes/blue/blue.css.map +1 -0
  10. package/config/themes/blue/blue.less +669 -0
  11. package/config/themes/blue/var.less +677 -0
  12. package/config/themes/blue-white/blue-white.css +576 -0
  13. package/config/themes/blue-white/blue-white.css.map +1 -0
  14. package/config/themes/blue-white/blue-white.less +669 -0
  15. package/config/themes/blue-white/var.less +676 -0
  16. package/config/themes/blue-white-tight/blue-white-tight.css +577 -0
  17. package/config/themes/blue-white-tight/blue-white-tight.css.map +1 -0
  18. package/config/themes/blue-white-tight/blue-white-tight.less +672 -0
  19. package/config/themes/blue-white-tight/var.less +677 -0
  20. package/config/themes/danqing/danqing.css +576 -0
  21. package/config/themes/danqing/danqing.css.map +1 -0
  22. package/config/themes/danqing/danqing.less +668 -0
  23. package/config/themes/danqing/danqing.wxss +572 -0
  24. package/config/themes/danqing/var.less +679 -0
  25. package/config/themes/deep/deep.css +576 -0
  26. package/config/themes/deep/deep.css.map +1 -0
  27. package/config/themes/deep/deep.less +669 -0
  28. package/config/themes/deep/var.less +677 -0
  29. package/config/themes/default/default.css +576 -241
  30. package/config/themes/default/default.css.map +1 -0
  31. package/config/themes/default/default.less +671 -319
  32. package/config/themes/default/var.less +677 -314
  33. package/config/themes/eap/eap.css +576 -0
  34. package/config/themes/eap/eap.css.map +1 -0
  35. package/config/themes/eap/eap.less +671 -0
  36. package/config/themes/eap/var.less +677 -0
  37. package/config/themes/gold/gold.css +576 -0
  38. package/config/themes/gold/gold.css.map +1 -0
  39. package/config/themes/gold/gold.less +671 -0
  40. package/config/themes/gold/var.less +677 -314
  41. package/config/themes/index.js +28 -14
  42. package/config/themes/lime/lime.css +576 -0
  43. package/config/themes/lime/lime.css.map +1 -0
  44. package/config/themes/lime/lime.less +671 -0
  45. package/config/themes/lime/var.less +678 -314
  46. package/config/themes/orange/orange.css +576 -0
  47. package/config/themes/orange/orange.css.map +1 -0
  48. package/config/themes/orange/orange.less +671 -0
  49. package/config/themes/orange/var.less +678 -0
  50. package/config/themes/red/red.css +576 -0
  51. package/config/themes/red/red.css.map +1 -0
  52. package/config/themes/red/red.less +671 -0
  53. package/config/themes/red/var.less +677 -0
  54. package/config/themes/theme-atrovirens.js +558 -0
  55. package/config/themes/theme-blue.js +558 -0
  56. package/config/themes/theme-bw.js +558 -0
  57. package/config/themes/theme-bwt.js +559 -0
  58. package/config/themes/theme-danqing.js +558 -0
  59. package/config/themes/theme-deep.js +558 -0
  60. package/config/themes/theme-default.js +558 -252
  61. package/config/themes/theme-eap.js +558 -0
  62. package/config/themes/theme-gold.js +558 -252
  63. package/config/themes/theme-lime.js +558 -252
  64. package/config/themes/theme-orange.js +559 -40
  65. package/config/themes/theme-red.js +558 -40
  66. package/config/themes/theme-white.js +558 -0
  67. package/config/themes/white/var.less +676 -0
  68. package/config/themes/white/white.css +576 -0
  69. package/config/themes/white/white.css.map +1 -0
  70. package/config/themes/white/white.less +669 -0
  71. package/directives/index.js +23 -23
  72. package/directives/module/draggable.js +56 -56
  73. package/directives/module/permission.js +49 -49
  74. package/directives/module/print.js +1 -0
  75. package/directives/module/vue-print-nb/README.md +63 -0
  76. package/directives/module/vue-print-nb/print.js +94 -0
  77. package/directives/module/vue-print-nb/printarea.js +532 -0
  78. package/index.js +10 -4
  79. package/nstyles/common.less +197 -0
  80. package/nstyles/components/404.less +46 -0
  81. package/nstyles/components/button.less +34 -0
  82. package/nstyles/components/date-picker.less +37 -0
  83. package/nstyles/components/drawer.less +20 -0
  84. package/nstyles/components/dropdown.less +18 -0
  85. package/nstyles/components/excel-flow.less +72 -0
  86. package/nstyles/components/form.less +313 -0
  87. package/nstyles/components/index.less +23 -0
  88. package/nstyles/components/layout/collect.less +10 -0
  89. package/nstyles/components/layout/detail-view.less +107 -0
  90. package/nstyles/components/layout/full-screen.less +7 -0
  91. package/nstyles/components/layout/index.less +7 -0
  92. package/nstyles/components/layout/other-menu.less +142 -0
  93. package/nstyles/components/layout/page-view.less +101 -0
  94. package/nstyles/components/layout/sider-trigger.less +41 -0
  95. package/nstyles/components/layout/tags-nav.less +113 -0
  96. package/nstyles/components/modal.less +85 -0
  97. package/nstyles/components/n-button.less +131 -0
  98. package/nstyles/components/n-image-preview.less +131 -0
  99. package/nstyles/components/n-model/index.less +19 -0
  100. package/nstyles/components/n-model/report-index.less +43 -0
  101. package/nstyles/components/n-panel.less +41 -0
  102. package/nstyles/components/n-picker.less +37 -0
  103. package/nstyles/components/n-sign.less +17 -0
  104. package/nstyles/components/n-tooltip.less +10 -0
  105. package/nstyles/components/panel.less +31 -0
  106. package/nstyles/components/select.less +3 -0
  107. package/nstyles/components/sign.less +27 -0
  108. package/nstyles/components/table.less +315 -0
  109. package/nstyles/components/tree.less +159 -0
  110. package/nstyles/components/upload.less +164 -0
  111. package/nstyles/index.less +5 -0
  112. package/nstyles/reset.less +65 -0
  113. package/nstyles/third/ag.less +174 -0
  114. package/nstyles/third/icons/sort-desc.svg +1 -0
  115. package/nstyles/third/icons/sort-up.svg +1 -0
  116. package/nstyles/third/icons/sorting.svg +1 -0
  117. package/nstyles/third/index.less +11 -0
  118. package/nstyles/third/view-design.less +367 -0
  119. package/nstyles/variables/base.less +143 -0
  120. package/nstyles/variables/index.less +4 -0
  121. package/nstyles/variables/theme/default/button.less +7 -0
  122. package/nstyles/variables/theme/default/common.less +57 -0
  123. package/nstyles/variables/theme/default/index.less +7 -0
  124. package/nstyles/variables/theme/default/layout.less +40 -0
  125. package/nstyles/variables/theme/default/table.less +37 -0
  126. package/nstyles/variables/theme/default/tag.less +3 -0
  127. package/nstyles/variables/theme/default/upload.less +3 -0
  128. package/nstyles/variables/theme/index.less +13 -0
  129. package/nstyles/variables/theme/small/button.less +7 -0
  130. package/nstyles/variables/theme/small/common.less +39 -0
  131. package/nstyles/variables/theme/small/index.less +5 -0
  132. package/nstyles/variables/theme/small/layout.less +21 -0
  133. package/nstyles/variables/theme/small/table.less +17 -0
  134. package/nstyles/variables/theme/small/tag.less +3 -0
  135. package/package.json +27 -7
  136. package/plugin/index.js +12 -0
  137. package/plugin/module/date-format.js +30 -0
  138. package/plugin/module/loading.js +26 -0
  139. package/plugin/module/warn-handler.js +11 -0
  140. package/styles/image/inspur.png +0 -0
  141. package/styles/image/lan_navigator.png +0 -0
  142. package/styles/image/lv_navigator.png +0 -0
  143. package/styles/variables.less +21 -21
  144. package/utils/ajax/cacheconf.js +19 -19
  145. package/utils/ajax/content-type.js +30 -0
  146. package/utils/ajax/index.js +12 -12
  147. package/utils/ajax/interceptors.js +97 -97
  148. package/utils/assist.js +147 -84
  149. package/utils/base64.js +126 -0
  150. package/utils/blob.js +47 -0
  151. package/utils/bus.js +3 -3
  152. package/utils/crypto/index.js +48 -38
  153. package/utils/crypto/md5.js +152 -152
  154. package/utils/crypto/sm3.js +235 -235
  155. package/utils/date.js +381 -352
  156. package/utils/dict/built-in-dict.js +20 -0
  157. package/utils/dict/index.js +168 -0
  158. package/utils/dom.js +38 -38
  159. package/utils/event.js +72 -0
  160. package/utils/excel.js +655 -523
  161. package/utils/file.js +19 -0
  162. package/utils/form/validate.js +29 -0
  163. package/utils/half-year.js +68 -0
  164. package/utils/index.js +42 -5
  165. package/utils/json.js +29 -0
  166. package/utils/lodop.js +165 -160
  167. package/utils/menu/before-close.js +17 -17
  168. package/utils/menu/index.js +395 -135
  169. package/utils/mime_type.js +67 -0
  170. package/utils/modelerUtil.js +227 -224
  171. package/utils/n/api.js +22 -0
  172. package/utils/n/date.js +57 -0
  173. package/utils/n/index.js +10 -0
  174. package/utils/n/is-type.js +176 -0
  175. package/utils/n/number.js +144 -0
  176. package/utils/n/permission-cache.js +11 -0
  177. package/utils/n/reuqest/axiosN.js +17 -0
  178. package/utils/n/reuqest/content-type.js +19 -0
  179. package/utils/n/reuqest/interceptors.js +95 -0
  180. package/utils/n/reuqest/url-params.js +12 -0
  181. package/utils/n/storage.js +51 -0
  182. package/utils/n/token.js +51 -0
  183. package/utils/n/user-cache.js +11 -0
  184. package/utils/n/user.js +34 -0
  185. package/utils/n/uuid.js +16 -0
  186. package/utils/n-generator-routers.js +208 -0
  187. package/utils/n-router.js +205 -0
  188. package/utils/n-theme.js +30 -0
  189. package/utils/number.js +180 -123
  190. package/utils/oss.js +57 -0
  191. package/utils/platform.js +1334 -583
  192. package/utils/quarter.js +58 -0
  193. package/utils/storage.js +198 -0
  194. package/utils/style.js +24 -0
  195. package/utils/theme.js +138 -43
  196. package/utils/transfer-queue.js +7 -0
  197. package/utils/transform.js +206 -0
  198. package/utils/type.js +102 -0
  199. package/utils/util.js +795 -0
  200. package/utils/validator.js +181 -0
  201. package/utils/vxetable/index.js +25 -25
  202. package/utils/zoomScroll.js +9 -9
  203. package/config/themes/gold/default.css +0 -241
  204. package/config/themes/gold/default.less +0 -319
  205. package/config/themes/lime/default.css +0 -241
  206. package/config/themes/lime/default.less +0 -319
@@ -1,135 +1,395 @@
1
- /**
2
- * 判断是否存在路由
3
- * @param $router
4
- * @param name
5
- * @returns {*|boolean}
6
- */
7
- export const hasRoute = ($router, name) => {
8
- let routes = $router.getRoutes();
9
- let res = routes.filter(item => item.name === name)
10
- return res && res.length > 0
11
- }
12
- /**
13
- * 判断是否存在路由并且页面存在
14
- * @param $router
15
- * @param path
16
- * @returns {*|boolean}
17
- */
18
- export const hasRoutePath = ($router, path) => {
19
- let routes = $router.getRoutes();
20
- let res = routes.filter(item => item.path === path)
21
- return res && res.length > 0
22
- }
23
- /**
24
- * 动态生成菜单
25
- * @param permissionList
26
- * @returns []
27
- */
28
- export const generatorMenuList = (permissionList,appId) => {
29
- let menuData = [],
30
- pageNode = {
31
- path: "/page",
32
- name: "page",
33
- meta: {
34
- hideInMenu: true,
35
- notCache: true
36
- },
37
- component: "Main",
38
- children: []
39
- };
40
- listToMenuTree(permissionList, menuData, pageNode, "0", [], true,appId);
41
-
42
- /*if (pageNode.children.length > 0) {
43
- menuData.push(pageNode);
44
- }*/
45
- return menuData;
46
- };
47
-
48
-
49
-
50
- /**
51
- * 数组转树形结构
52
- */
53
- const listToMenuTree = (list, menuTree, pageNode, parentId, crumbs, root, appId) => {
54
- if (list == null) {
55
- return;
56
- }
57
- list.forEach(item => {
58
- if (item.appId == appId) {
59
- // 判断是否为父级菜单
60
- if (item.pid === parentId) {
61
- if (item.type === 1 || item.type === 2) {
62
- let node = {
63
- meta: {
64
- appId: item.appId,
65
- title: item.label,
66
- icon: item.icon,
67
- crumbs: [...crumbs],
68
- activeName: item.name
69
- },
70
- type: item.type,
71
- pid: item.pid,
72
- component: item.name,
73
- name: item.name,
74
- uri: item.uri,
75
- children: []
76
- };
77
- node.meta.crumbs.push({
78
- icon: item.icon,
79
- name: item.name,
80
- title: item.label,
81
- type: item.type
82
- });
83
-
84
- if (item.type === 1) {
85
- if (root) {
86
- node.component = "Main";
87
- } else {
88
- node.component = "parentView";
89
- }
90
- }
91
- // 迭代 list, 找到当前菜单相符合的所有子菜单
92
- listToMenuTree(
93
- list,
94
- node.children,
95
- pageNode,
96
- item.permissionId,
97
- node.meta.crumbs,
98
- false,
99
- appId
100
- );
101
- // 删掉不存在 children 值的属性
102
- if (node.children.length <= 0) {
103
- delete node.children;
104
- }
105
- // 加入到树中
106
- menuTree.push(node);
107
- }
108
- if (item.type === 4) {
109
- let child = {
110
- meta: {
111
- title: item.label,
112
- hideInMenu: true,
113
- notCache: true,
114
- crumbs: [...crumbs],
115
- type: item.type
116
- },
117
- type: item.type,
118
- pid: item.pid,
119
- component: item.name,
120
- name: item.name,
121
- uri: item.uri
122
- };
123
- child.meta.crumbs.push({
124
- icon: item.icon,
125
- name: item.name,
126
- title: item.label,
127
- type: item.type
128
- });
129
- pageNode.children.push(child);
130
- }
131
- }
132
- }
133
- });
134
- };
135
- export default generatorMenuList;
1
+ import config from "../../config/config"
2
+ import {deepCopy} from "../assist";
3
+ import {getUrlParams} from "../platform"
4
+ /**
5
+ * 判断是否存在路由
6
+ * @param $router
7
+ * @param name
8
+ * @returns {*|boolean}
9
+ */
10
+ export const hasRoute = ($router, name) => {
11
+ let routes = $router.getRoutes();
12
+ let res = routes.filter(item => item.name === name)
13
+ return res && res.length > 0
14
+ }
15
+ /**
16
+ * 判断是否存在路由并且页面存在
17
+ * @param $router
18
+ * @param path
19
+ * @returns {*|boolean}
20
+ */
21
+ export const hasRoutePath = ($router, path) => {
22
+ if ($router && path) {
23
+ let routes = $router.getRoutes();
24
+ if (path.trim().startsWith("dida/")) {
25
+ path = path.trim().replace("dida/","");
26
+ if (!path.startsWith("/")) {
27
+ path = "/" + path;
28
+ }
29
+ } else if (path.trim().startsWith("dareport/")) {
30
+ path = path.trim().replace("dareport/","");
31
+ if (!path.startsWith("/")) {
32
+ path = "/" + path;
33
+ }
34
+ } else if (path.trim().startsWith("/" + config.routerBase + "/")) {
35
+ path = "/" + path.replace("/" + config.routerBase + "/","")
36
+ }
37
+ let res = routes.filter(item => item.path === path)
38
+ return res && res.length > 0
39
+ }
40
+ return false
41
+ }
42
+ /**
43
+ * 动态生成菜单
44
+ * @param permissionList
45
+ * @returns []
46
+ */
47
+ export const generatorMenuList = (permissionList,appId,generateType = 'router') => {
48
+ let menuRouter = generatorMenuRouter(permissionList,appId,generateType);
49
+ return menuRouter && menuRouter.menuData ? menuRouter.menuData : [];
50
+ };
51
+ /**
52
+ * 动态生成菜单
53
+ * @param generatorMenuRouter
54
+ * @returns []
55
+ */
56
+ export const generatorMenuRouter = (permissionList,appId,generateType = 'router') => {
57
+ let menuData = [],
58
+ pageNode = {
59
+ path: "/page",
60
+ name: "page",
61
+ meta: {
62
+ hideInMenu: true,
63
+ notCache: true
64
+ },
65
+ component: "Main",
66
+ children: []
67
+ };
68
+ listToMenuTree(permissionList, menuData, pageNode, "0", [], true,appId,generateType);
69
+ return {menuData,pageNode};
70
+ };
71
+
72
+
73
+ /**
74
+ * 数组转树形结构
75
+ */
76
+ const listToMenuTree = (list, menuTree, pageNode, parentId, crumbs, root, appId,generateType = 'router') => {
77
+ if (list == null) {
78
+ return;
79
+ }
80
+ list.forEach(item => {
81
+ let appIdCondition = !appId || item.appId == appId || appId.indexOf(item.appId) > -1;//过滤是否要求的应用
82
+ let hideInMenuCondition = !(item.hasOwnProperty("hideInMenu") && item.hideInMenu);//过滤是否隐藏的菜单
83
+ if ((generateType && generateType == 'router' && appIdCondition) ||
84
+ (generateType == 'menu' && appIdCondition && hideInMenuCondition)) {
85
+ // 判断是否为父级菜单
86
+ if (item.pid === parentId) {
87
+ if (item.type === 1 || item.type === 2) {
88
+ let node = {
89
+ meta: {
90
+ data: deepCopy(item),
91
+ appId: item.appId,
92
+ title: item.label,
93
+ icon: item.icon,
94
+ crumbs: [...crumbs],
95
+ activeName: item.name,
96
+ notCache: item.notCache ? true : false,
97
+ hideInMenu: item.hideInMenu ? true : false
98
+ },
99
+ permissionId: item.permissionId,
100
+ type: item.type,
101
+ pid: item.pid,
102
+ component: item.name,
103
+ name: item.name,
104
+ uri: item.uri,
105
+ children: []
106
+ };
107
+ node.meta.crumbs.push({
108
+ icon: item.icon,
109
+ name: item.name,
110
+ title: item.label,
111
+ type: item.type
112
+ });
113
+
114
+ if (item.type === 1) {
115
+ if (root) {
116
+ node.component = "Main";
117
+ } else {
118
+ node.component = "parentView";
119
+ }
120
+ }
121
+ // 迭代 list, 找到当前菜单相符合的所有子菜单
122
+ listToMenuTree(
123
+ list,
124
+ node.children,
125
+ pageNode,
126
+ item.permissionId,
127
+ node.meta.crumbs,
128
+ false,
129
+ appId,
130
+ generateType
131
+ );
132
+ // 删掉不存在 children 值的属性
133
+ if (node.children.length <= 0) {
134
+ delete node.children;
135
+ }
136
+ // 加入到树中
137
+ menuTree.push(node);
138
+ }
139
+ if (item.type === 4) {
140
+ let child = {
141
+ meta: {
142
+ data: deepCopy(item),
143
+ appId: item.appId,
144
+ title: item.label,
145
+ hideInMenu: true,
146
+ notCache: true,
147
+ crumbs: [...crumbs],
148
+ type: item.type
149
+ },
150
+ permissionId: item.permissionId,
151
+ type: item.type,
152
+ pid: item.pid,
153
+ component: item.name,
154
+ name: item.name,
155
+ uri: item.uri
156
+ };
157
+ child.meta.crumbs.push({
158
+ icon: item.icon,
159
+ name: item.name,
160
+ title: item.label,
161
+ type: item.type
162
+ });
163
+ pageNode.children.push(child);
164
+ }
165
+ }
166
+ }
167
+ });
168
+ };
169
+
170
+ /**
171
+ * 动态生成路由
172
+ * @param generatorMenuRouter
173
+ * @returns []
174
+ */
175
+ export const generatorDynamicRouter = (permissionList,constantRouterComponents,appIds = null,generateType = 'router') => {
176
+ let allMenu = generatorMenuRouter(permissionList, appIds,generateType);
177
+ let menuData = allMenu.menuData;
178
+ let pageNode = allMenu.pageNode;
179
+ if (menuData && pageNode && pageNode.children.length > 0) {
180
+ menuData.push(pageNode);
181
+ }
182
+ //给路由添加面包屑属性,解决示例页面左侧菜单点击不选中的问题
183
+ //routesAddCrumbs(exampleMenuData,[]);
184
+ //menuData = menuData.concat(exampleMenuData)
185
+ let dynamicRouter = generator(menuData,constantRouterComponents);
186
+
187
+ return dynamicRouter;
188
+ }
189
+ /**
190
+ * 路由添加面包屑属性
191
+ */
192
+ export const routesAddCrumbs = (routes ,crumbs) => {
193
+ routes.forEach(item => {
194
+ if (item.meta.hasOwnProperty('crumbs')){
195
+ item.meta.crumbs.push({
196
+ icon: item.meta.icon,
197
+ name: item.name,
198
+ title: item.meta.title,
199
+ type: item.type
200
+ });
201
+ }else{
202
+ item.meta['crumbs'] = [...crumbs];
203
+ item.meta.crumbs.push({
204
+ icon: item.meta.icon,
205
+ name: item.name,
206
+ title: item.meta.title,
207
+ type: item.type
208
+ });
209
+ }
210
+ if (item.hasOwnProperty("children")){
211
+ routesAddCrumbs(item.children,item.meta.crumbs)
212
+ }
213
+ });
214
+ }
215
+
216
+ /*
217
+ 生成 vue-router 层级路由表
218
+ */
219
+ const generator = (menuData,constantRouterComponents) => {
220
+ for (let item of menuData) {
221
+ if (item.component && typeof item.component == "string") {
222
+ const target = constantRouterComponents[item.component];
223
+ if (target) {
224
+ if (target.component) {
225
+ if (typeof target.component == "string") {
226
+ // 解决路由name与组件name不一致导致的keeplive不生效的问题
227
+ try {
228
+ //let componentPath = '@/view/' + target.component;
229
+ item.component = resolve =>
230
+ require(['@/view/'+ target.component], data => {
231
+ data.default.name = item.name;
232
+ resolve(data);
233
+ });
234
+ }catch (e) {
235
+ delete item.component
236
+ }
237
+ } else {
238
+ item.component = target.component;
239
+ }
240
+ }
241
+ if (target.url) {
242
+ let path = target.url;
243
+ let query = {};
244
+ if (path.indexOf("?") > -1) {
245
+ query = getUrlParams(path.substr(path.indexOf("?")));
246
+ item.query = query;
247
+ path = path.substr(0,path.indexOf("?"));
248
+ }
249
+ item.path = path;
250
+ }
251
+ if (item.uri) {
252
+ item.meta.uriParam = item.uri;
253
+ }
254
+ if (target.notCache) {
255
+ item.meta.notCache = target.notCache;
256
+ }
257
+ if (target.hideInMenu) {
258
+ item.meta.hideInMenu = target.hideInMenu;
259
+ }
260
+ }
261
+ if (item.uri) {
262
+ if (item.uri.startsWith("/")) {
263
+ item.uri = item.uri.substr(1);
264
+ }
265
+ let uri = item.uri;
266
+ if (uri.startsWith(config.routerBase + "/")) {
267
+ uri = uri.replace(config.routerBase + "/","")
268
+ }
269
+ if (uri.startsWith("dida/")) {
270
+ item.meta.notCache = true;
271
+ let path = uri;
272
+ let query = {};
273
+ if (path.indexOf("?") > -1) {
274
+ query = getUrlParams(path.substr(path.indexOf("?")));
275
+ item.query = query;
276
+ path = path.substr(0,path.indexOf("?"));
277
+ }
278
+ try{
279
+ //let path = '@/view/dida/dida-page';
280
+ item.component = resolve => {
281
+ require(['@/view/dida/dida-page'], data => {
282
+ data.default.name = item.name;
283
+ resolve(data);
284
+ });
285
+ };
286
+ }catch (e){
287
+ delete item.component
288
+ }
289
+ item.path = "/" + path;
290
+ } else if(uri.startsWith("dareport/")){
291
+ item.meta.notCache = true;
292
+ let path = uri;
293
+ let query = {};
294
+ if (path.indexOf("?") > -1) {
295
+ query = getUrlParams(path.substr(path.indexOf("?")));
296
+ item.query = query;
297
+ path = path.substr(0,path.indexOf("?"));
298
+ }
299
+ try{
300
+ item.component = resolve => {
301
+ require(['@/view/dida/dida-page'], data => {
302
+ data.default.name = item.name;
303
+ resolve(data);
304
+ });
305
+ };
306
+ }catch (e){
307
+ delete item.component
308
+ }
309
+ item.path = "/" + path;
310
+ } else {
311
+ try{
312
+ let path = item.uri;
313
+ if (item.uri.startsWith(config.routerBase + "/")) {
314
+ path = path.replace(config.routerBase + "/","")
315
+ }
316
+ let query = {};
317
+ if (path.indexOf("?") > -1) {
318
+ query = getUrlParams(path.substr(path.indexOf("?")));
319
+ path = path.substr(0,path.indexOf("?"));
320
+ }
321
+ if (target && target.component) {
322
+
323
+ } else {
324
+ let component = require('@/view/' + path);
325
+ if (component) {
326
+ item.component = resolve => {
327
+ require(['@/view/' + path], data => {
328
+ data.default.name = item.name;
329
+ resolve(data);
330
+ });
331
+ };
332
+ } else {
333
+ //console.warn(`${item.name}(${item.uri})页面不存在`)
334
+ delete item.component;
335
+ }
336
+ }
337
+ if (target && target.url) {
338
+
339
+ } else {
340
+ item.path = "/" + path;
341
+ item.query = query;
342
+ }
343
+ }catch (e){
344
+ //console.warn(`${item.name}(${item.uri})页面不存在`)
345
+ delete item.component;
346
+ }
347
+ }
348
+ }
349
+ if (item.path == null) {
350
+ item.path = "";
351
+ }
352
+ if (item.component && typeof item.component == "string") {
353
+ delete item.component;
354
+ }
355
+ if (item.children && item.children.length > 0) {
356
+ generator(item.children,constantRouterComponents);
357
+ }
358
+ }
359
+ }
360
+ return menuData;
361
+ };
362
+
363
+ /**
364
+ * 根据权限组织tab数据
365
+ * @param originMenuList
366
+ * @param name
367
+ * @param appId
368
+ * @returns {{}}
369
+ */
370
+ export const generateTabDataFromPermission = (originMenuList,name,appId) => {
371
+ let menuItem = {};
372
+ if (name && originMenuList) {
373
+ let originalMenu = originMenuList.find(item => item.name == name && item.type && item.type == '2' && (appId && item.appId == appId || !appId));
374
+ if (originalMenu && originalMenu.name) {
375
+ menuItem = {
376
+ meta: {
377
+ data: originalMenu,
378
+ appId: originalMenu.appId,
379
+ title: originalMenu.label,
380
+ icon: originalMenu.icon,
381
+ crumbs: [],
382
+ activeName: originalMenu.name
383
+ },
384
+ permissionId: originalMenu.permissionId,
385
+ pid: originalMenu.pid,
386
+ type: originalMenu.type,
387
+ name: originalMenu.name,
388
+ uri: originalMenu.uri
389
+ }
390
+ }
391
+ }
392
+ return menuItem;
393
+ }
394
+
395
+ export default generatorMenuList;
@@ -0,0 +1,67 @@
1
+ export const MIME_TYPE = {
2
+ aac: 'audio/aac',
3
+ abw: 'application/x-abiword',
4
+ arc: 'application/x-freearc',
5
+ avi: 'video/x-msvideo',
6
+ azw: 'application/vnd.amazon.ebook',
7
+ bin: 'application/octet-stream',
8
+ bmp: 'image/bmp',
9
+ bz: 'application/x-bzip',
10
+ bz2: 'application/x-bzip2',
11
+ csh: 'application/x-csh',
12
+ css: 'text/css',
13
+ csv: 'text/csv',
14
+ doc: 'application/msword',
15
+ docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
16
+ eot: 'application/vnd.ms-fontobject',
17
+ epub: 'application/epub+zip',
18
+ gif: 'image/gif',
19
+ html: 'text/html',
20
+ ico: 'image/vnd.microsoft.icon',
21
+ ics: 'text/calendar',
22
+ jar: 'application/java-archive',
23
+ jpg: 'image/jpeg',
24
+ jpeg: 'image/jpeg',
25
+ js: 'text/javascript',
26
+ json: 'application/json',
27
+ jsonld: 'application/ld+json',
28
+ mid: 'audio/midi',
29
+ midi: 'audio/x-midi',
30
+ mjs: 'text/javascript',
31
+ mp3: 'audio/mpeg',
32
+ mpeg: 'video/mpeg',
33
+ mpkg: 'application/vnd.apple.installer+xml',
34
+ odp: 'application/vnd.oasis.opendocument.presentation',
35
+ ods: 'application/vnd.oasis.opendocument.spreadsheet',
36
+ odt: 'application/vnd.oasis.opendocument.text',
37
+ oga: 'audio/ogg',
38
+ ogv: 'video/ogg',
39
+ ogx: 'application/ogg',
40
+ otf: 'font/otf',
41
+ png: 'image/png',
42
+ pdf: 'application/pdf',
43
+ ppt: 'application/vnd.ms-powerpoint',
44
+ pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
45
+ rar: 'application/x-rar-compressed',
46
+ rtf: 'application/rtf',
47
+ sh: 'application/x-sh',
48
+ svg: 'image/svg+xml',
49
+ swf: 'application/x-shockwave-flash',
50
+ tar: 'application/x-tar',
51
+ tiff: 'image/tiff',
52
+ ttf: 'font/ttf',
53
+ txt: 'text/plain',
54
+ vsd: 'application/vnd.visio',
55
+ wav: 'audio/wav',
56
+ weba: 'audio/webm',
57
+ webm: 'video/webm',
58
+ webp: 'image/webp',
59
+ woff: 'font/woff',
60
+ woff2: 'font/woff2',
61
+ xhtml: 'application/xhtml+xml',
62
+ xls: 'application/vnd.ms-excel',
63
+ xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
64
+ xul: 'application/vnd.mozilla.xul+xml',
65
+ zip: 'application/zip',
66
+ '7z': 'application/x-7z-compressed',
67
+ }