nikang 6 years ago
parent
commit
fa058ac89f
2 changed files with 35 additions and 25 deletions
  1. 1 0
      src/modules/marking/views/MarkPaperCheck.vue
  2. 34 25
      src/modules/marking/views/Marker.vue

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

@@ -18,6 +18,7 @@
                 placeholder="请选择"
                 style="width:150px;"
                 @change="changeMarkWork"
+                @clear="resetForm"
               >
                 <el-option
                   v-for="item in markWorkSelect"

+ 34 - 25
src/modules/marking/views/Marker.vue

@@ -14,15 +14,16 @@
                 clearable
                 filterable
                 class="input"
-                v-model="formSearch.markId"
+                v-model="formSearch.workId"
                 placeholder="请选择"
+                @clear="clearData"
               >
                 <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>
@@ -43,7 +44,7 @@
                 size="small"
                 type="primary"
                 icon="el-icon-search"
-                @click="searchSetting"
+                @click="searchBtnFn"
                 >查询</el-button
               >
             </el-form-item>
@@ -144,7 +145,8 @@ export default {
     return {
       formSearch: {
         userLoginName: "",
-        userName: ""
+        userName: "",
+        workId: ""
       },
       tableData: [],
       oldData: [],
@@ -152,12 +154,27 @@ export default {
       pageSize: 10,
       total: 10,
       loading: false,
-      workId: "",
       markWorkList: [],
       paginationShow: false
     };
   },
   methods: {
+    clearData() {
+      this.formSearch = Object.assign(this.formSearch, {
+        workId: "",
+        userLoginName: "",
+        userName: ""
+      });
+      this.tableData = [];
+      this.total = 0;
+      this.$router.push({
+        path: "/marking/marker"
+      });
+    },
+    searchBtnFn() {
+      this.currentPage = 1;
+      this.searchSetting();
+    },
     handleSettingCurrentChange(val) {
       this.currentPage = val;
       this.searchSetting();
@@ -167,7 +184,7 @@ export default {
       this.searchSetting();
     },
     searchSetting() {
-      if (!this.formSearch.markId) {
+      if (!this.formSearch.workId) {
         this.$notify({
           title: "警告",
           message: "请选择评卷名称",
@@ -175,7 +192,6 @@ export default {
         });
         return false;
       }
-      this.workId = this.formSearch.markId;
       this.loading = true;
       this.$http
         .get(
@@ -185,7 +201,7 @@ export default {
             "/" +
             this.pageSize +
             "?workId=" +
-            this.workId,
+            this.formSearch.workId,
           { params: this.formSearch }
         )
         .then(response => {
@@ -206,7 +222,7 @@ export default {
     markerDetail(row) {
       var url =
         "/marking/marker_detail/" +
-        this.workId +
+        this.formSearch.workId +
         "/" +
         row.userId +
         "/" +
@@ -221,24 +237,17 @@ export default {
         .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);
+          }
         });
     },
     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;
-          }
-        }
+      if (formData && formData.workId) {
+        this.formSearch.workId = parseInt(formData.workId);
+        this.formSearch.userLoginName = formData.userLoginName;
+        this.formSearch.userName = formData.userName;
         this.searchSetting();
       }
     }
@@ -249,7 +258,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
         });