|
@@ -1,12 +1,14 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<!-- 下载链接 -->
|
|
|
- <el-form :model="form" inline>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" inline>
|
|
|
<el-form-item label="批次名称" prop="examId">
|
|
|
<ExamSelect v-model="form.examId" />
|
|
|
</el-form-item>
|
|
|
- <el-button @click="add">导入</el-button>
|
|
|
+ <el-button @click="searchForm">查询</el-button>
|
|
|
+ <el-button @click="importFile">导入</el-button>
|
|
|
<!-- <el-button>导入</el-button> -->
|
|
|
+ <a :href="downloadUrl" download class="mx-2">下载模板</a>
|
|
|
</el-form>
|
|
|
|
|
|
<el-table :data="tableData" stripe style="width: 100%;">
|
|
@@ -37,7 +39,13 @@
|
|
|
size="mini"
|
|
|
type="primary"
|
|
|
plain
|
|
|
- @click="download({ id: scope.row.id, fileType: 'IMPORTFILE' })"
|
|
|
+ v-if="scope.row.status === 'FINISH'"
|
|
|
+ @click="
|
|
|
+ download({
|
|
|
+ id: scope.row.id,
|
|
|
+ type: scope.row.hasResultFile === '1' ? 'RESULT' : 'IMPORTFILE',
|
|
|
+ })
|
|
|
+ "
|
|
|
>
|
|
|
下载文件
|
|
|
</el-button>
|
|
@@ -45,7 +53,8 @@
|
|
|
size="mini"
|
|
|
type="primary"
|
|
|
plain
|
|
|
- @click="download({ id: scope.row.id, fileType: 'ERROR' })"
|
|
|
+ v-if="scope.row.hasReportFile === '1'"
|
|
|
+ @click="download({ id: scope.row.id, type: 'REPORT' })"
|
|
|
>
|
|
|
导出报告
|
|
|
</el-button>
|
|
@@ -63,12 +72,21 @@
|
|
|
:total="total"
|
|
|
/>
|
|
|
</div>
|
|
|
+
|
|
|
+ <ExamStudentImportDialog
|
|
|
+ ref="theDialog"
|
|
|
+ :examId="form.examId"
|
|
|
+ @reload="searchForm"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { searchTasks, downloadFile } from "@/api/examwork-task";
|
|
|
+import { searchTasks } from "@/api/examwork-task";
|
|
|
import { downloadFileURL } from "@/utils/utils";
|
|
|
+import ExamStudentImportDialog from "./ExamStudentImportDialog";
|
|
|
+import { EXAM_STUDENT_IMPORT_TEMPLATE_DOWNLOAD_URL } from "@/constant/constants";
|
|
|
+import { downloadFile } from "@/api/system-info";
|
|
|
|
|
|
export default {
|
|
|
name: "ExamStudentImport",
|
|
@@ -84,16 +102,22 @@ export default {
|
|
|
currentPage: 1,
|
|
|
pageSize: 10,
|
|
|
total: 10,
|
|
|
- selectedActivity: {},
|
|
|
+ downloadUrl: EXAM_STUDENT_IMPORT_TEMPLATE_DOWNLOAD_URL,
|
|
|
};
|
|
|
},
|
|
|
- created() {
|
|
|
- this.searchForm();
|
|
|
- },
|
|
|
+ components: { ExamStudentImportDialog },
|
|
|
methods: {
|
|
|
async searchForm() {
|
|
|
+ // try {
|
|
|
+ // const valid = await this.$refs.form.validate();
|
|
|
+ // if (!valid) return;
|
|
|
+ // } catch (error) {
|
|
|
+ // console.log(error);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
const res = await searchTasks({
|
|
|
type: "IMPORT_EXAM_STUDENT",
|
|
|
+ entityId: this.form.examId,
|
|
|
pageNumber: this.currentPage,
|
|
|
pageSize: this.pageSize,
|
|
|
});
|
|
@@ -109,9 +133,18 @@ export default {
|
|
|
this.currentPage = 1;
|
|
|
this.searchForm();
|
|
|
},
|
|
|
- add() {},
|
|
|
- async download({ id, fileType }) {
|
|
|
- const res = await downloadFile({ id, fileType });
|
|
|
+ async importFile() {
|
|
|
+ try {
|
|
|
+ const valid = await this.$refs.form.validate();
|
|
|
+ if (!valid) return;
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$refs.theDialog.openDialog();
|
|
|
+ },
|
|
|
+ async download({ id, type }) {
|
|
|
+ const res = await downloadFile({ id, type });
|
|
|
const url = res.data.data.url;
|
|
|
downloadFileURL(url);
|
|
|
},
|