feat:增加关闭导入学员弹框后,重新获取学员列表信息。

This commit is contained in:
wyx
2023-01-10 16:34:17 +08:00
parent f9830f71cc
commit 2f86d38cdd
3 changed files with 27 additions and 5 deletions

View File

@@ -171,6 +171,7 @@ export default {
const state = reactive({
template: process.env.VUE_APP_TEMPLATE + "导入学员模版-1672998102528.xlsx",
importStudent: process.env.VUE_APP_BASE_API + "admin/student/importStudent",
timers: "", // 定时器,用于清空定时器使用
uploadpercent: -1,
uploadErr: false, //上传失败
addLoading: false,
@@ -182,6 +183,7 @@ export default {
locationHref: location.href.indexOf('http://') !== -1 ? 'http://111.231.196.214:12016/' : location.href.slice(0, location.href.indexOf('/m')) + '/upload/'
});
const closeDrawer = () => {
clearInterval(state.timers);
state.fileList = [];
state.uploadpercent = -1;
state.addLoading = false;
@@ -191,6 +193,8 @@ export default {
state.errNum = 0;
state.downloadErrUrl = "";
ctx.emit("update:AddImpStuvisible", false);
// 通知父组件重新获取学员列表
ctx.emit("AddImpStuvisibleClose", false);
};
const afterVisibleChange = (bool) => {
@@ -228,7 +232,7 @@ export default {
type: 3
})
let i = 0;
let timer = setInterval(() => {
state.timers = setInterval(() => {
let uid = info.file.response.data;
api
.getImportStatus(uid)
@@ -246,12 +250,12 @@ export default {
state.succNum = res.data.data.successNum;
state.errNum = res.data.data.failedNum;
state.downloadErrUrl = res.data.data.url;
clearInterval(timer);
clearInterval(state.timers);
}
}
})
.catch((err) => {
clearInterval(timer);
clearInterval(state.timers);
state.showBottomBar = true;
state.addLoading = false;
console.log("查询导入状态失败", err);