created() {
this.getKpiRoleButton();
},
methods: {
async getKpiRoleButton() {
try {
const resultObj = await this.signKpiRoleIdSearch();
//resultObj.data.data是id需要传给下面的接口
kpiAPI
.kpiPermissionsButton({
roleId: resultObj.data.data
})
.then(res => {
console.log(res) //处理逻辑
});
} catch (err) {
console.log(err);
}
},
signKpiRoleIdSearch() {
return new Promise((resolve, reject) => {
this.$http
.get("url?userId=" +localStorage.getItem("id"))
.then(res => {
if (res.data.success) {
resolve(res);
}
});
}).catch(error => {
reject(error);
});
}
}