batchDel.vue 2.29 KB
<!--
 * @Author: xiaomiao 1158771342@qq.com
 * @Date: 2023-03-09 14:54:49
 * @LastEditors: xiaomiao 1158771342@qq.com
 * @LastEditTime: 2023-04-27 10:39:11
 * @FilePath: \不动产登记系统\bdcdj-web\src\views\workflow\components\batchDel.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class='batchDel'>
    <lb-table :column="columns" :data="formData.dataList" :maxHeight="460" :heightNumSetting="true" :pagination="false"
      @selection-change="handleSelectionChange">
    </lb-table>
    <div class="text-center">
      <el-button @click="$popupCacel">取消</el-button>
      <el-button type="primary" @click="submitdelclick" plain>确定</el-button>
    </div>
  </div>
</template>
<script>
  import { deleteFlow } from "@/api/ywbl.js"
  import store from '@/store/index.js'
  export default {
    components: {},
    props: {
      formData: {
        type: Object,
        default: {}
      }
    },
    data () {
      return {
        columns: [
          {
            type: 'selection',
            label: '全选'
          },
          {
            label: '序号',
            type: 'index',
            width: '50',
          },
          {
            prop: "bdcdyh",
            label: "不动产单元号",
          },
          {
            prop: "zl",
            label: "坐落",
          },
        ],
        dataList: [],
        selectBdcdy: [],
      }
    },
    methods: {
      // 批量删除确定按钮
      submitdelclick () {
        var formdata = new FormData();
        formdata.append("bsmSldyList", this.selectBdcdy);
        formdata.append("bsmSlsq", this.formData.bsmSlsq);
        deleteFlow(formdata).then(res => {
          if (res.code == 200) {
            this.$popupCacel();
            store.dispatch('user/refreshPage', true);
            this.$message.success("删除成功");
          } else {
            this.$message.error(res.message)
          }
        })
      },
      // 批量删除勾选事件
      handleSelectionChange (e) {
        this.selectBdcdy = [];
        e.forEach((item, index) => {
          this.selectBdcdy.push(item.bsmSldy)
        })
      }
    }
  }
</script>
<style scoped lang='scss'>
</style>