<template>
  <!-- 删除 -->
  <div>
  </div>
</template>

<script lang="ts">
import { defineComponent, PropType, ref } from 'vue';
import Drawer from '@/common/components/drawer/index.vue';
import { QueryPermancePlanTmpRsp } from '@/services/go/wrtrade/interface';
import { _closeModal } from '@/common/setup/modal/modal';
import { Modal } from 'ant-design-vue';
import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
import { delPerformancePlanTemplateReq } from '@/services/proto/performance';

export default defineComponent({
  name: 'search_performance_template_delete',
  components: { Drawer },
  emits: ['cancel', 'update'],
  props: {
    selectedRow: {
      type: Object as PropType<QueryPermancePlanTmpRsp>,
      default: {},
    },
  },
  setup(props, context) {
    const { visible, cancel } = _closeModal(context);
    const loading = ref<boolean>(false);
    Modal.confirm({
      title: '删除',
      content: '是否确认删除履约模板！',
      onOk: submit,
      onCancel: cancel,
    });
    function submit() {
      // 挂牌撤单请求
      const id = props.selectedRow.autoid;
      requestResultLoadingAndInfo(delPerformancePlanTemplateReq, id, loading, ['删除成功', '删除失败:']).then(() => {
        cancel(true);
      });
    }
    return {
      visible,
      cancel,
      submit,
      loading,
    };
  },
});
</script>