<script>
import { ALTERATION } from "@/api/business/purchase/contract";

export default {
  name: "DeleteDialog",
  data() {
    return {};
  },
  computed: {},
  watch: {},
  methods: {
    //
    open(prop) {
      return new Promise((resolve, reject) => {
        this.$confirm("是否变更数据项?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "info",
        })
          .then(async () => {
            try {
              // try
              const { msg, code } = await ALTERATION(prop);
              if (code === 200) {
                resolve(true);
                this.$emit("success");
                this.$notify.success(msg);
              }
            } catch (err) {
              // catch
              reject(false);
              console.error(err);
            } finally {
              // finally
            }
          })
          .catch(() => reject(false));
      });
    },
  },
  created() {},
  mounted() {},
  destroyed() {},
};
</script>
<template></template>
