wtt
2025-12-24 ddcd1fc431bcf4a3289a47b8dab6403564797461
utils/common.js
@@ -459,6 +459,37 @@
            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()