Merge branch 'develop' into devTee

# Conflicts:
#	src/api/registry/api.registry.ts
This commit is contained in:
setthawutttty 2024-03-25 14:11:36 +07:00
commit 28fb5ebb9a
20 changed files with 731 additions and 764 deletions

View file

@ -1,11 +1,25 @@
import env from "../index"; import env from "../index";
const registryNew = `${env.API_URI}/org/profile/`; const registryNew = `${env.API_URI}/org/profile/`;
const metadata = `${env.API_URI}/org/metadata/`;
export default { export default {
registryNew, registryNew,
registryNewByProfileId: (profileId: string) => `${registryNew}${profileId}`, registryNewByProfileId: (profileId: string) => `${registryNew}${profileId}`,
// metadata
profileNewGender: `${metadata}gender`,
profileNewReligion: `${metadata}religion`,
profileNewRelationship: `${metadata}relationship`,
profileNewBloodGroup: `${metadata}bloodGroup`,
// ประวัติส่วนตัว
profileNewProfileByProfileId: (profileId: string) =>
`${registryNew}${profileId}`,
profileNewProfileById: (dataId: string) => `${registryNew}${dataId}`,
profileNewProfileHisById: (dataId: string) =>
`${registryNew}history/${dataId}`,
// บันทึกวันที่ไม่ได้รับเงินเดือนฯ // บันทึกวันที่ไม่ได้รับเงินเดือนฯ
profileNewNoPaid: `${registryNew}nopaid`, profileNewNoPaid: `${registryNew}nopaid`,
profileNewNoPaidByProfileId: (profileId: string) => profileNewNoPaidByProfileId: (profileId: string) =>
@ -83,23 +97,23 @@ export default {
profileNewOtherHisById: (dataId: string) => profileNewOtherHisById: (dataId: string) =>
`${registryNew}other/history/${dataId}`, `${registryNew}other/history/${dataId}`,
// ข้อมูลครอบครัว // ข้อมูลครอบครัว
profileNewFamily: `${registryNew}family`, profileNewFamily: `${registryNew}family`,
profileNewFamilyByProfileId: (profileId: string) => profileNewFamilyByProfileId: (profileId: string) =>
`${registryNew}family/${profileId}`, `${registryNew}family/${profileId}`,
profileNewFamilyByFamilyId: (familyId: string) => profileNewFamilyByFamilyId: (familyId: string) =>
`${registryNew}family/${familyId}`, `${registryNew}family/${familyId}`,
profileNewFamilyeHisByFamilyId: (familyId: string) => profileNewFamilyeHisByFamilyId: (familyId: string) =>
`${registryNew}family/history/${familyId}`, `${registryNew}family/history/${familyId}`,
// วินัย // วินัย
profileNewDiscipline: `${registryNew}discipline`, profileNewDiscipline: `${registryNew}discipline`,
profileNewDisciplineByProfileId: (profileId: string) => profileNewDisciplineByProfileId: (profileId: string) =>
`${registryNew}discipline/${profileId}`, `${registryNew}discipline/${profileId}`,
profileNewDisciplineByDisciplineId: (disciplineId: string) => profileNewDisciplineByDisciplineId: (disciplineId: string) =>
`${registryNew}discipline/${disciplineId}`, `${registryNew}discipline/${disciplineId}`,
profileNewDisciplineHisByDisciplineId: (disciplineId: string) => profileNewDisciplineHisByDisciplineId: (disciplineId: string) =>
`${registryNew}discipline/history/${disciplineId}`, `${registryNew}discipline/history/${disciplineId}`,
// ปฏิบัติราชการพิเศษ // ปฏิบัติราชการพิเศษ
profileNewDuty: `${registryNew}duty`, profileNewDuty: `${registryNew}duty`,
@ -122,4 +136,9 @@ profileNewLeaveById:(id:string)=>`${registryNew}leave/${id}`,
profileNewLeaveHistory:(id:string)=>`${registryNew}leave/history/${id}`, profileNewLeaveHistory:(id:string)=>`${registryNew}leave/history/${id}`,
profileCheckDate:()=>`${env.API_URI}/leave/user/check`, profileCheckDate:()=>`${env.API_URI}/leave/user/check`,
profileNewLeaveType:()=>`${env.API_URI}/leave/type`, profileNewLeaveType:()=>`${env.API_URI}/leave/type`,
/** ตำแหน่งเงินเดือน*/
profileSalaryNew: `${env.API_URI}/org/profileSalary`,
profileSalaryNewById: (id: string) =>
`${env.API_URI}/org/profileSalary/${id}`,
}; };

View file

@ -588,7 +588,7 @@ const OpsFilter = ref<InsigniaOps>({
insigniaOptions: [], insigniaOptions: [],
}); });
const note = ref<string>(); const note = ref<string | null>();
const insigniaType = ref<string>(); const insigniaType = ref<string>();
const year = ref<number | null>(0); const year = ref<number | null>(0);
const no = ref<string>(); const no = ref<string>();
@ -1356,7 +1356,7 @@ const selectData = async (props: DataProps) => {
refCommandDateInput.value = props.row.refCommandDate refCommandDateInput.value = props.row.refCommandDate
? convertDateDisplay(props.row.refCommandDate as Date) ? convertDateDisplay(props.row.refCommandDate as Date)
: ""; : "";
note.value = props.row.note; note.value = props?.row?.note;
await checkRowPage(); await checkRowPage();
}; };
@ -1451,6 +1451,7 @@ const clickHistory = async (row: RequestItemsObject) => {
e.refCommandDate == null ? null : new Date(e.refCommandDate), e.refCommandDate == null ? null : new Date(e.refCommandDate),
createdFullName: e.createdFullName, createdFullName: e.createdFullName,
createdAt: new Date(e.createdAt), createdAt: new Date(e.createdAt),
note: e.note,
}); });
}); });
}) })

View file

@ -17,11 +17,12 @@ interface RequestItemsObject {
section: string; section: string;
page: string; page: string;
receiveDate: Date; receiveDate: Date;
dateAnnounce: Date|string|null; dateAnnounce: Date | string | null;
refCommandNo: string; refCommandNo: string;
refCommandDate: Date | null|string; refCommandDate: Date | null | string;
createdFullName: string; createdFullName: string;
createdAt: Date; createdAt: Date;
note: string | null;
} }
//columns //columns

View file

@ -17,6 +17,7 @@ interface ResponseObject {
refCommandDate: Date | null; refCommandDate: Date | null;
createdFullName: string; createdFullName: string;
createdAt: Date; createdAt: Date;
note: string;
} }
export type { ResponseObject }; export type { ResponseObject };

View file

@ -74,7 +74,7 @@ const columns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "สายงาน", label: "สายงาน",
sortable: true, sortable: true,
field: (v) => v.posType.posTypeName, field: (v) => (v.posType ? v.posType.posTypeName : "-"),
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
@ -85,7 +85,7 @@ const columns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "ระดับชั้นงาน", label: "ระดับชั้นงาน",
sortable: true, sortable: true,
field: (v) => v.posLevel.posLevelName, field: (v) => (v.posLevel ? v.posLevel.posLevelName : "-"),
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>

View file

