Преглед изворни кода

feat: 处理歌单列吧,自动被选中

Damon пре 8 месеци
родитељ
комит
f1be0bd8c5

+ 1 - 1
src/utils/request.js

@@ -67,7 +67,7 @@ service.interceptors.request.use(config => {
 
       ///活动管理-新增赠送流量特殊处理
       if (config.url === "/admin/activity/doExchange") {
-        interval = 3000;
+        interval = 2000;
       } else {
         interval = 1000;
       }

+ 11 - 6
src/views/music/album/detail.vue

@@ -396,6 +396,7 @@ export default {
 
     handleSelectionChange(val) {
       this.form.programList = JSON.parse(JSON.stringify(val));
+      this.form.programList = this.form.programList.filter((i) => i);
       this.$message.success("操作成功!");
     },
 
@@ -509,13 +510,17 @@ export default {
           let title = this.form.id ? "编辑成功!" : "新增成功!";
           submit(this.form).then((res) => {
             if (res.code === 0) {
-              this.$message.success(`${title}`);
-              if (!this.form.id) {
-                this.cancel();
-              } else {
-                this.getDetail();
-              }
+              this.$message.success(title);
+              this.cancel();
             }
+            // if (res.code === 0) {
+            //   this.$message.success(`${title}`);
+            //   if (!this.form.id) {
+            //     this.cancel();
+            //   } else {
+            //     this.getDetail();
+            //   }
+            // }
           });
         } else {
           return false;

+ 13 - 7
src/views/music/blog/detail.vue

@@ -487,6 +487,8 @@ export default {
 
     handleSelectionChange(val) {
       this.form.adminPodCastProgramDetailResp = JSON.parse(JSON.stringify(val));
+      this.form.adminPodCastProgramDetailResp =
+        this.form.adminPodCastProgramDetailResp.filter((i) => i);
       this.$message.success("操作成功!");
     },
 
@@ -609,15 +611,19 @@ export default {
             this.form.podcastProgramIds.push(i.id);
           });
           submit(this.form).then((res) => {
+            // if (res.code === 0) {
             if (res.code === 0) {
-              this.$message.success(`${title}`);
-              if (this.form.id) {
-                delete this.form.adminPodCastProgramDetailResp;
-                this.getDetail();
-              } else {
-                this.cancel();
-              }
+              this.$message.success(title);
+              this.cancel();
             }
+            //   this.$message.success(`${title}`);
+            //   if (this.form.id) {
+            //     delete this.form.adminPodCastProgramDetailResp;
+            //     this.getDetail();
+            //   } else {
+            //     this.cancel();
+            //   }
+            // }
           });
         } else {
           return false;

+ 27 - 80
src/views/music/menu/detail.vue

@@ -288,7 +288,6 @@ export default {
       }
     };
     return {
-      multipleTable: null,
       // 遮罩层
       loading: false,
       // 表单
@@ -373,6 +372,7 @@ export default {
         status: 1,
         platformId: null,
       },
+
       // 总数据
       total: 0,
       // 弹窗列表
@@ -381,6 +381,8 @@ export default {
       disabled: false,
       // 是否已选
       disabledChecked: false,
+      ///是否加载完
+      isLoad: false,
     };
   },
   mounted() {
@@ -414,62 +416,11 @@ export default {
     },
 
     handleSelectionChange(val) {
-      this.form.programList = JSON.parse(JSON.stringify(val));
-      this.$message.success("操作成功!");
-      ///  获取去掉的item
-      // var deleteList = [];
-      // for (var i = 0; i < this.tableData.length; i++) {
-      //   var isHas = false;
-      //   for (var j = 0; j < val.length; j++) {
-      //     if (this.tableData[i].id === val[j].id) {
-      //       isHas = true;
-      //       break;
-      //     }
-      //   }
-      //   if (!isHas) {
-      //     deleteList.push(this.tableData[i]);
-      //   }
-      // }
-
-      // /// 删掉去掉的
-      // if (deleteList.length > 0) {
-      //   for (var i = 0; i < this.form.programList.length; i++) {
-      //     for (var j = 0; j < deleteList.length; j++) {
-      //       if (this.form.programList[i].id === deleteList[j].id) {
-      //         this.form.programList.splice(i, 1);
-      //         break;
-      //       }
-      //     }
-      //   }
-      // }
-      // console.log("gadadfqewrqerqerqr==22=" + this.form.programList.length);
-
-      // ///添加没有的
-      // for (var i = 0; i < val.length; i++) {
-      //   var item = {
-      //     id: val[i].id,
-      //     name: val[i].name,
-      //     singerName: val[i].singerName,
-      //     playTime: val[i].playTime,
-      //     status: val[i].status,
-      //     progaramUrl: val[i].progaramUrl,
-      //   };
-      //   var has = this.disabledList(item);
-      //   ///如果没有,添加
-      //   if (!has) {
-      //     this.form.programList.push(item);
-      //   }
-      // }
-
-      // this.form.programList.push({
-      //   id: row.id,
-      //   name: row.name,
-      //   singerName: row.singerName,
-      //   playTime: row.playTime,
-      //   status: row.status,
-      //   progaramUrl: row.progaramUrl,
-      // });
-      // this.$message.success("添加成功!");
+      if (this.isLoad) {
+        this.form.programList = JSON.parse(JSON.stringify(val));
+        this.form.programList = this.form.programList.filter((i) => i);
+        this.$message.success("操作成功!");
+      }
     },
 
     // 详情
@@ -505,30 +456,26 @@ export default {
           this.total = res.data.total;
           this.loading = false;
 
-          // const tableInstance = this.multipleTable;
-          // if (tableInstance) {
-          //   // 通过设置内部 selection 属性来选中行(这是内部实现细节,可能会随版本变化)
-          //   tableInstance.store.states.selection = this.form.programList.map(
-          //     (index) => tableData[index]
-          //   );
-          //   // 强制表格重新渲染,以显示选中的行
-          //   this.tableKey += 1;
-          // }
-
-          // this.$refs.tableData.clearSelection();
-
-          // if (this.form.programList.length > 0) {
-          //   for (var i = 0; i < this.form.programList.length; i++) {
-          //     for (var j = 0; j < this.tableData.length; j++) {
-          //       if (this.form.programList[i] === this.tableData[j]) {
-          //         console.log("gadfadsfqewrqewrqerqerqer===" + j);
-          //         this.tableData.toggleRowSelection(this.tableData[j], true);
-          //         break;
-          //       }
-          //     }
-          //   }
-          // }
+          this.isLoad = false;
+          if (this.form.programList.length > 0) {
+            var temp = [];
+            for (var i = 0; i < this.tableData.length; i++) {
+              for (var j = 0; j < this.form.programList.length; j++) {
+                if (this.form.programList[j].id === this.tableData[i].id) {
+                  temp.push(this.tableData[i]);
+                  break;
+                }
+              }
+            }
+
+            if (temp.length > 0) {
+              temp.forEach((item) => {
+                this.$refs.multipleTable.toggleRowSelection(item, true);
+              });
+            }
+          }
         }
+        this.isLoad = true;
       });
     },