Navigator.vue
34.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
<template>
<el-header height="60px">
<div class="header-container">
<div class="flex">
<router-link to="home" style="text-decoration: none">
<div class="logo-container" v-if="!showLogo">
<img src="@/assets/img/logo-new.png" />
</div>
<div class="logo-container" v-if="logo">
<a class="logo-link">
<img :src="logo" style="margin-top: 0; height: 48px" />
</a>
</div>
</router-link>
</div>
<div class="flex header-right">
<div class="bmk-cascader_main">
<!-- <el-button style="margin-right: 15px" @click="toggleBmk"
>我的收藏
<i class="el-icon-star-on"></i>
</el-button> -->
<el-cascader-panel
:options="menuBmks"
v-if="showBmk"
id="bmkCascaderPanel"
style="margin-right: 20px; margin-left: 10px"
class="bmk-cascader_panel"
@change="handleBmkMenuChange"
>
<template slot-scope="{node, data}">
<span @click="handleBmkMenuClick(node)">
<el-tag type="info" plain closable @close="removeBmk(node)">{{
data.label
}}</el-tag>
</span>
</template>
</el-cascader-panel>
</div>
<el-autocomplete
popper-class="my-autocomplete"
size="small"
class="inline-input"
v-model="searchWork"
:fetch-suggestions="querySearch"
placeholder="搜索菜单"
:trigger-on-focus="false"
@select="handleSelect"
>
<i slot="suffix" class="el-input__icon el-icon-search"></i>
<template slot-scope="{item}">
<router-link class="alias"
style="color: #333;"
:to="{path: '/'+item.alias}"
>{{ item.name }}({{ item.alias }})</router-link
>
</template>
</el-autocomplete>
<div class="optionBtns">
<el-link
class="top-btn"
:underline="false"
:href="frontUrl"
target="_blank"
title="访问应用端"
>
<i class="icon-computer top-link-icon" /><span class="top-text"
>应用端</span
>
<!-- 访问应用端 -->
</el-link>
<el-link
class="top-btn"
:underline="false"
style=""
@click="handleScreenFull"
:title="isScreenFull ? '退出全屏' : '全屏'"
>
<i
:class="[
isScreenFull
? 'icon-nav-fullscreen-cancel'
: 'icon-nav-fullscreen'
]"
class="top-link-icon"
>
</i>
<span class="top-text">{{
isScreenFull ? '退出全屏' : '全屏'
}}</span>
</el-link>
<el-popover
popper-class="header-popper top-btn"
:visible-arrow="false"
trigger="hover"
>
<el-link
class="top-btn clear-cache-wrap"
slot="reference"
:underline="false"
><i class="icon-eliminate top-link-icon"></i
><span class="clear-cache-text">清除缓存</span>
<i class="icon-nav-user-unfold triangle-icon top-text"></i>
</el-link>
<template>
<ul class="user-link-ul clear-cache">
<li @click="clearCache('清除用户模块缓存', 'uc', 'eip:uc')">
清除用户模块缓存
</li>
<li
@click="clearCache('清除流程模块缓存', 'bpmModel', 'eip:bpm')"
>
清除流程模块缓存
</li>
<li @click="clearCache('清除表单模块缓存', 'form', 'eip:form')">
清除表单模块缓存
</li>
<li
@click="
clearCache('清除国际化模块缓存', 'portal', 'eip:i18n')
"
>
清除国际化模块缓存
</li>
<li
@click="clearCache('清除系统设置缓存', 'portal', 'eip:sys')"
>
清除系统设置缓存
</li>
<li @click="clearExtUniteToken('清除企微钉钉缓存')">
清除企微钉钉缓存
</li>
<li @click="clearCache('清除所有缓存', '', 'eip')">
清除所有缓存
</li>
</ul>
</template>
</el-popover>
<el-divider direction="vertical"></el-divider>
</div>
<lang-select />
<el-divider direction="vertical" class="divider-item"></el-divider>
<el-popover
popper-class="header-popper"
:visible-arrow="false"
width="208"
trigger="hover"
>
<HtAvatar slot="reference" :user="currentUser" isShowTriangle />
<template>
<div>
<div class="flex user-box-header">
<HtAvatar style="margin-right: 15px" :user="currentUser" />
<div>
<h3
v-if="$store.state.login.currentUser"
style="margin: 5px 0"
>
{{ $store.state.login.currentUser.username }}
</h3>
</div>
</div>
<!-- <span style="color: #c9c9c9">|</span> -->
<el-divider class="user-box-divider"></el-divider>
<div>
<ul class="user-link-ul">
<li @click="openInfoDialog">
<i class="icon-user-info"></i>
个人信息
</li>
<li @click="openResetPwdDialog">
<i class="icon-user-pwd-modify"></i>
修改密码
</li>
<li @click="handleStyleSettingDialog">
<i class="icon-nav-skin-select"></i>
风格设置
</li>
<li @click="aboutPlatformDialogVisible = true">
<i class="icon-hotent-H"></i>
关于平台
</li>
</ul>
</div>
<div class="flex user-box-logout" @click="logout">
<el-link :underline="false" class="icon-user-logout">退出系统</el-link>
</div>
</div>
</template>
</el-popover>
</div>
</div>
<ht-sidebar-dialog
width="28%"
title="风格设置"
:visible="styleSettingDialogVisible"
:before-close="handleStyleSettingDialogClose"
>
<el-form :model="styleSetting" style="margin-left: -30px">
<ht-form-item label="标签页风格" label-width="100px">
<el-radio-group v-model="styleSetting.tabsStyle.tabType">
<el-radio-button label="card">选项卡样式</el-radio-button>
<el-radio-button label>默认样式</el-radio-button>
<el-radio-button label="border-card">卡片化</el-radio-button>
<el-radio-button label="menuSetting">菜单配置</el-radio-button>
</el-radio-group>
</ht-form-item>
</el-form>
</ht-sidebar-dialog>
<ht-sidebar-dialog
title="查看个人信息"
:visible="infoDialogVisible"
width="28%"
:before-close="handleStyleSettingDialogClose"
>
<el-form
v-if="currentUser && currentUser.user"
:inline="true"
ref="form"
label-width="80px"
size="mini"
>
<el-form-item label="用户名称:" style="width: 50%">
<span class="content_span">{{ currentUser.user.fullname }}</span>
</el-form-item>
<el-form-item label="用户账号:">
<span class="content_span">{{ currentUser.user.account }}</span>
</el-form-item>
<el-form-item label="手机号码:" style="width: 50%">
<span class="content_span">{{ currentUser.user.mobile }}</span>
</el-form-item>
<el-form-item label="邮箱地址:">
<span class="content_span">{{ currentUser.user.email }}</span>
</el-form-item>
<el-form-item label="用户性别:" style="width: 50%">
<span class="content_span">{{ currentUser.user.sex }}</span>
</el-form-item>
<el-form-item label="用户状态:">
<span class="content_span">{{
currentUser.user.status == '1'
? '正常'
: currentUser.user.status == '0'
? '禁用'
: currentUser.user.status == '-1'
? '未激活'
: '离职'
}}</span>
</el-form-item>
<el-form-item label="地址:" style="width: 100%">
<span class="content_span">{{ currentUser.user.address }}</span>
</el-form-item>
<el-form-item style="width: 100%" label="所属角色:">
<template v-for="role in currentUser.roles">
<el-tag type="warning" size="small" :key="role.name" v-if="role.name">{{
role.name
}}</el-tag>
</template>
</el-form-item>
<el-form-item style="width: 100%" label="所属岗位:">
<el-tooltip
:content="post.pathName"
placement="top"
:key="post.postId"
v-for="post in currentUser.post"
>
<el-tag type="success" size="small">{{ post.postName }}</el-tag>
</el-tooltip>
</el-form-item>
<el-form-item style="width: 100%" label="所属组织:">
<el-tooltip
:content="org.pathName"
placement="top"
:key="org.orgId"
v-for="org in currentUser.org"
>
<el-tag size="small">{{ org.orgName }}</el-tag>
</el-tooltip>
</el-form-item>
</el-form>
</ht-sidebar-dialog>
<ht-sidebar-dialog
title="修改密码"
:visible.sync="modifyPwdDialogVisible"
:close-on-click-modal="false"
width="28%"
id="modlfy-dialog"
:before-close="handleStyleSettingDialogClose"
>
<el-form
:model="pwdForm"
:rules="pwdRules"
ref="pwdForm"
label-width="120px"
size="mini"
>
<el-form-item label="旧密码" prop="old">
<el-input
type="password"
v-model="pwdForm.old"
placeholder="请输入旧密码"
></el-input>
</el-form-item>
<el-form-item label="新密码" prop="new">
<el-input
type="password"
placeholder="请输入新密码"
v-model="pwdForm.new"
></el-input>
</el-form-item>
<el-form-item label="重复新密码" prop="newRepeat">
<el-input
type="password"
placeholder="请再次输入新密码"
v-model="pwdForm.newRepeat"
></el-input>
</el-form-item>
</el-form>
<span class="dialog-footer" style="text-align: right; bottom: auto">
<el-button size="small" @click="modifyPwdDialogVisible = false"
>取 消</el-button
>
<el-button size="small" type="primary" @click="submitForm()"
>确认</el-button
>
</span>
</ht-sidebar-dialog>
<el-dialog
title="关于平台"
:visible.sync="aboutPlatformDialogVisible"
append-to-body
width="600px"
>
<div class="about-platform">
<div class="platform-profile">
<i class="icon-hotent-H"></i>
<div class="platform-detail">
<span class="platform-name">EIP 企业信息平台</span>
<span class="platform-version" v-if="platformVersion"
>平台版本:{{ platformVersion }}</span
>
</div>
</div>
<span class="copyright">
Copyright © 版权所有
<a href="https://hotent.com" target="_blank"
>广州宏天软件股份有限公司</a
>
2008-2023
</span>
</div>
</el-dialog>
</el-header>
</template>
<script>
import HtAvatar from '@/components/common/HtAvatar.vue'
import LangSelect from '@/components/lang/LangSelect.vue'
import screenfull from 'screenfull'
import {mapState} from 'vuex'
import req from '@/request.js'
export default {
name: 'navigator',
components: {HtAvatar, LangSelect},
props: ['menuShow'],
data() {
var validateNew = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入新密码'))
}
let config = this.pwdStrategy
if (config.enable == 1) {
let pwdRule = config.pwdRule
let pwdLength = config.pwdLength
if (pwdRule) {
if (value.length < pwdLength) {
callback(new Error('新密码长度至少为' + pwdLength))
} else if (pwdRule == 2) {
var re = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z])')
if (!re.test(value)) {
callback(new Error('新密码必须包含数字、字母'))
} else {
callback()
}
} else if (pwdRule == 3) {
var re = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9])')
if (!re.test(value)) {
callback(new Error('新密码必须包含数字、字母、特殊字符'))
} else {
callback()
}
} else if (pwdRule == 4) {
var re = new RegExp(
'(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9])'
)
if (!re.test(value)) {
callback(new Error('新密码必须包含数字、大小字母、特殊字符'))
} else {
callback()
}
} else {
callback()
}
}
} else {
if (value.length < 6) {
callback(new Error('新密码长度至少为6'))
} else {
callback()
}
}
}
var validateold = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入旧密码'))
} else {
callback()
}
}
var validateNewReapeat = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入新密码'))
} else {
callback()
}
}
return {
logo: '',
platformVersion: '',
showLogo: true,
isScreenFull: false,
styleSettingDialogVisible: false,
styleSetting: {
tabsStyle: {
tabPosition: 'top',
tabType: 'border-card'
},
elementUI: {
theme: 'day-theme'
}
},
searchWork: '',
searchMenus: [],
infoDialogVisible: false,
modifyPwdDialogVisible: false,
pwdForm: {
old: '',
new: '',
newRepeat: ''
},
pwdRules: {
old: [{validator: validateold, trigger: 'blur'}],
new: [{validator: validateNew, trigger: 'blur'}],
newRepeat: [{validator: validateNewReapeat, trigger: 'blur'}]
},
isIeExplorer: false,
menuBmks: [],
menuSelected: '',
showBmk: false,
aboutPlatformDialogVisible: false
}
},
computed: {
...mapState({
menus: state => state.menu.menus,
currentUser: state => state.user.currentUserDetail,
token: state => state.login.currentUser.token,
frontUrl: function() {
if (
this.currentUser &&
this.currentUser.user &&
this.currentUser.user.account &&
(!window.ssoConfig.mode || window.ssoConfig.mode == 'jwt')
) {
return `${window.context.front}?token=` + this.token
} else {
return `${window.context.front}`
}
},
pwdStrategy: state => state.user.pwdStrategy,
bookmark: state => state.menu.bookmark,
loginCurrentUser: state => state.login.currentUser,
})
},
watch: {
styleSetting: {
handler: function(val, oldval) {
let str = JSON.stringify(val)
localStorage.setItem('styleSetting', str)
this.$store.dispatch('styleSetting/actionStyleSetting', JSON.parse(str))
},
deep: true //对象内部的属性监听,也叫深度监听
},
aboutPlatformDialogVisible: function(newVal, oldval) {
if (newVal && newVal != oldval) {
if (this.platformVersion == '') {
req
.get(window.context.uc + '/base/tools/v1/getPlatformVersion')
.then(rep => {
if (rep && rep.data && rep.data.state) {
this.platformVersion = rep.data.value
}
})
}
}
},
bookmark: {
handler: function(val) {
this.handleMenuBookmark()
}
},
loginCurrentUser: {
handler: function(val) {
this.init()
}
}
},
methods: {
clearExtUniteToken() {
this.$confirm('是否确认清除缓存数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.toClearExtUniteToken()
})
.catch(() => {})
},
toClearExtUniteToken() {
this.$http
.get('${portal}/portal/sysExternalUnite/v1/clearToken')
.then(() => {
this.$message.success('清除企微钉钉缓存成功')
})
},
clearCache(modelName, model, key) {
this.$confirm('是否确认清除缓存数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
//分服务部署模式下,清除所有缓存。调用各个微服务的清除缓存方法
if (!model && key == 'eip') {
if (window.context.uc != window.context.portal) {
;['uc', 'portal', 'form', 'bpmRunTime', 'bpmModel'].forEach(
ele => {
this.toClearCache(`清除${ele}模块缓存`, ele, key)
}
)
} else {
this.toClearCache(modelName, 'portal', key)
}
} else {
this.toClearCache(modelName, model, key)
}
})
.catch(() => {})
},
toClearCache(modelName, model, key) {
this.$http
.get('${' + model + '}/base/tools/v1/clearCacheByKey?key=' + key)
.then(() => {
this.$message.success(`${modelName}成功`)
})
},
submitForm() {
let this_ = this
this.$refs['pwdForm'].validate(valid => {
if (valid) {
if (this.pwdForm.newRepeat != this.pwdForm.new) {
this.$message.warning(`重复新密码与新密码不一致!`)
return
}
this.$http
.post('${uc}/api/user/v1/user/changUserPsd', {
oldPwd: this.pwdForm.old.encryptWithRsa(),
newPwd: this.pwdForm.new.encryptWithRsa()
})
.then(resp => {
let data = resp.data
if (data && data.state) {
this.modifyPwdDialogVisible = false
this.$alert('修改密码成功, 请使用新密码重新登录。', '提示', {
confirmButtonText: '确定',
callback: action => {
//退出登录
this_.logout()
}
})
}
})
}
})
},
openInfoDialog() {
this.infoDialogVisible = true
},
openResetPwdDialog() {
this.$store.dispatch('user/getDefPwdStrategy')
this.modifyPwdDialogVisible = true
if (this.$refs['pwdForm']) {
this.$refs['pwdForm'].resetFields()
}
},
logout() {
let loginRouthPath =
localStorage.getItem(
this.$store.state.login.currentUser.account + 'manageLoginRoutePath'
) || '/login'
this.$store.dispatch('menu/actionMenusEmpty')
this.$store.dispatch('login/logoutAndCleanUp').then(() => {
switch (window.ssoConfig.mode) {
case 'cas':
case 'oauth':
window.sessionStorage.removeItem('currentUser')
window.location.href =
window.ssoConfig.logout +
'?service=' +
window.location.href.split('?')[0]
break
default:
this.$router.push({
path: loginRouthPath
})
break
}
})
},
//全屏与退出全屏操作
handleScreenFull(type) {
if (!screenfull.isEnabled) {
this.$message({
message: '不支持全屏',
type: 'warning'
})
return false
}
screenfull.toggle(document.getElementsByTagName('body')[0])
screenfull.on("change", () => {
if (screenfull.isFullscreen) {
this.isScreenFull = true
} else {
this.isScreenFull = false
}
})
// this.isScreenFull = !this.isScreenFull
},
handleStyleSettingDialog() {
let styleSetting = localStorage.getItem('styleSetting')
if (styleSetting && styleSetting != 'null') {
this.styleSetting = JSON.parse(styleSetting)
}
this.styleSettingDialogVisible = true
},
handleStyleSettingDialogClose() {
this.styleSettingDialogVisible = false
this.infoDialogVisible = false
this.modifyPwdDialogVisible = false
},
querySearch(queryString, cb) {
// 查询出二级三级的菜单
let menus = []
menus = [...this.menus]
if (queryString) {
this.searchMenus = []
this.preFilterMenus(this.menus, queryString)
} else {
this.searchMenus = menus
}
// 调用 callback 返回建议列表的数据
this.searchMenus = this.searchMenus.unique('alias')
cb(this.searchMenus)
},
preFilterMenus(menus, queryString) {
if (menus instanceof Array) {
menus.forEach(x => {
this.filterMenus(x, queryString)
})
} else {
this.filterMenus(menus, queryString, true)
}
},
filterMenus(x, queryString, isComponent) {
if (x.children) {
let r = x.children.filter(menu => {
this.preFilterMenus(menu, queryString)
return (
menu.name.toLowerCase().indexOf(queryString.toLowerCase()) != -1 ||
menu.alias.toLowerCase().indexOf(queryString.toLowerCase()) != -1
)
})
if (r && r.length >= 1) {
r.forEach(y => {
if (isComponent) {
y.parentComponent = x
}
this.searchMenus.push(y)
})
}
}
},
handleSelect(item) {
this.$router.push({path: `/${item.alias}`})
},
//获取系统默认配置 系统Logo、名称
sysSetting() {
const _this = this
let url =
window.context.portal + '/sys/sysProperties/v1/getDecryptBySysSetting'
_this.$http.get(url).then(response => {
if (response && response.data && response.data.value) {
let sysSettingData = JSON.parse(response.data.value)
if (sysSettingData.manageLogo.length > 0) {
let manageLogo = sysSettingData.manageLogo
_this.showLogo = true
_this.logo = `${window.context.portal}/system/file/v1/getLogoFile?logoType=manage&tenantId=${sysSettingData.id}`
} else {
this.showLogo = false
}
} else {
this.showLogo = false
}
})
},
handleMenuBookmark() {
//this.menuBmks
//目前只需要考虑两级
let menus = []
for (let key in this.bookmark) {
let val = this.bookmark[key]
if (menus.length == 0) {
menus.push({
label: val.name,
value: val.menuId
})
continue
}
let isParent = true
for (let j = 0; j < menus.length; j++) {
if (menus[j].value === val.parentMenuId) {
if (!menus[j].children) {
menus[j].children = []
}
menus[j].children.push({
label: val.name,
value: val.menuId
})
isParent = false
break
}
}
if (isParent) {
menus.push({
label: val.name,
value: val.menuId
})
}
}
this.$set(this, 'menuBmks', menus)
},
toggleBmk() {
this.showBmk = !this.showBmk
if (this.showBmk) {
let this_ = this
setTimeout(() => {
let clickOtherFunction = function(event) {
let panelEle = document.getElementById('bmkCascaderPanel')
if (panelEle && panelEle.contains(event.target)) {
return
}
document.removeEventListener('click', clickOtherFunction, false)
this_.showBmk = false
}
document.addEventListener('click', clickOtherFunction, false)
}, 50)
}
},
//收藏菜单选中触发
handleBmkMenuClick(node) {
let menuId = node.data.value
//获取菜单路径
let menu = this.getMenuByMenuId(menuId)
if (menu && menu.href) {
//跳转
this.$router.push('/' + menu.alias)
return
}
if (menu && menu.path) {
if (menu.path.split('.').length == 5) {
//二级菜单,如数据应用、图标应用
this.$router.push('/' + menu.alias)
} else if (menu.path.split('.').length == 6) {
//三级菜单,如PC表单设计
let parentMenu = this.getMenuByMenuId(menu.parentId)
this.$router.push('/' + parentMenu.alias + '#' + menu.alias)
}
}
this.toggleBmk()
},
removeBmk(node) {
window.event.stopPropagation()
this.$confirm('是否删除该收藏?', '提示', {})
.then(() => {
this.doRemoveBmk(node.data)
})
.catch(() => {})
},
doRemoveBmk(data) {
let menuIds = []
let gatherFun = function(data) {
if (!data) {
return
}
if (data.value) {
menuIds.push(data.value)
}
if (data.children && data.children.length > 0) {
data.children.forEach(child => {
gatherFun.call(null, child)
})
}
}
gatherFun.call(null, data)
this.$store.dispatch('menu/removeMenuBookmark', menuIds).then(() => {
this.$message.success('删除成功')
this.$root.$emit('menuBookmarkChange')
this.toggleBmk()
})
},
getMenuByMenuId(menuId) {
let innerFun = menus => {
if (!menus || menus.length == 0) {
return
}
for (let i = 0; i < menus.length; i++) {
if (menus[i].id === menuId) {
return menus[i]
}
let menu = innerFun(menus[i].children)
if (menu) {
return menu
}
}
}
return innerFun(this.menus)
},
handleBmkMenuChange(node) {},
init() {
!this.currentUser && this.$store.dispatch('user/loadCurrentUserDetail')
const currentUser = this.loginCurrentUser
if (currentUser) {
let userAttrs = this.loginCurrentUser.userAttrs
if (userAttrs) {
//租户
const tenantId = userAttrs.tenantId
if (tenantId) {
let _this = this
let url = '${uc}/uc/tenantManage/v1/getJson?id=' + tenantId
this.$http.get(url).then(
resp => {
if (resp.data) {
let tenantManage = resp.data
if (tenantManage.manageLogo) {
let manageLogo = JSON.parse(tenantManage.manageLogo)
if (manageLogo && manageLogo.length > 0) {
_this.showLogo = true
_this.logo = `${window.context.portal}/system/file/v1/getLogoFile?logoType=manage&tenantId=${tenantManage.id}`
}
} else {
_this.showLogo = false
}
}
},
error => {
_this.showLogo = false
reject(error)
}
)
} else {
//不是租户
this.sysSetting()
}
} else {
//不是租户
this.sysSetting()
}
} else {
//不是租户
this.sysSetting()
}
}
},
mounted() {
this.init()
},
created() {
let USER_AGENT = navigator.userAgent.toLowerCase()
let isChrome = /.*(chrome)\/([\w.]+).*/
if (!isChrome.test(USER_AGENT)) {
this.isIeExplorer = true
}
}
}
</script>
<style lang="scss" scoped>
@import '@/assets/css/element-variables.scss';
/deep/.el-divider {
background: #9f9f9f;
margin: 0;
}
.divider-item {
margin: 0 24px;
}
.optionBtns {
padding: 0 16px;
}
.top-btn {
.top-text {
padding-right: 24px;
font-size: 16px;
font-weight: 400;
color: $base-color;
}
.clear-cache-text {
font-size: 16px;
font-weight: 400;
color: $base-color;
}
.triangle-icon {
padding-left: 10px;
}
}
.clear-cache-wrap {
&:hover {
.triangle-icon {
transform: rotateZ(180deg);
padding-left: 24px;
padding-right: 10px;
}
}
}
.navbar-menu-collapse {
cursor: pointer;
width: $base-header-height;
height: $base-header-height;
background: $base-collapse-bg;
text-align: center;
line-height: $base-header-height;
}
.navbar-menu-collapse > i {
font-size: 18px;
margin: 13px;
color: $base-color;
}
.logo-container {
margin-left: 24px;
cursor: default;
display: flex;
}
.logo-container > i.icon-hotent-H-c {
font-size: 36px;
background-image: linear-gradient($--color-secondary, $--color-primary);
background-clip: text;
-webkit-background-clip: text;
color: transparent;
margin-right: -5px;
}
.logo-container > i.icon-hotent-H-ie {
font-size: 36px;
background-clip: text;
-webkit-background-clip: text;
color: $--color-primary;
margin-right: -5px;
}
.logo-container:hover > i.icon-hotent-H-c {
background-image: linear-gradient($--color-primary, $--color-secondary);
}
.logo-container > span.pre-word {
font-size: 26px;
font-weight: bold;
color: $--color-primary;
}
.logo-container > span.tail-word {
font-size: 24px;
// font-weight: bold;
color: #bdbfc2;
}
.header-container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
justify-content: space-between;
position: fixed;
top: 0;
left: 0;
z-index: 999;
-webkit-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.08);
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.08);
background-color: #fff;
width: 100%;
height: $base-header-height;
// line-height:$base-header-height ;
}
.logo-link {
margin-left: 30px;
font-weight: bold;
font-size: 18px;
color: #2274af;
text-decoration: none;
}
.nav-logo {
width: 25px;
height: 25px;
line-height: 25px;
vertical-align: middle;
margin-top: -6px;
}
.header-right {
margin-right: 24px;
align-items: center;
justify-content: space-between;
}
.header-right > .el-link,
.header-right > span > .el-link {
margin-right: 15px;
font-size: 13px;
}
.header-right > .el-link:hover,
.header-right > span > .el-link:hover {
color: #ff7717;
}
.top-link-icon {
font-size: 20px;
padding-right: 8px;
color: $base-color;
// font-weight: bold;
}
.icon-computer {
font-size: 22px;
}
.top-message-header {
background: #f7f7f7;
justify-content: space-between;
padding: 5px 10px;
}
.user-box-divider {
// margin: 10px 0;
background: #E6E6E6;
}
.user-box-header {
padding: 8px 16px;
}
.inline-input {
margin-right: 15px;
width: 288px;
margin-right: 24px;
/deep/.el-input__inner {
border-radius: 2px;
}
/deep/.el-input__suffix {
color: #888;
.el-icon-search {
font-size: 16px;
}
}
}
.user-link-ul {
list-style: none;
padding: 0;
margin: 0;
}
.clear-cache {
padding: 5px;
}
.user-link-ul{
padding: 8px 0;
border-bottom: 1px solid #E6E6E6;
}
.user-link-ul > li {
padding: 0px 16px;
height: 32px;
line-height: 32px;
cursor: pointer;
}
.user-link-ul > li > i {
margin-right: 10px;
font-size: 16px;
}
.user-link-ul > li:hover {
background: #F9F9F9;
color: #409EFF;
}
.top-message-more {
border-top: 1px solid #dedede;
margin-top: 10px;
padding: 10px;
}
.top-message-body {
justify-content: center;
align-items: center;
min-height: 80px;
}
.top-message-more > a:hover,
.top-message-more > a:focus {
color: #555;
}
.user-box-logout {
margin: 8px 0 4px 0;
::v-deep{
.icon-user-logout{
justify-content: flex-start;
padding-left: 16px;
&:hover{
color: #E55555;
}
.el-link--inner{
padding-left: 8px;
}
}
}
}
.top-message-more:hover,
.user-box-logout:hover {
}
.user-box-logout > a {
height: 32px;
line-height: 32px;
width: 100%;
color: #E55555;
&:hover{
background: #F9F9F9;
}
}
// .user-box-logout > a:hover,
// .user-box-logout > a:focus {
// color: #ff7717;
// }
#screenfull {
margin-right: 15px;
svg {
width: 12px;
height: 12px;
margin-bottom: -2px;
}
}
.content_span {
color: #212121;
display: inline-block;
}
.bmk-cascader_panel {
position: absolute;
background: #ffffff;
>>> .el-cascader-menu__wrap {
min-height: 204px;
height: auto;
}
}
.bmk-cascader_main {
position: relative;
}
.about-platform {
display: flex;
height: 128px;
justify-content: space-between;
flex-direction: column;
text-align: center;
.platform-profile {
display: flex;
justify-content: center;
.platform-detail {
display: flex;
flex-direction: column;
text-align: left;
justify-content: space-around;
.platform-name {
font-size: 24px;
color: #333;
font-weight: bold;
}
.platform-version {
font-size: 14px;
color: #777;
}
}
}
.icon-hotent-H {
font-size: 77px;
background-image: linear-gradient(left bottom, #2274af, #56b0f0);
background-clip: text;
color: transparent;
}
.copyright {
color: #999;
font-size: 13px;
text-align: center;
}
.copyright > a {
color: #999;
font-size: 13px;
text-align: center;
text-decoration: none;
cursor: pointer;
}
.copyright > a:hover {
color: #2274af;
}
}
</style>