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,119 @@
|
|
|
1
|
+
import enumApi from '../../../../api/enum';
|
|
2
|
+
import modelApi from '../../../../api/model';
|
|
3
|
+
import userApi from '../../../../api/user';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 缓存信息
|
|
7
|
+
* */
|
|
8
|
+
export default {
|
|
9
|
+
namespaced: true,
|
|
10
|
+
state: {
|
|
11
|
+
// 缓存
|
|
12
|
+
caches: {},
|
|
13
|
+
// 枚举字典信息
|
|
14
|
+
dicts: {},
|
|
15
|
+
// 枚举信息
|
|
16
|
+
enums: {},
|
|
17
|
+
// 用户姓名
|
|
18
|
+
userNames: {}
|
|
19
|
+
},
|
|
20
|
+
getters: {},
|
|
21
|
+
actions: {
|
|
22
|
+
/**
|
|
23
|
+
* @description 加载缓存数据
|
|
24
|
+
* @param {Object} state vuex state
|
|
25
|
+
* @param {*} type 类别
|
|
26
|
+
*/
|
|
27
|
+
async loadCache({ state }, type) {
|
|
28
|
+
if (!(type in state.caches)) {
|
|
29
|
+
state.caches[type] = [];
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
let res = await modelApi.query(type, {});
|
|
33
|
+
|
|
34
|
+
state.caches = {
|
|
35
|
+
...state.caches
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
state.caches[type] = res.data;
|
|
39
|
+
} catch (err) {
|
|
40
|
+
delete state.caches[type];
|
|
41
|
+
throw err;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* @description 加载枚举字典数据
|
|
47
|
+
* @param {Object} state vuex state
|
|
48
|
+
* @param {*} type 类别
|
|
49
|
+
*/
|
|
50
|
+
async loadDict({ state }, type) {
|
|
51
|
+
if (!(type in state.dicts)) {
|
|
52
|
+
state.dicts[type] = {};
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
let res = await modelApi.query('Dict', { type: type });
|
|
56
|
+
state.dicts = {
|
|
57
|
+
...state.dicts
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
res.data.forEach(item => {
|
|
61
|
+
state.dicts[type][item.id] = item.displayName;
|
|
62
|
+
});
|
|
63
|
+
} catch (err) {
|
|
64
|
+
delete state.dicts[type];
|
|
65
|
+
throw err;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* @description 加载枚举数据
|
|
71
|
+
* @param {Object} state vuex state
|
|
72
|
+
* @param {*} type 类别
|
|
73
|
+
*/
|
|
74
|
+
async loadEnum({ state }, type) {
|
|
75
|
+
if (!(type in state.enums)) {
|
|
76
|
+
state.enums[type] = {};
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
let res = await enumApi.query(type);
|
|
80
|
+
state.enums = {
|
|
81
|
+
...state.enums
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
res.forEach(item => {
|
|
85
|
+
state.enums[type][item.id] = item.name;
|
|
86
|
+
});
|
|
87
|
+
} catch (err) {
|
|
88
|
+
delete state.enums[type];
|
|
89
|
+
throw err;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* @description 加载用户姓名数据
|
|
95
|
+
* @param {Object} state vuex state
|
|
96
|
+
* @param {*} id 唯一编号
|
|
97
|
+
*/
|
|
98
|
+
async loadUserName({ state }, id) {
|
|
99
|
+
if (id && !(id in state.userNames)) {
|
|
100
|
+
state.userNames[id] = {};
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
let res = await userApi.get(id);
|
|
104
|
+
|
|
105
|
+
if (res) {
|
|
106
|
+
state.userNames = {
|
|
107
|
+
...state.userNames
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
state.userNames[id] = res.name;
|
|
111
|
+
}
|
|
112
|
+
} catch (err) {
|
|
113
|
+
delete state.userNames[id];
|
|
114
|
+
throw err;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import dataViewApi from '../../../../api/dataView';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 缓存信息
|
|
5
|
+
* */
|
|
6
|
+
export default {
|
|
7
|
+
namespaced: true,
|
|
8
|
+
state: {
|
|
9
|
+
// 数据视图
|
|
10
|
+
dataViews: {},
|
|
11
|
+
// 数据结构
|
|
12
|
+
schemas: {}
|
|
13
|
+
},
|
|
14
|
+
getters: {
|
|
15
|
+
get: state => code => {
|
|
16
|
+
return state.dataViews[code];
|
|
17
|
+
},
|
|
18
|
+
getSchema: state => model => {
|
|
19
|
+
return state.schemas[model];
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
actions: {
|
|
23
|
+
/**
|
|
24
|
+
* @description 加载数据视图
|
|
25
|
+
* @param {Object} state vuex state
|
|
26
|
+
* @param {*} code 代码
|
|
27
|
+
*/
|
|
28
|
+
async load({ state }, code) {
|
|
29
|
+
if (!(code in state.dataViews)) {
|
|
30
|
+
let res = await dataViewApi.getByCode(code);
|
|
31
|
+
state.dataViews[code] = res;
|
|
32
|
+
|
|
33
|
+
return res;
|
|
34
|
+
} else {
|
|
35
|
+
return state.dataViews[code];
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* @description 加载数据结构
|
|
40
|
+
* @param {Object} state vuex state
|
|
41
|
+
* @param {*} model 模型
|
|
42
|
+
*/
|
|
43
|
+
async loadSchema({ state }, model) {
|
|
44
|
+
if (!(model in state.schemas)) {
|
|
45
|
+
let res = await dataViewApi.getSchemaByModel(model);
|
|
46
|
+
state.schemas[model] = res;
|
|
47
|
+
|
|
48
|
+
return res;
|
|
49
|
+
} else {
|
|
50
|
+
return state.schemas[model];
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* @description 重置数据视图
|
|
55
|
+
* @param {Object} state vuex state
|
|
56
|
+
* @param {*} code 代码
|
|
57
|
+
*/
|
|
58
|
+
async reset({ state }, code) {
|
|
59
|
+
let res = await dataViewApi.reset(code);
|
|
60
|
+
state.dataViews[code] = res;
|
|
61
|
+
|
|
62
|
+
return res;
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* @description 保存数据视图
|
|
66
|
+
* @param {Object} state vuex state
|
|
67
|
+
* @param {*} code 代码
|
|
68
|
+
* @param {*} columns 字段
|
|
69
|
+
*/
|
|
70
|
+
async save({ state }, { code, columns }) {
|
|
71
|
+
let res = await dataViewApi.save(code, columns);
|
|
72
|
+
state.dataViews[code] = res;
|
|
73
|
+
|
|
74
|
+
return res;
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* @description 保存用户数据视图
|
|
78
|
+
* @param {Object} state vuex state
|
|
79
|
+
* @param {*} code 代码
|
|
80
|
+
* @param {*} columns 字段
|
|
81
|
+
*/
|
|
82
|
+
async saveUserView({ state }, { code, columns }) {
|
|
83
|
+
let res = await dataViewApi.saveUserView(code, columns);
|
|
84
|
+
state.dataViews[code] = res;
|
|
85
|
+
|
|
86
|
+
return res;
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* @description 保存筛选字段
|
|
90
|
+
* @param {Object} state vuex state
|
|
91
|
+
* @param {*} code 代码
|
|
92
|
+
* @param {*} columns 字段
|
|
93
|
+
*/
|
|
94
|
+
async saveFilterColumn({ state }, { code, columns }) {
|
|
95
|
+
let res = await dataViewApi.saveFilterColumn(code, columns);
|
|
96
|
+
state.dataViews[code] = res;
|
|
97
|
+
|
|
98
|
+
return res;
|
|
99
|
+
},
|
|
100
|
+
/**
|
|
101
|
+
* @description 保存数据视图设置
|
|
102
|
+
* @param {Object} state vuex state
|
|
103
|
+
* @param {*} dataView 数据视图
|
|
104
|
+
*/
|
|
105
|
+
async saveSetting({ state }, dataView) {
|
|
106
|
+
let res = await dataViewApi.saveSetting(dataView);
|
|
107
|
+
state.dataViews[dataView.code] = res;
|
|
108
|
+
|
|
109
|
+
return res;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 持久化存储
|
|
3
|
+
* 一般情况下,您无需修改此文件
|
|
4
|
+
* */
|
|
5
|
+
import util from '../../../../libs/util';
|
|
6
|
+
import router from '../../../../router';
|
|
7
|
+
import { cloneDeep } from 'lodash';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @description 检查路径是否存在 不存在的话初始化
|
|
11
|
+
* @param {Object} dbName {String} 数据库名称
|
|
12
|
+
* @param {Object} path {String} 路径
|
|
13
|
+
* @param {Object} user {Boolean} 区分用户
|
|
14
|
+
* @param {Object} validator {Function} 数据校验钩子 返回 true 表示验证通过
|
|
15
|
+
* @param {Object} defaultValue {*} 初始化默认值
|
|
16
|
+
* @returns {String} 可以直接使用的路径
|
|
17
|
+
*/
|
|
18
|
+
function pathInit({ dbName = 'database', path = '', user = true, validator = () => true, defaultValue = '' }) {
|
|
19
|
+
const uuid = util.cookies.get('uuid') || 'ghost-uuid';
|
|
20
|
+
const currentPath = `${dbName}.${user ? `user.${uuid}` : 'public'}${path ? `.${path}` : ''}`;
|
|
21
|
+
const value = util.db.get(currentPath).value();
|
|
22
|
+
|
|
23
|
+
if (!(value !== undefined && validator(value))) {
|
|
24
|
+
util.db.set(currentPath, defaultValue).write();
|
|
25
|
+
}
|
|
26
|
+
return currentPath;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { pathInit };
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
namespaced: true,
|
|
33
|
+
actions: {
|
|
34
|
+
/**
|
|
35
|
+
* @description 将数据存储到指定位置 | 路径不存在会自动初始化
|
|
36
|
+
* @description 效果类似于取值 dbName.path = value
|
|
37
|
+
* @param context context
|
|
38
|
+
* @param {Object} dbName {String} 数据库名称
|
|
39
|
+
* @param {Object} path {String} 存储路径
|
|
40
|
+
* @param {Object} value {*} 需要存储的值
|
|
41
|
+
* @param {Object} user {Boolean} 是否区分用户
|
|
42
|
+
*/
|
|
43
|
+
set(context, { dbName = 'database', path = '', value = '', user = false }) {
|
|
44
|
+
util.db
|
|
45
|
+
.set(
|
|
46
|
+
pathInit({
|
|
47
|
+
dbName,
|
|
48
|
+
path,
|
|
49
|
+
user
|
|
50
|
+
}),
|
|
51
|
+
value
|
|
52
|
+
)
|
|
53
|
+
.write();
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* @description 获取数据
|
|
57
|
+
* @description 效果类似于取值 dbName.path || defaultValue
|
|
58
|
+
* @param context context
|
|
59
|
+
* @param {Object} dbName {String} 数据库名称
|
|
60
|
+
* @param {Object} path {String} 存储路径
|
|
61
|
+
* @param {Object} defaultValue {*} 取值失败的默认值
|
|
62
|
+
* @param {Object} user {Boolean} 是否区分用户
|
|
63
|
+
*/
|
|
64
|
+
get(context, { dbName = 'database', path = '', defaultValue = '', user = false }) {
|
|
65
|
+
return new Promise(resolve => {
|
|
66
|
+
resolve(
|
|
67
|
+
cloneDeep(
|
|
68
|
+
util.db
|
|
69
|
+
.get(
|
|
70
|
+
pathInit({
|
|
71
|
+
dbName,
|
|
72
|
+
path,
|
|
73
|
+
user,
|
|
74
|
+
defaultValue
|
|
75
|
+
})
|
|
76
|
+
)
|
|
77
|
+
.value()
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* @description 获取存储数据库对象
|
|
84
|
+
* @param {Object} context context
|
|
85
|
+
* @param {Object} user {Boolean} 是否区分用户
|
|
86
|
+
*/
|
|
87
|
+
database(context, { user = false } = {}) {
|
|
88
|
+
return new Promise(resolve => {
|
|
89
|
+
resolve(
|
|
90
|
+
util.db.get(
|
|
91
|
+
pathInit({
|
|
92
|
+
dbName: 'database',
|
|
93
|
+
path: '',
|
|
94
|
+
user,
|
|
95
|
+
defaultValue: {}
|
|
96
|
+
})
|
|
97
|
+
)
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* @description 清空存储数据库对象
|
|
103
|
+
* @param {Object} context context
|
|
104
|
+
* @param {Object} user {Boolean} 是否区分用户
|
|
105
|
+
*/
|
|
106
|
+
databaseClear(context, { user = false } = {}) {
|
|
107
|
+
return new Promise(resolve => {
|
|
108
|
+
resolve(
|
|
109
|
+
util.db.get(
|
|
110
|
+
pathInit({
|
|
111
|
+
dbName: 'database',
|
|
112
|
+
path: '',
|
|
113
|
+
user,
|
|
114
|
+
validator: () => false,
|
|
115
|
+
defaultValue: {}
|
|
116
|
+
})
|
|
117
|
+
)
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* @description 获取存储数据库对象 [ 区分页面 ]
|
|
123
|
+
* @param {Object} context context
|
|
124
|
+
* @param {Object} basis {String} 页面区分依据 [ name | path | fullPath ]
|
|
125
|
+
* @param {Object} user {Boolean} 是否区分用户
|
|
126
|
+
*/
|
|
127
|
+
databasePage(context, { basis = 'fullPath', user = false } = {}) {
|
|
128
|
+
return new Promise(resolve => {
|
|
129
|
+
resolve(
|
|
130
|
+
util.db.get(
|
|
131
|
+
pathInit({
|
|
132
|
+
dbName: 'database',
|
|
133
|
+
path: `$page.${router.app.$route[basis]}`,
|
|
134
|
+
user,
|
|
135
|
+
defaultValue: {}
|
|
136
|
+
})
|
|
137
|
+
)
|
|
138
|
+
);
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* @description 清空存储数据库对象 [ 区分页面 ]
|
|
143
|
+
* @param {Object} context context
|
|
144
|
+
* @param {Object} basis {String} 页面区分依据 [ name | path | fullPath ]
|
|
145
|
+
* @param {Object} user {Boolean} 是否区分用户
|
|
146
|
+
*/
|
|
147
|
+
databasePageClear(context, { basis = 'fullPath', user = false } = {}) {
|
|
148
|
+
return new Promise(resolve => {
|
|
149
|
+
resolve(
|
|
150
|
+
util.db.get(
|
|
151
|
+
pathInit({
|
|
152
|
+
dbName: 'database',
|
|
153
|
+
path: `$page.${router.app.$route[basis]}`,
|
|
154
|
+
user,
|
|
155
|
+
validator: () => false,
|
|
156
|
+
defaultValue: {}
|
|
157
|
+
})
|
|
158
|
+
)
|
|
159
|
+
);
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
/**
|
|
163
|
+
* @description 快速将页面当前的数据 ( $data ) 持久化
|
|
164
|
+
* @param {Object} context context
|
|
165
|
+
* @param {Object} instance {Object} vue 实例
|
|
166
|
+
* @param {Object} basis {String} 页面区分依据 [ name | path | fullPath ]
|
|
167
|
+
* @param {Object} user {Boolean} 是否区分用户
|
|
168
|
+
*/
|
|
169
|
+
pageSet(context, { instance, basis = 'fullPath', user = false }) {
|
|
170
|
+
return new Promise(resolve => {
|
|
171
|
+
resolve(
|
|
172
|
+
util.db.get(
|
|
173
|
+
pathInit({
|
|
174
|
+
dbName: 'database',
|
|
175
|
+
path: `$page.${router.app.$route[basis]}.$data`,
|
|
176
|
+
user,
|
|
177
|
+
validator: () => false,
|
|
178
|
+
defaultValue: cloneDeep(instance.$data)
|
|
179
|
+
})
|
|
180
|
+
)
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
/**
|
|
185
|
+
* @description 快速获取页面快速持久化的数据
|
|
186
|
+
* @param {Object} context context
|
|
187
|
+
* @param {Object} instance {Object} vue 实例
|
|
188
|
+
* @param {Object} basis {String} 页面区分依据 [ name | path | fullPath ]
|
|
189
|
+
* @param {Object} user {Boolean} 是否区分用户
|
|
190
|
+
*/
|
|
191
|
+
pageGet(context, { instance, basis = 'fullPath', user = false }) {
|
|
192
|
+
return new Promise(resolve => {
|
|
193
|
+
resolve(
|
|
194
|
+
cloneDeep(
|
|
195
|
+
util.db
|
|
196
|
+
.get(
|
|
197
|
+
pathInit({
|
|
198
|
+
dbName: 'database',
|
|
199
|
+
path: `$page.${router.app.$route[basis]}.$data`,
|
|
200
|
+
user,
|
|
201
|
+
defaultValue: cloneDeep(instance.$data)
|
|
202
|
+
})
|
|
203
|
+
)
|
|
204
|
+
.value()
|
|
205
|
+
)
|
|
206
|
+
);
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
/**
|
|
210
|
+
* @description 清空页面快照
|
|
211
|
+
* @param {Object} context context
|
|
212
|
+
* @param {Object} basis {String} 页面区分依据 [ name | path | fullPath ]
|
|
213
|
+
* @param {Object} user {Boolean} 是否区分用户
|
|
214
|
+
*/
|
|
215
|
+
pageClear(context, { basis = 'fullPath', user = false }) {
|
|
216
|
+
return new Promise(resolve => {
|
|
217
|
+
resolve(
|
|
218
|
+
util.db.get(
|
|
219
|
+
pathInit({
|
|
220
|
+
dbName: 'database',
|
|
221
|
+
path: `$page.${router.app.$route[basis]}.$data`,
|
|
222
|
+
user,
|
|
223
|
+
validator: () => false,
|
|
224
|
+
defaultValue: {}
|
|
225
|
+
})
|
|
226
|
+
)
|
|
227
|
+
);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 多语言
|
|
3
|
+
* */
|
|
4
|
+
import Languages from '../../../../i18n/locale';
|
|
5
|
+
import Setting from '../../../../setting';
|
|
6
|
+
import util from '../../../../libs/util';
|
|
7
|
+
import { pathInit } from '../../../../store/modules/admin/modules/db';
|
|
8
|
+
|
|
9
|
+
const savedLocaleKey = 'i18n-locale';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
namespaced: true,
|
|
13
|
+
state: {
|
|
14
|
+
locale: ''
|
|
15
|
+
},
|
|
16
|
+
actions: {
|
|
17
|
+
/**
|
|
18
|
+
* @description 获取当前语言
|
|
19
|
+
* */
|
|
20
|
+
getLocale({ state }) {
|
|
21
|
+
let locale;
|
|
22
|
+
|
|
23
|
+
const db = util.db.get(
|
|
24
|
+
pathInit({
|
|
25
|
+
dbName: 'database',
|
|
26
|
+
path: '',
|
|
27
|
+
user: true,
|
|
28
|
+
defaultValue: {}
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const savedLocale = db.get(savedLocaleKey).value();
|
|
33
|
+
|
|
34
|
+
// 先判断本地存储是否已有语言选择
|
|
35
|
+
if (savedLocale) {
|
|
36
|
+
locale = savedLocale;
|
|
37
|
+
} else {
|
|
38
|
+
// 判断是否开启自动识别语言
|
|
39
|
+
if (Setting.i18n.auto) {
|
|
40
|
+
// 如果自动识别的语言,本地没有该语言包,则设置为默认语言
|
|
41
|
+
const navLang = navigator.language;
|
|
42
|
+
if (Languages[navLang]) {
|
|
43
|
+
locale = navLang;
|
|
44
|
+
} else {
|
|
45
|
+
locale = Setting.i18n.default;
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
locale = Setting.i18n.default;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 将初次的语言保存在本地
|
|
52
|
+
db.set(savedLocaleKey, locale).write();
|
|
53
|
+
}
|
|
54
|
+
state.locale = locale;
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* @description 设置当前语言
|
|
58
|
+
* */
|
|
59
|
+
setLocale({ state }, { locale = Setting.i18n.default, vm }) {
|
|
60
|
+
const db = util.db.get(
|
|
61
|
+
pathInit({
|
|
62
|
+
dbName: 'database',
|
|
63
|
+
path: '',
|
|
64
|
+
user: true,
|
|
65
|
+
defaultValue: {}
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
// 将语言保存在本地
|
|
70
|
+
db.set(savedLocaleKey, locale).write();
|
|
71
|
+
|
|
72
|
+
// 判断是否刷新页面
|
|
73
|
+
if (Setting.i18n.refresh) {
|
|
74
|
+
location.reload();
|
|
75
|
+
} else {
|
|
76
|
+
// 设置当前语言
|
|
77
|
+
state.locale = locale;
|
|
78
|
+
// 设置 vue-i18n 的语言
|
|
79
|
+
vm.$i18n.locale = locale;
|
|
80
|
+
// 更新网页标题
|
|
81
|
+
util.title({
|
|
82
|
+
title: vm.$route.meta.title
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 布局配置
|
|
3
|
+
* */
|
|
4
|
+
import screenfull from 'screenfull';
|
|
5
|
+
|
|
6
|
+
import Setting from '../../../../setting';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
namespaced: true,
|
|
10
|
+
state: {
|
|
11
|
+
...Setting.layout,
|
|
12
|
+
isMobile: false, // 是否为手机
|
|
13
|
+
isTablet: false, // 是否为平板
|
|
14
|
+
isDesktop: true, // 是否为桌面
|
|
15
|
+
isFullscreen: false, // 是否切换到了全屏
|
|
16
|
+
bodyHeight: 0,
|
|
17
|
+
waterMark: Setting.waterMark
|
|
18
|
+
},
|
|
19
|
+
mutations: {
|
|
20
|
+
/**
|
|
21
|
+
* @description 设置设备类型
|
|
22
|
+
* @param {Object} state vuex state
|
|
23
|
+
* @param {String} type 设备类型,可选值为 Mobile、Tablet、Desktop
|
|
24
|
+
*/
|
|
25
|
+
setDevice(state, type) {
|
|
26
|
+
state.isMobile = false;
|
|
27
|
+
state.isTablet = false;
|
|
28
|
+
state.isDesktop = false;
|
|
29
|
+
state[`is${type}`] = true;
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* @description 修改 menuCollapse
|
|
33
|
+
* @param {Object} state vuex state
|
|
34
|
+
* @param {Boolean} collapse 折叠状态
|
|
35
|
+
* */
|
|
36
|
+
updateMenuCollapse(state, collapse) {
|
|
37
|
+
state.menuCollapse = collapse;
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* @description 设置全屏状态
|
|
41
|
+
* @param {Object} state vuex state
|
|
42
|
+
* @param {Boolean} isFullscreen vuex
|
|
43
|
+
* */
|
|
44
|
+
setFullscreen(state, isFullscreen) {
|
|
45
|
+
state.isFullscreen = isFullscreen;
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* @description 更改指定布局配置
|
|
49
|
+
* @param {Object} state vuex state
|
|
50
|
+
* @param {Object} key layout 名称,对应 Setting.layout
|
|
51
|
+
* @param {Object} value layout 值
|
|
52
|
+
* */
|
|
53
|
+
updateLayoutSetting(state, { key, value }) {
|
|
54
|
+
state[key] = value;
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* @description 更新页面高度
|
|
58
|
+
* */
|
|
59
|
+
setBodyHeight(state, height) {
|
|
60
|
+
state.bodyHeight = height;
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* @description 更新水印显示状态
|
|
64
|
+
* */
|
|
65
|
+
updateWaterMarkStatus(state, status) {
|
|
66
|
+
state.waterMark.show = status;
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* @description 更新水印文本
|
|
70
|
+
* */
|
|
71
|
+
updateWaterMarkText(state, text) {
|
|
72
|
+
state.waterMark.text = text;
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* @description 更新水印配置
|
|
76
|
+
* */
|
|
77
|
+
updateWaterMarkOptions(state, options) {
|
|
78
|
+
state.waterMark.options = options;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
actions: {
|
|
82
|
+
/**
|
|
83
|
+
* @description 初始化监听全屏状态
|
|
84
|
+
*/
|
|
85
|
+
listenFullscreen({ commit }) {
|
|
86
|
+
return new Promise(resolve => {
|
|
87
|
+
if (screenfull.enabled) {
|
|
88
|
+
screenfull.on('change', () => {
|
|
89
|
+
if (!screenfull.isFullscreen) {
|
|
90
|
+
commit('setFullscreen', false);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
// end
|
|
95
|
+
resolve();
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* @description 切换全屏
|
|
100
|
+
*/
|
|
101
|
+
toggleFullscreen({ commit }) {
|
|
102
|
+
return new Promise(resolve => {
|
|
103
|
+
if (screenfull.isFullscreen) {
|
|
104
|
+
screenfull.exit();
|
|
105
|
+
commit('setFullscreen', false);
|
|
106
|
+
} else {
|
|
107
|
+
screenfull.request();
|
|
108
|
+
commit('setFullscreen', true);
|
|
109
|
+
}
|
|
110
|
+
// end
|
|
111
|
+
resolve();
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 遮罩层
|
|
3
|
+
* */
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
namespaced: true,
|
|
7
|
+
state: {
|
|
8
|
+
count: 0, // 计数
|
|
9
|
+
enabled: true, // 启用
|
|
10
|
+
isLoading: false // 加载中
|
|
11
|
+
},
|
|
12
|
+
mutations: {
|
|
13
|
+
/**
|
|
14
|
+
* @description 开始加载
|
|
15
|
+
* @param {Object} state vuex state
|
|
16
|
+
*/
|
|
17
|
+
start(state) {
|
|
18
|
+
state.count++;
|
|
19
|
+
state.isLoading = true;
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* @description 加载结束
|
|
23
|
+
* @param {Object} state vuex state
|
|
24
|
+
* */
|
|
25
|
+
end(state) {
|
|
26
|
+
state.count--;
|
|
27
|
+
state.isLoading = state.count > 0;
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* @description 禁用遮罩层
|
|
31
|
+
* @param {Object} state vuex state
|
|
32
|
+
* */
|
|
33
|
+
disable(state) {
|
|
34
|
+
state.enabled = false;
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* @description 启用遮罩层
|
|
38
|
+
* @param {Object} state vuex state
|
|
39
|
+
* */
|
|
40
|
+
enable(state) {
|
|
41
|
+
state.enabled = true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|