<script>
export default {
  name: "PiLiangDaoChu",
  props: {
    selectData: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      title: "批量导出",
    };
  },
  computed: {
    disabled: {
      get() {
        let { selectData } = this.$props;

        if (selectData.length > 0) {
          return false;
        }
        return true;
      },
      set() {},
    },
  },
  methods: {
    async onClick() {
      try {
        let ids = this.$props.selectData.map((item) => item.id);
        console.log(ids, "ids");
        this.download(
          "/system/apply/material/exportApplies",
          { ids },
          `物料申请单${new Date().getTime()}.xlsx`
        );
      } catch (error) {}
    },
  },
  created() {},
};
</script>
<template>
  <el-button @click="onClick" :disabled="disabled" :size="$attrs.size">
    {{ title }}
  </el-button>
</template>
