yh-pub 1.0.0 → 1.0.2
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.
- package/README.MD +19 -19
- package/layout/admin/adminIndex.vue +104 -104
- package/layout/admin/api/loginApi.js +24 -24
- package/layout/admin/api/routers.js +93 -93
- package/layout/admin/api/tenantApi.js +123 -123
- package/layout/admin/home/homeIndex.vue +25 -25
- package/layout/admin/login/login.vue +161 -161
- package/layout/admin/menu/MenuIndex.vue +648 -648
- package/layout/admin/menu/icon.vue +108 -108
- package/layout/admin/menu/iconList.js +934 -934
- package/layout/admin/saTenant/saTenant.vue +173 -173
- package/layout/admin/saTenant/saTenantForm.js +80 -80
- package/layout/admin/saTenant/saTenantForm.vue +61 -61
- package/layout/admin/saTenant/saTenantRoleManage.js +417 -417
- package/layout/admin/saTenant/saTenantRoleManage.vue +99 -99
- package/layout/admin/user/saUser.less +6 -6
- package/layout/admin/user/saUser.vue +72 -72
- package/layout/main/components/console/console.vue +205 -205
- package/layout/main/components/error-store/error-store.vue +72 -72
- package/layout/main/components/error-store/index.js +2 -2
- package/layout/main/components/fullscreen/fullscreen.vue +57 -57
- package/layout/main/components/fullscreen/index.js +2 -2
- package/layout/main/components/language/language.vue +71 -71
- package/layout/main/components/side-menu/side-menu.less +73 -73
- package/layout/main/components/side-menu/side-menu.vue +75 -75
- package/layout/main/components/tags-nav/tags-nav.less +44 -44
- package/layout/main/components/tags-nav/tags-nav.vue +144 -144
- package/layout/main/components/user/user.less +12 -12
- package/layout/main/components/user/user.vue +185 -185
- package/layout/main/home/home.vue +480 -480
- package/layout/main/home/index.js +2 -2
- package/layout/main/home/toDoList.vue +32 -32
- package/layout/main/login/login.less +93 -93
- package/layout/main/login/login.vue +151 -151
- package/layout/main/main.less +81 -81
- package/layout/main/main.vue +254 -202
- package/layout/main/system/dict.vue +64 -64
- package/layout/main/system/orgManage.vue +473 -473
- package/layout/main/system/roleManage.js +807 -755
- package/layout/main/system/roleManage.vue +424 -399
- package/package.json +11 -11
- package/view/basic/error-logger.vue +74 -74
- package/view/basic/error-page/401.vue +22 -22
- package/view/basic/error-page/404.vue +22 -22
- package/view/basic/error-page/500.vue +22 -22
- package/view/basic/error-page/back-btn-group.vue +48 -48
- package/view/basic/error-page/error-content.vue +28 -28
- package/view/basic/error-page/error.less +46 -46
- package/view/config/component/confFormItem.vue +49 -49
- package/view/config/config.scss +45 -45
- package/view/config/configIndex.vue +150 -150
- package/view/config/subPage/router-config.vue +4 -4
- package/view/config/subPage/sys-config.vue +249 -249
- package/view/window/IframeFReportView.vue +27 -27
- package/view/window/windowIndex.vue +22 -22
package/layout/main/main.less
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
.main{
|
|
2
|
-
height: 100%;
|
|
3
|
-
display: flex;
|
|
4
|
-
.logo-con{
|
|
5
|
-
display: flex;
|
|
6
|
-
justify-content: center;
|
|
7
|
-
align-items: center;
|
|
8
|
-
height: 50px;
|
|
9
|
-
box-sizing: border-box;
|
|
10
|
-
background-color: #0051C1;
|
|
11
|
-
.max-logo{
|
|
12
|
-
height: 44px;
|
|
13
|
-
width: auto;
|
|
14
|
-
display: block;
|
|
15
|
-
margin: 0 auto;
|
|
16
|
-
}
|
|
17
|
-
.mini-logo{
|
|
18
|
-
width: 44px;
|
|
19
|
-
height: auto;
|
|
20
|
-
display: block;
|
|
21
|
-
margin: 0 auto;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
.header-con{
|
|
25
|
-
--header-size: 50px;
|
|
26
|
-
background: linear-gradient(90deg, #0051C1 0%, #3E93FE 100%);
|
|
27
|
-
width: 100%;
|
|
28
|
-
height: var(--header-size);
|
|
29
|
-
line-height: var(--header-size);
|
|
30
|
-
padding: 0 12px;
|
|
31
|
-
box-sizing: border-box;
|
|
32
|
-
display: flex;
|
|
33
|
-
justify-content: flex-end;
|
|
34
|
-
align-items: center;
|
|
35
|
-
position: relative;
|
|
36
|
-
.class-collapsed{
|
|
37
|
-
position: absolute;
|
|
38
|
-
left: 0;
|
|
39
|
-
top: 9px;
|
|
40
|
-
width: 32px;
|
|
41
|
-
height: 32px;
|
|
42
|
-
line-height: 32px;
|
|
43
|
-
text-align: center;
|
|
44
|
-
margin-right: 12px;
|
|
45
|
-
color: var(--el-color-white);
|
|
46
|
-
font-size: 26px;
|
|
47
|
-
cursor: pointer;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
.main-layout-con{
|
|
51
|
-
flex: 1;
|
|
52
|
-
overflow: hidden;
|
|
53
|
-
background-color:#F3F5FA;
|
|
54
|
-
display: flex;
|
|
55
|
-
flex-direction: column;
|
|
56
|
-
}
|
|
57
|
-
.main-container{
|
|
58
|
-
flex: 1;
|
|
59
|
-
overflow: auto;
|
|
60
|
-
background-color: #fff;
|
|
61
|
-
padding: 0 10px 10px 10px;
|
|
62
|
-
box-sizing: border-box;
|
|
63
|
-
}
|
|
64
|
-
.left-sider{
|
|
65
|
-
width: 220px;
|
|
66
|
-
background-color: #21304C;
|
|
67
|
-
--el-menu-bg-color: #21304C;
|
|
68
|
-
--el-menu-text-color: var(--el-color-white);
|
|
69
|
-
--el-menu-active-color: var(--el-color-white);
|
|
70
|
-
--el-menu-hover-bg-color: transparent;
|
|
71
|
-
&.is-collapse {
|
|
72
|
-
width: 64px;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
.right-container {
|
|
76
|
-
overflow: hidden;
|
|
77
|
-
flex: 1;
|
|
78
|
-
display: flex;
|
|
79
|
-
flex-direction: column;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
1
|
+
.main{
|
|
2
|
+
height: 100%;
|
|
3
|
+
display: flex;
|
|
4
|
+
.logo-con{
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
align-items: center;
|
|
8
|
+
height: 50px;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
background-color: #0051C1;
|
|
11
|
+
.max-logo{
|
|
12
|
+
height: 44px;
|
|
13
|
+
width: auto;
|
|
14
|
+
display: block;
|
|
15
|
+
margin: 0 auto;
|
|
16
|
+
}
|
|
17
|
+
.mini-logo{
|
|
18
|
+
width: 44px;
|
|
19
|
+
height: auto;
|
|
20
|
+
display: block;
|
|
21
|
+
margin: 0 auto;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
.header-con{
|
|
25
|
+
--header-size: 50px;
|
|
26
|
+
background: linear-gradient(90deg, #0051C1 0%, #3E93FE 100%);
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: var(--header-size);
|
|
29
|
+
line-height: var(--header-size);
|
|
30
|
+
padding: 0 12px;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: flex-end;
|
|
34
|
+
align-items: center;
|
|
35
|
+
position: relative;
|
|
36
|
+
.class-collapsed{
|
|
37
|
+
position: absolute;
|
|
38
|
+
left: 0;
|
|
39
|
+
top: 9px;
|
|
40
|
+
width: 32px;
|
|
41
|
+
height: 32px;
|
|
42
|
+
line-height: 32px;
|
|
43
|
+
text-align: center;
|
|
44
|
+
margin-right: 12px;
|
|
45
|
+
color: var(--el-color-white);
|
|
46
|
+
font-size: 26px;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
.main-layout-con{
|
|
51
|
+
flex: 1;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
background-color:#F3F5FA;
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
}
|
|
57
|
+
.main-container{
|
|
58
|
+
flex: 1;
|
|
59
|
+
overflow: auto;
|
|
60
|
+
background-color: #fff;
|
|
61
|
+
padding: 0 10px 10px 10px;
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
}
|
|
64
|
+
.left-sider{
|
|
65
|
+
width: 220px;
|
|
66
|
+
background-color: #21304C;
|
|
67
|
+
--el-menu-bg-color: #21304C;
|
|
68
|
+
--el-menu-text-color: var(--el-color-white);
|
|
69
|
+
--el-menu-active-color: var(--el-color-white);
|
|
70
|
+
--el-menu-hover-bg-color: transparent;
|
|
71
|
+
&.is-collapse {
|
|
72
|
+
width: 64px;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
.right-container {
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
flex: 1;
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
}
|
|
81
|
+
}
|
package/layout/main/main.vue
CHANGED
|
@@ -1,202 +1,254 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section class="main">
|
|
3
|
-
<aside
|
|
4
|
-
class="left-sider"
|
|
5
|
-
:class="{
|
|
6
|
-
<!-- 需要放在菜单上面的内容,如Logo,写在side-menu标签内部,如下 -->
|
|
7
|
-
<div class="logo-con">
|
|
8
|
-
<template v-if="hasCustomLogo">
|
|
9
|
-
<img
|
|
10
|
-
v-show="!collapse"
|
|
11
|
-
class="max-logo"
|
|
12
|
-
:src="logo"
|
|
13
|
-
key="max-logo" />
|
|
14
|
-
<img
|
|
15
|
-
v-show="collapse"
|
|
16
|
-
class="mini-logo"
|
|
17
|
-
:src="minLogo"
|
|
18
|
-
key="min-logo" />
|
|
19
|
-
</template>
|
|
20
|
-
<template v-else>
|
|
21
|
-
<img
|
|
22
|
-
v-show="!collapse"
|
|
23
|
-
class="max-logo"
|
|
24
|
-
src="@/assets/images/logo.png"
|
|
25
|
-
key="max-logo" />
|
|
26
|
-
<img
|
|
27
|
-
v-show="collapse"
|
|
28
|
-
class="mini-logo"
|
|
29
|
-
src="@/assets/images/logo-min.png"
|
|
30
|
-
key="min-logo" />
|
|
31
|
-
</template>
|
|
32
|
-
</div>
|
|
33
|
-
<side-menu
|
|
34
|
-
:active-name="route?.name"
|
|
35
|
-
:collapse="collapse"
|
|
36
|
-
:menu-list="menuList"></side-menu>
|
|
37
|
-
</aside>
|
|
38
|
-
<section
|
|
39
|
-
class="right-container"
|
|
40
|
-
:class="{
|
|
41
|
-
<header class="header-con">
|
|
42
|
-
<i
|
|
43
|
-
:class="`iconfont class-collapsed ${collapse ? 'icon-indent' : 'icon-outdent'}`"
|
|
44
|
-
@click="handleCollapsedChange"></i>
|
|
45
|
-
<user
|
|
46
|
-
:message-unread-count="unreadCount"
|
|
47
|
-
:user-name="userName" />
|
|
48
|
-
<language v-if="config.useI18n" />
|
|
49
|
-
<!-- <error-store
|
|
50
|
-
v-if="config.plugin?.errorStore?.showInHeader"
|
|
51
|
-
:count="errorCount"></error-store>
|
|
52
|
-
<LogConsole></LogConsole> -->
|
|
53
|
-
<fullscreen v-model="isFullScreen" />
|
|
54
|
-
</header>
|
|
55
|
-
<main class="main-layout-con">
|
|
56
|
-
<tags-nav />
|
|
57
|
-
<section
|
|
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
|
-
import
|
|
86
|
-
import
|
|
87
|
-
import
|
|
88
|
-
import
|
|
89
|
-
import {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
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
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<section class="main">
|
|
3
|
+
<aside
|
|
4
|
+
class="left-sider"
|
|
5
|
+
:class="{'is-collapse': collapse}">
|
|
6
|
+
<!-- 需要放在菜单上面的内容,如Logo,写在side-menu标签内部,如下 -->
|
|
7
|
+
<div class="logo-con">
|
|
8
|
+
<template v-if="hasCustomLogo">
|
|
9
|
+
<img
|
|
10
|
+
v-show="!collapse"
|
|
11
|
+
class="max-logo"
|
|
12
|
+
:src="logo"
|
|
13
|
+
key="max-logo" />
|
|
14
|
+
<img
|
|
15
|
+
v-show="collapse"
|
|
16
|
+
class="mini-logo"
|
|
17
|
+
:src="minLogo"
|
|
18
|
+
key="min-logo" />
|
|
19
|
+
</template>
|
|
20
|
+
<template v-else>
|
|
21
|
+
<img
|
|
22
|
+
v-show="!collapse"
|
|
23
|
+
class="max-logo"
|
|
24
|
+
src="@/assets/images/logo.png"
|
|
25
|
+
key="max-logo" />
|
|
26
|
+
<img
|
|
27
|
+
v-show="collapse"
|
|
28
|
+
class="mini-logo"
|
|
29
|
+
src="@/assets/images/logo-min.png"
|
|
30
|
+
key="min-logo" />
|
|
31
|
+
</template>
|
|
32
|
+
</div>
|
|
33
|
+
<side-menu
|
|
34
|
+
:active-name="route?.name"
|
|
35
|
+
:collapse="collapse"
|
|
36
|
+
:menu-list="menuList"></side-menu>
|
|
37
|
+
</aside>
|
|
38
|
+
<section
|
|
39
|
+
class="right-container"
|
|
40
|
+
:class="{'is-collapse': collapse}">
|
|
41
|
+
<header class="header-con">
|
|
42
|
+
<i
|
|
43
|
+
:class="`iconfont class-collapsed ${collapse ? 'icon-indent' : 'icon-outdent'}`"
|
|
44
|
+
@click="handleCollapsedChange"></i>
|
|
45
|
+
<user
|
|
46
|
+
:message-unread-count="unreadCount"
|
|
47
|
+
:user-name="userName" />
|
|
48
|
+
<language v-if="config.useI18n" />
|
|
49
|
+
<!-- <error-store
|
|
50
|
+
v-if="config.plugin?.errorStore?.showInHeader"
|
|
51
|
+
:count="errorCount"></error-store>
|
|
52
|
+
<LogConsole></LogConsole> -->
|
|
53
|
+
<fullscreen v-model="isFullScreen" />
|
|
54
|
+
</header>
|
|
55
|
+
<main class="main-layout-con">
|
|
56
|
+
<tags-nav />
|
|
57
|
+
<section
|
|
58
|
+
class="main-container"
|
|
59
|
+
:class="{'is-iframe': isIframe}">
|
|
60
|
+
<router-view v-slot="{Component}">
|
|
61
|
+
<KeepAlive
|
|
62
|
+
:max="10"
|
|
63
|
+
ref="kpAliveRef">
|
|
64
|
+
<component
|
|
65
|
+
v-show="!isIframe"
|
|
66
|
+
:is="Component"
|
|
67
|
+
:key="route.path" />
|
|
68
|
+
</KeepAlive>
|
|
69
|
+
<iframe
|
|
70
|
+
v-show="item === route.params.url"
|
|
71
|
+
v-for="item in iframeList"
|
|
72
|
+
:src="item"
|
|
73
|
+
:key="item"
|
|
74
|
+
frameborder="0"
|
|
75
|
+
scrolling="auto"
|
|
76
|
+
style="background-color: #fff"></iframe>
|
|
77
|
+
</router-view>
|
|
78
|
+
</section>
|
|
79
|
+
</main>
|
|
80
|
+
</section>
|
|
81
|
+
</section>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<script setup>
|
|
85
|
+
import './main.less';
|
|
86
|
+
import {ref, onMounted, onUnmounted, computed, watch} from 'vue';
|
|
87
|
+
import {storeToRefs} from 'pinia';
|
|
88
|
+
import {ElNotification} from 'element-plus';
|
|
89
|
+
import {getToken, getStorage} from '@/libs/util';
|
|
90
|
+
import {markRead} from '@/api/user';
|
|
91
|
+
import {useRouter, useRoute, onBeforeRouteUpdate} from 'vue-router';
|
|
92
|
+
|
|
93
|
+
import config from '@/config';
|
|
94
|
+
import {useAppStore} from '@/store/app.js';
|
|
95
|
+
import {useUserStore} from '@/store/user.js';
|
|
96
|
+
import SideMenu from './components/side-menu/side-menu.vue';
|
|
97
|
+
import TagsNav from './components/tags-nav/tags-nav.vue';
|
|
98
|
+
import User from './components/user/user.vue';
|
|
99
|
+
import Fullscreen from './components/fullscreen/fullscreen.vue';
|
|
100
|
+
import {Language} from 'yh-i18n';
|
|
101
|
+
|
|
102
|
+
const baseUrl = process.env.NODE_ENV === 'development' ? config.baseUrl.dev : config.baseUrl.pro;
|
|
103
|
+
|
|
104
|
+
const userStore = useUserStore();
|
|
105
|
+
const appStore = useAppStore();
|
|
106
|
+
const router = useRouter();
|
|
107
|
+
const route = useRoute();
|
|
108
|
+
const kpAliveRef = ref();
|
|
109
|
+
|
|
110
|
+
const {menuList, errorCount, tagPaths} = storeToRefs(appStore);
|
|
111
|
+
const {unreadCount} = storeToRefs(userStore);
|
|
112
|
+
|
|
113
|
+
const hasCustomLogo = computed(() => {
|
|
114
|
+
return !!config.logo;
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const logo = computed(() => {
|
|
118
|
+
return config.logo;
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const minLogo = computed(() => {
|
|
122
|
+
return config.minLogo;
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const isIframe = computed(() => {
|
|
126
|
+
return route.meta.isIframe;
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const iframeList = ref([]);
|
|
130
|
+
function pushIframe(url) {
|
|
131
|
+
if (!iframeList.value.includes(url)) {
|
|
132
|
+
iframeList.value.push(url);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
onBeforeRouteUpdate((to, form, next) => {
|
|
136
|
+
if (to.meta.isIframe) {
|
|
137
|
+
pushIframe(to.params.url);
|
|
138
|
+
}
|
|
139
|
+
next();
|
|
140
|
+
});
|
|
141
|
+
watch(
|
|
142
|
+
() => tagPaths.value,
|
|
143
|
+
(newVal, oldVal) => {
|
|
144
|
+
let delPath = oldVal.filter((path) => !newVal.includes(path));
|
|
145
|
+
delPath.forEach((path) => {
|
|
146
|
+
iframeList.value = iframeList.value.filter((item) => item !== path);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
const userName = ref('');
|
|
152
|
+
const collapse = ref(false);
|
|
153
|
+
const unReadMessageMap = ref({});
|
|
154
|
+
const websocketPath = baseUrl.replace('http', 'ws') + '/webSocket';
|
|
155
|
+
const isFullScreen = ref(false);
|
|
156
|
+
let websocket = null;
|
|
157
|
+
|
|
158
|
+
function handleCollapsedChange() {
|
|
159
|
+
collapse.value = !collapse.value;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function initWebsocket() {
|
|
163
|
+
let token = getToken();
|
|
164
|
+
if (typeof WebSocket === 'undefined') {
|
|
165
|
+
ElMessage.info('您的浏览器不支持WebSocket');
|
|
166
|
+
} else if (token) {
|
|
167
|
+
try {
|
|
168
|
+
// 实例化websocket
|
|
169
|
+
websocket = new WebSocket(websocketPath + '?$_TOKEN=' + token);
|
|
170
|
+
// 监听websocket的连接
|
|
171
|
+
websocket.onopen = () => {
|
|
172
|
+
console.log('(' + websocketPath + ') websocket连接成功');
|
|
173
|
+
};
|
|
174
|
+
// 监听websocket的错误信息
|
|
175
|
+
websocket.onerror = () => {
|
|
176
|
+
console.log('(' + websocketPath + ') websocket连接错误');
|
|
177
|
+
};
|
|
178
|
+
// 监听websocket的消息
|
|
179
|
+
websocket.onmessage = (msg) => {
|
|
180
|
+
websocketGetMessage(msg);
|
|
181
|
+
};
|
|
182
|
+
// 监听websocket关闭
|
|
183
|
+
websocket.onclose = () => {
|
|
184
|
+
websocketClose();
|
|
185
|
+
};
|
|
186
|
+
} catch (e) {}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function websocketGetMessage(msg) {
|
|
191
|
+
let msgData = eval(msg.data);
|
|
192
|
+
if (msgData && msgData.length > 0) {
|
|
193
|
+
msgData.forEach((msg) => {
|
|
194
|
+
if (!unReadMessageMap.value[msg.ID]) {
|
|
195
|
+
unReadMessageMap.value[msg.ID] = msg;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
Object.keys(unReadMessageMap.value).forEach((key) => {
|
|
199
|
+
let msg = unReadMessageMap.value[key];
|
|
200
|
+
if (!msg.hasOwnProperty('show')) {
|
|
201
|
+
ElNotification.open({
|
|
202
|
+
title: msg.TITLE,
|
|
203
|
+
desc: msg.TEXT,
|
|
204
|
+
duration: 0,
|
|
205
|
+
name: msg.ID,
|
|
206
|
+
onClose: () => {
|
|
207
|
+
delete unReadMessageMap.value[msg.ID];
|
|
208
|
+
markRead(msg.ID);
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
msg['show'] = true;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function websocketSendMessage(msg) {
|
|
218
|
+
websocket.send(msg);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function websocketClose() {
|
|
222
|
+
let that = this;
|
|
223
|
+
console.log('websocket关闭,尝试重新连接websocket');
|
|
224
|
+
window.setTimeout(() => {
|
|
225
|
+
that.initWebsocket();
|
|
226
|
+
}, 1000);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
onMounted(async () => {
|
|
230
|
+
try {
|
|
231
|
+
userName.value = getStorage('userName');
|
|
232
|
+
if (route.meta.isIframe) {
|
|
233
|
+
pushIframe(route.params.url);
|
|
234
|
+
}
|
|
235
|
+
} catch (error) {
|
|
236
|
+
console.error('菜单加载异常:', error);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
onUnmounted(() => {
|
|
240
|
+
ElNotification.closeAll();
|
|
241
|
+
});
|
|
242
|
+
</script>
|
|
243
|
+
|
|
244
|
+
<style lang="scss">
|
|
245
|
+
.main-container.is-iframe {
|
|
246
|
+
padding: 0 !important;
|
|
247
|
+
box-sizing: border-box;
|
|
248
|
+
overflow: hidden;
|
|
249
|
+
> iframe {
|
|
250
|
+
width: 100%;
|
|
251
|
+
height: 100%;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
</style>
|