eoss-ui 0.3.97

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 (378) hide show
  1. package/CHANGELOG.md +929 -0
  2. package/README.md +30 -0
  3. package/lib/button-group.js +2857 -0
  4. package/lib/button.js +2884 -0
  5. package/lib/card.js +603 -0
  6. package/lib/cascader.js +373 -0
  7. package/lib/checkbox-group.js +3099 -0
  8. package/lib/clients.js +375 -0
  9. package/lib/config/api.js +205 -0
  10. package/lib/data-table-form.js +3848 -0
  11. package/lib/data-table.js +6315 -0
  12. package/lib/date-picker.js +2821 -0
  13. package/lib/dialog.js +3730 -0
  14. package/lib/enterprise.js +372 -0
  15. package/lib/eoss-ui.common.js +65365 -0
  16. package/lib/error-page.js +293 -0
  17. package/lib/flow-group.js +4200 -0
  18. package/lib/flow-list.js +4350 -0
  19. package/lib/flow.js +12893 -0
  20. package/lib/form.js +15635 -0
  21. package/lib/handle-user.js +2900 -0
  22. package/lib/handler.js +3118 -0
  23. package/lib/index.js +1 -0
  24. package/lib/input-number.js +2743 -0
  25. package/lib/input.js +2935 -0
  26. package/lib/label.js +411 -0
  27. package/lib/login.js +5048 -0
  28. package/lib/main.js +5816 -0
  29. package/lib/mainComp.js +6530 -0
  30. package/lib/menu.js +529 -0
  31. package/lib/nav.js +3048 -0
  32. package/lib/notify.js +1079 -0
  33. package/lib/page.js +3036 -0
  34. package/lib/pagination.js +354 -0
  35. package/lib/player.js +2904 -0
  36. package/lib/qr-code.js +2860 -0
  37. package/lib/radio-group.js +3091 -0
  38. package/lib/select-ganged.js +3242 -0
  39. package/lib/select.js +3295 -0
  40. package/lib/selector-panel.js +4425 -0
  41. package/lib/selector.js +3722 -0
  42. package/lib/sizer.js +3067 -0
  43. package/lib/steps.js +2943 -0
  44. package/lib/switch.js +2784 -0
  45. package/lib/table-form.js +6211 -0
  46. package/lib/tabs-panel.js +274 -0
  47. package/lib/tabs.js +4988 -0
  48. package/lib/theme-chalk/base.css +1 -0
  49. package/lib/theme-chalk/button-group.css +1 -0
  50. package/lib/theme-chalk/button.css +0 -0
  51. package/lib/theme-chalk/card.css +1 -0
  52. package/lib/theme-chalk/cascader.css +0 -0
  53. package/lib/theme-chalk/checkbox-group.css +1 -0
  54. package/lib/theme-chalk/clients.css +1 -0
  55. package/lib/theme-chalk/data-table-form.css +1 -0
  56. package/lib/theme-chalk/data-table.css +1 -0
  57. package/lib/theme-chalk/date-picker.css +1 -0
  58. package/lib/theme-chalk/dialog.css +1 -0
  59. package/lib/theme-chalk/enterprise.css +1 -0
  60. package/lib/theme-chalk/error-page.css +1 -0
  61. package/lib/theme-chalk/flow-chart.css +0 -0
  62. package/lib/theme-chalk/flow-group.css +1 -0
  63. package/lib/theme-chalk/flow-list.css +1 -0
  64. package/lib/theme-chalk/flow.css +1 -0
  65. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  66. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  67. package/lib/theme-chalk/form.css +1 -0
  68. package/lib/theme-chalk/handle-user.css +1 -0
  69. package/lib/theme-chalk/handler.css +1 -0
  70. package/lib/theme-chalk/icon.css +1 -0
  71. package/lib/theme-chalk/index.css +1 -0
  72. package/lib/theme-chalk/input-number.css +0 -0
  73. package/lib/theme-chalk/input.css +1 -0
  74. package/lib/theme-chalk/label.css +1 -0
  75. package/lib/theme-chalk/login.css +1 -0
  76. package/lib/theme-chalk/main.css +1 -0
  77. package/lib/theme-chalk/mainComp.css +0 -0
  78. package/lib/theme-chalk/menu.css +1 -0
  79. package/lib/theme-chalk/nav.css +1 -0
  80. package/lib/theme-chalk/notify.css +0 -0
  81. package/lib/theme-chalk/page.css +1 -0
  82. package/lib/theme-chalk/pagination.css +1 -0
  83. package/lib/theme-chalk/player.css +1 -0
  84. package/lib/theme-chalk/qr-code.css +1 -0
  85. package/lib/theme-chalk/radio-group.css +1 -0
  86. package/lib/theme-chalk/radio.css +1 -0
  87. package/lib/theme-chalk/select-ganged.css +1 -0
  88. package/lib/theme-chalk/select.css +0 -0
  89. package/lib/theme-chalk/selector-panel.css +1 -0
  90. package/lib/theme-chalk/selector.css +1 -0
  91. package/lib/theme-chalk/sizer.css +1 -0
  92. package/lib/theme-chalk/steps.css +1 -0
  93. package/lib/theme-chalk/switch.css +1 -0
  94. package/lib/theme-chalk/table-form.css +0 -0
  95. package/lib/theme-chalk/tabs-panel.css +0 -0
  96. package/lib/theme-chalk/tabs.css +1 -0
  97. package/lib/theme-chalk/tips.css +1 -0
  98. package/lib/theme-chalk/toolbar.css +1 -0
  99. package/lib/theme-chalk/tree-group.css +1 -0
  100. package/lib/theme-chalk/tree.css +1 -0
  101. package/lib/theme-chalk/upload.css +1 -0
  102. package/lib/theme-chalk/wujie.css +0 -0
  103. package/lib/theme-chalk/wxlogin.css +1 -0
  104. package/lib/tips.js +2830 -0
  105. package/lib/toolbar.js +531 -0
  106. package/lib/tree-group.js +3373 -0
  107. package/lib/tree.js +3482 -0
  108. package/lib/upload.js +3913 -0
  109. package/lib/utils/bus.js +9 -0
  110. package/lib/utils/date-util.js +318 -0
  111. package/lib/utils/http.js +58 -0
  112. package/lib/utils/rules.js +19 -0
  113. package/lib/utils/store.js +22 -0
  114. package/lib/utils/util.js +2056 -0
  115. package/lib/wujie.js +2845 -0
  116. package/lib/wxlogin.js +2799 -0
  117. package/package.json +151 -0
  118. package/packages/button/index.js +5 -0
  119. package/packages/button/src/main.vue +264 -0
  120. package/packages/button-group/index.js +5 -0
  121. package/packages/button-group/src/main.vue +130 -0
  122. package/packages/card/index.js +5 -0
  123. package/packages/card/src/main.vue +144 -0
  124. package/packages/cascader/index.js +5 -0
  125. package/packages/cascader/src/main.vue +144 -0
  126. package/packages/checkbox-group/index.js +5 -0
  127. package/packages/checkbox-group/src/main.vue +285 -0
  128. package/packages/clients/index.js +5 -0
  129. package/packages/clients/src/main.vue +50 -0
  130. package/packages/data-table/index.js +5 -0
  131. package/packages/data-table/src/children.vue +40 -0
  132. package/packages/data-table/src/column.vue +796 -0
  133. package/packages/data-table/src/main copy.vue +1383 -0
  134. package/packages/data-table/src/main.vue +1229 -0
  135. package/packages/data-table/src/mixins/table.js +12 -0
  136. package/packages/data-table/src/sizer.vue +160 -0
  137. package/packages/data-table-form/index.js +5 -0
  138. package/packages/data-table-form/src/colgroup.vue +17 -0
  139. package/packages/data-table-form/src/main.vue +167 -0
  140. package/packages/data-table-form/src/table.vue +192 -0
  141. package/packages/data-table-form/src/tbody.vue +219 -0
  142. package/packages/data-table-form/src/thead.vue +68 -0
  143. package/packages/date-picker/index.js +5 -0
  144. package/packages/date-picker/src/main.vue +185 -0
  145. package/packages/dialog/index.js +5 -0
  146. package/packages/dialog/src/main.vue +442 -0
  147. package/packages/enterprise/index.js +5 -0
  148. package/packages/enterprise/src/main.vue +66 -0
  149. package/packages/error-page/index.js +5 -0
  150. package/packages/error-page/src/main.vue +44 -0
  151. package/packages/flow/index.js +5 -0
  152. package/packages/flow/src/component/CommonOpinions.vue +290 -0
  153. package/packages/flow/src/component/CustomPreset.vue +311 -0
  154. package/packages/flow/src/component/FileList.vue +97 -0
  155. package/packages/flow/src/component/Preset.vue +253 -0
  156. package/packages/flow/src/component/SendMsg.vue +221 -0
  157. package/packages/flow/src/component/TimeLimit.vue +190 -0
  158. package/packages/flow/src/component/taskUnionExamine.vue +507 -0
  159. package/packages/flow/src/form.vue +120 -0
  160. package/packages/flow/src/main.vue +2107 -0
  161. package/packages/flow/src/processForm.vue +866 -0
  162. package/packages/flow/src/processReject.vue +262 -0
  163. package/packages/flow/src/selectUser.vue +425 -0
  164. package/packages/flow/src/startTaskRead.vue +556 -0
  165. package/packages/flow/src/table.vue +51 -0
  166. package/packages/flow-group/index.js +5 -0
  167. package/packages/flow-group/src/main.vue +540 -0
  168. package/packages/flow-list/index.js +5 -0
  169. package/packages/flow-list/src/flow-table.vue +445 -0
  170. package/packages/flow-list/src/main.vue +456 -0
  171. package/packages/form/index.js +5 -0
  172. package/packages/form/src/main.vue +4429 -0
  173. package/packages/form/src/table.vue +1196 -0
  174. package/packages/handle-user/index.js +5 -0
  175. package/packages/handle-user/src/main.vue +122 -0
  176. package/packages/handler/index.js +5 -0
  177. package/packages/handler/src/main.vue +306 -0
  178. package/packages/input/index.js +5 -0
  179. package/packages/input/src/main.vue +307 -0
  180. package/packages/input-number/index.js +5 -0
  181. package/packages/input-number/src/main.vue +106 -0
  182. package/packages/label/index.js +5 -0
  183. package/packages/label/src/main.vue +208 -0
  184. package/packages/login/index.js +5 -0
  185. package/packages/login/src/main.vue +1193 -0
  186. package/packages/login/src/resetPassword.vue +332 -0
  187. package/packages/main/index.js +5 -0
  188. package/packages/main/src/main.vue +1496 -0
  189. package/packages/main/src/message.vue +239 -0
  190. package/packages/main/src/notice.vue +145 -0
  191. package/packages/main/src/settings.vue +105 -0
  192. package/packages/main/src/userinfo.vue +430 -0
  193. package/packages/mainComp/index.js +5 -0
  194. package/packages/mainComp/src/async-component/index.vue +85 -0
  195. package/packages/mainComp/src/main.vue +1934 -0
  196. package/packages/mainComp/src/message.vue +239 -0
  197. package/packages/mainComp/src/notice.vue +152 -0
  198. package/packages/mainComp/src/settings.vue +105 -0
  199. package/packages/mainComp/src/userinfo.vue +423 -0
  200. package/packages/menu/index.js +5 -0
  201. package/packages/menu/src/main.vue +401 -0
  202. package/packages/nav/index.js +5 -0
  203. package/packages/nav/src/main.vue +250 -0
  204. package/packages/notify/index.js +5 -0
  205. package/packages/notify/src/main.vue +538 -0
  206. package/packages/page/index.js +5 -0
  207. package/packages/page/src/main.vue +167 -0
  208. package/packages/pagination/index.js +5 -0
  209. package/packages/pagination/src/main.vue +77 -0
  210. package/packages/player/index.js +5 -0
  211. package/packages/player/src/main.vue +194 -0
  212. package/packages/qr-code/index.js +5 -0
  213. package/packages/qr-code/src/main.vue +154 -0
  214. package/packages/radio/index.js +5 -0
  215. package/packages/radio/src/main.vue +259 -0
  216. package/packages/radio-group/index.js +6 -0
  217. package/packages/radio-group/src/main.vue +267 -0
  218. package/packages/select/index.js +5 -0
  219. package/packages/select/src/main.vue +683 -0
  220. package/packages/select-ganged/index.js +5 -0
  221. package/packages/select-ganged/src/main.vue +686 -0
  222. package/packages/selector/index.js +5 -0
  223. package/packages/selector/src/main.vue +588 -0
  224. package/packages/selector-panel/index.js +5 -0
  225. package/packages/selector-panel/src/main.vue +968 -0
  226. package/packages/selector-panel/src/selection.vue +142 -0
  227. package/packages/selector-panel/src/tree.vue +129 -0
  228. package/packages/sizer/index.js +5 -0
  229. package/packages/sizer/src/main.vue +254 -0
  230. package/packages/steps/index.js +5 -0
  231. package/packages/steps/src/main.vue +175 -0
  232. package/packages/switch/index.js +5 -0
  233. package/packages/switch/src/main.vue +154 -0
  234. package/packages/table-form/index.js +5 -0
  235. package/packages/tabs/index.js +5 -0
  236. package/packages/tabs/src/main.vue +749 -0
  237. package/packages/tabs-panel/index.js +5 -0
  238. package/packages/tabs-panel/src/main.vue +18 -0
  239. package/packages/theme-chalk/README.md +33 -0
  240. package/packages/theme-chalk/lib/base.css +1 -0
  241. package/packages/theme-chalk/lib/button-group.css +1 -0
  242. package/packages/theme-chalk/lib/button.css +0 -0
  243. package/packages/theme-chalk/lib/card.css +1 -0
  244. package/packages/theme-chalk/lib/cascader.css +0 -0
  245. package/packages/theme-chalk/lib/checkbox-group.css +1 -0
  246. package/packages/theme-chalk/lib/clients.css +1 -0
  247. package/packages/theme-chalk/lib/data-table-form.css +1 -0
  248. package/packages/theme-chalk/lib/data-table.css +1 -0
  249. package/packages/theme-chalk/lib/date-picker.css +1 -0
  250. package/packages/theme-chalk/lib/dialog.css +1 -0
  251. package/packages/theme-chalk/lib/enterprise.css +1 -0
  252. package/packages/theme-chalk/lib/error-page.css +1 -0
  253. package/packages/theme-chalk/lib/flow-chart.css +0 -0
  254. package/packages/theme-chalk/lib/flow-group.css +1 -0
  255. package/packages/theme-chalk/lib/flow-list.css +1 -0
  256. package/packages/theme-chalk/lib/flow.css +1 -0
  257. package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
  258. package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
  259. package/packages/theme-chalk/lib/form.css +1 -0
  260. package/packages/theme-chalk/lib/handle-user.css +1 -0
  261. package/packages/theme-chalk/lib/handler.css +1 -0
  262. package/packages/theme-chalk/lib/icon.css +1 -0
  263. package/packages/theme-chalk/lib/index.css +1 -0
  264. package/packages/theme-chalk/lib/input-number.css +0 -0
  265. package/packages/theme-chalk/lib/input.css +1 -0
  266. package/packages/theme-chalk/lib/label.css +1 -0
  267. package/packages/theme-chalk/lib/login.css +1 -0
  268. package/packages/theme-chalk/lib/main.css +1 -0
  269. package/packages/theme-chalk/lib/mainComp.css +0 -0
  270. package/packages/theme-chalk/lib/menu.css +1 -0
  271. package/packages/theme-chalk/lib/nav.css +1 -0
  272. package/packages/theme-chalk/lib/notify.css +0 -0
  273. package/packages/theme-chalk/lib/page.css +1 -0
  274. package/packages/theme-chalk/lib/pagination.css +1 -0
  275. package/packages/theme-chalk/lib/player.css +1 -0
  276. package/packages/theme-chalk/lib/qr-code.css +1 -0
  277. package/packages/theme-chalk/lib/radio-group.css +1 -0
  278. package/packages/theme-chalk/lib/radio.css +1 -0
  279. package/packages/theme-chalk/lib/select-ganged.css +1 -0
  280. package/packages/theme-chalk/lib/select.css +0 -0
  281. package/packages/theme-chalk/lib/selector-panel.css +1 -0
  282. package/packages/theme-chalk/lib/selector.css +1 -0
  283. package/packages/theme-chalk/lib/sizer.css +1 -0
  284. package/packages/theme-chalk/lib/steps.css +1 -0
  285. package/packages/theme-chalk/lib/switch.css +1 -0
  286. package/packages/theme-chalk/lib/table-form.css +0 -0
  287. package/packages/theme-chalk/lib/tabs-panel.css +0 -0
  288. package/packages/theme-chalk/lib/tabs.css +1 -0
  289. package/packages/theme-chalk/lib/tips.css +1 -0
  290. package/packages/theme-chalk/lib/toolbar.css +1 -0
  291. package/packages/theme-chalk/lib/tree-group.css +1 -0
  292. package/packages/theme-chalk/lib/tree.css +1 -0
  293. package/packages/theme-chalk/lib/upload.css +1 -0
  294. package/packages/theme-chalk/lib/wujie.css +0 -0
  295. package/packages/theme-chalk/lib/wxlogin.css +1 -0
  296. package/packages/theme-chalk/package.json +35 -0
  297. package/packages/theme-chalk/src/base.scss +165 -0
  298. package/packages/theme-chalk/src/button-group.scss +9 -0
  299. package/packages/theme-chalk/src/button.scss +0 -0
  300. package/packages/theme-chalk/src/card.scss +55 -0
  301. package/packages/theme-chalk/src/cascader.scss +0 -0
  302. package/packages/theme-chalk/src/checkbox-group.scss +8 -0
  303. package/packages/theme-chalk/src/clients.scss +72 -0
  304. package/packages/theme-chalk/src/common/var.scss +1516 -0
  305. package/packages/theme-chalk/src/data-table-form.scss +55 -0
  306. package/packages/theme-chalk/src/data-table.scss +202 -0
  307. package/packages/theme-chalk/src/date-picker.scss +8 -0
  308. package/packages/theme-chalk/src/dialog.scss +52 -0
  309. package/packages/theme-chalk/src/enterprise.scss +5 -0
  310. package/packages/theme-chalk/src/error-page.scss +18 -0
  311. package/packages/theme-chalk/src/flow-chart.scss +0 -0
  312. package/packages/theme-chalk/src/flow-group.scss +101 -0
  313. package/packages/theme-chalk/src/flow-list.scss +41 -0
  314. package/packages/theme-chalk/src/flow.scss +285 -0
  315. package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
  316. package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
  317. package/packages/theme-chalk/src/form.scss +451 -0
  318. package/packages/theme-chalk/src/handle-user.scss +40 -0
  319. package/packages/theme-chalk/src/handler.scss +131 -0
  320. package/packages/theme-chalk/src/icon.scss +1714 -0
  321. package/packages/theme-chalk/src/index.scss +50 -0
  322. package/packages/theme-chalk/src/input-number.scss +0 -0
  323. package/packages/theme-chalk/src/input.scss +3 -0
  324. package/packages/theme-chalk/src/label.scss +24 -0
  325. package/packages/theme-chalk/src/login.scss +490 -0
  326. package/packages/theme-chalk/src/main.scss +483 -0
  327. package/packages/theme-chalk/src/mainComp.scss +0 -0
  328. package/packages/theme-chalk/src/menu.scss +201 -0
  329. package/packages/theme-chalk/src/mixins/color.scss +117 -0
  330. package/packages/theme-chalk/src/mixins/mixins.scss +25 -0
  331. package/packages/theme-chalk/src/nav.scss +73 -0
  332. package/packages/theme-chalk/src/notify.scss +0 -0
  333. package/packages/theme-chalk/src/page.scss +3 -0
  334. package/packages/theme-chalk/src/pagination.scss +14 -0
  335. package/packages/theme-chalk/src/player.scss +9 -0
  336. package/packages/theme-chalk/src/qr-code.scss +17 -0
  337. package/packages/theme-chalk/src/radio-group.scss +9 -0
  338. package/packages/theme-chalk/src/radio.scss +3 -0
  339. package/packages/theme-chalk/src/select-ganged.scss +9 -0
  340. package/packages/theme-chalk/src/select.scss +0 -0
  341. package/packages/theme-chalk/src/selector-panel.scss +203 -0
  342. package/packages/theme-chalk/src/selector.scss +85 -0
  343. package/packages/theme-chalk/src/sizer.scss +36 -0
  344. package/packages/theme-chalk/src/steps.scss +88 -0
  345. package/packages/theme-chalk/src/switch.scss +3 -0
  346. package/packages/theme-chalk/src/table-form.scss +1 -0
  347. package/packages/theme-chalk/src/tabs-panel.scss +0 -0
  348. package/packages/theme-chalk/src/tabs.scss +91 -0
  349. package/packages/theme-chalk/src/tips.scss +7 -0
  350. package/packages/theme-chalk/src/toolbar.scss +121 -0
  351. package/packages/theme-chalk/src/tree-group.scss +64 -0
  352. package/packages/theme-chalk/src/tree.scss +140 -0
  353. package/packages/theme-chalk/src/upload.scss +131 -0
  354. package/packages/theme-chalk/src/wujie.scss +0 -0
  355. package/packages/theme-chalk/src/wxlogin.scss +3 -0
  356. package/packages/tips/index.js +5 -0
  357. package/packages/tips/src/main.vue +126 -0
  358. package/packages/toolbar/index.js +5 -0
  359. package/packages/toolbar/src/main.vue +377 -0
  360. package/packages/tree/index.js +5 -0
  361. package/packages/tree/src/main.vue +636 -0
  362. package/packages/tree-group/index.js +5 -0
  363. package/packages/tree-group/src/main.vue +435 -0
  364. package/packages/upload/index.js +5 -0
  365. package/packages/upload/src/main.vue +1033 -0
  366. package/packages/upload/src/picture.js +15 -0
  367. package/packages/wujie/index.js +5 -0
  368. package/packages/wujie/src/main.vue +137 -0
  369. package/packages/wxlogin/index.js +5 -0
  370. package/packages/wxlogin/src/main.vue +110 -0
  371. package/src/config/api.js +211 -0
  372. package/src/index.js +167 -0
  373. package/src/utils/bus.js +3 -0
  374. package/src/utils/date-util.js +312 -0
  375. package/src/utils/http.js +50 -0
  376. package/src/utils/rules.js +18 -0
  377. package/src/utils/store.js +21 -0
  378. package/src/utils/util.js +2105 -0
