Browse Source

导入导出结果查询

zhangjie 2 years ago
parent
commit
bfa793b615

+ 3 - 2
src/assets/styles/base.scss

@@ -135,7 +135,7 @@ body {
   }
 
   &-filter {
-    padding: 20px 20px 5px 20px;
+    padding: 20px;
 
     .el-form-item {
       margin-bottom: 15px;
@@ -152,6 +152,7 @@ body {
     display: flex;
     align-items: stretch;
     justify-content: space-between;
+    padding: 20px 20px 5px 20px;
   }
 
   &-action {
@@ -426,7 +427,7 @@ body {
   color: $--color-primary;
   cursor: pointer;
   &:hover {
-    color: $--color-success;
+    opacity: 0.9;
   }
 }
 .ml-1 {

+ 16 - 2
src/assets/styles/common-comp.scss

@@ -378,10 +378,24 @@ $--cc-list-upload-pre: cc-list-upload;
     line-height: 20px;
   }
   &-footer {
-    padding: 10px 0;
+    padding: 0 0 10px 0;
     font-size: 14px;
-    a:hover {
+    a,
+    .el-button--text {
       color: $--color-primary;
+      &:hover {
+        opacity: 0.9;
+      }
+    }
+  }
+
+  .el-dialog {
+    &__body {
+      background-color: $--color-background;
+      padding: 20px;
+    }
+    &__footer {
+      padding: 15px 20px;
     }
   }
 }

+ 10 - 3
src/assets/styles/pages.scss

@@ -1139,15 +1139,22 @@
 }
 
 // modify-school
-.modify-school{
-  .logo-image{
+.modify-school {
+  .logo-image {
     background-color: $--color-background;
     padding: 10px;
     border-radius: 5px;
     text-align: center;
   }
-  .logo-view{
+  .logo-view {
     max-width: 160px;
     max-height: 40px;
   }
 }
+
+// .data-task-dialog
+.data-task-dialog {
+  .el-dialog__footer {
+    display: none;
+  }
+}

+ 47 - 0
src/components/base/DataTaskDialog.vue

@@ -0,0 +1,47 @@
+<template>
+  <el-dialog
+    class="data-task-dialog page-dialog"
+    :visible.sync="modalIsShow"
+    title="数据任务进度"
+    top="10px"
+    width="1100px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+  >
+    <data-task-manage
+      v-if="modalIsShow"
+      none-privilege
+      :task-type="taskType"
+    ></data-task-manage>
+    <div slot="footer"></div>
+  </el-dialog>
+</template>
+
+<script>
+import DataTaskManage from "../../modules/exam/views/DataTaskManage.vue";
+
+export default {
+  name: "data-task-dialog",
+  components: {
+    DataTaskManage
+  },
+  props: {
+    taskType: {
+      type: String,
+      default: ""
+    }
+  },
+  data() {
+    return { modalIsShow: false };
+  },
+  methods: {
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    }
+  }
+};
+</script>

+ 78 - 37
src/modules/base/views/CourseManage.vue

@@ -1,7 +1,12 @@
 <template>
   <div class="course-manage">
-    <div class="part-box part-box-filter part-box-flex">
-      <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
+    <div class="part-box part-box-filter">
+      <el-form
+        ref="FilterForm"
+        label-position="right"
+        label-width="85px"
+        inline
+      >
         <template v-if="checkPrivilege('condition', 'condition')">
           <el-form-item label="开课部门:">
             <org-select
@@ -41,39 +46,47 @@
           >
         </el-form-item>
       </el-form>
-      <div class="part-box-action">
-        <el-button
-          v-if="checkPrivilege('button', 'Delete')"
-          type="danger"
-          :disabled="!filterHasQuery"
-          @click="toBatchDelete"
-          >批量删除</el-button
-        >
-        <el-button
-          type="success"
-          icon="el-icon-download"
-          v-if="checkPrivilege('button', 'TempleteDownload')"
-          ><a :href="downloadUrl" :download="dfilename">模板下载</a></el-button
-        >
-        <upload-button
-          v-if="checkPrivilege('button', 'Import')"
-          btn-icon="el-icon-circle-plus-outline"
-          btn-content="批量导入"
-          btn-type="success"
-          :upload-url="uploadUrl"
-          :format="['xls', 'xlsx']"
-          accept=".xls,.xlsx"
-          @valid-error="validError"
-          @upload-success="uploadSuccess"
-        >
-        </upload-button>
-        <el-button
-          v-if="checkPrivilege('button', 'add')"
-          type="primary"
-          icon="el-icon-circle-plus-outline"
-          @click="toAdd"
-          >新增课程</el-button
-        >
+      <div class="box-justify">
+        <div>
+          <el-button
+            v-if="checkPrivilege('button', 'Delete')"
+            type="danger"
+            :disabled="!filterHasQuery"
+            @click="toBatchDelete"
+            >批量删除</el-button
+          >
+          <el-button
+            v-if="checkPrivilege('button', 'export')"
+            type="primary"
+            icon="el-icon-download"
+            :loading="loading"
+            @click="toExportCourse"
+            >导出课程</el-button
+          >
+        </div>
+        <div>
+          <el-button
+            v-if="checkPrivilege('button', 'import')"
+            type="success"
+            icon="el-icon-upload2"
+            @click="toImport"
+            >导入课程</el-button
+          >
+          <el-button
+            v-if="checkPrivilege('button', 'import')"
+            type="primary"
+            icon="el-icon-s-order"
+            @click="toDataTask"
+            >导入结果查询</el-button
+          >
+          <el-button
+            v-if="checkPrivilege('button', 'add')"
+            type="primary"
+            icon="el-icon-circle-plus-outline"
+            @click="toAdd"
+            >新增课程</el-button
+          >
+        </div>
       </div>
     </div>
     <div class="part-box part-box-pad">
@@ -151,6 +164,24 @@
       @modified="getList"
       ref="ModifyCourse"
     ></modify-course>
+    <!-- ImportFile -->
+    <import-file
+      v-if="checkPrivilege('button', 'import')"
+      ref="ImportFile"
+      title="导入课程"
+      :upload-url="uploadUrl"
+      :format="['xls', 'xlsx']"
+      :download-url="downloadUrl"
+      :download-filename="dfilename"
+      :auto-upload="false"
+      @upload-success="uploadSuccess"
+    ></import-file>
+    <!-- data-task-dialog -->
+    <data-task-dialog
+      v-if="checkPrivilege('button', 'import')"
+      ref="DataTaskDialog"
+      task-type="COURSE_IMPORT"
+    ></data-task-dialog>
   </div>
 </template>
 
@@ -158,12 +189,12 @@
 import { courseListPage, deleteCourse, batchDeleteCourse } from "../api";
 import pickerOptions from "@/constants/datePickerOptions";
 import ModifyCourse from "../components/ModifyCourse";
-import UploadButton from "../../../components/UploadButton";
+import ImportFile from "../../../components/ImportFile.vue";
 import { ABLE_TYPE } from "@/constants/enumerate";
 
 export default {
   name: "course-manage",
-  components: { ModifyCourse, UploadButton },
+  components: { ModifyCourse, ImportFile },
   data() {
     return {
       filter: {
@@ -180,6 +211,7 @@ export default {
       total: 0,
       courses: [],
       curCourse: {},
+      loading: false,
       // import
       uploadUrl: "/api/admin/basic/course/data_import",
       downloadUrl: "/temps/courseTemplate.xlsx",
@@ -257,7 +289,16 @@ export default {
         })
         .catch(() => {});
     },
+    async toExportCourse() {
+      // TODO:
+    },
     // import
+    toImport() {
+      this.$refs.ImportFile.open();
+    },
+    toDataTask() {
+      this.$refs.DataTaskDialog.open();
+    },
     validError(errorData) {
       this.$message.error(errorData.message);
     },

+ 73 - 37
src/modules/base/views/StudentManage.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="student-manage">
-    <div class="part-box part-box-filter part-box-flex">
+    <div class="part-box part-box-filter">
       <el-form ref="FilterForm" label-position="left" label-width="90px" inline>
         <el-form-item label="学院:">
           <college-select
@@ -41,40 +41,48 @@
           >
         </el-form-item>
       </el-form>
-      <div class="part-box-action">
-        <el-button
-          v-if="checkPrivilege('button', 'delete')"
-          type="danger"
-          icon="el-icon-delete"
-          :disabled="!filterHasQuery"
-          @click="toBatchDelete"
-          >批量删除</el-button
-        >
-        <el-button
-          type="success"
-          icon="el-icon-download"
-          v-if="checkPrivilege('button', 'import')"
-          ><a :href="downloadUrl" :download="dfilename">模板下载</a></el-button
-        >
-        <upload-button
-          v-if="checkPrivilege('button', 'import')"
-          btn-icon="el-icon-circle-plus-outline"
-          btn-content="批量导入"
-          btn-type="success"
-          :upload-url="uploadUrl"
-          :format="['xls', 'xlsx']"
-          accept=".xls,.xlsx"
-          @valid-error="validError"
-          @upload-success="uploadSuccess"
-        >
-        </upload-button>
-        <el-button
-          v-if="checkPrivilege('button', 'add')"
-          type="primary"
-          icon="el-icon-circle-plus-outline"
-          @click="toAdd"
-          >新增学生</el-button
-        >
+      <div class="box-justify">
+        <div>
+          <el-button
+            v-if="checkPrivilege('button', 'delete')"
+            type="danger"
+            icon="el-icon-delete"
+            :disabled="!filterHasQuery"
+            @click="toBatchDelete"
+            >批量删除</el-button
+          >
+          <el-button
+            v-if="checkPrivilege('button', 'export')"
+            type="primary"
+            icon="el-icon-download"
+            :loading="loading"
+            @click="toExportStudent"
+            >导出学生</el-button
+          >
+        </div>
+        <div>
+          <el-button
+            v-if="checkPrivilege('button', 'import')"
+            type="success"
+            icon="el-icon-upload2"
+            @click="toImport"
+            >导入学生</el-button
+          >
+          <el-button
+            v-if="checkPrivilege('button', 'import')"
+            type="primary"
+            icon="el-icon-s-order"
+            @click="toDataTask"
+            >导入结果查询</el-button
+          >
+          <el-button
+            v-if="checkPrivilege('button', 'add')"
+            type="primary"
+            icon="el-icon-circle-plus-outline"
+            @click="toAdd"
+            >新增学生</el-button
+          >
+        </div>
       </div>
     </div>
     <div class="part-box part-box-pad">
@@ -142,17 +150,35 @@
       @modified="getList"
       ref="ModifyStudent"
     ></modify-student>
+    <!-- ImportFile -->
+    <import-file
+      v-if="checkPrivilege('button', 'import')"
+      ref="ImportFile"
+      title="导入学生"
+      :upload-url="uploadUrl"
+      :format="['xls', 'xlsx']"
+      :download-url="downloadUrl"
+      :download-filename="dfilename"
+      :auto-upload="false"
+      @upload-success="uploadSuccess"
+    ></import-file>
+    <!-- data-task-dialog -->
+    <data-task-dialog
+      v-if="checkPrivilege('button', 'import')"
+      ref="DataTaskDialog"
+      task-type="STUDENT_IMPORT"
+    ></data-task-dialog>
   </div>
 </template>
 
 <script>
 import { studentListQuery, deleteStudent, deleteFilterStudent } from "../api";
 import ModifyStudent from "../components/ModifyStudent";
-import UploadButton from "../../../components/UploadButton";
+import ImportFile from "../../../components/ImportFile.vue";
 
 export default {
   name: "student-manage",
-  components: { ModifyStudent, UploadButton },
+  components: { ModifyStudent, ImportFile },
   data() {
     return {
       filter: {
@@ -167,6 +193,7 @@ export default {
       total: 0,
       dataList: [],
       curRow: {},
+      loading: false,
       // import
       uploadUrl: "/api/admin/basic/student/data_import",
       downloadUrl: "/temps/studentTemplate.xlsx",
@@ -231,7 +258,16 @@ export default {
         })
         .catch(() => {});
     },
+    async toExportStudent() {
+      // TODO:
+    },
     // import
+    toImport() {
+      this.$refs.ImportFile.open();
+    },
+    toDataTask() {
+      this.$refs.DataTaskDialog.open();
+    },
     validError(errorData) {
       this.$message.error(errorData.message);
     },

+ 19 - 3
src/modules/base/views/UserManage.vue

@@ -86,6 +86,13 @@
             @click="toImport"
             >导入用户</el-button
           >
+          <el-button
+            v-if="checkPrivilege('button', 'import')"
+            type="primary"
+            icon="el-icon-s-order"
+            @click="toDataTask"
+            >导入结果查询</el-button
+          >
           <el-button
             v-if="checkPrivilege('button', 'add')"
             type="primary"
@@ -198,6 +205,12 @@
       :auto-upload="false"
       @upload-success="uploadSuccess"
     ></import-file>
+    <!-- data-task-dialog -->
+    <data-task-dialog
+      v-if="checkPrivilege('button', 'import')"
+      ref="DataTaskDialog"
+      task-type="USER_IMPORT"
+    ></data-task-dialog>
   </div>
 </template>
 
@@ -305,9 +318,6 @@ export default {
       this.curUser = {};
       this.$refs.ModifyUser.open();
     },
-    toImport() {
-      this.$refs.ImportFile.open();
-    },
     async toDelete(row) {
       // 自己不可以删除自己
       const userId = this.$ls.get("user", { id: "" }).id;
@@ -361,6 +371,12 @@ export default {
     //   this.$message.info("您的密码已经变更,请重新登录系统!");
     // },
     // import
+    toImport() {
+      this.$refs.ImportFile.open();
+    },
+    toDataTask() {
+      this.$refs.DataTaskDialog.open();
+    },
     validError(errorData) {
       this.$message.error(errorData.message);
     },

+ 36 - 20
src/modules/exam/views/DataTaskManage.vue

@@ -2,31 +2,33 @@
   <div class="data-task-manage">
     <div class="part-box part-box-filter part-box-flex">
       <el-form ref="FilterForm" label-position="left" label-width="55px" inline>
-        <template v-if="checkPrivilege('condition', 'condition')">
-          <el-form-item label="状态:">
+        <template v-if="checkPriv('condition', 'condition')">
+          <el-form-item label="类别:">
             <el-select
-              v-model="filter.status"
-              placeholder="状态"
+              v-model="filter.type"
+              placeholder="类别"
               clearable
-              style="width: 120px;"
+              filterable
+              :disabled="typeDisabled"
+              style="width:300px"
             >
               <el-option
-                v-for="(val, key) in DATA_TASK_STATUS"
+                v-for="(val, key) in DATA_TASK_TYPE"
                 :key="key"
                 :value="key"
                 :label="val"
               ></el-option>
             </el-select>
           </el-form-item>
-          <el-form-item label="类别:">
+          <el-form-item label="状态:">
             <el-select
-              v-model="filter.type"
-              placeholder="类别"
+              v-model="filter.status"
+              placeholder="状态"
               clearable
-              filterable
+              style="width: 120px;"
             >
               <el-option
-                v-for="(val, key) in DATA_TASK_TYPE"
+                v-for="(val, key) in DATA_TASK_STATUS"
                 :key="key"
                 :value="key"
                 :label="val"
@@ -51,7 +53,7 @@
         </template>
         <el-form-item>
           <el-button
-            v-if="checkPrivilege('button', 'select')"
+            v-if="checkPriv('button', 'select')"
             type="primary"
             @click="toPage(1)"
             >查询</el-button
@@ -115,7 +117,7 @@
         >
           <template slot-scope="scope">
             <el-button
-              v-if="scope.row.hasReportFile && checkPrivilege('link', 'export')"
+              v-if="scope.row.hasReportFile && checkPriv('link', 'export')"
               class="btn-primary"
               type="text"
               :disabled="loading"
@@ -123,9 +125,7 @@
               >导出日志</el-button
             >
             <el-button
-              v-if="
-                scope.row.resetCreatePdf && checkPrivilege('link', 'createPdf')
-              "
+              v-if="scope.row.resetCreatePdf && checkPriv('link', 'createPdf')"
               class="btn-primary"
               type="text"
               :disabled="loading"
@@ -133,9 +133,7 @@
               >重新生成PDF</el-button
             >
             <el-button
-              v-if="
-                !scope.row.resetCreatePdf && checkPrivilege('link', 'download')
-              "
+              v-if="!scope.row.resetCreatePdf && checkPriv('link', 'download')"
               class="btn-primary"
               type="text"
               :disabled="loading"
@@ -172,6 +170,16 @@ import { downloadByUrl } from "@/plugins/download";
 
 export default {
   name: "data-task-manage",
+  props: {
+    taskType: {
+      type: String,
+      default: ""
+    },
+    nonePrivilege: {
+      type: Boolean,
+      default: false
+    }
+  },
   data() {
     return {
       filter: {
@@ -179,6 +187,7 @@ export default {
         status: "",
         result: ""
       },
+      typeDisabled: false,
       current: 1,
       size: this.GLOBAL.pageSize,
       total: 0,
@@ -192,11 +201,18 @@ export default {
     };
   },
   mounted() {
+    if (this.taskType) {
+      this.filter.type = this.taskType;
+      this.typeDisabled = true;
+    }
     this.toPage(1);
   },
   methods: {
+    checkPriv(type, field) {
+      return this.nonePrivilege || this.checkPrivilege(type, field);
+    },
     async getList() {
-      if (!this.checkPrivilege("list", "list")) return;
+      if (!this.checkPriv("list", "list")) return;
 
       const datas = {
         ...this.filter,

+ 65 - 41
src/modules/exam/views/StatisticsManage.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="exam-statistics">
-    <div class="part-box part-box-filter part-box-flex">
+    <div class="part-box part-box-filter">
       <el-form ref="FilterForm" label-position="left" label-width="90px" inline>
         <el-form-item label="学期:">
           <semester-select v-model="filter.semesterId"></semester-select>
@@ -74,44 +74,43 @@
           >
         </el-form-item>
       </el-form>
-      <div class="part-box-action">
-        <el-button
-          v-if="checkPrivilege('button', 'Delete')"
-          type="danger"
-          icon="el-icon-delete"
-          :loading="loading"
-          @click="toBatDelete"
-          >批量删除</el-button
-        >
-        <el-button
-          v-if="checkPrivilege('button', 'Freshen')"
-          type="primary"
-          icon="el-icon-refresh"
-          :loading="loading"
-          :disabled="!filter.examId"
-          @click="toFresh"
-          >刷新数据</el-button
-        >
-        <el-button
-          type="success"
-          icon="el-icon-download"
-          v-if="checkPrivilege('button', 'import')"
-          ><a :href="downloadUrl" :download="dfilename">模板下载</a></el-button
-        >
-        <upload-button
-          v-if="checkPrivilege('button', 'import')"
-          btn-icon="el-icon-circle-plus-outline"
-          btn-content="导入"
-          btn-type="success"
-          :upload-url="uploadUrl"
-          :upload-data="uploadData"
-          :format="['xls', 'xlsx']"
-          accept=".xls,.xlsx"
-          :disabled="!filter.examId"
-          @valid-error="validError"
-          @upload-success="uploadSuccess"
-        >
-        </upload-button>
+      <div class="box-justify">
+        <div>
+          <el-button
+            v-if="checkPrivilege('button', 'Delete')"
+            type="danger"
+            icon="el-icon-delete"
+            :loading="loading"
+            @click="toBatDelete"
+            >批量删除</el-button
+          >
+          <el-button
+            v-if="checkPrivilege('button', 'Freshen')"
+            type="primary"
+            icon="el-icon-refresh"
+            :loading="loading"
+            :disabled="!filter.examId"
+            @click="toFresh"
+            >刷新数据</el-button
+          >
+        </div>
+        <div>
+          <el-button
+            v-if="checkPrivilege('button', 'import')"
+            type="success"
+            icon="el-icon-upload2"
+            :disabled="!filter.examId"
+            @click="toImport"
+            >导入</el-button
+          >
+          <el-button
+            v-if="checkPrivilege('button', 'import')"
+            type="primary"
+            icon="el-icon-s-order"
+            @click="toDataTask"
+            >导入结果查询</el-button
+          >
+        </div>
       </div>
     </div>
     <div class="part-box part-box-pad">
@@ -204,18 +203,37 @@
       :contents="curContents"
       ref="StatisticsDetailDialog"
     ></statistics-detail-dialog>
+    <!-- ImportFile -->
+    <import-file
+      v-if="checkPrivilege('button', 'import')"
+      ref="ImportFile"
+      title="导入"
+      :upload-url="uploadUrl"
+      :upload-data="uploadData"
+      :format="['xls', 'xlsx']"
+      :download-url="downloadUrl"
+      :download-filename="dfilename"
+      :auto-upload="false"
+      @upload-success="uploadSuccess"
+    ></import-file>
+    <!-- data-task-dialog -->
+    <data-task-dialog
+      v-if="checkPrivilege('button', 'import')"
+      ref="DataTaskDialog"
+      task-type="STATISTICS_IMPORT"
+    ></data-task-dialog>
   </div>
 </template>
 
 <script>
 import { statisticsList, statisticsDelete, statisticsFreshen } from "../api";
 import { organizationFindByTypeList } from "../../base/api";
-import UploadButton from "../../../components/UploadButton";
+import ImportFile from "../../../components/ImportFile.vue";
 import StatisticsDetailDialog from "../components/StatisticsDetailDialog.vue";
 
 export default {
   name: "exam-statistics",
-  components: { UploadButton, StatisticsDetailDialog },
+  components: { ImportFile, StatisticsDetailDialog },
   data() {
     return {
       filter: {
@@ -333,6 +351,12 @@ export default {
       this.$refs.StatisticsDetailDialog.open();
     },
     // import
+    toImport() {
+      this.$refs.ImportFile.open();
+    },
+    toDataTask() {
+      this.$refs.DataTaskDialog.open();
+    },
     validError(errorData) {
       this.$message.error(errorData.message);
     },

+ 30 - 11
src/modules/exam/views/TaskPaperManage.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="task-paper-manage">
-    <div class="part-box part-box-filter part-box-flex">
+    <div class="part-box part-box-filter">
       <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
         <template v-if="checkPrivilege('condition', 'condition')">
           <el-form-item label="学期:">
@@ -52,16 +52,26 @@
           >
         </el-form-item>
       </el-form>
-      <div class="part-box-action">
-        <el-button
-          v-if="checkPrivilege('button', 'BatchDownload')"
-          icon="el-icon-download"
-          type="primary"
-          :loading="loading"
-          @click="toBatchExport"
-        >
-          批量下载试卷题卡
-        </el-button>
+      <div class="box-justify">
+        <div></div>
+        <div>
+          <el-button
+            v-if="checkPrivilege('button', 'BatchDownload')"
+            icon="el-icon-download"
+            type="primary"
+            :loading="loading"
+            @click="toBatchExport"
+          >
+            批量下载试卷题卡
+          </el-button>
+          <el-button
+            v-if="checkPrivilege('button', 'BatchDownload')"
+            type="primary"
+            icon="el-icon-s-order"
+            @click="toDataTask"
+            >下载结果查询</el-button
+          >
+        </div>
       </div>
     </div>
 
@@ -197,6 +207,12 @@
       :instance="curPaper"
       ref="PublishPrintTask"
     ></publish-print-task>
+    <!-- data-task-dialog -->
+    <data-task-dialog
+      v-if="checkPrivilege('button', 'BatchDownload')"
+      ref="DataTaskDialog"
+      task-type="PAPER_AND_CARD_PDF_DOWNLOAD"
+    ></data-task-dialog>
   </div>
 </template>
 
@@ -368,6 +384,9 @@ export default {
       } else {
         this.$message.error("导出任务提交失败,请重新尝试!");
       }
+    },
+    toDataTask() {
+      this.$refs.DataTaskDialog.open();
     }
   },
   beforeRouteLeave(to, from, next) {

+ 139 - 53
src/modules/print/views/BusinessDataExport.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="business-data-export">
-    <div class="part-box part-box-filter part-box-flex">
+    <div class="part-box part-box-filter">
       <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
         <template v-if="checkPrivilege('condition', 'condition')">
           <el-form-item label="学期:">
@@ -17,13 +17,21 @@
             ></exam-select>
           </el-form-item>
           <el-form-item label="印刷计划:">
-            <print-plan-select
+            <el-select
               v-model.trim="filter.printPlanIdList"
               placeholder="印刷计划"
               clearable
               multiple
               @change="printPlanChange"
-            ></print-plan-select>
+            >
+              <el-option
+                v-for="item in plans"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              >
+              </el-option>
+            </el-select>
           </el-form-item>
           <el-form-item label="课程(代码):" label-width="110px">
             <course-select
@@ -89,33 +97,41 @@
           >
         </el-form-item>
       </el-form>
-      <div class="part-box-action">
-        <el-button
-          v-if="checkPrivilege('button', 'TempleteDownload')"
-          icon="el-icon-download"
-          type="success"
-          :loading="loading"
-          @click="toDownloadTemplate"
-        >
-          考务数据模板下载
-        </el-button>
-        <el-button
-          v-if="checkPrivilege('button', 'import')"
-          icon="el-icon-circle-plus-outline"
-          type="success"
-          @click="toUpload"
-        >
-          导入
-        </el-button>
-        <el-button
-          v-if="checkPrivilege('button', 'export')"
-          icon="el-icon-download"
-          type="primary"
-          :loading="loading"
-          @click="toExport"
-        >
-          导出查询结果
-        </el-button>
+      <div class="box-justify">
+        <div>
+          <el-button
+            v-if="checkPrivilege('button', 'export')"
+            icon="el-icon-download"
+            type="primary"
+            :loading="loading"
+            @click="toExport"
+          >
+            导出查询结果
+          </el-button>
+          <el-button
+            v-if="checkPrivilege('button', 'export')"
+            type="primary"
+            icon="el-icon-s-order"
+            @click="toDataTask('EXAMINATION_EXPORT')"
+            >导出结果查询</el-button
+          >
+        </div>
+        <div>
+          <el-button
+            v-if="checkPrivilege('button', 'import')"
+            type="success"
+            icon="el-icon-upload2"
+            @click="toImport"
+            >导入考务数据</el-button
+          >
+          <el-button
+            v-if="checkPrivilege('button', 'import')"
+            type="primary"
+            icon="el-icon-s-order"
+            @click="toDataTask('EXAMINATION_IMPORT')"
+            >导入结果查询</el-button
+          >
+        </div>
       </div>
     </div>
 
@@ -214,11 +230,57 @@
       ref="PreviewBusinessDetail"
       :instance="curRow"
     ></preview-business-detail>
-    <!-- UploadBusinessDataDialog -->
-    <upload-business-data-dialog
-      ref="UploadBusinessDataDialog"
-      @modified="getList"
-    ></upload-business-data-dialog>
+    <!-- ImportFile -->
+    <import-file
+      v-if="checkPrivilege('button', 'import')"
+      ref="ImportFile"
+      title="导入考务数据"
+      :upload-url="uploadUrl"
+      :upload-data="uploadData"
+      :format="['xls', 'xlsx']"
+      :auto-upload="false"
+      :before-submit-handle="submitImport"
+      @upload-success="uploadSuccess"
+    >
+      <el-form
+        ref="modalFormComp"
+        :model="modalForm"
+        :rules="rules"
+        label-width="90px"
+      >
+        <el-form-item label="模板下载:">
+          <el-button type="text" :loading="loading" @click="toDownloadTemplate">
+            <span class="cont-link">
+              {{ dfilename }}
+            </span>
+          </el-button>
+        </el-form-item>
+
+        <el-form-item prop="printPlanId" label="印刷计划:">
+          <el-select
+            v-model="modalForm.printPlanId"
+            placeholder="请选择"
+            filterable
+            :disabled="loading"
+            style="width:100%"
+          >
+            <el-option
+              v-for="item in plans"
+              :key="item.id"
+              :value="item.id"
+              :label="item.name"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+    </import-file>
+    <!-- data-task-dialog -->
+    <data-task-dialog
+      v-if="checkPrivilege('button', 'import')"
+      ref="DataTaskDialog"
+      :task-type="taskType"
+    ></data-task-dialog>
   </div>
 </template>
 
@@ -227,17 +289,18 @@ import {
   businessDataListPage,
   businessTotalData,
   businessTemplateDownload,
-  businessDataExport
+  businessDataExport,
+  printPlanQuery
 } from "../api";
 import PreviewBusinessDetail from "../components/PreviewBusinessDetail";
-import UploadBusinessDataDialog from "../components/UploadBusinessDataDialog";
+import ImportFile from "../../../components/ImportFile.vue";
 import { parseTimeRangeDateAndTime } from "@/plugins/utils";
 import { downloadByApi } from "@/plugins/download";
 import pickerOptions from "@/constants/datePickerOptions";
 
 export default {
   name: "business-data-export",
-  components: { PreviewBusinessDetail, UploadBusinessDataDialog },
+  components: { PreviewBusinessDetail, ImportFile },
   data() {
     return {
       filter: {
@@ -258,28 +321,31 @@ export default {
       dataList: [],
       curRow: {},
       totalData: {},
-      curPrintPlan: {},
       loading: false,
       // date-picker
       createTime: [],
       pickerOptions,
       // import
+      plans: [],
+      modalForm: { type: "FILE", printPlanId: "" },
+      rules: {
+        printPlanId: [
+          {
+            required: true,
+            message: "请选择印刷计划",
+            trigger: "change"
+          }
+        ]
+      },
+      taskType: "",
       uploadUrl: "/api/admin/exam/print/data_import",
-      uploadData: {
-        type: "FILE",
-        printPlanId: ""
-      }
+      dfilename: "考务数据模板.xlsx",
+      uploadData: {}
     };
   },
-  computed: {
-    canImport() {
-      return (
-        this.curPrintPlan && ["NEW", "READY"].includes(this.curPrintPlan.status)
-      );
-    }
-  },
   mounted() {
     this.search();
+    this.getPlans();
   },
   methods: {
     async getList() {
@@ -330,9 +396,6 @@ export default {
       this.filter.examRoom = "";
       this.filter.examPlace = "";
     },
-    toUpload() {
-      this.$refs.UploadBusinessDataDialog.open();
-    },
     async toExport() {
       // 异步导出
       if (this.loading) return;
@@ -373,6 +436,29 @@ export default {
     toPreview(row) {
       this.curRow = { ...row };
       this.$refs.PreviewBusinessDetail.open();
+    },
+    // import
+    async getPlans() {
+      const res = await printPlanQuery();
+      this.plans = res.filter(item => ["NEW", "READY"].includes(item.status));
+    },
+    toImport() {
+      this.$refs.ImportFile.open();
+    },
+    toDataTask(taskType) {
+      this.taskType = taskType;
+      this.$refs.DataTaskDialog.open();
+    },
+    async submitImport() {
+      this.uploadData = { ...this.modalForm };
+      return this.$refs.modalFormComp.validate();
+    },
+    validError(errorData) {
+      this.$message.error(errorData.message);
+    },
+    uploadSuccess() {
+      this.$message.success("文件上传成功,后台正在导入!");
+      this.getList();
     }
   }
 };

+ 3 - 1
src/plugins/globalVuePlugins.js

@@ -24,6 +24,7 @@ import MajorSelect from "../components/base/MajorSelect.vue";
 import ClassSelect from "../components/base/ClassSelect.vue";
 import ExamSelect from "../components/base/ExamSelect.vue";
 import OrgSelect from "../components/base/OrgSelect.vue";
+import DataTaskDialog from "../components/base/DataTaskDialog.vue";
 
 const components = {
   ViewFooter,
@@ -46,7 +47,8 @@ const components = {
   MajorSelect,
   ClassSelect,
   ExamSelect,
-  OrgSelect
+  OrgSelect,
+  DataTaskDialog
 };
 
 export default {