@ -10,7 +10,6 @@ import { useCounterMixin } from "@/stores/mixin";
import HistoryTable from "@/components/TableHistory.vue"; import HistoryTable from "@/components/TableHistory.vue";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import type { RequestItemsObject } from "@/modules/04_registryNew/interface/request/DeclarationHonor"; import type { RequestItemsObject } from "@/modules/04_registryNew/interface/request/DeclarationHonor";
import type { FormData } from "@/modules/04_registryNew/interface/request/DeclarationHonor";
import type { ResponseObject } from "@/modules/04_registryNew/interface/response/DeclarationHonor"; import type { ResponseObject } from "@/modules/04_registryNew/interface/response/DeclarationHonor";
const $q = useQuasar(); const $q = useQuasar();
@ -29,20 +28,18 @@ const profileId = ref<string>(
route.params.id ? route.params.id.toString() : "" route.params.id ? route.params.id.toString() : ""
); );
const declHonorData = reactive<FormData>({ const id = ref<string>("");
id: "", const issueDateYear = ref<number>(0);
isActive: true, const declHonorForm = reactive<RequestItemsObject>({
isDate: "false", isDate: "false",
issuer: "", issuer: "",
detail: "", detail: "",
issueDate: null, issueDate: null,
issueDateYear: 0,
refCommandNo: "", refCommandNo: "",
refCommandDate: null, refCommandDate: null,
}); });
const isEdit = ref<boolean>(false); const isEdit = ref<boolean>(false);
const editRow = ref<boolean>(false);
const myForm = ref<QForm>(); const myForm = ref<QForm>();
const modal = ref<boolean>(false); const modal = ref<boolean>(false);
const modelView = ref<string>("table"); const modelView = ref<string>("table");
@ -234,21 +231,17 @@ async function addEditData(editStatus: boolean = false) {
if (!profileId.value) return; if (!profileId.value) return;
const url = editStatus const url = editStatus
? config.API.profileNewHonorById(declHonorData.id) ? config.API.profileNewHonorById(id.value)
: config.API.profileNewHonor; : config.API.profileNewHonor;
const method = editStatus ? "patch" : "post"; const method = editStatus ? "patch" : "post";
const reqBody: RequestItemsObject = { const reqBody: RequestItemsObject = {
...declHonorForm,
profileId: editStatus ? undefined : profileId.value, profileId: editStatus ? undefined : profileId.value,
isActive: declHonorData.isActive, isDate: declHonorForm.isDate === "true" ? true : false,
detail: declHonorData.detail,
issueDate: issueDate:
declHonorData.isDate === "true" declHonorForm.isDate === true
? declHonorData.issueDate ? declHonorForm.issueDate
: new Date(`${declHonorData.issueDateYear}-01-01`), : new Date(`${issueDateYear.value}-01-01`),
issuer: declHonorData.issuer,
refCommandDate: declHonorData.refCommandDate,
refCommandNo: declHonorData.refCommandNo,
isDate: declHonorData.isDate === "true" ? true : false,
}; };
try { try {
@ -262,57 +255,41 @@ async function addEditData(editStatus: boolean = false) {
} }
} }
async function clickDelete(dataId: string) { // async function clickDelete(dataId: string) {
try { // try {
await http.delete(config.API.profileNewHonorById(dataId)); // await http.delete(config.API.profileNewHonorById(dataId));
success($q, "ลบข้อมูลสำเร็จ"); // success($q, "");
await fetchData(); // await fetchData();
modal.value = false; // modal.value = false;
} catch (error) { // } catch (error) {
messageError($q, error); // messageError($q, error);
} finally { // } finally {
hideLoader(); // hideLoader();
} // }
} // }
function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) { function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
modal.value = true; modal.value = true;
editRow.value = false;
isEdit.value = editStatus; isEdit.value = editStatus;
if (editStatus && row) { if (editStatus && row) {
Object.assign(declHonorData, row); id.value = row.id;
declHonorData.isDate = row.isDate.toString();
declHonorData.issueDate = row.issueDate; issueDateYear.value = new Date(row.issueDate).getFullYear();
declHonorData.issueDateYear = new Date(row.issueDate).getFullYear(); declHonorForm.issuer = row.issuer;
declHonorData.refCommandDate = row.refCommandDate; declHonorForm.detail = row.detail;
declHonorForm.issueDate = row.issueDate;
declHonorForm.refCommandNo = row.refCommandNo;
declHonorForm.refCommandDate = row.refCommandDate;
declHonorForm.isDate = row.isDate ? "true" : "false";
} else { } else {
declHonorData.id = ""; clearData();
declHonorData.isActive = true;
declHonorData.issuer = "";
declHonorData.detail = "";
declHonorData.issueDate = null;
declHonorData.issueDateYear = 0;
declHonorData.refCommandNo = "";
declHonorData.refCommandDate = null;
declHonorData.isDate = "false";
} }
} }
async function clickClose() { async function clickClose() {
if (editRow.value == true) { clearData();
dialogConfirm( modal.value = false;
$q,
async () => {
modal.value = false;
editRow.value = false;
},
"ข้อมูลมีการแก้ไข",
"ยืนยันที่จะปิดโดยไม่บันทึกใช่หรือไม่?"
);
} else {
modal.value = false;
}
} }
async function clickHistory(row: ResponseObject) { async function clickHistory(row: ResponseObject) {
@ -334,30 +311,37 @@ function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
myForm.value?.validate().then(async (result: boolean) => { addEditData(isEdit.value);
if (result) { modal.value = false;
addEditData(isEdit.value);
modal.value = false;
}
});
}, },
"ยืนยันการบันทึกข้อมูล", "ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
); );
} }
function clearData() {
id.value = "";
issueDateYear.value = 0;
declHonorForm.issuer = "";
declHonorForm.detail = "";
declHonorForm.issueDate = null;
declHonorForm.refCommandNo = "";
declHonorForm.refCommandDate = null;
declHonorForm.isDate = "false";
}
onMounted(async () => { onMounted(async () => {
await fetchData(); await fetchData();
}); });
watch( watch(
() => declHonorData.isDate, () => declHonorForm.isDate,
() => { () => {
if (declHonorData.isDate === "true") { if (declHonorForm.isDate === "true") {
declHonorData.issueDateYear = 0; issueDateYear.value = 0;
} }
if (declHonorData.isDate === "false") { if (declHonorForm.isDate === "false") {
declHonorData.issueDate = null; declHonorForm.issueDate = null;
} }
} }
); );
@ -557,14 +541,14 @@ watch(
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card style="width: 600px"> <q-card style="width: 600px">
<q-form greedy ref="myForm" @submit="onSubmit"> <q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader tittle="ประกาศเกียรติคุณ" :close="clickClose" /> <DialogHeader tittle="ประกาศเกียรติคุณ" :close="clickClose" />
<q-separator /> <q-separator />
<q-card-section class="q-p-sm"> <q-card-section class="q-p-sm">
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs"> <div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="row col-12 q-gutter-md q-py-sm text-grey-7"> <div class="row col-12 q-gutter-md q-py-sm text-grey-7">
<q-radio <q-radio
v-model="declHonorData.isDate" v-model="declHonorForm.isDate as string"
checked-icon="task_alt" checked-icon="task_alt"
unchecked-icon="panorama_fish_eye" unchecked-icon="panorama_fish_eye"
val="false" val="false"
@ -572,7 +556,7 @@ watch(
dense dense
/> />
<q-radio <q-radio
v-model="declHonorData.isDate" v-model="declHonorForm.isDate as string"
checked-icon="task_alt" checked-icon="task_alt"
unchecked-icon="panorama_fish_eye" unchecked-icon="panorama_fish_eye"
val="true" val="true"
@ -584,12 +568,12 @@ watch(
<datepicker <datepicker
autoApply autoApply
year-picker year-picker
v-model="declHonorData.issueDateYear" v-model="issueDateYear"
week-start="0" week-start="0"
menu-class-name="modalfix" menu-class-name="modalfix"
:locale="'th'" :locale="'th'"
:enableTimePicker="false" :enableTimePicker="false"
v-if="declHonorData.isDate === 'false'" v-if="declHonorForm.isDate === 'false'"
> >
<template #year="{ year }">{{ year + 543 }}</template> <template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{ <template #year-overlay-value="{ value }">{{
@ -599,21 +583,15 @@ watch(
<q-input <q-input
dense dense
outlined outlined
lazy-rules
hide-bottom-space hide-bottom-space
class="inputgreen" class="inputgreen"
:model-value=" :model-value="issueDateYear ? issueDateYear + 543 : null"
declHonorData.issueDateYear
? declHonorData.issueDateYear + 543
: null
"
:rules="[ :rules="[
(val:string) => (val:string) =>
!!val || !!val ||
`${'กรุณาเลือกปีที่ได้รับ'}`, `${'กรุณาเลือกปีที่ได้รับ'}`,
]" ]"
:label="`${'ปีที่ได้รับ'}`" :label="`${'ปีที่ได้รับ'}`"
@update:modelValue="() => (editRow = true)"
> >
<template v-slot:prepend> <template v-slot:prepend>
<q-icon <q-icon
@ -630,7 +608,7 @@ watch(
borderless borderless
week-start="0" week-start="0"
menu-class-name="modalfix" menu-class-name="modalfix"
v-model="declHonorData.issueDate" v-model="declHonorForm.issueDate"
:locale="'th'" :locale="'th'"
:enableTimePicker="false" :enableTimePicker="false"
v-else v-else
@ -649,10 +627,9 @@ watch(
for="inputDatereceive" for="inputDatereceive"
ref="dateReceivedRef" ref="dateReceivedRef"
class="inputgreen" class="inputgreen"
:model-value="date2Thai(declHonorData.issueDate as Date)" :model-value="date2Thai(declHonorForm.issueDate as Date)"
:label="`${'วันที่ได้รับ'}`" :label="`${'วันที่ได้รับ'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่ได้รับ'}`]" :rules="[(val) => !!val || `${'กรุณาเลือกวันที่ได้รับ'}`]"
@update:modelValue="() => (editRow = true)"
> >
<template v-slot:prepend> <template v-slot:prepend>
<q-icon <q-icon
@ -672,9 +649,8 @@ watch(
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
class="inputgreen" class="inputgreen"
v-model="declHonorData.issuer" v-model="declHonorForm.issuer"
:label="`${'ผู้มีอำนาจลงนาม'}`" :label="`${'ผู้มีอำนาจลงนาม'}`"
@update:modelValue="() => (editRow = true)"
/> />
</div> </div>
<div class="col-12"> <div class="col-12">
@ -684,10 +660,9 @@ watch(
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
class="inputgreen" class="inputgreen"
v-model="declHonorData.detail" v-model="declHonorForm.detail"
:label="`${'รายละเอียด'}`" :label="`${'รายละเอียด'}`"
:rules="[(val) => !!val || `${'กรุณากรอกรายละเอียด'}`]" :rules="[(val) => !!val || `${'กรุณากรอกรายละเอียด'}`]"
@update:modelValue="() => (editRow = true)"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
@ -697,9 +672,8 @@ watch(
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
class="inputgreen" class="inputgreen"
v-model="declHonorData.refCommandNo" v-model="declHonorForm.refCommandNo"
:label="`${'เลขที่คำสั่ง'}`" :label="`${'เลขที่คำสั่ง'}`"
@update:modelValue="() => (editRow = true)"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="mdi-file" class="cursor-pointer" /> <q-icon name="mdi-file" class="cursor-pointer" />
@ -712,7 +686,7 @@ watch(
borderless borderless
week-start="0" week-start="0"
menu-class-name="modalfix" menu-class-name="modalfix"
v-model="declHonorData.refCommandDate" v-model="declHonorForm.refCommandDate"
:locale="'th'" :locale="'th'"
:enableTimePicker="false" :enableTimePicker="false"
> >
@ -730,13 +704,12 @@ watch(
hide-bottom-space hide-bottom-space
class="inputgreen" class="inputgreen"
:model-value=" :model-value="
declHonorData.refCommandDate == null declHonorForm.refCommandDate == null
? null ? null
: date2Thai(declHonorData.refCommandDate) : date2Thai(declHonorForm.refCommandDate)
" "
:label="`${'เอกสารอ้างอิง (ลงวันที่)'}`" :label="`${'เอกสารอ้างอิง (ลงวันที่)'}`"
@clear="declHonorData.refCommandDate = null" @clear="declHonorForm.refCommandDate = null"
@update:modelValue="() => (editRow = true)"
> >
<template v-slot:prepend> <template v-slot:prepend>
<q-icon <q-icon

View file

@ -365,12 +365,8 @@ function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
myForm.value?.validate().then(async (result: boolean) => { addEditData(isEdit.value);
if (result) { modal.value = false;
addEditData(isEdit.value);
modal.value = false;
}
});
}, },
"ยืนยันการบันทึกข้อมูล", "ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
@ -587,7 +583,7 @@ onMounted(async () => {
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card style="width: 600px"> <q-card style="width: 600px">
<q-form greedy ref="myForm" @submit="onSubmit"> <q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader <DialogHeader
tittle="ผลการประเมินการปฏิบัติราชการ" tittle="ผลการประเมินการปฏิบัติราชการ"
:close="clickClose" :close="clickClose"

View file

@ -127,22 +127,10 @@ function validateForm() {
dialogConfirm( dialogConfirm(
$q, $q,
async () => { async () => {
const hasError = []; if (edit.value) {
for (const key in objectRef) { editData();
if (Object.prototype.hasOwnProperty.call(objectRef, key)) { } else {
const property = objectRef[key]; saveData();
if (property.value && typeof property.value.validate === "function") {
const isValid = property.value.validate();
hasError.push(isValid);
}
}
}
if (hasError.every((result) => result === true)) {
if (edit.value) {
editData();
} else {
saveData();
}
} }
}, },
"ยืนยันการบันทึกข้อมูล", "ยืนยันการบันทึกข้อมูล",
@ -228,12 +216,6 @@ async function getData() {
// }); // });
// } // }
const infoRows = [
{ title: "รายละเอียด", value: "" },
{ title: "ล้างมลทิน", value: "" },
{ title: "เลขที่คำสั่ง", value: "" },
{ title: "เอกสารอ้างอิง (ลงวันที่)", value: "" },
];
onMounted(() => { onMounted(() => {
getData(); getData();
}); });
@ -467,7 +449,7 @@ onMounted(() => {
<!-- dialog add edit --> <!-- dialog add edit -->
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card style="min-width: 600px"> <q-card style="min-width: 600px">
<form @submit.prevent="validateForm"> <q-form greedy @submit.prevent @validation-success="validateForm">
<q-card-section class="flex justify-between" style="padding: 0"> <q-card-section class="flex justify-between" style="padding: 0">
<DialogHeader tittle="อื่นๆ" :close="closeDialog" /> <DialogHeader tittle="อื่นๆ" :close="closeDialog" />
</q-card-section> </q-card-section>
@ -541,7 +523,7 @@ onMounted(() => {
<q-tooltip>นทกขอม</q-tooltip> <q-tooltip>นทกขอม</q-tooltip>
</q-btn> </q-btn>
</q-card-actions> </q-card-actions>
</form> </q-form>
</q-card> </q-card>
</q-dialog> </q-dialog>

View file

@ -3,9 +3,7 @@ import { ref, watch, reactive } from "vue";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, type QTableProps } from "quasar"; import { useQuasar, type QTableProps } from "quasar";
import type { import type { RowList } from "@/modules/04_registryNew/interface/index/other";
RowList,
} from "@/modules/04_registryNew/interface/index/other";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
@ -93,7 +91,8 @@ const columns = ref<QTableProps["columns"]>([
]); ]);
function getHistory() { function getHistory() {
showLoader(); showLoader();
http.get(config.API.profileNewOtherHisById(id.value)) http
.get(config.API.profileNewOtherHisById(id.value))
.then((res) => { .then((res) => {
let data = res.data.result; let data = res.data.result;
rows.value = []; rows.value = [];
@ -201,23 +200,7 @@ watch(modal, (status) => {
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer"> <q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id"> <q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'"> <div>
{{
(formFilter.page - 1) * formFilter.pageSize +
props.rowIndex +
1
}}
</div>
<div
v-else-if="
col.name == 'refCommandDate' ||
col.name == 'date' ||
col.name == 'createdAt'
"
>
{{ col.value == null ? null : date2Thai(col.value) }}
</div>
<div v-else>
{{ col.value ? col.value : "-" }} {{ col.value ? col.value : "-" }}
</div> </div>
</q-td> </q-td>

View file

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, watch, ref } from "vue"; import { onMounted, watch, ref, reactive } from "vue";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import type { QTableColumn, QForm } from "quasar"; import type { QTableColumn, QForm } from "quasar";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -9,92 +10,59 @@ import { useCounterMixin } from "@/stores/mixin";
import { useProfileDataStore } from "@/modules/04_registryNew/stores/profile"; import { useProfileDataStore } from "@/modules/04_registryNew/stores/profile";
import HistoryTable from "@/components/TableHistory.vue"; import HistoryTable from "@/components/TableHistory.vue";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import type { import type { RequestObject } from "@/modules/04_registryNew/interface/request/Profile";
InformationOps, import type { ResponseObject } from "@/modules/04_registryNew/interface/response/Profile";
Information,
DataOption,
} from "@/modules/04_registryNew/interface/index/Main";
import { defaultInformation } from "@/modules/04_registryNew/interface/index/Main";
import type { RequestItemsHistoryObject } from "@/modules/04_registryNew/interface/request/Information";
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const profileStore = useProfileDataStore(); const store = useProfileDataStore();
const { const {
success,
showLoader, showLoader,
hideLoader, hideLoader,
date2Thai, date2Thai,
messageError, messageError,
convertDate, dialogConfirm,
dateToISO,
} = mixin; } = mixin;
const { changeRetireText, changeBirth } = profileStore; const { calculateAge, getGender, getRelationship, getReligion, getBloodGroup } =
store;
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const informaData = ref<Information>(defaultInformation);
const modal = ref<boolean>(false); const modal = ref<boolean>(false);
const myForm = ref<any>(); const informaData = ref<ResponseObject>();
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); const rowsHistory = ref<ResponseObject[]>([]);
const tittleHistory = ref<string>("ประวัติแก้ไขข้อมูลส่วนตัว"); const tittleHistory = ref<string>("ประวัติแก้ไขข้อมูลส่วนตัว");
const filterHistory = ref<string>(""); const filterHistory = ref<string>("");
const modalHistory = ref<boolean>(false); const modalHistory = ref<boolean>(false);
const Ops = ref<InformationOps>({ const id = ref<string>("");
prefixOps: [], const age = ref<string>("");
prefixOldOps: [], //
genderOps: [], const nationality = ref<string>("");
bloodOps: [], const formData = reactive<RequestObject>({
statusOps: [], citizenId: "",
religionOps: [], prefix: "",
employeeClassOps: [ firstName: "",
{ id: "perm", name: "ลูกจ้างประจำ" }, lastName: "",
{ id: "temp", name: "ลูกจ้างชั่วคราว" }, birthDate: null,
], genderId: "",
employeeTypeOps: [ relationshipId: "",
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" }, // nationality: "",
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" }, ethnicity: "",
], religionId: "",
}); bloodGroupId: "",
phone: "",
const OpsFilter = ref<InformationOps>({ posTypeId: "",
prefixOps: [], posLevelId: "",
prefixOldOps: [],
genderOps: [],
bloodOps: [],
statusOps: [],
religionOps: [],
employeeClassOps: [
{ id: "perm", name: "ลูกจ้างประจำ" },
{ id: "temp", name: "ลูกจ้างชั่วคราว" },
],
employeeTypeOps: [
{ id: "gov", name: "งบประมาณเงินอุดหนุนรัฐบาล" },
{ id: "bkk", name: "งบประมาณกรุงเทพมหานคร" },
],
});
// mock data
const resultData = ref({
citizenId: "3101502080439",
prefixId: "71ed89df-8257-43e8-8fba-0b42fb2c55e0",
prefix: "นางสาว",
firstName: "อรัญญาสาร",
lastName: "พรไชยะสิทธฺ์",
birthDate: new Date("1968-11-24T00:00:00"),
age: "55 ปี 3 เดือน 16 วัน",
genderId: "e2693577-6633-499b-9f0a-fec0bff0be6b",
gender: "หญิง",
relationshipId: null,
bloodGroupId: null,
nationality: "ไทย",
race: "ไทย",
religionId: "ceaec498-71b4-4f82-b5a2-7d6ec988b753",
telephoneNumber: null, telephoneNumber: null,
profileType: "officer", dateRetire: null,
employeeType: null, isProbation: false,
employeeClass: null, keycloak: "",
changeName: true, email: null,
isVerified: true, position: "",
isSendVerified: false,
}); });
const dataLabel = { const dataLabel = {
@ -105,10 +73,10 @@ const dataLabel = {
gender: "เพศ", gender: "เพศ",
relationship: "สถานภาพ", relationship: "สถานภาพ",
nationality: "สัญชาติ", nationality: "สัญชาติ",
race: "เชื้อชาติ", ethnicity: "เชื้อชาติ",
religion: "ศาสนา", religion: "ศาสนา",
bloodGroup: "หมู่เลือด", bloodGroup: "หมู่เลือด",
telephoneNumber: "เบอร์โทร", phone: "เบอร์โทร",
prefix: "คำนำหน้าชื่อ", prefix: "คำนำหน้าชื่อ",
firstName: "ชื่อ", firstName: "ชื่อ",
@ -168,6 +136,7 @@ const columnsHistory = ref<QTableColumn[]>([
field: "birthDate", field: "birthDate",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (v) => date2Thai(v),
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
@ -176,7 +145,7 @@ const columnsHistory = ref<QTableColumn[]>([
align: "left", align: "left",
label: "เพศ", label: "เพศ",
sortable: true, sortable: true,
field: "gender", field: (v) => (v.gender ? v.gender.name : "-"),
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
@ -187,7 +156,7 @@ const columnsHistory = ref<QTableColumn[]>([
align: "left", align: "left",
label: "สถานภาพ", label: "สถานภาพ",
sortable: true, sortable: true,
field: "relationship", field: (v) => (v.relationship ? v.relationship.name : "-"),
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
@ -198,7 +167,7 @@ const columnsHistory = ref<QTableColumn[]>([
align: "left", align: "left",
label: "หมู่เลือด", label: "หมู่เลือด",
sortable: true, sortable: true,
field: "bloodGroup", field: (v) => (v.bloodGroup ? v.bloodGroup.name : "-"),
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
@ -216,11 +185,11 @@ const columnsHistory = ref<QTableColumn[]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "race", name: "ethnicity",
align: "left", align: "left",
label: "เชื้อชาติ", label: "เชื้อชาติ",
sortable: true, sortable: true,
field: "race", field: "ethnicity",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
@ -231,40 +200,18 @@ const columnsHistory = ref<QTableColumn[]>([
align: "left", align: "left",
label: "ศาสนา", label: "ศาสนา",
sortable: true, sortable: true,
field: "religion", field: (v) => (v.religion ? v.religion.name : "-"),
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "telephoneNumber", name: "phone",
align: "left", align: "left",
label: "เบอร์โทร", label: "เบอร์โทร",
sortable: true, sortable: true,
field: "telephoneNumber", field: "phone",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "employeeType",
align: "left",
label: "ประเภทการจ้าง",
sortable: true,
field: "employeeType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "employeeClass",
align: "left",
label: "ประเภทลูกจ้าง",
sortable: true,
field: "employeeClass",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
sort: (a: string, b: string) => sort: (a: string, b: string) =>
@ -289,6 +236,7 @@ const columnsHistory = ref<QTableColumn[]>([
field: "createdAt", field: "createdAt",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (v) => date2Thai(v),
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
@ -304,255 +252,112 @@ const visibleColumnsHistory = ref<String[]>([
"relationship", "relationship",
"bloodGroup", "bloodGroup",
"nationality", "nationality",
"race", "ethnicity",
"religion", "religion",
"telephoneNumber", "phone",
"employeeType",
"employeeClass",
"createdFullName", "createdFullName",
"createdAt", "createdAt",
]); ]);
async function fetchData() { async function getData() {
informaData.value.cardid = resultData.value.citizenId; showLoader();
informaData.value.prefixId = resultData.value.prefixId;
informaData.value.prefix = resultData.value.prefix;
informaData.value.firstname = resultData.value.firstName;
informaData.value.lastname = resultData.value.lastName;
informaData.value.birthDate = resultData.value.birthDate;
informaData.value.age = resultData.value.age;
informaData.value.genderId = resultData.value.genderId;
informaData.value.bloodId = resultData.value.bloodGroupId;
informaData.value.nationality = resultData.value.nationality;
informaData.value.ethnicity = resultData.value.race;
informaData.value.statusId = resultData.value.relationshipId;
informaData.value.religionId = resultData.value.religionId;
informaData.value.tel = resultData.value.telephoneNumber;
informaData.value.employeeType = resultData.value.employeeType;
informaData.value.employeeClass = resultData.value.employeeClass;
informaData.value.profileType = resultData.value.profileType;
}
// get person detail list
async function fetchPerson() {
// showLoader();
await http await http
.get(config.API.person) .get(config.API.profileNewProfileByProfileId(profileId.value))
.then((res) => { .then((res) => {
const data = res.data.result; informaData.value = res.data.result;
let optionbloodGroups: DataOption[] = []; if (informaData.value) {
data.bloodGroups.map((r: any) => { id.value = informaData.value.id;
optionbloodGroups.push({ age.value = calculateAge(informaData.value.birthDate);
id: r.id.toString(), }
name: r.name.toString(), })
}); .catch((e) => {
}); messageError($q, e);
Ops.value.bloodOps = optionbloodGroups;
OpsFilter.value.bloodOps = optionbloodGroups;
let optiongenders: DataOption[] = [];
data.genders.map((r: any) => {
optiongenders.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
Ops.value.genderOps = optiongenders;
OpsFilter.value.genderOps = optiongenders;
let optionprefixs: DataOption[] = [];
data.prefixs.map((r: any) => {
optionprefixs.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
Ops.value.prefixOps = optionprefixs;
OpsFilter.value.prefixOps = optionprefixs;
let optionrelationships: DataOption[] = [];
data.relationships.map((r: any) => {
optionrelationships.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
Ops.value.statusOps = optionrelationships;
OpsFilter.value.statusOps = optionrelationships;
let optionreligions: DataOption[] = [];
data.religions.map((r: any) => {
optionreligions.push({
id: r.id.toString(),
name: r.name.toString(),
});
});
Ops.value.religionOps = optionreligions;
OpsFilter.value.religionOps = optionreligions;
}) })
.catch((e: any) => {})
.finally(() => { .finally(() => {
// hideLoader(); hideLoader();
}); });
} }
function filterSelector(val: any, update: Function, refData: string) { async function editData() {
switch (refData) { showLoader();
case "prefixOps": await http
update(() => { .put(config.API.profileNewProfileById(id.value), {
Ops.value.prefixOps = OpsFilter.value.prefixOps.filter( ...formData,
(v: DataOption) => v.name.indexOf(val) > -1 })
); .then((res) => {
}); success($q, "บันทึกข้อมูลสำเร็จ");
break; getData(), (modal.value = false);
case "genderOps": })
update(() => { .catch((e) => {
Ops.value.genderOps = OpsFilter.value.genderOps.filter( messageError($q, e);
(v: DataOption) => v.name.indexOf(val) > -1 })
); .finally(() => {
}); hideLoader();
break; });
case "bloodOps": }
update(() => {
Ops.value.bloodOps = OpsFilter.value.bloodOps.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "statusOps":
update(() => {
Ops.value.statusOps = OpsFilter.value.statusOps.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "religionOps":
update(() => {
Ops.value.religionOps = OpsFilter.value.religionOps.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "employeeClassOps":
update(() => {
Ops.value.employeeClassOps = OpsFilter.value.employeeClassOps.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
case "employeeTypeOps":
update(() => {
Ops.value.employeeTypeOps = OpsFilter.value.employeeTypeOps.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
default: function onClickOpenDialog() {
break; if (!informaData.value) return;
} modal.value = true;
id.value = informaData.value.id;
age.value = calculateAge(informaData.value.birthDate);
formData.citizenId = informaData.value.citizenId;
formData.prefix = informaData.value.prefix;
formData.firstName = informaData.value.firstName;
formData.lastName = informaData.value.lastName;
formData.birthDate = informaData.value.birthDate;
formData.genderId = informaData.value.genderId;
formData.relationshipId = informaData.value.relationshipId;
// formData.nationality = informaData.value.nationality;
formData.ethnicity = informaData.value.ethnicity;
formData.religionId = informaData.value.religionId;
formData.bloodGroupId = informaData.value.bloodGroupId;
formData.phone = informaData.value.phone;
}
function onSubmit() {
dialogConfirm(
$q,
async () => {
editData();
modal.value = false;
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
} }
async function clickHistory() { async function clickHistory() {
modalHistory.value = true; modalHistory.value = true;
// showLoader(); await http
// await http .get(config.API.profileNewProfileHisById(id.value))
// .get(config.API.profileInforHisId(route.params.id.toString())) .then((res) => {
// .then((res) => { rowsHistory.value = res.data.result;
// let data = res.data.result; })
// rowsHistory.value = []; .catch((e) => {
// data.map((e: RequestItemsHistoryObject) => { messageError($q, e);
// rowsHistory.value.push({ })
// citizenId: e.citizenId, .finally(() => {
// prefix: e.prefix, hideLoader();
// firstName: e.firstName, });
// lastName: e.lastName,
// birthDate: new Date(e.birthDate),
// gender: e.gender,
// relationship: e.relationship,
// bloodGroup: e.bloodGroup,
// nationality: e.nationality,
// race: e.race,
// religion: e.religion,
// telephoneNumber: e.telephoneNumber,
// employeeType:
// e.employeeType == "gov"
// ? ""
// : e.employeeType == "bkk"
// ? ""
// : "-",
// employeeClass:
// e.employeeClass == "perm"
// ? ""
// : e.employeeClass == "temp"
// ? ""
// : "-",
// createdFullName: e.createdFullName,
// createdAt: new Date(e.createdAt),
// });
// });
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
}
async function calRetire(birth: Date) {
const body = {
birthDate: dateToISO(birth),
};
const dateBefore = ref<Date>(new Date());
if (dateToISO(dateBefore.value) != dateToISO(birth)) {
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;
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;
// inputBirthDate.value = dateBefore.value;
changeRetireText(date2Thai(retire));
})
.finally(() => {
hideLoader();
});
}
}
function onSubmit() {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
// await saveData();
modal.value = false;
}
});
} }
watch( watch(
() => informaData.value.birthDate, () => formData.birthDate,
(value) => { (v) => {
// const dateVal = convertDate(value); if (v) {
if (value) { age.value = calculateAge(v);
calRetire(value);
} else {
informaData.value.age = "";
} }
} }
); );
onMounted(async () => { onMounted(async () => {
await fetchPerson(); await getData();
await fetchData(); store.genderOp.length === 0 ? await getGender() : "";
store.relationshipOp.length === 0 ? await getRelationship() : "";
store.religionOp.length === 0 ? await getReligion() : "";
store.bloodGroupOp.length === 0 ? await getBloodGroup() : "";
}); });
</script> </script>
<template> <template>
@ -563,7 +368,7 @@ onMounted(async () => {
round round
icon="mdi-pencil-outline" icon="mdi-pencil-outline"
color="primary" color="primary"
@click="modal = true" @click="onClickOpenDialog"
> >
<q-tooltip>แกไขขอม</q-tooltip> <q-tooltip>แกไขขอม</q-tooltip>
</q-btn> </q-btn>
@ -574,10 +379,10 @@ onMounted(async () => {
</div> </div>
<q-card bordered class="my-card bg-grey-1 q-pa-md"> <q-card bordered class="my-card bg-grey-1 q-pa-md">
<div :class="$q.screen.gt.xs ? 'row' : 'column'"> <div v-if="informaData" :class="$q.screen.gt.xs ? 'row' : 'column'">
<!-- column 1 --> <!-- column 1 -->
<div class="col-md-7 col-12 row"> <div class="col-md-7 col-12 row">
<div class="col-md-4 col-5 text-grey-6 text-weight-medium"> <div class="col-5 text-grey-6 text-weight-medium">
<div <div
v-for="label in Object.keys(dataLabel).slice(0, 6)" v-for="label in Object.keys(dataLabel).slice(0, 6)"
class="q-py-xs" class="q-py-xs"
@ -586,47 +391,33 @@ onMounted(async () => {
</div> </div>
</div> </div>
<!-- data --> <!-- data -->
<div class="col-md-8 col-7"> <div class="col-7">
<div class="q-py-xs"> <div class="q-py-xs">
{{ informaData.cardid }} {{ informaData.citizenId }}
</div> </div>
<div class="q-py-xs"> <div class="q-py-xs">
{{ {{
`${informaData.prefix} ${informaData.firstname} ${informaData.lastname}` `${informaData.prefix} ${informaData.firstName} ${informaData.lastName}`
}} }}
</div> </div>
<div class="q-py-xs"> <div class="q-py-xs">
{{ date2Thai(informaData.birthDate) }} {{ date2Thai(informaData.birthDate) }}
</div> </div>
<div class="q-py-xs"> <div class="q-py-xs">
{{ informaData.age ? informaData.age : "-" }} {{ age ? age : "-" }}
</div> </div>
<div class="q-py-xs"> <div class="q-py-xs">
{{ {{ informaData.gender ? informaData.gender.name : "-" }}
informaData.genderId
? (
Ops.genderOps.find((r) => r.id === informaData.genderId) ||
{}
).name
: "-"
}}
</div> </div>
<div class="q-py-xs"> <div class="q-py-xs">
{{ {{ informaData.relationship ? informaData.relationship.name : "-" }}
informaData.statusId
? (
Ops.statusOps.find((r) => r.id === informaData.statusId) ||
{}
).name
: "-"
}}
</div> </div>
</div> </div>
</div> </div>
<!-- column 2 --> <!-- column 2 -->
<div class="col-md-5 col-12 row"> <div class="col-md-5 col-12 row">
<div class="col-md-4 col-5 col text-grey-6 text-weight-medium"> <div class="col-5 col text-grey-6 text-weight-medium">
<div <div
v-for="label in Object.keys(dataLabel).slice(6, 11)" v-for="label in Object.keys(dataLabel).slice(6, 11)"
class="q-py-xs" class="q-py-xs"
@ -635,7 +426,7 @@ onMounted(async () => {
</div> </div>
</div> </div>
<!-- data --> <!-- data -->
<div class="col-md-8 col-7"> <div class="col-7">
<div class="q-py-xs"> <div class="q-py-xs">
{{ informaData.nationality ? informaData.nationality : "-" }} {{ informaData.nationality ? informaData.nationality : "-" }}
</div> </div>
@ -643,26 +434,13 @@ onMounted(async () => {
{{ informaData.ethnicity ? informaData.ethnicity : "-" }} {{ informaData.ethnicity ? informaData.ethnicity : "-" }}
</div> </div>
<div class="q-py-xs"> <div class="q-py-xs">
{{ {{ informaData.religion ? informaData.religion.name : "-" }}
informaData.religionId
? (
Ops.religionOps.find(
(r) => r.id === informaData.religionId
) || {}
).name
: "-"
}}
</div> </div>
<div class="q-py-xs"> <div class="q-py-xs">
{{ {{ informaData.bloodGroup ? informaData.bloodGroup.name : "-" }}
informaData.bloodId
? (Ops.bloodOps.find((b) => b.id === informaData.bloodId) || {})
.name
: "-"
}}
</div> </div>
<div class="q-py-xs"> <div class="q-py-xs">
{{ informaData.tel ? informaData.tel : "-" }} {{ informaData.phone ? informaData.phone : "-" }}
</div> </div>
</div> </div>
</div> </div>
@ -672,7 +450,7 @@ onMounted(async () => {
<!-- Edit Dialog --> <!-- Edit Dialog -->
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card style="width: 600px"> <q-card style="width: 600px">
<q-form ref="myForm" @submit="onSubmit"> <q-form greedy @submit.prevent @validation-success="onSubmit">
<DialogHeader <DialogHeader
tittle="แก้ไขประวัติส่วนตัว" tittle="แก้ไขประวัติส่วนตัว"
:close="() => (modal = false)" :close="() => (modal = false)"
@ -688,7 +466,8 @@ onMounted(async () => {
hide-bottom-space hide-bottom-space
maxlength="13" maxlength="13"
mask="#############" mask="#############"
v-model="informaData.cardid" v-model="formData.citizenId"
class="inputgreen"
:label="dataLabel.citizenId" :label="dataLabel.citizenId"
:rules="[ :rules="[
(val: string) => !!val || `${'กรุณากรอก เลขประจำตัวประชาชน'}`, (val: string) => !!val || `${'กรุณากรอก เลขประจำตัวประชาชน'}`,
@ -702,20 +481,18 @@ onMounted(async () => {
<q-select <q-select
dense dense
outlined outlined
use-input
lazy-rules lazy-rules
emit-value emit-value
map-options map-options
hide-bottom-space hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0" input-debounce="0"
v-model="informaData.prefixId" new-value-mode="add-unique"
:options="Ops.prefixOps" v-model="formData.prefix"
class="inputgreen"
:options="store.prefixOp"
:label="dataLabel.prefix" :label="dataLabel.prefix"
:rules="[(val: string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]" :rules="[(val: string) => !!val || `${'กรุณาเลือก คำนำหน้าชื่อ'}`]"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'prefixOps'
)"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
@ -724,7 +501,8 @@ onMounted(async () => {
outlined outlined
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
v-model="informaData.firstname" v-model="formData.firstName"
class="inputgreen"
:label="dataLabel.firstName" :label="dataLabel.firstName"
:rules="[(val: string) => !!val || `${'กรุณากรอก ชื่อ'}`]" :rules="[(val: string) => !!val || `${'กรุณากรอก ชื่อ'}`]"
/> />
@ -735,7 +513,8 @@ onMounted(async () => {
outlined outlined
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
v-model="informaData.lastname" v-model="formData.lastName"
class="inputgreen"
:label="dataLabel.lastName" :label="dataLabel.lastName"
:rules="[(val: string) => !!val || `${'กรุณากรอก นามสกุล'}`]" :rules="[(val: string) => !!val || `${'กรุณากรอก นามสกุล'}`]"
/> />
@ -746,7 +525,7 @@ onMounted(async () => {
borderless borderless
week-start="0" week-start="0"
menu-class-name="modalfix" menu-class-name="modalfix"
v-model="informaData.birthDate" v-model="formData.birthDate"
:locale="'th'" :locale="'th'"
> >
<template #year="{ year }"> <template #year="{ year }">
@ -762,9 +541,10 @@ onMounted(async () => {
outlined outlined
dense dense
hide-bottom-space hide-bottom-space
class="inputgreen"
:model-value=" :model-value="
informaData.birthDate != null formData.birthDate != null
? date2Thai(informaData.birthDate) ? date2Thai(formData.birthDate)
: null : null
" "
:label="dataLabel.birthDate" :label="dataLabel.birthDate"
@ -791,7 +571,8 @@ onMounted(async () => {
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
readonly readonly
v-model="informaData.age" class="inputgreen"
v-model="age"
:label="dataLabel.age" :label="dataLabel.age"
/> />
</div> </div>
@ -804,15 +585,13 @@ onMounted(async () => {
emit-value emit-value
map-options map-options
hide-bottom-space hide-bottom-space
option-value="id"
option-label="name"
input-debounce="0" input-debounce="0"
v-model="informaData.genderId" option-label="name"
:options="Ops.genderOps" option-value="id"
v-model="formData.genderId"
class="inputgreen"
:options="store.genderOp"
:label="dataLabel.gender" :label="dataLabel.gender"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'genderOps'
)"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
@ -827,12 +606,10 @@ onMounted(async () => {
option-value="id" option-value="id"
option-label="name" option-label="name"
input-debounce="0" input-debounce="0"
v-model="informaData.statusId" class="inputgreen"
:options="Ops.statusOps" v-model="formData.relationshipId"
:options="store.relationshipOp"
:label="dataLabel.relationship" :label="dataLabel.relationship"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'statusOps'
)"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
@ -841,7 +618,8 @@ onMounted(async () => {
outlined outlined
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
v-model="informaData.nationality" class="inputgreen"
v-model="nationality"
:label="dataLabel.nationality" :label="dataLabel.nationality"
/> />
</div> </div>
@ -851,8 +629,9 @@ onMounted(async () => {
outlined outlined
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
v-model="informaData.ethnicity" class="inputgreen"
:label="dataLabel.race" v-model="formData.ethnicity"
:label="dataLabel.ethnicity"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
@ -867,12 +646,10 @@ onMounted(async () => {
option-value="id" option-value="id"
option-label="name" option-label="name"
input-debounce="0" input-debounce="0"
v-model="informaData.religionId" v-model="formData.religionId"
:options="Ops.religionOps" class="inputgreen"
:options="store.religionOp"
:label="dataLabel.religion" :label="dataLabel.religion"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'religionOps'
)"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
@ -887,12 +664,10 @@ onMounted(async () => {
option-value="id" option-value="id"
option-label="name" option-label="name"
input-debounce="0" input-debounce="0"
v-model="informaData.bloodId" v-model="formData.bloodGroupId"
:options="Ops.bloodOps" class="inputgreen"
:options="store.bloodGroupOp"
:label="dataLabel.bloodGroup" :label="dataLabel.bloodGroup"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'bloodOps'
)"
/> />
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-6"> <div class="col-xs-6 col-sm-6 col-md-6">
@ -902,8 +677,9 @@ onMounted(async () => {
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
mask="##########" mask="##########"
v-model="informaData.tel" class="inputgreen"
:label="dataLabel.telephoneNumber" v-model="formData.phone"
:label="dataLabel.phone"
/> />
</div> </div>
</div> </div>
@ -939,14 +715,8 @@ onMounted(async () => {
<template #columns="props"> <template #columns="props">
<q-tr :props="props"> <q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props"> <q-td v-for="col in props.cols" :key="col.name" :props="props">
<div <div class="table_ellipsis">
v-if="col.name == 'birthDate' || col.name == 'createdAt'" {{ col.value ? col.value : "-" }}
class="table_ellipsis"
>
{{ date2Thai(col.value) }}
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
</div> </div>
</q-td> </q-td>
</q-tr> </q-tr>

View file

@ -1,6 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive } from "vue"; import { ref, reactive, onMounted } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { DataOption2 } from "@/modules/04_registryNew/interface/index/Main"; import type { DataOption2 } from "@/modules/04_registryNew/interface/index/Main";
@ -14,9 +17,20 @@ import { useCounterMixin } from "@/stores/mixin";
import { useSalaryDataStore } from "@/modules/04_registryNew/stores/salary"; import { useSalaryDataStore } from "@/modules/04_registryNew/stores/salary";
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute();
const profileId = ref<string>(
route.params.id ? route.params.id.toString() : ""
);
const store = useSalaryDataStore(); const store = useSalaryDataStore();
const { date2Thai, dialogConfirm, showLoader, hideLoader, messageError } = const {
useCounterMixin(); date2Thai,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
} = useCounterMixin();
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "date", name: "date",
@ -132,7 +146,6 @@ const visibleColumns = ref<string[]>([
"salaryRef", "salaryRef",
"refCommandNo", "refCommandNo",
]); ]);
const formFilter = reactive({ const formFilter = reactive({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
@ -227,8 +240,28 @@ const posTypeOptions = ref<DataOption2[]>(store.optionTemplatePos);
const posLevelOption = ref<DataOption2[]>(store.optionTemplatePos); const posLevelOption = ref<DataOption2[]>(store.optionTemplatePos);
const docOption = ref<DataOption2[]>(store.optionTemplateDoc); const docOption = ref<DataOption2[]>(store.optionTemplateDoc);
function fetchListSalary() {
showLoader();
http
.get(
config.API.profileSalaryNewById("59134ef9-9e62-41d0-aac5-339be727f2b1")
)
.then((res) => {
// console.log(res);
rows.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function onClickOpenDialog(statusEdit: boolean = false, data: any = []) { function onClickOpenDialog(statusEdit: boolean = false, data: any = []) {
isStatusEdit.value = statusEdit;
modalDialogSalary.value = true; modalDialogSalary.value = true;
formDataSalary.date = statusEdit ? data.date : null; formDataSalary.date = statusEdit ? data.date : null;
formDataSalary.posNo = statusEdit ? data.posNo : ""; formDataSalary.posNo = statusEdit ? data.posNo : "";
// formDataSalary.templatePos = statusEdit ? data.templatePos : ""; // formDataSalary.templatePos = statusEdit ? data.templatePos : "";
@ -249,11 +282,12 @@ function onClickOpenDialog(statusEdit: boolean = false, data: any = []) {
// formDataSalary.templateDoc = statusEdit ? data.templateDoc : ""; // formDataSalary.templateDoc = statusEdit ? data.templateDoc : "";
formDataSalary.doc = statusEdit ? data.salaryRef : ""; formDataSalary.doc = statusEdit ? data.salaryRef : "";
} }
function onClickCloseDialog() { function onClickCloseDialog() {
modalDialogSalary.value = false; modalDialogSalary.value = false;
} }
const filterSelector = (val: any, update: Function, filtername: string) => { function filterSelector(val: any, update: Function, filtername: string) {
switch (filtername) { switch (filtername) {
case "pos": case "pos":
update(() => { update(() => {
@ -294,7 +328,8 @@ const filterSelector = (val: any, update: Function, filtername: string) => {
default: default:
break; break;
} }
}; }
function updatePos(val: string) { function updatePos(val: string) {
formDataSalary.position = val; formDataSalary.position = val;
} }
@ -316,23 +351,38 @@ function onSubmit() {
} }
if (hasError.every((result) => result === true)) { if (hasError.every((result) => result === true)) {
dialogConfirm($q, () => { dialogConfirm($q, () => {
onClickCloseDialog(); submit();
}); });
} }
} }
async function submit() {
try {
const url = isStatusEdit.value
? config.API.profileSalaryNewById("12312")
: config.API.profileSalaryNew;
const method = isStatusEdit.value ? "put" : "post";
await http[method](url, formDataSalary);
fetchListSalary();
onClickCloseDialog();
success($q, "บันทึกข้อมูลสำเร็จ");
} catch (e) {
messageError($q, e);
} finally {
hideLoader();
}
}
const modalHistory = ref<boolean>(false); const modalHistory = ref<boolean>(false);
function ocClikcHistory() { function ocClikcHistory() {
modalHistory.value = true; modalHistory.value = true;
} }
onMounted(() => {
fetchListSalary();
});
</script> </script>
<template> <template>
<!-- <div class="row items-center q-gutter-sm">
<div class="toptitle text-dark row items-center q-py-xs">
ตำแหนงเงนเดอน
</div>
</div> -->
<q-toolbar style="padding: 0px" class="text-primary"> <q-toolbar style="padding: 0px" class="text-primary">
<q-btn flat round dense icon="add" @click="onClickOpenDialog()"> <q-btn flat round dense icon="add" @click="onClickOpenDialog()">
<q-tooltip>เพ</q-tooltip> <q-tooltip>เพ</q-tooltip>

View file

@ -6,4 +6,16 @@ interface RowList {
refCommandNo: string; refCommandNo: string;
refCommandDate: Date | null; refCommandDate: Date | null;
} }
export type { RowList };
interface ObjectSalaryRef {
date: object | null;
posNo: object | null;
position: object | null;
typePosition: object | null;
levelPosition: object | null;
salary: object | null;
doc: object | null;
[key: string]: any;
}
export type { RowList, ObjectSalaryRef };

View file

@ -1,37 +1,11 @@
interface RequestItemsObject { interface RequestItemsObject {
profileId?: string; profileId?: string;
isActive: boolean;
detail: string; detail: string;
issueDate: Date | null; issueDate: Date | null;
issuer: string; issuer: string;
refCommandDate: Date | null; refCommandDate: Date | null;
refCommandNo: string; refCommandNo: string;
isDate: boolean; isDate: boolean | string;
} }
interface FormData { export type { RequestItemsObject };
id: string;
isActive: boolean;
isDate: string | null;
issuer: string;
detail: string;
issueDate: Date | null;
issueDateYear: number;
refCommandNo: string;
refCommandDate: Date | null;
}
//columns
interface Columns {
[index: number]: {
name: String;
align: String;
label: String;
sortable: Boolean;
field: String;
headerStyle: String;
style: String;
};
}
export type { RequestItemsObject, FormData, Columns };

View file

@ -0,0 +1,24 @@
interface RequestObject {
bloodGroupId: string | null;
relationshipId: string | null;
genderId: string | null;
posTypeId: string;
posLevelId: string;
religionId: string | null;
citizenId: string;
telephoneNumber: string | null;
// nationality: string | null;
ethnicity: string | null;
birthDate: Date | null;
dateRetire: Date | null;
isProbation: boolean;
keycloak: string;
phone: string | null;
email: string | null;
position: string;
lastName: string;
firstName: string;
prefix: string;
}
export type { RequestObject };

View file

@ -0,0 +1,108 @@
interface ResponseObject {
id: string;
createdAt: Date;
createdUserId: string;
lastUpdatedAt: Date;
lastUpdateUserId: string;
createdFullName: string;
lastUpdateFullName: string;
prefix: string;
firstName: string;
lastName: string;
citizenId: string;
position: string;
posLevelId: string | null;
posTypeId: string | null;
email: string | null;
phone: string | null;
keycloak: string | null;
isProbation: boolean;
dateRetire: Date | null;
birthDate: Date;
ethnicity: string | null;
religionId: string | null;
religion: Religion | null;
telephoneNumber: null | null;
genderId: string | null;
gender: Gender | null;
relationshipId: string | null;
relationship: Relationship | null;
bloodGroupId: string | null;
bloodGroup: BloodGroup | null;
posLevel: PosLevel | null;
posType: PosType | null;
nationality?: string;
}
interface Religion {
id: string;
createdAt: Date;
lastUpdatedAt: Date;
createdFullName: string;
lastUpdateFullName: string;
name: string;
}
interface Gender {
id: string;
createdAt: Date;
lastUpdatedAt: Date;
createdFullName: string;
lastUpdateFullName: string;
name: string;
}
interface Relationship {
id: string;
createdAt: Date;
lastUpdatedAt: Date;
createdFullName: string;
lastUpdateFullName: string;
name: string;
}
interface BloodGroup {
id: string;
createdAt: Date;
lastUpdatedAt: Date;
createdFullName: string;
lastUpdateFullName: string;
name: string;
}
interface PosLevel {
id: string;
createdAt: Date;
createdUserId: string;
lastUpdatedAt: Date;
lastUpdateUserId: string;
createdFullName: string;
lastUpdateFullName: string;
posLevelName: string;
posLevelRank: number;
posLevelAuthority: null;
posTypeId: string;
}
interface PosType {
id: string;
createdAt: Date;
createdUserId: string;
lastUpdatedAt: Date;
lastUpdateUserId: string;
createdFullName: string;
lastUpdateFullName: string;
posTypeName: string;
posTypeRank: number;
}
export type {
ResponseObject,
Religion,
Gender,
Relationship,
BloodGroup,
PosLevel,
PosType,
};

View file

@ -1,92 +1,123 @@
import { ref, computed } from "vue"; import { ref } from "vue";
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import type {
Gender,
Religion,
Relationship,
BloodGroup,
} from "@/modules/04_registryNew/interface/response/Profile";
export const useProfileDataStore = defineStore("profile", () => { export const useProfileDataStore = defineStore("profile", () => {
const isVerified = ref<boolean>(false); const $q = useQuasar();
const isEdit = ref<boolean>(false); const mixin = useCounterMixin();
const emplployeeClass = ref<string | null>(""); const {
interface profile { showLoader,
main: { columns: String[] }; hideLoader,
education: { columns: String[] }; date2Thai,
oldName: { columns: String[] }; messageError,
certicate: { columns: String[] }; convertDate,
train: { columns: String[] }; dateToISO,
insignia: { columns: String[] }; } = mixin;
coined: { columns: String[] };
assessment: { columns: String[] }; const genderOp = ref<Gender[]>([]);
salary: { columns: String[] }; const religionOp = ref<Religion[]>([]);
discipline: { columns: String[] }; const relationshipOp = ref<Relationship[]>([]);
leave: { columns: String[] }; const bloodGroupOp = ref<BloodGroup[]>([]);
talent: { columns: String[] }; const prefixOp = ref<string[]>(["นาย", "นาง", "นางสาว"]);
work: { columns: String[] };
record: { columns: String[] }; function calculateAge(birthDate: Date): string {
other: { columns: String[] }; const birthDateTimeStamp = new Date(birthDate).getTime();
document: { columns: String[] }; const now = new Date();
const diff = now.getTime() - birthDateTimeStamp;
const ageDate = new Date(diff);
const years = ageDate.getUTCFullYear() - 1970;
const months = ageDate.getUTCMonth();
const days = ageDate.getUTCDate() - 1;
if (years > 60) {
return "อายุเกิน 60 ปี";
}
return `${years} ปี ${months} เดือน ${days} วัน`;
} }
const birthDate = ref<Date>(new Date()); async function getGender() {
const retireText = ref<string | null>(null); showLoader();
const changeRetireText = (val: string | null) => { await http
retireText.value = val; .get(config.API.profileNewGender)
}; .then((res) => {
const changeBirth = (val: Date) => { genderOp.value = res.data.result;
birthDate.value = val; })
}; .catch((e) => {
const profileData = ref<profile>({ messageError($q, e);
main: { columns: [] }, })
education: { columns: [] }, .finally(() => {
oldName: { columns: [] }, hideLoader();
certicate: { columns: [] }, });
train: { columns: [] },
insignia: { columns: [] },
coined: { columns: [] },
assessment: { columns: [] },
salary: { columns: [] },
discipline: { columns: [] },
leave: { columns: [] },
talent: { columns: [] },
work: { columns: [] },
record: { columns: [] },
other: { columns: [] },
document: { columns: [] },
});
const changeProfileColumns = (system: String, val: String[]) => {
if (system == "main") profileData.value.main.columns = val;
if (system == "education") profileData.value.education.columns = val;
if (system == "oldName") profileData.value.oldName.columns = val;
if (system == "certicate") profileData.value.certicate.columns = val;
if (system == "train") profileData.value.train.columns = val;
if (system == "insignia") profileData.value.insignia.columns = val;
if (system == "coined") profileData.value.coined.columns = val;
if (system == "assessment") profileData.value.assessment.columns = val;
if (system == "salary") profileData.value.salary.columns = val;
if (system == "discipline") profileData.value.discipline.columns = val;
if (system == "leave") profileData.value.leave.columns = val;
if (system == "talent") profileData.value.talent.columns = val;
if (system == "work") profileData.value.work.columns = val;
if (system == "record") profileData.value.record.columns = val;
if (system == "other") profileData.value.other.columns = val;
if (system == "document") profileData.value.document.columns = val;
localStorage.setItem("profile", JSON.stringify(profileData.value));
};
if (localStorage.getItem("profile") !== null) {
profileData.value = JSON.parse(localStorage.getItem("profile") || "{}");
} }
const isLoad = ref<number>(0); async function getRelationship() {
showLoader();
await http
.get(config.API.profileNewRelationship)
.then((res) => {
relationshipOp.value = res.data.result;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
async function getReligion() {
showLoader();
await http
.get(config.API.profileNewReligion)
.then((res) => {
religionOp.value = res.data.result;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
async function getBloodGroup() {
showLoader();
await http
.get(config.API.profileNewBloodGroup)
.then((res) => {
bloodGroupOp.value = res.data.result;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
return { return {
isLoad, prefixOp,
isVerified, genderOp,
isEdit, religionOp,
profileData, relationshipOp,
changeProfileColumns, bloodGroupOp,
birthDate,
changeBirth, calculateAge,
retireText, getGender,
changeRetireText, getRelationship,
emplployeeClass, getReligion,
getBloodGroup,
}; };
}); });

View file

@ -109,13 +109,23 @@ function fetchYearOption() {
} }
} }
function fetchDataPerson() { async function fetchDataPerson(search: boolean = false) {
showLoader(); showLoader();
let queryParams = {
page: formFilter.page,
pageSize: formFilter.pageSize,
};
if (search) {
queryParams = Object.assign({}, queryParams, {
searchField: searchType.value,
searchKeyword: formFilter.keyword,
});
}
http http
.get( .get(config.API.registryNew, { params: queryParams })
config.API.registryNew +
`?page=${formFilter.page}&pageSize=${formFilter.pageSize}&keyword=${formFilter.keyword}`
)
.then((res) => { .then((res) => {
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
dataPersonMain.value = res.data.result.data; dataPersonMain.value = res.data.result.data;
@ -149,7 +159,7 @@ function onclickSearch() {
fetchYearOption(); fetchYearOption();
} }
formFilter.keyword = formFilter.keyword === null ? "" : formFilter.keyword; formFilter.keyword = formFilter.keyword === null ? "" : formFilter.keyword;
fetchDataPerson(); fetchDataPerson(true);
} }
function selectType(item: DataOption) { function selectType(item: DataOption) {
@ -194,9 +204,13 @@ onMounted(async () => {
<q-card class="q-mt-md"> <q-card class="q-mt-md">
<q-card-section class="card-img q-pb-lg"> <q-card-section class="card-img q-pb-lg">
<div class="text-h5 text-center q-py-md text-weight-medium">นหาขอมลทะเบยนประว</div> <div class="text-h5 text-center q-py-md text-weight-medium">
นหาขอมลทะเบยนประว
</div>
<div class="row justify-center"> <div class="row justify-center">
<div class="col-xs-12 col-sm-12 col-md-11 q-pa-md bg-Search rounded-borders"> <div
class="col-xs-12 col-sm-12 col-md-11 q-pa-md bg-Search rounded-borders"
>
<q-form @submit="onclickSearch"> <q-form @submit="onclickSearch">
<div class="bg-white row col-12 q-pa-none rounded-borders"> <div class="bg-white row col-12 q-pa-none rounded-borders">
<div class="row col-11"> <div class="row col-11">
@ -212,10 +226,9 @@ onMounted(async () => {
option-label="name" option-label="name"
option-value="id" option-value="id"
map-options map-options
class="selectS col-11 q-px-md " class="selectS col-11 q-px-md"
color="deep-orange" color="deep-orange"
dropdown-icon="mdi-chevron-down" dropdown-icon="mdi-chevron-down"
/> />
<q-separator vertical /> <q-separator vertical />
</div> </div>
@ -234,12 +247,18 @@ onMounted(async () => {
</q-input> </q-input>
</div> </div>
<div class="row col-1"> <div class="row col-1">
<q-btn class="fit btnSearch" unelevated color="deep-orange" label="ค้นหา" type="submit" /> <q-btn
class="fit btnSearch"
unelevated
color="deep-orange"
label="ค้นหา"
type="submit"
/>
</div> </div>
</div> </div>
</q-form> </q-form>
<div v-if="isShowBtnFilter" class="col-12 row q-mt-sm"> <div v-if="isShowBtnFilter" class="col-12 row q-mt-sm">
<q-space/> <q-space />
<q-btn <q-btn
flat flat
label="ตัวเลือกเพิ่มเติม" label="ตัวเลือกเพิ่มเติม"
@ -299,8 +318,7 @@ onMounted(async () => {
label-color="white" label-color="white"
dropdown-icon="mdi-chevron-down" dropdown-icon="mdi-chevron-down"
class="q-px-sm" class="q-px-sm"
><!-- class="custom-btn" -->
><!-- class="custom-btn" -->
<template v-slot:label> <template v-slot:label>
{{ {{
labelOption.posType !== "ทั้งหมด" labelOption.posType !== "ทั้งหมด"
@ -341,7 +359,7 @@ onMounted(async () => {
label-color="white" label-color="white"
dropdown-icon="mdi-chevron-down" dropdown-icon="mdi-chevron-down"
class="q-px-sm" class="q-px-sm"
><!-- class="custom-btn" --> ><!-- class="custom-btn" -->
<template v-slot:label> <template v-slot:label>
{{ {{
labelOption.posLevel !== "ทั้งหมด" labelOption.posLevel !== "ทั้งหมด"
@ -382,7 +400,7 @@ onMounted(async () => {
label-color="white" label-color="white"
dropdown-icon="mdi-chevron-down" dropdown-icon="mdi-chevron-down"
class="q-px-sm" class="q-px-sm"
><!-- class="custom-btn" --> ><!-- class="custom-btn" -->
<template v-slot:label> <template v-slot:label>
{{ `ปีเกษียณ${labelOption.retireYear}` }} {{ `ปีเกษียณ${labelOption.retireYear}` }}
<q-btn <q-btn
@ -464,7 +482,7 @@ onMounted(async () => {
label-color="white" label-color="white"
dropdown-icon="mdi-chevron-down" dropdown-icon="mdi-chevron-down"
class="q-px-sm" class="q-px-sm"
><!-- class="custom-btn" --> ><!-- class="custom-btn" -->
<template v-slot:label> <template v-slot:label>
{{ {{
`อายุราชการ (${formFilter.rangeYear.min} - ${formFilter.rangeYear.max} ปี)` `อายุราชการ (${formFilter.rangeYear.min} - ${formFilter.rangeYear.max} ปี)`
@ -520,7 +538,7 @@ onMounted(async () => {
dropdown-icon="mdi-chevron-down" dropdown-icon="mdi-chevron-down"
:label="`เงื่อนไขอื่นๆ ${conditionTotal}`" :label="`เงื่อนไขอื่นๆ ${conditionTotal}`"
class="q-px-sm" class="q-px-sm"
><!-- class="custom-btn" --> ><!-- class="custom-btn" -->
<q-list> <q-list>
<q-item clickable v-close-popup> <q-item clickable v-close-popup>
<q-item-section> <q-item-section>
@ -562,7 +580,7 @@ onMounted(async () => {
</q-card> </q-card>
</template> </template>
<style > <style>
.card-img { .card-img {
background: url("@/assets/registry-banner.png"); background: url("@/assets/registry-banner.png");
background-size: cover; background-size: cover;
@ -581,19 +599,19 @@ onMounted(async () => {
background-color: #36969f; background-color: #36969f;
} }
.btnSearch{ .btnSearch {
border-radius: 0px 4px 4px 0px; border-radius: 0px 4px 4px 0px;
} }
.bg-Search{ .bg-Search {
background: #00000015; background: #00000015;
} }
.lineFil{ .lineFil {
transform:rotate(30deg); transform: rotate(30deg);
height: 20px; height: 20px;
margin-top: 15px; margin-top: 15px;
background: #ffffff7b !important; background: #ffffff7b !important;
} }
.selectS .q-field__control .q-field__append .q-icon{ .selectS .q-field__control .q-field__append .q-icon {
color: #ff5722 !important; color: #ff5722 !important;
} }
</style> </style>

View file

@ -300,15 +300,15 @@ function fetchDataPeriodNew() {
function onClickDownload(data: DataOption) { function onClickDownload(data: DataOption) {
showLoader(); showLoader();
if (data.id === "emp-08") { if (data.id === "emp-08" || data.id === "emp2-08") {
const formData = { const formData = {
type: "HAFT", type: "HAFT",
startDate: startDate:
props?.roundFilter?.shortCode === "APR" data.id === "emp-08"
? `${props?.roundFilter?.year - 1}-10-01` ? `${props?.roundFilter?.year - 1}-10-01`
: `${props?.roundFilter?.year}-04-01`, : `${props?.roundFilter?.year}-04-01`,
endDate: endDate:
props?.roundFilter?.shortCode === "APR" data.id === "emp-08"
? `${props?.roundFilter?.year}-03-31` ? `${props?.roundFilter?.year}-03-31`
: `${props?.roundFilter?.year}-09-30`, : `${props?.roundFilter?.year}-09-30`,
}; };

View file

@ -124,60 +124,84 @@ export const useSalaryEmployeeListSDataStore = defineStore(
/** List Download รายงานของรอบตุลาคม*/ /** List Download รายงานของรอบตุลาคม*/
const itemDownloadOct = ref<DataOption[]>([ const itemDownloadOct = ref<DataOption[]>([
{ {
id: "emp-01", id: "emp2-01",
name: "บัญชีคำนวณโควตา", name: "บัญชีการคำนวณวงเงินเลื่อนขั้นค่าจางลูกจ้างประจำกรุงเทพมหานคร",
}, },
{ {
id: "emp-02", id: "emp2-02",
name: "รายชื่อลูกจ้างประจำผู้ครองตำแหน่ง ณ วันที่ 1 กันยายน", name: "รายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ครองตำแหน่ง ณ วันที่ กันยายน",
}, },
{ {
id: "emp-03", id: "emp2-03",
name: "รายชื่อลูกจ้างประจำที่ได้รับการเสนอขอเลื่อนขั้นค่าจ้างหนึ่งขั้น", name: "รายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ได้รับการเสนอขอเลื่อนขั้นค่าจ้างรวมทั้งปีสองขั้น",
}, },
{ {
id: "emp-04", id: "emp2-04",
name: "แบบ ลจ.กทม.1-รายชื่อลูกจ้างผู้สมควรได้เลื่อนขั้นค่าจ้าง", name: "บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้สมควรได้เลื่อนขั้นค่าจ้าง (แบบ ลจ.กทม.๑)",
}, },
{ {
id: "emp-05", id: "emp2-05",
name: "แบบ ลจ.กทม.1-1-รายชื่อลูกจ้างผู้สมควรได้รับค่าตอบแทนพิเศษ", name: "บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้สมควรได้รับค่าตอบแทนพิเศษ (แบบ ลจ.กทม.๑/๑)",
}, },
{ {
id: "emp-06", id: "emp2-06",
name: "แบบ ลจ.กทม.2-รายชื่อลูกจ้างผู้ไม่สมควรเลื่อนขั้นค่าจ้าง", name: "บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่สมควรเลื่อนขั้นค่าจ้าง (แบบ ลจ.กทม.๒)",
}, },
{ {
id: "emp-07", id: "emp2-07",
name: "แบบ ลจ.กทม.2-1-รายชื่อลูกจ้างผู้ไม่สมควรได้รับค่าตอบแทนพิเศษ", name: "บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่สมควรได้รับค่าตอบแทนพิเศษ (แบบ ลจ.กทม.๒/๑)",
}, },
{ {
id: "emp-08", id: "emp2-08",
name: "แบบ ลจ.กทม.3-บัญชีแสดงวันลาในครึ่งปีของลูกจ้าง", name: "บัญชีแสดงวันลาในครึ่งปีที่แล้วมาของลูกจ้างประจำกรุงเทพมหานคร (แบบ ลจ.กทม.๓)",
}, },
{ {
id: "emp-09", id: "emp2-09",
name: "บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับเลื่อนขั้นค่าจ้างในวันที่ 1 ตุลาคม ย้อนหลัง 3 ครั้ง ", name: "รายชื่อลูกจ้างประจำกรุงเทพมหานครที่ครบเกษียณอายุราชการสิ้นปีงบประมาณ",
}, },
{ {
id: "emp-10", id: "emp2-10",
name: "รายชื่อลูกจ้างประจำผู้มีผลการประเมินดีเด่น", name: "บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับการเลื่อนขั้นค่าจ้าง/ค่าตอบแทนพิเศษ",
}, },
{ {
id: "emp-12", id: "emp2-11",
name: "บัญชีรายละเอียดผู้ได้รับอัตราค่าจ้างสูงกว่าขั้นสูง (แนบท้ายคำสั่ง) ", name: "รายชื่อลูกจ้างประจำผู้มีผลการประเมินประสิทธิภาพและประสิทธิผลการปฏิบัติงานอยู่ในระดับดีเด่น",
}, },
{ {
id: "emp-13", id: "emp2-13",
name: "บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับการเลื่อนขั้นค่าจ้าง", name: "บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่า อัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ ที่เกษียณอายุราชการ ในสิ้นปีงบประมาณ (แนบท้ายคำสั่ง)",
}, },
{ {
id: "emp-15", id: "emp2-14",
name: "บัญชีรายละเอียดลูกจ้างประจำที่ได้รับค่าตอบแทนพิเศษ(แนบท้ายคำสั่ง)", name: "บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับการเลื่อนขั้นค่าจ้างที่เกษียณอายุราชการ ในสิ้นปีงบประมาณ",
}, },
{ {
id: "emp-14", id: "emp2-15",
name: "บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับค่าตอบแทนพิเศษ", name: "บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับค่าตอบแทนพิเศษที่เกษียณอายุราชการ ในสิ้นปีงบประมาณ",
},
{
id: "emp2-17",
name: "บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่า อัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ (แนบท้ายคำสั่ง)",
},
{
id: "emp2-18",
name: "บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับการเลื่อนขั้นค่าจ้าง",
},
{
id: "emp2-20",
name: "บัญชีรายละเอียดให้ลูกจ้างประจำกรุงเทพมหานครได้รับค่าตอบแทนพิเศษ (แนบท้ายคำสั่ง)",
},
{
id: "emp2-21",
name: "บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับค่าตอบแทนพิเศษ",
},
{
id: "emp2-23",
name: "บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่า อัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ (แนบท้ายคำสั่ง)",
},
{
id: "emp2-25",
name: "แบบฟอร์มบัญชีถือจ่ายอัตราค่าจ้างลูกจ้างประจำกรุงเทพมหานคร ประจำปีงบประมาณ",
}, },
]); ]);

View file

@ -542,7 +542,7 @@ watch([() => page.value, () => pageSize.value], () => {
<q-select <q-select
ref="positionLevelRef" ref="positionLevelRef"
:class="inputEdit(isReadonly)" :class="inputEdit(isReadonly)"
label="ระดับชันงาน" label="ระดับชันงาน"
v-model="formData.positionLevel" v-model="formData.positionLevel"
:disable="formData.positionType == ''" :disable="formData.positionType == ''"
:options="levelOps" :options="levelOps"