<script>
import { INVALID } from "@/api/business/purchase/catalogue";

export default {
  name: "InvalidDialog",
  data() {
    return {};
  },
  computed: {},
  watch: {},
  methods: {
    //
    open(prop) {
      return this.$confirm("是否失效数据项?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "info",
      })
        .then(async () => {
          try {
            // try
            const ids = prop.map((item) => item.id);
            const { msg, code } = await INVALID({ ids });
            if (code === 200) {
              this.$emit("success");
              this.$notify.success(msg);
            }
          } catch (err) {
            // catch
            console.error(err);
          } finally {
            // finally
          }
        })
        .catch((err) => {
          console.error(err);
        });
    },
  },
  created() {},
  mounted() {},
  destroyed() {},
};
</script>
<template></template>
