Quellcode durchsuchen

精选电台 关联列表 删除bug修复

DESKTOP-SVI9JE1\muzen vor 2 Jahren
Ursprung
Commit
e5e8a4a506
1 geänderte Dateien mit 7 neuen und 6 gelöschten Zeilen
  1. 7 6
      src/views/operation/recommend/detail.vue

+ 7 - 6
src/views/operation/recommend/detail.vue

@@ -376,14 +376,16 @@ export default {
         if (res.code === 0) {
         if (res.code === 0) {
           this.dialogTableData = res.data.records
           this.dialogTableData = res.data.records
           this.total = res.data.total
           this.total = res.data.total
-          let row = ''
+          this.$refs.dialogTableData.clearSelection()
           if (this.form[this.index].childList && this.form[this.index].childList.length > 0) {
           if (this.form[this.index].childList && this.form[this.index].childList.length > 0) {
             this.form[this.index].childList.map(i => {
             this.form[this.index].childList.map(i => {
-              row = res.data.records.find(j => j.audioId === i.module.contentId)
+              let row = res.data.records.find(j => j.audioId === i.module.contentId)
+              // 有相同数据就回显勾选
+              if (row) {
+                this.$refs.dialogTableData.toggleRowSelection(row, true)
+              }
             })
             })
           }
           }
-          // 有相同数据就回显勾选
-          row ? this.$refs.dialogTableData.toggleRowSelection(row) : this.$refs.dialogTableData.clearSelection();
           this.loading = false
           this.loading = false
         }
         }
       })
       })
@@ -422,7 +424,6 @@ export default {
 
 
     // 批量选择
     // 批量选择
     handleSelectionChange(row) {
     handleSelectionChange(row) {
-      this.form[this.index].childList = []
       if (row.length > 0) {
       if (row.length > 0) {
         row.map(i => {
         row.map(i => {
           if (this.form[this.index].childList.findIndex(j => j.module.contentId === i.audioId) === -1) {
           if (this.form[this.index].childList.findIndex(j => j.module.contentId === i.audioId) === -1) {
@@ -499,7 +500,7 @@ export default {
 
 
     // 删除关联
     // 删除关联
     getRemove(row, index) {
     getRemove(row, index) {
-      let e = this.form[index].childList.findIndex(i => i.contentId === row.contentId)
+      let e = this.form[index].childList.findIndex(i => i.module.contentId === row.module.contentId)
       this.form[index].childList.splice(e, 1)
       this.form[index].childList.splice(e, 1)
     },
     },