@lambo-design/shared 1.0.0-beta.82 → 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/date.js +25 -0
- package/utils/dict/built-in-dict.js +20 -0
- package/utils/dict/index.js +75 -0
package/package.json
CHANGED
package/utils/assist.js
CHANGED
|
@@ -116,3 +116,134 @@ export function isJson(arg) {
|
|
|
116
116
|
export function isObject(item) {
|
|
117
117
|
return (item && typeof item === 'object' && !Array.isArray(item));
|
|
118
118
|
}
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
export const checkPhone = function (str) {
|
|
122
|
+
var reg = /^1[3456789]\d{9}$/
|
|
123
|
+
// ^1 以1开头
|
|
124
|
+
// [3456789] 第2位,使用原子表里的任意一个原子都可以
|
|
125
|
+
// \d{9}$ 第三位 朝后可以是任意数字 并且最后结尾必须是数字
|
|
126
|
+
if (reg.test(str)) {
|
|
127
|
+
return true
|
|
128
|
+
} else {
|
|
129
|
+
return false
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function checkIdCard(idcard) {
|
|
134
|
+
let Errors = new Array(
|
|
135
|
+
'验证通过!',
|
|
136
|
+
'身份证号码位数不对!',
|
|
137
|
+
'身份证号码出生日期超出范围或含有非法字符!',
|
|
138
|
+
'身份证号码校验错误!',
|
|
139
|
+
'身份证地区非法!',
|
|
140
|
+
)
|
|
141
|
+
let area = {
|
|
142
|
+
11: '北京',
|
|
143
|
+
12: '天津',
|
|
144
|
+
13: '河北',
|
|
145
|
+
14: '山西',
|
|
146
|
+
15: '内蒙古',
|
|
147
|
+
21: '辽宁',
|
|
148
|
+
22: '吉林',
|
|
149
|
+
23: '黑龙江',
|
|
150
|
+
31: '上海',
|
|
151
|
+
32: '江苏',
|
|
152
|
+
33: '浙江',
|
|
153
|
+
34: '安徽',
|
|
154
|
+
35: '福建',
|
|
155
|
+
36: '江西',
|
|
156
|
+
37: '山东',
|
|
157
|
+
41: '河南',
|
|
158
|
+
42: '湖北',
|
|
159
|
+
43: '湖南',
|
|
160
|
+
44: '广东',
|
|
161
|
+
45: '广西',
|
|
162
|
+
46: '海南',
|
|
163
|
+
50: '重庆',
|
|
164
|
+
51: '四川',
|
|
165
|
+
52: '贵州',
|
|
166
|
+
53: '云南',
|
|
167
|
+
54: '西藏',
|
|
168
|
+
61: '陕西',
|
|
169
|
+
62: '甘肃',
|
|
170
|
+
63: '青海',
|
|
171
|
+
64: '宁夏',
|
|
172
|
+
65: '新疆',
|
|
173
|
+
71: '台湾',
|
|
174
|
+
81: '香港',
|
|
175
|
+
82: '澳门',
|
|
176
|
+
91: '国外',
|
|
177
|
+
}
|
|
178
|
+
let Y, JYM
|
|
179
|
+
let S, M, ereg
|
|
180
|
+
let idcard_array = new Array()
|
|
181
|
+
idcard_array = idcard.split('')
|
|
182
|
+
//地区检验
|
|
183
|
+
if (area[parseInt(idcard.substr(0, 2))] == null) return Errors[4]
|
|
184
|
+
//身份号码位数及格式检验
|
|
185
|
+
switch (idcard.length) {
|
|
186
|
+
case 15:
|
|
187
|
+
if (
|
|
188
|
+
(parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0 ||
|
|
189
|
+
((parseInt(idcard.substr(6, 2)) + 1900) % 100 == 0 &&
|
|
190
|
+
(parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0)
|
|
191
|
+
) {
|
|
192
|
+
ereg =
|
|
193
|
+
/^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$/ //测试出生日期的合法性
|
|
194
|
+
} else {
|
|
195
|
+
ereg =
|
|
196
|
+
/^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$/ //测试出生日期的合法性
|
|
197
|
+
}
|
|
198
|
+
if (ereg.test(idcard)) {
|
|
199
|
+
return Errors[0]
|
|
200
|
+
} else {
|
|
201
|
+
return Errors[2]
|
|
202
|
+
}
|
|
203
|
+
case 18:
|
|
204
|
+
if (
|
|
205
|
+
parseInt(idcard.substr(6, 4)) % 4 == 0 ||
|
|
206
|
+
(parseInt(idcard.substr(6, 4)) % 100 == 0 && parseInt(idcard.substr(6, 4)) % 4 == 0)
|
|
207
|
+
) {
|
|
208
|
+
ereg =
|
|
209
|
+
/^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9Xx]$/ //闰年出生日期的合法性正则表达式
|
|
210
|
+
} else {
|
|
211
|
+
ereg =
|
|
212
|
+
/^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9Xx]$/ //平年出生日期的合法性正则表达式
|
|
213
|
+
}
|
|
214
|
+
if (ereg.test(idcard)) {
|
|
215
|
+
//测试出生日期的合法性
|
|
216
|
+
//计算校验位
|
|
217
|
+
S =
|
|
218
|
+
(parseInt(idcard_array[0]) + parseInt(idcard_array[10])) * 7 +
|
|
219
|
+
(parseInt(idcard_array[1]) + parseInt(idcard_array[11])) * 9 +
|
|
220
|
+
(parseInt(idcard_array[2]) + parseInt(idcard_array[12])) * 10 +
|
|
221
|
+
(parseInt(idcard_array[3]) + parseInt(idcard_array[13])) * 5 +
|
|
222
|
+
(parseInt(idcard_array[4]) + parseInt(idcard_array[14])) * 8 +
|
|
223
|
+
(parseInt(idcard_array[5]) + parseInt(idcard_array[15])) * 4 +
|
|
224
|
+
(parseInt(idcard_array[6]) + parseInt(idcard_array[16])) * 2 +
|
|
225
|
+
parseInt(idcard_array[7]) * 1 +
|
|
226
|
+
parseInt(idcard_array[8]) * 6 +
|
|
227
|
+
parseInt(idcard_array[9]) * 3
|
|
228
|
+
Y = S % 11
|
|
229
|
+
M = 'F'
|
|
230
|
+
JYM = '10X98765432'
|
|
231
|
+
M = JYM.substr(Y, 1) //判断校验位
|
|
232
|
+
if (M == idcard_array[17]) return Errors[0] //检测ID的校验位
|
|
233
|
+
else return Errors[3]
|
|
234
|
+
} else return Errors[2]
|
|
235
|
+
default:
|
|
236
|
+
return Errors[1]
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function getBirthday(a) {
|
|
241
|
+
if (15 == a.length || 18 == a.length) {
|
|
242
|
+
let left = a.length - 12
|
|
243
|
+
let right = a.length - 4
|
|
244
|
+
let b = a.slice(left, right)
|
|
245
|
+
if (8 == b.length) {
|
|
246
|
+
return b.substring(0, 4) + '-' + b.substring(4, 6) + '-' + b.substring(6)
|
|
247
|
+
} else return '1970-01-01' //0;
|
|
248
|
+
} else return '1970-01-01' //1;
|
|
249
|
+
}
|
package/utils/date.js
CHANGED
|
@@ -351,3 +351,28 @@ export const addMonth = function (startDate, monthDifference) {
|
|
|
351
351
|
startDate.getHours(), startDate.getMinutes(), startDate.getSeconds(), startDate.getMilliseconds()
|
|
352
352
|
);
|
|
353
353
|
}
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
export const formatDate = function(value) {
|
|
357
|
+
if (value) {
|
|
358
|
+
switch (value.length) {
|
|
359
|
+
case 14: {
|
|
360
|
+
return moment(value, 'YYYYMMDDHHmmss').format('YYYY-MM-DD HH:mm:ss')
|
|
361
|
+
}
|
|
362
|
+
case 12: {
|
|
363
|
+
return moment(value, 'YYYYMMDDHHmmss').format('YYYY-MM-DD HH:mm')
|
|
364
|
+
}
|
|
365
|
+
case 8: {
|
|
366
|
+
return moment(value, 'YYYYMMDD').format('YYYY-MM-DD')
|
|
367
|
+
}
|
|
368
|
+
case 6: {
|
|
369
|
+
return moment(value, 'YYYYMM').format('YYYY-MM')
|
|
370
|
+
}
|
|
371
|
+
case 4: {
|
|
372
|
+
return value.substring(0, 2) + '-' + value.substring(2, 2)
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
} else {
|
|
376
|
+
return '-'
|
|
377
|
+
}
|
|
378
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const builtInDictKeys = [
|
|
2
|
+
'SEX_ENUM',
|
|
3
|
+
'WHETHER_ENUM'
|
|
4
|
+
]
|
|
5
|
+
|
|
6
|
+
export const builtInDictMap = {
|
|
7
|
+
'SEX_ENUM' : { '0': '女', '1': '男' },
|
|
8
|
+
'WHETHER_ENUM' : { '0': '否', '1': '是' }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const builtInDictList = {
|
|
12
|
+
'SEX_ENUM' : [
|
|
13
|
+
{ K: '0', V: '女' },
|
|
14
|
+
{ K: '1', V: '男' },
|
|
15
|
+
],
|
|
16
|
+
'WHETHER_ENUM' : [
|
|
17
|
+
{ K: '0', V: '否' },
|
|
18
|
+
{ K: '1', V: '是' },
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -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
|
+
}
|