소스 검색

提交题库前段代码

weiwenhai 6 년 전
부모
커밋
6fa5f10296

+ 4 - 4
src/modules/questions/routes/routes.js

@@ -120,10 +120,6 @@ export default [
         path:
           "edit_select_question/:paperId/:paperDetailId/:questionType/:courseNo/:courseName",
         component: EditSelectQuestion
-      },
-      {
-        path: "preview_paper/:paperId", //预览试卷
-        component: PreviewPaper
       }
     ]
   },
@@ -135,5 +131,9 @@ export default [
     path:
       "/select_question/:id/:courseNo/:courseName/:paperDetailId/:parentView", //试卷选题
     component: SelectQuestion
+  },
+  {
+    path: "preview_paper/:paperId", //预览试卷
+    component: PreviewPaper
   }
 ];

+ 38 - 0
src/modules/questions/styles/Common.css

@@ -38,3 +38,41 @@
 .row_quesBody p {
   font-size: 13px;
 }
+
+.dialog_input_width {
+  width: 200px;
+}
+
+.margin_top_10 {
+  margin-top: 10px;
+}
+
+.margin_left_120 {
+  margin-left: 120px;
+}
+
+.margin_left_10 {
+  margin-left: 10px;
+}
+
+.error_message {
+  color: #f56c6c;
+  font-size: 12px;
+  line-height: 1;
+  padding-top: 4px;
+}
+
+.error_other {
+  position: relative;
+  top: auto;
+  left: auto;
+  display: inline-block;
+  margin-left: 10px;
+}
+
+.check_remark {
+  content: "*";
+  color: #f56c6c;
+  margin-right: 4px;
+  box-sizing: border-box;
+}

+ 92 - 84
src/modules/questions/views/CourseProperty.vue

@@ -125,45 +125,58 @@
         </el-pagination>
       </div>
     </div>
-    <el-dialog title="新增课程属性名称" :visible.sync="coursePropertyDialog">
-      <el-form :model="coursePropertyForm">
+    <el-dialog
+      title="新增课程属性名称"
+      :visible.sync="coursePropertyDialog"
+      width="500px"
+    >
+      <el-form
+        :model="coursePropertyForm"
+        ref="coursePropertyForm"
+        :rules="rules"
+        label-position="right"
+        label-width="90px"
+        inline-message
+      >
         <el-row>
-          <el-form-item label="属性名称">
+          <el-form-item label="属性名称" label-width="120px" prop="name">
             <el-input
+              class="dialog_input_width"
               v-model="coursePropertyForm.name"
-              auto-complete="off"
-              style="width:210px;"
-              @change="showTile"
             ></el-input>
-            <span style="color: red;" v-show="showName">请输入属性名称</span>
           </el-form-item>
         </el-row>
-        <el-form-item label="课程名称">
-          <el-select
-            v-model="coursePropertyForm.courseId"
-            class="form_width"
-            @change="showTile"
-            filterable
-            :remote-method="getCourses"
-            remote
-            clearable
-            placeholder="请选择"
-          >
-            <el-option
-              v-for="item in courseInfoSelect"
-              :label="item.courseInfo"
-              :value="item.courseId"
-              :key="item.courseId"
+        <el-row>
+          <el-form-item label="课程名称" label-width="120px" prop="courseId">
+            <el-select
+              class="dialog_input_width"
+              v-model="coursePropertyForm.courseId"
+              filterable
+              :remote-method="getCourses"
+              remote
+              clearable
+              placeholder="请选择课程"
             >
-            </el-option>
-          </el-select>
-          <span style="color: red;" v-show="showCourseNo">请选择课程名称</span>
-        </el-form-item>
+              <el-option
+                v-for="item in courseInfoSelect"
+                :label="item.courseInfo"
+                :value="item.courseId"
+                :key="item.courseId"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-row>
+        <el-row class="margin_top_10 margin_left_120">
+          <el-button type="primary" @click="submit('coursePropertyForm')"
+            >保 存</el-button
+          >
+          <el-button @click="resetForm('coursePropertyForm')">重 置</el-button>
+          <el-button @click="back('coursePropertyForm')" type="success"
+            ><i class="el-icon-caret-left"></i> 返 回</el-button
+          >
+        </el-row>
       </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="coursePropertyDialog = false">取 消</el-button>
-        <el-button type="primary" @click="submit">确 定</el-button>
-      </div>
     </el-dialog>
   </section>
 </template>
@@ -189,9 +202,13 @@ export default {
         courseCode: ""
       },
       coursePropertyDialog: false,
-      showName: false,
-      showCourseNo: false,
-      selectedList: []
+      selectedList: [],
+      rules: {
+        name: [{ required: true, message: "请输入属性名称", trigger: "blur" }],
+        courseId: [
+          { required: true, message: "请选择课程名称", trigger: "change" }
+        ]
+      }
     };
   },
 
@@ -213,12 +230,21 @@ export default {
     },
     //新增
     addCourseProperty() {
-      this.showName = false;
-      this.showCourseNo = false;
       this.coursePropertyDialog = true;
       this.coursePropertyForm.name = "";
       this.coursePropertyForm.courseId = "";
     },
