12-23-上传master
This commit is contained in:
48
src/utils/CommonUtils.ts
Normal file
48
src/utils/CommonUtils.ts
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* @Author: liqiang
|
||||
* @Date: 2020-11-24 15:26:54
|
||||
* @LastEditTime: 2020-12-09 14:13:30
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @Description: In User Settings Edit
|
||||
* @FilePath: \ebtp-cloud-frontend\src\utils\CommonUtils.ts
|
||||
*/
|
||||
/**
|
||||
* 判断是否等于空
|
||||
* @param value
|
||||
*/
|
||||
export function isEmpty(value: any) {
|
||||
return value === null || value === void 0 || value === '';
|
||||
}
|
||||
/**
|
||||
* 判断不等于空
|
||||
* @param value
|
||||
*/
|
||||
export function isNotEmpty(value: any) {
|
||||
return value !== null && value !== void 0 && value !== '';
|
||||
}
|
||||
|
||||
/**
|
||||
* proTable下拉选格式转换
|
||||
* @param data 字典数据
|
||||
*/
|
||||
export function proTableValueEnum(data: any) {
|
||||
let json = {};
|
||||
if(isEmpty(data)){
|
||||
return json;
|
||||
}
|
||||
for (const item of data) {
|
||||
json[item.code] = { text: item.dicName };
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取url路径信息
|
||||
* @param name
|
||||
*/
|
||||
export function getURLInformation(name: string) {
|
||||
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
let r = window.location.search.substr(1).match(reg);
|
||||
return r !== null ? unescape(r[2]) : null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user