刘洋 2 năm trước cách đây
mục cha
commit
8297637dc2

+ 82 - 42
src/modules/questions/views/AddPaperSelect.vue

@@ -13,7 +13,12 @@
             课程代码:{{ $route.query.courseNo }}
             课程代码:{{ $route.query.courseNo }}
           </p>
           </p>
         </div>
         </div>
-        <el-button type="primary" size="small" @click="save">保存</el-button>
+        <div>
+          <el-button type="primary" size="small" @click="save">保存</el-button>
+          <el-button type="primary" size="small" plain @click="back"
+            >返回</el-button
+          >
+        </div>
       </div>
       </div>
       <div class="form">
       <div class="form">
         <el-form
         <el-form
@@ -121,7 +126,7 @@
               <div style="color: #606266; font-size: 14px; line-height: 32px">
               <div style="color: #606266; font-size: 14px; line-height: 32px">
                 <span>选中范围预览:</span>
                 <span>选中范围预览:</span>
                 <span
                 <span
-                  v-if="hasError()"
+                  v-if="hasError"
                   class="red"
                   class="red"
                   style="font-size: 12px; font-weight: bold"
                   style="font-size: 12px; font-weight: bold"
                   >不满足最低要求</span
                   >不满足最低要求</span
@@ -140,20 +145,35 @@
                   :prop="item.prop"
                   :prop="item.prop"
                 >
                 >
                   <template slot-scope="scope">
                   <template slot-scope="scope">
-                    <span
+                    <div
                       v-if="
                       v-if="
-                        !['hardInfo', 'mediumInfo', 'easyInfo'].includes(
+                        ['hardInfo', 'mediumInfo', 'easyInfo'].includes(
                           item.prop
                           item.prop
                         )
                         )
                       "
                       "
-                      :class="{ red: hasNumError(scope.row, item.prop) }"
-                      >{{ scope.row[item.prop] }}</span
-                    >
-                    <span
-                      v-else
-                      :class="{ red: hasNumError(scope.row, item.prop) }"
-                      >{{ scope.row[item.prop]?.count }}</span
                     >
                     >
+                      <el-tooltip
+                        v-if="!scope.row[item.prop].valid"
+                        effect="dark"
+                        :content="scope.row[item.prop].invalidMsg"
+                        placement="top"
+                      >
+                        <span class="red">{{
+                          scope.row[item.prop]?.count
+                        }}</span>
+                      </el-tooltip>
+                      <span v-else>{{ scope.row[item.prop]?.count }}</span>
+                    </div>
+                    <div v-else>
+                      <span
+                        v-if="
+                          item.prop === 'totalCount' && hasNumError(scope.row)
+                        "
+                        style="color: #f56c6c; font-weight: bold"
+                        >{{ scope.row[item.prop] }}</span
+                      >
+                      <span v-else>{{ scope.row[item.prop] }}</span>
+                    </div>
                   </template>
                   </template>
                 </el-table-column>
                 </el-table-column>
               </el-table>
               </el-table>
