<template>
|
<el-dialog :title="modalOptions.title" v-model="visible" @close="close">
|
<EditForm ref="editFormRef" />
|
<template #footer>
|
<el-button @click="closeModal">{{ modalOptions.cancelText }}</el-button>
|
<el-button type="primary" :loading="loading" @click="sendForm">
|
{{ modalOptions.confirmText }}
|
</el-button>
|
</template>
|
</el-dialog>
|
</template>
|
|
<script setup>
|
import { useModal } from "@/hooks/useModal";
|
import EditForm from "../Form/EditForm.vue";
|
import { updateRegistration } from "@/api/procurementManagement/procurementInvoiceLedger";
|
import { ElMessage } from "element-plus";
|
|
defineOptions({
|
name: "来票台账编辑",
|
});
|
const emits = defineEmits(["success"]);
|
|
const editFormRef = ref();
|
const {
|
id,
|
visible,
|
loading,
|
openModal,
|
modalOptions,
|
handleConfirm,
|
closeModal,
|
} = useModal({ title: "来票台账" });
|
|
const open = async (id) => {
|
openModal(id);
|
await nextTick();
|
editFormRef.value.load(id);
|
};
|
|
const close = () => {
|
editFormRef.value.resetForm();
|
closeModal();
|
};
|
|
const sendForm = async () => {
|
const form = editFormRef.value.form;
|
const { code } = await updateRegistration(form);
|
if (code === 200) {
|
emits("success");
|
ElMessage({ message: "操作成功", type: "success" });
|
close();
|
}
|
};
|
|
defineExpose({
|
open,
|
});
|
</script>
|