| | |
| | | return handler(key, match); |
| | | }); |
| | | } |
| | | |
| | | fieldListFilterRole({FieldList, ExcludeKeys = [] ,RoleList = null}) { |
| | | if(!RoleList) { |
| | | RoleList = [ |
| | | /^[a-zA-Z]+$/, |
| | | /\bid$/i |
| | | ] |
| | | } |
| | | if(!Array.isArray(RoleList)){ |
| | | return { |
| | | status: false, |
| | | data: null, |
| | | Message: "过滤字段列表失败,规则必须是数组。" |
| | | } |
| | | } |
| | | |
| | | let FieldListCache = Array(FieldList) |
| | | |
| | | let list1 = FieldListCache.filter(elem => role[0].test(elem.ColmCols)) |
| | | console.log('list1: ',list1); |
| | | // RoleList.forEach(role => { |
| | | // console.log(FieldListCache.filter(field => !role.test(field.ColmCols))) |
| | | // FieldListCache = FieldListCache.filter(field => !role.test(field.ColmCols)) |
| | | // }) |
| | | |
| | | return { |
| | | status: true, |
| | | data: FieldListCache, |
| | | Message: "" |
| | | } |
| | | } |
| | | } |
| | | |
| | | export const CommonUtils = new commonUtils() |