lw-cdp-ui 1.0.7 → 1.0.8
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/dist/components/lwLayout/components/NavMenu.vue +36 -0
- package/dist/components/lwLayout/components/aside.vue +295 -0
- package/dist/components/lwLayout/components/bu.vue +62 -0
- package/dist/components/lwLayout/components/iframeView.vue +57 -0
- package/dist/components/lwLayout/components/lang.vue +65 -0
- package/dist/components/lwLayout/components/search.vue +139 -0
- package/dist/components/lwLayout/components/setting.vue +80 -0
- package/dist/components/lwLayout/components/sideM.vue +136 -0
- package/dist/components/lwLayout/components/tags.vue +329 -0
- package/dist/components/lwLayout/components/tasks.vue +83 -0
- package/dist/components/lwLayout/components/topbar.vue +71 -0
- package/dist/components/lwLayout/components/userbar.vue +229 -0
- package/dist/components/lwLayout/index.vue +384 -0
- package/dist/components/lwLogin/index.vue +368 -0
- package/dist/components/lwSearch/date/date.vue +109 -0
- package/dist/components/lwSearch/dateRange/dateRange.vue +110 -0
- package/dist/components/lwSearch/dates/dates.vue +366 -0
- package/dist/components/lwSearch/index.vue +656 -0
- package/dist/components/lwSearch/input/input.vue +54 -0
- package/dist/components/lwSearch/select/select.vue +69 -0
- package/dist/components/lwSvgIcon/index.vue +29 -0
- package/dist/components/lwTable/column.js +23 -0
- package/dist/components/lwTable/columnSetting.vue +120 -0
- package/dist/components/lwTable/index.vue +561 -0
- package/dist/lw-cdp-ui.esm.js +5712 -10
- package/dist/lw-cdp-ui.esm.js.map +1 -0
- package/dist/lw-cdp-ui.umd.js +15 -14
- package/dist/lw-cdp-ui.umd.js.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +5 -3
- package/dist/_commonjsHelpers-DaMA6jEr.js +0 -8
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
- package/dist/index-BfdSPp1W.js +0 -1805
- package/dist/index-Cnc84Sx6.js +0 -20
- package/dist/index-CxdIMwUE.js +0 -960
- package/dist/index-D825avEL.js +0 -1765
- package/dist/index-a7otVtml.js +0 -1093
- package/dist/lang-B7aKFznA.js +0 -87
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="navMenus.length<=0" style="padding:20px;">
|
|
3
|
+
<el-alert title="无子集菜单" center type="info" :closable="false"></el-alert>
|
|
4
|
+
</div>
|
|
5
|
+
<template v-for="navMenu in navMenus" v-bind:key="navMenu">
|
|
6
|
+
<el-menu-item v-if="!hasChildren(navMenu)" :index="navMenu.path">
|
|
7
|
+
<a v-if="navMenu.meta&&navMenu.meta.type=='link'" :href="navMenu.path" target="_blank" @click.stop='()=>{}'></a>
|
|
8
|
+
<el-icon v-if="navMenu.meta&&navMenu.meta.icon"><component :is="navMenu.meta.icon || 'el-icon-menu'"/></el-icon>
|
|
9
|
+
<template #title>
|
|
10
|
+
<span>{{navMenu.meta.title}}</span>
|
|
11
|
+
</template>
|
|
12
|
+
</el-menu-item>
|
|
13
|
+
<el-sub-menu v-else :index="navMenu.path">
|
|
14
|
+
<template #title>
|
|
15
|
+
<el-icon v-if="navMenu.meta&&navMenu.meta.icon"><component :is="navMenu.meta.icon || 'el-icon-menu'"/></el-icon>
|
|
16
|
+
<span>{{navMenu.meta.title}}</span>
|
|
17
|
+
</template>
|
|
18
|
+
<NavMenu :navMenus="navMenu.children"></NavMenu>
|
|
19
|
+
</el-sub-menu>
|
|
20
|
+
</template>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
export default {
|
|
25
|
+
name: 'NavMenu',
|
|
26
|
+
props: ['navMenus'],
|
|
27
|
+
data() {
|
|
28
|
+
return {}
|
|
29
|
+
},
|
|
30
|
+
methods: {
|
|
31
|
+
hasChildren(item) {
|
|
32
|
+
return item.children && !item.children.every(item => item.meta.hidden)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="layout-aside">
|
|
3
|
+
|
|
4
|
+
<img class="logo"
|
|
5
|
+
:src="logo"
|
|
6
|
+
alt="">
|
|
7
|
+
|
|
8
|
+
<el-popover placement="right"
|
|
9
|
+
:width="180"
|
|
10
|
+
trigger="click"
|
|
11
|
+
:show-arrow="false"
|
|
12
|
+
:offset="3"
|
|
13
|
+
popper-class="app-popper"
|
|
14
|
+
ref="popoverRef">
|
|
15
|
+
<template #reference>
|
|
16
|
+
<p>
|
|
17
|
+
<el-icon class="menu-btn">
|
|
18
|
+
<component is="el-icon-grid" />
|
|
19
|
+
</el-icon>
|
|
20
|
+
</p>
|
|
21
|
+
</template>
|
|
22
|
+
<div class="app-content">
|
|
23
|
+
<div class="app-title">
|
|
24
|
+
应用中心
|
|
25
|
+
<el-icon class="iconClose"
|
|
26
|
+
@click="closePopover">
|
|
27
|
+
<el-icon-close />
|
|
28
|
+
</el-icon>
|
|
29
|
+
</div>
|
|
30
|
+
<el-divider style="margin: 5px 0;" />
|
|
31
|
+
<template v-if="grantedApplications.length > 0">
|
|
32
|
+
<div class="menu-item"
|
|
33
|
+
@click="switchMenu(item)"
|
|
34
|
+
v-for="item in grantedApplications"
|
|
35
|
+
:key="item.resourceId">
|
|
36
|
+
<i class="iconfont"
|
|
37
|
+
:class="item.icon"
|
|
38
|
+
style="margin-right: 5px;"></i>
|
|
39
|
+
{{ item.name}}
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
</div>
|
|
44
|
+
</el-popover>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
import logo from 'https://saas.lianwei.com.cn/static/images/logo.jpg';
|
|
50
|
+
export default {
|
|
51
|
+
name: 'layoutAside',
|
|
52
|
+
props: {
|
|
53
|
+
},
|
|
54
|
+
data() {
|
|
55
|
+
return {
|
|
56
|
+
logo,
|
|
57
|
+
popVisible: false,
|
|
58
|
+
grantedApplications: [],
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
mounted() {
|
|
62
|
+
let { grantedApplications } = this.$TOOL.data.get('userAuthInfo');
|
|
63
|
+
this.grantedApplications = grantedApplications
|
|
64
|
+
document.addEventListener('click', this.handleDocumentClick);
|
|
65
|
+
},
|
|
66
|
+
beforeDestroy() {
|
|
67
|
+
document.removeEventListener('click', this.handleDocumentClick);
|
|
68
|
+
},
|
|
69
|
+
methods: {
|
|
70
|
+
handleDocumentClick(ev) {
|
|
71
|
+
let popover = document.getElementById('popover');
|
|
72
|
+
if (this.popVisible && (ev.target !== popover) && !popover.contains(ev.target)) {
|
|
73
|
+
this.popVisible = false;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
switchMenu(menuItem) {
|
|
77
|
+
window.location.href = menuItem.url;
|
|
78
|
+
},
|
|
79
|
+
closePopover() {
|
|
80
|
+
this.$refs.popoverRef.hide(); // 关闭 popover
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
</script>
|
|
85
|
+
<style lang="scss">
|
|
86
|
+
.layout-aside {
|
|
87
|
+
width: 100%;
|
|
88
|
+
height: 100%;
|
|
89
|
+
border-bottom: 1px solid var(--el-mask-color-extra-light);
|
|
90
|
+
.logo {
|
|
91
|
+
width: 100%;
|
|
92
|
+
height: auto;
|
|
93
|
+
display: block;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.menu-btn {
|
|
97
|
+
font-size: 24px;
|
|
98
|
+
color: #95989d;
|
|
99
|
+
}
|
|
100
|
+
.el-tooltip__trigger {
|
|
101
|
+
text-align: center;
|
|
102
|
+
padding: 10px;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
&:hover {
|
|
105
|
+
background-color: var(--el-menu-hover-bg-color);
|
|
106
|
+
.menu-btn {
|
|
107
|
+
color: var(--el-menu-active-color);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.menu-container {
|
|
113
|
+
display: flex;
|
|
114
|
+
flex: 1;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
align-items: center;
|
|
117
|
+
width: inherit;
|
|
118
|
+
|
|
119
|
+
.logo {
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
width: inherit;
|
|
124
|
+
height: 50px;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
margin: 0;
|
|
127
|
+
padding: 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.fixed-menu-list {
|
|
131
|
+
flex: 1;
|
|
132
|
+
width: inherit;
|
|
133
|
+
height: 100%;
|
|
134
|
+
}
|
|
135
|
+
.app-box {
|
|
136
|
+
width: 50px;
|
|
137
|
+
height: 50px;
|
|
138
|
+
color: #95989d;
|
|
139
|
+
}
|
|
140
|
+
.app-box:hover {
|
|
141
|
+
background: #eeeefc;
|
|
142
|
+
color: #3d3ad9;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.menu-container,
|
|
147
|
+
.footer {
|
|
148
|
+
p {
|
|
149
|
+
width: 50px;
|
|
150
|
+
height: 50px;
|
|
151
|
+
margin: auto;
|
|
152
|
+
line-height: 50px;
|
|
153
|
+
text-align: center;
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.iconfont {
|
|
158
|
+
color: inherit;
|
|
159
|
+
font-size: 18px;
|
|
160
|
+
padding: 15px;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.setting {
|
|
165
|
+
transform: rotate(180deg);
|
|
166
|
+
cursor: pointer;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.pop-menu {
|
|
171
|
+
min-width: 104px;
|
|
172
|
+
height: fit-content;
|
|
173
|
+
padding: 10px 0;
|
|
174
|
+
overflow-y: auto;
|
|
175
|
+
border: 1px solid #eaeaeb;
|
|
176
|
+
border-radius: 2px;
|
|
177
|
+
box-shadow: 0 2px 4px rgba(39, 40, 42, 0.15);
|
|
178
|
+
|
|
179
|
+
// &.side-popover {
|
|
180
|
+
// top: 50px !important;
|
|
181
|
+
// left: 50px !important;
|
|
182
|
+
// max-height: calc(100vh - 80px);
|
|
183
|
+
// }
|
|
184
|
+
|
|
185
|
+
// &.header-popover {
|
|
186
|
+
// top: 35px !important;
|
|
187
|
+
// right: 76px !important;
|
|
188
|
+
// left: auto !important;
|
|
189
|
+
// max-height: calc(100vh - 80px);
|
|
190
|
+
// }
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.menu-item {
|
|
194
|
+
display: flex;
|
|
195
|
+
box-sizing: border-box;
|
|
196
|
+
align-items: center;
|
|
197
|
+
height: 32px;
|
|
198
|
+
padding: 0 8px;
|
|
199
|
+
color: #6a6d73;
|
|
200
|
+
cursor: pointer;
|
|
201
|
+
|
|
202
|
+
&.fixed {
|
|
203
|
+
color: #27282a;
|
|
204
|
+
font-weight: bold;
|
|
205
|
+
|
|
206
|
+
.iconfont {
|
|
207
|
+
color: #3d3ad9;
|
|
208
|
+
font-weight: normal;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.iconfont.iconMinus-Circle {
|
|
212
|
+
color: #ccccf5;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
&:hover {
|
|
217
|
+
background: #eeeefc;
|
|
218
|
+
color: #3d3ad9;
|
|
219
|
+
|
|
220
|
+
&.fixed .iconfont.iconFixed {
|
|
221
|
+
display: none !important;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.iconfont {
|
|
225
|
+
display: block !important;
|
|
226
|
+
|
|
227
|
+
color: #3d3ad9;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.iconfont {
|
|
232
|
+
width: 16px;
|
|
233
|
+
height: 16px;
|
|
234
|
+
color: #95989d;
|
|
235
|
+
line-height: 15px;
|
|
236
|
+
|
|
237
|
+
&.iconFixed {
|
|
238
|
+
display: none;
|
|
239
|
+
color: #9a98eb;
|
|
240
|
+
font-size: 14px;
|
|
241
|
+
cursor: pointer;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
&.iconDrag1 {
|
|
245
|
+
display: none;
|
|
246
|
+
margin-left: 8px;
|
|
247
|
+
color: #9a98eb;
|
|
248
|
+
font-size: 14px;
|
|
249
|
+
cursor: grab;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.name {
|
|
254
|
+
flex: 1;
|
|
255
|
+
margin-left: 8px;
|
|
256
|
+
overflow: hidden;
|
|
257
|
+
color: inherit;
|
|
258
|
+
font-size: 12px;
|
|
259
|
+
line-height: 32px;
|
|
260
|
+
text-align: left;
|
|
261
|
+
text-overflow: ellipsis;
|
|
262
|
+
white-space: nowrap;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.app-popper {
|
|
267
|
+
padding: 10px 0 !important;
|
|
268
|
+
top: 50px !important;
|
|
269
|
+
.app-title {
|
|
270
|
+
font-size: 12px;
|
|
271
|
+
font-weight: bold;
|
|
272
|
+
line-height: 19px;
|
|
273
|
+
height: 19px;
|
|
274
|
+
padding: 0 10px 2px;
|
|
275
|
+
.iconClose {
|
|
276
|
+
position: absolute;
|
|
277
|
+
top: 10px;
|
|
278
|
+
right: 8px;
|
|
279
|
+
color: #d5d6d8;
|
|
280
|
+
font-weight: normal;
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
font-size: 16px;
|
|
283
|
+
&:hover {
|
|
284
|
+
color: #3d3ad9;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.icon-mmc-s {
|
|
291
|
+
margin-right: 10px !important;
|
|
292
|
+
margin-left: -4px;
|
|
293
|
+
}
|
|
294
|
+
</style>
|
|
295
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="screen panel-item hidden-sm-and-down"
|
|
3
|
+
@click="screen">
|
|
4
|
+
|
|
5
|
+
<el-dropdown @command="changeBusinessUnit">
|
|
6
|
+
<div class="bu-list">
|
|
7
|
+
<el-icon><el-icon-help /></el-icon>{{buName}}
|
|
8
|
+
</div>
|
|
9
|
+
<template #dropdown>
|
|
10
|
+
<el-dropdown-menu>
|
|
11
|
+
<el-dropdown-item v-for="item in buList"
|
|
12
|
+
:key="item.id"
|
|
13
|
+
:command="item.code">{{item.name}}</el-dropdown-item>
|
|
14
|
+
</el-dropdown-menu>
|
|
15
|
+
</template>
|
|
16
|
+
</el-dropdown>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
export default {
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
buName: '',
|
|
25
|
+
buList: [],
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
async changeBusinessUnit(command) {
|
|
30
|
+
this.buName = command
|
|
31
|
+
let item = this.buList.find(item => item.code === command)
|
|
32
|
+
this.$TOOL.data.set('buCode', command)
|
|
33
|
+
this.$TOOL.data.set('tenantId', item.tenantId)
|
|
34
|
+
// 检验是否初始化
|
|
35
|
+
let initialized = await this.$API.auth.initialized.get()
|
|
36
|
+
this.$TOOL.data.set('zoneInitialized', initialized)
|
|
37
|
+
if (!initialized) {
|
|
38
|
+
this.$router.push('/initialization');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
created() {
|
|
43
|
+
this.buList = this.$TOOL.data.get('buList')
|
|
44
|
+
|
|
45
|
+
let buCode = this.$TOOL.data.get('buCode')
|
|
46
|
+
let item = this.buList.find(item => item.code === buCode)
|
|
47
|
+
this.buName = item ? item.name : ''
|
|
48
|
+
this.changeBusinessUnit(buCode)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
<style lang="scss" scoped>
|
|
53
|
+
:deep(.el-dropdown){
|
|
54
|
+
height: 100%;
|
|
55
|
+
}
|
|
56
|
+
.bu-list{
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: 5px;
|
|
60
|
+
height: 100%;
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="$route.meta.type=='iframe'" class="iframe-pages">
|
|
3
|
+
<iframe v-for="item in iframeList" :key="item.meta.url" v-show="$route.meta.url==item.meta.url" :src="item.meta.url" frameborder='0'></iframe>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
data() {
|
|
10
|
+
return {
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
watch: {
|
|
15
|
+
$route(e) {
|
|
16
|
+
this.push(e)
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
created() {
|
|
20
|
+
this.push(this.$route);
|
|
21
|
+
},
|
|
22
|
+
computed:{
|
|
23
|
+
iframeList(){
|
|
24
|
+
return this.$store.state.iframe.iframeList
|
|
25
|
+
},
|
|
26
|
+
ismobile(){
|
|
27
|
+
return this.$store.state.global.ismobile
|
|
28
|
+
},
|
|
29
|
+
layoutTags(){
|
|
30
|
+
return this.$store.state.global.layoutTags
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
mounted() {
|
|
34
|
+
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
push(route){
|
|
38
|
+
if(route.meta.type == 'iframe'){
|
|
39
|
+
if(this.ismobile || !this.layoutTags){
|
|
40
|
+
this.$store.commit("setIframeList", route)
|
|
41
|
+
}else{
|
|
42
|
+
this.$store.commit("pushIframeList", route)
|
|
43
|
+
}
|
|
44
|
+
}else{
|
|
45
|
+
if(this.ismobile || !this.layoutTags){
|
|
46
|
+
this.$store.commit("clearIframeList")
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<style scoped>
|
|
55
|
+
.iframe-pages {width:100%;height:100%;background: #fff;}
|
|
56
|
+
iframe {border:0;width:100%;height:100%;display: block;}
|
|
57
|
+
</style>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dropdown trigger="click"
|
|
3
|
+
placement="bottom-end"
|
|
4
|
+
@command="configLang">
|
|
5
|
+
<el-button circle>
|
|
6
|
+
<svg xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
8
|
+
role="img"
|
|
9
|
+
width="1em"
|
|
10
|
+
height="1em"
|
|
11
|
+
preserveAspectRatio="xMidYMid meet"
|
|
12
|
+
viewBox="0 0 512 512">
|
|
13
|
+
<path d="M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z"
|
|
14
|
+
fill="currentColor"></path>
|
|
15
|
+
<path d="M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z"
|
|
16
|
+
fill="currentColor"></path>
|
|
17
|
+
</svg>
|
|
18
|
+
</el-button>
|
|
19
|
+
<template #dropdown>
|
|
20
|
+
<el-dropdown-menu>
|
|
21
|
+
<el-dropdown-item v-for="item in lang"
|
|
22
|
+
:key="item.value"
|
|
23
|
+
:command="item"
|
|
24
|
+
:class="{'selected':config.lang==item.value}">{{item.name}}</el-dropdown-item>
|
|
25
|
+
</el-dropdown-menu>
|
|
26
|
+
</template>
|
|
27
|
+
</el-dropdown>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
export default {
|
|
32
|
+
data () {
|
|
33
|
+
return {
|
|
34
|
+
config: {
|
|
35
|
+
lang: this.$TOOL.data.get("APP_LANG") || this.$CONFIG.LANG,
|
|
36
|
+
},
|
|
37
|
+
lang: [
|
|
38
|
+
{
|
|
39
|
+
name: "简体中文",
|
|
40
|
+
value: "zh-cn",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "English",
|
|
44
|
+
value: "en",
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
watch: {
|
|
50
|
+
"config.lang"(val) {
|
|
51
|
+
this.$i18n.locale = val;
|
|
52
|
+
this.$i18n.fallbackLocale = val;
|
|
53
|
+
this.$TOOL.data.set("APP_LANG", val);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
methods: {
|
|
57
|
+
configLang(command) {
|
|
58
|
+
this.config.lang = command.value;
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style>
|
|
65
|
+
</style>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sc-search">
|
|
3
|
+
<el-input ref="input" v-model="input" placeholder="搜索" size="large" clearable prefix-icon="el-icon-search" :trigger-on-focus="false" @input="inputChange"/>
|
|
4
|
+
<div class="sc-search-history" v-if="history.length>0">
|
|
5
|
+
<el-tag closable effect="dark" type="info" v-for="(item, index) in history" :key="item" @click="historyClick(item)" @close="historyClose(index)">{{item}}</el-tag>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="sc-search-result">
|
|
8
|
+
<div class="sc-search-no-result" v-if="result.length<=0">暂无搜索结果</div>
|
|
9
|
+
<ul v-else>
|
|
10
|
+
<el-scrollbar max-height="366px">
|
|
11
|
+
<li v-for="item in result" :key="item.path" @click="to(item)">
|
|
12
|
+
<el-icon><component :is="item.icon || 'el-icon-menu'" /></el-icon>
|
|
13
|
+
<span class="title">{{ item.breadcrumb }}</span>
|
|
14
|
+
</li>
|
|
15
|
+
</el-scrollbar>
|
|
16
|
+
</ul>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
export default {
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
input: "",
|
|
26
|
+
menu: [],
|
|
27
|
+
result: [],
|
|
28
|
+
history: []
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
mounted() {
|
|
32
|
+
var searchHistory = this.$TOOL.data.get("SEARCH_HISTORY") || []
|
|
33
|
+
this.history = searchHistory
|
|
34
|
+
var menuTree = this.$TOOL.data.get("MENU")
|
|
35
|
+
this.filterMenu(menuTree)
|
|
36
|
+
this.$refs.input.focus()
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
inputChange(value){
|
|
40
|
+
if(value){
|
|
41
|
+
this.result = this.menuFilter(value)
|
|
42
|
+
}else{
|
|
43
|
+
this.result = []
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
filterMenu(map){
|
|
47
|
+
map.forEach(item => {
|
|
48
|
+
if(item.meta.hidden || item.meta.type=="button"){
|
|
49
|
+
return false
|
|
50
|
+
}
|
|
51
|
+
if(item.meta.type=='iframe'){
|
|
52
|
+
item.path = `/i/${item.name}`
|
|
53
|
+
}
|
|
54
|
+
if(item.children&&item.children.length > 0&&!item.component){
|
|
55
|
+
this.filterMenu(item.children)
|
|
56
|
+
}else{
|
|
57
|
+
this.menu.push(item)
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
menuFilter(queryString){
|
|
62
|
+
var res = []
|
|
63
|
+
//过滤菜单树
|
|
64
|
+
var filterMenu = this.menu.filter((item) => {
|
|
65
|
+
if((item.meta.title).toLowerCase().indexOf(queryString.toLowerCase()) >= 0){
|
|
66
|
+
return true
|
|
67
|
+
}
|
|
68
|
+
if((item.name).toLowerCase().indexOf(queryString.toLowerCase()) >= 0){
|
|
69
|
+
return true
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
//匹配系统路由
|
|
73
|
+
var router = this.$router.getRoutes()
|
|
74
|
+
var filterRouter= filterMenu.map((m) => {
|
|
75
|
+
if(m.meta.type == "link"){
|
|
76
|
+
return router.find(r => r.path == '/'+m.path)
|
|
77
|
+
}else{
|
|
78
|
+
return router.find(r => r.path == m.path)
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
//重组对象
|
|
82
|
+
filterRouter.forEach(item => {
|
|
83
|
+
res.push({
|
|
84
|
+
name: item.name,
|
|
85
|
+
type: item.meta.type,
|
|
86
|
+
path: item.meta.type=="link"?item.path.slice(1):item.path,
|
|
87
|
+
icon: item.meta.icon,
|
|
88
|
+
title: item.meta.title,
|
|
89
|
+
breadcrumb: item.meta.breadcrumb.map(v => v.meta.title).join(' - ')
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
return res
|
|
93
|
+
},
|
|
94
|
+
to(item){
|
|
95
|
+
if(!this.history.includes(this.input)){
|
|
96
|
+
this.history.push(this.input)
|
|
97
|
+
this.$TOOL.data.set("SEARCH_HISTORY", this.history)
|
|
98
|
+
}
|
|
99
|
+
if(item.type=="link"){
|
|
100
|
+
setTimeout(()=>{
|
|
101
|
+
let a = document.createElement("a")
|
|
102
|
+
a.style = "display: none"
|
|
103
|
+
a.target = "_blank"
|
|
104
|
+
a.href = item.path
|
|
105
|
+
document.body.appendChild(a)
|
|
106
|
+
a.click()
|
|
107
|
+
document.body.removeChild(a)
|
|
108
|
+
}, 10);
|
|
109
|
+
}else{
|
|
110
|
+
this.$router.push({path: item.path})
|
|
111
|
+
}
|
|
112
|
+
this.$emit('success', true)
|
|
113
|
+
},
|
|
114
|
+
historyClick(text){
|
|
115
|
+
this.input = text
|
|
116
|
+
this.inputChange(text)
|
|
117
|
+
},
|
|
118
|
+
historyClose(index){
|
|
119
|
+
this.history.splice(index, 1);
|
|
120
|
+
if(this.history.length <= 0){
|
|
121
|
+
this.$TOOL.data.remove("SEARCH_HISTORY")
|
|
122
|
+
}else{
|
|
123
|
+
this.$TOOL.data.set("SEARCH_HISTORY", this.history)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
<style scoped>
|
|
131
|
+
.sc-search {}
|
|
132
|
+
.sc-search-no-result {text-align: center;margin: 40px 0;color: #999;}
|
|
133
|
+
.sc-search-history {margin-top: 10px;}
|
|
134
|
+
.sc-search-history .el-tag {cursor: pointer;}
|
|
135
|
+
.sc-search-result {margin-top: 15px;}
|
|
136
|
+
.sc-search-result li {height:56px;padding:0 15px;background: var(--el-bg-color-overlay);border: 1px solid var(--el-border-color-light);list-style:none;border-radius: 4px;margin-bottom: 5px;font-size: 14px;display: flex;align-items: center;cursor: pointer;}
|
|
137
|
+
.sc-search-result li i {font-size: 20px;margin-right: 15px;}
|
|
138
|
+
.sc-search-result li:hover {background: var(--el-color-primary);color: #fff;border-color: var(--el-color-primary);}
|
|
139
|
+
</style>
|