@lambo-design/shared 1.0.0-beta.20 → 1.0.0-beta.201
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/config/config.js +15 -2
- package/config/index.js +7 -2
- package/config/themes/atrovirens/atrovirens.css +564 -0
- package/config/themes/atrovirens/atrovirens.css.map +1 -0
- package/config/themes/atrovirens/atrovirens.less +656 -0
- package/config/themes/atrovirens/var.less +662 -0
- package/config/themes/blue/blue.css +564 -0
- package/config/themes/blue/blue.css.map +1 -0
- package/config/themes/blue/blue.less +657 -0
- package/config/themes/blue/var.less +663 -0
- package/config/themes/blue-white/blue-white.css +564 -0
- package/config/themes/blue-white/blue-white.css.map +1 -0
- package/config/themes/blue-white/blue-white.less +656 -0
- package/config/themes/blue-white/var.less +663 -0
- package/config/themes/blue-white-tight/blue-white-tight.css +565 -0
- package/config/themes/blue-white-tight/blue-white-tight.css.map +1 -0
- package/config/themes/blue-white-tight/blue-white-tight.less +657 -0
- package/config/themes/blue-white-tight/var.less +663 -0
- package/config/themes/deep/deep.css +564 -0
- package/config/themes/deep/deep.css.map +1 -0
- package/config/themes/deep/deep.less +655 -0
- package/config/themes/deep/var.less +663 -0
- package/config/themes/default/default.css +380 -57
- package/config/themes/default/default.css.map +1 -0
- package/config/themes/default/default.less +425 -88
- package/config/themes/default/var.less +361 -12
- package/config/themes/eap/eap.css +564 -0
- package/config/themes/eap/eap.css.map +1 -0
- package/config/themes/eap/eap.less +656 -0
- package/config/themes/eap/var.less +663 -0
- package/config/themes/gold/gold.css +564 -0
- package/config/themes/gold/gold.css.map +1 -0
- package/config/themes/gold/gold.less +656 -0
- package/config/themes/gold/var.less +357 -7
- package/config/themes/index.js +13 -3
- package/config/themes/lime/lime.css +564 -0
- package/config/themes/lime/lime.css.map +1 -0
- package/config/themes/lime/lime.less +656 -0
- package/config/themes/lime/var.less +357 -7
- package/config/themes/orange/orange.css +564 -0
- package/config/themes/orange/orange.css.map +1 -0
- package/config/themes/orange/orange.less +656 -0
- package/config/themes/orange/var.less +664 -0
- package/config/themes/red/red.css +564 -0
- package/config/themes/red/red.css.map +1 -0
- package/config/themes/red/red.less +656 -0
- package/config/themes/red/var.less +663 -0
- package/config/themes/theme-atrovirens.js +546 -0
- package/config/themes/theme-blue.js +546 -0
- package/config/themes/theme-bw.js +546 -0
- package/config/themes/theme-bwt.js +547 -0
- package/config/themes/theme-deep.js +546 -0
- package/config/themes/theme-default.js +353 -59
- package/config/themes/theme-eap.js +546 -0
- package/config/themes/theme-gold.js +305 -11
- package/config/themes/theme-lime.js +305 -11
- package/config/themes/theme-orange.js +534 -27
- package/config/themes/theme-red.js +538 -32
- package/directives/module/print.js +1 -0
- package/directives/module/vue-print-nb/README.md +63 -0
- package/directives/module/vue-print-nb/print.js +94 -0
- package/directives/module/vue-print-nb/printarea.js +532 -0
- package/index.js +7 -1
- package/nstyles/common.less +197 -0
- package/nstyles/components/404.less +46 -0
- package/nstyles/components/button.less +34 -0
- package/nstyles/components/date-picker.less +37 -0
- package/nstyles/components/drawer.less +20 -0
- package/nstyles/components/dropdown.less +18 -0
- package/nstyles/components/excel-flow.less +72 -0
- package/nstyles/components/form.less +303 -0
- package/nstyles/components/index.less +15 -0
- package/nstyles/components/layout/collect.less +10 -0
- package/nstyles/components/layout/detail-view.less +107 -0
- package/nstyles/components/layout/full-screen.less +7 -0
- package/nstyles/components/layout/index.less +7 -0
- package/nstyles/components/layout/other-menu.less +142 -0
- package/nstyles/components/layout/page-view.less +101 -0
- package/nstyles/components/layout/sider-trigger.less +41 -0
- package/nstyles/components/layout/tags-nav.less +113 -0
- package/nstyles/components/modal.less +85 -0
- package/nstyles/components/panel.less +31 -0
- package/nstyles/components/select.less +3 -0
- package/nstyles/components/sign.less +27 -0
- package/nstyles/components/table.less +315 -0
- package/nstyles/components/tree.less +159 -0
- package/nstyles/components/upload.less +131 -0
- package/nstyles/index.less +5 -0
- package/nstyles/reset.less +65 -0
- package/nstyles/third/ag.less +173 -0
- package/nstyles/third/icons/sort-desc.svg +1 -0
- package/nstyles/third/icons/sort-up.svg +1 -0
- package/nstyles/third/icons/sorting.svg +1 -0
- package/nstyles/third/index.less +11 -0
- package/nstyles/third/view-design.less +356 -0
- package/nstyles/variables/base.less +143 -0
- package/nstyles/variables/index.less +4 -0
- package/nstyles/variables/theme/default/button.less +7 -0
- package/nstyles/variables/theme/default/common.less +57 -0
- package/nstyles/variables/theme/default/index.less +7 -0
- package/nstyles/variables/theme/default/layout.less +40 -0
- package/nstyles/variables/theme/default/table.less +37 -0
- package/nstyles/variables/theme/default/tag.less +3 -0
- package/nstyles/variables/theme/default/upload.less +3 -0
- package/nstyles/variables/theme/index.less +13 -0
- package/nstyles/variables/theme/small/button.less +7 -0
- package/nstyles/variables/theme/small/common.less +39 -0
- package/nstyles/variables/theme/small/index.less +5 -0
- package/nstyles/variables/theme/small/layout.less +21 -0
- package/nstyles/variables/theme/small/table.less +17 -0
- package/nstyles/variables/theme/small/tag.less +3 -0
- package/package.json +39 -22
- package/plugin/index.js +12 -0
- package/plugin/module/date-format.js +30 -0
- package/plugin/module/loading.js +26 -0
- package/plugin/module/warn-handler.js +11 -0
- package/styles/image/lan_navigator.png +0 -0
- package/styles/image/lv_navigator.png +0 -0
- package/utils/ajax/content-type.js +30 -0
- package/utils/ajax/interceptors.js +13 -6
- package/utils/assist.js +147 -84
- package/utils/base64.js +126 -0
- package/utils/blob.js +47 -0
- package/utils/crypto/index.js +10 -0
- package/utils/date.js +334 -305
- package/utils/dict/built-in-dict.js +20 -0
- package/utils/dict/index.js +108 -0
- package/utils/event.js +72 -0
- package/utils/excel.js +369 -237
- package/utils/file.js +19 -0
- package/utils/form/validate.js +29 -0
- package/utils/half-year.js +68 -0
- package/utils/index.js +37 -0
- package/utils/json.js +29 -0
- package/utils/lodop.js +5 -0
- package/utils/menu/index.js +257 -11
- package/utils/mime_type.js +67 -0
- package/utils/modelerUtil.js +4 -1
- package/utils/n/api.js +8 -0
- package/utils/n/date.js +57 -0
- package/utils/n/index.js +10 -0
- package/utils/n/is-type.js +176 -0
- package/utils/n/number.js +144 -0
- package/utils/n/permission-cache.js +11 -0
- package/utils/n/reuqest/axiosN.js +15 -0
- package/utils/n/reuqest/content-type.js +19 -0
- package/utils/n/reuqest/interceptors.js +95 -0
- package/utils/n/reuqest/url-params.js +12 -0
- package/utils/n/storage.js +51 -0
- package/utils/n/token.js +51 -0
- package/utils/n/user-cache.js +11 -0
- package/utils/n/user.js +34 -0
- package/utils/n/uuid.js +16 -0
- package/utils/n-generator-routers.js +208 -0
- package/utils/n-router.js +205 -0
- package/utils/n-theme.js +30 -0
- package/utils/number.js +72 -15
- package/utils/oss.js +58 -0
- package/utils/platform.js +514 -22
- package/utils/quarter.js +58 -0
- package/utils/storage.js +198 -0
- package/utils/style.js +24 -0
- package/utils/theme.js +96 -3
- package/utils/transfer-queue.js +7 -0
- package/utils/type.js +102 -0
- package/utils/util.js +795 -0
- package/utils/validator.js +181 -0
- package/config/themes/gold/default.css +0 -241
- package/config/themes/gold/default.less +0 -319
- package/config/themes/lime/default.css +0 -241
- package/config/themes/lime/default.less +0 -319
package/utils/file.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件大小计算
|
|
3
|
+
* @param size
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*/
|
|
6
|
+
export const formatterSizeUnit = function (size) {
|
|
7
|
+
if (size) {
|
|
8
|
+
let result = parseInt(size);
|
|
9
|
+
if (result < 1024) {
|
|
10
|
+
return result + " B";
|
|
11
|
+
} else if (result < 1024 * 1024) {
|
|
12
|
+
return parseInt(result / 1024) + " KB";
|
|
13
|
+
} else if (result < 1024 * 1024 * 1024) {
|
|
14
|
+
return parseInt(result / (1024 * 1024)) + " MB";
|
|
15
|
+
} else {
|
|
16
|
+
return parseInt(result / (1024 * 1024 * 1024)) + " GB";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import ajax from '../ajax'
|
|
2
|
+
|
|
3
|
+
export const checkSingle = async (rule, value, callback, {url, formKey, formName}) => {
|
|
4
|
+
if (!formName) {
|
|
5
|
+
formName = "参数";
|
|
6
|
+
}
|
|
7
|
+
if (value) {
|
|
8
|
+
if (url) {
|
|
9
|
+
let params = {};
|
|
10
|
+
if (formKey) {
|
|
11
|
+
params[formKey] = value
|
|
12
|
+
}
|
|
13
|
+
const { data } = await ajax.get(url, {params: params});
|
|
14
|
+
if (data.code == 1 && data.data) {
|
|
15
|
+
callback(formName + "已存在");
|
|
16
|
+
} else {
|
|
17
|
+
callback();
|
|
18
|
+
}
|
|
19
|
+
} else {
|
|
20
|
+
callback();
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
callback(formName + "不能为空");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
checkSingle
|
|
29
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// 获取半年
|
|
2
|
+
export function getHalfYear(date) {
|
|
3
|
+
if (!date || date.length < 4) {
|
|
4
|
+
return ''
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const year = date.substring(0, 4)
|
|
8
|
+
const month = date.substring(4, 6)
|
|
9
|
+
const halfYear = getHalfYearNum(parseInt(month))
|
|
10
|
+
if (!month) {
|
|
11
|
+
return `${year}`
|
|
12
|
+
}
|
|
13
|
+
return `${year}H${halfYear}`
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function getHalfYearNum(month) {
|
|
17
|
+
if (typeof month === 'string') {
|
|
18
|
+
if (isNaN(parseInt(month))) return 0
|
|
19
|
+
month = parseInt(month)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return month <= 6 ? 1 : 2
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function formatHalfYear(halfYear) {
|
|
26
|
+
if (!halfYear || halfYear.length < 4) {
|
|
27
|
+
return halfYear
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const year = halfYear.substring(0, 4)
|
|
31
|
+
const month = halfYear.substring(4, 6)
|
|
32
|
+
if (!month) {
|
|
33
|
+
return `${year}全年`
|
|
34
|
+
}
|
|
35
|
+
const halfYearNum = parseInt(halfYear.substring(5))
|
|
36
|
+
const halfStr = halfYearNum === 1 ? '上半年' : '下半年'
|
|
37
|
+
return `${year}${halfStr}`
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function getHalfYearBeginMonth(halfYear) {
|
|
41
|
+
if (!halfYear || halfYear.length < 4) {
|
|
42
|
+
return halfYear
|
|
43
|
+
}
|
|
44
|
+
const year = halfYear.substring(0, 4)
|
|
45
|
+
const month = halfYear.substring(4, 6)
|
|
46
|
+
if (!month) {
|
|
47
|
+
return `${year}01`
|
|
48
|
+
}
|
|
49
|
+
const halfYearNum = parseInt(halfYear.substring(5))
|
|
50
|
+
const beginMonth = halfYearNum * 6 - 5
|
|
51
|
+
const monthStr = beginMonth < 10 ? `0${beginMonth}` : `${beginMonth}`
|
|
52
|
+
return `${year}${monthStr}`
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getHalfYearEndMonth(halfYear) {
|
|
56
|
+
if (!halfYear || halfYear.length < 4) {
|
|
57
|
+
return halfYear
|
|
58
|
+
}
|
|
59
|
+
const year = halfYear.substring(0, 4)
|
|
60
|
+
const month = halfYear.substring(4, 6)
|
|
61
|
+
if (!month) {
|
|
62
|
+
return `${year}12`
|
|
63
|
+
}
|
|
64
|
+
const halfYearNum = parseInt(halfYear.substring(5))
|
|
65
|
+
const endMonth = halfYearNum * 2
|
|
66
|
+
const monthStr = endMonth < 10 ? `0${endMonth}` : `${endMonth}`
|
|
67
|
+
return `${year}${monthStr}`
|
|
68
|
+
}
|
package/utils/index.js
CHANGED
|
@@ -3,3 +3,40 @@ const sum = (a, b) => {
|
|
|
3
3
|
};
|
|
4
4
|
|
|
5
5
|
export { sum };
|
|
6
|
+
import ajax from './ajax'
|
|
7
|
+
|
|
8
|
+
export {ajax as axios}
|
|
9
|
+
// export * from './crypto'
|
|
10
|
+
// export * from './dict'
|
|
11
|
+
// export * from './form/validate'
|
|
12
|
+
// export * from './menu'
|
|
13
|
+
// export * from './vxetable'
|
|
14
|
+
// export * from './n'
|
|
15
|
+
// export * from './date'
|
|
16
|
+
// export * from './assist'
|
|
17
|
+
// export * from './base64'
|
|
18
|
+
// export * from './bus'
|
|
19
|
+
// export * from './dom'
|
|
20
|
+
// export * from './event'
|
|
21
|
+
// export * from './excel'
|
|
22
|
+
// export * from './file'
|
|
23
|
+
// export * from './half-year'
|
|
24
|
+
// export * from './json'
|
|
25
|
+
// export * from './lodop'
|
|
26
|
+
// export * from './mime_type'
|
|
27
|
+
// export * from './modelerUtil'
|
|
28
|
+
// export * from './n-generator-routers'
|
|
29
|
+
// export * from './n-router'
|
|
30
|
+
// export * from './n-theme'
|
|
31
|
+
// export * from './number'
|
|
32
|
+
// export * from './oss'
|
|
33
|
+
// export * from './platform'
|
|
34
|
+
// export * from './quarter'
|
|
35
|
+
// export * from './storage'
|
|
36
|
+
// export * from './style'
|
|
37
|
+
// export * from './theme'
|
|
38
|
+
// export * from './transfer-queue'
|
|
39
|
+
// export * from './type'
|
|
40
|
+
// export * from './util'
|
|
41
|
+
// export * from './validator'
|
|
42
|
+
// export * from './zoomScroll'
|
package/utils/json.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
let json = {};
|
|
2
|
+
/**
|
|
3
|
+
* Json(带函数)转字符串
|
|
4
|
+
* @param value Json对象
|
|
5
|
+
* @returns {string} 字符串
|
|
6
|
+
*/
|
|
7
|
+
json.stringify = function (value) {
|
|
8
|
+
return JSON.stringify(value, function(key, val) {
|
|
9
|
+
if (typeof val === 'function') {
|
|
10
|
+
return val + '';
|
|
11
|
+
}
|
|
12
|
+
return val;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 字符串(带函数)转Object(函数可调用)
|
|
17
|
+
* @param value
|
|
18
|
+
* @returns {any}
|
|
19
|
+
*/
|
|
20
|
+
json.parse = function (value) {
|
|
21
|
+
return JSON.parse(value,function(k,v){
|
|
22
|
+
if(v.indexOf&&v.indexOf('function')>-1){
|
|
23
|
+
return eval("(function(){return "+v+" })()")
|
|
24
|
+
}
|
|
25
|
+
return v;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default json;
|
package/utils/lodop.js
CHANGED
package/utils/menu/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import config from "../../config/config"
|
|
2
|
+
import {deepCopy} from "../assist";
|
|
3
|
+
import {getUrlParams} from "../platform"
|
|
1
4
|
/**
|
|
2
5
|
* 判断是否存在路由
|
|
3
6
|
* @param $router
|
|
@@ -16,9 +19,25 @@ export const hasRoute = ($router, name) => {
|
|
|
16
19
|
* @returns {*|boolean}
|
|
17
20
|
*/
|
|
18
21
|
export const hasRoutePath = ($router, path) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
if ($router && path) {
|
|
23
|
+
let routes = $router.getRoutes();
|
|
24
|
+
if (path.trim().startsWith("dida/")) {
|
|
25
|
+
path = path.trim().replace("dida/","");
|
|
26
|
+
if (!path.startsWith("/")) {
|
|
27
|
+
path = "/" + path;
|
|
28
|
+
}
|
|
29
|
+
} else if (path.trim().startsWith("dareport/")) {
|
|
30
|
+
path = path.trim().replace("dareport/","");
|
|
31
|
+
if (!path.startsWith("/")) {
|
|
32
|
+
path = "/" + path;
|
|
33
|
+
}
|
|
34
|
+
} else if (path.trim().startsWith("/" + config.routerBase + "/")) {
|
|
35
|
+
path = "/" + path.replace("/" + config.routerBase + "/","")
|
|
36
|
+
}
|
|
37
|
+
let res = routes.filter(item => item.path === path)
|
|
38
|
+
return res && res.length > 0
|
|
39
|
+
}
|
|
40
|
+
return false
|
|
22
41
|
}
|
|
23
42
|
/**
|
|
24
43
|
* 动态生成菜单
|
|
@@ -26,6 +45,15 @@ export const hasRoutePath = ($router, path) => {
|
|
|
26
45
|
* @returns []
|
|
27
46
|
*/
|
|
28
47
|
export const generatorMenuList = (permissionList,appId) => {
|
|
48
|
+
let menuRouter = generatorMenuRouter(permissionList,appId);
|
|
49
|
+
return menuRouter && menuRouter.menuData ? menuRouter.menuData : [];
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* 动态生成菜单
|
|
53
|
+
* @param generatorMenuRouter
|
|
54
|
+
* @returns []
|
|
55
|
+
*/
|
|
56
|
+
export const generatorMenuRouter = (permissionList,appId) => {
|
|
29
57
|
let menuData = [],
|
|
30
58
|
pageNode = {
|
|
31
59
|
path: "/page",
|
|
@@ -38,15 +66,10 @@ export const generatorMenuList = (permissionList,appId) => {
|
|
|
38
66
|
children: []
|
|
39
67
|
};
|
|
40
68
|
listToMenuTree(permissionList, menuData, pageNode, "0", [], true,appId);
|
|
41
|
-
|
|
42
|
-
/*if (pageNode.children.length > 0) {
|
|
43
|
-
menuData.push(pageNode);
|
|
44
|
-
}*/
|
|
45
|
-
return menuData;
|
|
69
|
+
return {menuData,pageNode};
|
|
46
70
|
};
|
|
47
71
|
|
|
48
72
|
|
|
49
|
-
|
|
50
73
|
/**
|
|
51
74
|
* 数组转树形结构
|
|
52
75
|
*/
|
|
@@ -55,18 +78,22 @@ const listToMenuTree = (list, menuTree, pageNode, parentId, crumbs, root, appId)
|
|
|
55
78
|
return;
|
|
56
79
|
}
|
|
57
80
|
list.forEach(item => {
|
|
58
|
-
if (item.appId == appId) {
|
|
81
|
+
if (!appId || item.appId == appId && (!item.hasOwnProperty("hideInMenu") || (item.hasOwnProperty("hideInMenu") && !item.hideInMenu))) {
|
|
59
82
|
// 判断是否为父级菜单
|
|
60
83
|
if (item.pid === parentId) {
|
|
61
84
|
if (item.type === 1 || item.type === 2) {
|
|
62
85
|
let node = {
|
|
63
86
|
meta: {
|
|
87
|
+
data: deepCopy(item),
|
|
64
88
|
appId: item.appId,
|
|
65
89
|
title: item.label,
|
|
66
90
|
icon: item.icon,
|
|
67
91
|
crumbs: [...crumbs],
|
|
68
|
-
activeName: item.name
|
|
92
|
+
activeName: item.name,
|
|
93
|
+
notCache: item.notCache ? true : false,
|
|
94
|
+
hideInMenu: item.hideInMenu ? true : false
|
|
69
95
|
},
|
|
96
|
+
permissionId: item.permissionId,
|
|
70
97
|
type: item.type,
|
|
71
98
|
pid: item.pid,
|
|
72
99
|
component: item.name,
|
|
@@ -108,12 +135,15 @@ const listToMenuTree = (list, menuTree, pageNode, parentId, crumbs, root, appId)
|
|
|
108
135
|
if (item.type === 4) {
|
|
109
136
|
let child = {
|
|
110
137
|
meta: {
|
|
138
|
+
data: deepCopy(item),
|
|
139
|
+
appId: item.appId,
|
|
111
140
|
title: item.label,
|
|
112
141
|
hideInMenu: true,
|
|
113
142
|
notCache: true,
|
|
114
143
|
crumbs: [...crumbs],
|
|
115
144
|
type: item.type
|
|
116
145
|
},
|
|
146
|
+
permissionId: item.permissionId,
|
|
117
147
|
type: item.type,
|
|
118
148
|
pid: item.pid,
|
|
119
149
|
component: item.name,
|
|
@@ -132,4 +162,220 @@ const listToMenuTree = (list, menuTree, pageNode, parentId, crumbs, root, appId)
|
|
|
132
162
|
}
|
|
133
163
|
});
|
|
134
164
|
};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 动态生成路由
|
|
168
|
+
* @param generatorMenuRouter
|
|
169
|
+
* @returns []
|
|
170
|
+
*/
|
|
171
|
+
export const generatorDynamicRouter = (permissionList,constantRouterComponents) => {
|
|
172
|
+
let allMenu = generatorMenuRouter(permissionList, null);
|
|
173
|
+
let menuData = allMenu.menuData;
|
|
174
|
+
let pageNode = allMenu.pageNode;
|
|
175
|
+
if (menuData && pageNode && pageNode.children.length > 0) {
|
|
176
|
+
menuData.push(pageNode);
|
|
177
|
+
}
|
|
178
|
+
//给路由添加面包屑属性,解决示例页面左侧菜单点击不选中的问题
|
|
179
|
+
//routesAddCrumbs(exampleMenuData,[]);
|
|
180
|
+
//menuData = menuData.concat(exampleMenuData)
|
|
181
|
+
let dynamicRouter = generator(menuData,constantRouterComponents);
|
|
182
|
+
|
|
183
|
+
return dynamicRouter;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* 路由添加面包屑属性
|
|
187
|
+
*/
|
|
188
|
+
export const routesAddCrumbs = (routes ,crumbs) => {
|
|
189
|
+
routes.forEach(item => {
|
|
190
|
+
if (item.meta.hasOwnProperty('crumbs')){
|
|
191
|
+
item.meta.crumbs.push({
|
|
192
|
+
icon: item.meta.icon,
|
|
193
|
+
name: item.name,
|
|
194
|
+
title: item.meta.title,
|
|
195
|
+
type: item.type
|
|
196
|
+
});
|
|
197
|
+
}else{
|
|
198
|
+
item.meta['crumbs'] = [...crumbs];
|
|
199
|
+
item.meta.crumbs.push({
|
|
200
|
+
icon: item.meta.icon,
|
|
201
|
+
name: item.name,
|
|
202
|
+
title: item.meta.title,
|
|
203
|
+
type: item.type
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
if (item.hasOwnProperty("children")){
|
|
207
|
+
routesAddCrumbs(item.children,item.meta.crumbs)
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/*
|
|
213
|
+
生成 vue-router 层级路由表
|
|
214
|
+
*/
|
|
215
|
+
const generator = (menuData,constantRouterComponents) => {
|
|
216
|
+
for (let item of menuData) {
|
|
217
|
+
if (item.component && typeof item.component == "string") {
|
|
218
|
+
const target = constantRouterComponents[item.component];
|
|
219
|
+
if (target) {
|
|
220
|
+
if (typeof target.component == "string") {
|
|
221
|
+
// 解决路由name与组件name不一致导致的keeplive不生效的问题
|
|
222
|
+
try {
|
|
223
|
+
//let componentPath = '@/view/' + target.component;
|
|
224
|
+
item.component = resolve =>
|
|
225
|
+
require(['@/view/'+ target.component], data => {
|
|
226
|
+
data.default.name = item.name;
|
|
227
|
+
resolve(data);
|
|
228
|
+
});
|
|
229
|
+
}catch (e) {
|
|
230
|
+
delete item.component
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
item.component = target.component;
|
|
234
|
+
}
|
|
235
|
+
if (target.url) {
|
|
236
|
+
let path = target.url;
|
|
237
|
+
let query = {};
|
|
238
|
+
if (path.indexOf("?") > -1) {
|
|
239
|
+
query = getUrlParams(path.substr(path.indexOf("?")));
|
|
240
|
+
item.query = query;
|
|
241
|
+
path = path.substr(0,path.indexOf("?"));
|
|
242
|
+
}
|
|
243
|
+
item.path = path;
|
|
244
|
+
}
|
|
245
|
+
if (item.uri) {
|
|
246
|
+
item.meta.uriParam = item.uri;
|
|
247
|
+
}
|
|
248
|
+
if (target.notCache) {
|
|
249
|
+
item.meta.notCache = target.notCache;
|
|
250
|
+
}
|
|
251
|
+
if (target.hideInMenu) {
|
|
252
|
+
item.meta.hideInMenu = target.hideInMenu;
|
|
253
|
+
}
|
|
254
|
+
} else if (item.uri) {
|
|
255
|
+
if (item.uri.startsWith("/")) {
|
|
256
|
+
item.uri = item.uri.substr(1);
|
|
257
|
+
}
|
|
258
|
+
let uri = item.uri;
|
|
259
|
+
if (uri.startsWith(config.routerBase + "/")) {
|
|
260
|
+
uri = uri.replace(config.routerBase + "/","")
|
|
261
|
+
}
|
|
262
|
+
if (uri.startsWith("dida/")) {
|
|
263
|
+
item.meta.notCache = true;
|
|
264
|
+
let path = uri;
|
|
265
|
+
let query = {};
|
|
266
|
+
if (path.indexOf("?") > -1) {
|
|
267
|
+
query = getUrlParams(path.substr(path.indexOf("?")));
|
|
268
|
+
item.query = query;
|
|
269
|
+
path = path.substr(0,path.indexOf("?"));
|
|
270
|
+
}
|
|
271
|
+
try{
|
|
272
|
+
//let path = '@/view/dida/dida-page';
|
|
273
|
+
item.component = resolve => {
|
|
274
|
+
require(['@/view/dida/dida-page'], data => {
|
|
275
|
+
data.default.name = item.name;
|
|
276
|
+
resolve(data);
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
}catch (e){
|
|
280
|
+
delete item.component
|
|
281
|
+
}
|
|
282
|
+
item.path = "/" + path;
|
|
283
|
+
} else if(uri.startsWith("dareport/")){
|
|
284
|
+
item.meta.notCache = true;
|
|
285
|
+
let path = uri;
|
|
286
|
+
let query = {};
|
|
287
|
+
if (path.indexOf("?") > -1) {
|
|
288
|
+
query = getUrlParams(path.substr(path.indexOf("?")));
|
|
289
|
+
item.query = query;
|
|
290
|
+
path = path.substr(0,path.indexOf("?"));
|
|
291
|
+
}
|
|
292
|
+
try{
|
|
293
|
+
item.component = resolve => {
|
|
294
|
+
require(['@/view/dida/dida-page'], data => {
|
|
295
|
+
data.default.name = item.name;
|
|
296
|
+
resolve(data);
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
}catch (e){
|
|
300
|
+
delete item.component
|
|
301
|
+
}
|
|
302
|
+
item.path = "/" + path;
|
|
303
|
+
} else {
|
|
304
|
+
try{
|
|
305
|
+
let path = item.uri;
|
|
306
|
+
if (item.uri.startsWith(config.routerBase + "/")) {
|
|
307
|
+
path = path.replace(config.routerBase + "/","")
|
|
308
|
+
}
|
|
309
|
+
let query = {};
|
|
310
|
+
if (path.indexOf("?") > -1) {
|
|
311
|
+
query = getUrlParams(path.substr(path.indexOf("?")));
|
|
312
|
+
item.query = query;
|
|
313
|
+
path = path.substr(0,path.indexOf("?"));
|
|
314
|
+
}
|
|
315
|
+
//let componentPath = '@/view/' + path;
|
|
316
|
+
let component = require('@/view/' + path);
|
|
317
|
+
if (component) {
|
|
318
|
+
item.component = resolve => {
|
|
319
|
+
require(['@/view/' + path], data => {
|
|
320
|
+
data.default.name = item.name;
|
|
321
|
+
resolve(data);
|
|
322
|
+
});
|
|
323
|
+
};
|
|
324
|
+
item.path = "/" + path;
|
|
325
|
+
} else {
|
|
326
|
+
//console.warn(`${item.name}(${item.uri})页面不存在`)
|
|
327
|
+
delete item.component;
|
|
328
|
+
}
|
|
329
|
+
}catch (e){
|
|
330
|
+
//console.warn(`${item.name}(${item.uri})页面不存在`)
|
|
331
|
+
delete item.component;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
} else {
|
|
335
|
+
//console.warn(`${item.name}的资源路径未配置`);
|
|
336
|
+
delete item.component;
|
|
337
|
+
}
|
|
338
|
+
if (item.path == null) {
|
|
339
|
+
item.path = "";
|
|
340
|
+
}
|
|
341
|
+
if (item.children && item.children.length > 0) {
|
|
342
|
+
generator(item.children,constantRouterComponents);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return menuData;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* 根据权限组织tab数据
|
|
351
|
+
* @param originMenuList
|
|
352
|
+
* @param name
|
|
353
|
+
* @param appId
|
|
354
|
+
* @returns {{}}
|
|
355
|
+
*/
|
|
356
|
+
export const generateTabDataFromPermission = (originMenuList,name,appId) => {
|
|
357
|
+
let menuItem = {};
|
|
358
|
+
if (name && originMenuList) {
|
|
359
|
+
let originalMenu = originMenuList.find(item => item.name == name && item.type && item.type == '2' && (appId && item.appId == appId || !appId));
|
|
360
|
+
if (originalMenu && originalMenu.name) {
|
|
361
|
+
menuItem = {
|
|
362
|
+
meta: {
|
|
363
|
+
data: originalMenu,
|
|
364
|
+
appId: originalMenu.appId,
|
|
365
|
+
title: originalMenu.label,
|
|
366
|
+
icon: originalMenu.icon,
|
|
367
|
+
crumbs: [],
|
|
368
|
+
activeName: originalMenu.name
|
|
369
|
+
},
|
|
370
|
+
permissionId: originalMenu.permissionId,
|
|
371
|
+
pid: originalMenu.pid,
|
|
372
|
+
type: originalMenu.type,
|
|
373
|
+
name: originalMenu.name,
|
|
374
|
+
uri: originalMenu.uri
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return menuItem;
|
|
379
|
+
}
|
|
380
|
+
|
|
135
381
|
export default generatorMenuList;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export const MIME_TYPE = {
|
|
2
|
+
aac: 'audio/aac',
|
|
3
|
+
abw: 'application/x-abiword',
|
|
4
|
+
arc: 'application/x-freearc',
|
|
5
|
+
avi: 'video/x-msvideo',
|
|
6
|
+
azw: 'application/vnd.amazon.ebook',
|
|
7
|
+
bin: 'application/octet-stream',
|
|
8
|
+
bmp: 'image/bmp',
|
|
9
|
+
bz: 'application/x-bzip',
|
|
10
|
+
bz2: 'application/x-bzip2',
|
|
11
|
+
csh: 'application/x-csh',
|
|
12
|
+
css: 'text/css',
|
|
13
|
+
csv: 'text/csv',
|
|
14
|
+
doc: 'application/msword',
|
|
15
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
16
|
+
eot: 'application/vnd.ms-fontobject',
|
|
17
|
+
epub: 'application/epub+zip',
|
|
18
|
+
gif: 'image/gif',
|
|
19
|
+
html: 'text/html',
|
|
20
|
+
ico: 'image/vnd.microsoft.icon',
|
|
21
|
+
ics: 'text/calendar',
|
|
22
|
+
jar: 'application/java-archive',
|
|
23
|
+
jpg: 'image/jpeg',
|
|
24
|
+
jpeg: 'image/jpeg',
|
|
25
|
+
js: 'text/javascript',
|
|
26
|
+
json: 'application/json',
|
|
27
|
+
jsonld: 'application/ld+json',
|
|
28
|
+
mid: 'audio/midi',
|
|
29
|
+
midi: 'audio/x-midi',
|
|
30
|
+
mjs: 'text/javascript',
|
|
31
|
+
mp3: 'audio/mpeg',
|
|
32
|
+
mpeg: 'video/mpeg',
|
|
33
|
+
mpkg: 'application/vnd.apple.installer+xml',
|
|
34
|
+
odp: 'application/vnd.oasis.opendocument.presentation',
|
|
35
|
+
ods: 'application/vnd.oasis.opendocument.spreadsheet',
|
|
36
|
+
odt: 'application/vnd.oasis.opendocument.text',
|
|
37
|
+
oga: 'audio/ogg',
|
|
38
|
+
ogv: 'video/ogg',
|
|
39
|
+
ogx: 'application/ogg',
|
|
40
|
+
otf: 'font/otf',
|
|
41
|
+
png: 'image/png',
|
|
42
|
+
pdf: 'application/pdf',
|
|
43
|
+
ppt: 'application/vnd.ms-powerpoint',
|
|
44
|
+
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
45
|
+
rar: 'application/x-rar-compressed',
|
|
46
|
+
rtf: 'application/rtf',
|
|
47
|
+
sh: 'application/x-sh',
|
|
48
|
+
svg: 'image/svg+xml',
|
|
49
|
+
swf: 'application/x-shockwave-flash',
|
|
50
|
+
tar: 'application/x-tar',
|
|
51
|
+
tiff: 'image/tiff',
|
|
52
|
+
ttf: 'font/ttf',
|
|
53
|
+
txt: 'text/plain',
|
|
54
|
+
vsd: 'application/vnd.visio',
|
|
55
|
+
wav: 'audio/wav',
|
|
56
|
+
weba: 'audio/webm',
|
|
57
|
+
webm: 'video/webm',
|
|
58
|
+
webp: 'image/webp',
|
|
59
|
+
woff: 'font/woff',
|
|
60
|
+
woff2: 'font/woff2',
|
|
61
|
+
xhtml: 'application/xhtml+xml',
|
|
62
|
+
xls: 'application/vnd.ms-excel',
|
|
63
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
64
|
+
xul: 'application/vnd.mozilla.xul+xml',
|
|
65
|
+
zip: 'application/zip',
|
|
66
|
+
'7z': 'application/x-7z-compressed',
|
|
67
|
+
}
|
package/utils/modelerUtil.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import config from "@/config/config"
|
|
2
2
|
import ajax from '@/utils/ajax'
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* 工作流工具
|
|
6
|
+
*/
|
|
4
7
|
export const tools = {
|
|
5
8
|
|
|
6
9
|
registerFileDrop(container, callback) {
|
|
@@ -10,7 +13,7 @@ export const tools = {
|
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* 通过xml创建bpmn
|
|
13
|
-
* @param {string} xml 创建
|
|
16
|
+
* @param {string} xml 创建bpmn xml
|
|
14
17
|
* @param {object} bpmnModeler bpmn对象
|
|
15
18
|
* @param {object} container 容器对象
|
|
16
19
|
*/
|
package/utils/n/api.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { axiosN } from './reuqest/axiosN'
|
|
2
|
+
import config from '../../config/config'
|
|
3
|
+
|
|
4
|
+
const CONTEXT = `${config.immServerContext}/manage/pub/dateperiod`
|
|
5
|
+
|
|
6
|
+
export function getWeeksByMonthAPI(params) {
|
|
7
|
+
return axiosN.get(`${CONTEXT}/getWeekByMonth`, { params })
|
|
8
|
+
}
|
package/utils/n/date.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import dayjs from 'dayjs'
|
|
2
|
+
|
|
3
|
+
export function str2Date(value) {
|
|
4
|
+
if (value) {
|
|
5
|
+
return dayjs(value, ['YYYYMMDDHHmmss', 'YYYYMMDDHHmm', 'YYYYMMDD', 'YYYYMM', 'YYYY']).toDate()
|
|
6
|
+
} else {
|
|
7
|
+
return null
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function formatDate(value) {
|
|
12
|
+
if (value && /^[0-9]+$/.test(value)) {
|
|
13
|
+
switch (value.length) {
|
|
14
|
+
case 14: {
|
|
15
|
+
return dayjs(value, ['YYYYMMDDHHmmss']).format('YYYY-MM-DD HH:mm:ss')
|
|
16
|
+
}
|
|
17
|
+
case 12: {
|
|
18
|
+
return dayjs(value, ['YYYYMMDDHHmmss']).format('YYYY-MM-DD HH:mm')
|
|
19
|
+
}
|
|
20
|
+
case 8: {
|
|
21
|
+
return dayjs(value, ['YYYYMMDD']).format('YYYY-MM-DD')
|
|
22
|
+
}
|
|
23
|
+
case 6: {
|
|
24
|
+
return dayjs(value, ['YYYYMM']).format('YYYY-MM')
|
|
25
|
+
}
|
|
26
|
+
case 4: {
|
|
27
|
+
return value.substring(0, 2) + '-' + value.substring(2, 2)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
return value || '-'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function formatDateChinese(value) {
|
|
36
|
+
if (value && /^[0-9]+$/.test(value)) {
|
|
37
|
+
switch (value.length) {
|
|
38
|
+
case 14: {
|
|
39
|
+
return dayjs(value, ['YYYYMMDDHHmmss']).format('YYYY年MM月DD日 HH:mm:ss')
|
|
40
|
+
}
|
|
41
|
+
case 12: {
|
|
42
|
+
return dayjs(value, ['YYYYMMDDHHmmss']).format('YYYY年MM月DD日 HH:mm')
|
|
43
|
+
}
|
|
44
|
+
case 8: {
|
|
45
|
+
return dayjs(value, ['YYYYMMDD']).format('YYYY年MM月DD日')
|
|
46
|
+
}
|
|
47
|
+
case 6: {
|
|
48
|
+
return dayjs(value, ['YYYYMM']).format('YYYY年MM月')
|
|
49
|
+
}
|
|
50
|
+
case 4: {
|
|
51
|
+
return value.substring(0, 2) + '年' + value.substring(2, 2) + '月'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
return value || '-'
|
|
56
|
+
}
|
|
57
|
+
}
|