แก้ใช้ จาก mixin

This commit is contained in:
setthawutttty 2025-03-10 17:47:34 +07:00
parent 920ca8e13b
commit cbee41e212
12 changed files with 81 additions and 102 deletions

View file

@ -1,7 +1,6 @@
<script setup lang="ts">
import { ref, reactive, onMounted, computed, watch } from "vue";
import { useQuasar } from "quasar";
import { format, utcToZonedTime } from "date-fns-tz";
import http from "@/plugins/http";
import config from "@/app.config";
@ -14,7 +13,7 @@ import type { FormRef } from "@/modules/05_leave/interface/request/BirthForm";
const $q = useQuasar();
const dataStore = useLeaveStore();
const mixin = useCounterMixin();
const { date2Thai, dateToISO, messageError } = mixin;
const { date2Thai, dateToISO, messageError, convertDateToAPI } = mixin;
const edit = ref<boolean>(true);
const leaveId = ref<string>("");
@ -107,11 +106,11 @@ function onValidate() {
formData.append("type", formDataBirth.type);
formData.append(
"leaveStartDate",
dateToISO(new Date(formDataBirth.leaveStartDate))
convertDateToAPI(formDataBirth.leaveStartDate) ?? ""
);
formData.append(
"leaveEndDate",
dateToISO(new Date(formDataBirth.leaveEndDate))
convertDateToAPI(formDataBirth.leaveEndDate) ?? ""
);
formData.append("leaveWrote", formDataBirth.leaveWrote);
formData.append("leaveAddress", formDataBirth.leaveAddress);
@ -133,8 +132,8 @@ async function fetchCheck() {
await http
.post(config.API.leaveCheck(), {
type: dataStore.typeId ?? null,
StartLeaveDate: format(utcToZonedTime(formDataBirth.leaveStartDate , "Asia/Bangkok"),"yyyy-MM-dd") ?? null,
EndLeaveDate: format(utcToZonedTime(formDataBirth.leaveEndDate , "Asia/Bangkok"),"yyyy-MM-dd") ?? null,
StartLeaveDate: convertDateToAPI(formDataBirth.leaveStartDate) ?? null,
EndLeaveDate: convertDateToAPI(formDataBirth.leaveEndDate) ?? null,
})
.then((res: any) => {
const data = res.data.result;