xiatian 4 лет назад
Родитель
Сommit
5cbaf5354d

+ 5 - 0
src/modules/marking/routes/routes.js

@@ -11,6 +11,7 @@ import MarkWorkOverview from "../views/MarkWorkOverview.vue";
 import Marker from "../views/Marker.vue";
 import CourseDetail from "../views/CourseDetail.vue";
 import MarkerDetail from "../views/MarkerDetail.vue";
+import ExportTaskList from "../views/export_task_list.vue";
 
 export default [
   {
@@ -67,6 +68,10 @@ export default [
         path: "view_paper/:workId/:studentPaperId", //查看原卷
         component: ViewPaper,
       },
+      {
+        path: "export_task_list",
+        component: ExportTaskList, //导出任务列表
+      },
     ],
   },
   {

+ 44 - 1
src/modules/marking/views/MarkPaperCheck.vue

@@ -163,6 +163,13 @@
             @click="bachBackRefresh"
             >打回
           </el-button>
+          <el-button
+            type="primary"
+            size="mini"
+            icon="el-icon-download"
+            @click="exportData"
+            >导出</el-button
+          >
           <div style="width: 100%; margin-bottom: 10px"></div>
           <!-- 页面列表 -->
           <el-table
@@ -200,7 +207,7 @@
               sortable
             />
             <el-table-column label="课程" width="120" prop="courseName" />
-            <el-table-column label="试卷类型" width="120" prop="paperType" />
+            <el-table-column label="试卷名称" width="120" prop="paperType" />
             <el-table-column label="评卷员" width="120" prop="userName" />
             <el-table-column label="主观总分" width="120" prop="score" />
             <el-table-column
@@ -355,6 +362,42 @@ export default {
     window.viewPicture = this.viewPicture;
   },
   methods: {
+    exportData() {
+      if (!this.formSearch.workId) {
+        this.$notify({
+          title: "警告",
+          message: "请选择评卷工作",
+          type: "warning",
+          duration: 1000,
+        });
+        return false;
+      }
+
+      this.$confirm("确定执行导出?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        this.$http
+          .get(MARKING_API + "/export/task/paper_check", {
+            params: {
+              query: this.formSearch,
+            },
+          })
+          .then(() => {
+            this.$notify({
+              type: "success",
+              message: "正在后台导出中,请稍后到“导出任务列表”中下载!",
+            });
+          })
+          .catch((error) => {
+            this.$notify({
+              type: "error",
+              message: error.response.data.desc,
+            });
+          });
+      });
+    },
     selectChange(rows) {
       this.selectedIds = [];
       rows.forEach((element) => {

+ 276 - 0
src/modules/marking/views/export_task_list.vue

@@ -0,0 +1,276 @@
+<template>
+  <section style="margin-top: 0px">
+    <el-form
+      :model="formSearch"
+      :inline="true"
+      style="border-bottom: 1px solid rgb(221, 221, 221); margin-bottom: 10px"
+    >
+      <el-form-item label="评卷名称" prop="workId">
+        <el-select
+          v-model="formSearch.workId"
+          clearable
+          filterable
+          class="input"
+          placeholder="请选择"
+          size="small"
+          style="width: 150px"
+        >
+          <el-option
+            v-for="item in markWorkSelect"
+            :key="item.workId"
+            :label="item.markName"
+            :value="item.workId"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="类型">
+        <el-select
+          v-model="formSearch.type"
+          size="small"
+          class="w180"
+          placeholder="请选择"
+          clearable
+          @clear="clearTypeValue"
+        >
+          <el-option label="试卷检查" value="PAPER_CHECK"></el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="状态">
+        <el-select
+          v-model="formSearch.status"
+          size="small"
+          class="w180"
+          placeholder="请选择"
+          clearable
+          @clear="clearStatusValue"
+        >
+          <el-option label="导出中" value="EXPORTING"></el-option>
+          <el-option label="成功" value="SUCCESS"></el-option>
+          <el-option label="失败" value="ERROR"></el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button
+          size="small"
+          type="primary"
+          icon="el-icon-search"
+          @click="doSearch(1)"
+          >查询
+        </el-button>
+
+        <el-button size="small" icon="el-icon-refresh" @click="resetSearchForm">
+          重置
+        </el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-table
+      v-loading="loading"
+      :data="tableData"
+      element-loading-text="数据加载中"
+      style="width: 100%"
+      border
+      stripe
+    >
+      <el-table-column label="评卷ID" prop="workId" width="90px" sortable />
+      <el-table-column
+        label="评卷名称"
+        prop="workName"
+        width="105px"
+        sortable
+      />
+      <el-table-column
+        label="任务类型"
+        prop="typeTitle"
+        width="105px"
+        sortable
+      />
+      <el-table-column
+        label="任务状态"
+        prop="statusTitle"
+        width="105px"
+        sortable
+      />
+      <el-table-column label="状态描述" prop="statusMsg" />
+      <el-table-column label="创建人" prop="createName" width="90px" sortable />
+      <el-table-column
+        label="创建时间"
+        prop="creationTime"
+        width="155px"
+        sortable
+      />
+      <el-table-column
+        label="开始时间"
+        prop="startTime"
+        width="155px"
+        sortable
+      />
+      <el-table-column label="结束时间" prop="endTime" width="155px" sortable />
+
+      <el-table-column label="操作" width="180px">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="primary"
+            icon="el-icon-download"
+            :disabled="scope.row.status != 'SUCCESS'"
+            plain
+            @click="download(scope.row)"
+            >下载
+          </el-button>
+
+          <el-button
+            size="mini"
+            type="danger"
+            icon="el-icon-delete"
+            :disabled="scope.row.status == 'EXPORTING'"
+            plain
+            @click="doDelete(scope.row)"
+            >删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <div class="page pull-right">
+      <el-pagination
+        :current-page="formSearch.pageNo"
+        :page-size="formSearch.pageSize"
+        :page-sizes="[10, 20, 50, 100, 200, 300]"
+        :total="totalElements"
+        layout="total, sizes, prev, pager, next, jumper"
+        @current-change="handlePagerNo"
+        @size-change="handlePagerSize"
+      ></el-pagination>
+    </div>
+  </section>
+</template>
+
+<script>
+import { mapState } from "vuex";
+import { MARKING_API, DATA_PROCESS_API } from "@/constants/constants";
+
+export default {
+  data() {
+    return {
+      formSearch: {
+        workId: "",
+        type: null,
+        status: null,
+        pageNo: 1,
+        pageSize: 10,
+      },
+      loading: false,
+      tableData: [],
+      totalElements: 0,
+      markWorkList: [],
+    };
+  },
+  computed: {
+    ...mapState({ user: (state) => state.user }),
+    markWorkSelect() {
+      let markWorkNames = [];
+      for (let markWork of this.markWorkList) {
+        markWorkNames.push({
+          workId: markWork.id,
+          markName: markWork.name,
+        });
+      }
+      return markWorkNames;
+    },
+  },
+  created() {
+    this.getMarkWorks();
+    this.doSearch(1);
+  },
+  methods: {
+    getMarkWorks() {
+      this.$http
+        .get(DATA_PROCESS_API + "/markWorks?status=1")
+        .then((response) => {
+          this.markWorkList = response.data;
+          if (this.$route.query && this.$route.query.workId) {
+            this.formSearch.workId = parseInt(this.$route.query.workId);
+          }
+        });
+    },
+    doSearch(pageNo) {
+      this.formSearch.pageNo = pageNo;
+
+      this.loading = true;
+      let url = MARKING_API + "/export/task/list";
+      this.$http.post(url, this.formSearch).then(
+        (response) => {
+          this.tableData = response.data.content;
+          this.totalElements = response.data.totalElements;
+          this.loading = false;
+        },
+        (error) => {
+          console.log(error);
+          this.loading = false;
+        }
+      );
+    },
+    doDelete(row) {
+      this.$confirm("确认删除当前任务?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        let url = MARKING_API + "/export/task/delete?taskId=" + row.id;
+        this.$httpWithMsg.post(url).then(() => {
+          this.$notify({
+            type: "success",
+            message: "删除成功",
+          });
+          this.doSearch();
+        });
+      });
+    },
+    download(row) {
+      let opath = row.filePath;
+      let indx = opath.lastIndexOf("/");
+      let head = opath.substring(0, indx + 1);
+      let tail = opath.substring(indx + 1);
+      window.location.href = head + encodeURIComponent(tail);
+    },
+    handlePagerNo(pageNo) {
+      this.doSearch(pageNo);
+    },
+    handlePagerSize(pageSize) {
+      this.formSearch.pageSize = pageSize;
+      this.doSearch(1);
+    },
+    clearTypeValue() {
+      this.formSearch.type = null;
+    },
+    clearStatusValue() {
+      this.formSearch.status = null;
+    },
+    resetSearchForm() {
+      this.formSearch.examId = "";
+      this.formSearch.type = null;
+      this.formSearch.status = null;
+      this.doSearch(1);
+    },
+  },
+};
+</script>
+
+<style scoped>
+.page {
+  margin-top: 10px;
+}
+.pull-right {
+  float: right;
+}
+.pull-left {
+  float: left;
+}
+.w180 {
+  width: 180px;
+}
+</style>