fix:send_Date
This commit is contained in:
parent
e61f97faaf
commit
82eac261f4
2 changed files with 109 additions and 45 deletions
|
|
@ -24,6 +24,7 @@ const {
|
||||||
dateToISO,
|
dateToISO,
|
||||||
pathRegistryEmp,
|
pathRegistryEmp,
|
||||||
success,
|
success,
|
||||||
|
dialogConfirm,
|
||||||
} = useCounterMixin();
|
} = useCounterMixin();
|
||||||
|
|
||||||
//props
|
//props
|
||||||
|
|
@ -64,32 +65,34 @@ const reasonOp = ref<DataOption[]>([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
async function onSubmit() {
|
function onSubmit() {
|
||||||
try {
|
dialogConfirm($q, async () => {
|
||||||
showLoader();
|
try {
|
||||||
const formData = new FormData();
|
showLoader();
|
||||||
formData.append("ProfileId", profileId.value);
|
const formData = new FormData();
|
||||||
formData.append("Location", form.location);
|
formData.append("ProfileId", profileId.value);
|
||||||
formData.append(
|
formData.append("Location", form.location);
|
||||||
"ActiveDate",
|
formData.append(
|
||||||
form.activeDate !== null ? dateToISO(form.activeDate) : ""
|
"ActiveDate",
|
||||||
);
|
form.activeDate !== null ? dateToISO(form.activeDate) : ""
|
||||||
formData.append("Reason", form.reason);
|
);
|
||||||
if (form.files) {
|
formData.append("Reason", form.reason);
|
||||||
formData.append("file", form.files);
|
if (form.files) {
|
||||||
}
|
formData.append("file", form.files);
|
||||||
if (form.reason === "OTHER") {
|
}
|
||||||
formData.append("remark", form.remark);
|
if (form.reason === "OTHER") {
|
||||||
}
|
formData.append("remark", form.remark);
|
||||||
|
}
|
||||||
|
|
||||||
await http.post(config.API.resignAdmin(empType.value), formData);
|
await http.post(config.API.resignAdmin(empType.value), formData);
|
||||||
router.push({ name: isEmployee.value ? "resignEmployee" : "resign" });
|
router.push({ name: isEmployee.value ? "resignEmployee" : "resign" });
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
messageError($q, error);
|
messageError($q, error);
|
||||||
} finally {
|
} finally {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function ปิด popup*/
|
/** function ปิด popup*/
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,15 @@ import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { showLoader, hideLoader, messageError, success } = useCounterMixin();
|
const {
|
||||||
|
showLoader,
|
||||||
|
hideLoader,
|
||||||
|
messageError,
|
||||||
|
success,
|
||||||
|
date2Thai,
|
||||||
|
convertDateToAPI,
|
||||||
|
dialogConfirm,
|
||||||
|
} = useCounterMixin();
|
||||||
|
|
||||||
//props
|
//props
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
|
|
@ -26,27 +34,34 @@ const form = reactive({
|
||||||
tranferOrg: "",
|
tranferOrg: "",
|
||||||
noteReason: "",
|
noteReason: "",
|
||||||
files: null as File | null,
|
files: null as File | null,
|
||||||
|
date: null as Date | null,
|
||||||
});
|
});
|
||||||
|
|
||||||
async function onSubmit() {
|
function onSubmit() {
|
||||||
try {
|
dialogConfirm($q, async () => {
|
||||||
showLoader();
|
try {
|
||||||
const formData = new FormData();
|
showLoader();
|
||||||
formData.append("ProfileId", profileId.value);
|
const formData = new FormData();
|
||||||
formData.append("Organization", form.tranferOrg);
|
formData.append("ProfileId", profileId.value);
|
||||||
formData.append("Reason", form.noteReason);
|
formData.append("Organization", form.tranferOrg);
|
||||||
if (form.files) {
|
formData.append("Reason", form.noteReason);
|
||||||
formData.append("file", form.files);
|
formData.append(
|
||||||
}
|
"Date",
|
||||||
|
form.date !== null ? (convertDateToAPI(form.date) as string) : ""
|
||||||
|
);
|
||||||
|
if (form.files) {
|
||||||
|
formData.append("file", form.files);
|
||||||
|
}
|
||||||
|
|
||||||
await http.post(config.API.transferAdmin, formData);
|
await http.post(config.API.transferAdmin, formData);
|
||||||
router.push({ name: "transfer" });
|
router.push({ name: "transfer" });
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
messageError($q, error);
|
messageError($q, error);
|
||||||
} finally {
|
} finally {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function ปิด popup*/
|
/** function ปิด popup*/
|
||||||
|
|
@ -55,6 +70,7 @@ function closeDialog() {
|
||||||
form.tranferOrg = "";
|
form.tranferOrg = "";
|
||||||
form.noteReason = "";
|
form.noteReason = "";
|
||||||
form.files = null;
|
form.files = null;
|
||||||
|
form.date = null;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -67,7 +83,7 @@ function closeDialog() {
|
||||||
|
|
||||||
<q-card-section class="q-pa-md">
|
<q-card-section class="q-pa-md">
|
||||||
<div class="col-12 row q-col-gutter-sm">
|
<div class="col-12 row q-col-gutter-sm">
|
||||||
<div class="col-12">
|
<div class="col-md-9 col-sm-12">
|
||||||
<q-input
|
<q-input
|
||||||
class="inputgreen"
|
class="inputgreen"
|
||||||
dense
|
dense
|
||||||
|
|
@ -79,6 +95,51 @@ function closeDialog() {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3 col-sm-12">
|
||||||
|
<datepicker
|
||||||
|
class="inputgreen"
|
||||||
|
menu-class-name="modalfix"
|
||||||
|
v-model="form.date"
|
||||||
|
:locale="'th'"
|
||||||
|
autoApply
|
||||||
|
borderless
|
||||||
|
:enableTimePicker="false"
|
||||||
|
week-start="0"
|
||||||
|
>
|
||||||
|
<template #year="{ year }">
|
||||||
|
{{ year + 543 }}
|
||||||
|
</template>
|
||||||
|
<template #year-overlay-value="{ value }">
|
||||||
|
{{ parseInt(value + 543) }}
|
||||||
|
</template>
|
||||||
|
<template #trigger>
|
||||||
|
<q-input
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
|
hide-bottom-space
|
||||||
|
class="full-width"
|
||||||
|
:model-value="
|
||||||
|
form.date != null ? date2Thai(form.date) : null
|
||||||
|
"
|
||||||
|
:label="`${'ขอโอนตั้งแต่วันที่'}`"
|
||||||
|
:rules="[
|
||||||
|
(val: string) =>
|
||||||
|
!!val || `${'กรุณาเลือกวันที่ขอโอน'}`,
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon
|
||||||
|
name="event"
|
||||||
|
class="cursor-pointer"
|
||||||
|
style="color: var(--q-primary)"
|
||||||
|
>
|
||||||
|
</q-icon>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</template>
|
||||||
|
</datepicker>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<q-input
|
<q-input
|
||||||
class="inputgreen"
|
class="inputgreen"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue