dedsudiyu 1 päivä sitten
vanhempi
commit
8fae086d96

+ 54 - 26
src/views/safetyEducationExaminationNew/examManagement/examinationArrange/addPage.vue

@@ -143,7 +143,7 @@
                   </el-form-item>
                 </div>
 
-                <el-form-item label="考试范围" prop="scopeType">
+                <el-form-item label="考试范围" prop="scopeType" v-if="!yzyhTest">
                   <div class="scope-btn-group">
                     <button
                       v-for="item in scopeOptions"
@@ -241,6 +241,23 @@
                     </el-table>
                   </div>
                 </el-form-item>
+                <el-form-item label="考试范围" prop="targetUserType" v-if="yzyhTest">
+                  <div class="scope-btn-group">
+                    <button
+                      v-for="item in scopeOptionsB"
+                      :key="item.value"
+                      class="scope-btn"
+                      v-show="!showType || newData.targetUserType === item.value"
+                      :class="{ active: newData.targetUserType === item.value }"
+                      @click.prevent="newData.targetUserType = item.value"
+                    >
+                      <i v-if="newData.targetUserType === item.value" class="el-icon-check"
+                         style="color:#0183fa;margin-right:4px;"
+                      ></i>
+                      {{ item.label }}
+                    </button>
+                  </div>
+                </el-form-item>
               </div>
             </div>
             <!-- ==================== 考前配置 ==================== -->
@@ -291,7 +308,7 @@
                       <p>用户类别</p>
                       <p>学时要求配置</p>
                     </div>
-                    <div class="yzyh-input-max-box">
+                    <div v-if="this.newData.targetUserType == 2" class="yzyh-input-max-box">
                       <p class="yzyh-title-p">研究生</p>
                       <div class="yzyh-text-box">
                         <p>新生(无需进入实验室的)</p>
@@ -315,7 +332,7 @@
                         </div>
                       </div>
                     </div>
-                    <div class="yzyh-input-max-box">
+                    <div v-if="this.newData.targetUserType == 2" class="yzyh-input-max-box">
                       <p class="yzyh-title-p">本科生</p>
                       <div class="yzyh-text-box">
                         <p>非新生</p>
@@ -335,7 +352,7 @@
                         </div>
                       </div>
                     </div>
-                    <div class="yzyh-input-max-box">
+                    <div v-if="this.newData.targetUserType == 1" class="yzyh-input-max-box">
                       <p class="yzyh-title-p">教职工</p>
                       <div class="yzyh-text-box">
                         <p>新入职</p>
