Files
fe_service_ebtp_frontend/src/utils/CommonUtils.ts

61 lines
1.4 KiB
TypeScript
Raw Normal View History

2020-12-23 11:14:35 +08:00
/*
* @Author: liqiang
* @Date: 2020-11-24 15:26:54
2021-01-16 11:29:42 +08:00
* @LastEditTime: 2020-12-25 11:39:54
2020-12-23 11:14:35 +08:00
* @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;
}
2021-01-16 11:29:42 +08:00
/**
*
* @param data
*/
export function returnDictVal(data: any,value:any) {
let val = '';
if(isEmpty(data)){
return val;
}
for (const item of data) {
item.code === value ? val = item.dicName :null;
}
return val;
}
2020-12-23 11:14:35 +08:00
/**
* 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;
2021-01-16 11:29:42 +08:00
}