nikang 6 年之前
父節點
當前提交
c68a7c3e43
共有 1 個文件被更改,包括 116 次插入76 次删除
  1. 116 76
      src/modules/marking/views/MarkPaperCheck.vue

+ 116 - 76
src/modules/marking/views/MarkPaperCheck.vue

@@ -9,22 +9,21 @@
             ref="formSearch"
             label-width="70px"
           >
-            <el-form-item label="评卷名称" prop="markId">
+            <el-form-item label="评卷名称" prop="workId">
               <el-select
                 clearable
                 filterable
                 class="input"
-                v-model="formSearch.markId"
+                v-model="formSearch.workId"
                 placeholder="请选择"
                 style="width:150px;"
-                @change="getCourses"
+                @change="changeMarkWork"
               >
-                <el-option value>请选择</el-option>
                 <el-option
                   v-for="item in markWorkSelect"
                   :label="item.markName"
-                  :value="item.markId"
-                  :key="item.markId"
+                  :value="item.workId"
+                  :key="item.workId"
                 ></el-option>
               </el-select>
             </el-form-item>
@@ -41,7 +40,6 @@
                 style="width:150px;"
                 @focus="e => getOrgs(e.target.value)"
               >
-                <el-option label="请选择" value></el-option>
                 <el-option
                   v-for="item in orgList"
                   :label="item.name"
@@ -72,7 +70,6 @@
                 filterable
                 style="width:150px;"
               >
-                <el-option label="请选择" value></el-option>
                 <el-option
                   v-for="item in tags"
                   :label="item.name"
@@ -91,7 +88,6 @@
                 placeholder="请选择"
                 style="width:150px;"
               >
-                <el-option label="请选择" value></el-option>
                 <el-option
                   v-for="item in courseAllListSelect"
                   :label="item.courseInfo"
@@ -109,7 +105,6 @@
                 placeholder="请选择"
                 style="width:150px;"
               >
-                <el-option label="请选择" value></el-option>
                 <el-option
                   v-for="item in userList"
                   :label="item.name"
@@ -135,7 +130,7 @@
                 >查询</el-button
               >
               <el-button
-                @click="resetForm('formSearch')"
+                @click="resetForm()"
                 size="small"
                 icon="el-icon-refresh"
                 >重置</el-button
@@ -222,7 +217,7 @@
           </el-table>
           <div class="page pull-right">
             <el-pagination
-              background
+              v-if="paginationShow"
               @current-change="handleCurrentChange"
               @size-change="handleSizeChange"
               :current-page="currentPage"
@@ -253,8 +248,6 @@ export default {
         courseCode: "",
         userId: "",
         workId: "",
-        specialtyCode: "",
-        examType: "",
         markRemark: ""
       },
       orgList: [],
@@ -265,9 +258,8 @@ export default {
       currentPage: 1,
       pageSize: 10,
       total: 0,
-      workId: "",
+      paginationShow: false,
       examId: "",
-      paper: "",
       tags: [],
       loading: false,
       examType: "",
@@ -281,7 +273,7 @@ export default {
       let markWorkNames = [];
       for (let markWork of this.markWorkList) {
         markWorkNames.push({
-          markId: markWork.id,
+          workId: markWork.id,
           markName: markWork.name,
           examId: markWork.examId
         });
@@ -298,11 +290,38 @@ export default {
     }
   },
   methods: {
+    changeMarkWork() {
+      if (this.$route.query) {
+        this.$router.push({ path: "/marking/mark_paper_check" });
+      }
+      let obj = {};
+      for (let item of this.markWorkList) {
+        if (item.id === this.formSearch.workId) {
+          obj = item;
+          break;
+        }
+      }
+      this.examId = obj.examId;
+      this.examType = obj.examType;
+      this.getCourses();
+      this.formSearch = Object.assign(this.formSearch, {
+        orgCode: "",
+        studentName: "",
+        studentCode: "",
+        tag: "",
+        courseCode: "",
+        userId: "",
+        markRemark: ""
+      });
+    },
     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);
+          }
         });
     },
     //查询学习中心
@@ -314,30 +333,36 @@ export default {
       });
     },
     //查询课程