@@ -173,6 +193,7 @@ export default {
   components: { LinkTitlesCustom },
   components: { LinkTitlesCustom },
   data() {
   data() {
     return {
     return {
+      hasError: false,
       form: {
       form: {
         paperStructType: "BLUEPRINT",
         paperStructType: "BLUEPRINT",
         name: "",
         name: "",
@@ -288,11 +309,18 @@ export default {
         return true;
         return true;
       }
       }
     },
     },
+    back() {
+      if (this.$route.params?.id) {
+        this.$router.push("/questions/extract_paper_template");
+      } else {
+        this.$router.push("/questions/gen_paper/0");
+      }
+    },
     save() {
     save() {
       this.checked = true;
       this.checked = true;
       this.$refs.form.validate((valid) => {
       this.$refs.form.validate((valid) => {
         if (valid) {
         if (valid) {
-          if (this.multipleSelection.length && !this.hasError()) {
+          if (this.multipleSelection.length && !this.hasError) {
             let params = {
             let params = {
               courseId: this.$route.query.courseId,
               courseId: this.$route.query.courseId,
               ...this.form,
               ...this.form,
@@ -318,6 +346,9 @@ export default {
       return !!this.form.paperStructId;
       return !!this.form.paperStructId;
     },
     },
     structChange() {
     structChange() {
+      if (!this.form.paperStructId) {
+        return;
+      }
       this.tableLoading1 = true;
       this.tableLoading1 = true;
       this.$http
       this.$http
         .post("/api/ecs_ques/randompaper/struct/question/info", null, {
         .post("/api/ecs_ques/randompaper/struct/question/info", null, {
@@ -394,6 +425,7 @@ export default {
           if (this.lastRequestKey === str) {
           if (this.lastRequestKey === str) {
             this.tableData3 = res.data.structQuestionInfo || [];
             this.tableData3 = res.data.structQuestionInfo || [];
             this.tableLoading3 = false;
             this.tableLoading3 = false;
+            this.hasError = !res.data.valid;
           }
           }
         });
         });
     },
     },
@@ -401,39 +433,44 @@ export default {
       this.multipleSelection = val;
       this.multipleSelection = val;
       this.getTable3();
       this.getTable3();
     },
     },
-    hasNumError(row, prop) {
-      if (prop === "detailName") {
-        return false;
-      } else {
-        let targetName = row.detailName;
-        let find = this.tableData1.find(
-          (item) => item.detailName === targetName
-        );
-        if (!find) {
-          return false;
-        } else {
-          if (prop === "totalCount") {
-            return row[prop] < find[prop];
-          } else {
-            return row[prop].count < find[prop].count;
-          }
-        }
-      }
-    },
-    hasError() {
+    hasNumError(row) {
       return (
       return (
-        this.tableData1.length &&
-        this.tableData3.length &&
-        this.tableData3.every((item) => {
-          return (
-            this.hasNumError(item, "totalCount") ||
-            this.hasNumError(item, "hardInfo") ||
-            this.hasNumError(item, "mediumInfo") ||
-            this.hasNumError(item, "easyInfo")
-          );
-        })
+        row.easyInfo?.valid == false ||
+        row.hardInfo?.valid == false ||
+        row.mediumInfo?.valid == false
       );
       );
+      // if (prop === "detailName") {
+      //   return false;
+      // } else {
+      //   let targetName = row.detailName;
+      //   let find = this.tableData1.find(
+      //     (item) => item.detailName === targetName
+      //   );
+      //   if (!find) {
+      //     return false;
+      //   } else {
+      //     if (prop === "totalCount") {
+      //       return row[prop] < find[prop];
+      //     } else {
+      //       return row[prop].count < find[prop].count;
+      //     }
+      //   }
+      // }
     },
     },
+    // hasError() {
+    //   return (
+    //     this.tableData1.length &&
+    //     this.tableData3.length &&
+    //     this.tableData3.every((item) => {
+    //       return (
+    //         this.hasNumError(item, "totalCount") ||
+    //         this.hasNumError(item, "hardInfo") ||
+    //         this.hasNumError(item, "mediumInfo") ||
+    //         this.hasNumError(item, "easyInfo")
+    //       );
+    //     })
+    //   );
+    // },
   },
   },
 };
 };
 </script>
 </script>
@@ -450,6 +487,9 @@ export default {
 
 
   ::v-deep .red {
   ::v-deep .red {
     color: #f56c6c;
     color: #f56c6c;
+    font-weight: bold;
+    text-decoration: underline;
+    cursor: pointer;
   }
   }
 
 
   p {
   p {

+ 17 - 13
src/modules/questions/views/ExtractPaperInfo.vue

@@ -363,7 +363,6 @@ import { EXAM_WORK_API, QUESTION_API } from "@/constants/constants";
 import { mapState } from "vuex";
 import { mapState } from "vuex";
 import _ from "lodash";
 import _ from "lodash";
 import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
 import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
-import qs from "qs";
 export default {
 export default {
   components: { LinkTitlesCustom },
   components: { LinkTitlesCustom },
   data() {
   data() {
@@ -478,19 +477,24 @@ export default {
             ? structItem.difficulty
             ? structItem.difficulty
             : "";
             : "";
 
 
+          // this.$http
+          //   .post(
+          //     "/api/ecs_ques/randompaper/struct/question/view/info",
+          //     qs.stringify({
+          //       paperIds: this.randomTplInfo.paperIds.join(","),
+          //       structId: this.curStructInfo.paperStructId,
+          //     }),
+          //     {
+          //       headers: {
+          //         "content-type": "application/x-www-form-urlencoded",
+          //       },
+          //     }
+          //   )
           this.$http
           this.$http
-            .post(
-              "/api/ecs_ques/randompaper/struct/question/view/info",
-              qs.stringify({
-                paperIds: this.randomTplInfo.paperIds.join(","),
-                structId: this.curStructInfo.paperStructId,
-              }),
-              {
-                headers: {
-                  "content-type": "application/x-www-form-urlencoded",
-                },
-              }
-            )
+            .post("/api/ecs_ques/randompaper/struct/question/info", null, {
+              params: { structId: this.curStructInfo.paperStructId },
+              headers: { "content-type": "application/x-www-form-urlencoded" },
+            })
             .then((res) => {
             .then((res) => {
               this.randomTplInfo.tableData = res.data.structQuestionInfo || [];
               this.randomTplInfo.tableData = res.data.structQuestionInfo || [];
             });
             });

+ 3 - 0
src/modules/questions/views/ExtractPaperRule.vue

@@ -117,6 +117,9 @@
             <div class="el_table_inner_left">
             <div class="el_table_inner_left">
               <span v-show="scope.row.callType == 'WHOLE_SET'">成套调用</span>
               <span v-show="scope.row.callType == 'WHOLE_SET'">成套调用</span>
               <span v-show="scope.row.callType == 'RESTRUCT'">重组调用</span>
               <span v-show="scope.row.callType == 'RESTRUCT'">重组调用</span>
+              <span v-show="scope.row.callType == 'RANDOM_PAPER'"
+                >随机抽题</span
+              >
             </div>
             </div>
           </template>
           </template>
         </el-table-column>
         </el-table-column>

+ 1 - 1
src/modules/questions/views/ExtractPaperTemplate.vue

@@ -100,7 +100,7 @@ export default {
       total: 0,
       total: 0,
       tableData: [],
       tableData: [],
       columns: [
       columns: [
-        { label: "ID", prop: "id", width: 178 },
+        // { label: "ID", prop: "id", width: 178 },
         { label: "模板名称", prop: "name" },
         { label: "模板名称", prop: "name" },
         { label: "课程代码", prop: "courseCode" },
         { label: "课程代码", prop: "courseCode" },
         { label: "课程名称", prop: "courseName" },
         { label: "课程名称", prop: "courseName" },