Procházet zdrojové kódy

feat: 处理播客专辑列表,自动被选中

Damon před 8 měsíci
rodič
revize
edad4b0a49
1 změnil soubory, kde provedl 37 přidání a 4 odebrání
  1. 37 4
      src/views/music/blog/detail.vue

+ 37 - 4
src/views/music/blog/detail.vue

@@ -445,6 +445,8 @@ export default {
       ids: [],
       // 是否已选
       disabledChecked: false,
+      ///被选中数据是否加载完
+      isLoad: false,
     };
   },
   mounted() {
@@ -486,10 +488,14 @@ export default {
     },
 
     handleSelectionChange(val) {
-      this.form.adminPodCastProgramDetailResp = JSON.parse(JSON.stringify(val));
-      this.form.adminPodCastProgramDetailResp =
-        this.form.adminPodCastProgramDetailResp.filter((i) => i);
-      this.$message.success("操作成功!");
+      if (this.isLoad) {
+        this.form.adminPodCastProgramDetailResp = JSON.parse(
+          JSON.stringify(val)
+        );
+        this.form.adminPodCastProgramDetailResp =
+          this.form.adminPodCastProgramDetailResp.filter((i) => i);
+        this.$message.success("操作成功!");
+      }
     },
 
     // 详情
@@ -550,6 +556,33 @@ export default {
           this.dialogTableData = res.data.records;
           this.total = res.data.total;
           this.loading = false;
+
+          this.isLoad = false;
+          if (this.form.adminPodCastProgramDetailResp.length > 0) {
+            var temp = [];
+            for (var i = 0; i < this.dialogTableData.length; i++) {
+              for (
+                var j = 0;
+                j < this.form.adminPodCastProgramDetailResp.length;
+                j++
+              ) {
+                if (
+                  this.form.adminPodCastProgramDetailResp[j].id ===
+                  this.dialogTableData[i].id
+                ) {
+                  temp.push(this.dialogTableData[i]);
+                  break;
+                }
+              }
+            }
+
+            if (temp.length > 0) {
+              temp.forEach((item) => {
+                this.$refs.multipleTable.toggleRowSelection(item, true);
+              });
+            }
+          }
+          this.isLoad = true;
         }
       });
     },