浏览代码

feat: 盲票组单选

Sun 3 年之前
父节点
当前提交
9116b78efa
共有 1 个文件被更改,包括 21 次插入7 次删除
  1. 21 7
      src/views/business/ticket/index.vue

+ 21 - 7
src/views/business/ticket/index.vue

@@ -102,10 +102,11 @@
     </el-row>
 
     <el-table
+      ref="table"
       v-loading="loading"
       :data="list"
-      @selection-change="handleSelectionChange"
-      class="el-table"
+      @select="handleSelect"
+      class="ticket-table"
     >
       <el-table-column
         type="selection"
@@ -276,10 +277,15 @@ export default {
     handleAdd() {
       this.$router.push({ name: "TicketCreate" });
     },
-
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.boxId);
+    handleSelect(selection, row) {
+      const isSelect = selection.find(item => item.boxId === row.boxId)
+      this.$refs.table.clearSelection()
+      if (isSelect) {
+        this.$refs.table.toggleRowSelection(row, true)
+        this.ids = row.boxId
+      } else {
+        this.ids = ''
+      }
     },
 
     handleDetail() {},
@@ -313,5 +319,13 @@ export default {
   destroyed() {},
 };
 </script>
-<style lang="scss" scoped>
+<style lang="scss">
+.ticket-table {
+  thead {
+    .el-checkbox {
+      display: none !important;
+    }
+  }
+  
+}
 </style>