@@ -628,28 +645,21 @@
         }
       }
       const validateData1 = (rule, value, callback) => {
-        if (this.newData.studyHoursRequirementEnabled == 1 && !this.yzyhTest && !this.placementTest && this.newData.studyHoursRequirement == 0) {
-          callback(new Error('学时要求不能为0'))
-        }else if (this.newData.studyHoursRequirementEnabled == 1 && this.yzyhTest && this.newData.mandatoryStudyHoursConfig.freshmanNoLabHours == 0) {
-          callback(new Error('研究生-新生的学时要求不能为0'))
-        }
-        // else if (this.newData.studyHoursRequirementEnabled == 1 && this.yzyhTest && this.newData.mandatoryStudyHoursConfig.undergraduateHours == 0) {
-        //   callback(new Error('本科生的学时要求不能为0'))
-        // }
-        else if (this.newData.studyHoursRequirementEnabled == 1 && this.yzyhTest && this.newData.mandatoryStudyHoursConfig.staffNewHours == 0) {
-          callback(new Error('教职工-新入职的学时要求不能为0'))
-        }
-        // else if (this.newData.studyHoursRequirementEnabled == 1 && this.yzyhTest && this.newData.mandatoryStudyHoursConfig.staffNonNewHours == 0) {
-        //   callback(new Error('教职工-非新入职的学时要求不能为0'))
-        // }
-        else {
-          callback()
+        if(this.newData.targetUserType==2){
+          if (this.newData.studyHoursRequirementEnabled == 1 && !this.yzyhTest && !this.placementTest && this.newData.studyHoursRequirement == 0) {
+            callback(new Error('学时要求不能为0'))
+          }else if (this.newData.studyHoursRequirementEnabled == 1 && this.yzyhTest && this.newData.mandatoryStudyHoursConfig.freshmanNoLabHours == 0) {
+            callback(new Error('研究生-新生的学时要求不能为0'))
+          } else {
+            callback()
+          }
+        }else if(this.newData.targetUserType==1){
+          if (this.newData.studyHoursRequirementEnabled == 1 && this.yzyhTest && this.newData.mandatoryStudyHoursConfig.staffNewHours == 0) {
+            callback(new Error('教职工-新入职的学时要求不能为0'))
+          } else {
+            callback()
+          }
         }
-        // if (this.newData.studyHoursRequirementEnabled == 1 && this.newData.studyHoursRequirement == 0) {
-        //   callback(new Error('学时要求不能为0'))
-        // } else {
-        //   callback()
-        // }
       }
       const validateData2 = (rule, value, callback) => {
         if (this.newData.preCourseEnabled == 1 && !this.newData.preCourseId) {
@@ -723,6 +733,10 @@
           { label: '考试范围', value: 2 },
           { label: '指定考生', value: 3 }
         ],
+        scopeOptionsB: [
+          { label: '学生', value: 2 },
+          { label: '教职工', value: 1 },
+        ],
         optionListC:[],
         optionExamType: [],
         tableList: [],
@@ -756,6 +770,7 @@
           examTimeRange: null,
           answerDuration: 0,
           scopeType: 1,
+          targetUserType: '',
           studyHoursRequirementEnabled: 0,
           studyHoursRequirement: 0,
           knowledgePointIds:[],
@@ -820,6 +835,10 @@
             { required: true, message: '请选择考试范围', trigger: 'change' },
             { validator: validateData0, trigger: 'blur' }
           ],
+          targetUserType: [
+            { required: true, message: '请选择考试范围', trigger: 'change' },
+            { validator: validateData0, trigger: 'blur' }
+          ],
           examTimeRange: [
             { required: true, message: '请选择考试时间', trigger: 'change' }
           ],
@@ -911,6 +930,7 @@
               examTimeRange: [response.data.startTime.replace("T", "0"),response.data.endTime.replace("T", "0")],
               answerDuration: response.data.answerDuration,
               scopeType:response.data.scopeType,
+              targetUserType:response.data.targetUserType,
               studyHoursRequirementEnabled: response.data.studyHoursRequirementEnabled,
               studyHoursRequirement: response.data.studyHoursRequirement,
               knowledgePointIds: response.data.knowledgePointIds,
@@ -994,11 +1014,17 @@
           endTime:this.newData.examTimeRange[1].replace(" ", "T"),
           answerDuration:this.newData.answerDuration,
           scopeType:this.newData.scopeType,
+          targetUserType:this.yzyhTest?this.newData.targetUserType:'',
           ruleScopeItems:this.newData.scopeType==2?this.scopeList:[],
           designatedCandidates:this.newData.scopeType==3?this.userList:[],
           studyHoursRequirementEnabled:this.newData.studyHoursRequirementEnabled,
           studyHoursRequirement:this.newData.studyHoursRequirementEnabled == 1&&(!this.yzyhTest&&!this.placementTest)?this.newData.studyHoursRequirement:0,
-          mandatoryStudyHoursConfig:this.newData.studyHoursRequirementEnabled == 1&&this.yzyhTest?this.newData.mandatoryStudyHoursConfig:{
+          mandatoryStudyHoursConfig:this.newData.studyHoursRequirementEnabled == 1&&this.yzyhTest?{
+            freshmanNoLabHours:this.newData.targetUserType==2?this.newData.mandatoryStudyHoursConfig.freshmanNoLabHours:0,
+            undergraduateHours:this.newData.targetUserType==2?this.newData.mandatoryStudyHoursConfig.undergraduateHours:0,
+            staffNewHours:this.newData.targetUserType==1?this.newData.mandatoryStudyHoursConfig.staffNewHours:0,
+            staffNonNewHours:this.newData.targetUserType==1?this.newData.mandatoryStudyHoursConfig.staffNonNewHours:0,
+          }:{
             freshmanNoLabHours:0,
             undergraduateHours:0,
             staffNewHours:0,
@@ -1164,6 +1190,8 @@
               }
             }
             if (self.optionExamType[i].examTypeCode == 'yzyh') {
+              self.$set(this.newData, 'scopeType', 1)
+              self.$set(this.newData, 'targetUserType', 2)
               self.$set(this, 'yzyhTest', true)
             } else {
               self.$set(this, 'yzyhTest', false)