var auths = { '1': '文件缺失', '2': '未审核', '3': '文件异常', '4': '已审核通过', } var credits = { 'Y': '是', 'N': '否' } var _type_maps = { 'auth': auths, 'credit': credits } /** *键值翻译 * * @param {*} value 值 * @param {*} type 翻译类型 * @returns value对应的中文名称 */ function _transform(value,type) { if(!value || !type) return ""; if(!_type_maps[type]) return ""; if(!_type_maps[type][value]) return ""; return _type_maps[type][value]; }