shaogen1995 пре 4 година
родитељ
комит
f4802f8638
1 измењених фајлова са 38 додато и 3 уклоњено
  1. 38 3
      src/views/holding/holding0_add.vue

+ 38 - 3
src/views/holding/holding0_add.vue

@@ -48,12 +48,13 @@
              <h3>藏品信息</h3>
              <div class="btn">
                <el-button size="small" @click="isShow=true">添 加</el-button>
-               <el-button size="small">删 除</el-button>
+               <el-button size="small" @click="batchDel">删 除</el-button>
              </div>
           </div>
           <!--表格 -->
           <div class="table">
             <el-table
+              @selection-change="handleSelectionChange"
               :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
               :data="tableData"
               border
@@ -122,6 +123,8 @@ export default {
   },
   data () {
     return {
+      // 删除多个的id集合
+      delIds: [],
       // 单个id给弹窗,用来回显附件数据
       fujianId: null,
       // 第一层新增的数据
@@ -177,6 +180,37 @@ export default {
       // 把单个id给弹窗,用来回显附件数据
       this.isShowED = true
     },
+    // 表格的选中
+    handleSelectionChange (rows) {
+      // console.log(999, rows)
+      const temp = []
+      rows.forEach(v => {
+        temp.push(v.id)
+      })
+      const temp2 = new Set(temp)
+      this.delIds = [...temp2]
+    },
+    // 点击删除多个
+    batchDel () {
+      this.$confirm('确定删除码?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        // 发请求,清空数据
+        await removeOne(this.delIds.join(','))
+        this.$message({
+          type: 'success',
+          message: '删除成功!'
+        })
+        this.getHoldingList(this.mydata.id)
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消.'
+        })
+      })
+    },
     // 点击删除单个
     async deletes (id) {
       this.$confirm('确定删除码?', '提示', {
@@ -284,8 +318,7 @@ export default {
       justify-content: start;
     }
     .info{
-      max-height: 390px;
-      overflow: auto;
+      max-height: 404px;
       width: 86%;
       border: 1px solid #ccc;
       margin-left: 70px;
@@ -298,6 +331,8 @@ export default {
         padding: 0 30px;
       }
       .table{
+        overflow: auto;
+        max-height: 350px;
         .smimg{
           border: 3px solid #ccc;
           height: 78px;