@@ -0,0 +1,1934 @@
1
+ <template>
2
+ <div class="es-main">
3
+ <div
4
+ class="es-main-header"
5
+ :style="{ backgroundImage: headerImg ? 'url(' + headerImg + ')' : '' }"
6
+ >
7
+ <AsyncComponent
8
+ v-if="themeJSON.logo.comp"
9
+ :style="!themeJSON.topNav.comp ? 'width:100%' : ''"
10
+ :key="themeJSON.logo.comp"
11
+ v-bind="themeJSON.logo.data"
12
+ :componentRenderUrl="themeJSON.logo.comp"
13
+ />
14
+ <el-image v-if="showDefault" class="es-main-logo" :src="logoUrl">
15
+ <template slot="error">
16
+ <div class="es-logo-error">
17
+ <i class="el-icon-picture-outline"></i>LOGO
18
+ </div>
19
+ </template>
20
+ </el-image>
21
+ <div class="es-main-top-nav">
22
+ <es-menu
23
+ v-if="navs.length"
24
+ class="es-fourth-tabs"
25
+ :data="navs"
26
+ :icons="icons"
27
+ :popperClass="`el-menu--popup-${modal}`"
28
+ mode="horizontal"
29
+ :deep="modal === 'topnav'"
30
+ :default-active="topActive"
31
+ @select="
32
+ res => {
33
+ handleSelect(res, 'nav');
34
+ }
35
+ "
36
+ ></es-menu>
37
+ </div>
38
+
39
+ <AsyncComponent
40
+ v-if="themeJSON.topNav.comp"
41
+ :style="!themeJSON.logo.comp ? 'width:100%' : ''"
42
+ :hide="hide"
43
+ :subSystem="subsystem"
44
+ :online="online"
45
+ :application="application"
46
+ :storage="storage"
47
+ :notice="notice"
48
+ :data="handleData"
49
+ :key="themeJSON.topNav.comp"
50
+ v-bind="themeJSON.topNav.data"
51
+ :componentRenderUrl="themeJSON.topNav.comp"
52
+ @select="
53
+ res => {
54
+ handleSelect(res, 'sys');
55
+ }
56
+ "
57
+ @click="handleClick"
58
+ />
59
+ <es-handler
60
+ v-if="showDefault"
61
+ :userModel="userModel"
62
+ :hide="hide"
63
+ :subSystem="subsystem"
64
+ :online="online"
65
+ :application="application"
66
+ :storage="storage"
67
+ :notice="notice"
68
+ :data="handleData"
69
+ @select="
70
+ res => {
71
+ handleSelect(res, 'sys');
72
+ }
73
+ "
74
+ @click="handleClick"
75
+ ></es-handler>
76
+ </div>
77
+ <div class="es-main-box" v-if="reset">
78
+ <div class="es-main-left">
79
+ <AsyncComponent
80
+ v-if="themeJSON.leftNav.comp"
81
+ :biserial="biserial"
82
+ :newTitle="showNavTitle ? title : false"
83
+ :default-active="active"
84
+ :menu-tips="menuTips"
85
+ :scene="scene"
86
+ :key="themeJSON.leftNav.comp"
87
+ v-bind="themeJSON.leftNav.data"
88
+ :componentRenderUrl="themeJSON.leftNav.comp"
89
+ :newMenu="menu"
90
+ :application="application"
91
+ :menuUrl="menuUrl"
92
+ @trigger="
93
+ res => {
94
+ handleSelect(res, 'sub');
95
+ }
96
+ "
97
+ @select="
98
+ res => {
99
+ handleSelect(res, 'menu');
100
+ }
101
+ "
102
+ @success="menuSuccess"
103
+ />
104
+ <es-nav
105
+ v-if="showDefault"
106
+ :data="menu"
107
+ :biserial="biserial"
108
+ :width="navWidth"
109
+ :icons="icons"
110
+ :title="showNavTitle ? title : false"
111
+ :showCollapse="showNavTitle"
112
+ :default-active="active"
113
+ :menu-tips="menuTips"
114
+ :is-default="isDefault"
115
+ @trigger="
116
+ res => {
117
+ handleSelect(res, 'sub');
118
+ }
119
+ "
120
+ @select="
121
+ res => {
122
+ handleSelect(res, 'menu');
123
+ }
124
+ "
125
+ ></es-nav>
126
+ </div>
127
+ <div class="es-main-body">
128
+ <div v-if="fourthTabs" class="es-fourth-tabs">
129
+ <es-menu
130
+ :data="tabs"
131
+ :titleIcons="false"
132
+ mode="horizontal"
133
+ :default-active="tabsId"
134
+ :menu-tips="menuTips"
135
+ @select="
136
+ res => {
137
+ handleSelect(res, 'tabs');
138
+ }
139
+ "
140
+ ></es-menu>
141
+ </div>
142
+ <div class="es-body">
143
+ <div
144
+ class="es-body-main"
145
+ :style="themeJSON.copyright.comp ? 'bottom:60px' : ''"
146
+ >
147
+ <iframe
148
+ v-if="method === 'iframe'"
149
+ :id="iframeId"
150
+ :name="iframeId"
151
+ frameborder="0"
152
+ width="100%"
153
+ height="100%"
154
+ :src="page"
155
+ ></iframe>
156
+ <template v-else-if="method === 'wujie' && refresh">
157
+ <WujieVue
158
+ v-bind="wujieprops"
159
+ :name="wjName"
160
+ width="100%"
161
+ height="100%"
162
+ :url="page"
163
+ ></WujieVue>
164
+ </template>
165
+ <template v-else-if="method === 'router' && refresh">
166
+ <router-view v-if="!isKeepAlive" :key="routerKey" />
167
+ <keep-alive>
168
+ <router-view v-if="isKeepAlive" :key="routerKey"
169
+ /></keep-alive>
170
+ </template>
171
+ </div>
172
+ <AsyncComponent
173
+ style="position: absolute;
174
+ height: 60px;
175
+ bottom: 0;
176
+ left: 0;
177
+ right: 0;"
178
+ v-if="themeJSON.copyright.comp"
179
+ :key="themeJSON.copyright.comp"
180
+ v-bind="themeJSON.copyright.data"
181
+ :componentRenderUrl="themeJSON.copyright.comp"
182
+ />
183
+ <notice :data="sysMsg" @opened="handleOpened"></notice>
184
+ <message
185
+ v-if="showMsg"
186
+ ref="message"
187
+ :total.sync="notice"
188
+ :visible.sync="showMsg"
189
+ :winopen="winopen"
190
+ @ignore="handleChange"
191
+ @handle="handleMenuTips"
192
+ ></message>
193
+ </div>
194
+ </div>
195
+ </div>
196
+ <!-- <div v-show="set" ref="box" class="es-sets-button">
197
+ <el-button
198
+ type="primary"
199
+ class="es-icon-xitongguanli"
200
+ ref="area"
201
+ ></el-button>
202
+ </div> -->
203
+ <settings
204
+ v-bind="$attrs"
205
+ :theme="color"
206
+ :predefine="themes"
207
+ :visible.sync="showSet"
208
+ @change="handleChange"
209
+ ></settings>
210
+ <es-dialog
211
+ v-if="showUserInfo"
212
+ title="用户信息配置"
213
+ height="770px"
214
+ :visible.sync="showUserInfo"
215
+ @close="reGetConfig"
216
+ >
217
+ <slot name="user">
218
+ <userinfo
219
+ v-bind="$attrs"
220
+ @change="handleUserModel"
221
+ @reGetConfig="reGetConfig"
222
+ >
223
+ <slot name="userInfo"></slot>
224
+ </userinfo>
225
+ </slot>
226
+ </es-dialog>
227
+ <es-dialog
228
+ v-if="dialog.show"
229
+ v-bind="dialog"
230
+ :visible.sync="dialog.show"
231
+ ></es-dialog>
232
+ </div>
233
+ </template>
234
+ <script>
235
+ import userinfo from './userinfo.vue';
236
+ import settings from './settings.vue';
237
+ import message from './message.vue';
238
+ import notice from './notice.vue';
239
+ import AsyncComponent from './async-component/index.vue';
240
+ import {
241
+ mainConfig,
242
+ updateUserCustomInfo,
243
+ getComplexApplications,
244
+ getComplexApplicationsNew,
245
+ mainDetail,
246
+ wss,
247
+ topic
248
+ } from 'eoss-ui/src/config/api.js';
249
+ import store from 'eoss-ui/src/utils/store';
250
+ import util from 'eoss-ui/src/utils/util';
251
+ import SockJS from 'sockjs-client';
252
+ import Stomp from 'stompjs';
253
+ const isIE = navigator.userAgent.indexOf('MSIE') != -1;
254
+ export default {
255
+ name: 'EsMainComp',
256
+ inheritAttrs: false,
257
+ components: {
258
+ userinfo,
259
+ settings,
260
+ message,
261
+ AsyncComponent,
262
+ notice
263
+ },
264
+ props: {
265
+ //菜单导航地址
266
+ menuUrl: String,
267
+ icons: Object,
268
+ //logo
269
+ logo: {
270
+ type: String,
271
+ default: 'errorlogo'
272
+ },
273
+ //菜单显示类型
274
+ scene: {
275
+ type: String,
276
+ default: 'default'
277
+ },
278
+ //操作栏配置
279
+ handleData: Array, //host
280
+ host: {
281
+ type: String,
282
+ default() {
283
+ return util.getStorage('host') ? util.getStorage('host') : '';
284
+ }
285
+ },
286
+ //本地导航
287
+ data: Array,
288
+ //头部背景图片
289
+ headerImage: String,
290
+ //默认选中菜单id
291
+ defaultActive: Array,
292
+ //默认主题颜色
293
+ theme: {
294
+ type: String,
295
+ default: '#409eff'
296
+ },
297
+ //主题颜色选择颜色集合
298
+ themes: Array,
299
+ //需要隐藏的头部功能
300
+ hides: Object,
301
+
302
+ //储存数据
303
+ storage: {
304
+ type: String,
305
+ default() {
306
+ return util.getStorage('storage');
307
+ }
308
+ },
309
+ //是否启用子应用菜单接口
310
+ application: {
311
+ type: Boolean,
312
+ default: false
313
+ },
314
+ //是否显示设置按钮
315
+ set: {
316
+ type: Boolean,
317
+ default: false
318
+ },
319
+ //websocket
320
+ socket: {
321
+ type: Boolean,
322
+ default: true
323
+ },
324
+ //无界微前端属性
325
+ wjprops: {
326
+ type: Object,
327
+ default() {
328
+ return {};
329
+ }
330
+ },
331
+
332
+ //socket调试modal
333
+ console: {
334
+ type: Boolean,
335
+ default: false
336
+ },
337
+ //消息办理是否采用window.open的方式打开
338
+ winopen: {
339
+ type: Boolean,
340
+ default: true
341
+ },
342
+ //获取用户信息的接口
343
+ mainConfig: {
344
+ type: String,
345
+ default: mainConfig
346
+ },
347
+ iframeId: {
348
+ type: String,
349
+ default: 'stage'
350
+ },
351
+ routePath: {
352
+ type: String,
353
+ default: '/main'
354
+ },
355
+ setFirstAsDefault: Boolean,
356
+ pathUrl: {
357
+ type: String,
358
+ default: '/primary'
359
+ },
360
+ keepAlive: Boolean,
361
+ loadWujie: {
362
+ type: Boolean,
363
+ default: true
364
+ },
365
+ downgrade: {
366
+ type: Boolean,
367
+ default: true
368
+ },
369
+ empty: {
370
+ type: String,
371
+ default: '#/empty'
372
+ }
373
+ },
374
+ computed: {
375
+ //菜单类型
376
+ modal() {
377
+ return this.scene.toLowerCase();
378
+ },
379
+ isHomePage() {
380
+ if (util.getParams('applicationid') || util.getParams('applicationId')) {
381
+ return false;
382
+ }
383
+ let hash = util.win.location.hash;
384
+ if (
385
+ hash &&
386
+ hash.split('?')[0] !== '#/' &&
387
+ hash.split('?')[0] !== '#/mian'
388
+ ) {
389
+ return false;
390
+ }
391
+ return true;
392
+ },
393
+ navWidth() {
394
+ return this.modal === 'topside' ? '230px' : undefined;
395
+ },
396
+ showNavTitle() {
397
+ return this.modal !== 'topside';
398
+ },
399
+ //tabs菜单
400
+ fourthTabs() {
401
+ return this.tabs.length;
402
+ },
403
+ //菜单接口
404
+ action() {
405
+ if (this.menuUrl) {
406
+ return this.menuUrl;
407
+ }
408
+ if (this.application) {
409
+ return getComplexApplicationsNew;
410
+ }
411
+ return getComplexApplications;
412
+ },
413
+ //是否双列右侧菜单
414
+ biserial() {
415
+ if (
416
+ this.modal === 'subsystem' ||
417
+ this.modal === 'topside' ||
418
+ this.application
419
+ ) {
420
+ return false;
421
+ } else {
422
+ return true;
423
+ }
424
+ },
425
+ //隐藏操作按键
426
+ hide() {
427
+ if (this.modal === 'subsystem' || this.application) {
428
+ if (this.hides && Object.keys(this.hides).length) {
429
+ return { ...this.hides, set: !this.set, system: false };
430
+ } else {
431
+ return { set: !this.set, system: false };
432
+ }
433
+ } else if (this.modal === 'topside') {
434
+ if (this.hides && Object.keys(this.hides).length) {
435
+ return {
436
+ ...this.hides,
437
+ set: !this.set,
438
+ system: true,
439
+ user: true
440
+ };
441
+ } else {
442
+ return { set: !this.set, system: true, user: true };
443
+ }
444
+ } else {
445
+ if (this.hides && Object.keys(this.hides).length) {
446
+ return {
447
+ ...this.hides,
448
+ set: !this.set,
449
+ system: true,
450
+ user: true
451
+ };
452
+ } else {
453
+ return { set: !this.set, system: true };
454
+ }
455
+ }
456
+ },
457
+ logoUrl() {
458
+ if (this.mainLogo) {
459
+ return this.mainLogo;
460
+ }
461
+ return this.logo;
462
+ },
463
+ wujieprops() {
464
+ return util.extend(true, this.wjprops, this.defaultwjprops, {
465
+ attrs: { src: this.empty }
466
+ });
467
+ }
468
+ },
469
+ watch: {
470
+ // defaultActive: {
471
+ // immediate: true,
472
+ // deep: true,
473
+ // handler(val) {
474
+ // if (val && val.length) {
475
+ // if (this.menus.length) {
476
+ // this.setDefault(JSON.parse(JSON.stringify(this.menus)), val);
477
+ // }
478
+ // }
479
+ // }
480
+ // },
481
+ menuTips: {
482
+ immediate: true,
483
+ deep: true,
484
+ handler(val) {
485
+ if (Object.keys(val).length && this.menus.length) {
486
+ this.setTips(this.menus);
487
+ }
488
+ }
489
+ },
490
+ color: {
491
+ immediate: true,
492
+ handler(val) {
493
+ if (this.set) {
494
+ localStorage.setItem('theme', val);
495
+ util.updateTheme(val);
496
+ }
497
+ }
498
+ }
499
+ },
500
+ data() {
501
+ return {
502
+ showDefault: false,
503
+ themeJSON: {
504
+ logo: { comp: '', data: {} },
505
+ topNav: { comp: '', data: {} },
506
+ leftNav: { comp: '', data: {} },
507
+ copyright: { comp: '', data: {} }
508
+ },
509
+ pageLoading: false,
510
+ client: null,
511
+ websocket: null,
512
+ connect: 0,
513
+ wjName: 'singlespa',
514
+ menus: [],
515
+ //头部导航
516
+ navs: [],
517
+ //头部默认选择
518
+ topActive: '',
519
+ //子系统菜单
520
+ subsystem: [],
521
+ //头部子系统子导航默认选中项
522
+ sysId: '',
523
+ //导航默认选择
524
+ active: [],
525
+ //完整导航选中的ID
526
+ actives: [],
527
+ //初始默认选中菜单id
528
+ defaultActive: [],
529
+ //侧边导航
530
+ menu: [],
531
+ //菜单名称
532
+ title: '',
533
+ //菜单提醒气泡
534
+ menuTips: {},
535
+ //面包屑导航
536
+ tabs: [],
537
+ //页签导航默认选中值
538
+ tabsId: '',
539
+ //路由类型
540
+ method: 'router',
541
+ //页面地址
542
+ page: '',
543
+ //选中的地址
544
+ selectPage: '',
545
+ //主页面
546
+ homePage: '',
547
+ //header背景
548
+ mainLogo: null,
549
+ headerImg: this.headerImage,
550
+ //在线人数
551
+ online: 1,
552
+ //通知数
553
+ notice: 0,
554
+ //是否显示消息列表框
555
+ showMsg: false,
556
+ //即时消息
557
+ sysMsg: [],
558
+ //定时关闭及时消息对象
559
+ sysMsgOut: null,
560
+ //额外信息数据
561
+ extraData: '',
562
+ //用户信息
563
+ userModel: {},
564
+ //刷新路由
565
+ refresh: true,
566
+ //显示设置面板
567
+ showSet: false,
568
+ //弹窗配置
569
+ dialog: {
570
+ title: '',
571
+ params: {},
572
+ url: '',
573
+ index: null,
574
+ show: false
575
+ },
576
+ //当前设置的主题
577
+ color: util.getStorage('theme') ? util.getStorage('theme') : this.theme,
578
+ //显示用户信息
579
+ showUserInfo: false,
580
+ //是否展示侧边导航
581
+ showMenu: true,
582
+ props: {},
583
+ menuType: '',
584
+ //是否首次加载
585
+ isDefault: true,
586
+ reset: true,
587
+ customMenu: [],
588
+ isKeepAlive: this.keepAlive,
589
+ routerKey: '',
590
+ defaultwjprops: {}
591
+ };
592
+ },
593
+ created() {
594
+ this.getConfig();
595
+ // if (this.data === undefined) {
596
+ // this.getMenu();
597
+ // } else {
598
+ // this.menus = JSON.parse(JSON.stringify(this.data));
599
+ // this.setMenu(this.data);
600
+ // }
601
+ if (this.socket) {
602
+ this.initWebSocket();
603
+ }
604
+ },
605
+ mounted() {
606
+ //this.move();
607
+ util.win.reLogin = this.handleReLogin;
608
+ this.handleListener();
609
+ util.win.refresh = this.handleRefresh;
610
+ util.win.jumpMenu = this.jumpMenu;
611
+ if (util.win.$wujie) {
612
+ util.win.$wujie.bus.$on('changeTheme', res => {
613
+ util.updateTheme(res);
614
+ });
615
+ }
616
+ },
617
+ methods: {
618
+ menuSuccess(res) {
619
+ // this.menus
620
+ this.menuType = 'custom';
621
+ this.customMenu = res;
622
+ this.setMenu(res);
623
+ },
624
+ //获取主题模板JSON
625
+ getMainDetail(id) {
626
+ let params = {
627
+ url: mainDetail,
628
+ params: { id }
629
+ };
630
+ util
631
+ .ajax(params)
632
+ .then(res => {
633
+ let _that = this;
634
+ if (!res.results) {
635
+ _that.showDefault = true;
636
+ }
637
+ if (res.rCode == 0) {
638
+ if (res.results && JSON.parse(res.results.layout)) {
639
+ // 初始化布局器
640
+ _that.themeJSON = JSON.parse(res.results.layout);
641
+ let count = 0;
642
+ for (let key in _that.themeJSON) {
643
+ if (_that.themeJSON[key].comp) {
644
+ count++;
645
+ }
646
+ }
647
+ if (count == 0) {
648
+ _that.showDefault = true;
649
+ }
650
+ let theme = JSON.parse(res.results.theme);
651
+
652
+ util.updateTheme(theme.primaryColor);
653
+ _that.handleColorToPage(theme.globalThalk);
654
+ }
655
+ } else {
656
+ _that.$message.error('主题加载发生错误');
657
+ throw res.msg || '系统错误,请联系管理员!';
658
+ }
659
+ if (_that.showDefault && _that.data === undefined) {
660
+ _that.getMenu();
661
+ } else if (_that.showDefault) {
662
+ _that.menus = JSON.parse(JSON.stringify(_that.data));
663
+ _that.setMenu(_that.data);
664
+ }
665
+ })
666
+ .catch(err => {
667
+ if (err.message && err.message !== 'canceled') {
668
+ this.$message.error(err.message);
669
+ }
670
+ });
671
+ },
672
+ // 将chalk写入到页面中
673
+ handleColorToPage(globalThalk) {
674
+ const thalk = document.getElementById('chalk-style');
675
+ if (!thalk) {
676
+ let ele = document.createElement('style');
677
+ ele.setAttribute('id', 'chalk-style');
678
+ ele.innerText = globalThalk;
679
+ document.head.appendChild(ele);
680
+ }
681
+ // 如果设置过主题的话
682
+ else {
683
+ thalk.innerText = globalThalk;
684
+ }
685
+ },
686
+ //设置按钮拖动
687
+ move() {
688
+ let area = this.$refs.area.$el;
689
+ let box = this.$refs.box;
690
+ let [sTime, eTime] = [0, 0];
691
+ area.addEventListener('mousedown', e => {
692
+ sTime = new Date().getTime();
693
+ let { y: downY } = e;
694
+ let { height: winH } = document.body.getBoundingClientRect();
695
+ //防止拖动期间选中和复制网页文本
696
+ document.body.onselectstart = document.body.oncontextmenu = () => {
697
+ return false;
698
+ };
699
+ document.onmousemove = eve => {
700
+ let size = 40;
701
+ let { y: moveY } = eve;
702
+ let { top: boxTop } = box.getBoundingClientRect();
703
+ boxTop = boxTop + (moveY - downY);
704
+ boxTop >= winH - size && (boxTop = winH - size);
705
+ boxTop <= -size && (boxTop = -size);
706
+ if (boxTop < 64) {
707
+ boxTop = 64;
708
+ }
709
+ box.style.top = boxTop + 'px';
710
+ downY = moveY;
711
+ };
712
+ document.onmouseup = () => {
713
+ eTime = new Date().getTime();
714
+ let isClick = eTime - sTime < 200;
715
+ if (isClick) {
716
+ let onArea = () => {
717
+ this.handleSet();
718
+ area.removeEventListener('click', onArea);
719
+ };
720
+ area.addEventListener('click', onArea);
721
+ }
722
+ document.onmousemove = null;
723
+ document.body.onselectstart = document.body.oncontextmenu = () => {
724
+ return true;
725
+ };
726
+ };
727
+ });
728
+ },
729
+ //设置主题颜色
730
+ setTheme(color) {
731
+ if (!color) {
732
+ return;
733
+ }
734
+ util
735
+ .ajax({
736
+ url: updateUserCustomInfo,
737
+ params: { color: escape(color.toLowerCase()) },
738
+ data: { color: escape(color.toLowerCase()) }
739
+ })
740
+ .then(res => {
741
+ if (res.rCode === 0) {
742
+ this.color = color;
743
+ localStorage.setItem('theme', color);
744
+ this.$emit('setting', 'theme', this.color);
745
+ this.$message({
746
+ message: res.msg,
747
+ type: 'success',
748
+ duration: 2000
749
+ });
750
+ } else {
751
+ let msg = res.msg || '系统错误,请联系管理员!';
752
+ this.$message.error(msg);
753
+ }
754
+ })
755
+ .catch(err => {
756
+ if (err.message && err.message !== 'canceled') {
757
+ this.$message.error(err.message);
758
+ }
759
+ });
760
+ },
761
+ //显示隐藏设置面板
762
+ handleSet() {
763
+ this.showSet = !this.showSet;
764
+ },
765
+ setConfig(results, flag) {
766
+ let hash = util.win.location.hash;
767
+ for (let i in results) {
768
+ if (i === 'mainLogoUrl' && results[i]) {
769
+ this.mainLogo = results[i];
770
+ }
771
+ if (
772
+ i === 'mainBannerUrl' &&
773
+ results[i] &&
774
+ this.headerImage === undefined
775
+ ) {
776
+ this.headerImg = results[i];
777
+ }
778
+ if (i === 'initApplication' && results[i]) {
779
+ this.results[i] = results[i].split(',');
780
+ }
781
+ if (i === 'indexUrl' && results[i] && hash.indexOf('main') > -1) {
782
+ this.homePage = results[i];
783
+ this.isHomePage && this.handleJump(this.homePage);
784
+ }
785
+ if (i === 'subsystemName') {
786
+ document.title = results[i];
787
+ }
788
+ if (i === 'userStyle' && results[i].color) {
789
+ this.color = unescape(results[i].color).toLowerCase();
790
+ }
791
+ if (i === 'sysLogoIco' && results[i].sysLogoIco) {
792
+ util.setFavicon(results[i].sysLogoIco);
793
+ }
794
+ store.set(i, results[i]);
795
+ }
796
+ this.userModel = results.userModel;
797
+ let mainFrameLayout = results.mainFrameLayout;
798
+ if (results.userStyle.layout) {
799
+ this.getMainDetail(results.userStyle.layout);
800
+ } else {
801
+ this.getMainDetail(mainFrameLayout);
802
+ }
803
+ if (flag) {
804
+ sessionStorage.setItem('mainConfig', JSON.stringify(results));
805
+ util.setStorage({
806
+ type: this.storage,
807
+ key: {
808
+ userId: results.userModel.userId,
809
+ userName: results.userModel.username
810
+ }
811
+ });
812
+ }
813
+ },
814
+ //获取用户配置及信息
815
+ getConfig() {
816
+ if (util.getStorage('mainConfig')) {
817
+ const results = JSON.parse(util.getStorage('mainConfig'));
818
+ this.setConfig(results);
819
+ return true;
820
+ }
821
+ util
822
+ .ajax({ url: this.mainConfig })
823
+ .then(res => {
824
+ if (res && res.rCode === 0) {
825
+ this.setConfig(res.results, 1);
826
+ } else {
827
+ let msg = res.msg || '系统错误,请联系管理员!';
828
+ this.$message.error(msg);
829
+ }
830
+ })
831
+ .catch(err => {
832
+ if (err.message && err.message !== 'canceled') {
833
+ this.$message.error(err.message);
834
+ }
835
+ });
836
+ },
837
+ reGetConfig() {
838
+ util
839
+ .ajax({ url: this.mainConfig })
840
+ .then(res => {
841
+ if (res && res.rCode === 0) {
842
+ const results = JSON.parse(JSON.stringify(res.results));
843
+ this.setConfig(results, 1);
844
+ } else {
845
+ let msg = res.msg || '系统错误,请联系管理员!';
846
+ this.$message.error(msg);
847
+ }
848
+ })
849
+ .catch(err => {
850
+ if (err.message && err.message !== 'canceled') {
851
+ this.$message.error(err.message);
852
+ }
853
+ });
854
+ },
855
+ jumpMenu(res) {
856
+ if (typeof res === 'string') {
857
+ res = res.split(',');
858
+ }
859
+ this.setDefault(this.menus, res);
860
+ },
861
+ getId(arry, res) {
862
+ if (!res) {
863
+ return false;
864
+ }
865
+ for (let i = 0; i < arry.length; i++) {
866
+ let item = arry[i];
867
+ if (item.id === res || (item.url && item.url.indexOf(res) > -1)) {
868
+ return item.id;
869
+ } else if (
870
+ Object.prototype.hasOwnProperty.call(item, 'children') &&
871
+ item.children.length
872
+ ) {
873
+ let id = this.getId(item.children, res);
874
+ if (id) {
875
+ if (item.pid === 'root') {
876
+ return [item.id].concat(id);
877
+ } else if (typeof id === 'string') {
878
+ return [item.id, id];
879
+ }
880
+ return id;
881
+ }
882
+ } else if (
883
+ Object.prototype.hasOwnProperty.call(item, 'fourthTabs') &&
884
+ item.fourthTabs.length
885
+ ) {
886
+ let id = this.getId(item.fourthTabs, res);
887
+ if (id) {
888
+ if (item.pid === 'root') {
889
+ return [item.id].concat(id);
890
+ } else if (typeof id === 'string') {
891
+ return [item.id, id];
892
+ }
893
+ return id;
894
+ }
895
+ }
896
+ }
897
+ return false;
898
+ },
899
+ //获取应用导航菜单
900
+ getMenu() {
901
+ util
902
+ .ajax({ url: this.action })
903
+ .then(res => {
904
+ if (res && res.rCode === 0) {
905
+ this.menus = JSON.parse(JSON.stringify(res.results));
906
+ if (
907
+ this.$route &&
908
+ (this.$route.query.applicationId ||
909
+ this.$route.query.applicationid ||
910
+ (this.$route.name !== 'main' && this.$route.path !== '/main'))
911
+ ) {
912
+ let ids = this.getId(
913
+ this.menus,
914
+ this.$route.query.applicationId ||
915
+ this.$route.query.applicationid ||
916
+ this.$route.fullPath
917
+ );
918
+ if (ids) {
919
+ this.defaultActive = ids;
920
+ }
921
+ }
922
+ this.setTips(this.menus);
923
+ store.set('nav', this.menus);
924
+ this.setMenu(this.menus);
925
+ } else {
926
+ let msg = res.msg || '系统错误,请联系管理员!';
927
+ this.$message.error(msg);
928
+ }
929
+ })
930
+ .catch(err => {
931
+ if (err.message && err.message !== 'canceled') {
932
+ this.$message.error(err.message);
933
+ }
934
+ });
935
+ },
936
+ //遍历设置菜单气泡提醒
937
+ setTips(obj) {
938
+ if (Array.isArray(obj)) {
939
+ obj.forEach(item => {
940
+ this.setTips(item);
941
+ });
942
+ } else {
943
+ if (Object.prototype.hasOwnProperty.call(obj, 'tips') && obj.tips) {
944
+ this.$set(obj, 'tips', false);
945
+ delete obj.tips;
946
+ }
947
+ let flag = false;
948
+ if (obj.children && obj.children.length) {
949
+ obj.children.forEach(item => {
950
+ if (this.setTips(item)) {
951
+ flag = true;
952
+ }
953
+ });
954
+ if (flag) {
955
+ this.$set(obj, 'tips', true);
956
+ return true;
957
+ }
958
+ } else if (obj.fourthTabs && obj.fourthTabs.length) {
959
+ obj.fourthTabs.forEach(item => {
960
+ if (this.setTips(item)) {
961
+ flag = true;
962
+ }
963
+ });
964
+ if (flag) {
965
+ this.$set(obj, 'tips', true);
966
+ return true;
967
+ }
968
+ } else {
969
+ if (this.menuTips[obj.id] && Number(this.menuTips[obj.id])) {
970
+ this.$set(obj, 'tips', Number(this.menuTips[obj.id]));
971
+ return true;
972
+ }
973
+ }
974
+ }
975
+ return false;
976
+ },
977
+ //设置右侧导航
978
+ setMenu(res) {
979
+ if (this.defaultActive && this.defaultActive.length) {
980
+ this.isDefault = false;
981
+ this.setDefault(res, this.defaultActive);
982
+ } else {
983
+ if (this.homePage) {
984
+ this.isDefault = true;
985
+ } else {
986
+ this.isDefault = false;
987
+ }
988
+ if (this.modal === 'subsystem' || this.modal === 'topside') {
989
+ if (this.modal === 'subsystem') {
990
+ if (this.menuType === 'custom') {
991
+ this.subsystem = this.customMenu;
992
+ } else {
993
+ this.subsystem = res;
994
+ }
995
+ // this.subsystem = res;
996
+ } else if (this.modal === 'topside') {
997
+ if (this.menuType === 'custom') {
998
+ this.navs = this.customMenu;
999
+ this.topActive = res[0].id;
1000
+ } else {
1001
+ this.navs = res;
1002
+ this.topActive = res[0].id;
1003
+ }
1004
+ // this.navs = res;
1005
+ // this.topActive = res[0].id;
1006
+ }
1007
+ if (this.application) {
1008
+ for (let i = 0; i < res.length; i++) {
1009
+ if (res[i].hasPermission) {
1010
+ this.menu = res[i].children;
1011
+ this.title = res[i].text;
1012
+ break;
1013
+ }
1014
+ }
1015
+ } else {
1016
+ this.menu = res[0].children;
1017
+ this.title = res[0].text;
1018
+ }
1019
+ if (!this.isDefault) {
1020
+ this.active = this.getFirst(this.menu[0]);
1021
+ }
1022
+ } else if (this.modal === 'topnav') {
1023
+ if (this.menuType === 'custom') {
1024
+ this.navs = this.customMenu;
1025
+ this.topActive = this.getFirst(res[0]);
1026
+ } else {
1027
+ this.navs = res;
1028
+ this.topActive = this.getFirst(res[0]);
1029
+ }
1030
+ } else {
1031
+ this.menu = res;
1032
+ if (!this.isDefault) {
1033
+ this.active = [this.menu[0].id];
1034
+ let id = this.getFirst(this.menu[0]);
1035
+ if (id && this.menu[0].id !== id) {
1036
+ this.active.push(id);
1037
+ } else {
1038
+ this.handleJump(
1039
+ this.menu[0].url,
1040
+ this.menu[0].urlopenmode,
1041
+ this.menu[0]
1042
+ );
1043
+ }
1044
+ }
1045
+ }
1046
+ }
1047
+
1048
+ // const active = sessionStorage.getItem('menus');
1049
+ // if (
1050
+ // this.defaultActive &&
1051
+ // this.defaultActive.length
1052
+ // ) {
1053
+ // this.setDefault(res, this.defaultActive);
1054
+ // } else if (util.win.location.hash !== '#/main' && active) {
1055
+ // this.setDefault(res, active.split(','));
1056
+ // } else {
1057
+ // if (this.modal === 'default' || !this.modal) {
1058
+ // this.menu = res;
1059
+ // this.active = res[0].id;
1060
+ // } else if (
1061
+ // this.modal === 'subsystem' ||
1062
+ // this.modal === 'subSystem' ||
1063
+ // this.modal === 'topnav' ||
1064
+ // this.modal === 'topNav'
1065
+ // ) {
1066
+ // if (this.modal === 'subsystem' || this.modal === 'subSystem') {
1067
+ // if (this.menuType === 'custom') {
1068
+ // this.subsystem = this.customMenu;
1069
+ // this.active = this.customMenu[0].id;
1070
+ // } else {
1071
+ // this.subsystem = res;
1072
+ // this.active = res[0].id;
1073
+ // }
1074
+ // } else if (this.modal === 'topnav' || this.modal === 'topNav') {
1075
+ // if (this.menuType === 'custom') {
1076
+ // this.navs = this.customMenu;
1077
+ // } else {
1078
+ // this.navs = res;
1079
+ // }
1080
+ // }
1081
+ // if (this.application) {
1082
+ // for (let i = 0; i < res.length; i++) {
1083
+ // if (res[i].hasPermission) {
1084
+ // this.menu = res[i].children;
1085
+ // this.title = res[i].text;
1086
+ // break;
1087
+ // }
1088
+ // }
1089
+ // } else {
1090
+ // this.menu = res[0].children;
1091
+ // this.title = res[0].text;
1092
+ // }
1093
+ // }
1094
+ // if (!this.homePage) {
1095
+ // this.getFirst(this.menu);
1096
+ // }
1097
+ // }
1098
+ },
1099
+ //获取导航第一个页面
1100
+ getFirst(obj) {
1101
+ // let item = arry[0];
1102
+ // if (
1103
+ // Object.prototype.hasOwnProperty.call(item, 'children') &&
1104
+ // item.children.length
1105
+ // ) {
1106
+ // this.active.push(item.id);
1107
+ // this.getFirst(item.children);
1108
+ // } else if (
1109
+ // Object.prototype.hasOwnProperty.call(item, 'fourthTabs') &&
1110
+ // item.fourthTabs.length
1111
+ // ) {
1112
+ // if (item.url) {
1113
+ // let res = item.fourthTabs.filter(res => {
1114
+ // return res.url === item.url;
1115
+ // })[0];
1116
+ // if (res) {
1117
+ // this.tabsId = res.id;
1118
+ // this.handleJump(res.url);
1119
+ // } else {
1120
+ // this.tabsId = item.fourthTabs[0].id;
1121
+ // this.handleJump(item.fourthTabs[0].url);
1122
+ // }
1123
+ // } else {
1124
+ // this.tabsId = item.fourthTabs[0].id;
1125
+ // this.handleJump(item.fourthTabs[0].url);
1126
+ // }
1127
+ // } else {
1128
+ // if (Array.isArray(this.active)) {
1129
+ // this.active.push(item.id);
1130
+ // } else {
1131
+ // this.active = item.id;
1132
+ // }
1133
+ // this.handleJump(item.url);
1134
+ // }
1135
+ if (!obj) {
1136
+ return '';
1137
+ }
1138
+ if (obj.children && obj.children.length) {
1139
+ return this.getFirst(obj.children[0]);
1140
+ } else if (obj.fourthTabs && obj.fourthTabs.length) {
1141
+ if (this.modal === 'topnav') {
1142
+ return this.getFirst(obj.fourthTabs[0]);
1143
+ } else {
1144
+ this.tabs = obj.fourthTabs;
1145
+ if (obj.url) {
1146
+ let tab = obj.fourthTabs.filter(item => {
1147
+ return item.url === obj.url;
1148
+ })[0];
1149
+ if (tab) {
1150
+ this.tabsId = tab.id;
1151
+ this.handleJump(tab.url, tab.urlopenmode, tab);
1152
+ }
1153
+ } else {
1154
+ this.tabsId = this.tabs[0].id;
1155
+ this.handleJump(
1156
+ this.tabs[0].url,
1157
+ this.tabs[0].urlopenmode,
1158
+ this.tabs[0]
1159
+ );
1160
+ }
1161
+ return obj.id;
1162
+ }
1163
+ } else {
1164
+ this.handleJump(obj.url, obj.urlopenmode, obj);
1165
+ }
1166
+ return obj.id;
1167
+ },
1168
+ //设置默认页面
1169
+ setDefault(res, active) {
1170
+ this.sysId = '';
1171
+ this.tabsId = '';
1172
+ this.active = [];
1173
+ this.getUrl(res, active);
1174
+ if (
1175
+ this.modal === 'subsystem' ||
1176
+ this.modal === 'subSystem' ||
1177
+ this.modal === 'topnav' ||
1178
+ this.modal === 'topNav' ||
1179
+ this.modal === 'topside' ||
1180
+ this.modal === 'topSide'
1181
+ ) {
1182
+ if (this.modal === 'subsystem' || this.modal === 'subSystem') {
1183
+ if (this.menuType === 'custom') {
1184
+ this.subsystem = this.customMenu;
1185
+ this.sysId = active[0];
1186
+ } else {
1187
+ this.subsystem = res;
1188
+ this.sysId = active[0];
1189
+ }
1190
+ } else if (
1191
+ this.modal === 'topnav' ||
1192
+ this.modal === 'topNav' ||
1193
+ this.modal === 'topside' ||
1194
+ this.modal === 'topSide'
1195
+ ) {
1196
+ if (this.menuType === 'custom') {
1197
+ this.navs = this.customMenu;
1198
+ this.topActive = active[0];
1199
+ } else {
1200
+ this.navs = res;
1201
+ this.topActive = active[0];
1202
+ }
1203
+ // this.navs = res;
1204
+ // this.topActive = active[0];
1205
+ }
1206
+ // if (this.biserial) {
1207
+ // if (this.tabs.length) {
1208
+ // this.tabsId = active[active.length - 1];
1209
+ // this.active = active.slice(1, active.length - 2);
1210
+ // } else {
1211
+ // this.active = active.slice(1);
1212
+ // }
1213
+ // } else {
1214
+ if (this.tabs.length) {
1215
+ this.tabsId = active[active.length - 1];
1216
+ this.active = active.slice(1, active.length - 1);
1217
+ } else {
1218
+ this.active = active.slice(1);
1219
+ }
1220
+ // }
1221
+ for (let i = 0; i < res.length; i++) {
1222
+ if (res[i].id === active[0]) {
1223
+ this.menu = res[i].children;
1224
+ this.title = res[i].text;
1225
+ break;
1226
+ }
1227
+ }
1228
+ } else {
1229
+ this.menu = res;
1230
+ if (this.biserial) {
1231
+ this.active = active.slice(
1232
+ 0,
1233
+ active.length > 2 ? active.length - 1 : active.length
1234
+ );
1235
+ } else {
1236
+ this.active = active.slice(1);
1237
+ }
1238
+ this.tabsId = active[active.length - 1];
1239
+ // if (this.biserial) {
1240
+ // if (this.tabs.length) {
1241
+ // this.tabsId = active[active.length - 1];
1242
+ // this.active = active.slice(1, active.length - 2);
1243
+ // } else {
1244
+ // this.active = active;
1245
+ // }
1246
+ // } else {
1247
+ // if (this.tabs.length) {
1248
+ // this.tabsId = active[active.length - 1];
1249
+ // this.active = active[active.length - 2];
1250
+ // } else {
1251
+ // this.active = active[active.length - 1];
1252
+ // }
1253
+ // }
1254
+ }
1255
+ },
1256
+ jsBeforeLoaders(url, type) {
1257
+ if (type === undefined) {
1258
+ this.defaultwjprops = {
1259
+ plugins: [
1260
+ {
1261
+ jsBeforeLoaders: [{ src: url }]
1262
+ }
1263
+ ]
1264
+ };
1265
+ } else {
1266
+ let { model, view } = util.getParams({ url: url });
1267
+ if (view) {
1268
+ if (view.indexOf('.js') > -1) {
1269
+ let views = view.split(',');
1270
+ let jss = [];
1271
+ views.forEach(item => {
1272
+ jss.push({
1273
+ src:
1274
+ (util.win.path
1275
+ ? util.win.path
1276
+ : util.startWith(model, '/')
1277
+ ? ''
1278
+ : '/') +
1279
+ (model ? model.split('|').join('/') + '/' : '') +
1280
+ item
1281
+ });
1282
+ });
1283
+ this.defaultwjprops = {
1284
+ plugins: [
1285
+ {
1286
+ jsBeforeLoaders: jss
1287
+ }
1288
+ ]
1289
+ };
1290
+ }
1291
+ }
1292
+ }
1293
+ },
1294
+ //获取页面类型及地址
1295
+ getUrl(res, active, index) {
1296
+ index = index === undefined ? 0 : index;
1297
+ for (let i = 0; i < res.length; i++) {
1298
+ let item = res[i];
1299
+ if (item.id === active[index]) {
1300
+ if (index === active.length - 1) {
1301
+ this.handleJump(item.url, item.urlopenmode, item);
1302
+ } else {
1303
+ if (item.children && item.children.length) {
1304
+ index++;
1305
+ let url = this.getUrl(item.children, active, index);
1306
+ if (url && index === active.length - 1) {
1307
+ this.tabs = '';
1308
+ }
1309
+ return url;
1310
+ }
1311
+ if (item.fourthTabs && item.fourthTabs.length) {
1312
+ index++;
1313
+ let url = this.getUrl(item.fourthTabs, active, index);
1314
+ if (url) {
1315
+ this.$set(this, 'tabs', item.fourthTabs);
1316
+ }
1317
+ return url;
1318
+ }
1319
+ }
1320
+ } else if (item.children && item.children.length) {
1321
+ this.getUrl(item.children, active, index);
1322
+ }
1323
+ }
1324
+ return false;
1325
+ },
1326
+ setUrl(url, param) {
1327
+ let obj = param ? param : {};
1328
+ let params = util.getParams({ url: url }, true);
1329
+ for (let i in params) {
1330
+ if (i != 'model' && i != 'view' && i != '_baseUrl') {
1331
+ obj[i] = params[i];
1332
+ }
1333
+ }
1334
+ let _url = params._baseUrl ? params._baseUrl : './primary.html';
1335
+ return util.urlJoinParams({ url: _url, param: obj });
1336
+ },
1337
+ //应用导航交互
1338
+ handleSelect(res, type) {
1339
+ // this.active = [];
1340
+ // this.tabsId = '';
1341
+ // let active = sessionStorage.getItem('menus');
1342
+ // active = active ? active.split(',') : [];
1343
+ // const { node } = res;
1344
+ // switch (type) {
1345
+ // case 'nav':
1346
+ // this.menu = node.children;
1347
+ // this.title = node.text;
1348
+ // if (active.length) {
1349
+ // active[0] = node.id;
1350
+ // } else {
1351
+ // active.push(node.id);
1352
+ // }
1353
+ // break;
1354
+ // case 'sys':
1355
+ // this.menu = node.children;
1356
+ // this.title = node.text;
1357
+ // if (active.length) {
1358
+ // active[0] = node.id;
1359
+ // } else {
1360
+ // active.push(node.id);
1361
+ // }
1362
+ // break;
1363
+ // case 'sub':
1364
+ // if (active.length) {
1365
+ // active[0] = node.id;
1366
+ // } else {
1367
+ // active.push(node.id);
1368
+ // }
1369
+ // break;
1370
+ // case 'menu':
1371
+ // this.active = node.id;
1372
+ // if (active.length > 1) {
1373
+ // active[1] = node.id;
1374
+ // } else {
1375
+ // active.push(node.id);
1376
+ // }
1377
+ // this.tabs = node.fourthTabs;
1378
+ // if (node.url) {
1379
+ // let tab = node.fourthTabs.filter(item => {
1380
+ // return item.url === node.url;
1381
+ // })[0];
1382
+ // if (tab) {
1383
+ // this.tabsId = tab.id;
1384
+ // }
1385
+ // } else {
1386
+ // this.tabsId = this.tabs[0].id;
1387
+ // this.handleJump(this.tabs[0].url);
1388
+ // }
1389
+ // break;
1390
+ // case 'tabs':
1391
+ // if (active.length > 2) {
1392
+ // active[2] = node.id;
1393
+ // } else {
1394
+ // active.push(node.id);
1395
+ // }
1396
+ // break;
1397
+ // }
1398
+ // sessionStorage.setItem('menus', active.join(','));
1399
+ // if (node.url) {
1400
+ // this.selectPage = node.url;
1401
+ // this.refresh = false;
1402
+ // switch (node.urlopenmode) {
1403
+ // case '2':
1404
+ // location.reload();
1405
+ // break;
1406
+ // case 2:
1407
+ // location.reload();
1408
+ // break;
1409
+ // case '1':
1410
+ // util.win.open(node.url);
1411
+ // break;
1412
+ // case 1:
1413
+ // util.win.open(node.url);
1414
+ // break;
1415
+ // default:
1416
+ // let url;
1417
+ // if (node.url.indexOf('//:') === 0) {
1418
+ // this.method = 'wujie';
1419
+ // url = node.url.replace('//:', '');
1420
+ // } else if (
1421
+ // node.url.indexOf('dhtml') > -1 ||
1422
+ // (node.url.indexOf('html') > -1 &&
1423
+ // node.url.indexOf('html#') === -1)
1424
+ // ) {
1425
+ // this.method = 'iframe';
1426
+ // url = node.url;
1427
+ // } else {
1428
+ // this.method = 'router';
1429
+ // url = node.url;
1430
+
1431
+ // const routes = this.$router.options.routes;
1432
+
1433
+ // if (routes) {
1434
+ // let path = this.hasRouter(routes, url);
1435
+ // if (path) {
1436
+ // let index = decodeURI(url).indexOf('?');
1437
+ // url = path + (index > -1 ? url.slice(index) : '');
1438
+ // } else {
1439
+ // this.method = 'wujie';
1440
+ // }
1441
+ // } else {
1442
+ // console.error('缺少路由配置');
1443
+ // return;
1444
+ // // const moduleName = util.getStorage('moduleName');
1445
+ // // if (moduleName && node.url.indexOf(moduleName) > -1) {
1446
+ // // url = node.url.slice(node.url.indexOf('#/') + 1);
1447
+ // // } else if (node.url.indexOf('/') > -1) {
1448
+ // // this.method = 'wujie';
1449
+ // // }
1450
+ // }
1451
+ // }
1452
+ // if (this.method === 'router') {
1453
+ // if (url.indexOf('/') > -1) {
1454
+ // this.$router.push({ path: util.handlerUrl(url) });
1455
+ // } else {
1456
+ // this.$router.push({ name: url });
1457
+ // }
1458
+ // this.$nextTick(() => {
1459
+ // this.refresh = true;
1460
+ // });
1461
+ // } else if (this.method === 'wujie') {
1462
+ // this.page = util.handlerUrl(url, this.host);
1463
+ // this.$nextTick(() => {
1464
+ // this.refresh = true;
1465
+ // });
1466
+ // } else {
1467
+ // this.refresh = false;
1468
+ // this.page = util.handlerUrl(url, this.host);
1469
+ // }
1470
+ // }
1471
+ // }
1472
+
1473
+ this.isDefault = false;
1474
+ const { node } = res;
1475
+ switch (type) {
1476
+ case 'nav':
1477
+ this.tabs = [];
1478
+ this.active = '';
1479
+ if (this.modal === 'topside') {
1480
+ this.menu = node.children;
1481
+ this.title = node.text;
1482
+ this.active = this.getFirst(node.children[0]);
1483
+ } else {
1484
+ if (node.url) {
1485
+ let tab = node.fourthTabs.filter(item => {
1486
+ return item.url === node.url;
1487
+ })[0];
1488
+ if (tab) {
1489
+ this.tabs = node.fourthTabs;
1490
+ this.tabsId = tab.id;
1491
+ }
1492
+ //this.handleJump(node.url);
1493
+ } else {
1494
+ if (node.fourthTabs.length) {
1495
+ this.tabs = node.fourthTabs;
1496
+ this.tabsId = this.tabs[0].id;
1497
+ this.handleJump(
1498
+ this.tabs[0].url,
1499
+ this.tabs[0].urlopenmode,
1500
+ this.tabs[0]
1501
+ );
1502
+ }
1503
+ }
1504
+ }
1505
+ break;
1506
+ case 'sys':
1507
+ this.tabs = [];
1508
+ this.menu = node.children;
1509
+ this.title = node.text;
1510
+ this.active = this.getFirst(node.children[0]);
1511
+ break;
1512
+ case 'sub':
1513
+ if (node.url) {
1514
+ this.tabs = [];
1515
+ }
1516
+ if (this.setFirstAsDefault) {
1517
+ let id = this.getFirst(node);
1518
+ if (node.id !== id) {
1519
+ this.$set(this.active, 0, node.id);
1520
+ this.$set(this.active, 1, id);
1521
+ }
1522
+ }
1523
+ break;
1524
+ case 'menu':
1525
+ this.tabsId = '';
1526
+ this.tabs = [];
1527
+ if (this.setFirstAsDefault) {
1528
+ if (this.biserial) {
1529
+ this.$set(this.active, 1, node.id);
1530
+ } else {
1531
+ this.active = node.id;
1532
+ }
1533
+ }
1534
+ if (node.url) {
1535
+ let tab = node.fourthTabs.filter(item => {
1536
+ return item.url === node.url;
1537
+ })[0];
1538
+ if (tab) {
1539
+ this.tabs = node.fourthTabs;
1540
+ this.tabsId = tab.id;
1541
+ }
1542
+ // this.handleJump(node.url);
1543
+ } else if (node.fourthTabs.length) {
1544
+ if (node.fourthTabs.length) {
1545
+ this.tabs = node.fourthTabs;
1546
+ this.tabsId = this.tabs[0].id;
1547
+ this.handleJump(
1548
+ this.tabs[0].url,
1549
+ this.tabs[0].urlopenmode,
1550
+ this.tabs[0]
1551
+ );
1552
+ }
1553
+ }
1554
+ break;
1555
+ case 'tabs':
1556
+ break;
1557
+ }
1558
+ if (node.url) {
1559
+ this.selectPage = node.url;
1560
+ this.refresh = false;
1561
+ this.handleJump(node.url, Number(node.urlopenmode), node);
1562
+ }
1563
+ },
1564
+ hasRouter(res, url) {
1565
+ if (!url) {
1566
+ return false;
1567
+ }
1568
+ if (Array.isArray(res)) {
1569
+ for (let i in res) {
1570
+ let path = this.hasRouter(res[i], url);
1571
+ if (path) {
1572
+ return path;
1573
+ }
1574
+ }
1575
+ } else {
1576
+ let path = res.path;
1577
+ if (path !== '/' && path !== '/404') {
1578
+ path = path.replace(path[1], path[1].toLowerCase());
1579
+ }
1580
+ let pathname = url.substring(url.indexOf('#/') + 1);
1581
+ pathname = pathname
1582
+ .replace(pathname[1], pathname[1].toLowerCase())
1583
+ .split('?')[0];
1584
+ if (res.path !== '/' && pathname == path) {
1585
+ return pathname;
1586
+ }
1587
+ if (Object.prototype.hasOwnProperty.call(res, 'children')) {
1588
+ let path = this.hasRouter(res.children, url);
1589
+ if (path) {
1590
+ return path;
1591
+ }
1592
+ }
1593
+ }
1594
+ return false;
1595
+ },
1596
+ handleTrigger(res) {},
1597
+ //头部工具交互事件
1598
+ handleClick(res) {
1599
+ const { type } = res;
1600
+ switch (type) {
1601
+ //刷新
1602
+ case 'refresh':
1603
+ this.handleRefresh();
1604
+ break;
1605
+ case 'home':
1606
+ this.reset = false;
1607
+ if (this.homePage) {
1608
+ this.handleJump(this.homePage);
1609
+ // this.showMenu = false
1610
+ // this.active = [];
1611
+ // this.menu = [];
1612
+ // if (this.scene === 'topNav' || this.scene === 'topnav') {
1613
+ // this.setMenu(this.navs.length > 0 ? this.navs : []);
1614
+ // // this.getFirst(this.navs.length>0? this.navs : []);
1615
+ // } else {
1616
+ // setTimeout(() => {
1617
+ // this.setMenu(this.menus.length > 0 ? this.menus : []);
1618
+ // }, 1000);
1619
+ // // this.getFirst(this.menus.length>0? this.menus : []);
1620
+ // }
1621
+ }
1622
+ this.active = [];
1623
+ this.defaultActive = [];
1624
+ this.tabs = [];
1625
+ this.setMenu(this.menus);
1626
+ this.$nextTick(() => {
1627
+ this.reset = true;
1628
+ });
1629
+ break;
1630
+ case 'user':
1631
+ this.showUserInfo = true;
1632
+ break;
1633
+ case 'online':
1634
+ this.dialog = {
1635
+ title: '查看在线人员',
1636
+ show: true,
1637
+ url: '/main/sysuseronline/list.dhtml'
1638
+ };
1639
+ break;
1640
+ case 'notice':
1641
+ this.showMsg = !this.showMsg;
1642
+ break;
1643
+ case 'set':
1644
+ this.handleSet();
1645
+ break;
1646
+ case 'goView':
1647
+ util.win.open(res.path, '_blank');
1648
+ break;
1649
+ }
1650
+ },
1651
+ //刷新子页面、子路由
1652
+ handleRefresh() {
1653
+ if (this.method === 'iframe') {
1654
+ this.page = util.handlerUrl(this.page);
1655
+ } else {
1656
+ this.refresh = false;
1657
+ this.$nextTick(() => {
1658
+ this.refresh = true;
1659
+ });
1660
+ }
1661
+ },
1662
+ //跳转页面
1663
+ handleJump(page, type, res) {
1664
+ if (type == 1) {
1665
+ util.win.open(page);
1666
+ } else if (type == 2) {
1667
+ location.reload();
1668
+ } else if (type == 3) {
1669
+ this.method = 'iframe';
1670
+ this.refresh = false;
1671
+ this.page = util.handlerUrl(page);
1672
+ } else if (page) {
1673
+ let urls = page.split('?');
1674
+ if (urls[0].indexOf('.js') > 0) {
1675
+ this.method = this.downgrade && isIE ? 'iframe' : 'wujie';
1676
+ this.wjName = 'singlespa';
1677
+ let url = './primary.html' + (urls[1] ? `?${urls[1]}` : '');
1678
+ this.jsBeforeLoaders(urls[0]);
1679
+ this.page = url;
1680
+ this.$nextTick(() => {
1681
+ this.refresh = true;
1682
+ });
1683
+ } else if (
1684
+ urls[0].indexOf('.dhtml') > 0 ||
1685
+ (urls[0].indexOf('.html') > 0 && urls[0].indexOf('.html#') === -1)
1686
+ ) {
1687
+ this.method = 'iframe';
1688
+ this.refresh = false;
1689
+ this.page = util.handlerUrl(page);
1690
+ } else {
1691
+ this.method = 'router';
1692
+ const routes = this.$router.options.routes;
1693
+ if (routes) {
1694
+ let path = this.hasRouter(routes, urls[0]);
1695
+ if (path) {
1696
+ let params = util.getParams({ url: page });
1697
+ if (res) {
1698
+ this.routerKey = res.id;
1699
+ if (Object.prototype.hasOwnProperty.call(res, 'keepAlive')) {
1700
+ this.isKeepAlive = res.keepAlive;
1701
+ }
1702
+ }
1703
+ this.$router.push({ path: path, query: params });
1704
+ this.$nextTick(() => {
1705
+ this.refresh = true;
1706
+ });
1707
+ } else {
1708
+ let urlopenmode = util.getParams({
1709
+ url: page,
1710
+ name: 'urlopenmode'
1711
+ });
1712
+ if (
1713
+ this.loadWujie === false ||
1714
+ (this.downgrade && isIE) ||
1715
+ urlopenmode == 3
1716
+ ) {
1717
+ this.method = 'iframe';
1718
+ this.refresh = false;
1719
+ this.page = util.handlerUrl(page);
1720
+ } else {
1721
+ this.method = 'wujie';
1722
+ this.wjName = res.appCode ? res.appCode : 'application';
1723
+ this.page = page;
1724
+ this.$nextTick(() => {
1725
+ this.refresh = true;
1726
+ });
1727
+ }
1728
+ }
1729
+ } else {
1730
+ console.error('缺少路由配置');
1731
+ return;
1732
+ }
1733
+ }
1734
+ }
1735
+ },
1736
+ //设置回调
1737
+ handleChange(res) {
1738
+ const { type, value } = res;
1739
+ switch (type) {
1740
+ case 'theme':
1741
+ this.setTheme(value);
1742
+ break;
1743
+ case 'ignore':
1744
+ this.notice = 0;
1745
+ break;
1746
+ }
1747
+ },
1748
+ //监听改变菜单
1749
+ handleListener() {
1750
+ util.win.addEventListener(
1751
+ 'message',
1752
+ function(e) {
1753
+ var msg = e.data;
1754
+ if (msg.key == 'jump_Menu') {
1755
+ let res = msg.data1;
1756
+ if (typeof res === 'string') {
1757
+ res = res.split(',');
1758
+ }
1759
+ this.setDefault(this.menus, res);
1760
+ }
1761
+ },
1762
+ false
1763
+ );
1764
+ },
1765
+ //开启weosocket
1766
+ initWebSocket() {
1767
+ //初始化weosocket
1768
+ //初始化weosocket
1769
+ if (!this.websocket) {
1770
+ const url = (util.getStorage('wshost') || '') + wss;
1771
+ this.websocket = new SockJS(url);
1772
+ }
1773
+
1774
+ if (!this.console) {
1775
+ this.client.debug = null;
1776
+ }
1777
+ this.handleConnect(this.client);
1778
+ },
1779
+ handleConnect(client) {
1780
+ client.connect(
1781
+ {},
1782
+ () => {
1783
+ //localStorage.setItem("socket",true);
1784
+ //订阅服务端的
1785
+ client.subscribe(topic, response => {
1786
+ let res = JSON.parse(response.body);
1787
+ let data = res.data;
1788
+ for (let i in data) {
1789
+ if (data[i] !== null && data[i] !== undefined) {
1790
+ if (i === 'onlineUserNums' && data[i] > 0) {
1791
+ this.online = data[i];
1792
+ }
1793
+ if (i === 'sysMsgNums') {
1794
+ this.notice = data[i];
1795
+ if (this.showMsg) {
1796
+ this.$refs.message.getMsg(true);
1797
+ }
1798
+ }
1799
+ if (i === 'menuTipsMap') {
1800
+ this.menuTips = data[i];
1801
+ }
1802
+ if (i === 'sysMsgList') {
1803
+ this.sysMsg = data[i];
1804
+ }
1805
+ if (i === 'extraData') {
1806
+ this.extraData = data[i];
1807
+ }
1808
+ }
1809
+ }
1810
+ });
1811
+ },
1812
+ error => {
1813
+ console.log('webSocket连接失败');
1814
+ if (this.connect < 10 && !util.getStorage('timer')) {
1815
+ this.handleConnect(client);
1816
+ } else {
1817
+ client.disconnect();
1818
+ }
1819
+ }
1820
+ );
1821
+ },
1822
+ handleOpened(res) {
1823
+ if (!res) {
1824
+ this.sysMsgOut = setTimeout(() => {
1825
+ this.sysMsg = [];
1826
+ }, 3000);
1827
+ } else if (this.sysMsgOut) {
1828
+ clearTimeout(this.sysMsgOut);
1829
+ }
1830
+ },
1831
+ handleDialog(obj) {
1832
+ this.dialog = obj;
1833
+ },
1834
+ handleUserModel(name, val) {
1835
+ this.$set(this.userModel, name, val);
1836
+ },
1837
+ handleMenuTips(id, num) {
1838
+ if (num) {
1839
+ this.$set(this.menuTips, id, num);
1840
+ } else {
1841
+ let n = parseInt(this.menuTips[id], 10) - 1;
1842
+ this.$set(this.menuTips, id, n);
1843
+ }
1844
+ },
1845
+ handleReLogin(res) {
1846
+ if (res && typeof res == 'string') {
1847
+ res = JSON.parse(res);
1848
+ }
1849
+ let msg = '提示';
1850
+ let btn = {
1851
+ confirmButtonText: '确定',
1852
+ cancelButtonText: '取消',
1853
+ closeOnClickModal: false,
1854
+ type: 'warning'
1855
+ };
1856
+ if (res) {
1857
+ if (res.rCode === 69) {
1858
+ msg = '该账号在其他地方已登陆!';
1859
+ btn = {
1860
+ confirmButtonText: '确定',
1861
+ closeOnClickModal: false,
1862
+ type: 'warning'
1863
+ };
1864
+ } else {
1865
+ msg = '登录已过期,请重新登录!';
1866
+ }
1867
+ }
1868
+ this.$confirm(msg, btn)
1869
+ .then(() => {
1870
+ util.removeStorage([
1871
+ 'Authorization',
1872
+ 'token',
1873
+ 'ssId',
1874
+ 'userId',
1875
+ 'userName',
1876
+ 'auth',
1877
+ 'deviceUnique',
1878
+ 'menus',
1879
+ 'useCaseCodes',
1880
+ 'mainConfig'
1881
+ ]);
1882
+ if (util.win.top.location.href.indexOf('main.html') > -1) {
1883
+ util.win.top.location.href = './login.html';
1884
+ } else {
1885
+ const hash = util.win.top.location.hash;
1886
+ if (hash) {
1887
+ const len = util.win.top.location.href.indexOf(hash);
1888
+ let href = util.win.top.location.href.slice(0, len) + '#/login';
1889
+ util.win.top.location.href = href;
1890
+ } else {
1891
+ const loginPage =
1892
+ util.getStorage('login') || util.getStorage('loginPage');
1893
+ if (loginPage) {
1894
+ util.win.top.location.href = loginPage;
1895
+ } else {
1896
+ util.win.top.location.href = '/login.html';
1897
+ }
1898
+ }
1899
+ }
1900
+ })
1901
+ .catch(e => {});
1902
+ },
1903
+ openPage(url, name, width, height) {
1904
+ let src = url;
1905
+ if (!util.startWith(url, ['http', '/'])) {
1906
+ let pathname = window.location.pathname;
1907
+ if (pathname !== '/') {
1908
+ pathname = pathname.split('/');
1909
+ pathname.splice(pathname.length - 1);
1910
+ pathname = pathname.join('/');
1911
+ }
1912
+ src = pathname + url.replace('./', '');
1913
+ }
1914
+ if (name) {
1915
+ let w = width ? width : util.win.top.screen.availWidth - 10;
1916
+ let h = height ? height : util.win.top.screen.availHeight - 60;
1917
+ util.win.open(
1918
+ src,
1919
+ name,
1920
+ `width=${w}px,height=${h}px,resizable=yes,status=yes,menubar=no,scrollbars=yes`
1921
+ );
1922
+ } else {
1923
+ util.win.open(src);
1924
+ }
1925
+ }
1926
+ },
1927
+
1928
+ beforeDestroy() {
1929
+ if (this.client && this.client.connected) {
1930
+ this.client.disconnect();
1931
+ }
1932
+ }
1933
+ };
1934
+ </script>