@lambo-design/shared 1.0.0-beta.81 → 1.0.0-beta.83
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/themes/atrovirens/atrovirens.css +532 -532
- package/config/themes/default/default.css +532 -532
- package/config/themes/eap/eap.css +532 -532
- package/config/themes/gold/gold.css +532 -532
- package/config/themes/lime/lime.css +532 -532
- package/config/themes/orange/orange.css +532 -532
- package/config/themes/red/red.css +532 -532
- package/package.json +1 -1
- package/utils/assist.js +131 -0
- package/utils/base64.js +126 -126
- package/utils/date.js +329 -276
- package/utils/dict/built-in-dict.js +20 -0
- package/utils/dict/index.js +75 -0
- package/utils/lodop.js +5 -0
- package/utils/modelerUtil.js +4 -1
- package/utils/number.js +72 -0
- package/utils/platform.js +86 -1
- package/config/themes/gold/var.css +0 -0
- package/config/themes/gold/var.css.map +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import config from '../../config/config'
|
|
2
|
+
import ajax from '../ajax'
|
|
3
|
+
import { builtInDictKeys, builtInDictMap, builtInDictList} from './built-in-dict'
|
|
4
|
+
import { setSessionStorage, getSessionStorage} from "../platform";
|
|
5
|
+
|
|
6
|
+
export async function getAllDict(dictIdArray) {
|
|
7
|
+
if (dictIdArray.length > 0) {
|
|
8
|
+
try {
|
|
9
|
+
const { data } = await ajax.get(`${config.upmsServerContext}/manage/acDict/getDictsForMulti`, { params: { dictIds : dictIdArray.join(",") } })
|
|
10
|
+
let result = {}
|
|
11
|
+
if (data.code == 1) {
|
|
12
|
+
let dictList = data.data;
|
|
13
|
+
for (let key in dictList) {
|
|
14
|
+
let dicts = dictList[key]
|
|
15
|
+
result[key] = {};
|
|
16
|
+
if (dicts.length > 0) {
|
|
17
|
+
result[key]['enumList'] = dicts
|
|
18
|
+
setSessionStorage(key + '_LIST', dicts)
|
|
19
|
+
let dictMap = {}
|
|
20
|
+
for(let dict of dicts) {
|
|
21
|
+
dictMap[dict.K] = dict.V;
|
|
22
|
+
}
|
|
23
|
+
result[key]['enumData'] = dictMap
|
|
24
|
+
setSessionStorage(key + '_MAP', dictMap)
|
|
25
|
+
} else if (builtInDictKeys.includes(key)) {
|
|
26
|
+
let dicts = builtInDictList[key]
|
|
27
|
+
result[key]['enumList'] = dicts
|
|
28
|
+
setSessionStorage(key + '_LIST', dicts)
|
|
29
|
+
let dictMap = {}
|
|
30
|
+
for(let dict of dicts) {
|
|
31
|
+
dictMap[dict.K] = dict.V;
|
|
32
|
+
}
|
|
33
|
+
result[key]['enumData'] = dictMap
|
|
34
|
+
setSessionStorage(key + '_MAP', dictMap)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return result
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error(`getDictsForMulti error dictId=${dictIdArray}`, error)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export async function getDictList(dictId) {
|
|
46
|
+
if (builtInDictKeys.includes(dictId)) {
|
|
47
|
+
return builtInDictList[dictId]
|
|
48
|
+
}
|
|
49
|
+
const dictValue = getSessionStorage(dictId + '_LIST')
|
|
50
|
+
if (!!dictValue) {
|
|
51
|
+
return dictValue
|
|
52
|
+
}
|
|
53
|
+
let data = await getAllDict([dictId]);
|
|
54
|
+
return data[dictId];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function getDictMap(dictId) {
|
|
58
|
+
if (builtInDictKeys.includes(dictId)) {
|
|
59
|
+
return builtInDictMap[dictId]
|
|
60
|
+
}
|
|
61
|
+
const dictValue = getSessionStorage(dictId + '_MAP')
|
|
62
|
+
if (!!dictValue) {
|
|
63
|
+
return dictValue
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
const { data } = await ajax.get(`${config.upmsServerContext}/manage/acDict/getDictsMap`, { params: { dictId : dictId } })
|
|
68
|
+
if (data.code == 1) {
|
|
69
|
+
setSessionStorage(dictId + '_MAP', data.data)
|
|
70
|
+
}
|
|
71
|
+
return data.data
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error(`getDictsMap error dictId=${dictId}`, error)
|
|
74
|
+
}
|
|
75
|
+
}
|
package/utils/lodop.js
CHANGED
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/number.js
CHANGED
|
@@ -121,3 +121,75 @@ export function toFixed(num, digit) {
|
|
|
121
121
|
}
|
|
122
122
|
return changenum;
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* js除法计算
|
|
126
|
+
*/
|
|
127
|
+
export const accDiv = function (arg1, arg2) {
|
|
128
|
+
let t1 = 0, t2 = 0, r1, r2;
|
|
129
|
+
try {
|
|
130
|
+
t1 = arg1.toString().split(".")[1].length
|
|
131
|
+
} catch (e) {
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
t2 = arg2.toString().split(".")[1].length
|
|
135
|
+
} catch (e) {
|
|
136
|
+
}
|
|
137
|
+
r1 = Number(arg1.toString().replace(".", ""))
|
|
138
|
+
r2 = Number(arg2.toString().replace(".", ""))
|
|
139
|
+
return (r1 / r2) * Math.pow(10, t2 - t1);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* js乘法计算
|
|
144
|
+
*/
|
|
145
|
+
export const accMul = function (arg1, arg2) {
|
|
146
|
+
let m = 0, s1 = arg1.toString(), s2 = arg2.toString();
|
|
147
|
+
try {
|
|
148
|
+
m += s1.split(".")[1].length
|
|
149
|
+
} catch (e) {
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
m += s2.split(".")[1].length
|
|
153
|
+
} catch (e) {
|
|
154
|
+
}
|
|
155
|
+
return accDiv(Number(s1.replace(".", "")) * Number(s2.replace(".", "")), Math.pow(10, m));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* js加法计算
|
|
160
|
+
*/
|
|
161
|
+
export const accAdd = function (arg1, arg2) {
|
|
162
|
+
let r1, r2, m;
|
|
163
|
+
try {
|
|
164
|
+
r1 = arg1.toString().split(".")[1].length
|
|
165
|
+
} catch (e) {
|
|
166
|
+
r1 = 0
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
r2 = arg2.toString().split(".")[1].length
|
|
170
|
+
} catch (e) {
|
|
171
|
+
r2 = 0
|
|
172
|
+
}
|
|
173
|
+
m = Math.pow(10, Math.max(r1, r2));
|
|
174
|
+
return accDiv((accMul(arg1, m) + accMul(arg2, m)), m);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* js减法计算
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
export const accSub = function (arg1, arg2) {
|
|
182
|
+
let r1, r2, m;
|
|
183
|
+
try {
|
|
184
|
+
r1 = arg1.toString().split(".")[1].length
|
|
185
|
+
} catch (e) {
|
|
186
|
+
r1 = 0
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
r2 = arg2.toString().split(".")[1].length
|
|
190
|
+
} catch (e) {
|
|
191
|
+
r2 = 0
|
|
192
|
+
}
|
|
193
|
+
m = Math.pow(10, Math.max(r1, r2));
|
|
194
|
+
return accDiv((accMul(arg1, m) - accMul(arg2, m)), m);
|
|
195
|
+
};
|
package/utils/platform.js
CHANGED
|
@@ -315,6 +315,12 @@ export const getTableDataFromArray = (array) => {
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
/**
|
|
319
|
+
* 寻找上级节点
|
|
320
|
+
* @param ele
|
|
321
|
+
* @param tag
|
|
322
|
+
* @returns {*}
|
|
323
|
+
*/
|
|
318
324
|
export const findNodeUpper = (ele, tag) => {
|
|
319
325
|
if (ele.parentNode) {
|
|
320
326
|
if (ele.parentNode.tagName === tag.toUpperCase()) {
|
|
@@ -325,6 +331,12 @@ export const findNodeUpper = (ele, tag) => {
|
|
|
325
331
|
}
|
|
326
332
|
}
|
|
327
333
|
|
|
334
|
+
/**
|
|
335
|
+
* 根据class寻找上级节点
|
|
336
|
+
* @param ele
|
|
337
|
+
* @param classes
|
|
338
|
+
* @returns {*}
|
|
339
|
+
*/
|
|
328
340
|
export const findNodeUpperByClasses = (ele, classes) => {
|
|
329
341
|
let parentNode = ele.parentNode
|
|
330
342
|
if (parentNode) {
|
|
@@ -337,6 +349,12 @@ export const findNodeUpperByClasses = (ele, classes) => {
|
|
|
337
349
|
}
|
|
338
350
|
}
|
|
339
351
|
|
|
352
|
+
/**
|
|
353
|
+
* 根据ele寻找下级节点
|
|
354
|
+
* @param ele
|
|
355
|
+
* @param tag
|
|
356
|
+
* @returns {*}
|
|
357
|
+
*/
|
|
340
358
|
export const findNodeDownward = (ele, tag) => {
|
|
341
359
|
const tagName = tag.toUpperCase()
|
|
342
360
|
if (ele.childNodes.length) {
|
|
@@ -350,6 +368,12 @@ export const findNodeDownward = (ele, tag) => {
|
|
|
350
368
|
}
|
|
351
369
|
}
|
|
352
370
|
|
|
371
|
+
/**
|
|
372
|
+
* @description 判断要查询的数组是否至少有一个元素包含在目标数组中
|
|
373
|
+
* @param access 需要查询的数组
|
|
374
|
+
* @param canViewAccess 目标数组
|
|
375
|
+
* @returns {*}
|
|
376
|
+
*/
|
|
353
377
|
export const showByAccess = (access, canViewAccess) => {
|
|
354
378
|
return hasOneOf(canViewAccess, access)
|
|
355
379
|
}
|
|
@@ -379,7 +403,14 @@ export const routeHasExist = (tagNavList, routeItem) => {
|
|
|
379
403
|
return res
|
|
380
404
|
}
|
|
381
405
|
|
|
382
|
-
|
|
406
|
+
/**
|
|
407
|
+
* scrollTop animation
|
|
408
|
+
* @param el
|
|
409
|
+
* @param from
|
|
410
|
+
* @param to
|
|
411
|
+
* @param duration
|
|
412
|
+
* @param endCallback
|
|
413
|
+
*/
|
|
383
414
|
export const scrollTop = (el, from = 0, to, duration = 500, endCallback) => {
|
|
384
415
|
if (!window.requestAnimationFrame) {
|
|
385
416
|
window.requestAnimationFrame = (
|
|
@@ -428,6 +459,11 @@ export const setTitle = (configTitle,routeItem, vm) => {
|
|
|
428
459
|
window.document.title = resTitle
|
|
429
460
|
}
|
|
430
461
|
|
|
462
|
+
/**
|
|
463
|
+
* 获取浏览器地址url中的参数
|
|
464
|
+
* @param url
|
|
465
|
+
* @returns {Object}
|
|
466
|
+
*/
|
|
431
467
|
export const getUrlParams = (url) => {
|
|
432
468
|
if (!url){
|
|
433
469
|
url = location.search;
|
|
@@ -505,6 +541,11 @@ const hasOneOf = (targetarr, arr) => {
|
|
|
505
541
|
return targetarr.some(_ => arr.indexOf(_) > -1)
|
|
506
542
|
}
|
|
507
543
|
|
|
544
|
+
/**
|
|
545
|
+
* foreach
|
|
546
|
+
* @param arr
|
|
547
|
+
* @param fn 回调函数,参数接收arr的元素,索引,arr本身
|
|
548
|
+
*/
|
|
508
549
|
const forEach = (arr, fn) => {
|
|
509
550
|
if (!arr.length || !fn) return
|
|
510
551
|
let i = -1
|
|
@@ -528,6 +569,14 @@ export function oneOf (value, validList) {
|
|
|
528
569
|
return false
|
|
529
570
|
}
|
|
530
571
|
|
|
572
|
+
/**
|
|
573
|
+
* recursionKeyFindItem
|
|
574
|
+
* @param arr
|
|
575
|
+
* @param filterKey
|
|
576
|
+
* @param filterValue
|
|
577
|
+
* @param recursionKey
|
|
578
|
+
* @returns {*|null}
|
|
579
|
+
*/
|
|
531
580
|
export const recursionKeyFindItem = (arr, filterKey, filterValue, recursionKey) => {
|
|
532
581
|
for (const item of arr) {
|
|
533
582
|
if (item[filterKey] && item[filterKey] == filterValue) {
|
|
@@ -544,18 +593,42 @@ export const recursionKeyFindItem = (arr, filterKey, filterValue, recursionKey)
|
|
|
544
593
|
return null;
|
|
545
594
|
};
|
|
546
595
|
|
|
596
|
+
/**
|
|
597
|
+
* filterMenuName
|
|
598
|
+
* @param menuList
|
|
599
|
+
* @param name
|
|
600
|
+
* @returns {*|null}
|
|
601
|
+
*/
|
|
547
602
|
export const filterMenuName = (menuList, name) => {
|
|
548
603
|
return recursionKeyFindItem(menuList, 'name', name, 'children')
|
|
549
604
|
};
|
|
550
605
|
|
|
606
|
+
/**
|
|
607
|
+
* filterMenuUri
|
|
608
|
+
* @param menuList
|
|
609
|
+
* @param name
|
|
610
|
+
* @returns {*|null}
|
|
611
|
+
*/
|
|
551
612
|
export const filterMenuUri = (menuList, name) => {
|
|
552
613
|
return recursionKeyFindItem(menuList, 'uri', name, 'children')
|
|
553
614
|
};
|
|
554
615
|
|
|
616
|
+
/**
|
|
617
|
+
* tagExists
|
|
618
|
+
* @param taglist
|
|
619
|
+
* @param name
|
|
620
|
+
* @returns {boolean}
|
|
621
|
+
*/
|
|
555
622
|
export const tagExists = (taglist, name) => {
|
|
556
623
|
return taglist && taglist.filter(item => item.name === name).length > 0;
|
|
557
624
|
};
|
|
558
625
|
|
|
626
|
+
/**
|
|
627
|
+
* getPreviousTagIndex
|
|
628
|
+
* @param tagList
|
|
629
|
+
* @param name
|
|
630
|
+
* @returns {number}
|
|
631
|
+
*/
|
|
559
632
|
export const getPreviousTagIndex = (tagList, name) => {
|
|
560
633
|
let count = 0;
|
|
561
634
|
if (tagList && name) {
|
|
@@ -573,6 +646,12 @@ export const getPreviousTagIndex = (tagList, name) => {
|
|
|
573
646
|
return count;
|
|
574
647
|
};
|
|
575
648
|
|
|
649
|
+
/**
|
|
650
|
+
* getDelTagIndex
|
|
651
|
+
* @param tagList
|
|
652
|
+
* @param name
|
|
653
|
+
* @returns {number}
|
|
654
|
+
*/
|
|
576
655
|
export const getDelTagIndex = (tagList, name) => {
|
|
577
656
|
let count = 1;
|
|
578
657
|
if (tagList && name) {
|
|
@@ -586,6 +665,12 @@ export const getDelTagIndex = (tagList, name) => {
|
|
|
586
665
|
return count;
|
|
587
666
|
}
|
|
588
667
|
|
|
668
|
+
/**
|
|
669
|
+
* turnToPage
|
|
670
|
+
* @param vm
|
|
671
|
+
* @param name
|
|
672
|
+
* @param url
|
|
673
|
+
*/
|
|
589
674
|
export const turnToPage = (vm, name ,url) =>{
|
|
590
675
|
if (window.top && window.top.location.href != window.location.href) {
|
|
591
676
|
sessionStorage.removeItem('activeName')
|
|
File without changes
|
|
File without changes
|