소스 검색

初选报名bug修复

shilipojs 2 년 전
부모
커밋
916af408fa
2개의 변경된 파일25개의 추가작업 그리고 10개의 파일을 삭제
  1. 16 9
      src/views/system/user/profile/components/report-table.vue
  2. 9 1
      src/views/system/user/profile/components/test-drage.vue

+ 16 - 9
src/views/system/user/profile/components/report-table.vue

@@ -66,7 +66,7 @@
       </template>
     </mx-table>
     <!-- 初录 多志愿拖拽 -->
-    <div v-if="this.generation.current == 1">
+    <div v-if="this.generation.current == 1  ">
       <p>您的选科志愿: <span v-for="(item) in activeModels.selectedList">
       {{ item.groupName }}
 <!--        {{ index + 1 < selectedList.length ? '、' : '' }}-->
@@ -235,7 +235,7 @@ export default {
       }
     },
     resolveDynamicTable() {
-      if (!this.formatRows) return {}
+      if (!Object.keys(this.formatRows).length) return {}
       const options = this.generation.options
       if (!options || !this.generation.active) return {}
       const optValues = Object.values(options)
@@ -253,7 +253,11 @@ export default {
     },
     activeModels(){
       if(!this.generation) return {}
-      return this.generation.models.find(item => item.generation == this.generation.active)
+      const generation = this.generation.models.find(item => item.generation == this.generation.active)
+      generation.selectedList = generation.models.filter(item => {
+        return item.selected
+      })
+      return generation
     },
     // 初始化 rows 填充固定数据
     formatRows() {
@@ -310,6 +314,7 @@ export default {
         const real = this.activeModels.selectedList.filter(item => {
           return item.selected == true
         })
+        console.log(real)
         if (real.length < this.generation.status.preferenceCount) {
           this.$message.warning(`初录报名需要选择${this.generation.status.preferenceCount}个志愿`)
           return
@@ -326,8 +331,9 @@ export default {
         this.$message.warning(`最多选择${preferenceCount}个志愿`)
         return
       }
+      this.activeModels.models.find(item =>  item.groupId == row.groupId).selected = true
       row.selected = true
-      this.activeModels.selectedList.push(row)
+      // this.activeModels.selectedList.push(row)
     },
     toUnSelect(row) {
       this.$confirm(`是否解除选科组合【${row.groupName}】`, '警告', {
@@ -335,14 +341,15 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        row.selected = false
-        const start = this.activeModels.selectedList.findIndex(item => item.groupId == row.groupId)
-        console.log(start)
-        this.activeModels.selectedList.splice(start, 1)
+        this.activeModels.models.find(item =>  item.groupId == row.groupId).selected = false
+        // row.selected = false
+        // const start = this.activeModels.selectedList.findIndex(item => item.groupId == row.groupId)
+        // console.log(start)
+        // this.activeModels.selectedList.splice(start, 1)
       }).catch(() => {
         this.$message({
           type: 'info',
-          message: '已取消'
+          message: '已取消解除报名'
         })
       })
     },

+ 9 - 1
src/views/system/user/profile/components/test-drage.vue

@@ -27,7 +27,15 @@ export default {
     return {
       dragIndex: '',
       enterIndex: '',
-      sortList: this.selectedList,
+      sortList: [],
+    }
+  },
+  watch: {
+    selectedList: {
+      immediate:true,
+      handler(val){
+        this.sortList = val
+      }
     }
   },
   methods: {