-    getCourses(markId) {
-      let workId = this.formSearch.markId;
-      if (markId) {
-        workId = markId;
-      }
+    getCourses() {
       this.$http
-        .get(MARKING_API + "/markResults/queryExamCourseList?workId=" + workId)
+        .get(
+          MARKING_API +
+            "/markResults/queryExamCourseList?workId=" +
+            this.formSearch.workId
+        )
         .then(response => {
           this.courseList = response.data;
+          if (this.$route.query && this.$route.query.courseCode) {
+            this.formSearch.courseCode = this.$route.query.courseCode;
+            this.getUserList();
+          }
         });
     },
     //查询评委
     getUserList() {
-      this.formSearch.userId = "";
       this.$http
         .get(
           DATA_PROCESS_API +
             "/markUsers/assign?workId=" +
-            this.workId +
+            this.formSearch.workId +
             "&courseCode=" +
             this.formSearch.courseCode
         )
         .then(response => {
           this.userList = response.data;
+          if (this.$route.query && this.$route.query.userId) {
+            this.formSearch.userId = parseInt(this.$route.query.userId);
+          }
         });
     },
     //查询标记卷
@@ -364,7 +389,11 @@ export default {
     },
     //查询方法
     searchMarkPaperCheck() {
-      if (!this.formSearch.markId) {
+      this.currentPage = 1;
+      this.initMarkPaperCheck();
+    },
+    initMarkPaperCheck() {
+      if (!this.formSearch.workId) {
         this.$notify({
           title: "警告",
           message: "请选择评卷名称",
@@ -372,17 +401,6 @@ export default {
         });
         return false;
       }
-      let obj = {};
-      for (let item of this.markWorkList) {
-        if (item.id === this.formSearch.markId) {
-          obj = item;
-          break;
-        }
-      }
-      this.examId = obj.examId;
-      this.formSearch.workId = this.formSearch.markId;
-      this.examType = obj.examType;
-      this.formSearch.examType = this.examType;
       this.loading = true;
       var url =
         DATA_PROCESS_API +
@@ -390,33 +408,56 @@ export default {
         (this.currentPage - 1) +
         "/" +
         this.pageSize;
-      this.$http
-        .get(url, { params: this.formSearch })
-        .then(response => {
-          console.log("查询的列表集合", response);
-          this.tableData = response.data.list;
-          this.total = response.data.total;
-          this.loading = false;
-          this.$router.push({
-            path:
-              "/marking/mark_paper_check?" +
-              new URLSearchParams(JSON.parse(JSON.stringify(this.formSearch)))
-          });
-        })
-        .catch(function(response) {
-          console.log(response);
+      this.$http.get(url, { params: this.formSearch }).then(response => {
+        console.log("查询的列表集合", response);
+        this.tableData = response.data.list;
+        this.total = response.data.total;
+        this.loading = false;
+        this.$router.push({
+          path: "/marking/mark_paper_check",
+          query: {
+            workId: this.formSearch.workId,
+            orgCode: this.formSearch.orgCode,
+            studentName: this.formSearch.studentName,
+            studentCode: this.formSearch.studentCode,
+            tag: this.formSearch.tag,
+            courseCode: this.formSearch.courseCode,
+            userId: this.formSearch.userId,
+            markRemark: this.formSearch.markRemark,
+            examId: this.examId,
+            examType: this.examType,
+            currentPage: this.currentPage,
+            pageSize: this.pageSize
+          }
         });
+        this.$nextTick(function() {
+          this.paginationShow = true;
+        });
+      });
     },
-    resetForm(formName) {
-      this.$refs[formName].resetFields();
+    resetForm() {
+      this.formSearch = Object.assign(this.formSearch, {
+        orgCode: "",
+        studentName: "",
+        studentCode: "",
+        tag: "",
+        courseCode: "",
+        userId: "",
+        workId: "",
+        markRemark: ""
+      });
+      this.tableData = [];
+      this.total = 0;
+      this.$router.push({ path: "/marking/mark_paper_check" });
     },
     handleCurrentChange(val) {
       this.currentPage = val;
-      this.searchMarkPaperCheck();
+      this.initMarkPaperCheck();
     },
     handleSizeChange(val) {
       this.pageSize = val;
-      this.searchMarkPaperCheck();
+      this.currentPage = 1;
+      this.initMarkPaperCheck();
     },
     //查看原卷
     viewPaper(row) {
@@ -425,7 +466,7 @@ export default {
         console.log("studentPaperId:", studentPaperId);
         var urls =
           "/marking/view_paper/" +
-          this.formSearch.markId +
+          this.formSearch.workId +
           "/" +
           this.examId +
           "/" +
@@ -461,32 +502,31 @@ export default {
         }
       }
     },
-    backFill() {
-      var formData = this.$route.query;
-      if (formData && formData.markId) {
-        for (var attr in formData) {
-          var value = formData[attr];
-          if (value && value != "null") {
-            if (!isNaN(value)) {
-              if (~~value == value) {
-                value = parseInt(value);
-              } else {
-                value = parseFloat(value);
-              }
-            }
-            this.formSearch[attr] = value;
-          }
-        }
+    operaQuery() {
+      let formData = this.$route.query;
+      if (formData && formData.workId) {
+        this.formSearch.workId = formData.workId;
+        this.formSearch.orgCode = formData.orgCode;
+        this.formSearch.studentName = formData.studentName;
+        this.formSearch.studentCode = formData.studentCode;
+        this.formSearch.markRemark = formData.markRemark;
+        this.formSearch.courseCode = formData.courseCode;
+        this.formSearch.userId = formData.userId;
+        this.formSearch.tag = formData.tag;
+        this.examId = formData.examId;
+        this.examType = formData.examType;
+        this.currentPage = parseInt(formData.currentPage);
+        this.pageSize = parseInt(formData.pageSize);
         this.getCourses();
-        this.searchMarkPaperCheck();
+        this.initMarkPaperCheck();
       }
     }
   },
   created() {
-    this.getMarkWorks();
     //查询标记卷
     this.getTags();
-    this.backFill();
+    this.getMarkWorks();
+    this.operaQuery();
   }
 };
 </script>