|
@@ -263,9 +263,11 @@
|
|
|
<el-form>
|
|
|
<el-form-item label="选择文件类型">
|
|
|
<el-radio-group v-model="fileType" @change="handleFileTypeChange">
|
|
|
- <el-radio label="zip">ZIP</el-radio>
|
|
|
- <el-radio label="pdf">PDF</el-radio>
|
|
|
- <el-radio label="image">图片(*.jpg|*.jpeg|*.png)</el-radio>
|
|
|
+ <el-radio v-show="optZipVisible" label="zip">ZIP</el-radio>
|
|
|
+ <el-radio v-show="optPdfVisible" label="pdf">PDF</el-radio>
|
|
|
+ <el-radio v-show="optImageVisible" label="image"
|
|
|
+ >图片(*.jpg|*.jpeg|*.png)</el-radio
|
|
|
+ >
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="选择文件">
|
|
@@ -447,7 +449,8 @@ export default {
|
|
|
pageNo: 1,
|
|
|
pageSize: 10,
|
|
|
examType: "",
|
|
|
- ORG_FIND_ALL: false //查询所有机构
|
|
|
+ ORG_FIND_ALL: false, //查询所有机构
|
|
|
+ examStageId: null
|
|
|
},
|
|
|
getExamCondition: {
|
|
|
params: {
|
|
@@ -466,7 +469,10 @@ export default {
|
|
|
},
|
|
|
summary: "",
|
|
|
summaryList: [],
|
|
|
- md5Size: 0
|
|
|
+ md5Size: 0,
|
|
|
+ optZipVisible: false,
|
|
|
+ optPdfVisible: false,
|
|
|
+ optImageVisible: false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -476,7 +482,6 @@ export default {
|
|
|
},
|
|
|
//计算是否显示图片上传框
|
|
|
uploadDisabled() {
|
|
|
- debugger;
|
|
|
return this.fileList.length >= this.fileLimit;
|
|
|
}
|
|
|
},
|
|
@@ -486,7 +491,6 @@ export default {
|
|
|
this.removeImgs();
|
|
|
},
|
|
|
handleChange(file, fileList) {
|
|
|
- debugger;
|
|
|
this.fileList = fileList;
|
|
|
this.calcSummary(this.fileList);
|
|
|
},
|
|
@@ -516,13 +520,16 @@ export default {
|
|
|
},
|
|
|
|
|
|
calcSummary(fileList) {
|
|
|
- this.summaryList = [];
|
|
|
- this.md5Size = 0;
|
|
|
+ var summaryList = [];
|
|
|
+ var md5Size = 0;
|
|
|
+
|
|
|
for (let i = 0; i < fileList.length; i++) {
|
|
|
let f = fileList[i];
|
|
|
this.getFileMD5(f.raw, md5 => {
|
|
|
- this.summaryList.push({ index: i, summary: md5 });
|
|
|
- this.md5Size++;
|
|
|
+ summaryList.push({ index: i, summary: md5 });
|
|
|
+ md5Size++;
|
|
|
+ this.summaryList = summaryList;
|
|
|
+ this.md5Size = md5Size;
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -557,7 +564,8 @@ export default {
|
|
|
pageNo: 1,
|
|
|
pageSize: 10,
|
|
|
examType: "",
|
|
|
- ORG_FIND_ALL: this.form.ORG_FIND_ALL
|
|
|
+ ORG_FIND_ALL: this.form.ORG_FIND_ALL,
|
|
|
+ examStageId: null
|
|
|
};
|
|
|
},
|
|
|
showMoreCondition() {
|
|
@@ -599,6 +607,7 @@ export default {
|
|
|
}
|
|
|
this.tableLoading = false;
|
|
|
});
|
|
|
+ this.getUploadFileType();
|
|
|
},
|
|
|
selectable(row) {
|
|
|
return row.isWarn;
|
|
@@ -710,6 +719,11 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
openUploadAnswerDialog(examStudentId) {
|
|
|
+ this.fileList = [];
|
|
|
+ this.imageAnswerFileList = [];
|
|
|
+ // this.offlineAnswerFile = "";
|
|
|
+ this.cleanOfflineFile();
|
|
|
+
|
|
|
this.$http
|
|
|
.get("/api/ecs_oe_admin/exam/record/data/findByExamStudentId", {
|
|
|
params: { examStudentId: examStudentId }
|
|
@@ -732,7 +746,6 @@ export default {
|
|
|
},
|
|
|
uploadAnswerChange(event) {
|
|
|
if (event.target.files.length > 0) {
|
|
|
- debugger;
|
|
|
this.offlineAnswerFile = event.target.files[0];
|
|
|
} else {
|
|
|
this.offlineAnswerFile = "";
|
|
@@ -776,7 +789,7 @@ export default {
|
|
|
headers: { "Content-Type": "multipart/form-data" }
|
|
|
};
|
|
|
let param = new FormData();
|
|
|
- debugger;
|
|
|
+
|
|
|
param.append("file", this.offlineAnswerFile);
|
|
|
param.append("examRecordDataId", this.currentOfflineExamRecordDataId);
|
|
|
this.$http
|
|
@@ -807,8 +820,34 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ //获取支持的文件上传类型
|
|
|
+ getUploadFileType() {
|
|
|
+ this.$http
|
|
|
+ .get(
|
|
|
+ "/api/ecs_exam_work/exam/property/" +
|
|
|
+ this.form.examId +
|
|
|
+ "/OFFLINE_UPLOAD_FILE_TYPE"
|
|
|
+ )
|
|
|
+ .then(response => {
|
|
|
+ var allowfileSuffixs = response.data;
|
|
|
+ if (!allowfileSuffixs || allowfileSuffixs.length == 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (allowfileSuffixs.some(p => p.toUpperCase() == "ZIP")) {
|
|
|
+ this.optZipVisible = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (allowfileSuffixs.some(p => p.toUpperCase() == "PDF")) {
|
|
|
+ this.optPdfVisible = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (allowfileSuffixs.some(p => p.toUpperCase() == "IMAGE")) {
|
|
|
+ this.optImageVisible = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
beforeUpload(file) {
|
|
|
- debugger;
|
|
|
var index = file.name.lastIndexOf(".");
|
|
|
var fileNameLength = file.name.length;
|
|
|
var fileSuffix = file.name
|
|
@@ -857,7 +896,6 @@ export default {
|
|
|
return promise; //通过返回一个promis对象解决
|
|
|
},
|
|
|
submitUpload() {
|
|
|
- debugger;
|
|
|
this.uploadAnswerDialogLoading = true;
|
|
|
let config = {
|
|
|
headers: { "Content-Type": "multipart/form-data" }
|
|
@@ -894,11 +932,13 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
cleanOfflineFile() {
|
|
|
- this.$refs.offlineFileInput.value = "";
|
|
|
+ if (this.$refs.offlineFileInput) {
|
|
|
+ this.$refs.offlineFileInput.value = "";
|
|
|
+ }
|
|
|
+
|
|
|
this.offlineAnswerFile = "";
|
|
|
},
|
|
|
downloadAnswer(files) {
|
|
|
- debugger;
|
|
|
if (files && files.length > 0) {
|
|
|
if (files[0].fileType != "image") {
|
|
|
window.open(files[0].offlineFileUrl);
|
|
@@ -930,7 +970,7 @@ export default {
|
|
|
},
|
|
|
batchSubmitUpload() {
|
|
|
this.$refs.upload.submit();
|
|
|
- debugger;
|
|
|
+
|
|
|
let params = new FormData();
|
|
|
params.append("examRecordDataId", this.currentOfflineExamRecordDataId);
|
|
|
params.append("fileType", this.fileType);
|
|
@@ -964,10 +1004,14 @@ export default {
|
|
|
this.offlineAnswerFile = "";
|
|
|
this.search();
|
|
|
})
|
|
|
- .catch(() => {
|
|
|
+ .catch(e => {
|
|
|
+ let errMsg = "上传失败";
|
|
|
+ if (e.response) {
|
|
|
+ errMsg = e.response.data.desc;
|
|
|
+ }
|
|
|
this.$notify({
|
|
|
title: "提示",
|
|
|
- message: "上传失败",
|
|
|
+ message: errMsg,
|
|
|
type: "error",
|
|
|
duration: 2000
|
|
|
});
|
|
@@ -996,7 +1040,11 @@ export default {
|
|
|
return false;
|
|
|
}
|
|
|
},
|
|
|
- created() {}
|
|
|
+ created() {
|
|
|
+ if (this.form.examId) {
|
|
|
+ this.getUploadFileType();
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
<style scoped>
|