แก้ การส่งไฟล์

This commit is contained in:
AnandaTon 2023-08-24 16:08:11 +07:00
parent f7c7959f1c
commit cb4e32c855
2 changed files with 270 additions and 13 deletions

View file

@ -120,6 +120,7 @@ const tranferOrg = ref("")
const dateCommand = ref<Date>(new Date())
const dateLeave = ref<Date>(new Date())
const noteReason = ref("")
const nameFile = ref<string>("")
onMounted(() => {
if (route.params.id !== undefined) {
@ -129,8 +130,8 @@ onMounted(() => {
})
const saveResing = () => {
$q.dialog({
title: "ยืนยันการยื่นข้อมูลลาออก",
message: "ต้องการยื่นข้อมูลลาออกนี้ใช่หรือไม่?",
title: "ยืนยันการยื่นข้อมูลแบบสอบถาม",
message: "ต้องการยื่นข้อมูลแบบสอบถามนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
@ -145,11 +146,16 @@ const saveResing = () => {
}
const createFormresign = async () => {
const formData = new FormData()
const blob = files.value.slice(0, files.value[0].size)
const newFile = new File(blob, nameFile.value, {
type: files.value[0].type,
})
formData.append("Location", tranferOrg.value)
formData.append("SendDate", dateToISO(dateCommand.value))
formData.append("ActiveDate", dateToISO(dateLeave.value))
formData.append("Reason", noteReason.value)
formData.append("file", files.value)
formData.append("file", newFile)
console.log(files.value)
await http
.post(config.API.listResign(), formData)
.then((res: any) => {