แก้ให้ file เป็นว่างได้

This commit is contained in:
AnandaTon 2023-09-25 12:53:42 +07:00
parent bf5b67ee36
commit 3ebc2714cc

View file

@ -88,20 +88,16 @@ const fileUploadDoc = async (file: any) => {
const saveResing = () => { const saveResing = () => {
$q.dialog({ $q.dialog({
title: "ยืนยันการยื่นข้อมูลแบบสอบถาม", title: "ยืนยันการยื่นข้อมูลลาออก",
message: "ต้องการยื่นข้อมูลแบบสอบถามนี้ใช่หรือไม่?", message: "ต้องการยื่นข้อมูลลาออกนี้ใช่หรือไม่?",
cancel: { cancel: {
flat: true, flat: true,
color: "negative", color: "negative",
}, },
persistent: true, persistent: true,
}) })
.onOk(async () => { .onOk(() => {
if (files.value == undefined) { createFormresign()
fails($q, "กรุณากรอกอัพโหลดเอกสารเพิ่มเติม")
} else {
createFormresign()
}
}) })
.onCancel(() => {}) .onCancel(() => {})
.onDismiss(() => {}) .onDismiss(() => {})
@ -147,15 +143,17 @@ const deleteResting = async (id: string) => {
// //
const createFormresign = async () => { const createFormresign = async () => {
const formData = new FormData() const formData = new FormData()
const blob = files.value.slice(0, files.value[0].size)
const newFile = new File(blob, nameFile.value, { // const blob = files.value.slice(0, files.value[0].size)
type: files.value[0].type, // const newFile = new File(blob, nameFile.value, {
}) // type: files.value[0].type,
// })
formData.append("Location", tranferOrg.value) formData.append("Location", tranferOrg.value)
formData.append("SendDate", dateToISO(dateCommand.value)) formData.append("SendDate", dateToISO(dateCommand.value))
formData.append("ActiveDate", dateToISO(dateLeave.value)) formData.append("ActiveDate", dateToISO(dateLeave.value))
formData.append("Reason", noteReason.value) formData.append("Reason", noteReason.value)
formData.append("file", newFile) formData.append("file", files.value)
await http await http
.post(config.API.listResign(), formData) .post(config.API.listResign(), formData)
.then((res: any) => { .then((res: any) => {