Merge pull request #1488 from Frappet/fix/formatDate

fix:convertDateToAPI
This commit is contained in:
Warunee Tamkoo 2025-10-21 21:22:44 +07:00 committed by GitHub
commit 8f53521403
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 42 additions and 13 deletions

View file

@ -133,6 +133,20 @@ interface Position2 {
positionExecutiveField: string; // ด้านทางการบริหาร positionExecutiveField: string; // ด้านทางการบริหาร
positionArea: string; // ด้าน/สาขา positionArea: string; // ด้าน/สาขา
positionIsSelected: string; // เป็นตำแหน่งที่ถูกเลือกในรอบนั้นๆ หรือไม่? positionIsSelected: string; // เป็นตำแหน่งที่ถูกเลือกในรอบนั้นๆ หรือไม่?
orgShortname: string; // อักษรย่อตำแหน่ง
posMasterNoPrefix: string; // Prefix นำหน้าเลขที่ตำแหน่ง เป็น Optional (ไม่ใช่อักษรย่อของหน่วยงาน/ส่วนราชการ)
posMasterNo: number | string; // เลขที่ตำแหน่ง เป็นตัวเลข
posMasterNoSuffix: string | null; // Suffix หลังเลขที่ตำแหน่ง เช่น ช.
fullNameCurrentHolder: string | null;
fullNameNextHolder: string | null;
positions: Position[]; // ตำแหน่ง
isSit: boolean;
profilePosition: string;
profilePostype: string;
profilePoslevel: string;
conditionReason: string;
isCondition: boolean;
isDirector: boolean;
} }
interface PosMaster2 { interface PosMaster2 {
@ -162,7 +176,7 @@ interface PosMaster2 {
current_holderId?: string; current_holderId?: string;
next_holderId?: string; next_holderId?: string;
isSit?: boolean; isSit?: boolean;
ancestorDNA: string; ancestorDNA?: string;
} }
interface HistoryPos { interface HistoryPos {

View file

@ -9,6 +9,7 @@ import type {
DataActive, DataActive,
SumPosition, SumPosition,
PosMaster, PosMaster,
PosMaster2,
} from "@/modules/02_organization/interface/response/organizational"; } from "@/modules/02_organization/interface/response/organizational";
export const useOrganizational = defineStore("organizationalStore", () => { export const useOrganizational = defineStore("organizationalStore", () => {
@ -88,7 +89,7 @@ export const useOrganizational = defineStore("organizationalStore", () => {
* @returns * @returns
*/ */
function fetchPosMaster(data: PosMaster[]) { function fetchPosMaster(data: PosMaster[]) {
const newPosMaster = data.map((e: PosMaster) => ({ const newPosMaster: PosMaster2[] = data.map((e: PosMaster) => ({
...e, ...e,
positionIsSelected: positionIsSelected:
typeOrganizational.value === "draft" && e.fullNameNextHolder !== null typeOrganizational.value === "draft" && e.fullNameNextHolder !== null
@ -109,7 +110,7 @@ export const useOrganizational = defineStore("organizationalStore", () => {
isSit: e.isSit, isSit: e.isSit,
})); }));
return newPosMaster; return newPosMaster || [];
} }
/** /**

View file

@ -20,7 +20,7 @@ const $q = useQuasar();
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { messageError, success, showLoader, hideLoader, onSearchDataTable } = const { messageError, success, showLoader, hideLoader, onSearchDataTable,convertDateToAPI } =
mixin; mixin;
const initialPagination = ref<Pagination>({ const initialPagination = ref<Pagination>({
@ -370,7 +370,7 @@ function onSubmitCandidates(date: Date) {
showLoader(); showLoader();
await http await http
.post(config.API.periodRecruitToPlacement(importId.value), { .post(config.API.periodRecruitToPlacement(importId.value), {
accountStartDate: date, accountStartDate: convertDateToAPI(date),
}) })
.then(() => { .then(() => {
success($q, "นำผู้ผ่านสอบแข่งขันเข้าสู่ระบบบรรจุ"); success($q, "นำผู้ผ่านสอบแข่งขันเข้าสู่ระบบบรรจุ");

View file

@ -20,8 +20,14 @@ const $q = useQuasar();
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { messageError, success, showLoader, hideLoader, onSearchDataTable } = const {
mixin; messageError,
success,
showLoader,
hideLoader,
onSearchDataTable,
convertDateToAPI,
} = mixin;
const year = ref<string>("2566"); const year = ref<string>("2566");
const round = ref<string>("1"); const round = ref<string>("1");
@ -341,7 +347,7 @@ async function onSubmitCandidates(date: Date) {
showLoader(); showLoader();
await http await http
.post(config.API.periodDisableToPlacement(importId.value), { .post(config.API.periodDisableToPlacement(importId.value), {
accountStartDate: date, accountStartDate: convertDateToAPI(date),
}) })
.then(() => { .then(() => {
success($q, "นำผู้ผ่านคัดเลือกคนพิการเข้าสู่ระบบบรรจุ"); success($q, "นำผู้ผ่านคัดเลือกคนพิการเข้าสู่ระบบบรรจุ");

View file

@ -95,7 +95,7 @@ function onSubmit() {
positionNumberOld: positionNumberOld.value, positionNumberOld: positionNumberOld.value,
amountOld: salary.value, amountOld: salary.value,
organization: organization.value, organization: organization.value,
date: date.value, date: convertDateToAPI(date.value),
dateRepatriation: convertDateToAPI(dateRepatriation.value), dateRepatriation: convertDateToAPI(dateRepatriation.value),
reason: reason.value, reason: reason.value,
}; };

View file

@ -27,6 +27,7 @@ const {
success, success,
dialogConfirm, dialogConfirm,
onSearchDataTable, onSearchDataTable,
convertDateToAPI
} = mixin; } = mixin;
/** คอลัมน์ */ /** คอลัมน์ */
@ -206,7 +207,7 @@ async function saveAppoint() {
if (result) { if (result) {
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
const body = { const body = {
appointDate: dateBreak.value, appointDate: convertDateToAPI(dateBreak.value),
}; };
showLoader(); showLoader();
await http await http

View file

@ -27,6 +27,7 @@ const {
hideLoader, hideLoader,
date2Thai, date2Thai,
calculateDurationYmd, calculateDurationYmd,
convertDateToAPI,
} = useCounterMixin(); } = useCounterMixin();
/** /**
@ -77,7 +78,12 @@ function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, () => {
showLoader(); showLoader();
http http
.post(config.API.devUploadUser + projectId.value, formData) .post(config.API.devUploadUser + projectId.value, {
...formData,
dateStart: convertDateToAPI(formData.dateStart),
dateEnd: convertDateToAPI(formData.dateEnd),
commandDate: convertDateToAPI(formData.commandDate),
})
.then(async (res) => { .then(async (res) => {
await props?.fetchData(); await props?.fetchData();
tab.value = res.data.result ? "IN" : "OUT"; tab.value = res.data.result ? "IN" : "OUT";

View file

@ -21,6 +21,7 @@ const {
messageError, messageError,
dialogConfirm, dialogConfirm,
success, success,
convertDateToAPI,
} = mixin; } = mixin;
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
@ -61,8 +62,8 @@ function onSubmit() {
.put(config.API.devScholarship + `/admin/detail/${id.value}`, { .put(config.API.devScholarship + `/admin/detail/${id.value}`, {
bookNumber: bookNumber.value, bookNumber: bookNumber.value,
bookDate: bookDate.value, bookDate: bookDate.value,
governmentDate: governmentDate.value, governmentDate: convertDateToAPI(governmentDate.value),
governmentEndDate: governmentEndDate.value, governmentEndDate: convertDateToAPI(governmentEndDate.value),
isGraduated: isGraduated.value, isGraduated: isGraduated.value,
graduatedDate: graduatedDate:
isGraduated.value == "true" ? graduatedDate.value : null, isGraduated.value == "true" ? graduatedDate.value : null,