From e8abe383b0348469a0543e225096d31298c12857 Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期一, 20 五月 2024 13:42:25 +0800
Subject: [PATCH] fix:修改考生回显问题

---
 src/views/exam/paper/edit.vue |   43 ++++++++++++++++++++++++++-----------------
 1 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/src/views/exam/paper/edit.vue b/src/views/exam/paper/edit.vue
index 9b205ac..795212a 100644
--- a/src/views/exam/paper/edit.vue
+++ b/src/views/exam/paper/edit.vue
@@ -1,10 +1,9 @@
 <template>
   <div class="app-container">
     <el-form :model="form" ref="form" label-width="200px" v-loading="formLoading" :rules="rules">
-      <el-form-item label="鑰冪敓锛�" prop="menuIds" required>
-        <el-select v-model="form.menuIds" :collapse-tags="true" multiple placeholder="璇烽�夋嫨" @focus="selectStudent"
-          popper-class="examinee-popper"
-          >
+      <el-form-item label="鑰冪敓锛�" prop="examineeList" required>
+        <el-select v-model="form.examineeList" :collapse-tags="true" multiple placeholder="璇烽�夋嫨" @focus="selectStudent"
+          popper-class="examinee-popper">
         </el-select>
       </el-form-item>
       <el-form-item label="璇剧洰锛�" prop="subjectId" required>
@@ -145,8 +144,8 @@
           <el-button type="primary" @click="selectStudent">鏌ヨ</el-button>
         </el-form-item>
       </el-form>
-      <el-table ref="multipleTable" v-loading="student.listLoading" :data="tableData" border fit highlight-current-row style="width: 100%"
-        @selection-change="handleSelection" row-key="id">
+      <el-table ref="multipleTable" v-loading="student.listLoading" :data="tableData" border fit highlight-current-row
+        style="width: 100%" @selection-change="handleSelection" row-key="id">
         <el-table-column type="selection" :reserve-selection="true"></el-table-column>
         <el-table-column prop="realName" label="瀛﹀憳" />
       </el-table>
@@ -207,12 +206,13 @@
         suggestTime: null,
         titleItems: [],
         subjectSource: {},
-        questionTypeVMS: []
+        questionTypeVMS: [],
+        examineeList: []
       },
       subjectFilter: null,
       formLoading: false,
       rules: {
-        menuIds: [
+        examineeList: [
           { required: true, message: '璇烽�夋嫨', trigger: 'change' }
         ],
         subjectId: [
@@ -246,10 +246,6 @@
         total: 0
       },
       currentTitleItem: null,
-
-
-      examineeList: [],
-
     };
   },
   created() {
@@ -262,7 +258,8 @@
       _this.formLoading = true;
       examPaperApi.select(id).then(re => {
         _this.form = re.response;
-        _this.form.menuIds = JSON.parse(re.response.menuIds);
+        // _this.form.menuIds = JSON.parse(re.response.menuIds);
+        _this.examineeList = JSON.parse(re.response.userIds).map(item => item.realName);
         console.log(_this.form);
         _this.formLoading = false;
       });
@@ -294,7 +291,7 @@
 
         this.$nextTick(() => {
           this.tableData.map(data => {
-            if (this.form.menuIds.find(item => item === data.id)) {
+            if (this.form.userIds.find(item => item === data.id)) {
               this.$refs.multipleTable.toggleRowSelection(data, true);
             } else {
               this.$refs.multipleTable.toggleRowSelection(data, false);
@@ -381,7 +378,7 @@
             tempForm.subjectId = tempForm.subjectId;
           };
           tempForm.userIds = tempForm.menuIds;
-          tempForm.menuIds = JSON.stringify(tempForm.menuIds);
+          // tempForm.menuIds = JSON.stringify(tempForm.menuIds);
 
           if (tempForm.questionTypeVMS == null) {
             tempForm.questionTypeVMS = [];
@@ -438,7 +435,15 @@
       this.questionPage.showDialog = false;
     },
     confirmStudentSelect() {
-      this.form.menuIds = this.student.multipleSelection.map((item) => item.id);
+      // this.form.menuIds = this.student.multipleSelection.map((item) => item.id);
+      this.form.userIds = this.student.multipleSelection.map((item) => {
+        return {
+          id: item.id,
+          realName: item.realName
+        };
+      });
+      this.form.examineeList = this.student.multipleSelection.map((item) => item.realName);
+      
       this.studentDialog = false;
     },
 
@@ -513,7 +518,11 @@
       paperTypeEnum: state => state.exam.examPaper.paperTypeEnum,
       levelEnum: state => state.user.levelEnum
     }),
-    ...mapState('exam', { subjects: state => state.subjects })
+    ...mapState('exam', { subjects: state => state.subjects }),
+
+    examineeFormat() {
+      return this.examineeList.map(item => item.realName);
+    }
   }
 };
 </script>

--
Gitblit v1.8.0