llj
2026-01-27 bbae990ed1f4574fa954753faeae159052d03fba
utils/common.js
@@ -464,7 +464,7 @@
        if(!RoleList) {
            RoleList = [
                /^[a-zA-Z]+$/,
                /\bid$/i
                /id$/i
            ]
        }
        if(!Array.isArray(RoleList)){
@@ -475,21 +475,39 @@
            }
        }
        
        let FieldListCache = Array(FieldList)
        let FieldListCache = Array(...FieldList)
        
        RoleList.forEach(role => {
            console.log(FieldListCache.filter(field => !role.test(field.ColmCols)))
            FieldListCache = FieldListCache.filter(field => !role.test(field.ColmCols))
            FieldListCache = FieldListCache.filter(elem => !role.test(elem.ColmCols))
        })
        
        FieldListCache = FieldListCache.filter(elem => !ExcludeKeys.includes(elem.ColmCols))
        return {
            status: true,
            data: FieldListCache,
            Message: ""
        }
    }
    emptyValueFilter(item, fieldList){
        return fieldList.filter(e => {
            return item[e.ColmCols]
        })
    }
    httpFormatWs(httpUrl=this.serverUrl) {
        if(httpUrl.indexOf("http://") === 0){
            httpUrl = httpUrl.replace("http://", "")
            httpUrl = "ws://" + httpUrl.split(":")[0]+":8089/ws"
        }else if(httpUrl.indexOf("https://") === 0) {
            httpUrl = httpUrl.replace("https://", "")
            httpUrl = "wss://" + httpUrl.split(":")[0]+":8089/ws"
        }else{
            // 提示传入连接错误
        }
        return httpUrl
    }
}
export const CommonUtils = new commonUtils()