กลับไปใช้ปฏิทินก่อน
This commit is contained in:
parent
d5f0664894
commit
7aa4ae148b
4 changed files with 72 additions and 176 deletions
|
|
@ -33,13 +33,13 @@ const informaData = ref<any>({
|
|||
prefixId: null,
|
||||
firstname: null,
|
||||
lastname: null,
|
||||
birthDate: "",
|
||||
birthDate: null,
|
||||
genderId: null,
|
||||
bloodId: null,
|
||||
nationality: "ไทย",
|
||||
ethnicity: "ไทย",
|
||||
nationality: null,
|
||||
ethnicity: null,
|
||||
statusId: null,
|
||||
religionId: "ceaec498-71b4-4f82-b5a2-7d6ec988b753",
|
||||
religionId: null,
|
||||
tel: null,
|
||||
employeeType: null,
|
||||
employeeClass: null,
|
||||
|
|
@ -173,23 +173,23 @@ const calRetire = async (birth: Date) => {
|
|||
birthDate: dateToISO(birth),
|
||||
};
|
||||
if (dateToISO(dateBefore.value) != dateToISO(birth)) {
|
||||
// showLoader();
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.profileCalRetire, body)
|
||||
.then((res: any) => {
|
||||
const data = res.data.result;
|
||||
informaData.value.age = data.age;
|
||||
// informaData.value.birthDate = birth;
|
||||
informaData.value.birthDate = birth;
|
||||
changeRetireText(data.retireDate);
|
||||
dateBefore.value = birth;
|
||||
})
|
||||
// .catch((e: any) => {
|
||||
// messageError($q, e);
|
||||
// informaData.value.birthDate = null;
|
||||
// informaData.value.age = "";
|
||||
// })
|
||||
.catch((e: any) => {
|
||||
messageError($q, e);
|
||||
informaData.value.birthDate = null;
|
||||
informaData.value.age = "";
|
||||
})
|
||||
.finally(() => {
|
||||
// hideLoader();
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -321,7 +321,6 @@ const fetchPerson = async () => {
|
|||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-dialog v-model="modal">
|
||||
<q-card style="min-width: 60vw">
|
||||
|
|
@ -404,23 +403,7 @@ const fetchPerson = async () => {
|
|||
</div>
|
||||
<div class="row col-12 q-col-gutter-x-sm q-mb-xs">
|
||||
<div class="col-xs-6 col-sm-2 col-md-2">
|
||||
<!-- เปลี่ยนเป็นเลือกปฏิทิน -->
|
||||
<q-input
|
||||
v-model="informaData.birthDate"
|
||||
:rules="[(val: string) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี เกิด'}`]"
|
||||
:label="`${'วัน/เดือน/ปี เกิด'}`"
|
||||
type="date"
|
||||
hide-bottom-space
|
||||
outlined
|
||||
dense
|
||||
lazy-rules
|
||||
@update:model-value="
|
||||
(val:any) => {
|
||||
calRetire(new Date(val));
|
||||
}
|
||||
"
|
||||
/>
|
||||
<!-- <datepicker
|
||||
<datepicker
|
||||
v-model="informaData.birthDate"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
|
|
@ -435,7 +418,8 @@ const fetchPerson = async () => {
|
|||
<template #year-overlay-value="{ value }">
|
||||
{{ parseInt(value + 543) }}
|
||||
</template>
|
||||
<template #trigger><q-input
|
||||
<template #trigger>
|
||||
<q-input
|
||||
for="#birthDate"
|
||||
hide-bottom-space
|
||||
outlined
|
||||
|
|
@ -457,9 +441,9 @@ const fetchPerson = async () => {
|
|||
>
|
||||
</q-icon>
|
||||
</template>
|
||||
</q-input> -->
|
||||
<!-- </template>
|
||||
</datepicker> -->
|
||||
</q-input>
|
||||
</template>
|
||||
</datepicker>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-2 col-md-2">
|
||||
<q-input
|
||||
|
|
@ -594,6 +578,12 @@ const fetchPerson = async () => {
|
|||
:label="`${'เบอร์โทร'}`"
|
||||
mask="##########"
|
||||
/>
|
||||
<!-- :rules="[
|
||||
(val: string) => !!val || `${'กรุณากรอก เบอร์โทร'}`,
|
||||
(val: string) =>
|
||||
val.length >= 10 ||
|
||||
`${'กรุณากรอกเบอร์โทรให้ครบ'}`,
|
||||
]" -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -123,39 +123,7 @@
|
|||
</div>
|
||||
<div class="col-12 q-py-md"><q-separator /></div>
|
||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||
<!-- เปลี่ยนเป็นเลือกปฏิทิน -->
|
||||
<q-input
|
||||
v-if="edit"
|
||||
v-model="govermentData.containDate"
|
||||
:rules="[
|
||||
(val) =>
|
||||
!!val ||
|
||||
`${
|
||||
profileType == 'officer'
|
||||
? 'กรุณาเลือกวันที่บรรจุ'
|
||||
: 'กรุณาเลือกวันที่แต่งตั้ง'
|
||||
}`,
|
||||
]"
|
||||
:label="`${
|
||||
profileType == 'officer' ? 'วันที่บรรจุ' : 'วันที่แต่งตั้ง'
|
||||
}`"
|
||||
type="date"
|
||||
:class="getClass(edit)"
|
||||
hide-bottom-space
|
||||
:outlined="edit"
|
||||
dense
|
||||
lazy-rules
|
||||
stack-label
|
||||
:readonly="!edit"
|
||||
:borderless="!edit"
|
||||
@update:model-value="
|
||||
(val:any) => {
|
||||
handleDate(new Date(val));
|
||||
}
|
||||
"
|
||||
/>
|
||||
<datepicker
|
||||
v-else
|
||||
v-model="govermentData.containDate"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
|
|
@ -182,7 +150,7 @@
|
|||
:borderless="!edit"
|
||||
:model-value="
|
||||
govermentData.containDate !== null
|
||||
? date2Thai(new Date(govermentData.containDate))
|
||||
? date2Thai(govermentData.containDate)
|
||||
: null
|
||||
"
|
||||
:rules="[
|
||||
|
|
@ -213,37 +181,7 @@
|
|||
</datepicker>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-3 col-md-3">
|
||||
<!-- เปลี่ยนเป็นเลือกปฏิทิน -->
|
||||
<q-input
|
||||
v-if="edit"
|
||||
v-model="govermentData.workDate"
|
||||
:rules="[
|
||||
(val) =>
|
||||
!!val ||
|
||||
`${
|
||||
profileType == 'officer'
|
||||
? 'กรุณาเลือกเริ่มปฎิบัติราชการ'
|
||||
: 'กรุณาเลือกวันที่จ้างและแต่งตั้งมีผล'
|
||||
}`,
|
||||
]"
|
||||
:label="`${
|
||||
profileType == 'officer'
|
||||
? 'เริ่มปฎิบัติราชการ'
|
||||
: 'วันที่จ้างและแต่งตั้งมีผล'
|
||||
}`"
|
||||
type="date"
|
||||
:class="getClass(edit)"
|
||||
hide-bottom-space
|
||||
:outlined="edit"
|
||||
dense
|
||||
lazy-rules
|
||||
stack-label
|
||||
:readonly="!edit"
|
||||
:borderless="!edit"
|
||||
/>
|
||||
|
||||
<datepicker
|
||||
v-else
|
||||
v-model="govermentData.workDate"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
|
|
@ -269,7 +207,7 @@
|
|||
:borderless="!edit"
|
||||
:model-value="
|
||||
govermentData.workDate !== null
|
||||
? date2Thai(new Date(govermentData.workDate))
|
||||
? date2Thai(govermentData.workDate)
|
||||
: null
|
||||
"
|
||||
:rules="[
|
||||
|
|
@ -387,7 +325,7 @@
|
|||
"
|
||||
class="table_ellipsis"
|
||||
>
|
||||
{{ col.value }}
|
||||
{{ date2Thai(col.value) }}
|
||||
</div>
|
||||
<div v-else class="table_ellipsis">
|
||||
{{ col.value }}
|
||||
|
|
@ -409,10 +347,7 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
import HistoryTable from "@/components/TableHistory.vue";
|
||||
import type { RequestItemsHistoryObject } from "@/modules/04_registry/interface/request/Government";
|
||||
import type {
|
||||
ResponseObject,
|
||||
RowHistory,
|
||||
} from "@/modules/04_registry/interface/response/Government";
|
||||
import type { ResponseObject } from "@/modules/04_registry/interface/response/Government";
|
||||
import { useRoute } from "vue-router";
|
||||
import { useProfileDataStore } from "@/modules/04_registry/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
|
@ -445,7 +380,7 @@ const { birthDate, retireText } = storeToRefs(profileStore);
|
|||
const edit = ref<boolean>(false);
|
||||
const govermentData = ref<Goverment>(defaultGoverment);
|
||||
const myform = ref<any>();
|
||||
const rowsHistory = ref<RowHistory[]>([]); //select data history
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||
const tittleHistory = ref<string>("ประวัติแก้ไขข้อมูลราชการ"); //
|
||||
const filterHistory = ref<string>(""); //search data table history
|
||||
const modalHistory = ref<boolean>(false); //modal ประวัติการแก้ไขข้อมูล
|
||||
|
|
@ -698,8 +633,8 @@ const fetchData = async () => {
|
|||
govermentData.value.numberId = data.posNo;
|
||||
govermentData.value.positionExecutive = data.positionExecutive;
|
||||
govermentData.value.positionExecutiveSide = data.positionExecutiveSide;
|
||||
govermentData.value.containDate = dateToISO(new Date(data.dateAppoint));
|
||||
govermentData.value.workDate = dateToISO(new Date(data.dateStart));
|
||||
govermentData.value.containDate = data.dateAppoint;
|
||||
govermentData.value.workDate = data.dateStart;
|
||||
govermentData.value.retireDate = data.retireDate;
|
||||
govermentData.value.absent = data.govAgeAbsent;
|
||||
govermentData.value.age = data.govAgePlus;
|
||||
|
|
@ -724,8 +659,8 @@ const editData = async () => {
|
|||
showLoader();
|
||||
await http
|
||||
.put(config.API.profileGovId(route.params.id.toString()), {
|
||||
dateAppoint: dateToISO(new Date(govermentData.value.containDate)),
|
||||
dateStart: dateToISO(new Date(govermentData.value.workDate)),
|
||||
dateAppoint: dateToISO(govermentData.value.containDate),
|
||||
dateStart: dateToISO(govermentData.value.workDate),
|
||||
reasonSameDate: govermentData.value.reasonSameDate,
|
||||
})
|
||||
.then((res) => {
|
||||
|
|
@ -751,7 +686,7 @@ const saveData = async () => {
|
|||
};
|
||||
|
||||
const handleDate = async (modelData: Date) => {
|
||||
// govermentData.value.containDate = dateToISO(modelData);
|
||||
govermentData.value.containDate = modelData;
|
||||
await fetchCalAgeGov(modelData);
|
||||
};
|
||||
|
||||
|
|
@ -787,24 +722,24 @@ const clickHistory = async () => {
|
|||
rowsHistory.value = [];
|
||||
data.map((e: RequestItemsHistoryObject) => {
|
||||
rowsHistory.value.push({
|
||||
oc: e.oc ?? "-",
|
||||
position: e.position ?? "-",
|
||||
positionPathSide: e.positionPathSide ?? "-",
|
||||
posNo: e.posNo ?? "-",
|
||||
positionLine: e.positionLine ?? "-",
|
||||
positionType: e.positionType ?? "-",
|
||||
positionLevel: e.positionLevel ?? "-",
|
||||
positionExecutive: e.positionExecutive ?? "-",
|
||||
positionExecutiveSide: e.positionExecutiveSide ?? "-",
|
||||
dateAppoint: date2Thai(e.dateAppoint) ?? "-",
|
||||
dateStart: date2Thai(e.dateStart) ?? "-",
|
||||
retireDate: e.retireDate ?? "-",
|
||||
govAge: e.govAge ?? "-",
|
||||
govAgeAbsent: e.govAgeAbsent ?? "-",
|
||||
govAgePlus: e.govAgePlus ?? "-",
|
||||
reasonSameDate: e.reasonSameDate ?? "-",
|
||||
createdFullName: e.createdFullName ?? "-",
|
||||
createdAt: date2Thai(e.createdAt) ?? "-",
|
||||
oc: e.oc,
|
||||
position: e.position,
|
||||
positionPathSide: e.positionPathSide,
|
||||
posNo: e.posNo,
|
||||
positionLine: e.positionLine,
|
||||
positionType: e.positionType,
|
||||
positionLevel: e.positionLevel,
|
||||
positionExecutive: e.positionExecutive,
|
||||
positionExecutiveSide: e.positionExecutiveSide,
|
||||
dateAppoint: new Date(e.dateAppoint),
|
||||
dateStart: new Date(e.dateStart),
|
||||
retireDate: e.retireDate,
|
||||
govAge: e.govAge,
|
||||
govAgeAbsent: e.govAgeAbsent,
|
||||
govAgePlus: e.govAgePlus,
|
||||
reasonSameDate: e.reasonSameDate,
|
||||
createdFullName: e.createdFullName,
|
||||
createdAt: new Date(e.createdAt),
|
||||
});
|
||||
});
|
||||
})
|
||||
|
|
|
|||
|
|
@ -91,32 +91,7 @@
|
|||
/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-2 col-md-2">
|
||||
<!-- เปลี่ยนเป็นเลือกปฏิทิน -->
|
||||
<q-input
|
||||
v-if="edit"
|
||||
v-model="informaData.birthDate"
|
||||
:rules="[(val: string) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี เกิด'}`]"
|
||||
:label="`${'วัน/เดือน/ปี เกิด'}`"
|
||||
type="date"
|
||||
:class="getClass(edit)"
|
||||
hide-bottom-space
|
||||
:outlined="edit"
|
||||
dense
|
||||
lazy-rules
|
||||
stack-label
|
||||
:readonly="!edit"
|
||||
:borderless="!edit"
|
||||
:disabled="!edit"
|
||||
:max-date="new Date()"
|
||||
@update:model-value="
|
||||
(val:any) => {
|
||||
calRetire(new Date(val));
|
||||
}
|
||||
"
|
||||
/>
|
||||
|
||||
<datepicker
|
||||
v-else
|
||||
v-model="informaData.birthDate"
|
||||
:locale="'th'"
|
||||
autoApply
|
||||
|
|
@ -143,7 +118,7 @@
|
|||
:borderless="!edit"
|
||||
:model-value="
|
||||
informaData.birthDate !== null
|
||||
? date2Thai(new Date(informaData.birthDate))
|
||||
? date2Thai(informaData.birthDate)
|
||||
: null
|
||||
"
|
||||
:rules="[(val: string) => !!val || `${'กรุณาเลือก วัน/เดือน/ปี เกิด'}`]"
|
||||
|
|
@ -755,7 +730,7 @@ const defaultAdd = () => {
|
|||
prefixId: null,
|
||||
firstname: null,
|
||||
lastname: null,
|
||||
birthDate: "",
|
||||
birthDate: new Date(),
|
||||
genderId: null,
|
||||
bloodId: null,
|
||||
nationality: null,
|
||||
|
|
@ -1002,7 +977,7 @@ const filterSelector = (val: any, update: Function, refData: string) => {
|
|||
};
|
||||
|
||||
const handleDate = async (modelData: Date) => {
|
||||
informaData.value.birthDate = modelData.toDateString();
|
||||
informaData.value.birthDate = modelData;
|
||||
await calRetire(modelData);
|
||||
};
|
||||
|
||||
|
|
@ -1016,7 +991,7 @@ const calRetire = async (birth: Date) => {
|
|||
birthDate: dateToISO(birth),
|
||||
};
|
||||
if (dateToISO(dateBefore.value) != dateToISO(birth)) {
|
||||
// showLoader();
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.profileCalRetire, body)
|
||||
.then((res: any) => {
|
||||
|
|
@ -1025,14 +1000,14 @@ const calRetire = async (birth: Date) => {
|
|||
changeRetireText(data.retireDate);
|
||||
dateBefore.value = birth;
|
||||
})
|
||||
// .catch((e: any) => {
|
||||
// messageError($q, e);
|
||||
// const retire = new Date(`${birth.getFullYear() + 60}-09-30`);
|
||||
// informaData.value.birthDate = dateBefore.value.toDateString();
|
||||
// changeRetireText(date2Thai(retire));
|
||||
// })
|
||||
.catch((e: any) => {
|
||||
messageError($q, e);
|
||||
const retire = new Date(`${birth.getFullYear() + 60}-09-30`);
|
||||
informaData.value.birthDate = dateBefore.value;
|
||||
changeRetireText(date2Thai(retire));
|
||||
})
|
||||
.finally(() => {
|
||||
// hideLoader();
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -1053,7 +1028,7 @@ const fetchData = async () => {
|
|||
: "";
|
||||
informaData.value.firstname = data.firstName;
|
||||
informaData.value.lastname = data.lastName;
|
||||
informaData.value.birthDate = dateToISO(new Date(data.birthDate));
|
||||
informaData.value.birthDate = new Date(data.birthDate);
|
||||
informaData.value.genderId =
|
||||
data.genderId !== "00000000-0000-0000-0000-000000000000"
|
||||
? data.genderId
|
||||
|
|
@ -1110,7 +1085,7 @@ const editData = async () => {
|
|||
religionId: informaData.value.religionId,
|
||||
birthDate:
|
||||
informaData.value.birthDate != null
|
||||
? dateToISO(new Date(informaData.value.birthDate))
|
||||
? dateToISO(informaData.value.birthDate)
|
||||
: dateToISO(new Date()),
|
||||
bloodGroupId: informaData.value.bloodId,
|
||||
relationshipId: informaData.value.statusId,
|
||||
|
|
@ -1135,11 +1110,7 @@ const editData = async () => {
|
|||
edit.value = false;
|
||||
emit("update:statusEdit", false);
|
||||
await fetchData();
|
||||
await changeBirth(
|
||||
informaData.value.birthDate
|
||||
? new Date(informaData.value.birthDate)
|
||||
: new Date()
|
||||
);
|
||||
await changeBirth(informaData.value.birthDate ?? new Date());
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ interface Information {
|
|||
prefixId: string | null;
|
||||
firstname: string | null;
|
||||
lastname: string | null;
|
||||
birthDate: string | null;
|
||||
birthDate: Date | null;
|
||||
genderId: string | null;
|
||||
bloodId: string | null;
|
||||
nationality: string | null;
|
||||
|
|
@ -78,8 +78,8 @@ interface Goverment {
|
|||
numberId: string | null;
|
||||
positionExecutive: string | null;
|
||||
positionExecutiveSide: string | null;
|
||||
containDate: string;
|
||||
workDate: string;
|
||||
containDate: Date;
|
||||
workDate: Date;
|
||||
retireDate: string | null;
|
||||
absent: number | null;
|
||||
age: number | null;
|
||||
|
|
@ -118,8 +118,8 @@ const defaultGoverment: Goverment = {
|
|||
numberId: null,
|
||||
positionExecutive: null,
|
||||
positionExecutiveSide: null,
|
||||
containDate: "",
|
||||
workDate: "",
|
||||
containDate: new Date(),
|
||||
workDate: new Date(),
|
||||
retireDate: null,
|
||||
absent: 0,
|
||||
age: 0,
|
||||
|
|
@ -217,5 +217,5 @@ export type {
|
|||
DataOption,
|
||||
zipCodeOption,
|
||||
DataOptioninfo,
|
||||
docList,
|
||||
docList
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue