vue2-client 1.4.56 → 1.4.58
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +2 -1
- package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +151 -149
- package/src/base-client/components/common/XFormTable/XFormTable.vue +10 -0
- package/src/base-client/components/common/XTreeOne/XTreeOne.vue +109 -105
- package/src/components/exception/ExceptionPage.vue +70 -70
- package/src/layouts/ComponentLayoutOne.vue +47 -46
- package/src/pages/exception/404.vue +25 -21
- package/src/router/async/router.map.js +68 -67
- package/src/router/guards.js +104 -104
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -523,6 +523,7 @@ export default {
|
|
|
523
523
|
pathKey: undefined,
|
|
524
524
|
accept: undefined,
|
|
525
525
|
selectType: undefined,
|
|
526
|
+
groupIndex: undefined,
|
|
526
527
|
groupIndexView: undefined,
|
|
527
528
|
addOrEdit: 'all',
|
|
528
529
|
selectKeyName: undefined,
|
|
@@ -555,7 +556,7 @@ export default {
|
|
|
555
556
|
this.lowerPath = this.stockList.filter(item => item.id === _item.resUploadStock)[0]?.f_lower_path_json ?? []
|
|
556
557
|
}
|
|
557
558
|
}
|
|
558
|
-
if (_item.selectKey && _item.selectType === 'logic' && _item.selectKey.substring(0, 6) === 'logic@') {
|
|
559
|
+
if (_item.selectKey && _item.selectKey.length >= 6 && _item.selectType === 'logic' && _item.selectKey.substring(0, 6) === 'logic@') {
|
|
559
560
|
_item.selectKey = _item.selectKey.substring(6)
|
|
560
561
|
}
|
|
561
562
|
if (_item.formType === 'selects') {
|
|
@@ -1,149 +1,151 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<a-drawer
|
|
3
|
-
title="选择参数组"
|
|
4
|
-
placement="right"
|
|
5
|
-
:width="isMobile ? screenWidth : screenWidth * 0.85"
|
|
6
|
-
:visible="visible"
|
|
7
|
-
@close="onClose"
|
|
8
|
-
>
|
|
9
|
-
<x-add-form
|
|
10
|
-
business-title="参数设置"
|
|
11
|
-
business-type="编辑"
|
|
12
|
-
:visible.sync="editQueryVisible"
|
|
13
|
-
:json-data="formObj.formJson"
|
|
14
|
-
:modify-model-data="
|
|
15
|
-
:loading="loading"
|
|
16
|
-
@onSubmit="submit"/>
|
|
17
|
-
<a-list
|
|
18
|
-
:grid="{gutter: 24, lg: 4, md: 3, sm: 1, xs: 1}"
|
|
19
|
-
:dataSource="columnJson.groups"
|
|
20
|
-
>
|
|
21
|
-
<a-list-item slot="renderItem" slot-scope="item">
|
|
22
|
-
<a-card :hoverable="true" @click="toEdit(item)">
|
|
23
|
-
<a-card-meta >
|
|
24
|
-
<div style="margin-bottom: 3px" slot="title">{{ item.group }}</div>
|
|
25
|
-
<a-icon type="tags" slot="avatar" :style="{ fontSize:'2em' }"/>
|
|
26
|
-
<div class="meta-content" slot="description">{{ item.describe }}</div>
|
|
27
|
-
</a-card-meta>
|
|
28
|
-
</a-card>
|
|
29
|
-
</a-list-item>
|
|
30
|
-
</a-list>
|
|
31
|
-
</a-drawer>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<script>
|
|
35
|
-
import { mapState } from 'vuex'
|
|
36
|
-
import XAddForm from '@vue2-client/base-client/components/common/XAddForm/XAddForm'
|
|
37
|
-
import { commonApi, post } from '@vue2-client/services/api'
|
|
38
|
-
|
|
39
|
-
export default {
|
|
40
|
-
name: 'FormGroupEdit',
|
|
41
|
-
components: {
|
|
42
|
-
XAddForm
|
|
43
|
-
},
|
|
44
|
-
data () {
|
|
45
|
-
return {
|
|
46
|
-
// 页面宽度
|
|
47
|
-
screenWidth: document.documentElement.clientWidth,
|
|
48
|
-
// 是否显示参数下发抽屉
|
|
49
|
-
editQueryVisible: false,
|
|
50
|
-
targetIndex: 0,
|
|
51
|
-
columnJson: {},
|
|
52
|
-
editIndex: -1,
|
|
53
|
-
formObj: {
|
|
54
|
-
groupName: '',
|
|
55
|
-
formJson: []
|
|
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
|
-
this.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
this.$message.
|
|
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
|
-
-webkit-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<a-drawer
|
|
3
|
+
title="选择参数组"
|
|
4
|
+
placement="right"
|
|
5
|
+
:width="isMobile ? screenWidth : screenWidth * 0.85"
|
|
6
|
+
:visible="visible"
|
|
7
|
+
@close="onClose"
|
|
8
|
+
>
|
|
9
|
+
<x-add-form
|
|
10
|
+
business-title="参数设置"
|
|
11
|
+
business-type="编辑"
|
|
12
|
+
:visible.sync="editQueryVisible"
|
|
13
|
+
:json-data="formObj.formJson"
|
|
14
|
+
:modify-model-data="modifyModelDataItem"
|
|
15
|
+
:loading="loading"
|
|
16
|
+
@onSubmit="submit"/>
|
|
17
|
+
<a-list
|
|
18
|
+
:grid="{gutter: 24, lg: 4, md: 3, sm: 1, xs: 1}"
|
|
19
|
+
:dataSource="columnJson.groups"
|
|
20
|
+
>
|
|
21
|
+
<a-list-item slot="renderItem" slot-scope="item">
|
|
22
|
+
<a-card :hoverable="true" @click="toEdit(item)">
|
|
23
|
+
<a-card-meta >
|
|
24
|
+
<div style="margin-bottom: 3px" slot="title">{{ item.group }}</div>
|
|
25
|
+
<a-icon type="tags" slot="avatar" :style="{ fontSize:'2em' }"/>
|
|
26
|
+
<div class="meta-content" slot="description">{{ item.describe }}</div>
|
|
27
|
+
</a-card-meta>
|
|
28
|
+
</a-card>
|
|
29
|
+
</a-list-item>
|
|
30
|
+
</a-list>
|
|
31
|
+
</a-drawer>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import { mapState } from 'vuex'
|
|
36
|
+
import XAddForm from '@vue2-client/base-client/components/common/XAddForm/XAddForm'
|
|
37
|
+
import { commonApi, post } from '@vue2-client/services/api'
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
name: 'FormGroupEdit',
|
|
41
|
+
components: {
|
|
42
|
+
XAddForm
|
|
43
|
+
},
|
|
44
|
+
data () {
|
|
45
|
+
return {
|
|
46
|
+
// 页面宽度
|
|
47
|
+
screenWidth: document.documentElement.clientWidth,
|
|
48
|
+
// 是否显示参数下发抽屉
|
|
49
|
+
editQueryVisible: false,
|
|
50
|
+
targetIndex: 0,
|
|
51
|
+
columnJson: {},
|
|
52
|
+
editIndex: -1,
|
|
53
|
+
formObj: {
|
|
54
|
+
groupName: '',
|
|
55
|
+
formJson: []
|
|
56
|
+
},
|
|
57
|
+
modifyModelDataItem: {},
|
|
58
|
+
// 参数设置业务执行状态
|
|
59
|
+
loading: false
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
mounted () {
|
|
63
|
+
this.initView()
|
|
64
|
+
},
|
|
65
|
+
computed: {
|
|
66
|
+
...mapState('setting', ['isMobile'])
|
|
67
|
+
},
|
|
68
|
+
props: {
|
|
69
|
+
visible: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false
|
|
72
|
+
},
|
|
73
|
+
modifyModelData: {
|
|
74
|
+
type: Object,
|
|
75
|
+
default: () => {
|
|
76
|
+
return {}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
watch: {
|
|
81
|
+
visible (rel) {
|
|
82
|
+
if (rel) {
|
|
83
|
+
this.initView()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
methods: {
|
|
88
|
+
// 初始化组件
|
|
89
|
+
initView () {
|
|
90
|
+
this.$emit('getColumnJson', val => {
|
|
91
|
+
this.columnJson = val
|
|
92
|
+
})
|
|
93
|
+
},
|
|
94
|
+
toEdit (item) {
|
|
95
|
+
post(commonApi.getColumnsJson, { queryObject: item }).then(res => {
|
|
96
|
+
this.formObj = res
|
|
97
|
+
this.modifyModelDataItem = { data: this.modifyModelData[this.formObj.groupName] }
|
|
98
|
+
this.editQueryVisible = true
|
|
99
|
+
})
|
|
100
|
+
},
|
|
101
|
+
onClose () {
|
|
102
|
+
this.$emit('update:visible', false)
|
|
103
|
+
},
|
|
104
|
+
submit (res) {
|
|
105
|
+
if (res.valid) {
|
|
106
|
+
this.loading = true
|
|
107
|
+
const requestParameters = {
|
|
108
|
+
paramsJson: {}
|
|
109
|
+
}
|
|
110
|
+
requestParameters.paramsJson[this.formObj.groupName] = {}
|
|
111
|
+
for (const key of Object.keys(res.form)) {
|
|
112
|
+
const realKey = key.substring(key.indexOf('_') + 1)
|
|
113
|
+
requestParameters.paramsJson[this.formObj.groupName][realKey] = res.form[key]
|
|
114
|
+
}
|
|
115
|
+
this.$emit('onSubmit', requestParameters, result => {
|
|
116
|
+
if (result) {
|
|
117
|
+
this.$message.success('参数设置成功!')
|
|
118
|
+
} else {
|
|
119
|
+
this.$message.error('参数设置失败!')
|
|
120
|
+
}
|
|
121
|
+
this.loading = false
|
|
122
|
+
this.editQueryVisible = false
|
|
123
|
+
})
|
|
124
|
+
} else {
|
|
125
|
+
return false
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
</script>
|
|
131
|
+
<style lang="less" scoped>
|
|
132
|
+
.card-avatar {
|
|
133
|
+
width: 48px;
|
|
134
|
+
height: 48px;
|
|
135
|
+
border-radius: 48px;
|
|
136
|
+
}
|
|
137
|
+
.new-btn{
|
|
138
|
+
border-radius: 2px;
|
|
139
|
+
width: 100%;
|
|
140
|
+
height: 187px;
|
|
141
|
+
}
|
|
142
|
+
.meta-content{
|
|
143
|
+
position: relative;
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
text-overflow: ellipsis;
|
|
146
|
+
display: -webkit-box;
|
|
147
|
+
height: 64px;
|
|
148
|
+
-webkit-line-clamp: 3;
|
|
149
|
+
-webkit-box-orient: vertical;
|
|
150
|
+
}
|
|
151
|
+
</style>
|
|
@@ -220,6 +220,11 @@ export default {
|
|
|
220
220
|
},
|
|
221
221
|
fixedQueryForm: {
|
|
222
222
|
handler () {
|
|
223
|
+
if (this.queryParamsName) {
|
|
224
|
+
this.getColumnsJson()
|
|
225
|
+
} else if (this.queryParamsJson) {
|
|
226
|
+
this.getColumnsJsonBySource()
|
|
227
|
+
}
|
|
223
228
|
this.form = {}
|
|
224
229
|
},
|
|
225
230
|
deep: true
|
|
@@ -229,6 +234,11 @@ export default {
|
|
|
229
234
|
this.getColumnsJsonBySource()
|
|
230
235
|
},
|
|
231
236
|
deep: true
|
|
237
|
+
},
|
|
238
|
+
queryParamsName: {
|
|
239
|
+
handler () {
|
|
240
|
+
this.getColumnsJson()
|
|
241
|
+
}
|
|
232
242
|
}
|
|
233
243
|
},
|
|
234
244
|
created () {
|
|
@@ -1,105 +1,109 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="XTreeOne">
|
|
3
|
-
<component-layout-one :siderProps="{width: leftWidth,collapsible: collapsible,collapsedWidth: collapsedWidth,theme: 'light'}">
|
|
4
|
-
<template slot="left">
|
|
5
|
-
<div class="bg-white pd-20" :style="{height: treeHeight}">
|
|
6
|
-
<a-input-search style="margin-bottom: 8px" placeholder="Search" allow-clear @change="onChange" />
|
|
7
|
-
<a-tree
|
|
8
|
-
:tree-data="searchData"
|
|
9
|
-
@select="onSelect">
|
|
10
|
-
<template #title="{ title }">
|
|
11
|
-
<span v-if="title.indexOf(searchValue) > -1">
|
|
12
|
-
{{ title.substr(0, title.indexOf(searchValue)) }}
|
|
13
|
-
<span style="color: #f50">{{ searchValue }}</span>
|
|
14
|
-
{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
|
|
15
|
-
</span>
|
|
16
|
-
<span v-else>{{ title }}</span>
|
|
17
|
-
</template>
|
|
18
|
-
</a-tree>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
<slot></slot>
|
|
22
|
-
</component-layout-one>
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script>
|
|
27
|
-
import ComponentLayoutOne from '@vue2-client/layouts/ComponentLayoutOne'
|
|
28
|
-
export default {
|
|
29
|
-
name: 'XTreeOne',
|
|
30
|
-
components: { ComponentLayoutOne },
|
|
31
|
-
props: {
|
|
32
|
-
// 左侧宽度
|
|
33
|
-
leftWidth: {
|
|
34
|
-
type: [Number, String],
|
|
35
|
-
default: () => {
|
|
36
|
-
return 200
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
// 左侧是否可收起
|
|
40
|
-
collapsible: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
default: true
|
|
43
|
-
},
|
|
44
|
-
// 左侧收起后宽度
|
|
45
|
-
collapsedWidth: {
|
|
46
|
-
type: Number,
|
|
47
|
-
default: 0
|
|
48
|
-
},
|
|
49
|
-
// Tree 树形控件数据
|
|
50
|
-
// array<{key, title, children, [disabled, selectable]}>
|
|
51
|
-
treeData: {
|
|
52
|
-
type: Array,
|
|
53
|
-
required: true
|
|
54
|
-
},
|
|
55
|
-
treeHeight: {
|
|
56
|
-
type: String,
|
|
57
|
-
default: '85vh'
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
data () {
|
|
61
|
-
return {
|
|
62
|
-
// 用于展示筛选出的数据
|
|
63
|
-
searchData: [],
|
|
64
|
-
// 查询值
|
|
65
|
-
searchValue: ''
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
created () {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
this.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div id="XTreeOne">
|
|
3
|
+
<component-layout-one :siderProps="{width: leftWidth,collapsible: collapsible,collapsedWidth: collapsedWidth,theme: 'light'}">
|
|
4
|
+
<template slot="left">
|
|
5
|
+
<div class="bg-white pd-20" :style="{height: treeHeight}">
|
|
6
|
+
<a-input-search style="margin-bottom: 8px" placeholder="Search" allow-clear @change="onChange" />
|
|
7
|
+
<a-tree
|
|
8
|
+
:tree-data="searchData"
|
|
9
|
+
@select="onSelect">
|
|
10
|
+
<template #title="{ title }">
|
|
11
|
+
<span v-if="title.indexOf(searchValue) > -1">
|
|
12
|
+
{{ title.substr(0, title.indexOf(searchValue)) }}
|
|
13
|
+
<span style="color: #f50">{{ searchValue }}</span>
|
|
14
|
+
{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
|
|
15
|
+
</span>
|
|
16
|
+
<span v-else>{{ title }}</span>
|
|
17
|
+
</template>
|
|
18
|
+
</a-tree>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
<slot></slot>
|
|
22
|
+
</component-layout-one>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import ComponentLayoutOne from '@vue2-client/layouts/ComponentLayoutOne'
|
|
28
|
+
export default {
|
|
29
|
+
name: 'XTreeOne',
|
|
30
|
+
components: { ComponentLayoutOne },
|
|
31
|
+
props: {
|
|
32
|
+
// 左侧宽度
|
|
33
|
+
leftWidth: {
|
|
34
|
+
type: [Number, String],
|
|
35
|
+
default: () => {
|
|
36
|
+
return 200
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
// 左侧是否可收起
|
|
40
|
+
collapsible: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: true
|
|
43
|
+
},
|
|
44
|
+
// 左侧收起后宽度
|
|
45
|
+
collapsedWidth: {
|
|
46
|
+
type: Number,
|
|
47
|
+
default: 0
|
|
48
|
+
},
|
|
49
|
+
// Tree 树形控件数据
|
|
50
|
+
// array<{key, title, children, [disabled, selectable]}>
|
|
51
|
+
treeData: {
|
|
52
|
+
type: Array,
|
|
53
|
+
required: true
|
|
54
|
+
},
|
|
55
|
+
treeHeight: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: '85vh'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
data () {
|
|
61
|
+
return {
|
|
62
|
+
// 用于展示筛选出的数据
|
|
63
|
+
searchData: [],
|
|
64
|
+
// 查询值
|
|
65
|
+
searchValue: ''
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
created () {
|
|
69
|
+
this.init()
|
|
70
|
+
},
|
|
71
|
+
mounted () {
|
|
72
|
+
},
|
|
73
|
+
watch: {
|
|
74
|
+
'treeData' () {
|
|
75
|
+
this.init()
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
methods: {
|
|
79
|
+
init () {
|
|
80
|
+
// 添加title插槽
|
|
81
|
+
for (const index of this.treeData.keys()) {
|
|
82
|
+
this.treeData[index].scopedSlots = { title: 'title' }
|
|
83
|
+
}
|
|
84
|
+
this.searchData = Object.assign([], this.treeData)
|
|
85
|
+
},
|
|
86
|
+
onChange (e) {
|
|
87
|
+
const name = e.target.value
|
|
88
|
+
this.searchValue = name
|
|
89
|
+
this.searchData = []
|
|
90
|
+
for (const row of this.treeData) {
|
|
91
|
+
if (row.title.indexOf(name) > -1) {
|
|
92
|
+
this.searchData.push(row)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
onSelect (selectedKeys, e) {
|
|
97
|
+
this.$emit('onSelect', selectedKeys, e)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<style lang="less">
|
|
104
|
+
#XTreeOne {
|
|
105
|
+
.pd-20 {
|
|
106
|
+
padding: 20px;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
</style>
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="exception-page">
|
|
3
|
-
<div class="img">
|
|
4
|
-
<img :src="config[type].img" alt=""/>
|
|
5
|
-
</div>
|
|
6
|
-
<div class="content">
|
|
7
|
-
<h1>{{ config[type].title }}</h1>
|
|
8
|
-
<div class="desc">{{ config[type].desc }}</div>
|
|
9
|
-
<div class="action">
|
|
10
|
-
<a-button type="primary" @click="backHome"
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
import Config from './typeConfig'
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
name: 'ExceptionPage',
|
|
21
|
-
// eslint-disable-next-line vue/require-prop-types
|
|
22
|
-
props: ['type', 'homeRoute'],
|
|
23
|
-
data () {
|
|
24
|
-
return {
|
|
25
|
-
config: Config
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
methods: {
|
|
29
|
-
backHome () {
|
|
30
|
-
if (this.homeRoute) {
|
|
31
|
-
this.$router.push(
|
|
32
|
-
}
|
|
33
|
-
this.$emit('backHome', this.type)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<style lang="less" scoped>
|
|
40
|
-
.exception-page{
|
|
41
|
-
border-radius: 4px;
|
|
42
|
-
display: flex;
|
|
43
|
-
justify-content: center;
|
|
44
|
-
align-items: center;
|
|
45
|
-
background-color: @base-bg-color;
|
|
46
|
-
.img{
|
|
47
|
-
padding-right: 52px;
|
|
48
|
-
zoom: 1;
|
|
49
|
-
img{
|
|
50
|
-
max-width: 430px;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
.content{
|
|
54
|
-
h1{
|
|
55
|
-
color: #434e59;
|
|
56
|
-
font-size: 72px;
|
|
57
|
-
font-weight: 600;
|
|
58
|
-
line-height: 72px;
|
|
59
|
-
margin-bottom: 24px;
|
|
60
|
-
}
|
|
61
|
-
.desc{
|
|
62
|
-
color: @text-color-second;
|
|
63
|
-
font-size: 20px;
|
|
64
|
-
line-height: 28px;
|
|
65
|
-
margin-bottom: 16px;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="exception-page">
|
|
3
|
+
<div class="img">
|
|
4
|
+
<img :src="config[type].img" alt=""/>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="content">
|
|
7
|
+
<h1>{{ config[type].title }}</h1>
|
|
8
|
+
<div class="desc">{{ config[type].desc }}</div>
|
|
9
|
+
<div class="action">
|
|
10
|
+
<a-button type="primary" @click="backHome">返回首页</a-button>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import Config from './typeConfig'
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
name: 'ExceptionPage',
|
|
21
|
+
// eslint-disable-next-line vue/require-prop-types
|
|
22
|
+
props: ['type', 'homeRoute'],
|
|
23
|
+
data () {
|
|
24
|
+
return {
|
|
25
|
+
config: Config
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
backHome () {
|
|
30
|
+
if (this.homeRoute) {
|
|
31
|
+
this.$router.push(this.homeRoute)
|
|
32
|
+
}
|
|
33
|
+
this.$emit('backHome', this.type)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style lang="less" scoped>
|
|
40
|
+
.exception-page{
|
|
41
|
+
border-radius: 4px;
|
|
42
|
+
display: flex;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
align-items: center;
|
|
45
|
+
background-color: @base-bg-color;
|
|
46
|
+
.img{
|
|
47
|
+
padding-right: 52px;
|
|
48
|
+
zoom: 1;
|
|
49
|
+
img{
|
|
50
|
+
max-width: 430px;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
.content{
|
|
54
|
+
h1{
|
|
55
|
+
color: #434e59;
|
|
56
|
+
font-size: 72px;
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
line-height: 72px;
|
|
59
|
+
margin-bottom: 24px;
|
|
60
|
+
}
|
|
61
|
+
.desc{
|
|
62
|
+
color: @text-color-second;
|
|
63
|
+
font-size: 20px;
|
|
64
|
+
line-height: 28px;
|
|
65
|
+
margin-bottom: 16px;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
</style>
|
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="ComponentLayoutOne">
|
|
3
|
-
<a-layout>
|
|
4
|
-
<a-layout-sider v-bind="siderProps">
|
|
5
|
-
<slot name="left"></slot>
|
|
6
|
-
</a-layout-sider>
|
|
7
|
-
<a-layout>
|
|
8
|
-
<slot></slot>
|
|
9
|
-
</a-layout>
|
|
10
|
-
</a-layout>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
export default {
|
|
16
|
-
name: 'ComponentLayoutOne',
|
|
17
|
-
props: {
|
|
18
|
-
// Layout.Sider props对象
|
|
19
|
-
siderProps: {
|
|
20
|
-
type: Object,
|
|
21
|
-
default: () => {
|
|
22
|
-
return {}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
data () {
|
|
27
|
-
return {}
|
|
28
|
-
},
|
|
29
|
-
created () {
|
|
30
|
-
},
|
|
31
|
-
mounted () {
|
|
32
|
-
},
|
|
33
|
-
methods: {}
|
|
34
|
-
}
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<style lang="less">
|
|
38
|
-
#ComponentLayoutOne {
|
|
39
|
-
.ant-layout-sider {
|
|
40
|
-
.ant-layout-sider-zero-width-trigger {
|
|
41
|
-
top: 50%;
|
|
42
|
-
background-color: @shadow-color;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div id="ComponentLayoutOne">
|
|
3
|
+
<a-layout>
|
|
4
|
+
<a-layout-sider v-bind="siderProps">
|
|
5
|
+
<slot name="left"></slot>
|
|
6
|
+
</a-layout-sider>
|
|
7
|
+
<a-layout>
|
|
8
|
+
<slot></slot>
|
|
9
|
+
</a-layout>
|
|
10
|
+
</a-layout>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
name: 'ComponentLayoutOne',
|
|
17
|
+
props: {
|
|
18
|
+
// Layout.Sider props对象
|
|
19
|
+
siderProps: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: () => {
|
|
22
|
+
return {}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
data () {
|
|
27
|
+
return {}
|
|
28
|
+
},
|
|
29
|
+
created () {
|
|
30
|
+
},
|
|
31
|
+
mounted () {
|
|
32
|
+
},
|
|
33
|
+
methods: {}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<style lang="less">
|
|
38
|
+
#ComponentLayoutOne {
|
|
39
|
+
.ant-layout-sider {
|
|
40
|
+
.ant-layout-sider-zero-width-trigger {
|
|
41
|
+
top: 50%;
|
|
42
|
+
background-color: @shadow-color;
|
|
43
|
+
z-index: 9999;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<exception-page :home-route="homePage" :style="`min-height: ${minHeight}`" type="404" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
import ExceptionPage from '@vue2-client/components/exception/ExceptionPage'
|
|
7
|
-
import { mapState } from 'vuex'
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<exception-page :home-route="homePage" :style="`min-height: ${minHeight}`" type="404" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import ExceptionPage from '@vue2-client/components/exception/ExceptionPage'
|
|
7
|
+
import { mapState } from 'vuex'
|
|
8
|
+
const { homePage } = require('@vue2-client/config')
|
|
9
|
+
export default {
|
|
10
|
+
name: 'Exp404',
|
|
11
|
+
components: { ExceptionPage },
|
|
12
|
+
computed: {
|
|
13
|
+
homePage () {
|
|
14
|
+
return homePage
|
|
15
|
+
},
|
|
16
|
+
...mapState('setting', ['pageMinHeight']),
|
|
17
|
+
minHeight () {
|
|
18
|
+
return this.pageMinHeight ? this.pageMinHeight + 'px' : '100vh'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<style scoped lang="less">
|
|
25
|
+
</style>
|
|
@@ -1,67 +1,68 @@
|
|
|
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
|
-
|
|
1
|
+
const { homePage } = require('../../config')
|
|
2
|
+
// 视图组件
|
|
3
|
+
const view = {
|
|
4
|
+
tabs: () => import('@vue2-client/layouts/tabs'),
|
|
5
|
+
blank: () => import('@vue2-client/layouts/BlankView'),
|
|
6
|
+
page: () => import('@vue2-client/layouts/PageView')
|
|
7
|
+
}
|
|
8
|
+
// 动态路由对象定义
|
|
9
|
+
const routerResource = {}
|
|
10
|
+
// --------------------------------------基本视图组件--------------------------------------
|
|
11
|
+
// 空白视图
|
|
12
|
+
routerResource.blank = view.blank
|
|
13
|
+
// 单页面视图
|
|
14
|
+
routerResource.singlePage = view.blank
|
|
15
|
+
|
|
16
|
+
// --------------------------------------仪表盘--------------------------------------
|
|
17
|
+
routerResource.dashboard = view.blank
|
|
18
|
+
// 工作台
|
|
19
|
+
routerResource.workplace = () => import('@vue2-client/pages/dashboard/workplace')
|
|
20
|
+
// --------------------------------------系统配置--------------------------------------
|
|
21
|
+
routerResource.system = view.blank
|
|
22
|
+
// 报表测试用页面
|
|
23
|
+
routerResource.testPage = () => import('@vue2-client/pages/ReportView.vue')
|
|
24
|
+
// 字典管理
|
|
25
|
+
routerResource.dictionaryManage = () => import(/* webpackChunkName: "dictionary" */ '@vue2-client/pages/system/dictionary')
|
|
26
|
+
// 查询配置管理
|
|
27
|
+
routerResource.queryParamsManage = () => import(/* webpackChunkName: "queryParams" */ '@vue2-client/pages/system/queryParams')
|
|
28
|
+
// 文件管理
|
|
29
|
+
routerResource.fileManager = () => import('@vue2-client/pages/system/file')
|
|
30
|
+
// 登录日志
|
|
31
|
+
routerResource.loginInfor = () => import('@vue2-client/pages/system/monitor/loginInfor')
|
|
32
|
+
// 操作日志
|
|
33
|
+
routerResource.operLog = () => import('@vue2-client/pages/system/monitor/operLog')
|
|
34
|
+
// 系统问题反馈工单
|
|
35
|
+
routerResource.submitTicket = () => import(/* webpackChunkName: "submitTicket" */ '@vue2-client/pages/system/ticket')
|
|
36
|
+
|
|
37
|
+
// 基础路由组件注册
|
|
38
|
+
const routerMap = {
|
|
39
|
+
login: {
|
|
40
|
+
authority: '*',
|
|
41
|
+
path: '/login',
|
|
42
|
+
component: () => import('@vue2-client/pages/login')
|
|
43
|
+
},
|
|
44
|
+
root: {
|
|
45
|
+
path: '/',
|
|
46
|
+
name: '首页',
|
|
47
|
+
redirect: homePage,
|
|
48
|
+
component: view.tabs
|
|
49
|
+
},
|
|
50
|
+
exp403: {
|
|
51
|
+
authority: '*',
|
|
52
|
+
name: 'exp403',
|
|
53
|
+
path: '403',
|
|
54
|
+
component: () => import('@vue2-client/pages/exception/403')
|
|
55
|
+
},
|
|
56
|
+
exp404: {
|
|
57
|
+
name: 'exp404',
|
|
58
|
+
path: '404',
|
|
59
|
+
component: () => import('@vue2-client/pages/exception/404')
|
|
60
|
+
},
|
|
61
|
+
exp500: {
|
|
62
|
+
name: 'exp500',
|
|
63
|
+
path: '500',
|
|
64
|
+
component: () => import('@vue2-client/pages/exception/500')
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
Object.assign(routerMap, routerResource)
|
|
68
|
+
export default routerMap
|
package/src/router/guards.js
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import { hasAuthority } from '@vue2-client/utils/authority-utils'
|
|
2
|
-
import { loginIgnore } from '@vue2-client/router/index'
|
|
3
|
-
import { checkAuthorization } from '@vue2-client/utils/request'
|
|
4
|
-
import NProgress from 'nprogress'
|
|
5
|
-
|
|
6
|
-
NProgress.configure({ showSpinner: false })
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 进度条开始
|
|
10
|
-
* @param to
|
|
11
|
-
* @param form
|
|
12
|
-
* @param next
|
|
13
|
-
*/
|
|
14
|
-
const progressStart = (to, from, next) => {
|
|
15
|
-
// start progress bar
|
|
16
|
-
if (!NProgress.isStarted()) {
|
|
17
|
-
NProgress.start()
|
|
18
|
-
}
|
|
19
|
-
next()
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 登录守卫
|
|
24
|
-
* @param to
|
|
25
|
-
* @param form
|
|
26
|
-
* @param next
|
|
27
|
-
* @param options
|
|
28
|
-
*/
|
|
29
|
-
const loginGuard = (to, from, next, options) => {
|
|
30
|
-
const { message } = options
|
|
31
|
-
if (!loginIgnore.includes(to) && !checkAuthorization()) {
|
|
32
|
-
message.warning('登录已失效,请重新登录')
|
|
33
|
-
next({ path: '/login' })
|
|
34
|
-
} else {
|
|
35
|
-
next()
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 权限守卫
|
|
41
|
-
* @param to
|
|
42
|
-
* @param form
|
|
43
|
-
* @param next
|
|
44
|
-
* @param options
|
|
45
|
-
*/
|
|
46
|
-
const authorityGuard = (to, from, next, options) => {
|
|
47
|
-
const { store, message } = options
|
|
48
|
-
const permissions = store.getters['account/permissions']
|
|
49
|
-
const roles = store.getters['account/roles']
|
|
50
|
-
if (!hasAuthority(to, permissions, roles)) {
|
|
51
|
-
message.warning(`对不起,您无权访问页面: ${to.fullPath},请联系管理员`)
|
|
52
|
-
next({ path: '/403' })
|
|
53
|
-
// NProgress.done()
|
|
54
|
-
} else {
|
|
55
|
-
next()
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* 混合导航模式下一级菜单跳转重定向
|
|
61
|
-
* @param to
|
|
62
|
-
* @param from
|
|
63
|
-
* @param next
|
|
64
|
-
* @param options
|
|
65
|
-
* @returns {*}
|
|
66
|
-
*/
|
|
67
|
-
const redirectGuard = (to, from, next, options) => {
|
|
68
|
-
const { store } = options
|
|
69
|
-
const getFirstChild = (routes) => {
|
|
70
|
-
const route = routes[0]
|
|
71
|
-
if (!route.children || route.children.length === 0) {
|
|
72
|
-
return route
|
|
73
|
-
}
|
|
74
|
-
return getFirstChild(route.children)
|
|
75
|
-
}
|
|
76
|
-
if (store.state.setting.layout === 'mix') {
|
|
77
|
-
const firstMenu = store.getters['setting/firstMenu']
|
|
78
|
-
if (firstMenu.find(item => item.fullPath === to.fullPath)) {
|
|
79
|
-
store.commit('setting/setActivatedFirst', to.fullPath)
|
|
80
|
-
const subMenu = store.getters['setting/subMenu']
|
|
81
|
-
if (subMenu.length > 0) {
|
|
82
|
-
const redirect = getFirstChild(subMenu)
|
|
83
|
-
return next({ path: redirect.fullPath })
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
next()
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* 进度条结束
|
|
92
|
-
* @param to
|
|
93
|
-
* @param form
|
|
94
|
-
* @param options
|
|
95
|
-
*/
|
|
96
|
-
const progressDone = () => {
|
|
97
|
-
// finish progress bar
|
|
98
|
-
NProgress.done()
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export default {
|
|
102
|
-
beforeEach: [progressStart, loginGuard, authorityGuard, redirectGuard],
|
|
103
|
-
afterEach: [progressDone]
|
|
104
|
-
}
|
|
1
|
+
import { hasAuthority } from '@vue2-client/utils/authority-utils'
|
|
2
|
+
import { loginIgnore } from '@vue2-client/router/index'
|
|
3
|
+
import { checkAuthorization } from '@vue2-client/utils/request'
|
|
4
|
+
import NProgress from 'nprogress'
|
|
5
|
+
|
|
6
|
+
NProgress.configure({ showSpinner: false })
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 进度条开始
|
|
10
|
+
* @param to
|
|
11
|
+
* @param form
|
|
12
|
+
* @param next
|
|
13
|
+
*/
|
|
14
|
+
const progressStart = (to, from, next) => {
|
|
15
|
+
// start progress bar
|
|
16
|
+
if (!NProgress.isStarted()) {
|
|
17
|
+
NProgress.start()
|
|
18
|
+
}
|
|
19
|
+
next()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 登录守卫
|
|
24
|
+
* @param to
|
|
25
|
+
* @param form
|
|
26
|
+
* @param next
|
|
27
|
+
* @param options
|
|
28
|
+
*/
|
|
29
|
+
const loginGuard = (to, from, next, options) => {
|
|
30
|
+
const { message } = options
|
|
31
|
+
if ((!loginIgnore.includes(to) || to.name === '404') && !checkAuthorization()) {
|
|
32
|
+
message.warning('登录已失效,请重新登录')
|
|
33
|
+
next({ path: '/login' })
|
|
34
|
+
} else {
|
|
35
|
+
next()
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 权限守卫
|
|
41
|
+
* @param to
|
|
42
|
+
* @param form
|
|
43
|
+
* @param next
|
|
44
|
+
* @param options
|
|
45
|
+
*/
|
|
46
|
+
const authorityGuard = (to, from, next, options) => {
|
|
47
|
+
const { store, message } = options
|
|
48
|
+
const permissions = store.getters['account/permissions']
|
|
49
|
+
const roles = store.getters['account/roles']
|
|
50
|
+
if (!hasAuthority(to, permissions, roles)) {
|
|
51
|
+
message.warning(`对不起,您无权访问页面: ${to.fullPath},请联系管理员`)
|
|
52
|
+
next({ path: '/403' })
|
|
53
|
+
// NProgress.done()
|
|
54
|
+
} else {
|
|
55
|
+
next()
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 混合导航模式下一级菜单跳转重定向
|
|
61
|
+
* @param to
|
|
62
|
+
* @param from
|
|
63
|
+
* @param next
|
|
64
|
+
* @param options
|
|
65
|
+
* @returns {*}
|
|
66
|
+
*/
|
|
67
|
+
const redirectGuard = (to, from, next, options) => {
|
|
68
|
+
const { store } = options
|
|
69
|
+
const getFirstChild = (routes) => {
|
|
70
|
+
const route = routes[0]
|
|
71
|
+
if (!route.children || route.children.length === 0) {
|
|
72
|
+
return route
|
|
73
|
+
}
|
|
74
|
+
return getFirstChild(route.children)
|
|
75
|
+
}
|
|
76
|
+
if (store.state.setting.layout === 'mix') {
|
|
77
|
+
const firstMenu = store.getters['setting/firstMenu']
|
|
78
|
+
if (firstMenu.find(item => item.fullPath === to.fullPath)) {
|
|
79
|
+
store.commit('setting/setActivatedFirst', to.fullPath)
|
|
80
|
+
const subMenu = store.getters['setting/subMenu']
|
|
81
|
+
if (subMenu.length > 0) {
|
|
82
|
+
const redirect = getFirstChild(subMenu)
|
|
83
|
+
return next({ path: redirect.fullPath })
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
next()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 进度条结束
|
|
92
|
+
* @param to
|
|
93
|
+
* @param form
|
|
94
|
+
* @param options
|
|
95
|
+
*/
|
|
96
|
+
const progressDone = () => {
|
|
97
|
+
// finish progress bar
|
|
98
|
+
NProgress.done()
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export default {
|
|
102
|
+
beforeEach: [progressStart, loginGuard, authorityGuard, redirectGuard],
|
|
103
|
+
afterEach: [progressDone]
|
|
104
|
+
}
|