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,643 @@
|
|
|
1
|
+
import util from '../libs/util';
|
|
2
|
+
import router from '../router';
|
|
3
|
+
import { mapState, mapActions } from 'vuex';
|
|
4
|
+
import dateFormat from 'date-fns/format';
|
|
5
|
+
import Setting from '../setting';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 页面公共混合
|
|
9
|
+
* */
|
|
10
|
+
export default {
|
|
11
|
+
data() {
|
|
12
|
+
return {
|
|
13
|
+
grid4: {
|
|
14
|
+
xxl: 4,
|
|
15
|
+
xl: 4,
|
|
16
|
+
lg: 4,
|
|
17
|
+
md: 6,
|
|
18
|
+
sm: 12,
|
|
19
|
+
xs: 24
|
|
20
|
+
},
|
|
21
|
+
grid6: {
|
|
22
|
+
xxl: 6,
|
|
23
|
+
xl: 6,
|
|
24
|
+
lg: 8,
|
|
25
|
+
md: 12,
|
|
26
|
+
sm: 12,
|
|
27
|
+
xs: 24
|
|
28
|
+
},
|
|
29
|
+
grid8: {
|
|
30
|
+
xxl: 8,
|
|
31
|
+
xl: 8,
|
|
32
|
+
lg: 8,
|
|
33
|
+
md: 12,
|
|
34
|
+
sm: 24,
|
|
35
|
+
xs: 24
|
|
36
|
+
},
|
|
37
|
+
grid12: {
|
|
38
|
+
xxl: 12,
|
|
39
|
+
xl: 12,
|
|
40
|
+
lg: 12,
|
|
41
|
+
md: 12,
|
|
42
|
+
sm: 24,
|
|
43
|
+
xs: 24
|
|
44
|
+
},
|
|
45
|
+
grid16: {
|
|
46
|
+
xxl: 16,
|
|
47
|
+
xl: 16,
|
|
48
|
+
lg: 16,
|
|
49
|
+
md: 24,
|
|
50
|
+
sm: 24,
|
|
51
|
+
xs: 24
|
|
52
|
+
},
|
|
53
|
+
grid18: {
|
|
54
|
+
xxl: 18,
|
|
55
|
+
xl: 18,
|
|
56
|
+
lg: 18,
|
|
57
|
+
md: 24,
|
|
58
|
+
sm: 24,
|
|
59
|
+
xs: 24
|
|
60
|
+
},
|
|
61
|
+
grid24: {
|
|
62
|
+
xxl: 24,
|
|
63
|
+
xl: 24,
|
|
64
|
+
lg: 24,
|
|
65
|
+
md: 24,
|
|
66
|
+
sm: 24,
|
|
67
|
+
xs: 24
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
computed: {
|
|
72
|
+
...mapState('admin/user', ['info']),
|
|
73
|
+
...mapState('admin/cache', ['userNames', 'enums', 'dicts', 'caches']),
|
|
74
|
+
...mapState('admin/menu', ['userPermissions']),
|
|
75
|
+
rootPath() {
|
|
76
|
+
return Setting.rootPath;
|
|
77
|
+
},
|
|
78
|
+
sysInfo() {
|
|
79
|
+
return Setting.info;
|
|
80
|
+
},
|
|
81
|
+
layout() {
|
|
82
|
+
return Setting.layout;
|
|
83
|
+
},
|
|
84
|
+
apiBaseURL() {
|
|
85
|
+
return Setting.apiBaseURL;
|
|
86
|
+
},
|
|
87
|
+
uploadURL() {
|
|
88
|
+
return Setting.apiBaseURL + 'api/Attachment/add';
|
|
89
|
+
},
|
|
90
|
+
uploadHeaders() {
|
|
91
|
+
const token = util.cookies.get('token');
|
|
92
|
+
return {
|
|
93
|
+
Authorization: 'Bearer ' + token
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
methods: {
|
|
98
|
+
...mapActions('admin/cache', ['loadEnum', 'loadDict', 'loadUserName', 'loadCache']),
|
|
99
|
+
copy(model) {
|
|
100
|
+
return JSON.parse(JSON.stringify(model));
|
|
101
|
+
},
|
|
102
|
+
allow(key) {
|
|
103
|
+
if (key.startsWith('permission/')) {
|
|
104
|
+
// 全局权限
|
|
105
|
+
return this.userPermissions[key];
|
|
106
|
+
} else {
|
|
107
|
+
// 页面权限点
|
|
108
|
+
//console.log('router.currentRoute', router.currentRoute.value.fullPath);
|
|
109
|
+
let url = router.currentRoute.value.fullPath.substr(1);
|
|
110
|
+
|
|
111
|
+
if (this.userPermissions[url + '$' + key] == true) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
let count = Object.keys(this.userPermissions).filter(item => item.startsWith(url + '$')).length;
|
|
116
|
+
|
|
117
|
+
// 未分权限点
|
|
118
|
+
if (this.userPermissions[url] == true && count == 0) {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
getCache(type, id) {
|
|
126
|
+
this.loadCache(type);
|
|
127
|
+
return this.caches[type].find(x => x.id == id);
|
|
128
|
+
},
|
|
129
|
+
getCacheList(type) {
|
|
130
|
+
this.loadCache(type);
|
|
131
|
+
return this.caches[type];
|
|
132
|
+
},
|
|
133
|
+
getEnum(type, id) {
|
|
134
|
+
this.loadEnum(type);
|
|
135
|
+
return this.enums[type][id];
|
|
136
|
+
},
|
|
137
|
+
getEnumList(type) {
|
|
138
|
+
this.loadEnum(type);
|
|
139
|
+
return Object.keys(this.enums[type]).map(key => {
|
|
140
|
+
return {
|
|
141
|
+
id: key,
|
|
142
|
+
name: this.enums[type][key]
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
getDict(type, id) {
|
|
147
|
+
this.loadDict(type);
|
|
148
|
+
return this.dicts[type][id];
|
|
149
|
+
},
|
|
150
|
+
getDictList(type) {
|
|
151
|
+
this.loadDict(type);
|
|
152
|
+
return Object.keys(this.dicts[type]).map(key => {
|
|
153
|
+
return {
|
|
154
|
+
id: key,
|
|
155
|
+
name: this.dicts[type][key]
|
|
156
|
+
};
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
getUserName(id) {
|
|
160
|
+
this.loadUserName(id);
|
|
161
|
+
return this.userNames[id];
|
|
162
|
+
},
|
|
163
|
+
// 附件
|
|
164
|
+
getAttachmentUrl(file, name) {
|
|
165
|
+
if (file) {
|
|
166
|
+
return this.apiBaseURL + 'api/Attachment/get?file=' + encodeURI(file) + '&name=' + encodeURI(name);
|
|
167
|
+
} else {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
// 文件下载
|
|
172
|
+
fileDownload(file, name) {
|
|
173
|
+
let url = this.getAttachmentUrl(file, name);
|
|
174
|
+
|
|
175
|
+
if (url) {
|
|
176
|
+
window.location.href = url;
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
// 图片路径
|
|
180
|
+
getImgUrl(file) {
|
|
181
|
+
if (file) {
|
|
182
|
+
return this.apiBaseURL + 'api/Attachment/getImage?file=' + encodeURI(file);
|
|
183
|
+
} else {
|
|
184
|
+
return this.rootPath + 'images/no-image.png';
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
// 显示格式化内容
|
|
188
|
+
showData(model, column) {
|
|
189
|
+
let expression = column.code;
|
|
190
|
+
let dataType = column.dataType;
|
|
191
|
+
let format = column.displayFormat;
|
|
192
|
+
let digit = column.digit;
|
|
193
|
+
let fixedDigit = column.fixedDigit;
|
|
194
|
+
|
|
195
|
+
if (!dataType) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (dataType.indexOf('Enum:') === 0) {
|
|
200
|
+
return this.getEnum(dataType.replace('Enum:', ''), this.parseData(model, expression));
|
|
201
|
+
} else if (dataType === 'BigInteger') {
|
|
202
|
+
return this.getUserName(this.parseData(model, expression));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
let value = this.parseData(model, expression);
|
|
206
|
+
|
|
207
|
+
if (value == null) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (dataType === 'DateTime') {
|
|
212
|
+
// 日期
|
|
213
|
+
if (!!(format || '').trim()) {
|
|
214
|
+
return dateFormat(new Date(value), format);
|
|
215
|
+
// return $filter('date')(value, format);
|
|
216
|
+
} else {
|
|
217
|
+
return dateFormat(new Date(value), 'yyyy-MM-dd');
|
|
218
|
+
// return $filter('date')(value, 'yyyy-MM-dd');
|
|
219
|
+
}
|
|
220
|
+
} else if (dataType === 'Decimal' || dataType === 'Float' || dataType === 'Double') {
|
|
221
|
+
value = parseFloat(value);
|
|
222
|
+
|
|
223
|
+
// 千分位
|
|
224
|
+
if (format === 'Money') {
|
|
225
|
+
return this.formatThousand(value.toFixed(2));
|
|
226
|
+
} else if (format === 'Thousand') {
|
|
227
|
+
return this.formatThousand(this.keepDecimal(value, digit, fixedDigit));
|
|
228
|
+
} else if (format === 'Percent') {
|
|
229
|
+
return this.keepDecimal(value, digit, fixedDigit) + '%';
|
|
230
|
+
} else {
|
|
231
|
+
return this.keepDecimal(value, digit, fixedDigit);
|
|
232
|
+
}
|
|
233
|
+
} else if (dataType === 'Boolean') {
|
|
234
|
+
if (format === 'Y') {
|
|
235
|
+
return value ? '<i class="fa fa-check info"></i>' : '';
|
|
236
|
+
} else if (format === 'YN') {
|
|
237
|
+
return value ? '<i class="fa fa-check"></i>' : '<i class="fa fa-times"></i>';
|
|
238
|
+
} else if (format === 'Disabled') {
|
|
239
|
+
return value ? '<i class="fa fa-ban error"></i>' : '';
|
|
240
|
+
} else if (format === 'Valid') {
|
|
241
|
+
return value ? '<i class="fa fa-check success"></i>' : '';
|
|
242
|
+
} else if (format === 'Attention') {
|
|
243
|
+
return value ? '<i class="fa fa-exclamation error"></i>' : '';
|
|
244
|
+
} else {
|
|
245
|
+
return value ? '<i class="fa fa-check info"></i>' : '';
|
|
246
|
+
}
|
|
247
|
+
} else if (dataType === 'String') {
|
|
248
|
+
return value;
|
|
249
|
+
} else {
|
|
250
|
+
return value;
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
// 根据表达式取值
|
|
254
|
+
parseData(model, expression) {
|
|
255
|
+
if (expression == null) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
let keys = expression.split('.');
|
|
260
|
+
let result = model;
|
|
261
|
+
|
|
262
|
+
for (let i = 0; i < keys.length; i++) {
|
|
263
|
+
if (result == null) {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
result = result[keys[i]];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return result;
|
|
270
|
+
},
|
|
271
|
+
// 根据表达式赋值
|
|
272
|
+
setData(model, expression, value) {
|
|
273
|
+
if (expression == null) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
let keys = expression.split('.');
|
|
278
|
+
let target = model;
|
|
279
|
+
|
|
280
|
+
for (let i = 0; i < keys.length; i++) {
|
|
281
|
+
if (i === keys.length - 1) {
|
|
282
|
+
target[keys[i]] = value;
|
|
283
|
+
} else {
|
|
284
|
+
if (!(keys[i] in target) || target[keys[i]] == null) {
|
|
285
|
+
target[keys[i]] = {};
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
target = target[keys[i]];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
//this.$forceUpdate();
|
|
293
|
+
},
|
|
294
|
+
// 根据表达式取值(日期)
|
|
295
|
+
parseDateTimeData(model, expression) {
|
|
296
|
+
let data = this.parseData(model, expression);
|
|
297
|
+
|
|
298
|
+
if (data == null) {
|
|
299
|
+
return '';
|
|
300
|
+
} else {
|
|
301
|
+
return data;
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
// 根据表达式取值(数组)
|
|
305
|
+
parseArrayData(model, expression) {
|
|
306
|
+
let data = [];
|
|
307
|
+
let value = this.parseData(model, expression);
|
|
308
|
+
|
|
309
|
+
if (value != null && value != '') {
|
|
310
|
+
data = JSON.parse(value);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return data;
|
|
314
|
+
},
|
|
315
|
+
// 根据表达式赋值(数组)
|
|
316
|
+
setArrayData(model, expression, value) {
|
|
317
|
+
let data = '';
|
|
318
|
+
if (value != null) {
|
|
319
|
+
data = JSON.stringify(value);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
this.setData(model, expression, data);
|
|
323
|
+
},
|
|
324
|
+
// 根据表达式取值(日期段)
|
|
325
|
+
parseDateRangeData(model, expression) {
|
|
326
|
+
let data = [];
|
|
327
|
+
let value = this.parseData(model, expression);
|
|
328
|
+
|
|
329
|
+
if (value != null && value != '') {
|
|
330
|
+
data = JSON.parse(value);
|
|
331
|
+
data[0] = new Date(data[0]);
|
|
332
|
+
data[1] = new Date(data[1]);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return data;
|
|
336
|
+
},
|
|
337
|
+
// 根据公式获取触发字段
|
|
338
|
+
getTriggers(text) {
|
|
339
|
+
let triggers = [];
|
|
340
|
+
let expression = '';
|
|
341
|
+
|
|
342
|
+
for (let i = 0; i < text.length; i++) {
|
|
343
|
+
if (
|
|
344
|
+
text[i] == ' ' ||
|
|
345
|
+
text[i] == '+' ||
|
|
346
|
+
text[i] == '-' ||
|
|
347
|
+
text[i] == '*' ||
|
|
348
|
+
text[i] == '/' ||
|
|
349
|
+
text[i] == '(' ||
|
|
350
|
+
text[i] == ')' ||
|
|
351
|
+
text[i] == '>' ||
|
|
352
|
+
text[i] == '<' ||
|
|
353
|
+
text[i] == '!' ||
|
|
354
|
+
text[i] == '&' ||
|
|
355
|
+
text[i] == '|' ||
|
|
356
|
+
text[i] == '='
|
|
357
|
+
) {
|
|
358
|
+
if (!!(expression || '').trim()) {
|
|
359
|
+
triggers.push(expression);
|
|
360
|
+
expression = '';
|
|
361
|
+
}
|
|
362
|
+
} else {
|
|
363
|
+
expression += text[i];
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (!!(expression || '').trim()) {
|
|
368
|
+
triggers.push(expression);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
return triggers;
|
|
372
|
+
},
|
|
373
|
+
// 计算列
|
|
374
|
+
calculate(text, model) {
|
|
375
|
+
let result = '';
|
|
376
|
+
let expression = '';
|
|
377
|
+
|
|
378
|
+
for (let i = 0; i < text.length; i++) {
|
|
379
|
+
if (
|
|
380
|
+
text[i] == ' ' ||
|
|
381
|
+
text[i] == '+' ||
|
|
382
|
+
text[i] == '-' ||
|
|
383
|
+
text[i] == '*' ||
|
|
384
|
+
text[i] == '/' ||
|
|
385
|
+
text[i] == '(' ||
|
|
386
|
+
text[i] == ')' ||
|
|
387
|
+
text[i] == '>' ||
|
|
388
|
+
text[i] == '<' ||
|
|
389
|
+
text[i] == '!' ||
|
|
390
|
+
text[i] == '|' ||
|
|
391
|
+
text[i] == '&' ||
|
|
392
|
+
text[i] == '='
|
|
393
|
+
) {
|
|
394
|
+
if (!!(expression || '').trim()) {
|
|
395
|
+
if (!isNaN(expression) || expression.substr(0, 1) == "'" || expression.substr(0, 1) == '"' || expression == 'null') {
|
|
396
|
+
result += expression;
|
|
397
|
+
} else {
|
|
398
|
+
let data = this.parseData(model, expression);
|
|
399
|
+
|
|
400
|
+
if (data == null) {
|
|
401
|
+
result += 'null';
|
|
402
|
+
} else if (isNaN(data)) {
|
|
403
|
+
result += "'" + String(data) + "'";
|
|
404
|
+
} else {
|
|
405
|
+
result += String(data);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
expression = '';
|
|
410
|
+
}
|
|
411
|
+
result += text[i];
|
|
412
|
+
} else {
|
|
413
|
+
expression += text[i];
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (!!(expression || '').trim()) {
|
|
418
|
+
if (!isNaN(expression) || expression.substr(0, 1) == "'" || expression.substr(0, 1) == '"' || expression == 'null') {
|
|
419
|
+
result += expression;
|
|
420
|
+
} else {
|
|
421
|
+
let data = this.parseData(model, expression);
|
|
422
|
+
|
|
423
|
+
if (data == null) {
|
|
424
|
+
result += 'null';
|
|
425
|
+
} else if (isNaN(data)) {
|
|
426
|
+
result += "'" + String(data) + "'";
|
|
427
|
+
} else {
|
|
428
|
+
result += String(data);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
let data = null;
|
|
434
|
+
try {
|
|
435
|
+
console.log('expression', result);
|
|
436
|
+
data = eval(result);
|
|
437
|
+
|
|
438
|
+
if (data != 'NaN' && String(data) == 'NaN') {
|
|
439
|
+
data = null;
|
|
440
|
+
} else if (typeof data == 'number' && (String(data) == 'Infinity' || String(data) == '-Infinity')) {
|
|
441
|
+
data = null;
|
|
442
|
+
}
|
|
443
|
+
} catch (e) {
|
|
444
|
+
//console.log('表达式计算错误', e);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
return data;
|
|
448
|
+
},
|
|
449
|
+
// 根据条件判断
|
|
450
|
+
judgeCondition(setting, model) {
|
|
451
|
+
if (!setting) {
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if (setting.type == 'Condition') {
|
|
456
|
+
// 条件
|
|
457
|
+
for (let i = 0; i < setting.condition.length; i++) {
|
|
458
|
+
let data = this.parseData(model, setting.condition[i].code);
|
|
459
|
+
if (data == null) {
|
|
460
|
+
data = '';
|
|
461
|
+
}
|
|
462
|
+
let value = setting.condition[i].value;
|
|
463
|
+
let operator = setting.condition[i].operator;
|
|
464
|
+
let result = false;
|
|
465
|
+
|
|
466
|
+
if (operator == 'Equal') {
|
|
467
|
+
result = value.split(',').some(item => {
|
|
468
|
+
return String(data) == item;
|
|
469
|
+
});
|
|
470
|
+
} else if (operator == 'Contains') {
|
|
471
|
+
result = value.split(',').some(item => {
|
|
472
|
+
return String(data).indexOf(item) != -1;
|
|
473
|
+
});
|
|
474
|
+
} else if (operator == 'GreaterThan') {
|
|
475
|
+
result = data > value;
|
|
476
|
+
} else if (operator == 'LessThan') {
|
|
477
|
+
result = data < value;
|
|
478
|
+
} else if (operator == 'GreaterThanOrEqual') {
|
|
479
|
+
result = data >= value;
|
|
480
|
+
} else if (operator == 'LessThanOrEqual') {
|
|
481
|
+
result = data <= value;
|
|
482
|
+
} else if (operator == 'NotEqual') {
|
|
483
|
+
result = String(data) != value;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
if (!result) {
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
return true;
|
|
491
|
+
} else if (setting.type == 'Expression') {
|
|
492
|
+
// 表达式
|
|
493
|
+
return this.calculate(setting.expression, model) == true;
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
// 确认框
|
|
497
|
+
confirm(title, onConfirm) {
|
|
498
|
+
let swal = this.$swal.fire({
|
|
499
|
+
title: title,
|
|
500
|
+
icon: 'question',
|
|
501
|
+
showCancelButton: true
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
swal.then(result => {
|
|
505
|
+
if (result.value) {
|
|
506
|
+
if (typeof onConfirm === 'function') {
|
|
507
|
+
onConfirm();
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
return swal;
|
|
513
|
+
},
|
|
514
|
+
// 带输入的确认框
|
|
515
|
+
confirmInput(title, inputLabel, onConfirm, preConfirm) {
|
|
516
|
+
let swal = this.$swal.fire({
|
|
517
|
+
title: title,
|
|
518
|
+
input: 'text',
|
|
519
|
+
inputPlaceholder: inputLabel,
|
|
520
|
+
icon: 'question',
|
|
521
|
+
showCancelButton: true,
|
|
522
|
+
preConfirm: preConfirm
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
swal.then(result => {
|
|
526
|
+
if (result.value) {
|
|
527
|
+
if (typeof onConfirm === 'function') {
|
|
528
|
+
onConfirm();
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
return swal;
|
|
534
|
+
},
|
|
535
|
+
// 成功提示
|
|
536
|
+
success(message, onConfirm) {
|
|
537
|
+
var swal = this.$swal.fire({
|
|
538
|
+
title: message,
|
|
539
|
+
icon: 'success'
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
swal.then(() => {
|
|
543
|
+
if (typeof onConfirm === 'function') {
|
|
544
|
+
onConfirm();
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
return swal;
|
|
549
|
+
},
|
|
550
|
+
// 警告提示
|
|
551
|
+
warning(message, onConfirm) {
|
|
552
|
+
var swal = this.$swal.fire({
|
|
553
|
+
title: message,
|
|
554
|
+
icon: 'warning'
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
swal.then(() => {
|
|
558
|
+
if (typeof onConfirm === 'function') {
|
|
559
|
+
onConfirm();
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
return swal;
|
|
564
|
+
},
|
|
565
|
+
// 失败提示
|
|
566
|
+
error(message, onConfirm) {
|
|
567
|
+
var swal = this.$swal.fire({
|
|
568
|
+
title: message,
|
|
569
|
+
icon: 'error'
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
swal.then(() => {
|
|
573
|
+
if (typeof onConfirm === 'function') {
|
|
574
|
+
onConfirm();
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
return swal;
|
|
579
|
+
},
|
|
580
|
+
// 获取超链接
|
|
581
|
+
getHyperlink(data, hyperlink) {
|
|
582
|
+
while (hyperlink.indexOf('{') >= 0) {
|
|
583
|
+
let start = hyperlink.indexOf('{');
|
|
584
|
+
let end = hyperlink.indexOf('}');
|
|
585
|
+
let expression = hyperlink.substring(start + 1, end);
|
|
586
|
+
|
|
587
|
+
hyperlink = hyperlink.substring(0, start) + this.parseData(data, expression) + hyperlink.substring(end + 1);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
return hyperlink;
|
|
591
|
+
},
|
|
592
|
+
// 保留小数
|
|
593
|
+
keepDecimal(num, digit, fixedDigit) {
|
|
594
|
+
if (digit == null) {
|
|
595
|
+
return num;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
let result = parseFloat(num);
|
|
599
|
+
if (isNaN(result) || isNaN(digit)) {
|
|
600
|
+
return null;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
if (fixedDigit) {
|
|
604
|
+
return result.toFixed(digit);
|
|
605
|
+
} else {
|
|
606
|
+
return Math.round(num * Math.pow(10, digit)) / Math.pow(10, digit);
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
// 加千分位
|
|
610
|
+
formatThousand(value) {
|
|
611
|
+
if (value == null) {
|
|
612
|
+
return value;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
let intPart = Math.trunc(value); // 获取整数部分
|
|
616
|
+
|
|
617
|
+
let intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'); // 将整数部分逢三一断
|
|
618
|
+
let value2Array = value.toString().split('.');
|
|
619
|
+
// =2表示数据有小数位
|
|
620
|
+
if (value2Array.length === 2) {
|
|
621
|
+
return intPartFormat + '.' + value2Array[1].toString();
|
|
622
|
+
} else {
|
|
623
|
+
return intPartFormat;
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
// 重置通知栏数字
|
|
627
|
+
resetNotice() {
|
|
628
|
+
this.getNotice(this).init();
|
|
629
|
+
},
|
|
630
|
+
// 获取通知栏
|
|
631
|
+
getNotice(node) {
|
|
632
|
+
if (node.$refs.notice != null) {
|
|
633
|
+
return node.$refs.notice;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
if (node.$parent != null) {
|
|
637
|
+
return this.getNotice(node.$parent);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
return null;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
};
|