|
@@ -41,12 +41,20 @@
|
|
|
<el-button type="primary" @click="handleCurrentChange(1)">
|
|
|
查询
|
|
|
</el-button>
|
|
|
+ <el-button :loading="downloading" @click="exportHandle">
|
|
|
+ 导出
|
|
|
+ </el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<!-- <div class="part-box-action"></div> -->
|
|
|
</div>
|
|
|
<div class="part-box">
|
|
|
- <el-table ref="table" :data="tableData" resizable>
|
|
|
+ <el-table
|
|
|
+ ref="table"
|
|
|
+ :data="tableData"
|
|
|
+ resizable
|
|
|
+ @sort-change="sortChange"
|
|
|
+ >
|
|
|
<el-table-column label="序号" width="60">
|
|
|
<template slot-scope="scope">
|
|
|
{{ pageSize * (currentPage - 1) + scope.$index + 1 }}
|
|
@@ -57,8 +65,10 @@
|
|
|
<el-table-column
|
|
|
prop="questionCount"
|
|
|
label="试题数量"
|
|
|
+ sortable
|
|
|
></el-table-column>
|
|
|
- <el-table-column prop="paperCount" label="试卷数量"> </el-table-column>
|
|
|
+ <el-table-column prop="paperCount" label="试卷数量" sortable>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
<div class="part-page">
|
|
|
<el-pagination
|
|
@@ -76,9 +86,12 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { courseQueryApi } from "../../card/api";
|
|
|
-import { statisticsQueryApi } from "../api";
|
|
|
+import { statisticsQueryApi, statisticsExportApi } from "../api";
|
|
|
import pickerOptions from "@/constants/datePickerOptions";
|
|
|
import { omit } from "lodash";
|
|
|
+import { downloadByApi } from "@/plugins/download";
|
|
|
+// TODO:增加查看每套试卷的题型、难易度、知识点的分布(试卷结构分析)
|
|
|
+
|
|
|
export default {
|
|
|
name: "StatisticsManage",
|
|
|
computed: {
|
|
@@ -95,6 +108,8 @@ export default {
|
|
|
searchForm: {
|
|
|
courseId: "",
|
|
|
createTime: [],
|
|
|
+ orderField: "",
|
|
|
+ orderType: "",
|
|
|
},
|
|
|
courseLoading4Search: false,
|
|
|
tableData: [],
|
|
@@ -104,6 +119,7 @@ export default {
|
|
|
total: 10,
|
|
|
loading: false,
|
|
|
pickerOptions,
|
|
|
+ downloading: false,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -136,12 +152,36 @@ export default {
|
|
|
this.currentPage = val;
|
|
|
this.search();
|
|
|
},
|
|
|
+ sortChange({ prop, order }) {
|
|
|
+ if (!order) {
|
|
|
+ this.searchForm.orderField = undefined;
|
|
|
+ this.searchForm.orderType = undefined;
|
|
|
+ } else {
|
|
|
+ this.searchForm.orderField = prop;
|
|
|
+ this.searchForm.orderType = order === "ascending" ? "ASC" : "DESC";
|
|
|
+ }
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
async getCoursesList(query) {
|
|
|
this.courseLoading4Search = true;
|
|
|
const res = await courseQueryApi(query);
|
|
|
this.courseList = res.data || [];
|
|
|
this.courseLoading4Search = false;
|
|
|
},
|
|
|
+ async exportHandle() {
|
|
|
+ if (this.downloading) return;
|
|
|
+ this.downloading = true;
|
|
|
+
|
|
|
+ const res = await downloadByApi(() => {
|
|
|
+ return statisticsExportApi(this.searchForm);
|
|
|
+ }).catch((e) => {
|
|
|
+ this.$message.error(e || "导出失败,请重新尝试!");
|
|
|
+ });
|
|
|
+ this.downloading = false;
|
|
|
+
|
|
|
+ if (!res) return;
|
|
|
+ this.$message.success("导出成功!");
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|