+    //重置
+    resetForm(formData) {
+      this.coursePropertyForm.name = "";
+      this.coursePropertyForm.courseId = "";
+      this.$refs[formData].clearValidate();
+    },
+    //返回
+    back(formData) {
+      this.resetForm(formData);
+      this.coursePropertyDialog = false;
+    },
     //修改
     editCourseProperty(row) {
       sessionStorage.setItem("course_property_name", this.formSearch.name);
@@ -359,55 +385,37 @@ export default {
       this.searchCourProperty();
     },
     //确定
-    submit() {
-      if (!this.coursePropertyForm.name && !this.coursePropertyForm.courseId) {
-        this.showName = true;
-        this.showCourseNo = true;
-        return 0;
-      }
-      if (!this.coursePropertyForm.name) {
-        this.showName = true;
-        return 0;
-      }
-      if (!this.coursePropertyForm.courseId) {
-        this.showCourseNo = true;
-        return 0;
-      }
-      for (let course of this.courseList) {
-        if (course.id == this.coursePropertyForm.courseId) {
-          this.coursePropertyForm.courseCode = course.code;
+    submit(formData) {
+      this.$refs[formData].validate(valid => {
+        if (valid) {
+          for (let course of this.courseList) {
+            if (course.id == this.coursePropertyForm.courseId) {
+              this.coursePropertyForm.courseCode = course.code;
+            }
+          }
+          this.$http
+            .post(
+              QUESTION_API + "/courseProperty/save",
+              this.coursePropertyForm
+            )
+            .then(() => {
+              this.$notify({
+                message: "新增成功",
+                type: "success"
+              });
+              this.coursePropertyDialog = false;
+              this.searchCourProperty();
+            })
+            .catch(() => {
+              this.$notify({
+                type: "error",
+                message: "课程属性名称重复,请重新命名"
+              });
+            });
+        } else {
+          return false;
         }
-      }
-      this.$http
-        .post(QUESTION_API + "/courseProperty/save", this.coursePropertyForm)
-        .then(() => {
-          this.$notify({
-            message: "新增成功",
-            type: "success"
-          });
-          this.coursePropertyDialog = false;
-          this.searchCourProperty();
-        })
-        .catch(() => {
-          this.$notify({
-            type: "error",
-            message: "课程属性名称重复,请重新命名"
-          });
-        });
-    },
-    showTile() {
-      if (!this.coursePropertyForm.name) {
-        this.showName = true;
-      }
-      if (!this.coursePropertyForm.courseId) {
-        this.showCourseNo = true;
-      }
-      if (this.coursePropertyForm.name) {
-        this.showName = false;
-      }
-      if (this.coursePropertyForm.courseId) {
-        this.showCourseNo = false;
-      }
+      });
     },
     getEnable(value) {
       if (value === true) {

+ 2 - 2
src/modules/questions/views/EditPaper.vue

@@ -1391,8 +1391,8 @@ export default {
           this.reduplicateQuestions = response.data;
           this.duplicateLoading = false;
           this.initReduplicateQuesColor();
-          var ques = document.getElementsByClassName("ques")[0];
-          ques.style.display = "inline";
+          // var ques = document.getElementsByClassName("ques")[0];
+          // ques.style.display = "inline";
         });
     },
     initReduplicateQuesColor() {

+ 151 - 88
src/modules/questions/views/ExportStructure.vue

@@ -138,10 +138,18 @@
       </div>
     </div>
     <!-- 复用窗口 -->
-    <el-dialog title="试卷结构复用" :visible.sync="dialogCopyModel">
-      <el-form :model="exportStructureCopy" ref="exportStructureCopy">
+    <el-dialog
+      title="试卷结构复用"
+      :visible.sync="dialogCopyModel"
+      width="500px"
+    >
+      <el-form
+        :model="exportStructureCopy"
+        label-position="right"
+        label-width="120px"
+      >
         <el-tabs> <el-tab-pane label="原结构信息"></el-tab-pane> </el-tabs>
-        <el-form-item label="考试类型" label-width="120px">
+        <el-form-item label="考试类型">
           <el-select
             v-model="exportStructureCopy.examTypeOld"
             placeholder="请选择"
@@ -155,7 +163,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="考试名称" label-width="120px">
+        <el-form-item label="考试名称">
           <el-select
             v-model="exportStructureCopy.examIdOld"
             placeholder="请选择"
@@ -169,7 +177,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="导出类型" label-width="120px">
+        <el-form-item label="导出类型">
           <el-select
             v-model="exportStructureCopy.exportTypeOld"
             placeholder="请选择"
@@ -184,7 +192,7 @@
           </el-select>
         </el-form-item>
         <el-tabs> <el-tab-pane label="新结构信息"></el-tab-pane> </el-tabs>
-        <el-form-item label="考试类型" label-width="120px">
+        <el-form-item label="考试类型">
           <el-select
             v-model="exportStructureCopy.examType"
             placeholder="请选择"
@@ -198,12 +206,12 @@
             ></el-option>
           </el-select>
           <span
-            style="color: red"
+            class="error_message error_other"
             v-if="check_value(exportStructureCopy.examType)"
             >请选择考试类型</span
           >
         </el-form-item>
-        <el-form-item label="考试名称" label-width="120px">
+        <el-form-item label="考试名称">
           <el-select v-model="exportStructureCopy.examId" placeholder="请选择">
             <el-option
               v-for="item in examListNew"
@@ -213,102 +221,125 @@
             ></el-option>
           </el-select>
           <span
-            style="color: red"
+            class="error_message error_other"
             v-if="check_value(exportStructureCopy.examId)"
             >请选择考试名称</span
           >
         </el-form-item>
+        <el-row class="margin_top_10 margin_left_120">
+          <el-button type="primary" @click="saveCopy">保 存</el-button>
+          <el-button @click="resetForm3">重 置</el-button>
+          <el-button @click="cancleCopy" type="success"
+            ><i class="el-icon-caret-left"></i> 返 回</el-button
+          >
+        </el-row>
       </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="cancleCopy">取 消</el-button>
-        <el-button type="primary" @click="saveCopy">确 定</el-button>
-      </div>
     </el-dialog>
     <!-- 新增窗口 -->
-    <el-dialog title="新增导出结构" :visible.sync="dialogModel">
-      <el-form :model="exportStructure" ref="exportStructure">
-        <el-form-item label="考试类型" label-width="120px">
-          <el-select
-            v-model="exportStructure.examType"
-            placeholder="请选择"
-            @change="searchExportStructure('examType')"
-          >
-            <el-option
-              v-for="item in EXAM_TYPES"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value"
-            ></el-option>
-          </el-select>
-          <span style="color: red" v-if="check_value(exportStructure.examType)"
-            >请选择考试类型</span
-          >
-        </el-form-item>
-        <el-form-item label="考试名称" label-width="120px">
-          <el-select
-            v-model="exportStructure.examId"
-            filterable
-            placeholder="请选择"
-            @change="searchExportStructure('examId')"
-          >
-            <el-option
-              v-for="item in examListByExamType"
-              :key="item.id"
-              :label="item.name"
-              :value="item.id"
-            ></el-option>
-          </el-select>
-          <span style="color: red" v-if="check_value(exportStructure.examId)"
-            >请选择考试名称</span
-          >
-        </el-form-item>
-        <el-form-item label="导出类型" label-width="120px">
-          <el-select
-            v-model="exportStructure.exportType"
-            placeholder="请选择"
-            :disabled="button"
-          >
-            <el-option
-              v-for="item in EXPORT_TYPES"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value"
-            ></el-option>
-          </el-select>
-          <span
-            style="color: red"
-            v-if="check_value(exportStructure.exportType)"
-            >请选择导出类型</span
-          >
-        </el-form-item>
+    <el-dialog title="新增导出结构" :visible.sync="dialogModel" width="500px">
+      <el-form
+        :model="exportStructure"
+        label-position="right"
+        label-width="120px"
+      >
+        <el-row>
+          <el-form-item label="考试类型">
+            <el-select
+              v-model="exportStructure.examType"
+              placeholder="请选择"
+              @change="searchExportStructure('examType')"
+            >
+              <el-option
+                v-for="item in EXAM_TYPES"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              ></el-option>
+            </el-select>
+            <span
+              class="error_message error_other"
+              v-if="check_value(exportStructure.examType)"
+              >请选择考试类型</span
+            >
+          </el-form-item>
+        </el-row>
+        <el-row>
+          <el-form-item label="考试名称">
+            <el-select
+              v-model="exportStructure.examId"
+              filterable
+              placeholder="请选择"
+              @change="searchExportStructure('examId')"
+            >
+              <el-option
+                v-for="item in examListByExamType"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              ></el-option>
+            </el-select>
+            <span
+              class="error_message error_other"
+              v-if="check_value(exportStructure.examId)"
+              >请选择考试名称</span
+            >
+          </el-form-item>
+        </el-row>
+        <el-row>
+          <el-form-item label="导出类型">
+            <el-select
+              v-model="exportStructure.exportType"
+              placeholder="请选择"
+              :disabled="button"
+            >
+              <el-option
+                v-for="item in EXPORT_TYPES"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              ></el-option>
+            </el-select>
+            <span
+              class="error_message error_other"
+              v-if="check_value(exportStructure.exportType)"
+              >请选择导出类型</span
+            >
+          </el-form-item>
+        </el-row>
         <!-- 判断机考还是传统 -->
         <div v-if="exportStructure.exportType == 'NORMAL'">
           <div
             v-for="(item, index) in exportStructure.questionTypeNums"
             :key="index"
           >
-            <el-form-item
-              :label="item.questionType | questionType"
-              label-width="120px"
-            >
-              <el-input
-                v-model="item.quantity"
-                style="width: 220px"
-                :disabled="button"
-              ></el-input>
-              <span style="color: red" v-if="check(item.quantity)">
-                请输入正整数或0
-              </span>
-            </el-form-item>
+            <el-row>
+              <el-form-item
+                :label="item.questionType | questionType"
+                label-width="120px"
+              >
+                <el-input
+                  v-model="item.quantity"
+                  style="width: 220px"
+                  :disabled="button"
+                ></el-input>
+                <span
+                  class="error_message error_other"
+                  v-if="check(item.quantity)"
+                >
+                  请输入正整数或0
+                </span>
+              </el-form-item>
+            </el-row>
           </div>
         </div>
+        <el-row class="margin_top_10 margin_left_120">
+          <el-button type="primary" @click="save">保 存</el-button>
+          <el-button @click="resetForm2">重 置</el-button>
+          <el-button @click="cancel" type="success"
+            ><i class="el-icon-caret-left"></i> 返 回</el-button
+          >
+        </el-row>
       </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="cancel">取 消</el-button>
-        <el-button type="primary" @click="save" :disabled="button"
-          >确 定</el-button
-        >
-      </div>
     </el-dialog>
   </section>
 </template>
@@ -489,6 +520,32 @@ export default {
           this.search();
         });
     },
+    //重置2
+    resetForm2() {
+      this.exportStructure = {
+        examType: "",
+        examId: "",
+        examName: "",
+        exportType: "",
+        useable: "1", //默认启用
+        questionTypeNums: [
+          {
+            questionType: "SINGLE_ANSWER_QUESTION",
+            quantity: ""
+          },
+          {
+            questionType: "MULTIPLE_ANSWER_QUESTION",
+            quantity: ""
+          },
+          {
+            questionType: "BOOL_ANSWER_QUESTION",
+            quantity: ""
+          }
+        ]
+      };
+      this.isShow = false;
+      this.button = false;
+    },
     //取消
     cancel() {
       this.isShow = false;
@@ -500,6 +557,12 @@ export default {
       this.isShow = false;
       this.dialogCopyModel = false;
     },
+    //重置3
+    resetForm3() {
+      this.exportStructureCopy.examType = "";
+      this.exportStructureCopy.examId = "";
+      this.isShow = false;
+    },
     //复用
     copy(row) {
       this.dialogCopyModel = true;

+ 72 - 39
src/modules/questions/views/GenPaper.vue

@@ -139,7 +139,7 @@
             <span>{{ scope.row.lastModifyName }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="操作" width="180">
+        <el-table-column label="操作" width="180" fixed="right">
           <template slot-scope="scope">
             <div class="operate_left">
               <el-button
@@ -166,7 +166,7 @@
                       size="mini"
                       type="primary"
                       @click="previewPDF2(scope.row)"
-                      ><i class="el-icon-zoom-in"></i> 预览PDF</el-button
+                      ><i class="el-icon-zoom-in"></i> 预览</el-button
                     >
                   </el-dropdown-item>
                   <el-dropdown-item>
@@ -174,7 +174,7 @@
                       size="mini"
                       type="primary"
                       @click="openPrint(scope.row)"
-                      ><i class="el-icon-share"></i> 传至印刷</el-button
+                      ><i class="el-icon-share"></i> 发送</el-button
                     >
                   </el-dropdown-item>
                   <el-dropdown-item>
@@ -253,17 +253,29 @@
       </el-form>
     </el-dialog>
 
-    <el-dialog title="传送印刷平台" v-model="dialogModel">
-      <el-form>
+    <el-dialog title="传送印刷平台" :visible.sync="dialogModel" width="500px">
+      <el-form
+        :model="printFrom"
+        ref="printFrom"
+        :rules="rules"
+        label-position="right"
+        label-width="120px"
+        inline-message
+      >
         <el-row>
-          <el-form-item label="学校名称" label-width="120px">
-            <el-input v-model="this.Org.name" :disabled="true"></el-input>
+          <el-form-item label="学校名称">
+            <el-input
+              class="dialog_input_width"
+              v-model="this.Org.name"
+              :disabled="true"
+            ></el-input>
           </el-form-item>
         </el-row>
         <el-row>
-          <el-form-item label="考试名称" label-width="120px">
+          <el-form-item label="考试名称" prop="examId">
             <el-select
-              v-model="examId"
+              class="dialog_input_width"
+              v-model="printFrom.examId"
               filterable
               clearable
               :remote-method="getExams"
@@ -279,11 +291,16 @@
             </el-select>
           </el-form-item>
         </el-row>
+        <el-row class="margin_top_10 margin_left_120">
+          <el-button type="primary" @click="sendPrint('printFrom')"
+            >保 存</el-button
+          >
+          <el-button @click="resetForm2('printFrom')">重 置</el-button>
+          <el-button @click="cancel('printFrom')" type="success"
+            ><i class="el-icon-caret-left"></i> 返 回</el-button
+          >
+        </el-row>
       </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="cancel">取 消</el-button>
-        <el-button type="primary" @click="sendPrint">确 定</el-button>
-      </div>
     </el-dialog>
   </section>
 </template>
@@ -330,11 +347,16 @@ export default {
       examList: [],
       Org: {},
       dialogModel: false,
-      examId: "",
       rowId: "",
       isShowPrintExamPackage: false,
       isShowPrintExamPackagePassword: false,
-      printExamPackagePassword: ""
+      printExamPackagePassword: "",
+      printFrom: {
+        examId: ""
+      },
+      rules: {
+        examId: [{ required: true, message: "请输入名称", trigger: "change" }]
+      }
     };
   },
   methods: {
@@ -596,37 +618,48 @@ export default {
     },
     openPrint(row) {
       this.dialogModel = true;
-      this.examId = "";
+      this.printFrom.examId = "";
       this.rowId = row.id;
       console.log("this.examList:", this.examList);
     },
-    cancel() {
+    cancel(formData) {
+      this.resetForm2(formData);
       this.dialogModel = false;
     },
+    resetForm2(formData) {
+      this.printFrom.examId = "";
+      this.$refs[formData].clearValidate();
+    },
     //传至印刷模块
-    sendPrint() {
-      var orgId = "";
-      for (let exam of this.examList) {
-        if ((exam.id = this.examId)) {
-          orgId = exam.rootOrgId;
+    sendPrint(formData) {
+      this.$refs[formData].validate(valid => {
+        if (valid) {
+          var orgId = "";
+          for (let exam of this.examList) {
+            if ((exam.id = this.printFrom.examId)) {
+              orgId = exam.rootOrgId;
+            }
+          }
+          if (orgId != "") {
+            this.$http.get(
+              QUESTION_API +
+                "/sendPrint/" +
+                this.rowId +
+                "/" +
+                this.printFrom.examId +
+                "/" +
+                orgId
+            );
+            this.$notify({
+              message: "已推送",
+              type: "success"
+            });
+            this.dialogModel = false;
+          }
+        } else {
+          return false;
         }
-      }
-      if (orgId != "") {
-        this.$http.get(
-          QUESTION_API +
-            "/sendPrint/" +
-            this.rowId +
-            "/" +
-            this.examId +
-            "/" +
-            orgId
-        );
-        this.$notify({
-          message: "已推送",
-          type: "success"
-        });
-        this.dialogModel = false;
-      }
+      });
     },
     //查询考试
     getExams(query) {

+ 108 - 96
src/modules/questions/views/ImportPaper.vue

@@ -157,7 +157,7 @@
             <span>{{ scope.row.lastModifyName }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="操作" width="180">
+        <el-table-column label="操作" width="180" fixed="right">
           <template slot-scope="scope">
             <div class="operate_left">
               <el-button
@@ -216,24 +216,30 @@
       title="克隆试卷"
       :visible.sync="copyPaperDialog"
       v-loading.body="cloneLoading"
+      width="500px"
     >
-      <el-form :model="copyPaperForm">
+      <el-form
+        :model="copyPaperForm"
+        ref="copyPaperForm"
+        :rules="rules"
+        label-position="right"
+        label-width="120px"
+        inline-message
+      >
         <el-row>
-          <el-form-item label="试卷名称">
+          <el-form-item label="试卷名称" prop="paperName">
             <el-input
+              class="dialog_input_width"
               v-model="copyPaperForm.paperName"
-              style="width: 220px;"
               placeholder="请输试卷名称"
-              @change="showTitle()"
             ></el-input>
-            <span style="color: red;" v-show="showName">请输试卷名称</span>
           </el-form-item>
         </el-row>
         <el-row>
-          <el-form-item label="课程名称">
+          <el-form-item label="课程名称" prop="courseNo">
             <el-select
+              class="dialog_input_width"
               v-model="copyPaperForm.courseNo"
-              @change="showTitle()"
               :remote-method="getCourses"
               remote
               filterable
@@ -248,22 +254,32 @@
               >
               </el-option>
             </el-select>
-            <span style="color: red;" v-show="showCourseNo"
-              >请选择课程名称</span
-            >
           </el-form-item>
         </el-row>
+        <el-row class="margin_top_10 margin_left_120">
+          <el-button type="primary" @click="submitCopy('copyPaperForm')"
+            >保 存</el-button
+          >
+          <el-button @click="resetForm2('copyPaperForm')">重 置</el-button>
+          <el-button @click="back2('copyPaperForm')" type="success"
+            ><i class="el-icon-caret-left"></i> 返 回</el-button
+          >
+        </el-row>
       </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="closeCopy()">取 消</el-button>
-        <el-button type="primary" @click="submitCopy()">确 定</el-button>
-      </div>
     </el-dialog>
-    <el-dialog title="属性修改" :visible.sync="quesPropertyDialog">
-      <el-form :loading="quesLoading">
+    <el-dialog
+      title="属性修改"
+      :visible.sync="quesPropertyDialog"
+      width="500px"
+    >
+      <el-form
+        :loading="quesLoading"
+        label-position="right"
+        label-width="120px"
+      >
         <el-row>
           <el-form-item label="难  度">
-            <el-select v-model="difficultyDegree">
+            <el-select v-model="difficultyDegree" class="dialog_input_width">
               <el-option
                 v-for="item in difficultyDegreeList"
                 :label="item.label"
@@ -275,7 +291,7 @@
         </el-row>
         <el-row>
           <el-form-item label="公开度">
-            <el-select v-model="publicity">
+            <el-select v-model="publicity" class="dialog_input_width">
               <el-option
                 v-for="item in publicityList"
                 :label="item.label"
@@ -285,16 +301,19 @@
             </el-select>
           </el-form-item>
         </el-row>
+        <el-row class="margin_top_10 margin_left_120">
+          <el-button
+            type="primary"
+            @click="submitUpdate()"
+            v-loading.fullscreen.lock="quesLoading"
+            >保 存</el-button
+          >
+          <el-button @click="resetForm">重 置</el-button>
+          <el-button @click="closePropertyDialog" type="success"
+            ><i class="el-icon-caret-left"></i> 返 回</el-button
+          >
+        </el-row>
       </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="closePropertyDialog()">取 消</el-button>
-        <el-button
-          type="primary"
-          @click="submitUpdate()"
-          v-loading.fullscreen.lock="quesLoading"
-          >确 定</el-button
-        >
-      </div>
     </el-dialog>
   </section>
 </template>
@@ -332,8 +351,6 @@ export default {
       },
       copyPaperId: "",
       quesPropertyDialog: false,
-      showName: false,
-      showCourseNo: false,
       difficultyDegree: 0.1,
       publicity: true,
       updateType: "",
@@ -349,7 +366,15 @@ export default {
         { label: 0.9, value: 0.9 },
         { label: 1.0, value: 1.0 }
       ],
-      publicityList: PUBLICITY_LIST
+      publicityList: PUBLICITY_LIST,
+      rules: {
+        paperName: [
+          { required: true, message: "请输试卷名称", trigger: "blur" }
+        ],
+        courseNo: [
+          { required: true, message: "请选择课程名称", trigger: "change" }
+        ]
+      }
     };
   },
   methods: {
@@ -507,73 +532,46 @@ export default {
     },
     //克隆试卷
     copyImportPaper(row) {
-      this.showName = false;
-      this.showCourseNo = false;
       this.copyPaperForm.paperName = "";
-      this.copyPaperForm.courseNo = null;
+      this.copyPaperForm.courseNo = "";
       this.copyPaperId = row.id;
       this.copyPaperDialog = true;
     },
-    //取消
-    closeCopy() {
-      this.copyPaperDialog = false;
-    },
-    //确定
-    submitCopy() {
-      if (!this.copyPaperForm.paperName && !this.copyPaperForm.courseNo) {
-        this.showName = true;
-        this.showCourseNo = true;
-        return;
-      }
-      if (!this.copyPaperForm.paperName) {
-        this.showName = true;
-        return;
-      }
-      if (!this.copyPaperForm.courseNo) {
-        this.showCourseNo = true;
-        return;
-      }
-      this.cloneLoading = true;
-      this.$http
-        .post(
-          QUESTION_API +
-            "/clonePaper/" +
-            this.copyPaperId +
-            "/" +
-            this.copyPaperForm.paperName +
-            "/" +
-            this.copyPaperForm.courseNo
-        )
-        .then(() => {
-          this.$notify({
-            message: "复制成功",
-            type: "success"
-          });
-          this.cloneLoading = false;
-          this.copyPaperDialog = false;
-          this.searchImportPaper();
-        })
-        .catch(() => {
-          this.$notify({
-            type: "error",
-            message: "试卷名称重复,请重新命名"
-          });
-          this.cloneLoading = false;
-        });
-    },
-    showTitle() {
-      if (!this.copyPaperForm.paperName) {
-        this.showName = true;
-      }
-      if (this.copyPaperForm.paperName) {
-        this.showName = false;
-      }
-      if (!this.copyPaperForm.courseNo) {
-        this.showCourseNo = true;
-      }
-      if (this.copyPaperForm.courseNo) {
-        this.showCourseNo = false;
-      }
+    //保存
+    submitCopy(formData) {
+      this.$refs[formData].validate(valid => {
+        if (valid) {
+          this.cloneLoading = true;
+          this.$http
+            .post(
+              QUESTION_API +
+                "/clonePaper/" +
+                this.copyPaperId +
+                "/" +
+                this.copyPaperForm.paperName +
+                "/" +
+                this.copyPaperForm.courseNo
+            )
+            .then(() => {
+              this.$notify({
+                message: "复制成功",
+                type: "success"
+              });
+              this.cloneLoading = false;
+              this.copyPaperDialog = false;
+              this.searchImportPaper();
+            })
+            .catch(() => {
+              this.$notify({
+                type: "error",
+                message: "试卷名称重复,请重新命名"
+              });
+              this.cloneLoading = false;
+            });
+        } else {
+          return false;
+        }
+      });
     },
     removeItem() {
       sessionStorage.removeItem("import_paper_courseNo");
@@ -620,7 +618,21 @@ export default {
       this.publicity = true;
       this.quesPropertyDialog = true;
     },
-    //试卷修改属性 openQuesPro,openQuesProC
+    //重置
+    resetForm() {
+      this.difficultyDegree = 0.1;
+      this.publicity = true;
+    },
+    resetForm2(formData) {
+      this.copyPaperForm.paperName = "";
+      this.copyPaperForm.courseNo = "";
+      this.$refs[formData].clearValidate();
+    },
+    back2(formData) {
+      this.resetForm2(formData);
+      this.copyPaperDialog = false;
+    },
+    //试卷修改属性 openQuesPro
     openQuesPro() {
       if (!this.selectedPaperIds || this.selectedPaperIds.length < 1) {
         this.$notify({
@@ -632,7 +644,7 @@ export default {
       this.updateType = "paper";
       this.openInit();
     },
-    //课程修改属性
+    //课程修改属性 openQuesProC
     openQuesProC() {
       if (!this.formSearch.courseNo) {
         this.$notify({

+ 82 - 69
src/modules/questions/views/InsertBluePaperStructure.vue

@@ -113,45 +113,62 @@
         </el-form>
 
         <!-- 添加大题弹出框 -->
-        <el-dialog title="大题信息" :visible.sync="detailDialog">
+        <el-dialog title="大题信息" :visible.sync="detailDialog" width="500px">
           <el-form
-            :inline="true"
             :model="paperDetailStructForm"
+            ref="paperDetailStructForm"
+            :rules="rules"
             label-position="right"
             label-width="90px"
+            inline-message
           >
             <el-row>
-              <el-form-item label="大题名称" label-width="120px">
+              <el-form-item label="大题名称" label-width="120px" prop="name">
                 <el-input
-                  class="pull_length"
+                  class="dialog_input_width"
                   v-model="paperDetailStructForm.name"
-                  auto-complete="off"
                   placeholder="请输入题型名称"
                 ></el-input>
               </el-form-item>
             </el-row>
             <el-row>
-              <el-form-item label="题型描述" label-width="120px">
+              <el-form-item label="题型描述" label-width="120px" prop="remark">
                 <el-input
+                  class="dialog_input_width"
                   type="textarea"
                   :rows="2"
-                  class="pull_length"
                   v-model="paperDetailStructForm.remark"
-                  auto-complete="off"
                   placeholder="请输入题型描述"
                 ></el-input>
               </el-form-item>
             </el-row>
-            <el-row style="margin-left: 120px;">
+            <el-row class="margin_top_10 margin_left_120">
               <span v-if="dialogType == 'ADD'">
-                <el-button type="primary" @click="saveDetail">保 存</el-button>
+                <el-button
+                  type="primary"
+                  @click="saveDetail('paperDetailStructForm')"
+                  >保 存</el-button
+                >
               </span>
               <span v-else>
-                <el-button type="primary" @click="saveEditDetail"
+                <el-button
+                  type="primary"
+                  @click="saveEditDetail('paperDetailStructForm')"
                   >保 存</el-button
                 >
               </span>
-              <el-button type="danger" @click="closeDialog">取 消</el-button>
+              <span class="margin_left_10">
+                <el-button @click="resetForm('paperDetailStructForm')"
+                  >重 置</el-button
+                >
+              </span>
+              <span class="margin_left_10">
+                <el-button
+                  @click="closeDialog('paperDetailStructForm')"
+                  type="success"
+                  ><i class="el-icon-caret-left"></i> 返 回</el-button
+                >
+              </span>
             </el-row>
           </el-form>
         </el-dialog>
@@ -256,7 +273,11 @@ export default {
       paperDetailStructs: [],
       courseList: [],
       loading: false,
-      coursePropertyList: []
+      coursePropertyList: [],
+      rules: {
+        name: [{ required: true, message: "请输入名称", trigger: "blur" }],
+        remark: [{ required: true, message: "请输入题型描述", trigger: "blur" }]
+      }
     };
   },
   methods: {
@@ -434,37 +455,32 @@ export default {
       this.detailDialog = true;
     },
     //保存新增大题
-    saveDetail() {
-      //校验大题名称
-      if (
-        !this.paperDetailStructForm.name ||
-        this.paperDetailStructForm.name.trim().length == 0
-      ) {
-        this.$notify({
-          type: "error",
-          message: "大题名称为空,请输入大题名称"
-        });
-        return;
-      }
-      //定义一个id的集合,用来id自加
-      var ids = [];
-      for (let paperDetailStruct of this.paperDetailStructs) {
-        ids.push(paperDetailStruct.id);
-      }
-      ids.sort();
-      var maxId;
-      if (ids.length == 0) {
-        maxId = 0;
-      } else {
-        maxId = ids[ids.length - 1];
-      }
-      var paperDetailStruct = Object.assign({}, this.paperDetailStructForm);
-      paperDetailStruct.id = maxId + 1;
-      paperDetailStruct.number = this.paperDetailStructs.length + 1;
-      this.paperDetailStructs.push(paperDetailStruct);
-      this.detailDialog = false;
-      this.blueStruct.paperDetailStructs = this.paperDetailStructs;
-      sessionStorage.setItem("blueStruct", JSON.stringify(this.blueStruct));
+    saveDetail(formData) {
+      this.$refs[formData].validate(valid => {
+        if (valid) {
+          //定义一个id的集合,用来id自加
+          var ids = [];
+          for (let paperDetailStruct of this.paperDetailStructs) {
+            ids.push(paperDetailStruct.id);
+          }
+          ids.sort();
+          var maxId;
+          if (ids.length == 0) {
+            maxId = 0;
+          } else {
+            maxId = ids[ids.length - 1];
+          }
+          var paperDetailStruct = Object.assign({}, this.paperDetailStructForm);
+          paperDetailStruct.id = maxId + 1;
+          paperDetailStruct.number = this.paperDetailStructs.length + 1;
+          this.paperDetailStructs.push(paperDetailStruct);
+          this.detailDialog = false;
+          this.blueStruct.paperDetailStructs = this.paperDetailStructs;
+          sessionStorage.setItem("blueStruct", JSON.stringify(this.blueStruct));
+        } else {
+          return false;
+        }
+      });
     },
     //删除大题
     deleteDetail(row) {
@@ -489,29 +505,22 @@ export default {
       this.detailDialog = true;
     },
     //保存修改大题
-    saveEditDetail() {
-      //校验大题名称
-      if (
-        !this.paperDetailStructForm.name ||
-        this.paperDetailStructForm.name.trim().length == 0
-      ) {
-        this.$notify({
-          type: "error",
-          message: "大题名称为空,请输入大题名称"
-        });
-        return;
-      }
-      for (let paperDetailStruct of this.paperDetailStructs) {
-        if (this.paperDetailStructForm.id === paperDetailStruct.id) {
-          console.log("paperDetailStruct", paperDetailStruct);
-          paperDetailStruct.name = this.paperDetailStructForm.name;
-          paperDetailStruct.remark = this.paperDetailStructForm.remark;
+    saveEditDetail(formData) {
+      this.$refs[formData].validate(valid => {
+        if (valid) {
+          for (let paperDetailStruct of this.paperDetailStructs) {
+            if (this.paperDetailStructForm.id === paperDetailStruct.id) {
+              console.log("paperDetailStruct", paperDetailStruct);
+              paperDetailStruct.name = this.paperDetailStructForm.name;
+              paperDetailStruct.remark = this.paperDetailStructForm.remark;
+            }
+          }
+          this.paperDetailStructForm = { name: "", remark: "", id: "" };
+          this.blueStruct.paperDetailStructs = this.paperDetailStructs;
+          sessionStorage.setItem("blueStruct", JSON.stringify(this.blueStruct));
+          this.detailDialog = false;
         }
-      }
-      this.paperDetailStructForm = { name: "", remark: "", id: "" };
-      this.blueStruct.paperDetailStructs = this.paperDetailStructs;
-      sessionStorage.setItem("blueStruct", JSON.stringify(this.blueStruct));
-      this.detailDialog = false;
+      });
     },
     //返回
     back() {
@@ -520,9 +529,8 @@ export default {
       });
     },
     //关闭窗口
-    closeDialog() {
-      this.paperDetailStructForm.name = "";
-      this.paperDetailStructForm.remark = "";
+    closeDialog(formData) {
+      this.resetForm(formData);
       this.detailDialog = false;
     },
     //得到题型
@@ -592,6 +600,11 @@ export default {
     clearCourseProperty() {
       this.blueStruct.coursePropertyId = "";
       this.coursePropertyList = [];
+    },
+    resetForm(formData) {
+      this.paperDetailStructForm.name = "";
+      this.paperDetailStructForm.remark = "";
+      this.$refs[formData].clearValidate();
     }
   },
   computed: {

+ 32 - 39
src/modules/questions/views/InsertPaperStructure.vue

@@ -89,26 +89,32 @@
         </el-form>
 
         <!-- 添加大题弹出框 -->
-        <el-dialog title="大题信息" :visible.sync="paperDetailStructDialog">
+        <el-dialog
+          title="大题信息"
+          :visible.sync="paperDetailStructDialog"
+          width="500px"
+        >
           <el-form
-            :inline="true"
             :model="paperDetailStructForm"
             ref="paperDetailStructForm"
             :rules="rules"
             label-position="right"
-            label-width="90px"
+            label-width="120px"
+            inline-message
           >
             <el-row>
-              <el-form-item label="大题名称" label-width="120px" prop="name">
+              <el-form-item label="大题名称" prop="name">
                 <el-input
+                  class="dialog_input_width"
                   v-model="paperDetailStructForm.name"
                   placeholder="请输入题型名称"
                 ></el-input>
               </el-form-item>
             </el-row>
             <el-row>
-              <el-form-item label="题型描述" label-width="120px" prop="remark">
+              <el-form-item label="题型描述" prop="remark">
                 <el-input
+                  class="dialog_input_width"
                   type="textarea"
                   :rows="2"
                   v-model="paperDetailStructForm.remark"
@@ -116,7 +122,7 @@
                 ></el-input>
               </el-form-item>
             </el-row>
-            <el-row>
+            <el-row class="margin_top_10 margin_left_120">
               <span v-if="dialogType == 'ADD'">
                 <el-button
                   type="primary"
@@ -131,7 +137,18 @@
                   >保 存</el-button
                 >
               </span>
-              <el-button type="danger" @click="resetForm()">重 置</el-button>
+              <span class="margin_left_10">
+                <el-button @click="resetForm('paperDetailStructForm')"
+                  >重 置</el-button
+                >
+              </span>
+              <span class="margin_left_10">
+                <el-button
+                  @click="back2('paperDetailStructForm')"
+                  type="success"
+                  ><i class="el-icon-caret-left"></i> 返 回</el-button
+                >
+              </span>
             </el-row>
           </el-form>
         </el-dialog>
@@ -347,18 +364,6 @@ export default {
     },
     //保存大题
     submitForm(formData) {
-      //校验大题名称
-      if (
-        !this.paperDetailStructForm.name ||
-        this.paperDetailStructForm.name.trim().length == 0
-      ) {
-        this.$notify({
-          message: "大题名称不能为空",
-          type: "error"
-        });
-        return;
-      }
-      this.loading = true;
       this.$refs[formData].validate(valid => {
         if (valid) {
           var ids = [];
@@ -372,7 +377,6 @@ export default {
           } else {
             maxId = ids[ids.length - 1];
           }
-
           var paperDetailStruct = Object.assign({}, this.paperDetailStructForm);
           paperDetailStruct.id = maxId + 1;
           paperDetailStruct.number = this.paperDetailStructs.length + 1;
@@ -388,21 +392,8 @@ export default {
           return false;
         }
       });
-      this.loading = false;
     },
     submitEditForm(formData) {
-      //校验大题名称
-      if (
-        !this.paperDetailStructForm.name ||
-        this.paperDetailStructForm.name.trim().length == 0
-      ) {
-        this.$notify({
-          message: "大题名称不能为空",
-          type: "error"
-        });
-        return;
-      }
-      this.loading = true;
       this.$refs[formData].validate(valid => {
         if (valid) {
           var paperDetailStructs = this.paperDetailStructs;
@@ -423,7 +414,6 @@ export default {
           return false;
         }
       });
-      this.loading = false;
     },
     deletePaperDetail(id) {
       var paperDetailStructs = this.paperDetailStructs;
@@ -444,11 +434,10 @@ export default {
       sessionStorage.removeItem("paperStruct");
     },
     //重置
-    resetForm() {
-      this.paperDetailStructForm = {
-        name: "",
-        remark: ""
-      };
+    resetForm(formData) {
+      this.paperDetailStructForm.remark = "";
+      this.paperDetailStructForm.name = "";
+      this.$refs[formData].clearValidate();
     },
 
     //添加大题型
@@ -493,6 +482,10 @@ export default {
         path: "/questions/paper_structure/1"
       });
     },
+    back2(formData) {
+      this.resetForm(formData);
+      this.paperDetailStructDialog = false;
+    },
     //查询所有课程
     getCourses(query) {
       query = query.trim();

+ 4 - 1
src/modules/questions/views/InsertPaperTitle.vue

@@ -12,8 +12,8 @@
           <el-row>
             <el-form-item label="课程名称(代码)" class="pull-left">
               <el-select
+                class="dialog_input_width"
                 @change="searchGenPaper"
-                style="width: 193px;"
                 v-model="paperTitleForm.courseNo"
                 filterable
                 remote
@@ -33,6 +33,7 @@
           <el-row v-if="paperTitelDisable">
             <el-form-item label="试卷名称" class="pull-left">
               <el-select
+                class="dialog_input_width"
                 v-model="paperTitleForm.paperId"
                 filterable
                 placeholder="请选择"
@@ -53,6 +54,7 @@
           <el-row v-if="paperDetailDisable">
             <el-form-item label="试卷大题" class="pull-left">
               <el-select
+                class="dialog_input_width"
                 v-model="paperTitleForm.paperDetailId"
                 filterable
                 placeholder="请选择"
@@ -70,6 +72,7 @@
           <el-row>
             <el-form-item label="题型" class="pull-left">
               <el-select
+                class="dialog_input_width"
                 v-model="paperTitleForm.value"
                 filterable
                 placeholder="请选择"

+ 37 - 24
src/modules/questions/views/PaperStructure.vue

@@ -1,5 +1,8 @@
 <template>
   <section class="content">
+    <div v-show="isClear == 1">
+      <LinkTitlesCustom :currentPaths="['基础信息', '精确结构预设']" />
+    </div>
     <!-- 正文信息 -->
     <div class="box-body">
       <el-form
@@ -156,7 +159,9 @@
 
 <script>
 import { CORE_API, QUESTION_API } from "@/constants/constants";
+import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
 export default {
+  components: { LinkTitlesCustom },
   data() {
     return {
       courseLoading: false,
@@ -294,9 +299,6 @@ export default {
       this.searchPaperStructs();
     },
 
-    removeItem() {
-      sessionStorage.removeItem("paperStruct");
-    },
     //查询所有课程
     getCourses(query) {
       query = query.trim();
@@ -319,8 +321,31 @@ export default {
         return "宏观结构";
       }
       return "微观结构";
+    },
+    removeItem() {
+      sessionStorage.removeItem("paperStruct");
+    },
+    initVue() {
+      this.isClear = this.$route.params.isClear;
+      if (this.isClear == 0 || !this.isClear) {
+        sessionStorage.removeItem("paper_stucture");
+        sessionStorage.removeItem("paper_stucture_currentPage");
+        this.formSearch = {
+          name: "",
+          creator: "",
+          courseNo: "ALL",
+          type: "EXACT"
+        };
+        this.currentPage = 1;
+      } else {
+        this.formSearch = JSON.parse(sessionStorage.getItem("paper_stucture"));
+        this.currentPage = parseInt(
+          sessionStorage.getItem("paper_stucture_currentPage")
+        );
+      }
     }
   },
+
   computed: {
     selectedIds() {
       var selectedIdsStr = "";
@@ -343,28 +368,16 @@ export default {
       return courseList;
     }
   },
+  watch: {
+    // $route() {
+    //   //this.initVue();
+
+    // }
+    $route: "initVue"
+  },
   created() {
-    this.isClear = this.$route.params.isClear;
-    if (this.isClear == 0 || !this.isClear) {
-      sessionStorage.removeItem("paper_stucture");
-      sessionStorage.removeItem("paper_stucture_currentPage");
-    } else {
-      this.formSearch = JSON.parse(sessionStorage.getItem("paper_stucture"));
-      this.currentPage = parseInt(
-        sessionStorage.getItem("paper_stucture_currentPage")
-      );
-      if (!this.formSearch) {
-        this.formSearch = {
-          name: "",
-          creator: "",
-          courseNo: "ALL",
-          type: "EXACT"
-        };
-      }
-      if (!this.currentPage) {
-        this.currentPage = 1;
-      }
-    }
+    console.log("aaa");
+    this.initVue();
     this.removeItem();
     this.searchPaperStructs();
   }