<script setup lang="ts">
import { ref } from "vue";
import PaymentTable from "./payment-table.vue";
import CreateTicketDialog from "./create-ticket-dialog.vue";

const visible = ref(false);

const ticketDialogRef = ref<InstanceType<typeof CreateTicketDialog>>(null);

function handleAdd({ payNo }) {
  ticketDialogRef.value.onDisplay(payNo);
}

defineExpose({
  onDisplay: () => (visible.value = true)
});
</script>

<template>
  <el-dialog v-model="visible" title="新建采购回票" center destroy-on-close>
    <PaymentTable @add-btn-click="handleAdd" />

    <CreateTicketDialog ref="ticketDialogRef" />
  </el-dialog>
</template>
