vue2-client 1.1.0 → 1.2.0
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/.eslintrc.js +81 -81
- package/README.md +4 -2
- package/babel.config.js +14 -14
- package/docs/index.md +29 -29
- package/{src/index.js → index.js} +8 -8
- package/jest.config.js +3 -3
- package/package.json +1 -1
- package/public/index.html +27 -27
- package/src/App.vue +93 -93
- package/src/base-client/all.js +26 -26
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +4 -4
- package/src/base-client/components/common/CreateQuery/index.md +42 -42
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +3 -3
- package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
- package/src/base-client/components/common/CustomColumnsDrawer/index.md +46 -46
- package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +3 -3
- package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
- package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
- package/src/base-client/components/common/XAddForm/XAddForm.vue +3 -3
- package/src/base-client/components/common/XAddForm/index.md +60 -60
- package/src/base-client/components/common/XBadge/index.md +39 -39
- package/src/base-client/components/common/XCard/index.md +43 -43
- package/src/base-client/components/common/XForm/XForm.vue +2 -2
- package/src/base-client/components/common/XForm/XFormItem.vue +1 -1
- package/src/base-client/components/common/XForm/index.md +3 -3
- package/src/base-client/components/common/XFormCol/index.md +35 -35
- package/src/base-client/components/common/XFormTable/XFormTable.vue +6 -6
- package/src/base-client/components/common/XFormTable/index.md +89 -89
- package/src/base-client/components/common/XTable/XTable.vue +3 -3
- package/src/base-client/components/common/XTable/index.md +3 -3
- package/src/base-client/components/common/XTreeOne/XTreeOne.vue +105 -105
- package/src/base-client/components/iot/CustomerDetailsView/CustomerDetailsView.vue +3 -3
- package/src/base-client/components/iot/CustomerDetailsView/index.md +41 -41
- package/src/base-client/components/iot/DataAnalysisUser/DataAnalysisUser.vue +127 -127
- package/src/base-client/components/iot/DataAnalysisViewGD/DataAnalysisViewGD.vue +5 -5
- package/src/base-client/components/iot/DeviceBrandDetailsView/DeviceBrandDetailsView.vue +3 -3
- package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +3 -3
- package/src/base-client/components/iot/DeviceDetailsView/index.md +43 -43
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +1 -1
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +57 -57
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstruct.vue +122 -122
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstructOperate.vue +4 -4
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsMain.vue +225 -225
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +135 -135
- package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +3 -3
- package/src/base-client/components/iot/InstructDetailsView/InstructDetailsView.vue +5 -5
- package/src/base-client/components/iot/InstructDetailsView/index.md +45 -45
- package/src/base-client/components/iot/LogDetailsView/LogDetailsView.vue +3 -3
- package/src/base-client/components/iot/LogDetailsView/index.md +43 -43
- package/src/base-client/components/iot/MeterDetailsView/MeterDetailsView.vue +3 -3
- package/src/base-client/components/iot/MeterDetailsView/index.md +43 -43
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsCount.vue +1 -1
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsException.vue +3 -3
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsHandPlan.vue +3 -3
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsInstruct.vue +4 -4
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsMain.vue +3 -3
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsSellGas.vue +3 -3
- package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +4 -4
- package/src/base-client/components/iot/WebmeterAnalysisView/index.md +48 -48
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +4 -4
- package/src/base-client/components/system/DictionaryDetailsView/index.md +41 -41
- package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +3 -3
- package/src/base-client/components/ticket/EmployeeDetailsView/EmployeeDetailsView.vue +5 -5
- package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +5 -5
- package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +3 -3
- package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +6 -6
- package/src/base-client/plugins/AppData.js +3 -3
- package/src/base-client/plugins/GetLoginInfoService.js +2 -2
- package/src/base-client/plugins/index.js +4 -4
- package/src/bootstrap.js +4 -4
- package/src/components/Ellipsis/Ellipsis.vue +64 -64
- package/src/components/Ellipsis/index.md +38 -38
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/STable/README.md +341 -341
- package/src/components/Trend/index.md +45 -45
- package/src/components/cache/AKeepAlive.js +172 -172
- package/src/components/checkbox/index.js +7 -7
- package/src/components/index.js +36 -36
- package/src/components/menu/menu.js +273 -273
- package/src/components/setting/Setting.vue +237 -237
- package/src/components/table/advance/AdvanceTable.vue +275 -275
- package/src/components/transition/PageToggleTransition.vue +97 -97
- package/src/config/default/setting.config.js +33 -33
- package/src/layouts/CommonLayout.vue +42 -42
- package/src/layouts/ComponentLayoutOne.vue +47 -47
- package/src/layouts/PageLayout.vue +151 -151
- package/src/layouts/SinglePageView.vue +74 -74
- package/src/layouts/header/AdminHeader.vue +109 -109
- package/src/layouts/header/HeaderAvatar.vue +60 -60
- package/src/layouts/header/HeaderNotice.vue +1 -1
- package/src/layouts/tabs/TabsHead.vue +190 -190
- package/src/layouts/tabs/TabsView.vue +355 -355
- package/src/main.js +2 -2
- package/src/mock/common/reportData.js +20 -20
- package/src/mock/goods/index.js +108 -108
- package/src/mock/index.js +12 -12
- package/src/mock/project/index.js +17 -17
- package/src/mock/user/current.js +13 -13
- package/src/mock/user/login.js +39 -39
- package/src/mock/user/routes.js +61 -61
- package/src/mock/workplace/index.js +15 -15
- package/src/pages/exception/403.vue +2 -2
- package/src/pages/exception/404.vue +2 -2
- package/src/pages/exception/500.vue +2 -2
- package/src/pages/login/Login.vue +8 -8
- package/src/pages/report/ReportTable.js +125 -125
- package/src/pages/report/ReportTableHome.vue +2 -2
- package/src/pages/resourceManage/resourceManageMain.vue +1 -1
- package/src/pages/system/applyInstallView/Core.vue +570 -570
- package/src/pages/system/applyInstallView/index.vue +34 -34
- package/src/pages/system/dictionary/index.vue +41 -41
- package/src/pages/system/queryParams/index.vue +41 -41
- package/src/router/async/config.async.js +25 -25
- package/src/router/async/router.map.js +13 -13
- package/src/router/guards.js +104 -104
- package/src/router/index.js +2 -2
- package/src/services/api/common.js +1 -1
- package/src/services/api/restTools.js +1 -1
- package/src/services/dataSource.js +12 -12
- package/src/services/user.js +34 -34
- package/src/store/index.js +5 -5
- package/src/store/modules/setting.js +114 -114
- package/src/theme/index.less +5 -5
- package/src/theme/reportTable.less +58 -58
- package/src/utils/i18n.js +80 -80
- package/src/utils/indexedDB.js +1 -1
- package/src/utils/request.js +1 -1
- package/src/utils/routerUtil.js +3 -3
- package/tests/unit/ReportTable.spec.js +2 -2
- package/vue.config.js +1 -0
- package/webpack.config.js +1 -1
- package/src/router/config.js +0 -23
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<Core></Core>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
<script>
|
|
7
|
-
|
|
8
|
-
import Core from '
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
name: 'Test',
|
|
12
|
-
data () {
|
|
13
|
-
return {
|
|
14
|
-
isShowOne: false,
|
|
15
|
-
isShowTwo: false
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
components: {
|
|
19
|
-
Core
|
|
20
|
-
},
|
|
21
|
-
methods: {
|
|
22
|
-
goto () {
|
|
23
|
-
this.isShowTwo = false
|
|
24
|
-
this.isShowOne = true
|
|
25
|
-
},
|
|
26
|
-
goto2 () {
|
|
27
|
-
this.isShowTwo = true
|
|
28
|
-
this.isShowOne = false
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
</script>
|
|
33
|
-
<style scoped>
|
|
34
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<Core></Core>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
|
|
8
|
+
import Core from '@vue2-client/pages/system/applyInstallView/Core'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: 'Test',
|
|
12
|
+
data () {
|
|
13
|
+
return {
|
|
14
|
+
isShowOne: false,
|
|
15
|
+
isShowTwo: false
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
components: {
|
|
19
|
+
Core
|
|
20
|
+
},
|
|
21
|
+
methods: {
|
|
22
|
+
goto () {
|
|
23
|
+
this.isShowTwo = false
|
|
24
|
+
this.isShowOne = true
|
|
25
|
+
},
|
|
26
|
+
goto2 () {
|
|
27
|
+
this.isShowTwo = true
|
|
28
|
+
this.isShowOne = false
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
<style scoped>
|
|
34
|
+
</style>
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<a-card :bordered="false">
|
|
3
|
-
<dictionary-details-view
|
|
4
|
-
:visible.sync="detailVisible"
|
|
5
|
-
:id="selectId"
|
|
6
|
-
v-if="selectId"
|
|
7
|
-
/>
|
|
8
|
-
<x-form-table
|
|
9
|
-
title="字典"
|
|
10
|
-
:queryParamsName="queryParamsName"
|
|
11
|
-
@action="toDetail">
|
|
12
|
-
</x-form-table>
|
|
13
|
-
</a-card>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
import XFormTable from '
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
name: 'Dictionary',
|
|
21
|
-
components: {
|
|
22
|
-
XFormTable
|
|
23
|
-
},
|
|
24
|
-
data () {
|
|
25
|
-
return {
|
|
26
|
-
// 选中的编号
|
|
27
|
-
selectId: undefined,
|
|
28
|
-
// 查询配置文件名
|
|
29
|
-
queryParamsName: 'dictionaryQueryParams',
|
|
30
|
-
// 是否显示详情抽屉
|
|
31
|
-
detailVisible: false
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
methods: {
|
|
35
|
-
toDetail (record, id) {
|
|
36
|
-
this.selectId = id + ''
|
|
37
|
-
this.detailVisible = true
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<a-card :bordered="false">
|
|
3
|
+
<dictionary-details-view
|
|
4
|
+
:visible.sync="detailVisible"
|
|
5
|
+
:id="selectId"
|
|
6
|
+
v-if="selectId"
|
|
7
|
+
/>
|
|
8
|
+
<x-form-table
|
|
9
|
+
title="字典"
|
|
10
|
+
:queryParamsName="queryParamsName"
|
|
11
|
+
@action="toDetail">
|
|
12
|
+
</x-form-table>
|
|
13
|
+
</a-card>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
name: 'Dictionary',
|
|
21
|
+
components: {
|
|
22
|
+
XFormTable
|
|
23
|
+
},
|
|
24
|
+
data () {
|
|
25
|
+
return {
|
|
26
|
+
// 选中的编号
|
|
27
|
+
selectId: undefined,
|
|
28
|
+
// 查询配置文件名
|
|
29
|
+
queryParamsName: 'dictionaryQueryParams',
|
|
30
|
+
// 是否显示详情抽屉
|
|
31
|
+
detailVisible: false
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
toDetail (record, id) {
|
|
36
|
+
this.selectId = id + ''
|
|
37
|
+
this.detailVisible = true
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<a-card :bordered="false">
|
|
3
|
-
<query-params-details-view
|
|
4
|
-
:visible.sync="detailVisible"
|
|
5
|
-
:id="selectId"
|
|
6
|
-
v-if="selectId"
|
|
7
|
-
/>
|
|
8
|
-
<x-form-table
|
|
9
|
-
title="查询配置"
|
|
10
|
-
:queryParamsName="queryParamsName"
|
|
11
|
-
@action="toDetail">
|
|
12
|
-
</x-form-table>
|
|
13
|
-
</a-card>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
import XFormTable from '
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
name: 'QueryParams',
|
|
21
|
-
components: {
|
|
22
|
-
XFormTable
|
|
23
|
-
},
|
|
24
|
-
data () {
|
|
25
|
-
return {
|
|
26
|
-
// 选中的编号
|
|
27
|
-
selectId: undefined,
|
|
28
|
-
// 查询配置文件名
|
|
29
|
-
queryParamsName: 'queryParams',
|
|
30
|
-
// 是否显示详情抽屉
|
|
31
|
-
detailVisible: false
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
methods: {
|
|
35
|
-
toDetail (record, id) {
|
|
36
|
-
this.selectId = id + ''
|
|
37
|
-
this.detailVisible = true
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<a-card :bordered="false">
|
|
3
|
+
<query-params-details-view
|
|
4
|
+
:visible.sync="detailVisible"
|
|
5
|
+
:id="selectId"
|
|
6
|
+
v-if="selectId"
|
|
7
|
+
/>
|
|
8
|
+
<x-form-table
|
|
9
|
+
title="查询配置"
|
|
10
|
+
:queryParamsName="queryParamsName"
|
|
11
|
+
@action="toDetail">
|
|
12
|
+
</x-form-table>
|
|
13
|
+
</a-card>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
name: 'QueryParams',
|
|
21
|
+
components: {
|
|
22
|
+
XFormTable
|
|
23
|
+
},
|
|
24
|
+
data () {
|
|
25
|
+
return {
|
|
26
|
+
// 选中的编号
|
|
27
|
+
selectId: undefined,
|
|
28
|
+
// 查询配置文件名
|
|
29
|
+
queryParamsName: 'queryParams',
|
|
30
|
+
// 是否显示详情抽屉
|
|
31
|
+
detailVisible: false
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
toDetail (record, id) {
|
|
36
|
+
this.selectId = id + ''
|
|
37
|
+
this.detailVisible = true
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import routerMap from './router.map'
|
|
2
|
-
import { parseRoutes } from '
|
|
3
|
-
|
|
4
|
-
// 异步路由配置
|
|
5
|
-
const routesConfig = [
|
|
6
|
-
'login',
|
|
7
|
-
'root',
|
|
8
|
-
{
|
|
9
|
-
router: 'exp404',
|
|
10
|
-
path: '*',
|
|
11
|
-
name: '404'
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
router: 'exp403',
|
|
15
|
-
path: '/403',
|
|
16
|
-
name: '403'
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
const options = {
|
|
21
|
-
mode: 'history',
|
|
22
|
-
routes: parseRoutes(routesConfig, routerMap)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default options
|
|
1
|
+
import routerMap from './router.map'
|
|
2
|
+
import { parseRoutes } from '@vue2-client/utils/routerUtil'
|
|
3
|
+
|
|
4
|
+
// 异步路由配置
|
|
5
|
+
const routesConfig = [
|
|
6
|
+
'login',
|
|
7
|
+
'root',
|
|
8
|
+
{
|
|
9
|
+
router: 'exp404',
|
|
10
|
+
path: '*',
|
|
11
|
+
name: '404'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
router: 'exp403',
|
|
15
|
+
path: '/403',
|
|
16
|
+
name: '403'
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
const options = {
|
|
21
|
+
mode: 'history',
|
|
22
|
+
routes: parseRoutes(routesConfig, routerMap)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default options
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// 视图组件
|
|
2
2
|
const view = {
|
|
3
|
-
tabs: () => import('
|
|
4
|
-
blank: () => import('
|
|
5
|
-
page: () => import('
|
|
6
|
-
singlePage: () => import('
|
|
3
|
+
tabs: () => import('@vue2-client/layouts/tabs'),
|
|
4
|
+
blank: () => import('@vue2-client/layouts/BlankView'),
|
|
5
|
+
page: () => import('@vue2-client/layouts/PageView'),
|
|
6
|
+
singlePage: () => import('@vue2-client/layouts/SinglePageView')
|
|
7
7
|
}
|
|
8
8
|
// 动态路由对象定义
|
|
9
9
|
const routerResource = {}
|
|
@@ -15,22 +15,22 @@ routerResource.singlePage = view.singlePage
|
|
|
15
15
|
// --------------------------------------系统配置--------------------------------------
|
|
16
16
|
routerResource.system = view.blank
|
|
17
17
|
// 字典管理
|
|
18
|
-
routerResource.dictionaryManage = () => import(/* webpackChunkName: "dictionary" */ '
|
|
18
|
+
routerResource.dictionaryManage = () => import(/* webpackChunkName: "dictionary" */ '@vue2-client/pages/system/dictionary')
|
|
19
19
|
// 查询配置管理
|
|
20
|
-
routerResource.queryParamsManage = () => import(/* webpackChunkName: "queryParams" */ '
|
|
20
|
+
routerResource.queryParamsManage = () => import(/* webpackChunkName: "queryParams" */ '@vue2-client/pages/system/queryParams')
|
|
21
21
|
// 报装可视化
|
|
22
|
-
routerResource.applyInstallView = () => import(/* webpackChunkName: "applyInstallView" */ '
|
|
22
|
+
routerResource.applyInstallView = () => import(/* webpackChunkName: "applyInstallView" */ '@vue2-client/pages/system/applyInstallView')
|
|
23
23
|
// --------------------------------------报表组件--------------------------------------
|
|
24
|
-
routerResource.reportTable = () => import(/* webpackChunkName: "ReportTableHome" */ '
|
|
24
|
+
routerResource.reportTable = () => import(/* webpackChunkName: "ReportTableHome" */ '@vue2-client/pages/report/ReportTableHome')
|
|
25
25
|
// --------------------------------------资源管理--------------------------------------
|
|
26
|
-
routerResource.resourceManageMain = () => import(/* webpackChunkName: "resourceManageMain" */ '
|
|
26
|
+
routerResource.resourceManageMain = () => import(/* webpackChunkName: "resourceManageMain" */ '@vue2-client/pages/resourceManage/resourceManageMain')
|
|
27
27
|
|
|
28
28
|
// 基础路由组件注册
|
|
29
29
|
const routerMap = {
|
|
30
30
|
login: {
|
|
31
31
|
authority: '*',
|
|
32
32
|
path: '/login',
|
|
33
|
-
component: () => import('
|
|
33
|
+
component: () => import('@vue2-client/pages/login')
|
|
34
34
|
},
|
|
35
35
|
root: {
|
|
36
36
|
path: '/',
|
|
@@ -42,17 +42,17 @@ const routerMap = {
|
|
|
42
42
|
authority: '*',
|
|
43
43
|
name: 'exp403',
|
|
44
44
|
path: '403',
|
|
45
|
-
component: () => import('
|
|
45
|
+
component: () => import('@vue2-client/pages/exception/403')
|
|
46
46
|
},
|
|
47
47
|
exp404: {
|
|
48
48
|
name: 'exp404',
|
|
49
49
|
path: '404',
|
|
50
|
-
component: () => import('
|
|
50
|
+
component: () => import('@vue2-client/pages/exception/404')
|
|
51
51
|
},
|
|
52
52
|
exp500: {
|
|
53
53
|
name: 'exp500',
|
|
54
54
|
path: '500',
|
|
55
|
-
component: () => import('
|
|
55
|
+
component: () => import('@vue2-client/pages/exception/500')
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
Object.assign(routerMap, routerResource)
|
package/src/router/guards.js
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import { hasAuthority } from '
|
|
2
|
-
import { loginIgnore } from '
|
|
3
|
-
import { checkAuthorization } from '
|
|
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) && !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
|
+
}
|
package/src/router/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatRoutes } from '
|
|
1
|
+
import { formatRoutes } from '@vue2-client/utils/routerUtil'
|
|
2
2
|
|
|
3
3
|
// 不需要登录拦截的路由配置
|
|
4
4
|
const loginIgnore = {
|
|
@@ -20,7 +20,7 @@ const loginIgnore = {
|
|
|
20
20
|
* @returns {RouterOptions}
|
|
21
21
|
*/
|
|
22
22
|
function initRouter (isAsync) {
|
|
23
|
-
const options =
|
|
23
|
+
const options = require('./async/config.async').default
|
|
24
24
|
formatRoutes(options.routes)
|
|
25
25
|
return options
|
|
26
26
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { GOODS, GOODS_COLUMNS } from './api'
|
|
2
|
-
import { METHOD, request } from '
|
|
3
|
-
|
|
4
|
-
export async function goodsList (params) {
|
|
5
|
-
return request(GOODS, METHOD.GET, params)
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export async function goodsColumns () {
|
|
9
|
-
return request(GOODS_COLUMNS, METHOD.GET)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default { goodsList, goodsColumns }
|
|
1
|
+
import { GOODS, GOODS_COLUMNS } from './api'
|
|
2
|
+
import { METHOD, request } from '@vue2-client/utils/request'
|
|
3
|
+
|
|
4
|
+
export async function goodsList (params) {
|
|
5
|
+
return request(GOODS, METHOD.GET, params)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export async function goodsColumns () {
|
|
9
|
+
return request(GOODS_COLUMNS, METHOD.GET)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default { goodsList, goodsColumns }
|