zhangjie 6 mesi fa
parent
commit
86ea1d2e23

+ 65 - 41
src/modules/exam/components/createExamAndPrintTask/InfoPrintTask.vue

@@ -100,13 +100,44 @@
         </div>
         <div>
           <el-button
-            v-if="checkPrivilege('button', 'ExamTaskStudentObject')"
+            v-if="
+              checkPrivilege(
+                'button',
+                'ExamTaskStudentObject',
+                'TaskApplyManage'
+              )
+            "
             type="primary"
             @click="toAdd"
             >新增考试对象</el-button
           >
         </div>
       </div>
+      <el-form label-width="90px">
+        <el-form-item label="考试时间:">
+          <one-date-time-range
+            :start-date-time.sync="taskModel.examStartTime"
+            :end-date-time.sync="taskModel.examEndTime"
+            @change="timeChange"
+          >
+          </one-date-time-range>
+        </el-form-item>
+        <el-form-item label="印刷室:">
+          <el-select
+            v-model="taskModel.printHouseId"
+            placeholder="请选择"
+            filterable
+            @change="printHouseChange"
+          >
+            <el-option
+              v-for="room in printHouses"
+              :key="room.printHouseId"
+              :value="room.printHouseId"
+              :label="room.printHouseName"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
       <el-table ref="TableList" :data="tableData" border>
         <el-table-column type="index" width="80" label="卷袋序号">
         </el-table-column>
@@ -128,19 +159,11 @@
             ></el-input-number>
           </template>
         </el-table-column>
-        <el-table-column label="考试时间" width="300">
+        <el-table-column label="考试时间" width="180">
           <template slot-scope="scope">
-            <template v-if="!scope.row.canEditTime">
+            <template>
               {{ scope.row.examDate }} {{ scope.row.examTime }}
             </template>
-            <template v-else>
-              <one-date-time-range
-                :start-date-time.sync="scope.row.examStartTime"
-                :end-date-time.sync="scope.row.examEndTime"
-                @change="timeChange(scope.row)"
-              >
-              </one-date-time-range>
-            </template>
           </template>
         </el-table-column>
         <el-table-column prop="examPlace" label="校区(考点)" width="140">
@@ -162,21 +185,6 @@
           </template>
         </el-table-column>
         <el-table-column prop="printHouseName" label="印刷室" width="140">
-          <template slot-scope="scope">
-            <el-select
-              v-model="scope.row.printHouseId"
-              placeholder="请选择"
-              filterable
-              @change="() => printHouseChange(scope.row)"
-            >
-              <el-option
-                v-for="room in printHouses"
-                :key="room.printHouseId"
-                :value="room.printHouseId"
-                :label="room.printHouseName"
-              ></el-option>
-            </el-select>
-          </template>
         </el-table-column>
         <el-table-column
           label="操作"
