eoss-ui 0.5.79 → 0.5.81-beta

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 (131) hide show
  1. package/lib/button-group.js +279 -265
  2. package/lib/button.js +71 -69
  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 +71 -70
  7. package/lib/clients.js +11 -11
  8. package/lib/config/api.js +1 -0
  9. package/lib/data-table-form.js +69 -67
  10. package/lib/data-table.js +87 -80
  11. package/lib/date-picker.js +71 -69
  12. package/lib/dialog.js +71 -70
  13. package/lib/enterprise.js +2 -2
  14. package/lib/eoss-ui.common.js +5966 -986
  15. package/lib/error-page.js +2 -2
  16. package/lib/flow-group.js +71 -69
  17. package/lib/flow-list.js +74 -72
  18. package/lib/flow.js +95 -93
  19. package/lib/form.js +179 -98
  20. package/lib/handle-user.js +72 -70
  21. package/lib/handler.js +75 -73
  22. package/lib/icon.js +3731 -12
  23. package/lib/icons.js +3 -3
  24. package/lib/index.js +1 -1
  25. package/lib/input-number.js +71 -69
  26. package/lib/input.js +71 -73
  27. package/lib/label.js +2 -2
  28. package/lib/layout.js +2 -2
  29. package/lib/login.js +146 -106
  30. package/lib/main.js +5663 -844
  31. package/lib/menu.js +2 -2
  32. package/lib/nav.js +71 -69
  33. package/lib/notify.js +72 -70
  34. package/lib/page.js +71 -69
  35. package/lib/pagination.js +2 -2
  36. package/lib/player.js +75 -73
  37. package/lib/qr-code.js +73 -71
  38. package/lib/radio-group.js +71 -69
  39. package/lib/retrial-auth.js +73 -71
  40. package/lib/select-ganged.js +71 -69
  41. package/lib/select.js +71 -69
  42. package/lib/selector-panel.js +74 -73
  43. package/lib/selector.js +80 -78
  44. package/lib/sizer.js +71 -69
  45. package/lib/steps.js +71 -69
  46. package/lib/switch.js +78 -76
  47. package/lib/table-form.js +71 -69
  48. package/lib/tabs-panel.js +2 -2
  49. package/lib/tabs.js +71 -69
  50. package/lib/theme-chalk/base.css +1 -1
  51. package/lib/theme-chalk/clients.css +1 -1
  52. package/lib/theme-chalk/data-table.css +1 -1
  53. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  54. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  55. package/lib/theme-chalk/form.css +1 -1
  56. package/lib/theme-chalk/icon.css +1 -1
  57. package/lib/theme-chalk/index.css +1 -1
  58. package/lib/theme-chalk/login.css +1 -1
  59. package/lib/theme-chalk/main.css +1 -1
  60. package/lib/theme-chalk/menu.css +1 -1
  61. package/lib/theme-chalk/simplicity.css +1 -0
  62. package/lib/theme-chalk/sizer.css +1 -1
  63. package/lib/theme-chalk/upload.css +1 -1
  64. package/lib/tips.js +72 -70
  65. package/lib/toolbar.js +2 -2
  66. package/lib/tree-group.js +71 -69
  67. package/lib/tree.js +71 -69
  68. package/lib/upload.js +146 -118
  69. package/lib/utils/util.js +2 -2
  70. package/lib/wujie.js +71 -69
  71. package/lib/wxlogin.js +214 -212
  72. package/package.json +3 -3
  73. package/packages/clients/src/main.vue +7 -7
  74. package/packages/data-table/src/main.vue +17 -5
  75. package/packages/form/src/main.vue +27 -13
  76. package/packages/handler/src/main.vue +3 -1
  77. package/packages/icon/src/main.vue +31 -10
  78. package/packages/icons/src/icon.json +1 -1
  79. package/packages/input/src/main.vue +0 -4
  80. package/packages/login/src/main.vue +13 -7
  81. package/packages/main/src/default/index.vue +2199 -0
  82. package/packages/main/src/main.vue +30 -2209
  83. package/packages/main/src/simplicity/apps.vue +301 -0
  84. package/packages/main/src/simplicity/avatar.vue +68 -0
  85. package/packages/main/src/simplicity/handler.vue +148 -0
  86. package/packages/main/src/simplicity/index.vue +1515 -0
  87. package/packages/main/src/simplicity/lists.vue +84 -0
  88. package/packages/main/src/simplicity/menu-list.vue +74 -0
  89. package/packages/main/src/simplicity/message.vue +237 -0
  90. package/packages/main/src/simplicity/notice.vue +145 -0
  91. package/packages/main/src/simplicity/settings.vue +119 -0
  92. package/packages/main/src/simplicity/sub-menu.vue +120 -0
  93. package/packages/main/src/simplicity/user.vue +243 -0
  94. package/packages/main/src/simplicity/userinfo.vue +302 -0
  95. package/packages/theme-chalk/lib/base.css +1 -1
  96. package/packages/theme-chalk/lib/clients.css +1 -1
  97. package/packages/theme-chalk/lib/data-table.css +1 -1
  98. package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
  99. package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
  100. package/packages/theme-chalk/lib/form.css +1 -1
  101. package/packages/theme-chalk/lib/icon.css +1 -1
  102. package/packages/theme-chalk/lib/index.css +1 -1
  103. package/packages/theme-chalk/lib/login.css +1 -1
  104. package/packages/theme-chalk/lib/main.css +1 -1
  105. package/packages/theme-chalk/lib/menu.css +1 -1
  106. package/packages/theme-chalk/lib/simplicity.css +1 -0
  107. package/packages/theme-chalk/lib/sizer.css +1 -1
  108. package/packages/theme-chalk/lib/upload.css +1 -1
  109. package/packages/theme-chalk/src/base.scss +1 -0
  110. package/packages/theme-chalk/src/clients.scss +1 -1
  111. package/packages/theme-chalk/src/common/var.scss +4 -0
  112. package/packages/theme-chalk/src/data-table.scss +3 -0
  113. package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
  114. package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
  115. package/packages/theme-chalk/src/form.scss +2 -2
  116. package/packages/theme-chalk/src/icon.scss +4 -4
  117. package/packages/theme-chalk/src/login.scss +644 -632
  118. package/packages/theme-chalk/src/main.scss +6 -2
  119. package/packages/theme-chalk/src/simplicity.scss +545 -0
  120. package/packages/upload/src/main.vue +132 -80
  121. package/src/config/api.js +1 -0
  122. package/src/index.js +1 -1
  123. package/src/utils/util.js +2 -2
  124. package/lib/theme-chalk/mainComp.css +0 -0
  125. package/packages/main/src/async-component/index.vue +0 -87
  126. package/packages/theme-chalk/lib/mainComp.css +0 -0
  127. package/packages/theme-chalk/src/mainComp.scss +0 -0
  128. /package/packages/main/src/{message.vue → default/message.vue} +0 -0
  129. /package/packages/main/src/{notice.vue → default/notice.vue} +0 -0
  130. /package/packages/main/src/{settings.vue → default/settings.vue} +0 -0
  131. /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,745 +27,32 @@ 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
