<template>
  <my-drawer
    class="sop-dialog"
    :visible="visible"
    header="上报质量问题"
    size="80%"
    attach="body"
    :closeOnOverlayClick="false"
    :close-btn="true"
    :footer="false"
    @close="emit('update:visible', false)"
  >
    <quality-issue
      v-if="visible"
      :sop="sop"
      :type="type"
      @confirm="stepConfirm"
      @cancel="emit('update:visible', false)"
    ></quality-issue>
  </my-drawer>
</template>

<script setup name="QualityIssueDialog">
import QualityIssue from './index.vue';

const emit = defineEmits(['update:visible', 'confirm']);
const props = defineProps({
  visible: Boolean,
  sop: {
    type: Object,
    default() {
      return {};
    },
  },
  type: {
    type: String,
    default: 'new',
  },
});

const stepConfirm = () => {
  emit('update:visible', false);
  emit('confirm');
};
</script>
