From 711555c3d5c36a0b2ca34eb9dc8b31a8101d9e81 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 06 六月 2024 18:00:58 +0800
Subject: [PATCH] 模板可见性配置

---
 src/views/Manage/TestPaper/PaperTemplate.vue |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/src/views/Manage/TestPaper/PaperTemplate.vue b/src/views/Manage/TestPaper/PaperTemplate.vue
index cc587a3..14337bf 100644
--- a/src/views/Manage/TestPaper/PaperTemplate.vue
+++ b/src/views/Manage/TestPaper/PaperTemplate.vue
@@ -123,6 +123,10 @@
             <el-form-item label="鑰冭瘯鏃堕暱(鍒嗛挓)" prop="suggestTime">
               <el-input-number v-model="form.suggestTime" placeholder="璇疯緭鍏ヨ�冭瘯鏃堕暱"/>
             </el-form-item>
+            <el-form-item label="鏉冮檺" prop="visibility">
+              <el-radio v-model="form.visibility" :label="1">绉佹湁</el-radio>
+              <el-radio v-model="form.visibility" :label="2">鍏紑</el-radio>
+            </el-form-item>
             <el-form-item label="澶氶�夐寰楀垎绫诲瀷" prop="deductType" v-show="addedQuestionTypes.includes(2)"><!-- 鏈夊閫夋墠鍑虹幇 -->
               <div>
                 <el-select v-model="form.deductType" placeholder="璇烽�夋嫨澶氶�夐寰楀垎绫诲瀷" style="width: 200px;margin-right: 30px">
@@ -188,6 +192,7 @@
             <el-button @click="cancel">鍙� 娑�</el-button>
           </div>
         </el-dialog>
+
         <!-- 娣诲姞棰樼洰瀵硅瘽妗� -->
         <el-dialog :title="questionTitle" :visible.sync="questionOpen" width="400px" append-to-body>
           <el-form ref="questionForm" :model="questionForm" :rules="questionRules">
@@ -234,7 +239,7 @@
   data() {
     var validateDeductType = (rule, value, callback) => {
       const index = this.addedQuestionTypes.findIndex(item => item.questionType === 2)
-      if (index && (!value || value === '')) {
+      if (index !== -1 && (!value || value === '')) {
         callback(new Error('璇烽�夋嫨澶氶�夐寰楀垎鏂瑰紡'));
       } else {
         callback();
@@ -255,7 +260,9 @@
         currentPage: 1,
         pageSize: 10
       },
-      form: {},
+      form: {
+        visibility: 1
+      },
       questionForm: {},
       tableData: [],
       subjects: [],
@@ -393,6 +400,7 @@
         name: null,
         subjectId: null,
         suggestTime: null,
+        visibility: 1
       };
       this.addedQuestionTypes = []
       this.questionList = []
@@ -474,25 +482,22 @@
     submitForm() {
       this.$refs['form'].validate(valid => {
         if (valid) {
-          if (this.form.deptId && this.form.deptId.length > 0) {
-            this.form.deptId = this.form.deptId[this.form.deptId.length - 1]
-          }
           let temp = {
             ...this.form,
-            category: parseInt(this.form.category)
           };
+          temp.questionList = this.questionList
           if (temp.id != null) {
-            updatePoint(temp).then(response => {
-              this.$modal.msgSuccess("淇敼鎴愬姛");
+            editExamTemplate(temp).then(response => {
+              this.$message("淇敼鎴愬姛");
               this.open = false;
-              this.getList();
+              this.getPage();
             });
           } else {
-            addPoint(temp).then(response => {
-              this.$modal.msgSuccess("鏂板鎴愬姛");
+            addExamTemplate(temp).then(response => {
+              this.$message("鏂板鎴愬姛");
               this.open = false;
               this.reset()
-              this.getList();
+              this.getPage();
             });
           }
         } else {

--
Gitblit v1.8.0