index.vue 913 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <script>
  2. export default {
  3. name: "PiLiangDaoChu",
  4. props: {
  5. selectData: {
  6. type: Array,
  7. default: () => [],
  8. },
  9. },
  10. data() {
  11. return {
  12. title: "批量导出",
  13. };
  14. },
  15. computed: {
  16. disabled: {
  17. get() {
  18. let { selectData } = this.$props;
  19. if (selectData.length > 0) {
  20. return false;
  21. }
  22. return true;
  23. },
  24. set() {},
  25. },
  26. },
  27. methods: {
  28. async onClick() {
  29. try {
  30. let ids = this.$props.selectData.map((item) => item.id);
  31. console.log(ids, "ids");
  32. this.download(
  33. "/system/apply/material/exportApplies",
  34. { ids },
  35. `物料申请单${new Date().getTime()}.xlsx`
  36. );
  37. } catch (error) {}
  38. },
  39. },
  40. created() {},
  41. };
  42. </script>
  43. <template>
  44. <el-button @click="onClick" :disabled="disabled" :size="$attrs.size">
  45. {{ title }}
  46. </el-button>
  47. </template>