eoss-ui 0.4.61 → 0.4.63

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