ソースを参照

feat: 命题任务新建调整

zhangjie 6 ヶ月 前
コミット
eee7d5653d

+ 1 - 1
src/modules/base/components/ResetPwd.vue

@@ -228,7 +228,7 @@ export default {
       if (this.isSubmit) return;
       this.isSubmit = true;
       let datas = {
-        id: this.modalForm.id,
+        // id: this.modalForm.id,
       };
       if (this.needBindMobile) {
         datas = {

+ 34 - 39
src/modules/exam/components/createExamAndPrintTask/InfoPrintTask.vue

@@ -122,21 +122,6 @@
           >
           </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="卷袋序号">
@@ -166,6 +151,23 @@
             </template>
           </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 prop="examPlace" label="校区(考点)" width="140">
           <template slot-scope="scope">
             <el-input
@@ -184,8 +186,6 @@
             ></el-input>
           </template>
         </el-table-column>
-        <el-table-column prop="printHouseName" label="印刷室" width="140">
-        </el-table-column>
         <el-table-column
           label="操作"
           width="120"
@@ -280,8 +280,8 @@ export default {
       showStudent: false,
       curCreateTime: [],
       defaultTime: "",
-      taskModel: { examStartTime: null, examEndTime: null, printHouseId: "" },
-      curHouse: null,
+      taskModel: { examStartTime: null, examEndTime: null },
+      defaultHouse: null,
     };
   },
   computed: {
@@ -441,20 +441,15 @@ export default {
     async getPrintHouses() {
       this.printHouses = await listTaskPrintHouse();
       if (this.printHouses.length === 1) {
-        this.curHouse = this.printHouses[0];
-        this.taskModel.printHouseId = this.curHouse.printHouseId;
+        this.defaultHouse = this.printHouses[0];
+      } else {
+        this.defaultHouse = null;
       }
     },
     timeChange() {
-      this.tableData.forEach((row) => {
-        if (!this.taskModel.examStartTime || !this.taskModel.examEndTime) {
-          row.examDate = "";
-          row.examTime = "";
-          row.examStartTime = "";
-          row.examEndTime = "";
-          return;
-        }
+      if (!this.taskModel.examStartTime || !this.taskModel.examEndTime) return;
 
+      this.tableData.forEach((row) => {
         row.examStartTime = this.taskModel.examStartTime;
         row.examEndTime = this.taskModel.examEndTime;
 
@@ -470,14 +465,13 @@ export default {
     backupCountChange() {
       this.updatePackageInfos();
     },
-    printHouseChange() {
-      this.curHouse = this.printHouses.find(
-        (item) => item.printHouseId === this.taskModel.printHouseId
+    printHouseChange(row) {
+      const defaultHouse = this.printHouses.find(
+        (item) => item.printHouseId === row.printHouseId
       );
-      this.tableData.forEach((row) => {
-        row.printHouseId = this.curHouse?.printHouseId;
-        row.printHouseName = this.curHouse?.printHouseName;
-      });
+      if (defaultHouse) {
+        row.printHouseName = defaultHouse.printHouseName;
+      }
     },
     toAdd() {
       if (!this.infoExamTask.courseId) {
@@ -610,11 +604,12 @@ export default {
           className: data.classNames.join(),
           studentCount: data.examTaskStudentObjectParamList.length,
         });
+        if (this.defaultHouse) {
+          tableRow.printHouseId = this.defaultHouse.printHouseId;
+          tableRow.printHouseName = this.defaultHouse.printHouseName;
+        }
         this.tableData.push(tableRow);
       });
-      // 更新考试时间和印刷室
-      this.printHouseChange();
-      this.timeChange();
     },
     toDelete(index) {
       this.tableData.splice(index, 1);

+ 34 - 51
src/modules/exam/components/taskApply/TaskPrint.vue

@@ -127,22 +127,6 @@
           >
           </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="卷袋序号">
@@ -173,6 +157,23 @@
             </template>
           </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 prop="examPlace" label="校区(考点)" width="140">
           <template slot-scope="scope">
             <el-input
@@ -193,8 +194,6 @@
             ></el-input>
           </template>
         </el-table-column>
-        <el-table-column prop="printHouseName" label="印刷室" width="140">
-        </el-table-column>
         <el-table-column
           label="操作"
           width="120"
@@ -292,8 +291,8 @@ export default {
       showStudent: false,
       curCreateTime: [],
       defaultTime: "",
-      taskModel: { examStartTime: null, examEndTime: null, printHouseId: "" },
-      curHouse: null,
+      taskModel: { examStartTime: null, examEndTime: null },
+      defaultHouse: null,
       // exam task content
       infoExamTask: {},
       infoExamTaskDetail: [],
@@ -325,8 +324,9 @@ export default {
     async getPrintHouses() {
       this.printHouses = await listTaskPrintHouse();
       if (this.printHouses.length === 1) {
-        this.curHouse = this.printHouses[0];
-        this.taskModel.printHouseId = this.curHouse.printHouseId;
+        this.defaultHouse = this.printHouses[0];
+      } else {
+        this.defaultHouse = null;
       }
     },
     async getInfoPrintTask() {
@@ -359,17 +359,6 @@ 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;
@@ -393,15 +382,9 @@ export default {
       return { backupCount, minBackupCount: backupCount };
     },
     timeChange() {
-      this.tableData.forEach((row) => {
-        if (!this.taskModel.examStartTime || !this.taskModel.examEndTime) {
-          row.examDate = "";
-          row.examTime = "";
-          row.examStartTime = "";
-          row.examEndTime = "";
-          return;
-        }
+      if (!this.taskModel.examStartTime || !this.taskModel.examEndTime) return;
 
+      this.tableData.forEach((row) => {
         row.examStartTime = this.taskModel.examStartTime;
         row.examEndTime = this.taskModel.examEndTime;
 
@@ -417,14 +400,13 @@ export default {
     backupCountChange() {
       this.updatePackageInfos();
     },
-    printHouseChange() {
-      this.curHouse = this.printHouses.find(
-        (item) => item.printHouseId === this.taskModel.printHouseId
+    printHouseChange(row) {
+      const defaultHouse = this.printHouses.find(
+        (item) => item.printHouseId === row.printHouseId
       );
-      this.tableData.forEach((row) => {
-        row.printHouseId = this.curHouse?.printHouseId;
-        row.printHouseName = this.curHouse?.printHouseName;
-      });
+      if (defaultHouse) {
+        row.printHouseName = defaultHouse.printHouseName;
+      }
     },
     toAdd() {
       if (!this.infoExamTask.courseId) {
@@ -558,11 +540,12 @@ export default {
           className: data.classNames.join(),
           studentCount: data.examTaskStudentObjectParamList.length,
         });
+        if (this.defaultHouse) {
+          tableRow.printHouseId = this.defaultHouse.printHouseId;
+          tableRow.printHouseName = this.defaultHouse.printHouseName;
+        }
         this.tableData.push(tableRow);
       });
-      // 更新考试时间和印刷室
-      this.printHouseChange();
-      this.timeChange();
     },
     toDelete(index) {
       this.tableData.splice(index, 1);