this.$ajax.post(this.$httpConfig.config.rolelist, params)
.then(res => {
if (res.data.code === 2000) {
this.searchRoleList = res.data.data.list;
let result = [],//定义一个数组
tmpData = this.searchRoleList;//要循环的对象
for (let index in tmpData) {
result.push({'id': tmpData[index].roleId, 'value': tmpData[index].roleName});//将你要的id和value以对象的形式追加到数组里
}
cb(result);
}
})
.catch(res => {
this.searchRoleList = [];
cb(this.searchRoleList);
});