浏览代码

标签管理 标签分类 内容弹窗重复勾选bug 取消弹窗还会勾选内容

DESKTOP-O04BTUJ\muzen 3 年之前
父节点
当前提交
3a988f33dc
共有 1 个文件被更改,包括 18 次插入8 次删除
  1. 18 8
      src/views/label/tag/detail.vue

+ 18 - 8
src/views/label/tag/detail.vue

@@ -81,7 +81,7 @@
     </el-form>
 
     <!-- 弹窗 -->
-    <el-dialog :visible.sync="dialogVisible" title="新增频道内容">
+    <el-dialog :visible.sync="dialogVisible" title="新增频道内容" :before-close="getCancel">
       <el-form inline size="mini">
         <el-form-item label="内容名称:">
           <el-input v-model="dialogForm.name" placeholder="请输入内容名称" clearable />
@@ -109,7 +109,7 @@
       <pagination v-show="total>0" :total="total" :page.sync="dialogForm.pageNum"
         :limit.sync="dialogForm.pageSize" @pagination="getPage" />
       <div slot="footer">
-        <el-button @click="this.dialogVisible = false">取消</el-button>
+        <el-button @click="getCancel">取消</el-button>
         <el-button type="primary" @click="getAdd">确定</el-button>
       </div>
     </el-dialog>
@@ -304,12 +304,15 @@ export default {
         if (res.code === 0) {
           this.dialogData = res.data.records
           this.total = res.data.total
-          this.tableData.map(i => {
-            let row = res.data.records.find(j => j.id === i.audioId)
-            if (row) {
-              this.$refs.table.toggleRowSelection(row)
-            }
-          })
+          this.$refs.table.clearSelection()
+          if (this.tableData.length > 0) {
+            this.tableData.map(i => {
+              let row = res.data.records.find(j => j.id == i.audioId)
+              if (row) {
+                this.$refs.table.toggleRowSelection(row)
+              }
+            })
+          }
           this.loading = false
         }
       })
@@ -358,6 +361,13 @@ export default {
       }
     },
 
+    // 取消弹窗
+    getCancel() {
+      this.dialogVisible = false
+      this.ids = []
+      // this.$refs.table.clearSelection();
+    },
+
     // 添加频道内容
     getAdd() {
       createTag({