<!-- 驳回弹窗 -->
<template>
    <simple-form-modal title="驳回提示" :items="formItems" ref="editRef" :baseUrl="baseUrl" :formatData="formatData"
        @success="(data) => emit('success', data)"></simple-form-modal>
</template>

<script setup>
import { reactive, ref, defineEmits, computed } from 'vue';
import SimpleFormModal from '@/components/CommonPage/SimpleFormModal.vue';

const emit = defineEmits(['success']);

const formItems = computed(() => {
    return [
        {
            type: 'dictSelect',
            label: '驳回原因',
            prop: 'refusalReson',
            props: { code: 'audit_reject_reason', class: 'custom-select' },
        }
    ];
});

//默认值
const baseUrl = reactive({
    add: '/order/orderInfo/exceptcheck',
    update: '/order/orderInfo/exceptcheck'
});

const formData = ref({
    id: '',
    checkStatus: 2
});

const formatData = (data) => {
    return {
        id: formData.value.id,
        checkStatus: formData.value.checkStatus,
        refusalReson: data.refusalReson,
        refusalResonCode: data.refusalReson
    }
}

const editRef = ref(null);

function handleOpen(id) {
    formData.value.id = id;
    editRef.value?.handleOpen(formData.value);
}

defineExpose({ handleOpen });
</script> 