เพิ่ม from submit
This commit is contained in:
parent
e4835425c0
commit
2dabb6d6a8
1 changed files with 259 additions and 280 deletions
|
|
@ -251,67 +251,38 @@ function checkEndDate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
// watch(
|
||||||
() => formData.date,
|
// () => formData.date,
|
||||||
() => {
|
// () => {
|
||||||
if (formData.date) {
|
// if (formData.date) {
|
||||||
dateRef.value.resetValidation();
|
// dateRef.value.resetValidation();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
|
||||||
watch(
|
// watch(
|
||||||
() => formData.startDate,
|
// () => formData.startDate,
|
||||||
() => {
|
// () => {
|
||||||
if (formData.startDate) {
|
// if (formData.startDate) {
|
||||||
startDateRef.value.resetValidation();
|
// startDateRef.value.resetValidation();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
|
||||||
watch(
|
// watch(
|
||||||
() => formData.endDate,
|
// () => formData.endDate,
|
||||||
() => {
|
// () => {
|
||||||
if (formData.endDate) {
|
// if (formData.endDate) {
|
||||||
endDateRef.value.resetValidation();
|
// endDateRef.value.resetValidation();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
|
||||||
/**
|
|
||||||
* function เรียกไฟล์ PDF
|
|
||||||
* @param url link PDF
|
|
||||||
* @param type ประเภทไฟล์
|
|
||||||
* @param fileName ชือไฟล์
|
|
||||||
*/
|
|
||||||
async function downloadFile(url: string, type: string, fileName: string) {
|
|
||||||
await axios
|
|
||||||
.get(url, {
|
|
||||||
method: "GET",
|
|
||||||
responseType: "blob",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
Accept: type, // ถ้ามีการระบุเมื่ออัปโหลด
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then(async (res) => {
|
|
||||||
const a = document.createElement("a");
|
|
||||||
a.href = window.URL.createObjectURL(res.data);
|
|
||||||
a.download = fileName;
|
|
||||||
a.click();
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
messageError($q, err);
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-dialog v-model="modal" persistent>
|
<q-dialog v-model="modal" persistent>
|
||||||
<q-card class="col-12" style="width: 80%">
|
<q-card class="col-12" style="width: 80%">
|
||||||
|
<form @submit.prevent.stop="onClickSubmit">
|
||||||
<Header :tittle="title" :close="closeDialog" />
|
<Header :tittle="title" :close="closeDialog" />
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
|
||||||
|
|
@ -378,7 +349,11 @@ async function downloadFile(url: string, type: string, fileName: string) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-xs-12 col-md-1">
|
<div class="col-xs-12 col-md-1">
|
||||||
<q-checkbox size="md" v-model="formData.isSpecial" label="ฉ" />
|
<q-checkbox
|
||||||
|
size="md"
|
||||||
|
v-model="formData.isSpecial"
|
||||||
|
label="ฉ"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|
@ -415,7 +390,9 @@ async function downloadFile(url: string, type: string, fileName: string) {
|
||||||
dense
|
dense
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:model-value="
|
:model-value="
|
||||||
formData.date != null ? date2Thai(formData.date) : null
|
formData.date != null
|
||||||
|
? date2Thai(formData.date)
|
||||||
|
: null
|
||||||
"
|
"
|
||||||
label="ให้ไว้ ณ วันที่"
|
label="ให้ไว้ ณ วันที่"
|
||||||
:rules="[
|
:rules="[
|
||||||
|
|
@ -467,7 +444,8 @@ async function downloadFile(url: string, type: string, fileName: string) {
|
||||||
"
|
"
|
||||||
label="วันที่มีผลบังคับใช้"
|
label="วันที่มีผลบังคับใช้"
|
||||||
:rules="[
|
:rules="[
|
||||||
(val) => !!val || `${'กรุณาเลือกวันที่มีผลบังคับใช้'}`,
|
(val) =>
|
||||||
|
!!val || `${'กรุณาเลือกวันที่มีผลบังคับใช้'}`,
|
||||||
]"
|
]"
|
||||||
lazy-rules
|
lazy-rules
|
||||||
>
|
>
|
||||||
|
|
@ -547,10 +525,11 @@ async function downloadFile(url: string, type: string, fileName: string) {
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<div class="text-right q-ma-sm">
|
<div class="text-right q-ma-sm">
|
||||||
<q-btn label="บันทึก" color="secondary" @click="onClickSubmit">
|
<q-btn label="บันทึก" type="submit" color="secondary">
|
||||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue