zrg
2025-12-25 7de2d9a4a7b2f97dcbda3cf9a78643854c94318f
utils/common.js
@@ -340,7 +340,7 @@
            })
        })
    }
   //没有添加锁的异步查询
    async doRequest2Async({
        url,
        data,
@@ -395,10 +395,7 @@
            console.log('播放暂停,销毁');
            innerAudioContext.destroy();
        });
      innerAudioContext.onStop(function() {
          console.log('播放暂停,销毁');
          innerAudioContext.destroy();
      })
    }
    // playSound(e) {
    //     // 全局维护一个音频实例,防止缓存溢出
@@ -462,6 +459,41 @@
            return handler(key, match);
        });
    }
    fieldListFilterRole({FieldList, ExcludeKeys = [] ,RoleList = null}) {
        if(!RoleList) {
            RoleList = [
                /^[a-zA-Z]+$/,
                /id$/i
            ]
        }
        if(!Array.isArray(RoleList)){
            return {
                status: false,
                data: null,
                Message: "过滤字段列表失败,规则必须是数组。"
            }
        }
        let FieldListCache = Array(...FieldList)
        RoleList.forEach(role => {
            FieldListCache = FieldListCache.filter(elem => !role.test(elem.ColmCols))
        })
        FieldListCache = FieldListCache.filter(elem => !ExcludeKeys.includes(elem))
        return {
            status: true,
            data: FieldListCache,
            Message: ""
        }
    }
    emptyValueFilter(item, fieldList){
        return fieldList.filter(e => {
            return item[e.ColmCols]
        })
    }
}
export const CommonUtils = new commonUtils()