eoss-ui 0.5.80 → 0.5.81-beta1

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