@@ -272,6 +280,8 @@ export default {
       showStudent: false,
       curCreateTime: [],
       defaultTime: "",
+      taskModel: { examStartTime: null, examEndTime: null, printHouseId: "" },
+      curHouse: null,
     };
   },
   computed: {
@@ -430,26 +440,39 @@ export default {
     },
     async getPrintHouses() {
       this.printHouses = await listTaskPrintHouse();
-    },
-    timeChange(row) {
-      if (!row.examStartTime || !row.examEndTime) {
-        row.examDate = "";
-        row.examTime = "";
-        return;
+      if (this.printHouses.length === 1) {
+        this.curHouse = this.printHouses[0];
+        this.taskModel.printHouseId = this.curHouse.printHouseId;
       }
+    },
+    timeChange() {
+      this.tableData.forEach((row) => {
+        if (!this.taskModel.examStartTime || !this.taskModel.examEndTime) {
+          row.examDate = "";
+          row.examTime = "";
+          return;
+        }
 
-      Object.assign(row, getExamDateTime(row.examStartTime, row.examEndTime));
+        Object.assign(
+          row,
+          getExamDateTime(
+            this.taskModel.examStartTime,
+            this.taskModel.examEndTime
+          )
+        );
+      });
     },
     backupCountChange() {
       this.updatePackageInfos();
     },
-    printHouseChange(row) {
-      const curHouse = this.printHouses.find(
-        (item) => item.printHouseId === row.printHouseId
+    printHouseChange() {
+      this.curHouse = this.printHouses.find(
+        (item) => item.printHouseId === this.taskModel.printHouseId
       );
-      if (curHouse) {
-        row.printHouseName = curHouse.printHouseName;
-      }
+      this.tableData.forEach((row) => {
+        row.printHouseId = this.curHouse?.printHouseId;
+        row.printHouseName = this.curHouse?.printHouseName;
+      });
     },
     toAdd() {
       if (!this.infoExamTask.courseId) {
@@ -492,7 +515,6 @@ export default {
         isSelectStudent: true,
         examTaskStudentObjectParamList: [],
         classNames: [],
-        canEditTime: false,
         ...modalFormData,
       };
       return data;
@@ -582,10 +604,12 @@ export default {
           ...this.getBackupCount(data.examTaskStudentObjectParamList.length),
           className: data.classNames.join(),
           studentCount: data.examTaskStudentObjectParamList.length,
-          canEditTime: !data.examStartTime || !data.examEndTime,
         });
         this.tableData.push(tableRow);
       });
+      // 更新考试时间和印刷室
+      this.printHouseChange();
+      this.timeChange();
     },
     toDelete(index) {
       this.tableData.splice(index, 1);

+ 78 - 43
src/modules/exam/components/taskApply/TaskPrint.vue

@@ -104,13 +104,46 @@
         </div>
         <div>
           <el-button
-            v-if="checkPrivilege('button', 'ExamTaskStudentObject') && editable"
+            v-if="
+              checkPrivilege(
+                'button',
+                'ExamTaskStudentObject',
+                'TaskApplyManage'
+              ) && editable
+            "
             type="primary"
             @click="toAdd"
             >新增考试对象</el-button
           >
         </div>
       </div>
+      <el-form label-width="90px">
+        <el-form-item label="考试时间:">
+          <one-date-time-range
+            :start-date-time.sync="taskModel.examStartTime"
+            :end-date-time.sync="taskModel.examEndTime"
+            :disabled="!editable"
+            @change="timeChange"
+          >
+          </one-date-time-range>
+        </el-form-item>
+        <el-form-item label="印刷室:">
+          <el-select
+            v-model="taskModel.printHouseId"
+            placeholder="请选择"
+            filterable
+            :disabled="!editable"
+            @change="printHouseChange"
+          >
+            <el-option
+              v-for="room in printHouses"
+              :key="room.printHouseId"
+              :value="room.printHouseId"
+              :label="room.printHouseName"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
       <el-table ref="TableList" :data="tableData" border>
         <el-table-column type="index" width="80" label="卷袋序号">
         </el-table-column>
@@ -133,20 +166,11 @@
             ></el-input-number>
           </template>
         </el-table-column>
-        <el-table-column label="考试时间" width="300">
+        <el-table-column label="考试时间" width="180">
           <template slot-scope="scope">
-            <template v-if="!scope.row.canEditTime">
+            <template>
               {{ scope.row.examDate }} {{ scope.row.examTime }}
             </template>
-            <template v-else>
-              <one-date-time-range
-                :start-date-time.sync="scope.row.examStartTime"
-                :end-date-time.sync="scope.row.examEndTime"
-                :disabled="!editable"
-                @change="timeChange(scope.row)"
-              >
-              </one-date-time-range>
-            </template>
           </template>
         </el-table-column>
         <el-table-column prop="examPlace" label="校区(考点)" width="140">
@@ -170,22 +194,6 @@
           </template>
         </el-table-column>
         <el-table-column prop="printHouseName" label="印刷室" width="140">
-          <template slot-scope="scope">
-            <el-select
-              v-model="scope.row.printHouseId"
-              placeholder="请选择"
-              filterable
-              :disabled="!editable"
-              @change="() => printHouseChange(scope.row)"
-            >
-              <el-option
-                v-for="room in printHouses"
-                :key="room.printHouseId"
-                :value="room.printHouseId"
-                :label="room.printHouseName"
-              ></el-option>
-            </el-select>
-          </template>
         </el-table-column>
         <el-table-column
           label="操作"
@@ -284,6 +292,8 @@ export default {
       showStudent: false,
       curCreateTime: [],
       defaultTime: "",
+      taskModel: { examStartTime: null, examEndTime: null, printHouseId: "" },
+      curHouse: null,
       // exam task content
       infoExamTask: {},
       infoExamTaskDetail: [],
@@ -314,6 +324,10 @@ export default {
   methods: {
     async getPrintHouses() {
       this.printHouses = await listTaskPrintHouse();
+      if (this.printHouses.length === 1) {
+        this.curHouse = this.printHouses[0];
+        this.taskModel.printHouseId = this.curHouse.printHouseId;
+      }
     },
     async getInfoPrintTask() {
       const orgInfo = this.$ls.get("user", { orgInfo: {} }).orgInfo;
@@ -345,6 +359,17 @@ export default {
 
       this.tableData = this.infoPrintTask.list;
       this.updatePackageInfos();
+
+      // 数据复现
+      if (this.tableData.length) {
+        const row = this.tableData[0];
+        this.taskModel.printHouseId = row.printHouseId;
+        this.taskModel.examStartTime = row.examStartTime;
+        this.taskModel.examEndTime = row.examEndTime;
+        this.curHouse = this.printHouses.find(
+          (item) => item.printHouseId === this.taskModel.printHouseId
+        );
+      }
     },
     updatePackageInfos() {
       this.packageInfos.packageCount = this.tableData.length;
@@ -367,25 +392,34 @@ export default {
       }
       return { backupCount, minBackupCount: backupCount };
     },
-    timeChange(row) {
-      if (!row.examStartTime || !row.examEndTime) {
-        row.examDate = "";
-        row.examTime = "";
-        return;
-      }
+    timeChange() {
+      this.tableData.forEach((row) => {
+        if (!this.taskModel.examStartTime || !this.taskModel.examEndTime) {
+          row.examDate = "";
+          row.examTime = "";
+          return;
+        }
 
-      Object.assign(row, getExamDateTime(row.examStartTime, row.examEndTime));
+        Object.assign(
+          row,
+          getExamDateTime(
+            this.taskModel.examStartTime,
+            this.taskModel.examEndTime
+          )
+        );
+      });
     },
     backupCountChange() {
       this.updatePackageInfos();
     },
-    printHouseChange(row) {
-      const curHouse = this.printHouses.find(
-        (item) => item.printHouseId === row.printHouseId
+    printHouseChange() {
+      this.curHouse = this.printHouses.find(
+        (item) => item.printHouseId === this.taskModel.printHouseId
       );
-      if (curHouse) {
-        row.printHouseName = curHouse.printHouseName;
-      }
+      this.tableData.forEach((row) => {
+        row.printHouseId = this.curHouse?.printHouseId;
+        row.printHouseName = this.curHouse?.printHouseName;
+      });
     },
     toAdd() {
       if (!this.infoExamTask.courseId) {
@@ -428,7 +462,6 @@ export default {
         isSelectStudent: true,
         examTaskStudentObjectParamList: [],
         classNames: [],
-        canEditTime: false,
         ...modalFormData,
       };
       return data;
@@ -519,10 +552,12 @@ export default {
           ...this.getBackupCount(data.examTaskStudentObjectParamList.length),
           className: data.classNames.join(),
           studentCount: data.examTaskStudentObjectParamList.length,
-          canEditTime: !data.examStartTime || !data.examEndTime,
         });
         this.tableData.push(tableRow);
       });
+      // 更新考试时间和印刷室
+      this.printHouseChange();
+      this.timeChange();
     },
     toDelete(index) {
       this.tableData.splice(index, 1);

+ 2 - 2
src/modules/mark/components/markParam/MarkParamStructure.vue

@@ -150,7 +150,7 @@
               v-model="scope.row.totalScore"
               class="width-full"
               size="small"
-              :min="0.5"
+              :min="0"
               :max="500"
               :step="0.5"
               step-strictly
@@ -586,7 +586,7 @@ export default {
         if (!item.subNumber) {
           errorFields.push("小题号");
         }
-        if (!item.totalScore) {
+        if (!item.totalScore && item.totalScore !== 0) {
           errorFields.push("小题满分");
         }
         if (!item.intervalScore && !item.objective) {