mooho-base-admin-plus 0.1.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/.env +5 -0
- package/.env.development +0 -0
- package/.env.production +0 -0
- package/.eslintignore +11 -0
- package/.eslintrc.js +47 -0
- package/.prettierrc +15 -0
- package/README.md +18 -0
- package/dist/favicon.ico +0 -0
- package/dist/mooho-base-admin-plus.min.esm.js +131746 -0
- package/dist/mooho-base-admin-plus.min.js +279 -0
- package/dist/setting.js +31 -0
- package/dist/static/images/app-barcode.png +0 -0
- package/dist/static/images/login/bg.png +0 -0
- package/dist/static/images/login/logo.png +0 -0
- package/dist/static/images/login/password-active.png +0 -0
- package/dist/static/images/login/password-default.png +0 -0
- package/dist/static/images/login/signIn-img.png +0 -0
- package/dist/static/images/login/user-active.png +0 -0
- package/dist/static/images/login/user-default.png +0 -0
- package/dist/static/images/logo-dark.png +0 -0
- package/dist/static/images/logo-small.png +0 -0
- package/dist/static/images/logo.png +0 -0
- package/dist/static/images/logo.svg +510 -0
- package/dist/static/images/no-image.png +0 -0
- package/dist/style.css +4 -0
- package/index.html +18 -0
- package/other/pda.vue +28 -0
- package/package.json +59 -0
- package/public/favicon.ico +0 -0
- package/public/setting.js +31 -0
- package/public/static/images/app-barcode.png +0 -0
- package/public/static/images/login/bg.png +0 -0
- package/public/static/images/login/logo.png +0 -0
- package/public/static/images/login/password-active.png +0 -0
- package/public/static/images/login/password-default.png +0 -0
- package/public/static/images/login/signIn-img.png +0 -0
- package/public/static/images/login/user-active.png +0 -0
- package/public/static/images/login/user-default.png +0 -0
- package/public/static/images/logo-dark.png +0 -0
- package/public/static/images/logo-small.png +0 -0
- package/public/static/images/logo.png +0 -0
- package/public/static/images/logo.svg +510 -0
- package/public/static/images/no-image.png +0 -0
- package/src/App.vue +60 -0
- package/src/api/application.js +35 -0
- package/src/api/customModel.js +187 -0
- package/src/api/customPage.js +15 -0
- package/src/api/customTable.js +24 -0
- package/src/api/dataSource.js +93 -0
- package/src/api/dataView.js +199 -0
- package/src/api/dictType.js +23 -0
- package/src/api/entityView.js +13 -0
- package/src/api/enum.js +15 -0
- package/src/api/filterColumn.js +16 -0
- package/src/api/model.js +244 -0
- package/src/api/movePlan.js +29 -0
- package/src/api/notification.js +28 -0
- package/src/api/openApiPermission.js +25 -0
- package/src/api/permission.js +51 -0
- package/src/api/planJob.js +15 -0
- package/src/api/process.js +23 -0
- package/src/api/processDef.js +36 -0
- package/src/api/processInst.js +16 -0
- package/src/api/rolePermission.js +17 -0
- package/src/api/roleProperty.js +36 -0
- package/src/api/shortcut.js +20 -0
- package/src/api/system.js +23 -0
- package/src/api/task.js +56 -0
- package/src/api/taskQueue.js +24 -0
- package/src/api/user.js +45 -0
- package/src/api/viewColumn.js +16 -0
- package/src/assets/svg/body.svg +17 -0
- package/src/assets/svg/header-theme-dark.svg +40 -0
- package/src/assets/svg/header-theme-primary.svg +40 -0
- package/src/assets/svg/header-top.svg +40 -0
- package/src/assets/svg/icon-happy.svg +1 -0
- package/src/assets/svg/icon-sad.svg +1 -0
- package/src/assets/svg/icon-social-bilibili.svg +1 -0
- package/src/assets/svg/icon-social-dingding.svg +1 -0
- package/src/assets/svg/icon-social-facebook.svg +1 -0
- package/src/assets/svg/icon-social-juejin.svg +1 -0
- package/src/assets/svg/icon-social-qq.svg +1 -0
- package/src/assets/svg/icon-social-twitter.svg +1 -0
- package/src/assets/svg/icon-social-wechat.svg +1 -0
- package/src/assets/svg/icon-social-weibo.svg +1 -0
- package/src/assets/svg/icon-social-zhihu.svg +1 -0
- package/src/assets/svg/nav-theme-dark.svg +40 -0
- package/src/assets/svg/nav-theme-light.svg +40 -0
- package/src/components/copyright/index.vue +28 -0
- package/src/components/home/notice-list.vue +62 -0
- package/src/components/home/shortcut.vue +125 -0
- package/src/components/input/dialog-select.vue +301 -0
- package/src/components/input/item-select.vue +195 -0
- package/src/components/link/index.vue +54 -0
- package/src/components/richEditor/index.vue +86 -0
- package/src/components/upload/file-upload.vue +84 -0
- package/src/components/upload/upload-attachment.vue +119 -0
- package/src/components/upload/upload-image.vue +212 -0
- package/src/components/view/column-check.vue +223 -0
- package/src/components/view/column-edit.vue +850 -0
- package/src/components/view/column-select.vue +206 -0
- package/src/components/view/condition-edit.vue +164 -0
- package/src/components/view/filter-edit.vue +633 -0
- package/src/components/view/filter-setting.vue +126 -0
- package/src/components/view/form-setting-layout.vue +375 -0
- package/src/components/view/form-setting.vue +247 -0
- package/src/components/view/group-column.vue +104 -0
- package/src/components/view/group-method.vue +104 -0
- package/src/components/view/mixin.js +72 -0
- package/src/components/view/modal-form-filter.vue +319 -0
- package/src/components/view/modal-form-sort.vue +248 -0
- package/src/components/view/modal-form.vue +453 -0
- package/src/components/view/modal-table.vue +471 -0
- package/src/components/view/table-filter.vue +702 -0
- package/src/components/view/table-setting.vue +533 -0
- package/src/components/view/view-chart.vue +423 -0
- package/src/components/view/view-form-draggable.vue +837 -0
- package/src/components/view/view-form.vue +1444 -0
- package/src/components/view/view-table.vue +2261 -0
- package/src/components/workflow/flow-chart.vue +846 -0
- package/src/directive/focus.js +10 -0
- package/src/directive/tabHide.js +9 -0
- package/src/i18n/index.js +15 -0
- package/src/i18n/locale/en-US.js +1 -0
- package/src/i18n/locale/lang.js +1 -0
- package/src/i18n/locale/zh-CN.js +1 -0
- package/src/i18n/locale.js +102 -0
- package/src/index.js +222 -0
- package/src/layouts/basic-layout/header-breadcrumb/index.vue +122 -0
- package/src/layouts/basic-layout/header-collapse/index.vue +44 -0
- package/src/layouts/basic-layout/header-fullscreen/index.vue +19 -0
- package/src/layouts/basic-layout/header-i18n/index.vue +45 -0
- package/src/layouts/basic-layout/header-log/index.vue +41 -0
- package/src/layouts/basic-layout/header-logo/index.vue +23 -0
- package/src/layouts/basic-layout/header-notice/index.vue +218 -0
- package/src/layouts/basic-layout/header-reload/index.vue +21 -0
- package/src/layouts/basic-layout/header-search/index.vue +37 -0
- package/src/layouts/basic-layout/header-setting/index.vue +219 -0
- package/src/layouts/basic-layout/header-user/index.vue +175 -0
- package/src/layouts/basic-layout/i18n.js +50 -0
- package/src/layouts/basic-layout/index.vue +280 -0
- package/src/layouts/basic-layout/menu-head/index.vue +120 -0
- package/src/layouts/basic-layout/menu-head/title.vue +48 -0
- package/src/layouts/basic-layout/menu-side/index.vue +113 -0
- package/src/layouts/basic-layout/menu-side/menu-collapse.vue +76 -0
- package/src/layouts/basic-layout/menu-side/menu-item.vue +31 -0
- package/src/layouts/basic-layout/menu-side/menu-title.vue +56 -0
- package/src/layouts/basic-layout/menu-side/submenu.vue +31 -0
- package/src/layouts/basic-layout/mixins/click-item.js +21 -0
- package/src/layouts/basic-layout/mixins/sider-menu-badge.js +13 -0
- package/src/layouts/basic-layout/mixins/translate-title.js +11 -0
- package/src/layouts/basic-layout/tabs/index.vue +192 -0
- package/src/layouts/basic-layout/water-mark/index.vue +29 -0
- package/src/libs/lodop/index.js +145 -0
- package/src/libs/random_str.js +10 -0
- package/src/libs/request/index.js +158 -0
- package/src/libs/system/index.js +234 -0
- package/src/libs/util.cookies.js +44 -0
- package/src/libs/util.db.js +13 -0
- package/src/libs/util.js +55 -0
- package/src/libs/util.log.js +88 -0
- package/src/libs/water-mark.js +44 -0
- package/src/menu/header.js +20 -0
- package/src/menu/modules/dashboard.js +23 -0
- package/src/menu/sider.js +12 -0
- package/src/mixins/app.js +9 -0
- package/src/mixins/page.js +643 -0
- package/src/pages/account/login.vue +101 -0
- package/src/pages/common/home.vue +169 -0
- package/src/pages/common/task-form.vue +350 -0
- package/src/pages/common/todo.vue +31 -0
- package/src/pages/system/apiLog.vue +79 -0
- package/src/pages/system/applicationType.vue +182 -0
- package/src/pages/system/customPage.vue +62 -0
- package/src/pages/system/customTable.vue +98 -0
- package/src/pages/system/dict.vue +36 -0
- package/src/pages/system/dictType.vue +58 -0
- package/src/pages/system/entityView.vue +38 -0
- package/src/pages/system/error/404.vue +6 -0
- package/src/pages/system/extendColumn.vue +99 -0
- package/src/pages/system/formView.vue +136 -0
- package/src/pages/system/log.vue +55 -0
- package/src/pages/system/notice.vue +26 -0
- package/src/pages/system/openApi.vue +26 -0
- package/src/pages/system/openUser.vue +66 -0
- package/src/pages/system/organization.vue +98 -0
- package/src/pages/system/organizationType.vue +26 -0
- package/src/pages/system/permission.vue +175 -0
- package/src/pages/system/planJob.vue +40 -0
- package/src/pages/system/printTemplate.vue +48 -0
- package/src/pages/system/process.vue +79 -0
- package/src/pages/system/processType.vue +26 -0
- package/src/pages/system/role.vue +395 -0
- package/src/pages/system/rolePropertyEdit.vue +480 -0
- package/src/pages/system/sequenceSetting.vue +26 -0
- package/src/pages/system/systemData.vue +52 -0
- package/src/pages/system/tableView.vue +386 -0
- package/src/pages/system/taskQueue.vue +48 -0
- package/src/pages/system/user.vue +250 -0
- package/src/pages/template/processPage.vue +243 -0
- package/src/pages/template/reportPage.vue +66 -0
- package/src/pages/template/viewPage.vue +139 -0
- package/src/plugins/auth/index.js +21 -0
- package/src/plugins/error/index.js +31 -0
- package/src/plugins/index.js +24 -0
- package/src/plugins/sweetalert2/index.js +20 -0
- package/src/router/dynamic.js +183 -0
- package/src/router/index.js +84 -0
- package/src/setting.js +202 -0
- package/src/store/index.js +9 -0
- package/src/store/modules/admin/index.js +16 -0
- package/src/store/modules/admin/modules/account.js +103 -0
- package/src/store/modules/admin/modules/cache.js +119 -0
- package/src/store/modules/admin/modules/dataView.js +112 -0
- package/src/store/modules/admin/modules/db.js +231 -0
- package/src/store/modules/admin/modules/i18n.js +87 -0
- package/src/store/modules/admin/modules/layout.js +115 -0
- package/src/store/modules/admin/modules/loader.js +44 -0
- package/src/store/modules/admin/modules/log.js +77 -0
- package/src/store/modules/admin/modules/menu.js +338 -0
- package/src/store/modules/admin/modules/page.js +466 -0
- package/src/store/modules/admin/modules/user.js +96 -0
- package/src/store/modules/admin/modules/viewPage.js +34 -0
- package/src/styles/common.less +47 -0
- package/src/styles/css/default.css +510 -0
- package/src/styles/css/login.css +1217 -0
- package/src/styles/default/index.less +6 -0
- package/src/styles/font/demo.css +539 -0
- package/src/styles/font/demo_index.html +372 -0
- package/src/styles/font/icon-demo/demo.css +539 -0
- package/src/styles/font/icon-demo/demo_index.html +423 -0
- package/src/styles/font/icon-demo/iconfont.css +61 -0
- package/src/styles/font/icon-demo/iconfont.eot +0 -0
- package/src/styles/font/icon-demo/iconfont.js +1 -0
- package/src/styles/font/icon-demo/iconfont.svg +59 -0
- package/src/styles/font/icon-demo/iconfont.ttf +0 -0
- package/src/styles/font/icon-demo/iconfont.woff +0 -0
- package/src/styles/font/icon-demo/iconfont.woff2 +0 -0
- package/src/styles/font/iconfont.css +47 -0
- package/src/styles/font/iconfont.js +1 -0
- package/src/styles/font/iconfont.json +65 -0
- package/src/styles/font/iconfont.ttf +0 -0
- package/src/styles/font/iconfont.woff +0 -0
- package/src/styles/font/iconfont.woff2 +0 -0
- package/src/styles/font/ionicons.svg +870 -0
- package/src/styles/font/ionicons.ttf +0 -0
- package/src/styles/font/ionicons.woff +0 -0
- package/src/styles/font/ionicons.woff2 +0 -0
- package/src/styles/index.less +7 -0
- package/src/styles/layout/basic-layout/layout.less +527 -0
- package/src/styles/layout/basic-layout/menu.less +274 -0
- package/src/styles/layout/index.less +2 -0
- package/src/styles/setting.less +6 -0
- package/styleguide.config.js +22 -0
- package/test/api/barcode.js +50 -0
- package/test/api/inbound.js +47 -0
- package/test/api/interfaceLog.js +15 -0
- package/test/api/interfaceQueue.js +15 -0
- package/test/api/interfaceServer.js +29 -0
- package/test/api/movePlan.js +50 -0
- package/test/api/movePlanItem.js +13 -0
- package/test/api/moveType.js +22 -0
- package/test/api/openApiPermission.js +25 -0
- package/test/api/outbound.js +40 -0
- package/test/api/permission.js +34 -0
- package/test/api/rolePermission.js +17 -0
- package/test/api/user.js +40 -0
- package/test/api/viewColumn.js +16 -0
- package/test/api/warehouse.js +13 -0
- package/test/api/warehouseMoveType.js +18 -0
- package/test/main.js +55 -0
- package/test/package.js +33 -0
- package/test/pages/home/index.vue +22 -0
- package/test/pages/task/test.vue +28 -0
- package/test/pages/test/dataViewTest.vue +28 -0
- package/test/pages/test/logReport.vue +25 -0
- package/test/pages/test/testPage.vue +38 -0
- package/test/router/routes.js +88 -0
- package/test/setting.env.js +22 -0
- package/test/styles/css/custom.css +0 -0
- package/test/styles/css/login.css +1217 -0
- package/vite.config.js +72 -0
- package/vue.config.js +20 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import permissionApi from '../api/permission';
|
|
2
|
+
|
|
3
|
+
// 动态路由
|
|
4
|
+
export default {
|
|
5
|
+
async init(router) {
|
|
6
|
+
let pages = router.pages;
|
|
7
|
+
let layout = router.layout;
|
|
8
|
+
|
|
9
|
+
let res = await permissionApi.queryRouter();
|
|
10
|
+
|
|
11
|
+
// 自定义页面数据处理
|
|
12
|
+
res.forEach(permission => {
|
|
13
|
+
if (permission.isCustomPage) {
|
|
14
|
+
permission.url += '?id=' + permission.customPageID;
|
|
15
|
+
if (permission.customPage.customPageTemplate) {
|
|
16
|
+
permission.templateUrl = 'template/' + permission.customPage.customPageTemplate.substr(0, 1).toLowerCase() + permission.customPage.customPageTemplate.substr(1) + '.vue';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
let allPer = res;
|
|
22
|
+
let topPer = allPer.filter(p => p.parentID == null);
|
|
23
|
+
let routes = [
|
|
24
|
+
{
|
|
25
|
+
path: '/:pathMatch(.*)',
|
|
26
|
+
name: '404',
|
|
27
|
+
meta: {
|
|
28
|
+
title: '404'
|
|
29
|
+
},
|
|
30
|
+
component: () => {
|
|
31
|
+
return new Promise(resolve => {
|
|
32
|
+
resolve(pages['system/error/404.vue']);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
path: '/',
|
|
38
|
+
redirect: {
|
|
39
|
+
name: 'login'
|
|
40
|
+
},
|
|
41
|
+
component: layout,
|
|
42
|
+
children: []
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
for (let i = 0; i < topPer.length; i++) {
|
|
46
|
+
if (!(topPer[i].templateUrl || '').trim()) {
|
|
47
|
+
topPer[i] = PermissionDeep(topPer[i], allPer);
|
|
48
|
+
} else {
|
|
49
|
+
// 一级菜单
|
|
50
|
+
let parent = routes.find(element => {
|
|
51
|
+
return element.path === '/';
|
|
52
|
+
});
|
|
53
|
+
let item = topPer[i];
|
|
54
|
+
let url = item.url.split('?')[0];
|
|
55
|
+
let data = {};
|
|
56
|
+
if (item.url.split('?').length > 1) {
|
|
57
|
+
item.url
|
|
58
|
+
.split('?')[1]
|
|
59
|
+
.split('&')
|
|
60
|
+
.forEach(item => {
|
|
61
|
+
if (item.split('=').length > 1 && item.split('=')[0].length > 0) {
|
|
62
|
+
data[item.split('=')[0]] = item.split('=')[1];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
let node = {
|
|
67
|
+
id: item.id,
|
|
68
|
+
path: url.split('/').pop(),
|
|
69
|
+
name: url.replace(/\//g, '-'),
|
|
70
|
+
meta: {
|
|
71
|
+
auth: false,
|
|
72
|
+
title: item.name,
|
|
73
|
+
description: item.subName,
|
|
74
|
+
data,
|
|
75
|
+
cache: item.isMenu
|
|
76
|
+
},
|
|
77
|
+
component: () => {
|
|
78
|
+
return new Promise(resolve => {
|
|
79
|
+
resolve(pages[item.templateUrl]);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
parent.children.push(node);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
buildPermission(pages, topPer, routes, layout, null);
|
|
88
|
+
|
|
89
|
+
routes.forEach(route => {
|
|
90
|
+
router.addRoute(route);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return routes;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
function buildPermission(pages, perArry, routes, layout, parent) {
|
|
98
|
+
perArry.forEach(item => {
|
|
99
|
+
let node;
|
|
100
|
+
if (item.parentID == null) {
|
|
101
|
+
if (!(item.templateUrl || '').trim()) {
|
|
102
|
+
node = {
|
|
103
|
+
id: item.id,
|
|
104
|
+
pId: item.parentID,
|
|
105
|
+
path: '/' + item.url.split('/').pop(),
|
|
106
|
+
name: item.url.replace('app.', '').replace(/\./g, '-'),
|
|
107
|
+
meta: {
|
|
108
|
+
auth: false
|
|
109
|
+
},
|
|
110
|
+
component: layout
|
|
111
|
+
};
|
|
112
|
+
routes.push(node);
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
// 获取参数
|
|
116
|
+
let url = item.url.split('?')[0];
|
|
117
|
+
let data = {};
|
|
118
|
+
if (item.url.split('?').length > 1) {
|
|
119
|
+
item.url
|
|
120
|
+
.split('?')[1]
|
|
121
|
+
.split('&')
|
|
122
|
+
.forEach(item => {
|
|
123
|
+
if (item.split('=').length > 1 && item.split('=')[0].length > 0) {
|
|
124
|
+
data[item.split('=')[0]] = item.split('=')[1];
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
node = {
|
|
129
|
+
id: item.id,
|
|
130
|
+
pId: item.parentID,
|
|
131
|
+
path: url.split('/').pop(),
|
|
132
|
+
name: url.replace(/\//g, '-'),
|
|
133
|
+
meta: {
|
|
134
|
+
auth: false,
|
|
135
|
+
title: item.name,
|
|
136
|
+
description: item.subName,
|
|
137
|
+
data,
|
|
138
|
+
cache: item.isMenu
|
|
139
|
+
},
|
|
140
|
+
component: () => {
|
|
141
|
+
return new Promise(resolve => {
|
|
142
|
+
resolve(pages[item.templateUrl]);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
if (parent == null) {
|
|
147
|
+
parent = routes.find(p => p.id == item.parentID);
|
|
148
|
+
}
|
|
149
|
+
if (parent != undefined) {
|
|
150
|
+
if (parent.children == null) {
|
|
151
|
+
parent.children = [];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (parent.pId != null) {
|
|
155
|
+
let backup = parent;
|
|
156
|
+
parent = routes.find(p => p.id == parent.pId);
|
|
157
|
+
node.path = url.split('/').splice(1).join('/');
|
|
158
|
+
parent.children.push(node);
|
|
159
|
+
parent = backup;
|
|
160
|
+
} else {
|
|
161
|
+
parent.children.push(node);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (item.sonPer != null) {
|
|
167
|
+
buildPermission(pages, item.sonPer, routes, layout, node);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
return routes;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function PermissionDeep(per, perArry) {
|
|
175
|
+
let sonPerArry = perArry.filter(p => p.parentID == per.id);
|
|
176
|
+
if (sonPerArry.length > 0) {
|
|
177
|
+
per['sonPer'] = sonPerArry;
|
|
178
|
+
for (let i = 0; i < sonPerArry.length; i++) {
|
|
179
|
+
sonPerArry[i] = PermissionDeep(sonPerArry[i], perArry);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return per;
|
|
183
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createRouter, createWebHistory, createWebHashHistory, createMemoryHistory } from 'vue-router';
|
|
2
|
+
import ViewUIPlus from 'view-ui-plus';
|
|
3
|
+
import util from '../libs/util';
|
|
4
|
+
import Setting from '../setting';
|
|
5
|
+
import store from '../store/index';
|
|
6
|
+
import dynamic from './dynamic';
|
|
7
|
+
|
|
8
|
+
// 根目录
|
|
9
|
+
let base = import.meta.env.VUE_APP_BASE_PATH;
|
|
10
|
+
if (!base) {
|
|
11
|
+
base = '';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// 导出路由 在 main.js 里使用
|
|
15
|
+
const router = createRouter({
|
|
16
|
+
history: Setting.routerMode === 'history' ? createWebHistory(base) : Setting.routerMode === 'hash' ? createWebHashHistory(base) : createMemoryHistory(base),
|
|
17
|
+
routes: []
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// 是否初始化
|
|
21
|
+
let inited = false;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 路由拦截
|
|
25
|
+
* 权限验证
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
router.beforeEach(async (to, from, next) => {
|
|
29
|
+
if (Setting.showProgressBar) {
|
|
30
|
+
ViewUIPlus.LoadingBar.start();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!inited) {
|
|
34
|
+
// 初始化动态路由
|
|
35
|
+
let dynamicRoutes = await dynamic.init(router);
|
|
36
|
+
let frameInRoutes = router.getRoutes();
|
|
37
|
+
|
|
38
|
+
// 处理路由 得到每一级的路由设置
|
|
39
|
+
store.commit('admin/page/init', [...frameInRoutes, ...dynamicRoutes]);
|
|
40
|
+
inited = true;
|
|
41
|
+
next({
|
|
42
|
+
...to,
|
|
43
|
+
replace: true
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
// 判断是否需要登录才可以进入
|
|
47
|
+
if (to.matched.some(_ => _.meta.auth)) {
|
|
48
|
+
// 这里依据 token 判断是否登录,可视情况修改
|
|
49
|
+
const token = util.cookies.get('token');
|
|
50
|
+
|
|
51
|
+
if (token && token !== 'undefined') {
|
|
52
|
+
next();
|
|
53
|
+
} else {
|
|
54
|
+
// 没有登录的时候跳转到登录界面
|
|
55
|
+
// 携带上登陆成功之后需要跳转的页面完整路径
|
|
56
|
+
next({
|
|
57
|
+
name: 'login',
|
|
58
|
+
query: {
|
|
59
|
+
redirect: to.fullPath
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
// 不需要身份校验 直接通过
|
|
65
|
+
next();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
router.afterEach(to => {
|
|
71
|
+
if (Setting.showProgressBar) ViewUIPlus.LoadingBar.finish();
|
|
72
|
+
// 多页控制 打开新的页面
|
|
73
|
+
if (!('meta' in to) || (to.meta && !('tabs' in to.meta)) || (to.meta && to.meta.tabs)) {
|
|
74
|
+
store.dispatch('admin/page/open', to);
|
|
75
|
+
}
|
|
76
|
+
// 更改标题
|
|
77
|
+
util.title({
|
|
78
|
+
title: to.meta.title
|
|
79
|
+
});
|
|
80
|
+
// 返回页面顶端
|
|
81
|
+
window.scrollTo(0, 0);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export default router;
|
package/src/setting.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin Plus 业务配置
|
|
3
|
+
* */
|
|
4
|
+
|
|
5
|
+
const env = import.meta.env.NODE_ENV;
|
|
6
|
+
const basePath = import.meta.env.VUE_APP_BASE_PATH;
|
|
7
|
+
|
|
8
|
+
const Setting = {
|
|
9
|
+
/**
|
|
10
|
+
* 基础配置
|
|
11
|
+
* */
|
|
12
|
+
// 基本信息
|
|
13
|
+
info: {},
|
|
14
|
+
// 项目的 ID
|
|
15
|
+
appID: 'app',
|
|
16
|
+
// 根目录
|
|
17
|
+
rootPath: basePath == '' || basePath == null ? '/static/' : '/' + basePath + '/static/',
|
|
18
|
+
// 网页标题的后缀,不需要设置为 false 或空
|
|
19
|
+
titleSuffix: 'Admin Plus',
|
|
20
|
+
// 路由模式,可选值为 history 或 hash
|
|
21
|
+
routerMode: 'history',
|
|
22
|
+
// 页面切换时,是否显示模拟的进度条
|
|
23
|
+
showProgressBar: true,
|
|
24
|
+
// Cookies 默认保存时间,单位:天
|
|
25
|
+
cookiesExpires: 1,
|
|
26
|
+
/**
|
|
27
|
+
* 多语言配置
|
|
28
|
+
* */
|
|
29
|
+
i18n: {
|
|
30
|
+
// 默认语言
|
|
31
|
+
default: 'zh-CN',
|
|
32
|
+
// 是否根据用户电脑配置自动设置语言(仅第一次有效)
|
|
33
|
+
auto: false,
|
|
34
|
+
// 切换语言时是否刷新页面
|
|
35
|
+
refresh: false,
|
|
36
|
+
// 支持的语言列表
|
|
37
|
+
list: [
|
|
38
|
+
{
|
|
39
|
+
locale: 'zh-CN',
|
|
40
|
+
language: '简体中文'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
locale: 'en-US',
|
|
44
|
+
language: 'English'
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
// 是否通过远程接口来获取 i81n 文件
|
|
48
|
+
remote: false
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* 布局配置
|
|
52
|
+
* */
|
|
53
|
+
// 侧边菜单宽度,单位 px,不可动态修改,需与 setting.less 的 @menuSideWidth 保持一致
|
|
54
|
+
menuSideWidth: 256,
|
|
55
|
+
// 顶栏高度,单位 px,不可动态修改,需与 setting.less 的 @headerHeight 保持一致
|
|
56
|
+
headerHeight: 64,
|
|
57
|
+
// 侧边菜单折起时的宽度,单位 px,不可动态修改,需与 setting.less 的 @menuSideCollapseWidth 保持一致
|
|
58
|
+
menuSideCollapseWidth: 80,
|
|
59
|
+
layout: {
|
|
60
|
+
// 侧边栏风格,可选值为 dark 或 light
|
|
61
|
+
siderTheme: 'dark',
|
|
62
|
+
// 顶栏风格,可选值为 light、dark 或 primary
|
|
63
|
+
headerTheme: 'light',
|
|
64
|
+
// 顶栏是否置顶,开启后会覆盖侧边栏,需开启 headerFix
|
|
65
|
+
headerStick: false,
|
|
66
|
+
// 是否开启多 Tabs 页签
|
|
67
|
+
tabs: false,
|
|
68
|
+
// 多 Tabs 页签是否显示图标,开启 tabs 时有效
|
|
69
|
+
showTabsIcon: true,
|
|
70
|
+
// 是否固定多 Tabs 多页签
|
|
71
|
+
tabsFix: true,
|
|
72
|
+
// 再次点击 Tabs 页签时,是否重载当前页面
|
|
73
|
+
tabsReload: false,
|
|
74
|
+
// 页签是否支持拖拽排序
|
|
75
|
+
tabsOrder: true,
|
|
76
|
+
// 是否固定侧边栏
|
|
77
|
+
siderFix: true,
|
|
78
|
+
// 是否固定顶栏
|
|
79
|
+
headerFix: true,
|
|
80
|
+
// 是否在下滑时隐藏顶栏,需开启 headerFix,如果开启了 tabsFix,Tabs 也会被隐藏
|
|
81
|
+
headerHide: false,
|
|
82
|
+
// 是否显示顶部菜单栏
|
|
83
|
+
// 一般来说,侧边的菜单栏足以满足大部分业务,如需动态切换侧边栏,可开启此选项启用顶部一级菜单,此时侧边栏将作为二级菜单
|
|
84
|
+
headerMenu: false,
|
|
85
|
+
// 侧边菜单栏是否开启手风琴模式
|
|
86
|
+
menuAccordion: true,
|
|
87
|
+
// 是否显示折叠侧边栏按钮,移动端下会自动强制开启
|
|
88
|
+
showSiderCollapse: true,
|
|
89
|
+
// 侧边菜单栏是否默认折起
|
|
90
|
+
menuCollapse: false,
|
|
91
|
+
// 再次点击当前侧边菜单时,是否重载当前页面
|
|
92
|
+
menuSiderReload: false,
|
|
93
|
+
// 再次点击当前顶部菜单时,是否重载当前页面
|
|
94
|
+
menuHeaderReload: false,
|
|
95
|
+
// 侧边菜单折起时,是否在子菜单前显示父级菜单名称
|
|
96
|
+
showCollapseMenuTitle: false,
|
|
97
|
+
// 是否显示重载按钮
|
|
98
|
+
showReload: false,
|
|
99
|
+
// 是否显示搜索
|
|
100
|
+
showSearch: false,
|
|
101
|
+
// 是否显示通知
|
|
102
|
+
showNotice: false,
|
|
103
|
+
// 是否显示全屏
|
|
104
|
+
showFullscreen: true,
|
|
105
|
+
// 在手机访问时,是否在顶部显示小尺寸 logo
|
|
106
|
+
showMobileLogo: true,
|
|
107
|
+
// 是否显示全局面包屑,开启 headerMenu 时不可用
|
|
108
|
+
showBreadcrumb: true,
|
|
109
|
+
// 全局面包屑是否显示图标,开启 showBreadcrumb 时有效
|
|
110
|
+
showBreadcrumbIcon: false,
|
|
111
|
+
// 是否显示日志入口,开启与否,不影响日志记录,如不希望用户看到可关闭
|
|
112
|
+
showLog: env === 'development',
|
|
113
|
+
// 是否显示多语言
|
|
114
|
+
showI18n: false,
|
|
115
|
+
// 是否支持动态修改布局配置,移动端下会自动强制关闭
|
|
116
|
+
enableSetting: env === 'development',
|
|
117
|
+
// 退出登录时,是否二次确认
|
|
118
|
+
logoutConfirm: true,
|
|
119
|
+
// 是否根据操作系统缩放比例,自动调整比例
|
|
120
|
+
autoFixRatio: true,
|
|
121
|
+
// 是否允许点击遮罩层关闭
|
|
122
|
+
maskClosable: true,
|
|
123
|
+
// 是否允许拖动
|
|
124
|
+
draggable: true
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* 多页 Tabs
|
|
128
|
+
* */
|
|
129
|
+
page: {
|
|
130
|
+
// 默认打开的页签
|
|
131
|
+
opened: [],
|
|
132
|
+
// 登录时是否加载上次打开的页签
|
|
133
|
+
loadOpenedTabs: true
|
|
134
|
+
},
|
|
135
|
+
// /**
|
|
136
|
+
// * 徽标配置
|
|
137
|
+
// * */
|
|
138
|
+
// badge: {
|
|
139
|
+
// // 侧边菜单徽标
|
|
140
|
+
// siderMenuBadge: [
|
|
141
|
+
// {
|
|
142
|
+
// path: '/dashboard/monitor',
|
|
143
|
+
// count: 1
|
|
144
|
+
// },
|
|
145
|
+
// {
|
|
146
|
+
// path: '/system',
|
|
147
|
+
// text: 'New',
|
|
148
|
+
// type: 'warning'
|
|
149
|
+
// },
|
|
150
|
+
// {
|
|
151
|
+
// path: '/list',
|
|
152
|
+
// color: 'cyan'
|
|
153
|
+
// },
|
|
154
|
+
// {
|
|
155
|
+
// path: '/list/table-list',
|
|
156
|
+
// color: 'cyan'
|
|
157
|
+
// }
|
|
158
|
+
// ],
|
|
159
|
+
// // 顶栏菜单徽标
|
|
160
|
+
// headerMenuBadge: []
|
|
161
|
+
// },
|
|
162
|
+
/**
|
|
163
|
+
* 水印配置
|
|
164
|
+
* */
|
|
165
|
+
waterMark: {
|
|
166
|
+
// 是否显示
|
|
167
|
+
show: true,
|
|
168
|
+
// 初始显示文案,可以通过 vuex 随时更新
|
|
169
|
+
text: 'Admin Plus',
|
|
170
|
+
// 水印配置
|
|
171
|
+
options: {}
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* 功能配置
|
|
175
|
+
* */
|
|
176
|
+
// 相同路由,不同参数间进行切换,是否强力更新
|
|
177
|
+
sameRouteForceUpdate: false
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const copyTo = (source, target) => {
|
|
181
|
+
for (let key in source) {
|
|
182
|
+
if (typeof source[key] === 'object') {
|
|
183
|
+
if (target[key] == null) {
|
|
184
|
+
target[key] = {};
|
|
185
|
+
}
|
|
186
|
+
copyTo(source[key], target[key]);
|
|
187
|
+
} else {
|
|
188
|
+
target[key] = source[key];
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
let localSetting = window.setting;
|
|
194
|
+
|
|
195
|
+
if (localSetting) {
|
|
196
|
+
copyTo(localSetting, Setting);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// API地址
|
|
200
|
+
Setting.apiBaseURL = process.env.NODE_ENV === 'development' ? Setting.apiBaseURL.dev : Setting.apiBaseURL.prd;
|
|
201
|
+
|
|
202
|
+
export default Setting;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 该文件启用 `@/store/index.js` 导入所有 vuex 模块。
|
|
3
|
+
* 这个文件是一次性创建的,不应该被修改。
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const files = import.meta.globEager('./modules/*.js');
|
|
7
|
+
const modules = {};
|
|
8
|
+
|
|
9
|
+
Object.keys(files).forEach(key => {
|
|
10
|
+
modules[key.replace(/(\.\/modules\/|\.js)/g, '')] = files[key].default;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
namespaced: true,
|
|
15
|
+
modules
|
|
16
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 注册、登录、注销
|
|
3
|
+
* */
|
|
4
|
+
import util from '../../../../libs/util';
|
|
5
|
+
import router from '../../../../router';
|
|
6
|
+
import userApi from '../../../../api/user';
|
|
7
|
+
import swal from 'sweetalert2';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
namespaced: true,
|
|
11
|
+
actions: {
|
|
12
|
+
/**
|
|
13
|
+
* @description 登录
|
|
14
|
+
* @param {Object} context
|
|
15
|
+
* @param username {String} 用户账号
|
|
16
|
+
* @param password {String} 密码
|
|
17
|
+
* @param param route {Object} 登录成功后定向的路由对象 任何 vue-router 支持的格式
|
|
18
|
+
*/
|
|
19
|
+
login({ dispatch }, { username = '', password = '' } = {}) {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
userApi
|
|
22
|
+
.login({
|
|
23
|
+
account: username,
|
|
24
|
+
password
|
|
25
|
+
})
|
|
26
|
+
.then(async res => {
|
|
27
|
+
// 设置 cookie 一定要存 uuid 和 token 两个 cookie
|
|
28
|
+
// 整个系统依赖这两个数据进行校验和存储
|
|
29
|
+
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
|
|
30
|
+
// token 代表用户当前登录状态 建议在网络请求中携带 token
|
|
31
|
+
// 如有必要 token 需要定时更新,默认保存一天,可在 setting.js 中修改
|
|
32
|
+
// 如果你的 token 不是通过 cookie 携带,而是普通字段,也可视情况存储在 localStorage
|
|
33
|
+
util.cookies.set('uuid', res.user.id);
|
|
34
|
+
util.cookies.set('token', res.token);
|
|
35
|
+
// 设置 vuex 用户信息
|
|
36
|
+
await dispatch('admin/user/set', res.user, { root: true });
|
|
37
|
+
await dispatch('admin/user/setData', res.data, { root: true });
|
|
38
|
+
// 用户登录后从持久化数据加载一系列的设置
|
|
39
|
+
await dispatch('load');
|
|
40
|
+
// 获取动态菜单
|
|
41
|
+
await dispatch('admin/menu/getMenuList', false, { root: true });
|
|
42
|
+
// 结束
|
|
43
|
+
resolve(res);
|
|
44
|
+
})
|
|
45
|
+
.catch(err => {
|
|
46
|
+
// console.log('err: ', err);
|
|
47
|
+
reject(err);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* @description 退出登录
|
|
53
|
+
* */
|
|
54
|
+
logout({ dispatch }, { confirm = false } = {}) {
|
|
55
|
+
async function logout() {
|
|
56
|
+
// 删除cookie
|
|
57
|
+
util.cookies.remove('token');
|
|
58
|
+
util.cookies.remove('uuid');
|
|
59
|
+
// 清空 vuex 用户信息
|
|
60
|
+
await dispatch('admin/user/set', {}, { root: true });
|
|
61
|
+
// 跳转路由
|
|
62
|
+
router.push({
|
|
63
|
+
name: 'login'
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (confirm) {
|
|
68
|
+
swal
|
|
69
|
+
.fire({
|
|
70
|
+
title: '确定要退出吗?\r\nAre you sure to logout?',
|
|
71
|
+
icon: 'question',
|
|
72
|
+
showCancelButton: true,
|
|
73
|
+
confirmButtonText: '确定 OK',
|
|
74
|
+
confirmButtonColor: '#2d8cf0',
|
|
75
|
+
cancelButtonText: '取消 Cancel'
|
|
76
|
+
})
|
|
77
|
+
.then(result => {
|
|
78
|
+
if (result.value) {
|
|
79
|
+
logout();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
logout();
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* @description 用户登录后从持久化数据加载一系列的设置
|
|
88
|
+
* @param {Object} state vuex state
|
|
89
|
+
* @param {Object} dispatch vuex dispatch
|
|
90
|
+
* @param {Object} loadOpenedTabs 是否加载页签信息
|
|
91
|
+
*/
|
|
92
|
+
load({ dispatch }, { loadOpenedTabs = true } = {}) {
|
|
93
|
+
return new Promise(async resolve => {
|
|
94
|
+
// 加载用户登录信息
|
|
95
|
+
await dispatch('admin/user/load', null, { root: true });
|
|
96
|
+
// 持久化数据加载上次退出时的多页列表
|
|
97
|
+
await dispatch('admin/page/openedLoad', { loadOpenedTabs }, { root: true });
|
|
98
|
+
// end
|
|
99
|
+
resolve();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|