- },
34
+ type: String,
421
35
  remote: {
422
36
  type: Boolean,
423
37
  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
38
  }
634
39
  },
40
+ computed: {},
41
+ watch: {},
635
42
  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
- };
43
+ return {};
728
44
  },
729
45
  created() {
730
46
  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
47
  this.getConfig(params);
738
48
  },
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
- },
49
+ mounted() {},
752
50
  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' && 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') {
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 === 'subsystemExtend' && results[i].themeColor) {
999
- this.color = unescape(results[i].themeColor).toLowerCase();
1000
- }
1001
- if (i === 'userStyle' && results[i].color) {
1002
- let color = unescape(results[i].color).toLowerCase();
1003
- if (util.startWith(color, '#')) {
1004
- this.color = color;
1005
- }
1006
- }
1007
- if (i === 'subsystemExtend' && results[i].userInfoContents) {
1008
- this.userInfoContents = results[i].userInfoContents;
1009
- }
1010
- if (i === 'subsystemExtend' && results[i].webPageWatermark) {
1011
- try {
1012
- util.win.top.webPageWatermark = results[i].webPageWatermark;
1013
- util.watermark(results[i].webPageWatermark);
1014
- } catch (error) {
1015
- util.win.postMessage(
1016
- { type: 2, content: results[i].webPageWatermark },
1017
- '*'
1018
- );
1019
- }
1020
- }
1021
-
1022
- if (i === 'subsystemExtend' && results[i].loginPage) {
1023
- util.setStorage('loginPage', results[i].loginPage);
1024
- }
1025
- store.set(i, results[i]);
1026
- }
1027
- this.userModel = results.userModel;
1028
- let mainFrameLayout = results.mainFrameLayout;
1029
- if (results.userStyle.layout && this.isCustomMain) {
1030
- this.getMainDetail(results.userStyle.layout);
1031
- } else if (this.isCustomMain) {
1032
- this.getMainDetail(mainFrameLayout);
1033
- } else {
1034
- this.showDefault = true;
1035
- }
1036
- },
1037
- //获取用户配置及信息
51
+ /**
52
+ * @desc:获取系统配置
53
+ * @author huangbo
54
+ * @date 2024年9月7日
55
+ **/
1038
56
  getConfig(query) {
1039
57
  const token =
1040
58
  util.getStorage('token') || util.getStorage('Authorization');
@@ -1045,1210 +63,13 @@ export default {
1045
63
  ) {
1046
64
  return false;
1047
65
  }
1048
- if (util.getStorage('mainConfig')) {
1049
- const results = JSON.parse(util.getStorage('mainConfig'));
1050
- this.setConfig(results);
1051
- if (this.remote) {
1052
- this.getMenu();
1053
- } else {
1054
- this.renderMenu();
1055
- }
1056
- return true;
1057
- }
1058
- util.getMainConfig((res) => {
1059
- this.setConfig(res, 1);
1060
- if (this.remote) {
1061
- this.getMenu();
1062
- } else {
1063
- this.renderMenu();
1064
- }
1065
- });
1066
- },
1067
- reGetConfig() {
1068
- util
1069
- .ajax({ url: this.mainConfig })
1070
- .then((res) => {
1071
- if (res && res.rCode === 0) {
1072
- const results = JSON.parse(JSON.stringify(res.results));
1073
- this.setConfig(results, 1);
1074
- } else {
1075
- let msg = res.msg || '系统错误,请联系管理员!';
1076
- this.$message.error(msg);
1077
- }
1078
- })
1079
- .catch((err) => {
1080
- if (err.message && err.message !== 'canceled') {
1081
- this.$message.error(err.message);
1082
- }
1083
- });
1084
- },
1085
- /**
1086
- * @desc 跳转菜单
1087
- * @param {Object/String} [res] - 菜单id(多个用,隔开)或url地址或系统菜单数据对象
1088
- * @param {Boolean} [isUrl] - res是否是url地址
1089
- * @param {Object} [param] - 拼接地址后的参数
1090
- */
1091
- jumpMenu(res, isUrl, param, hide) {
1092
- if (this.showSide === false) {
1093
- this.isSide = true;
1094
- }
1095
- if (hide !== undefined && hide !== null && hide !== '') {
1096
- this.hideSubMenu = hide;
1097
- }
1098
- let option = { url: res, isUrl: isUrl, param: param };
1099
- if (util.isObject(res)) {
1100
- if (res.urlopenmode == 1) {
1101
- util.win.open(res.url);
1102
- return;
1103
- } else if (res.urlopenmode == 2) {
1104
- location.href = res.url;
1105
- return;
1106
- } else {
1107
- option = { ...option, ...res };
1108
- }
1109
- }
1110
- let ids;
1111
- if (typeof option.url === 'string') {
1112
- if (
1113
- option.isUrl ||
1114
- option.url.indexOf('.html') > -1 ||
1115
- option.url.indexOf('.dhtml') > -1 ||
1116
- option.url.indexOf('/#/') > -1 ||
1117
- option.url.indexOf('#/') > -1
1118
- ) {
1119
- option.isUrlc = true;
1120
- ids = this.getId(this.menus, option.url);
1121
- if (!ids) {
1122
- if (
1123
- option.url.indexOf('.html') === -1 &&
1124
- option.url.indexOf('#/') === -1
1125
- ) {
1126
- this.method = 'iframe';
1127
- this.refresh = false;
1128
- this.page = option.url;
1129
- } else {
1130
- this.method = 'router';
1131
- const routes = this.$router.options.routes;
1132
- if (routes) {
1133
- let path = this.hasRouter(routes, option.url);
1134
- if (path) {
1135
- let params = util.getParams({ url: option.url });
1136
- this.$router.push({
1137
- path: path,
1138
- query: params
1139
- });
1140
- } else {
1141
- if (this.loadWujie === false || (this.downgrade && isIE)) {
1142
- this.method = 'iframe';
1143
- this.refresh = false;
1144
- this.page = option.url;
1145
- } else {
1146
- this.method = 'wujie';
1147
- this.wjName = 'application' + Date.now();
1148
- this.page = this.host + option.url;
1149
- }
1150
- }
1151
- }
1152
- }
1153
- this.$nextTick(() => {
1154
- this.refresh = true;
1155
- });
1156
- return;
1157
- }
1158
- } else {
1159
- ids = option.url.split(',');
1160
- }
1161
- } else {
1162
- ids = option.url;
1163
- }
1164
- this.setDefault(this.menus, ids, option.param);
1165
- },
1166
- /**
1167
- * @desc 获取菜单层级id
1168
- * @param {Array} [menus] - 系统菜单数据对象
1169
- * @param {String} [url] - 菜单id或url地址
1170
- */
1171
- getId(menus, url) {
1172
- if (!url) {
1173
- return false;
1174
- }
1175
- for (let i = 0; i < menus.length; i++) {
1176
- let item = menus[i];
1177
- if (
1178
- Object.prototype.hasOwnProperty.call(item, 'children') &&
1179
- item.children.length
1180
- ) {
1181
- let id = this.getId(item.children, url);
1182
- if (id) {
1183
- if (typeof id === 'string') {
1184
- this.isTabs = false;
1185
- }
1186
- if (item.pid === 'root' || Array.isArray(id)) {
1187
- return [item.id].concat(id);
1188
- } else if (typeof id === 'string') {
1189
- return [item.id, id];
1190
- }
1191
- return id;
1192
- }
1193
- } else if (
1194
- Object.prototype.hasOwnProperty.call(item, 'fourthTabs') &&
1195
- item.fourthTabs.length
1196
- ) {
1197
- let id = this.getId(item.fourthTabs, url);
1198
- if (id) {
1199
- if (typeof id === 'string') {
1200
- this.isTabs = true;
1201
- }
1202
- if (item.pid === 'root') {
1203
- return [item.id].concat(id);
1204
- } else if (typeof id === 'string') {
1205
- return [item.id, id];
1206
- }
1207
- return id;
1208
- }
1209
- } else if (item.id === url || item.url == url) {
1210
- return item.id;
1211
- } else {
1212
- if (item.url) {
1213
- let url = new URL(item.url, window.location.origin);
1214
- if (url.hash == url) {
1215
- return item.id;
1216
- }
1217
- }
1218
- }
1219
- }
1220
- return false;
1221
- },
1222
- //获取应用导航菜单
1223
- getMenu() {
1224
- let param = this.menuCode ? { menuCode: this.menuCode } : {};
1225
- let params = { ...this.param, ...param };
1226
- util
1227
- .ajax({ url: this.action, params: params })
1228
- .then((res) => {
1229
- if (res.rCode === 0) {
1230
- if (res.results && res.results.length) {
1231
- this.menus = JSON.parse(JSON.stringify(res.results));
1232
- this.setTips(this.menus);
1233
- store.set('nav', this.menus);
1234
- this.setMenu(this.menus);
1235
- } else {
1236
- this.$message.error('未分配菜单权限,请联系管理员!');
1237
- }
1238
- } else {
1239
- let msg = res.msg || '系统错误,请联系管理员!';
1240
- this.$message.error(msg);
1241
- }
1242
- })
1243
- .catch((err) => {
1244
- if (err.message && err.message !== 'canceled') {
1245
- this.$message.error(err.message);
1246
- }
66
+ if (!util.getStorage('mainConfig')) {
67
+ util.getMainConfig((res) => {
68
+ this.$refs.main.init(res);
1247
69
  });
1248
- },
1249
- //设置默认左侧导航
1250
- setMenu(res) {
1251
- let applicationid =
1252
- util.getParams('applicationid') || util.getParams('applicationId');
1253
- if (applicationid) {
1254
- let ids = this.getId(this.menus, applicationid);
1255
- if (ids) {
1256
- this.defaultActive = ids;
1257
- }
1258
- } else if (util.win.location.hash) {
1259
- let hash = util.win.location.hash;
1260
- if (hash) {
1261
- hash = hash.split('?')[0];
1262
- }
1263
- if (hash !== '#/' && hash !== '#/main') {
1264
- let ids = this.getId(this.menus, util.win.location.hash);
1265
- if (ids) {
1266
- this.defaultActive = ids;
1267
- //this.navIds = ids;
1268
- this.setTitle(ids[0]);
1269
- }
1270
- }
1271
- } else if (sessionStorage.getItem('jump') && this.isHistory) {
1272
- let ids = this.getId(this.menus, sessionStorage.getItem('jump'));
1273
- if (ids) {
1274
- this.defaultActive = ids;
1275
- //this.navIds = ids;
1276
- this.setTitle(ids[0]);
1277
- }
1278
- }
1279
- if (this.defaultActive && this.defaultActive.length) {
1280
- this.isDefault = false;
1281
- this.setDefault(res, this.defaultActive);
1282
- } else {
1283
- if (this.homePage || !util.getStorage('mainConfig')) {
1284
- this.isDefault = true;
1285
- if (
1286
- this.homePage &&
1287
- (!this.defaultActive || !this.defaultActive.length)
1288
- ) {
1289
- let ids = this.getId(this.menus, this.homePage);
1290
- if (ids) {
1291
- this.defaultActive = ids;
1292
- this.isDefault = false;
1293
- this.setDefault(res, this.defaultActive);
1294
- return false;
1295
- } else {
1296
- this.handleJump(this.homePage);
1297
- }
1298
- }
1299
- } else {
1300
- this.isDefault = false;
1301
- }
1302
- if (this.layout === 'subsystem' || this.layout === 'topside') {
1303
- if (this.layout === 'subsystem') {
1304
- this.navs = [];
1305
- if (this.menuType === 'custom') {
1306
- this.subsystem = this.customMenu;
1307
- } else {
1308
- this.subsystem = res;
1309
- }
1310
- } else if (this.layout === 'topside') {
1311
- this.subsystem = [];
1312
- if (this.menuType === 'custom') {
1313
- this.navs = this.customMenu;
1314
- this.topActive = res[0].id;
1315
- } else {
1316
- this.navs = res;
1317
- this.topActive = res[0].id;
1318
- }
1319
- }
1320
- if (this.application) {
1321
- for (let i = 0; i < res.length; i++) {
1322
- if (res[i].hasPermission) {
1323
- this.menu = res[i].children;
1324
- this.title = res[i].text;
1325
- break;
1326
- }
1327
- }
1328
- } else {
1329
- this.menu = res[0].children;
1330
- this.title = res[0].text;
1331
- }
1332
- if (!this.isDefault || (this.isDefault && !this.homePage)) {
1333
- this.active = this.getFirst(this.menu[0]).id;
1334
- }
1335
- } else if (this.layout === 'topnav') {
1336
- if (this.menuType === 'custom') {
1337
- this.navs = this.customMenu;
1338
- this.topActive = this.getFirst(res[0]).id;
1339
- } else {
1340
- this.navs = res;
1341
- this.topActive = this.getFirst(res[0]).id;
1342
- }
1343
- } else {
1344
- this.nav = [];
1345
- this.subsystem = [];
1346
- this.menu = res;
1347
- if (!this.isDefault || (this.isDefault && !this.homePage)) {
1348
- this.active = [this.menu[0].id];
1349
- let id = this.getFirst(this.menu[0]).id;
1350
- if (id && this.menu[0].id !== id) {
1351
- this.active.push(id);
1352
- } else {
1353
- let hash = util.win.location.hash;
1354
- if (hash) {
1355
- hash = hash.split('?')[0];
1356
- if (hash !== '#/' && hash !== '#/main') {
1357
- this.handleJump(hash);
1358
- return;
1359
- }
1360
- }
1361
- let jump = sessionStorage.getItem('jump');
1362
- if (jump) {
1363
- this.handleJump(jump);
1364
- } else {
1365
- this.handleJump(
1366
- this.menu[0].url,
1367
- this.menu[0].urlopenmode,
1368
- this.menu[0]
1369
- );
1370
- }
1371
- }
1372
- }
1373
- }
1374
- }
1375
- },
1376
- //获取菜单第一条数据
1377
- getFirst(obj) {
1378
- if (!obj) {
1379
- return '';
1380
- }
1381
- let openIdex = 0;
1382
- if (
1383
- obj.extendData &&
1384
- (obj.extendData.subDefOpenIndex || obj.extendData.subDefOpen)
1385
- ) {
1386
- openIdex = parseInt(
1387
- obj.extendData.subDefOpenIndex || obj.extendData.subDefOpen,
1388
- 10
1389
- );
1390
- }
1391
- if (obj.children && obj.children.length) {
1392
- return this.getFirst(obj.children[openIdex]);
1393
- } else if (obj.fourthTabs && obj.fourthTabs.length) {
1394
- if (this.layout === 'topnav') {
1395
- return this.getFirst(obj.fourthTabs[openIdex]);
1396
- } else {
1397
- this.tabs = obj.fourthTabs;
1398
- if (obj.url) {
1399
- let tab = obj.fourthTabs.filter((item) => {
1400
- return item.url === obj.url;
1401
- })[0];
1402
- if (tab) {
1403
- this.tabsId = tab.id;
1404
- this.handleJump(tab.url, tab.urlopenmode, tab);
1405
- }
1406
- } else {
1407
- this.tabsId = this.tabs[0].id;
1408
- this.handleJump(
1409
- this.tabs[0].url,
1410
- this.tabs[0].urlopenmode,
1411
- this.tabs[0]
1412
- );
1413
- }
1414
- }
1415
- } else {
1416
- this.tabs = [];
1417
- this.handleJump(obj.url, obj.urlopenmode, obj);
1418
- }
1419
- return obj;
1420
- },
1421
- //遍历设置菜单气泡提醒
1422
- setTips(obj) {
1423
- if (Array.isArray(obj)) {
1424
- obj.forEach((item) => {
1425
- this.setTips(item);
1426
- });
1427
- } else {
1428
- if (
1429
- obj &&
1430
- Object.prototype.hasOwnProperty.call(obj, 'tips') &&
1431
- obj.tips
1432
- ) {
1433
- this.$set(obj, 'tips', false);
1434
- delete obj.tips;
1435
- }
1436
- let flag = false;
1437
- if (obj.children && obj.children.length) {
1438
- obj.children.forEach((item) => {
1439
- if (this.setTips(item)) {
1440
- flag = true;
1441
- }
1442
- });
1443
- if (flag) {
1444
- this.$set(obj, 'tips', true);
1445
- return true;
1446
- }
1447
- } else if (obj.fourthTabs && obj.fourthTabs.length) {
1448
- obj.fourthTabs.forEach((item) => {
1449
- if (this.setTips(item)) {
1450
- flag = true;
1451
- }
1452
- });
1453
- if (flag) {
1454
- this.$set(obj, 'tips', true);
1455
- return true;
1456
- }
1457
- } else {
1458
- if (this.menuTips[obj.id] && Number(this.menuTips[obj.id])) {
1459
- this.$set(obj, 'tips', Number(this.menuTips[obj.id]));
1460
- return true;
1461
- }
1462
- }
1463
- }
1464
- return false;
1465
- },
1466
- //设置默认导航页面
1467
- setDefault(res, active, param) {
1468
- this.navIds = JSON.parse(JSON.stringify(active));
1469
- this.sysId = '';
1470
- this.tabsId = '';
1471
- this.active = '';
1472
- this.getUrl(res, active, param);
1473
- if (
1474
- this.layout === 'subsystem' ||
1475
- this.layout === 'subSystem' ||
1476
- this.layout === 'topnav' ||
1477
- this.layout === 'topNav' ||
1478
- this.layout === 'topside' ||
1479
- this.layout === 'topSide'
1480
- ) {
1481
- if (this.layout === 'subsystem' || this.layout === 'subSystem') {
1482
- this.navs = [];
1483
- if (this.menuType === 'custom') {
1484
- this.subsystem = this.customMenu;
1485
- this.sysId = active[0];
1486
- } else {
1487
- this.subsystem = res;
1488
- this.sysId = active[0];
1489
- }
1490
- } else if (
1491
- this.layout === 'topnav' ||
1492
- this.layout === 'topNav' ||
1493
- this.layout === 'topside' ||
1494
- this.layout === 'topSide'
1495
- ) {
1496
- this.subsystem = [];
1497
- if (this.menuType === 'custom') {
1498
- this.navs = this.customMenu;
1499
- this.topActive = active[0];
1500
- } else {
1501
- this.navs = res;
1502
- this.topActive = active[0];
1503
- }
1504
- }
1505
- if (this.tabs.length || this.isTabs) {
1506
- this.tabsId = active[active.length - 1];
1507
- this.active = active.slice(1, active.length - 1);
1508
- } else {
1509
- this.active = active.slice(1);
1510
- }
1511
- for (let i = 0; i < res.length; i++) {
1512
- if (res[i].id === active[0]) {
1513
- this.menu = res[i].children;
1514
- this.title = res[i].text;
1515
- break;
1516
- }
1517
- }
1518
- } else if (active && active.length) {
1519
- this.navs = [];
1520
- this.subsystem = [];
1521
- this.menu = res;
1522
- if (this.biserial) {
1523
- this.active = active.slice(
1524
- 0,
1525
- active.length > 2 ? active.length - 1 : active.length
1526
- );
1527
- } else {
1528
- this.active = active.slice(1);
1529
- }
1530
- this.tabsId = active[active.length - 1];
1531
- }
1532
- this.showPage = true;
1533
- },
1534
- //获取页面类型及地址
1535
- getUrl(res, active, index, param) {
1536
- index = index === undefined ? 0 : index;
1537
- for (let i = 0; i < res.length; i++) {
1538
- let item = res[i];
1539
- if (item.id === active[index]) {
1540
- if (index === active.length - 1) {
1541
- this.handleJump(item.url, item.urlopenmode, item, param);
1542
- return item.url;
1543
- } else {
1544
- if (item.children && item.children.length) {
1545
- index++;
1546
- let url = this.getUrl(item.children, active, index, param);
1547
- if (url && index === active.length - 1) {
1548
- this.tabs = '';
1549
- }
1550
- return url;
1551
- }
1552
- if (item.fourthTabs && item.fourthTabs.length) {
1553
- index++;
1554
- let url = this.getUrl(item.fourthTabs, active, index, param);
1555
- if (url) {
1556
- this.$set(this, 'tabs', item.fourthTabs);
1557
- }
1558
- return url;
1559
- }
1560
- }
1561
- } else if (item.children && item.children.length) {
1562
- this.getUrl(item.children, active, index, param);
1563
- }
1564
- }
1565
- return false;
1566
- },
1567
-
1568
- setUrl(url, param) {
1569
- let obj = param ? param : {};
1570
- let params = util.getParams({ url: url }, true);
1571
- for (let i in params) {
1572
- if (i != 'model' && i != 'view' && i != '_baseUrl') {
1573
- obj[i] = params[i];
1574
- }
1575
- }
1576
- let _url = params._baseUrl ? params._baseUrl : './primary.html';
1577
- return util.urlJoinParams({ url: _url, param: obj });
1578
- },
1579
- //应用导航交互
1580
- handleSelect(res, type, open) {
1581
- const { node, fourthTabs } = res;
1582
- if (!open) {
1583
- if (
1584
- node.extendData &&
1585
- node.extendData.businessStatus == 0 &&
1586
- node.extendData.businessWarnMsg
1587
- ) {
1588
- this.$alert(node.extendData.businessWarnMsg, '提示', {
1589
- type: 'warning'
1590
- });
1591
- return;
1592
- }
1593
- this.isDefault = false;
1594
- this.tabsId = '';
1595
- }
1596
- switch (type) {
1597
- case 'nav':
1598
- this.tabs = [];
1599
- //this.active = '';
1600
- if (this.layout === 'topside') {
1601
- if (this.title !== node.text) {
1602
- //this.navIds = [node.id];
1603
- this.menu = node.children;
1604
- this.active = node.id;
1605
- this.title = node.text;
1606
- }
1607
- if (this.setFirstAsDefault) {
1608
- let subNode = this.getFirst(node);
1609
- if (subNode) {
1610
- this.active = subNode.id;
1611
- // this.navIds = [
1612
- // node.id,
1613
- // ...this.getId(node.children, subNode.url)
1614
- // ];
1615
- }
1616
- }
1617
- } else {
1618
- //this.navIds = this.getId(this.menus, node.url);
1619
- this.setTitle(this.navIds[0]);
1620
- this.tabsId = fourthTabs ? node.id : '';
1621
- }
1622
- break;
1623
- case 'sys':
1624
- if (Number(node.urlopenmode) !== 1) {
1625
- //this.navIds = [node.id];
1626
- this.tabs = [];
1627
- this.menu = node.children;
1628
- if (this.title !== node.text) {
1629
- this.active = '';
1630
- this.title = node.text;
1631
- }
1632
- if (this.setFirstAsDefault) {
1633
- let subNode = this.getFirst(node);
1634
- if (subNode) {
1635
- this.active = subNode.id;
1636
- // this.navIds = [
1637
- // node.id,
1638
- // ...this.getId(node.children, subNode.url)
1639
- // ];
1640
- }
1641
- }
1642
- this.isSide = true;
1643
- }
1644
- break;
1645
- case 'sub':
1646
- this.hideSubMenu = false;
1647
- //this.navIds = [node.id];
1648
- if (node.url) {
1649
- this.tabs = [];
1650
- }
1651
- if (this.title !== node.text) {
1652
- this.active = [node.id];
1653
- this.title = node.text;
1654
- }
1655
- if (this.setFirstAsDefault) {
1656
- let subNode = this.getFirst(node);
1657
- this.active = [node.id];
1658
- if (subNode && node.id !== subNode.id) {
1659
- //this.navIds = this.getId(this.menus, subNode.url);
1660
- this.$set(this.active, 1, subNode.id);
1661
- }
1662
- }
1663
- break;
1664
- case 'menu':
1665
- if (!open) {
1666
- this.tabs = [];
1667
- if (this.biserial) {
1668
- this.$set(this.active, 1, node.id);
1669
- } else {
1670
- this.active = node.id;
1671
- }
1672
- if (node.url) {
1673
- if (node.children && node.children.length) {
1674
- let tab = node.children.filter((item) => {
1675
- return item.url === node.url;
1676
- })[0];
1677
- if (tab) {
1678
- if (this.biserial) {
1679
- this.$set(this.active, 1, tab.id);
1680
- } else {
1681
- this.active = tab.id;
1682
- }
1683
- //this.navIds = this.getId(this.menus, tab.url);
1684
- }
1685
- } else {
1686
- let tab = (node.fourthTabs || []).filter((item) => {
1687
- return item.url === node.url;
1688
- })[0];
1689
- if (tab) {
1690
- this.tabs = node.fourthTabs;
1691
- this.tabsId = tab.id;
1692
- //this.navIds = this.getId(this.menus, tab.url);
1693
- } else {
1694
- //this.navIds = this.getId(this.menus, node.url);
1695
- }
1696
- }
1697
- } else {
1698
- if (node.fourthTabs.length) {
1699
- this.tabs = node.fourthTabs;
1700
- this.tabsId = this.tabs[0].id;
1701
- this.handleJump(
1702
- this.tabs[0].url,
1703
- this.tabs[0].urlopenmode,
1704
- this.tabs[0]
1705
- );
1706
- //this.navIds = this.getId(this.menus, this.tabs[0].url);
1707
- }
1708
- }
1709
- } else {
1710
- if (this.setFirstAsDefault) {
1711
- this.tabs = [];
1712
- let subNode = this.getFirst(node);
1713
- if (subNode) {
1714
- if (this.biserial) {
1715
- this.$set(this.active, 1, subNode.id);
1716
- } else {
1717
- this.active = subNode.id;
1718
- }
1719
- //this.navIds = this.getId(this.menus, subNode.url);
1720
- }
1721
- }
1722
- }
1723
- break;
1724
- case 'tabs':
1725
- this.tabsId = node.id;
1726
- //this.navIds = this.getId(this.menus, node.url);
1727
- break;
1728
- }
1729
- if (node.url) {
1730
- this.selectPage = node.url;
1731
- this.refresh = false;
1732
- this.handleJump(node.url, Number(node.urlopenmode), node);
1733
- }
1734
- },
1735
- hasRouter(res, url) {
1736
- if (!url) {
1737
- return false;
1738
- }
1739
- if (Array.isArray(res)) {
1740
- for (let i in res) {
1741
- let path = this.hasRouter(res[i], url);
1742
- if (path) {
1743
- return path;
1744
- }
1745
- }
1746
- } else {
1747
- let path = res.path;
1748
- if (path !== '/' && path !== '/404') {
1749
- path = path.replace(path[1], path[1].toLowerCase());
1750
- }
1751
- let pathname = url.substring(url.indexOf('#/') + 1);
1752
- pathname = pathname
1753
- .replace(pathname[1], pathname[1].toLowerCase())
1754
- .split('?')[0];
1755
- if (res.path !== '/' && pathname == path) {
1756
- return pathname;
1757
- }
1758
- if (res && Object.prototype.hasOwnProperty.call(res, 'children')) {
1759
- let path = this.hasRouter(res.children, url);
1760
- if (path) {
1761
- return path;
1762
- }
1763
- }
1764
- }
1765
- return false;
1766
- },
1767
- //头部工具交互事件
1768
- handleClick(res) {
1769
- const { type } = res;
1770
- switch (type) {
1771
- //刷新
1772
- case 'refresh':
1773
- this.handleRefresh();
1774
- break;
1775
- case 'home':
1776
- this.reset = false;
1777
- if (this.homePage) {
1778
- this.handleJump(this.homePage);
1779
- }
1780
- this.active = [];
1781
- this.defaultActive = [];
1782
- this.tabs = [];
1783
- if (this.menus && this.menus.length) {
1784
- this.setMenu(this.menus);
1785
- }
1786
- this.$nextTick(() => {
1787
- this.reset = true;
1788
- });
1789
- break;
1790
- case 'user':
1791
- this.showUserInfo = true;
1792
- break;
1793
- case 'online':
1794
- if (this.onlineUrl) {
1795
- this.dialog = {
1796
- title: '查看在线人员',
1797
- show: true,
1798
- src: this.onlineUrl
1799
- };
1800
- }
1801
- break;
1802
- case 'notice':
1803
- this.showMsg = !this.showMsg;
1804
- break;
1805
- case 'set':
1806
- this.handleSet();
1807
- break;
1808
- case 'goView':
1809
- util.win.open(res.path, '_blank');
1810
- break;
1811
- }
1812
- this.$emit('handler-click', res);
1813
- },
1814
- //刷新子页面、子路由
1815
- handleRefresh() {
1816
- if (this.method === 'iframe') {
1817
- this.page = util.handlerUrl(this.page);
1818
- } else {
1819
- this.refresh = false;
1820
- this.$nextTick(() => {
1821
- this.refresh = true;
1822
- });
1823
- }
1824
- },
1825
- //跳转页面
1826
- handleJump(page, type, res, param) {
1827
- this.navIds = this.getId(this.menus, page);
1828
- console.log(page);
1829
- let prevPage = sessionStorage.getItem('jump');
1830
- sessionStorage.setItem('jump', page);
1831
- if (res) {
1832
- if (res.fourthTabs && res.fourthTabs.length) {
1833
- this.pid = res.id;
1834
- } else {
1835
- this.pid = res.pid;
1836
- }
1837
- }
1838
- if (util.win.location.hash === page && prevPage === page) {
1839
- this.refresh = true;
1840
- return;
1841
- }
1842
- if (type == 1) {
1843
- util.win.open(page);
1844
- } else if (type == 2) {
1845
- location.href = page;
1846
- } else if (
1847
- type == 3 ||
1848
- this.loadWujie === false ||
1849
- (this.downgrade && isIE)
1850
- ) {
1851
- this.method = 'iframe';
1852
- this.refresh = false;
1853
- this.page = util.handlerUrl(page, param);
1854
- } else if (page) {
1855
- let urls = page.split('?');
1856
- if (urls[0].indexOf('.js') > 1) {
1857
- this.method = 'wujie';
1858
- this.wjName = 'singlespa';
1859
- this.page = this.host + page;
1860
- this.$nextTick(() => {
1861
- this.refresh = true;
1862
- });
1863
- } else if (
1864
- urls[0].indexOf('.dhtml') > 0 ||
1865
- (urls[0].indexOf('.html') > 0 && urls[0].indexOf('.html#') === -1)
1866
- ) {
1867
- this.method = 'iframe';
1868
- this.refresh = false;
1869
- this.page = util.handlerUrl(page, param);
1870
- } else {
1871
- if (urls[0].indexOf('.html') === -1 && urls[0].indexOf('#/') === -1) {
1872
- this.method = 'iframe';
1873
- this.refresh = false;
1874
- this.page = util.handlerUrl(page, param);
1875
- } else {
1876
- this.method = 'router';
1877
- const routes = this.$router.options.routes;
1878
- if (routes) {
1879
- let path = this.hasRouter(routes, urls[0]);
1880
- if (path) {
1881
- let params = util.getParams({ url: page });
1882
- if (param) {
1883
- params = { ...params, ...param };
1884
- }
1885
- if (res) {
1886
- this.routerKey = res.id;
1887
- if (Object.prototype.hasOwnProperty.call(res, 'keepAlive')) {
1888
- this.isKeepAlive = res.keepAlive;
1889
- }
1890
- }
1891
- this.$router.push({
1892
- path: path,
1893
- query: params
1894
- });
1895
- this.$nextTick(() => {
1896
- this.refresh = true;
1897
- });
1898
- } else {
1899
- let urlopenmode = util.getParams({
1900
- url: page,
1901
- name: 'urlopenmode'
1902
- });
1903
- if (
1904
- this.loadWujie === false ||
1905
- (this.downgrade && isIE) ||
1906
- urlopenmode == 3
1907
- ) {
1908
- this.method = 'iframe';
1909
- this.refresh = false;
1910
- this.page = util.handlerUrl(page, param);
1911
- } else {
1912
- this.method = 'wujie';
1913
- this.wjName =
1914
- res && res.appCode ? res.appCode : 'application';
1915
- this.page = this.host + page;
1916
- this.$nextTick(() => {
1917
- this.refresh = true;
1918
- });
1919
- }
1920
- }
1921
- } else {
1922
- this.method = 'iframe';
1923
- this.refresh = false;
1924
- this.page = util.handlerUrl(page, param);
1925
- this.$nextTick(() => {
1926
- this.refresh = true;
1927
- });
1928
- }
1929
- }
1930
- }
1931
- }
1932
- this.$nextTick(() => {
1933
- this.showPage = true;
1934
- });
1935
- },
1936
- //设置回调
1937
- handleChange(res) {
1938
- const { type, value } = res;
1939
- switch (type) {
1940
- case 'theme':
1941
- this.setTheme(value);
1942
- break;
1943
- case 'ignore':
1944
- this.notice = 0;
1945
- break;
1946
- }
1947
- },
1948
- getFourthTabs(menus, id) {
1949
- if (Array.isArray(menus)) {
1950
- for (let i = 0; i < menus.length; i++) {
1951
- let fourth = this.getFourthTabs(menus[i], id);
1952
- if (fourth) {
1953
- return fourth;
1954
- }
1955
- }
1956
- } else {
1957
- if (menus.fourthTabs && menus.fourthTabs.length && menus.id === id) {
1958
- return menus;
1959
- }
1960
- if (menus.children && menus.children.length) {
1961
- for (let i = 0; i < menus.children.length; i++) {
1962
- let fourth = this.getFourthTabs(menus.children[i], id);
1963
- if (fourth) {
1964
- return fourth;
1965
- }
1966
- }
1967
- }
1968
- }
1969
- return false;
1970
- },
1971
- handleLayout(res, old) {
1972
- if (res == old) {
1973
- return;
1974
- }
1975
- this.layout = res;
1976
- switch (res) {
1977
- case 'topnav':
1978
- this.navs = this.menus;
1979
- this.tabs = [];
1980
- this.subsystem = [];
1981
- this.topActive =
1982
- this.navIds && this.navIds.length
1983
- ? this.navIds[this.navIds.length - 1]
1984
- : '';
1985
- break;
1986
- case 'subsystem':
1987
- this.subsystem = this.menus;
1988
- this.navs = [];
1989
- this.tabs = [];
1990
- if (this.navIds && this.navIds.length) {
1991
- let node = this.setTitle(this.navIds[0]);
1992
- this.active = JSON.parse(JSON.stringify(this.navIds)).slice(1);
1993
- let tabs = this.getFourthTabs(this.menus, this.pid);
1994
- if (tabs) {
1995
- this.active.pop();
1996
- this.tabs = tabs.fourthTabs;
1997
- this.tabsId = this.navIds[this.navIds.length - 1];
1998
- }
1999
- this.menu = node.children;
2000
- this.title = node.text;
2001
- } else {
2002
- //this.navIds = [this.menus[0].id]
2003
- this.menu = this.menus[0].children;
2004
- this.title = this.menus[0].text;
2005
- }
2006
- break;
2007
- case 'topside':
2008
- this.navs = this.menus;
2009
- this.subsystem = [];
2010
- this.tabs = [];
2011
- if (this.navIds && this.navIds.length) {
2012
- let node = this.setTitle(this.navIds[0]);
2013
- this.active = JSON.parse(JSON.stringify(this.navIds)).slice(1);
2014
- let tabs = this.getFourthTabs(this.menus, this.pid);
2015
- if (tabs) {
2016
- this.active.pop();
2017
- this.tabs = tabs.fourthTabs;
2018
- this.tabsId = this.navIds[this.navIds.length - 1];
2019
- }
2020
- this.topActive = this.navIds[0];
2021
- this.menu = node.children;
2022
- } else {
2023
- this.menu = this.menus[0].children;
2024
- this.topActive = this.menus[0].id;
2025
- }
2026
- break;
2027
- default:
2028
- this.navs = [];
2029
- this.subsystem = [];
2030
- this.menu = this.menus;
2031
- if (this.navIds && this.navIds.length) {
2032
- this.active = JSON.parse(JSON.stringify(this.navIds));
2033
- let tabs = this.getFourthTabs(this.menus, this.pid);
2034
- if (tabs) {
2035
- this.active.pop();
2036
- this.tabs = tabs.fourthTabs;
2037
- this.tabsId = this.navIds[this.navIds.length - 1];
2038
- }
2039
- }
2040
- }
2041
- },
2042
- //监听改变菜单
2043
- handleListener() {
2044
- util.win.addEventListener(
2045
- 'message',
2046
- (e) => {
2047
- var msg = e.data;
2048
- if (msg.key == 'jump_Menu') {
2049
- let res = msg.data1;
2050
- if (typeof res === 'string') {
2051
- res = res.split(',');
2052
- }
2053
- this.setDefault(this.menus, res);
2054
- }
2055
- },
2056
- false
2057
- );
2058
- },
2059
- //开启weosocket
2060
- initWebSocket() {
2061
- this.webSocket = util.socket({
2062
- url: wss,
2063
- take: topic,
2064
- success: (res) => {
2065
- let data = res.data || {};
2066
- for (let i in data) {
2067
- if (data[i] !== null && data[i] !== undefined) {
2068
- if (i === 'onlineUserNums' && data[i] > 0) {
2069
- this.online = data[i];
2070
- }
2071
- if (i === 'sysMsgNums') {
2072
- this.notice = data[i];
2073
- if (this.showMsg) {
2074
- this.$refs.message.getMsg(true);
2075
- }
2076
- }
2077
- if (i === 'menuTipsMap') {
2078
- this.menuTips = data[i];
2079
- }
2080
- if (i === 'sysMsgList') {
2081
- this.sysMsg = data[i];
2082
- }
2083
- if (i === 'extraData') {
2084
- this.extraData = data[i];
2085
- }
2086
- }
2087
- }
2088
- if (this.$store) {
2089
- try {
2090
- this.$store.commit('websocket', data);
2091
- } catch (error) {}
2092
- }
2093
- if (this.$eventBus) {
2094
- this.$eventBus.$emit('websocket', data);
2095
- }
2096
- if (util.win.eventBus) {
2097
- util.win.eventBus.$emit('websocket', data);
2098
- }
2099
- }
2100
- });
2101
- },
2102
- handleOpened(res) {
2103
- if (res === undefined) {
2104
- this.sysMsg = [];
2105
- } else if (res == false && this.sysMsg.length) {
2106
- this.sysMsgOut = setTimeout(() => {
2107
- this.sysMsg = [];
2108
- }, 3000);
2109
- } else if (this.sysMsgOut) {
2110
- clearTimeout(this.sysMsgOut);
2111
- }
2112
- },
2113
- // handleDialog(obj) {
2114
- // this.dialog = obj;
2115
- // },
2116
- handleUserModel(name, val) {
2117
- this.$set(this.userModel, name, val);
2118
- },
2119
- handleMenuTips(id, num) {
2120
- if (num) {
2121
- this.$set(this.menuTips, id, num);
2122
- } else {
2123
- let n = parseInt(this.menuTips[id], 10) - 1;
2124
- this.$set(this.menuTips, id, n);
2125
- }
2126
- },
2127
- handleReLogin(res) {
2128
- if (res && typeof res == 'string') {
2129
- res = JSON.parse(res);
2130
- }
2131
- let msg = '提示';
2132
- let btn = {
2133
- confirmButtonText: '确定',
2134
- cancelButtonText: '取消',
2135
- closeOnClickModal: false,
2136
- type: 'warning'
2137
- };
2138
- if (res) {
2139
- if (res.rCode === 69) {
2140
- msg = '该账号在其他地方已登陆!';
2141
- btn = {
2142
- confirmButtonText: '确定',
2143
- closeOnClickModal: false,
2144
- type: 'warning'
2145
- };
2146
- } else {
2147
- msg = '登录已过期,请重新登录!';
2148
- }
2149
- }
2150
- cl;
2151
- let remind = sessionStorage.getItem('remind');
2152
- if (!remind) {
2153
- clearTimeout(this.timer);
2154
- this.timer = setTimeout(() => {
2155
- console.log('handleReLogin');
2156
- sessionStorage.setItem('remind', 1);
2157
- this.$confirm(msg, btn)
2158
- .then(() => {
2159
- util.removeStorage([
2160
- 'Authorization',
2161
- 'token',
2162
- 'ssId',
2163
- 'userId',
2164
- 'userName',
2165
- 'auth',
2166
- 'deviceUnique',
2167
- 'menus',
2168
- 'useCaseCodes',
2169
- 'mainConfig',
2170
- 'jump'
2171
- ]);
2172
- const loginPage =
2173
- util.getStorage('login') || util.getStorage('loginPage');
2174
- try {
2175
- if (loginPage) {
2176
- let src;
2177
- if (!util.startWith(loginPage, ['http', '/'], true)) {
2178
- let pathname = util.win.top.location.pathname;
2179
- if (pathname !== '/') {
2180
- pathname = pathname.split('/');
2181
- pathname.splice(pathname.length - 1);
2182
- pathname = pathname.join('/');
2183
- src = pathname + '/' + loginPage.replace('./', '');
2184
- } else {
2185
- src = pathname + loginPage.replace('./', '');
2186
- }
2187
- } else {
2188
- src = loginPage;
2189
- }
2190
- util.win.top.location.href = src;
2191
- } else if (
2192
- util.win.top.location.href.indexOf('main.html') > -1
2193
- ) {
2194
- util.win.top.location.href = './login.html';
2195
- } else {
2196
- const hash = util.win.top.location.hash;
2197
- if (hash) {
2198
- const len = util.win.top.location.href.indexOf(hash);
2199
- util.win.top.location.href =
2200
- util.win.location.href.slice(0, len) + '#/login';
2201
- } else {
2202
- util.win.top.location.href = '/login.html';
2203
- }
2204
- }
2205
- } catch (error) {
2206
- util.win.postMessage({ type: 1 }, '*');
2207
- }
2208
- })
2209
- .catch((e) => {
2210
- sessionStorage.removeItem('remind');
2211
- });
2212
- }, 2000);
2213
- }
2214
- },
2215
- openPage(url, name, width, height) {
2216
- let src = url;
2217
- if (!util.startWith(url, ['http', '/'], true)) {
2218
- let pathname = window.location.pathname;
2219
- if (pathname !== '/') {
2220
- pathname = pathname.split('/');
2221
- pathname.splice(pathname.length - 1);
2222
- pathname = pathname.join('/');
2223
- }
2224
- src = pathname + url.replace('./', '/');
2225
- }
2226
- if (name) {
2227
- let w = 0;
2228
- let h = 0;
2229
- try {
2230
- w = width ? width : util.win.top.screen.availWidth - 10;
2231
- h = height ? height : util.win.top.screen.availHeight - 60;
2232
- } catch (error) {
2233
- w = width ? width : util.win.screen.availWidth - 10;
2234
- h = height ? height : util.win.screen.availHeight - 60;
2235
- }
2236
- return util.win.open(
2237
- src,
2238
- name,
2239
- `width=${w}px,height=${h}px,resizable=yes,status=yes,menubar=no,scrollbars=yes`
2240
- );
2241
- } else {
2242
- return util.win.open(src);
2243
70
  }
2244
71
  }
2245
72
  },
2246
- beforeDestroy() {
2247
- this.timer = null;
2248
- if (this.webSocket) {
2249
- this.webSocket.destroy();
2250
- }
2251
- util.win.removeEventListener('popstate', this.tateHandle);
2252
- }
73
+ beforeDestroy() {}
2253
74
  };
2254
75
  </script>