|
|
@ -447,6 +447,48 @@ export function getImgsDetailPopData(row,sucess,faild) { |
|
|
|
return imgsrcList |
|
|
|
} |
|
|
|
|
|
|
|
// 匹配正则返回值
|
|
|
|
/** 具体参数详细,可参照README.md的[表单组件补充:currenForm]说明 |
|
|
|
* @param {*} type 需要匹配的正则类型 |
|
|
|
* @param {*} value 当前传入值(即需要校验值) |
|
|
|
* @param {*} fixedNum 如果type为pointNumber,需要保留小数点后的位数 |
|
|
|
* @returns |
|
|
|
*/ |
|
|
|
export function getMatchRegConformValue(type,value,fixedNum){ |
|
|
|
let _conformValue = "" |
|
|
|
switch(type){ |
|
|
|
// 正整数
|
|
|
|
case "number": |
|
|
|
_conformValue=value.replace(/[^\d]/g,''); |
|
|
|
break; |
|
|
|
|
|
|
|
// 数字+带小数点,只能输入一个小数点
|
|
|
|
case "pointNumber": |
|
|
|
//小数点后保留位数
|
|
|
|
let _fixed = fixedNum ? Number(fixedNum) : 100 |
|
|
|
let reg = new RegExp(`\\d+\\.?\\d{0,${_fixed}}`); |
|
|
|
let _match = String(value).match(reg) |
|
|
|
_conformValue = _match ? _match[0] : _match |
|
|
|
break; |
|
|
|
|
|
|
|
// 数字+字母
|
|
|
|
case "numberLetter": |
|
|
|
_conformValue=value.replace(/[\W]/g,''); |
|
|
|
break; |
|
|
|
|
|
|
|
// 字母
|
|
|
|
case "letter": |
|
|
|
_conformValue=value.replace(/[^a-zA-Z]/g,''); |
|
|
|
break; |
|
|
|
|
|
|
|
// 字母+中文
|
|
|
|
case "letterCn": |
|
|
|
_conformValue=value.replace(/[\d]/g,''); |
|
|
|
break; |
|
|
|
} |
|
|
|
return _conformValue |
|
|
|
} |
|
|
|
|
|
|
|
// 字典格式化数据结构
|
|
|
|
export function dictFormatData() { |
|
|
|
return new Promise(resolve => { |
|
|
@ -496,3 +538,5 @@ export function dictFormatData() { |
|
|
|
// })
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|