mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-14 21:36:44 +08:00
feat:增加导出作业
This commit is contained in:
@@ -28,10 +28,12 @@
|
||||
<div style="height: 176px; margin-bottom: 20px">
|
||||
<a-upload-dragger
|
||||
v-model:fileList="fileList"
|
||||
:action="BATCH_IMPORT_SCORE + '?offcoursePlanId=' + id"
|
||||
action="/admin/student/importHomeWork"
|
||||
name="file"
|
||||
:multiple="true"
|
||||
:before-upload="beforeUpload"
|
||||
@change="handleChange"
|
||||
@customRequest="handleUpload"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<inbox-outlined></inbox-outlined>
|
||||
@@ -60,8 +62,8 @@
|
||||
</div>
|
||||
<div class="curloading">
|
||||
<div class="cur">55%</div>
|
||||
<div class="cancel" style="margin-left: 20px">暂停</div>
|
||||
<div class="cancel" style="margin-left: 15px">取消</div>
|
||||
<!-- <div class="cancel" style="margin-left: 20px">暂停</div>
|
||||
<div class="cancel" style="margin-left: 15px">取消</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -79,10 +81,22 @@
|
||||
</div>
|
||||
<div class="curloading">
|
||||
<div class="cur">55%</div>
|
||||
<div class="cancel" style="margin-left: 20px">暂停</div>
|
||||
<div class="cancel" style="margin-left: 15px">取消</div>
|
||||
<div
|
||||
style="color: #387df7; margin-left: 20px; cursor: pointer"
|
||||
>
|
||||
下载失败数据
|
||||
</div>
|
||||
<!-- <div class="cancel" style="margin-left: 20px">暂停</div>
|
||||
<div class="cancel" style="margin-left: 15px">取消</div> -->
|
||||
</div>
|
||||
<div
|
||||
class="defeat"
|
||||
style="display: flex; align-items: center"
|
||||
>
|
||||
<div style="color: #ff7474">
|
||||
20条数据导入成功,5条数据导入失败
|
||||
</div>
|
||||
</div>
|
||||
<div class="defeat">下载失败数据</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="loadborder">
|
||||
@@ -99,7 +113,7 @@
|
||||
</div>
|
||||
<div class="curloading">
|
||||
<div class="cur">100%</div>
|
||||
<div class="cancel" style="margin-left: 20px">删除</div>
|
||||
<!-- <div class="cancel" style="margin-left: 20px">删除</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -150,7 +164,18 @@ export default {
|
||||
|
||||
//上传文件
|
||||
const handleChange = (info) => {
|
||||
console.log("info", info, props.id);
|
||||
console.log("info", info);
|
||||
let timer = setInterval(() => {
|
||||
if (info.file.percent < 100) {
|
||||
console.log("info111", info.file.percent);
|
||||
} else {
|
||||
console.log("info22", info.file.percent);
|
||||
clearInterval(timer);
|
||||
}
|
||||
}, 1000);
|
||||
// if (info.event) {
|
||||
// console.log("info.event", info.event);
|
||||
// }
|
||||
const status = info.file.status;
|
||||
if (status !== "uploading") {
|
||||
console.log(info.file, info.fileList);
|
||||
@@ -159,24 +184,61 @@ export default {
|
||||
const formData = new FormData();
|
||||
formData.append("uploadFile", info.file);
|
||||
// formData.append("offcoursePlanId", props.id);
|
||||
console.log(info.file);
|
||||
api.batchImportScore(props.id, formData).then((res) => {
|
||||
// if (res.data.code === 200) {
|
||||
// console.log('上传成功')
|
||||
// }
|
||||
console.log("上传成绩", res);
|
||||
});
|
||||
console.log("info.file", info.file);
|
||||
// api.batchImportScore(formData).then((res) => {
|
||||
// // if (res.data.code === 200) {
|
||||
// // console.log('上传成功')
|
||||
// // }
|
||||
// console.log("上传成绩", res);
|
||||
// });
|
||||
message.success(`${info.file.name} file uploaded successfully.`);
|
||||
} else if (status === "error") {
|
||||
message.error(`${info.file.name} file upload failed.`);
|
||||
}
|
||||
};
|
||||
const beforeUpload = (file) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// const isJpgOrPng =
|
||||
// file.name.indexOf(".xlsx") !== "-1" ||
|
||||
// file.name.indexOf(".xls") !== "-1";
|
||||
|
||||
// if (!isJpgOrPng) {
|
||||
// message.destroy();
|
||||
// message.error("仅支持xls、xlsx格式!");
|
||||
// return reject(false);
|
||||
// }
|
||||
const formData = new FormData();
|
||||
formData.append("uploadFile", file);
|
||||
// let progress = { percent: 1 };
|
||||
|
||||
// const intervalId = setInterval(() => {
|
||||
// if (progress.percent < 100) {
|
||||
// progress.percent++;
|
||||
// file.onProgress(progress);
|
||||
// } else {
|
||||
// clearInterval(intervalId);
|
||||
// }
|
||||
// }, 100);
|
||||
api.batchImportScore(formData).then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
console.log("上传成功", res);
|
||||
return reject(true);
|
||||
}
|
||||
});
|
||||
return reject(false);
|
||||
});
|
||||
};
|
||||
const handleUpload = (e) => {
|
||||
console.log("handleUpload", e);
|
||||
};
|
||||
return {
|
||||
...toRefs(state),
|
||||
afterVisibleChange,
|
||||
closeDrawer,
|
||||
handleChange,
|
||||
BATCH_IMPORT_SCORE,
|
||||
beforeUpload,
|
||||
handleUpload,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -281,12 +343,13 @@ export default {
|
||||
margin-left: 20px;
|
||||
position: relative;
|
||||
.defeat {
|
||||
width: 400px;
|
||||
position: absolute;
|
||||
left: 46px;
|
||||
top: 38px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #ff7474;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.img {
|
||||
width: 30px;
|
||||
|
||||
Reference in New Issue
Block a user