Merge branch 'develop' of github.com:Frappet/hrms-mgt into develop

This commit is contained in:
Warunee Tamkoo 2025-03-11 18:07:48 +07:00
commit 0bf38bb88c
25 changed files with 590 additions and 1251 deletions

View file

@ -33,10 +33,7 @@ const employeeClass = ref<string>(
const typeKeyword = ref<string>(""); const typeKeyword = ref<string>("");
const Keyword = ref<string>(""); const Keyword = ref<string>("");
const positionKeyword = ref<string>(""); const positionKeyword = ref<string>("");
const employeeClassOps = ref<DataOption[]>([
{ id: "officer", name: "ข้าราชการ กทม.สามัญ" },
{ id: "perm", name: "ลูกจ้างประจำ" },
]);
// //
const typeKeywordOps = ref<DataOption[]>([ const typeKeywordOps = ref<DataOption[]>([
{ id: "no", name: "ตำแหน่งเลขที่" }, { id: "no", name: "ตำแหน่งเลขที่" },
@ -97,14 +94,6 @@ const columns = ref<QTableProps["columns"]>([
]); ]);
const rows = ref<HistoryPos[]>([]); const rows = ref<HistoryPos[]>([]);
/** function เปลี่ยนประเภท*/
function changeEmployeeClass() {
typeKeyword.value = "";
Keyword.value = "";
positionKeyword.value = "";
rows.value = [];
}
/** /**
* function นหาประวอครองตำแหน * function นหาประวอครองตำแหน
* @param type ประเภทขาราชการ * @param type ประเภทขาราชการ
@ -186,27 +175,6 @@ function closeDialog() {
<q-form ref="myForm"> <q-form ref="myForm">
<div class="bg-grey-2 q-pa-sm"> <div class="bg-grey-2 q-pa-sm">
<div class="row q-col-gutter-sm full-width"> <div class="row q-col-gutter-sm full-width">
<!-- <div class="col-3">
<q-select
hide-bottom-space
:rules="[(val:string) => !!val || `${'กรุณาเลือก ประเภท'}`]"
outlined
dense
lazy-rules
bg-color="white"
v-model="employeeClass"
emit-value
map-options
:options="employeeClassOps"
option-label="name"
option-value="id"
:label="`${'ประเภท'}`"
use-input
input-debounce="0"
@update:model-value="changeEmployeeClass"
/>
</div> -->
<div class="col-3"> <div class="col-3">
<q-select <q-select
hide-bottom-space hide-bottom-space

View file

@ -0,0 +1,129 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableColumn } from "quasar";
import type { DataHistory } from "@/modules/04_registryPerson/interface/index/Main";
import DialogHeader from "@/components/DialogHeader.vue";
const { onSearchDataTable } = useCounterMixin();
const modal = defineModel<boolean>("modal", { required: true });
const title = defineModel<string>("title", { required: true });
const columns = defineModel<QTableColumn[]>("columns", {
required: true,
});
const visibleColumnsMain = defineModel<string[]>("visibleColumns", {
required: true,
});
const props = defineProps({
fetchData: { type: Function, required: true },
});
const filter = ref<string>("");
const rows = ref<DataHistory[]>([]);
const dataMain = ref<DataHistory[]>([]);
const visibleColumns = ref<string[]>([]);
const pagination = ref({
sortBy: "lastUpdatedAt",
});
async function fetchDataTable() {
visibleColumns.value = visibleColumnsMain.value;
const data = await props?.fetchData?.();
dataMain.value = data;
rows.value = data;
}
/** ฟังก์ค้นหาข้อมูลรายการประวัติแก้ไขข้อมูลส่วนตัว */
function serchDataTable() {
rows.value = onSearchDataTable(filter.value, dataMain.value, columns.value);
}
watch(
() => modal.value,
() => {
if (modal.value) {
fetchDataTable();
} else {
filter.value = "";
dataMain.value = [];
rows.value = [];
pagination.value.sortBy = "lastUpdatedAt";
}
}
);
</script>
<template>
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 80%">
<DialogHeader :tittle="title" :close="() => (modal = false)" />
<q-separator />
<q-card-section style="max-height: 50vh" class="scroll">
<div class="row q-gutter-sm q-mb-sm">
<q-space />
<q-input
dense
v-model="filter"
outlined
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
<d-table
ref="table"
flat
bordered
dense
:columns="columns"
:rows="rows"
class="custom-header-table"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
>
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
</q-card>
</q-dialog>
</template>
<style lang="scss" scoped></style>

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, watch, ref, reactive } from "vue"; import { onMounted, watch, ref, reactive, defineAsyncComponent } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
@ -16,6 +16,7 @@ import type { ResponseObject } from "@/modules/04_registryPerson/interface/respo
/** importComponents*/ /** importComponents*/
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogHistory.vue";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
@ -30,7 +31,7 @@ const {
messageError, messageError,
dialogConfirm, dialogConfirm,
dialogMessageNotify, dialogMessageNotify,
onSearchDataTable, convertDateToAPI,
} = useCounterMixin(); } = useCounterMixin();
/** props*/ /** props*/
@ -55,9 +56,6 @@ const empType = ref<string>(
const id = ref<string>(""); const id = ref<string>("");
const modal = ref<boolean>(false); // const modal = ref<boolean>(false); //
const informaData = ref<ResponseObject>(); // const informaData = ref<ResponseObject>(); //
const rowsHistory = ref<ResponseObject[]>([]); //
const rowsHistoryMain = ref<ResponseObject[]>([]); //
const filterHistory = ref<string>(""); //
const modalHistory = ref<boolean>(false); // const modalHistory = ref<boolean>(false); //
const age = ref<string | null>(""); // const age = ref<string | null>(""); //
const formData = reactive<RequestObject>(store.defaultProfile); // const formData = reactive<RequestObject>(store.defaultProfile); //
@ -255,7 +253,7 @@ const columnsHistory = ref<QTableColumn[]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
]); ]);
const visibleColumnsHistory = ref<String[]>([ const visibleColumnsHistory = ref<string[]>([
"citizenId", "citizenId",
"prefix", "prefix",
"rank", "rank",
@ -272,9 +270,6 @@ const visibleColumnsHistory = ref<String[]>([
"lastUpdateFullName", "lastUpdateFullName",
"lastUpdatedAt", "lastUpdatedAt",
]); ]);
const pagination = ref({
sortBy: "lastUpdatedAt",
});
/** function เรียกข้อมูลข้อมูลส่วนตัว*/ /** function เรียกข้อมูลข้อมูลส่วนตัว*/
async function getData() { async function getData() {
@ -331,6 +326,7 @@ function onSubmit() {
...formData, ...formData,
employeeClass: employeeClass:
route.name === "registry-employeeId" ? "TEMP" : undefined, route.name === "registry-employeeId" ? "TEMP" : undefined,
birthDate: convertDateToAPI(formData.birthDate),
}) })
.then(async () => { .then(async () => {
await props.fetchDataPersonal?.(); await props.fetchDataPersonal?.();
@ -352,21 +348,22 @@ function onSubmit() {
/** function ดูข้อมูลประวัติแก้ไขข้อมูลส่วนตัว*/ /** function ดูข้อมูลประวัติแก้ไขข้อมูลส่วนตัว*/
async function clickHistory() { async function clickHistory() {
showLoader();
modalHistory.value = true; modalHistory.value = true;
filterHistory.value = ""; }
await http
.get(config.API.profileNewProfileHisById(id.value, empType.value)) async function fetchDataHistory() {
.then(async (res) => { showLoader();
rowsHistory.value = await res.data.result; try {
rowsHistoryMain.value = await res.data.result; const res = await http.get(
}) config.API.profileNewProfileHisById(id.value, empType.value)
.catch((e) => { );
messageError($q, e); const data = await res.data.result;
}) return data;
.finally(() => { } catch (e) {
hideLoader(); messageError($q, e);
}); } finally {
hideLoader();
}
} }
/** /**
@ -396,7 +393,6 @@ function changeCardID(citizenId: string | number | null) {
function calculateMaxDate() { function calculateMaxDate() {
const today = new Date(); const today = new Date();
today.setFullYear(today.getFullYear() - 18); today.setFullYear(today.getFullYear() - 18);
return today; return today;
} }
@ -417,15 +413,6 @@ watch(
} }
); );
/** ฟังก์ค้นหาข้อมูลรายการประวัติแก้ไขข้อมูลส่วนตัว */
function serchDataTable() {
rowsHistory.value = onSearchDataTable(
filterHistory.value,
rowsHistoryMain.value,
columnsHistory.value
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/ /** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => { onMounted(() => {
const promises = []; const promises = [];
@ -863,81 +850,13 @@ onMounted(() => {
</q-card> </q-card>
</q-dialog> </q-dialog>
<!-- ประวแกไขขอมลสวนต --> <DialogHistory
<q-dialog v-model="modalHistory" persistent> v-model:modal="modalHistory"
<q-card style="min-width: 80%"> :visible-columns="visibleColumnsHistory"
<DialogHeader :title="`ประวัติแก้ไขข้อมูลส่วนตัว`"
tittle="ประวัติแก้ไขข้อมูลส่วนตัว" :columns="columnsHistory"
:close=" :fetch-data="fetchDataHistory"
() => ( />
(modalHistory = false), ((rowsHistory = []), (filterHistory = ''))
)
"
/>
<q-separator />
<q-card-section style="max-height: 50vh" class="scroll">
<div class="row q-gutter-sm q-mb-sm">
<q-space />
<q-input
dense
v-model="filterHistory"
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumnsHistory"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columnsHistory"
option-value="name"
style="min-width: 140px"
/>
</div>
<d-table
ref="table"
flat
bordered
dense
:columns="columnsHistory"
:rows="rowsHistory"
class="custom-header-table"
:visible-columns="visibleColumnsHistory"
v-model:pagination="pagination"
>
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
</q-card>
</q-dialog>
</template> </template>
<style lang="scss"> <style lang="scss">

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, useAttrs, reactive, watch } from "vue"; import { onMounted, ref, reactive, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import axios from "axios"; import axios from "axios";
@ -12,6 +12,7 @@ import config from "@/app.config";
/** importType*/ /** importType*/
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
import type { ResponseObject } from "@/components/information/interface/response/OldName"; import type { ResponseObject } from "@/components/information/interface/response/OldName";
import type { DataProfile } from "@/modules/04_registryPerson/interface/response/Main"; import type { DataProfile } from "@/modules/04_registryPerson/interface/response/Main";
import type { FormChangeName } from "@/modules/04_registryPerson/interface/request/Main"; import type { FormChangeName } from "@/modules/04_registryPerson/interface/request/Main";
@ -23,7 +24,7 @@ import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
const store = useProfileDataStore(); const store = useProfileDataStore();
const attrs = ref<any>(useAttrs());
const { fetchPerson } = store; const { fetchPerson } = store;
const { const {
date2Thai, date2Thai,
@ -165,11 +166,10 @@ const pagination = ref({
const uploadUrl = ref<string>(""); const uploadUrl = ref<string>("");
const subId = ref<string>(""); const subId = ref<string>("");
const fileUpload = ref<File>(); const fileUpload = ref<File | undefined>(undefined);
/** ฟังก์ชันดึงข้อมูลส่วนตัว*/ /** ฟังก์ชันดึงข้อมูลส่วนตัว*/
async function fetchDataPersonal() { async function fetchDataPersonal() {
showLoader();
await http await http
.get(config.API.registryNewByProfileId(profileId.value, empType.value)) .get(config.API.registryNewByProfileId(profileId.value, empType.value))
.then(async (res) => { .then(async (res) => {
@ -178,9 +178,6 @@ async function fetchDataPersonal() {
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
})
.finally(() => {
hideLoader();
}); });
} }
@ -189,7 +186,6 @@ async function fetchDataPersonal() {
* @param id id profile * @param id id profile
*/ */
async function fetchData(id: string) { async function fetchData(id: string) {
showLoader();
await http await http
.get(config.API.profileNewChangeNameByProfileId(id, empType.value)) .get(config.API.profileNewChangeNameByProfileId(id, empType.value))
.then(async (res) => { .then(async (res) => {
@ -198,19 +194,46 @@ async function fetchData(id: string) {
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
})
.finally(() => {
hideLoader();
}); });
} }
/** ฟังก์ชันยืนยันการบันทึกข้อมูล*/ /** ฟังก์ชันยืนยันการบันทึกข้อมูล*/
function onSubmit() { function onSubmit() {
if (!!fileUpload.value || dialogStatus.value === "edit") { if (!!fileUpload.value) {
dialogConfirm( dialogConfirm(
$q, $q,
() => { async () => {
dialogStatus.value === "create" ? addData() : editData(editId.value); showLoader();
await http
.post(config.API.profileNewChangeName(empType.value), {
profileId: empType.value === "" ? profileId.value : undefined,
profileEmployeeId:
empType.value !== "" ? profileId.value : undefined,
prefixId: changeNameData.prefixId,
prefix: changeNameData.prefix,
firstName: changeNameData.firstName,
lastName: changeNameData.lastName,
status: changeNameData.status,
documentId: changeNameData.documentId,
})
.then(async (res) => {
subId.value = await res.data.result;
await Promise.all([
uploadProfile(res.data.result),
fetchData(profileId.value),
props?.fetchDataPersonal?.(),
fetchDataPersonal(),
]);
closeDialog();
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}, },
"ยืนยันการบันทึกข้อมูล", "ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
@ -242,7 +265,7 @@ async function uploadProfile(id: string) {
) )
.then(async (res) => { .then(async (res) => {
uploadUrl.value = res.data["เอกสารหลักฐาน"].uploadUrl; uploadUrl.value = res.data["เอกสารหลักฐาน"].uploadUrl;
await uploadFileURL(uploadUrl.value, fileUpload.value); await uploadFileURL(uploadUrl.value, fileUpload.value as File);
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -254,7 +277,7 @@ async function uploadProfile(id: string) {
* @param uploadUrl Path ปโหลดไฟล * @param uploadUrl Path ปโหลดไฟล
* @param file ไฟลเอกสาร * @param file ไฟลเอกสาร
*/ */
async function uploadFileURL(uploadUrl: string, file: any) { async function uploadFileURL(uploadUrl: string, file: File) {
await axios await axios
.put(uploadUrl, file, { .put(uploadUrl, file, {
headers: { headers: {
@ -298,65 +321,7 @@ async function onDownloadFile(id: string) {
} }
/** ฟังกชันเพิ่มการเปลี่ยนชื่อ - นามสกุล */ /** ฟังกชันเพิ่มการเปลี่ยนชื่อ - นามสกุล */
async function addData() { async function addData() {}
showLoader();
await http
.post(config.API.profileNewChangeName(empType.value), {
profileId: empType.value === "" ? profileId.value : undefined,
profileEmployeeId: empType.value !== "" ? profileId.value : undefined,
prefixId: changeNameData.prefixId,
prefix: changeNameData.prefix,
firstName: changeNameData.firstName,
lastName: changeNameData.lastName,
status: changeNameData.status,
documentId: changeNameData.documentId,
})
.then(async (res) => {
subId.value = await res.data.result;
await uploadProfile(res.data.result);
await fetchData(profileId.value);
await props?.fetchDataPersonal?.();
await fetchDataPersonal();
success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* งกชนแกไขการเปลยนช - นามสก
* @param idData id องการแกไช
*/
function editData(idData: string) {
showLoader();
http
.patch(
config.API.profileNewChangeNameByChangeNameId(idData, empType.value),
{
...changeNameData,
profileId: undefined,
}
)
.then(async () => {
await uploadProfile(subId.value);
success($q, "บันทึกข้อมูลสำเร็จ");
await fetchData(profileId.value);
await props.fetchDataPersonal?.();
await fetchDataPersonal();
closeDialog();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** /**
* งกชนคนหาขอมลใน select * งกชนคนหาขอมลใน select
@ -376,7 +341,7 @@ function filterSelector(val: string, update: Function, refData: string) {
case "prefixOps": case "prefixOps":
update(() => { update(() => {
store.Ops.prefixOps = store.OpsFilter.prefixOps.filter( store.Ops.prefixOps = store.OpsFilter.prefixOps.filter(
(v: any) => v.name.indexOf(val) > -1 (v: DataOption) => v.name.indexOf(val) > -1
); );
}); });
break; break;
@ -433,6 +398,7 @@ watch(
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/ /** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(async () => { onMounted(async () => {
// //
showLoader();
if ( if (
store.Ops.prefixOps.length === 0 || store.Ops.prefixOps.length === 0 ||
store.Ops.genderOps.length === 0 || store.Ops.genderOps.length === 0 ||
@ -442,8 +408,11 @@ onMounted(async () => {
) { ) {
await fetchPerson(); await fetchPerson();
} }
try {
await Promise.all([fetchData(profileId.value), fetchDataPersonal()]); await Promise.all([fetchData(profileId.value), fetchDataPersonal()]);
} finally {
hideLoader();
}
}); });
</script> </script>
@ -509,7 +478,6 @@ onMounted(async () => {
bordered bordered
virtual-scroll virtual-scroll
ref="table" ref="table"
v-bind="attrs"
:rows="rows" :rows="rows"
:columns="columns" :columns="columns"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"

View file

@ -9,13 +9,13 @@ import { useAddressDataStore } from "@/modules/04_registryPerson/stores/Address"
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import type { QTableProps } from "quasar"; import type { QTableColumn } from "quasar";
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main"; import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Address"; import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Address";
import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Address"; import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Address";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const store = useAddressDataStore(); const store = useAddressDataStore();
@ -36,7 +36,6 @@ const {
hideLoader, hideLoader,
dialogConfirm, dialogConfirm,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
/** /**
@ -81,10 +80,7 @@ const dataLabel = {
}; };
const modalHistory = ref<boolean>(false); // Popup const modalHistory = ref<boolean>(false); // Popup
const rowsHistory = ref<ResponseObject[]>([]); // const visibleColumnsHistory = ref<string[]>([
const rowsHistoryMain = ref<ResponseObject[]>([]); //
const filterHistory = ref<string>(""); //
const visibleColumnsHistory = ref<String[]>([
"currentAddress", "currentAddress",
"currentDistrict", "currentDistrict",
"currentSubDistrict", "currentSubDistrict",
@ -99,7 +95,7 @@ const visibleColumnsHistory = ref<String[]>([
"lastUpdateFullName", "lastUpdateFullName",
"lastUpdatedAt", "lastUpdatedAt",
]); ]);
const columnsHistory = ref<QTableProps["columns"]>([ const columnsHistory = ref<QTableColumn[]>([
{ {
name: "registrationAddress", name: "registrationAddress",
align: "left", align: "left",
@ -252,9 +248,6 @@ const columnsHistory = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
]); ]);
const pagination = ref({
sortBy: "lastUpdatedAt",
});
/** /**
* งกนดงขอมลทอย * งกนดงขอมลทอย
@ -470,26 +463,23 @@ function clickClose() {
modal.value = false; modal.value = false;
} }
/** /** ฟังก์ชันเปิด popup ประวัติแก้ไขข้อมูลที่อยู่*/
* งกนเป popup ประวแกไขขอมลทอย
* และดงขอมลรายการประวแกไขขอมลทอย
*/
async function clickHistory() { async function clickHistory() {
showLoader();
modalHistory.value = true; modalHistory.value = true;
filterHistory.value = ""; }
await http
.get(config.API.profileNewAddressHisById(profileId.value, empType.value)) async function fetchDataHistory() {
.then(async (res) => { showLoader();
rowsHistory.value = await res.data.result; try {
rowsHistoryMain.value = await res.data.result; const res = await http.get(
}) config.API.profileNewAddressHisById(profileId.value, empType.value)
.catch((e) => { );
messageError($q, e); const data = res.data.result;
}) return data;
.finally(() => { } catch (err) {
hideLoader(); } finally {
}); hideLoader();
}
} }
/** /**
@ -508,15 +498,6 @@ function sameAddressToggle(v: string) {
} }
} }
/** ฟังก์ค้นหาข้อมูลรายการประวัติแก้ไขข้อมูลที่อยู่ */
function serchDataTable() {
rowsHistory.value = onSearchDataTable(
filterHistory.value,
rowsHistoryMain.value,
columnsHistory.value ? columnsHistory.value : []
);
}
/** ดูการเปลี่ยนแปลงที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้า*/ /** ดูการเปลี่ยนแปลงที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้า*/
watch( watch(
() => sameAddress.value, () => sameAddress.value,
@ -904,74 +885,13 @@ onMounted(async () => {
</q-dialog> </q-dialog>
<!-- ประวแกไขขอมลทอย --> <!-- ประวแกไขขอมลทอย -->
<q-dialog v-model="modalHistory" persistent> <DialogHistory
<q-card style="min-width: 80%"> v-model:modal="modalHistory"
<DialogHeader :title="`ประวัติแก้ไขข้อมูลที่อยู่`"
tittle="ประวัติแก้ไขข้อมูลที่อยู่" :columns="columnsHistory"
:close="() => ((modalHistory = false), (rowsHistory = []))" :visible-columns="visibleColumnsHistory"
/> :fetch-data="fetchDataHistory"
<q-separator color="grey-4" /> />
<q-card-section style="max-height: 50vh" class="scroll">
<div class="row q-gutter-sm q-mb-sm">
<q-space />
<q-input
dense
v-model="filterHistory"
ref="filterRef"
outlined
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumnsHistory"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columnsHistory"
option-value="name"
style="min-width: 140px"
/>
</div>
<d-table
ref="table"
flat
bordered
dense
:columns="columnsHistory"
:rows="rowsHistory"
:visible-columns="visibleColumnsHistory"
v-model:pagination="pagination"
>
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
</q-card>
</q-dialog>
</template> </template>
<style scoped></style> <style scoped></style>

View file

@ -9,7 +9,7 @@ import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import type { QTableProps } from "quasar"; import type { QTableColumn } from "quasar";
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main"; import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
import type { import type {
FormPerson, FormPerson,
@ -17,6 +17,7 @@ import type {
} from "@/modules/04_registryPerson/interface/index/family"; } from "@/modules/04_registryPerson/interface/index/family";
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
@ -30,7 +31,6 @@ const {
messageError, messageError,
success, success,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = useCounterMixin(); } = useCounterMixin();
/** props*/ /** props*/
@ -43,9 +43,7 @@ const profileId = ref<string>(
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
/** TableHisoty*/ /** TableHisoty*/
const rows = ref<any[]>([]); const visibleColumns = ref<string[]>([
const rowsMain = ref<any[]>([]);
const visibleColumns = ref<String[]>([
"statusMarital", "statusMarital",
"citizenId", "citizenId",
"prefix", "prefix",
@ -57,7 +55,7 @@ const visibleColumns = ref<String[]>([
"lastUpdateFullName", "lastUpdateFullName",
"lastUpdatedAt", "lastUpdatedAt",
]); ]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableColumn[]>([
{ {
name: "statusMarital", name: "statusMarital",
align: "left", align: "left",
@ -151,9 +149,6 @@ const columns = ref<QTableProps["columns"]>([
format: (val) => date2Thai(val, false, true), format: (val) => date2Thai(val, false, true),
}, },
]); ]);
const pagination = ref({
sortBy: "lastUpdatedAt",
});
/** ข้อมูล*/ /** ข้อมูล*/
const fatherData = reactive<FormPerson>({ const fatherData = reactive<FormPerson>({
@ -190,6 +185,7 @@ const modalHistory = ref<boolean>(false);
const filterHistory = ref<string>(""); const filterHistory = ref<string>("");
const titleForm = ref<string>(""); const titleForm = ref<string>("");
const typeForm = ref<string>(""); const typeForm = ref<string>("");
const historyId = ref<string>("");
const isEdit = ref<boolean>(false); const isEdit = ref<boolean>(false);
const childernId = ref<string>(""); const childernId = ref<string>("");
@ -353,7 +349,6 @@ function closeDialog() {
fromData.job = ""; fromData.job = "";
fromData.lastNameOld = ""; fromData.lastNameOld = "";
fromData.statusMarital = ""; fromData.statusMarital = "";
rows.value = [];
filterHistory.value = ""; filterHistory.value = "";
} }
@ -418,10 +413,9 @@ function onOpenDialogForm(
* @param id * @param id
*/ */
async function onOpenDialogHistory(type: string, id: string = "") { async function onOpenDialogHistory(type: string, id: string = "") {
modalHistory.value = true;
typeForm.value = type; typeForm.value = type;
const historyId = type === "children" ? id : profileId.value; historyId.value = type === "children" ? id : profileId.value;
await fetchHistory(historyId, type); modalHistory.value = true;
} }
/** function fetch ข้อมูลความสัมพันธ์ */ /** function fetch ข้อมูลความสัมพันธ์ */
@ -453,59 +447,41 @@ function filterSelectorRelation(val: string, update: Function) {
}); });
} }
/** async function fetchDataHistory() {
* function fetch อมลประวการแกไขขอม
* @param id
* @param type
*/
async function fetchHistory(id: string, type: string) {
showLoader(); showLoader();
await http try {
.get(config.API.profileFamilyHistory(id, empType.value, type)) const res = await http.get(
.then(async (res) => { config.API.profileFamilyHistory(
const data = await res.data.result; historyId.value,
rows.value = await data.map((e: any) => ({ empType.value,
citizenId: e[`${type}CitizenId`], typeForm.value
prefix: e[`${type}Prefix`], )
firstName: e[`${type}FirstName`], );
lastName: e[`${type}LastName`],
job: e[`${type}Career`],
isLive: e[`${type}Live`],
lastNameOld:
type === "couple"
? e.coupleLastNameOld
: type === "mother"
? e.motherLastNameOld
: undefined,
lastUpdateFullName: e.lastUpdateFullName,
lastUpdatedAt: e.lastUpdatedAt,
statusMarital: type === "couple" ? e.relationship : undefined,
}));
rowsMain.value = rows.value;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** ฟังก์ค้นหาข้อมูลรายการประวัติแก้ไขข้อมูล */ const data = await res.data.result.map((e: any) => ({
function serchDataTable() { citizenId: e[`${typeForm.value}CitizenId`],
const baseColumns = prefix: e[`${typeForm.value}Prefix`],
typeForm.value === "couple" firstName: e[`${typeForm.value}FirstName`],
? columns.value lastName: e[`${typeForm.value}LastName`],
: typeForm.value === "mother" job: e[`${typeForm.value}Career`],
? columns.value?.filter((e) => e.name !== "statusMarital") isLive: e[`${typeForm.value}Live`],
: columns.value?.filter( lastNameOld:
(e) => e.name !== "lastNameOld" && e.name !== "statusMarital" typeForm.value === "couple"
); ? e.coupleLastNameOld
rows.value = onSearchDataTable( : typeForm.value === "mother"
filterHistory.value, ? e.motherLastNameOld
rowsMain.value, : undefined,
baseColumns ? baseColumns : [] lastUpdateFullName: e.lastUpdateFullName,
); lastUpdatedAt: e.lastUpdatedAt,
statusMarital: typeForm.value === "couple" ? e.relationship : undefined,
}));
return data;
} catch (err) {
messageError($q, err);
} finally {
hideLoader();
}
} }
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/ /** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
@ -1073,100 +1049,29 @@ onMounted(async () => {
</q-card> </q-card>
</q-dialog> </q-dialog>
<!-- ประวการแกไขขอม --> <DialogHistory
<q-dialog v-model="modalHistory" class="dialog" persistent> v-model:modal="modalHistory"
<q-card style="min-width: 80%"> :title="`ประวัติการแก้ไขข้อมูล${
<DialogHeader typeForm === 'father'
:tittle="`ประวัติการแก้ไขข้อมูล${ ? 'บิดา'
typeForm === 'father' : typeForm === 'mother'
? 'บิดา' ? 'มารดา'
: typeForm === 'mother' : typeForm === 'couple'
? 'มารดา' ? 'คู่สมรส'
: typeForm === 'couple' : 'บุตร'
? 'คู่สมรส' }`"
: 'บุตร' :columns="
}`" typeForm === 'couple'
:close="closeDialog" ? columns
/> : typeForm === 'mother'
<q-separator /> ? columns?.filter((e) => e.name !== 'statusMarital')
<q-card-section> : columns?.filter(
<div class="row q-gutter-sm q-mb-sm"> (e) => e.name !== 'lastNameOld' && e.name !== 'statusMarital'
<q-space /> )
<q-input "
dense :visible-columns="visibleColumns"
v-model="filterHistory" :fetch-data="fetchDataHistory"
ref="filterRef" />
outlined
placeholder="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="
typeForm === 'couple'
? columns
: typeForm === 'mother'
? columns?.filter((e) => e.name !== 'statusMarital')
: columns?.filter(
(e) =>
e.name !== 'lastNameOld' && e.name !== 'statusMarital'
)
"
option-value="name"
style="min-width: 140px"
/>
</div>
<d-table
ref="table"
flat
bordered
dense
:columns="
typeForm === 'couple'
? columns
: typeForm === 'mother'
? columns?.filter((e) => e.name !== 'statusMarital')
: columns?.filter(
(e) => e.name !== 'lastNameOld' && e.name !== 'statusMarital'
)
"
:rows="rows"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
>
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
</q-card>
</q-dialog>
</template> </template>
<style scoped></style> <style scoped></style>

View file

@ -1,4 +1,3 @@
div
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, onMounted } from "vue"; import { ref, reactive, onMounted } from "vue";
import { QForm, useQuasar } from "quasar"; import { QForm, useQuasar } from "quasar";
@ -9,7 +8,7 @@ import { useRoute } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import type { QTableProps } from "quasar"; import type { QTableColumn } from "quasar";
import type { import type {
DataOptionEducation, DataOptionEducation,
DataOptionEducationLevel, DataOptionEducationLevel,
@ -22,6 +21,7 @@ import type {
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import DialogSortEducation from "@/modules/04_registryPerson/components/detail/PersonalInformation/DialogSortEducation.vue"; import DialogSortEducation from "@/modules/04_registryPerson/components/detail/PersonalInformation/DialogSortEducation.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
@ -48,11 +48,7 @@ const mode = ref<string>("table"); //การแสดงของ Table card
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
/** Table*/ const baseColumns = ref<QTableColumn[]>([
const keyword = ref<string>("");
const rows = ref<ResponseObject[]>([]);
const rowsMain = ref<ResponseObject[]>([]);
const columns = ref<QTableProps["columns"]>([
{ {
name: "educationLevel", name: "educationLevel",
align: "left", align: "left",
@ -84,7 +80,7 @@ const columns = ref<QTableProps["columns"]>([
format(val, row) { format(val, row) {
return row.isDate return row.isDate
? date2Thai(row.startDate) ? date2Thai(row.startDate)
: new Date(row.startDate).getFullYear() + 543; : (new Date(row.startDate).getFullYear() + 543).toString();
}, },
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
@ -97,11 +93,10 @@ const columns = ref<QTableProps["columns"]>([
label: "ถึง", label: "ถึง",
sortable: true, sortable: true,
field: "endDate", field: "endDate",
format(val, row) { format(val, row) {
return row.isDate return row.isDate
? date2Thai(row.endDate) ? date2Thai(row.endDate)
: new Date(row.endDate).getFullYear() + 543; : (new Date(row.endDate).getFullYear() + 543).toString();
}, },
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
@ -249,238 +244,6 @@ const columns = ref<QTableProps["columns"]>([
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: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
format: (v) => date2Thai(v, false, true),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<string[]>([
"educationLevel",
"institute",
"degree",
"field",
"gpa",
"country",
"duration",
"durationYear",
"other",
"fundName",
"isEducation",
"isHigh",
"endDate",
"startDate",
"finishDate",
"note",
"lastUpdatedAt",
]);
const pagination = ref({
sortBy: "",
});
/** Table ประวัติแก้ไขประวัติการศึกษา*/
const historyKeyword = ref<string>("");
const historyRows = ref<ResponseObject[]>([]);
const historyRowsMain = ref<ResponseObject[]>([]);
const historyColumns = ref<QTableProps["columns"]>([
{
name: "educationLevel",
align: "left",
label: "ระดับการศึกษา",
sortable: true,
field: "educationLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "institute",
align: "left",
label: "สถานศึกษา",
sortable: true,
field: "institute",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "startDate",
align: "left",
label: "ตั้งแต่",
sortable: true,
field: "startDate",
format(val, row) {
return row.isDate
? date2Thai(row.startDate)
: new Date(row.startDate).getFullYear() + 543;
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "endDate",
align: "left",
label: "ถึง",
sortable: true,
field: "endDate",
format(val, row) {
return row.isDate
? date2Thai(row.endDate)
: new Date(row.endDate).getFullYear() + 543;
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "finishDate",
align: "left",
label: "วันที่สำเร็จการศึกษา",
sortable: true,
field: "finishDate",
format: (v) => date2Thai(v),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "isEducation",
align: "left",
label: "เป็นวุฒิการศึกษาในตำแหน่ง",
sortable: true,
field: "isEducation",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => (v === true ? "ใช่" : "ไม่ใช่"),
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "isHigh",
align: "left",
label: "วุฒิการศึกษาสูงสุด",
sortable: true,
field: "isHigh",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (v) => (v === true ? "ใช่" : v === false ? "ไม่ใช่" : "-"),
sort: (a: string, b: string) =>
a
.toString()
.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "degree",
align: "left",
label: "วุฒิการศึกษา",
sortable: true,
field: "degree",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "field",
align: "left",
label: "สาขาวิชา/ทาง",
sortable: true,
field: "field",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "fundName",
align: "left",
label: "ทุน",
sortable: true,
field: "fundName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "gpa",
align: "left",
label: "เกรดเฉลี่ย",
sortable: true,
field: "gpa",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "country",
align: "left",
label: "ประเทศ",
sortable: true,
field: "country",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "other",
align: "left",
label: "ข้อมูลการติดต่อ",
sortable: true,
field: "other",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "duration",
align: "left",
label: "ระยะเวลา",
sortable: true,
field: "duration",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "durationYear",
align: "left",
label: "ระยะเวลาหลักสูตร (ปี)",
sortable: true,
field: "durationYear",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "note",
align: "left",
label: "หมายเหตุ",
sortable: true,
field: "note",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{ {
name: "lastUpdateFullName", name: "lastUpdateFullName",
align: "left", align: "left",
@ -505,7 +268,7 @@ const historyColumns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
]); ]);
const historyVisibleColumns = ref<string[]>([ const baseVisibleColumns = ref<string[]>([
"educationLevel", "educationLevel",
"institute", "institute",
"degree", "degree",
@ -525,10 +288,25 @@ const historyVisibleColumns = ref<string[]>([
"lastUpdateFullName", "lastUpdateFullName",
"lastUpdatedAt", "lastUpdatedAt",
]); ]);
const paginationHistory = ref({
sortBy: "lastUpdatedAt", /** Table*/
const keyword = ref<string>("");
const rows = ref<ResponseObject[]>([]);
const rowsMain = ref<ResponseObject[]>([]);
const columns = ref<QTableColumn[]>(
baseColumns.value.filter((e: QTableColumn) => e.name !== "lastUpdateFullName")
);
const visibleColumns = ref<string[]>(
baseVisibleColumns.value.filter((e: string) => e !== "lastUpdateFullName")
);
const pagination = ref({
sortBy: "",
}); });
/** Table ประวัติแก้ไขประวัติการศึกษา*/
const historyColumns = ref<QTableColumn[]>(baseColumns.value);
const historyVisibleColumns = ref<string[]>(baseVisibleColumns.value);
const editId = ref<string>(""); //id const editId = ref<string>(""); //id
const isDate = ref<string>("false"); const isDate = ref<string>("false");
@ -578,8 +356,55 @@ const dataSort = ref<ResponseObject[]>([]);
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
() => { async () => {
dialogStatus.value === "create" ? addData() : editData(editId.value); showLoader();
const isEdit = dialogStatus.value === "create" ? false : true;
const url = isEdit
? config.API.profileNewEducationByEducationId(
editId.value,
empType.value
)
: config.API.profileNewEducation(empType.value);
const method = isEdit ? http.patch : http.post;
const body = {
...educationData,
startYear: undefined,
endYear: undefined,
isDate: isDate.value === "false" ? false : true,
profileId: isEdit
? undefined
: empType.value === ""
? id.value
: undefined,
profileEmployeeId: isEdit
? undefined
: empType.value !== ""
? id.value
: undefined,
durationYear: isEdit
? educationData.durationYear === ""
? null
: educationData.durationYear
: undefined,
finishDate: convertDateToAPI(educationData.finishDate),
startDate: convertDateToAPI(educationData.startDate),
endDate: convertDateToAPI(educationData.endDate),
};
await method(url, body)
.then(async () => {
await fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}, },
"ยืนยันการบันทึกข้อมูล", "ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
@ -678,13 +503,6 @@ function closeDialog() {
dialog.value = false; dialog.value = false;
} }
/** funcitob ปิด popup ประวัติการศึกษา*/
function closeHistoryDialog() {
historyDialog.value = false;
historyKeyword.value = "";
historyRows.value = [];
}
/** /**
* function fetch อมลประวการศกษา * function fetch อมลประวการศกษา
* @param id คคล * @param id คคล
@ -724,84 +542,32 @@ function fetchEducationLevel() {
}); });
} }
const historyId = ref<string>("");
/** /**
* function fetch ประวการแกไขประวการศกษา * function fetch ประวการแกไขประวการศกษา
* @param id ประวการศกษา * @param id ประวการศกษา
*/ */
function fetchHistoryData(id: string) { function onOpenHistoryData(id: string) {
showLoader(); historyId.value = id;
http historyDialog.value = true;
.get(config.API.profileNewEducationHisByEducationId(id, empType.value))
.then(async (res) => {
historyRows.value = await res.data.result;
historyRowsMain.value = await res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
} }
/** function เพิ่มข้อมูลประวัติการศึกษา*/ async function fetchDataHistory() {
function addData() {
showLoader(); showLoader();
http try {
.post(config.API.profileNewEducation(empType.value), { const res = await http.get(
...educationData, config.API.profileNewEducationHisByEducationId(
startYear: undefined, historyId.value,
endYear: undefined, empType.value
isDate: isDate.value === "false" ? false : true, )
profileId: empType.value === "" ? id.value : undefined, );
profileEmployeeId: empType.value !== "" ? id.value : undefined, const data = res.data.result;
finishDate: convertDateToAPI(educationData.finishDate), return data;
startDate: convertDateToAPI(educationData.startDate), } catch (err) {
endDate: convertDateToAPI(educationData.endDate), messageError($q, err);
}) } finally {
.then(async () => { hideLoader();
await fetchData(id.value); }
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**
* function นทกการแกไขขอม
* @param idData ประวการศกษา
*/
function editData(idData: string) {
showLoader();
http
.patch(config.API.profileNewEducationByEducationId(idData, empType.value), {
...educationData,
profileId: undefined,
startYear: undefined,
endYear: undefined,
isDate: isDate.value === "false" ? false : true,
durationYear:
educationData.durationYear === "" ? null : educationData.durationYear,
finishDate: convertDateToAPI(educationData.finishDate),
startDate: convertDateToAPI(educationData.startDate),
endDate: convertDateToAPI(educationData.endDate),
})
.then(async () => {
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
} }
/** ฟังก์ค้นหาข้อมูลรายการประวัติการศึกษา */ /** ฟังก์ค้นหาข้อมูลรายการประวัติการศึกษา */
@ -813,15 +579,6 @@ function serchDataTable() {
); );
} }
/** ฟังก์ค้นหาข้อมูลรายการประวัติการศึกษา */
function serchDataTableHistory() {
historyRows.value = onSearchDataTable(
historyKeyword.value,
historyRowsMain.value,
historyColumns.value ? historyColumns.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/ /** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(async () => { onMounted(async () => {
await fetchData(id.value); await fetchData(id.value);
@ -955,9 +712,7 @@ onMounted(async () => {
dense dense
round round
icon="mdi-history" icon="mdi-history"
@click=" @click="() => onOpenHistoryData(props.row.id)"
() => (fetchHistoryData(props.row.id), (historyDialog = true))
"
> >
<q-tooltip>ประวแกไขประวการศกษา</q-tooltip> <q-tooltip>ประวแกไขประวการศกษา</q-tooltip>
</q-btn> </q-btn>
@ -996,9 +751,7 @@ onMounted(async () => {
round round
color="deep-purple" color="deep-purple"
icon="mdi-history" icon="mdi-history"
@click=" @click="() => onOpenHistoryData(props.row.id)"
() => (fetchHistoryData(props.row.id), (historyDialog = true))
"
> >
<q-tooltip>ประวแกไขประวการศกษา</q-tooltip> <q-tooltip>ประวแกไขประวการศกษา</q-tooltip>
</q-btn> </q-btn>
@ -1543,81 +1296,13 @@ onMounted(async () => {
</q-dialog> </q-dialog>
<!-- ประวแกไขประวการศกษา --> <!-- ประวแกไขประวการศกษา -->
<q-dialog v-model="historyDialog" class="dialog" persistent> <DialogHistory
<q-card style="min-width: 80%"> v-model:modal="historyDialog"
<DialogHeader :columns="historyColumns"
tittle="ประวัติแก้ไขประวัติการศึกษา" :visible-columns="historyVisibleColumns"
:close="closeHistoryDialog" :title="`ประวัติแก้ไขประวัติการศึกษา`"
/> :fetch-data="fetchDataHistory"
<q-separator /> />
<q-card-section style="max-height: 50vh" class="scroll">
<q-toolbar style="padding: 0px" class="text-primary q-mb-sm">
<q-space />
<q-input
dense
outlined
bg-color="white"
v-model="historyKeyword"
label="ค้นหา"
class="q-mr-sm"
@keydown.enter.pervent="serchDataTableHistory"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="historyVisibleColumns"
multiple
outlined
dense
bg-color="white"
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="historyColumns"
option-value="name"
style="min-width: 140px"
/>
</q-toolbar>
<d-table
ref="table"
:columns="historyColumns"
:rows="historyRows"
row-key="name"
flat
bordered
:paging="true"
dense
class="custom-header-table"
:visible-columns="historyVisibleColumns"
v-model:pagination="paginationHistory"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.id">
<div>
{{ col.value === "" ? "-" : col.value }}
</div>
</q-td>
<q-td auto-width> </q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
</q-card>
</q-dialog>
<DialogSortEducation <DialogSortEducation
v-model:modal="modalSort" v-model:modal="modalSort"

View file

@ -10,12 +10,13 @@ import { checkPermission } from "@/utils/permissions";
import { QForm, useQuasar } from "quasar"; import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar"; import type { QTableColumn } from "quasar";
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/SpecialSkill"; import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/SpecialSkill";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/SpecialSkill"; import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/SpecialSkill";
import type { ResFileData } from "@/modules/04_registryPerson/interface/index/Main"; import type { ResFileData } from "@/modules/04_registryPerson/interface/index/Main";
import dialogHeader from "@/components/DialogHeader.vue"; import dialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/DialogHistory.vue";
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
@ -49,88 +50,8 @@ const mode = ref<string>("table"); //การแสดงของ Table card
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
//Table
const keyword = ref<string>(""); //
const rows = ref<ResponseObject[]>([]); //
const rowsMain = ref<ResponseObject[]>([]); //
const columns = ref<QTableProps["columns"]>([
{
name: "field",
align: "left",
label: "ด้าน",
sortable: true,
field: "field",
headerStyle: "font-size: 14px; width: 50px;",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "detail",
align: "left",
label: "รายละเอียด",
sortable: true,
field: "detail",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "remark",
align: "left",
label: "หมายเหตุ",
sortable: true,
field: "remark",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "reference",
align: "left",
label: "เอกสารอ้างอิง",
sortable: true,
field: "reference",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "lastUpdatedAt",
align: "left",
label: "วันที่แก้ไข",
sortable: true,
field: "lastUpdatedAt",
format: (v) => date2Thai(v, false, true),
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const visibleColumns = ref<string[]>([
"field",
"detail",
"remark",
"reference",
"lastUpdatedAt",
]);
const pagination = ref({
sortBy: "lastUpdatedAt",
});
const dialog = ref<boolean>(false); // popup const baseColumns = ref<QTableColumn[]>([
const dialogStatus = ref<string>("create"); ////
const editId = ref<string>(""); //id
const historyDialog = ref<boolean>(false); // popup
const historyRows = ref<ResponseObject[]>([]); //
const historyRowsMain = ref<ResponseObject[]>([]); //
const historyKeyword = ref<string>(""); //
const historyColumns = ref<QTableProps["columns"]>([
{ {
name: "field", name: "field",
align: "left", align: "left",
@ -199,7 +120,7 @@ const historyColumns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
]); ]);
const historyVisibleColumns = ref<string[]>([ const baseVisibleColumns = ref<string[]>([
"field", "field",
"detail", "detail",
"remark", "remark",
@ -207,10 +128,30 @@ const historyVisibleColumns = ref<string[]>([
"lastUpdateFullName", "lastUpdateFullName",
"lastUpdatedAt", "lastUpdatedAt",
]); ]);
const historyPagination = ref({
//Table
const keyword = ref<string>(""); //
const rows = ref<ResponseObject[]>([]); //
const rowsMain = ref<ResponseObject[]>([]); //
const columns = ref<QTableColumn[]>(
baseColumns.value.filter((e: QTableColumn) => e.name !== "lastUpdateFullName")
);
const visibleColumns = ref<string[]>(
baseVisibleColumns.value.filter((e: string) => e !== "lastUpdateFullName")
);
const pagination = ref({
sortBy: "lastUpdatedAt", sortBy: "lastUpdatedAt",
}); });
const dialog = ref<boolean>(false); // popup
const dialogStatus = ref<string>("create"); ////
const editId = ref<string>(""); //id
const historyId = ref<string>("");
const historyDialog = ref<boolean>(false); // popup
const historyColumns = ref<QTableColumn[]>(baseColumns.value);
const historyVisibleColumns = ref<string[]>(baseVisibleColumns.value);
// //
const specialSkill = reactive<RequestItemsObject>({ const specialSkill = reactive<RequestItemsObject>({
field: "", // field: "", //
@ -218,16 +159,53 @@ const specialSkill = reactive<RequestItemsObject>({
remark: "", // remark: "", //
reference: "", // reference: "", //
profileId: id.value, profileId: id.value,
dateStart: null,
dateEnd: null,
}); });
/** function ยืนยันการบันทึกข้อมูล*/ /** function ยืนยันการบันทึกข้อมูล*/
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
() => { async () => {
dialogStatus.value === "create" ? addData() : editData(editId.value); showLoader();
const url = isEdit.value
? config.API.profileNewAbilityByAbilityId(editId.value, empType.value)
: config.API.profileNewAbility(empType.value);
const method = isEdit.value ? http.patch : http.post;
const body = {
...specialSkill,
dateEnd: null,
dateStart: null,
profileId: isEdit.value
? undefined
: empType.value === ""
? id.value
: undefined,
profileEmployeeId: isEdit.value
? undefined
: empType.value !== ""
? id.value
: undefined,
isUpload: !isEdit.value ? undefined : isUpload.value,
};
await method(url, body)
.then(async (res) => {
if (fileUpload.value && res.data.result) {
await uploadProfile(res.data.result);
}
await fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}, },
"ยืนยันการบันทึกข้อมูล", "ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
@ -285,80 +263,29 @@ async function fetchData(id: string) {
} }
/** /**
* function fetch ระวการแกไขความสามรรถพเศษ * function ระวการแกไขความสามรรถพเศษ
* @param id ความสามรรถพเศษ * @param id ความสามรรถพเศษ
*/ */
async function fetchHistoryData(id: string) { async function onOpenHistoryData(id: string) {
showLoader(); historyId.value = id;
await http historyDialog.value = true;
.get(config.API.profileNewAbilityHisByAbilityId(id, empType.value))
.then(async (res) => {
historyRows.value = await res.data.result;
historyRowsMain.value = await res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
} }
/** function เพิ่มข้อมูลความสามรรถพิเศษ*/ /** function fetch ประวัติการแก้ไขความสามรรถพิเศษ*/
async function addData() { async function fetchDataHistory() {
showLoader(); showLoader();
await http try {
.post(config.API.profileNewAbility(empType.value), { const res = await http.get(
...specialSkill, config.API.profileNewAbilityHisByAbilityId(historyId.value, empType.value)
dateStart: null, );
dateEnd: null,
profileId: empType.value === "" ? id.value : undefined,
profileEmployeeId: empType.value !== "" ? id.value : undefined,
})
.then(async (res) => {
if (fileUpload.value && res.data.result) {
await uploadProfile(res.data.result);
}
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** const data = res.data.result;
* function นทกการแกไขขอม return data;
* @param idData ความสามรรถพเศษ } catch (err) {
*/ messageError($q, err);
async function editData(idData: string) { } finally {
showLoader(); hideLoader();
await http }
.patch(config.API.profileNewAbilityByAbilityId(idData, empType.value), {
...specialSkill,
dateStart: null,
dateEnd: null,
profileId: undefined,
isUpload: !isEdit.value ? undefined : isUpload.value,
})
.then(async (res) => {
if (fileUpload.value && idData) {
await uploadProfile(idData);
}
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
} }
/** /**
@ -420,8 +347,7 @@ async function isUploadFn(id: string) {
.patch(config.API.profileNewAbilityByAbilityId(id, empType.value), { .patch(config.API.profileNewAbilityByAbilityId(id, empType.value), {
isUpload: fileUpload.value ? true : false, isUpload: fileUpload.value ? true : false,
}) })
.then(async (res) => {}) .then(async () => {})
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
}) })
@ -467,13 +393,6 @@ function closeDialog() {
clearForm(); clearForm();
} }
/** function ปิด popup รายการประวัติ*/
function closeHistoryDialog() {
historyDialog.value = false;
historyKeyword.value = "";
historyRows.value = [];
}
/** ฟังก์ค้นหาข้อมูลรายการความสามาพิเศษ */ /** ฟังก์ค้นหาข้อมูลรายการความสามาพิเศษ */
function serchDataTable() { function serchDataTable() {
rows.value = onSearchDataTable( rows.value = onSearchDataTable(
@ -483,15 +402,6 @@ function serchDataTable() {
); );
} }
/** ฟังก์ค้นหาข้อมูลรายการประวัติแก้ไขความสามารถพิเศษ */
function serchDataTableHistory() {
historyRows.value = onSearchDataTable(
historyKeyword.value,
historyRowsMain.value,
historyColumns.value ? historyColumns.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/ /** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => { onMounted(() => {
fetchData(id.value); fetchData(id.value);
@ -600,10 +510,7 @@ onMounted(() => {
round round
color="deep-purple" color="deep-purple"
icon="mdi-history" icon="mdi-history"
@click=" @click="onOpenHistoryData(props.row.id)"
fetchHistoryData(props.row.id);
historyDialog = true;
"
> >
<q-tooltip>ประวแกไขความสามารถพเศษ</q-tooltip> <q-tooltip>ประวแกไขความสามารถพเศษ</q-tooltip>
</q-btn> </q-btn>
@ -634,7 +541,7 @@ onMounted(() => {
dense dense
round round
icon="mdi-file-document-outline" icon="mdi-file-document-outline"
@click="onDownloadFile(props.row.profileId)" @click="onDownloadFile(props.row.id)"
> >
<q-tooltip>ดาวนโหลด</q-tooltip> <q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn> </q-btn>
@ -653,10 +560,7 @@ onMounted(() => {
round round
color="deep-purple" color="deep-purple"
icon="mdi-history" icon="mdi-history"
@click=" @click="onOpenHistoryData(props.row.id)"
fetchHistoryData(props.row.id);
historyDialog = true;
"
> >
<q-tooltip>ประวแกไขความสามารถพเศษ</q-tooltip> <q-tooltip>ประวแกไขความสามารถพเศษ</q-tooltip>
</q-btn> </q-btn>
@ -841,7 +745,7 @@ onMounted(() => {
round round
color="primary" color="primary"
icon="mdi-download" icon="mdi-download"
@click="onDownloadFile(id)" @click="onDownloadFile(editId)"
/> />
<q-btn <q-btn
@ -872,75 +776,13 @@ onMounted(() => {
</q-dialog> </q-dialog>
<!-- ประวแกไขความสามารถพเศษ --> <!-- ประวแกไขความสามารถพเศษ -->
<q-dialog v-model="historyDialog" persistent> <DialogHistory
<q-card style="width: 900px; max-width: 80vw"> v-model:modal="historyDialog"
<dialog-header :columns="historyColumns"
tittle="ประวัติแก้ไขความสามารถพิเศษ" :visible-columns="historyVisibleColumns"
:close="closeHistoryDialog" :title="`ประวัติแก้ไขความสามารถพิเศษ`"
/> :fetch-data="fetchDataHistory"
<q-separator /> />
<q-card-section>
<q-toolbar style="padding: 0px" class="text-primary q-mb-sm">
<q-space />
<q-input
dense
outlined
bg-color="white"
v-model="historyKeyword"
label="ค้นหา"
class="q-mr-sm"
@keydown.enter.pervent="serchDataTableHistory"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="historyVisibleColumns"
multiple
outlined
dense
bg-color="white"
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="historyColumns"
option-value="name"
style="min-width: 140px"
/>
</q-toolbar>
<d-table
ref="table"
:columns="historyColumns"
:rows="historyRows"
row-key="name"
flat
bordered
dense
class="custom-header-table"
:visible-columns="historyVisibleColumns"
v-model:pagination="historyPagination"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props" v-if="mode === 'table'">
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.id">
<div>{{ col.value ? col.value : "-" }}</div>
</q-td>
</q-tr>
</template>
</d-table>
</q-card-section>
</q-card>
</q-dialog>
</template> </template>
<style scoped> <style scoped>

View file

@ -70,15 +70,6 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
// {
// name: "document",
// align: "center",
// label: "",
// sortable: false,
// field: "document",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
{ {
name: "status", name: "status",
align: "left", align: "left",
@ -105,7 +96,6 @@ const visibleColumns = ref<string[]>([
"fullname", "fullname",
"topic", "topic",
"detail", "detail",
// "document",
"status", "status",
"remark", "remark",
]); ]);
@ -117,9 +107,9 @@ const statusOption = ref<DataOption[]>(store.optionStatus); //รายการ
const requestId = ref<string>(""); //id const requestId = ref<string>(""); //id
/** function fetch รายการคำร้องขอแก้ไขทะเบียนประวัติ*/ /** function fetch รายการคำร้องขอแก้ไขทะเบียนประวัติ*/
function fetchListRequset() { async function fetchListRequset() {
showLoader(); showLoader();
http await http
.get( .get(
config.API.requestEditByType( config.API.requestEditByType(
routerName.value == "registryNewRequestEditEMP" ? "-employee" : "" routerName.value == "registryNewRequestEditEMP" ? "-employee" : ""
@ -167,7 +157,6 @@ function clearStatus() {
*/ */
function filterOption(val: string, update: Function) { function filterOption(val: string, update: Function) {
update(() => { update(() => {
status.value = val ? "" : status.value;
statusOption.value = store.optionStatus.filter( statusOption.value = store.optionStatus.filter(
(v: DataOption) => v.name.indexOf(val) > -1 (v: DataOption) => v.name.indexOf(val) > -1
); );
@ -309,21 +298,7 @@ onMounted(() => {
</q-btn> </q-btn>
</q-td> </q-td>
<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 v-if="col.name === 'document'">
<q-btn
icon="mdi-download"
round
dense
flat
color="primary"
@click.pervent="onDownloadFile(props.row.id)"
>
<q-tooltip>ดาวนโหลดเอกสารหลกฐาน</q-tooltip>
</q-btn>
</div> -->
<!-- <div v-else class="table_ellipsis2"> -->
{{ col.value ? col.value : "-" }} {{ col.value ? col.value : "-" }}
<!-- </div> -->
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>

View file

@ -192,7 +192,6 @@ function clearStatus() {
*/ */
function filterOption(val: string, update: Function) { function filterOption(val: string, update: Function) {
update(() => { update(() => {
status.value = val ? "" : status.value;
statusOption.value = store.optionStatusIDP.filter( statusOption.value = store.optionStatusIDP.filter(
(v: DataOption) => v.name.indexOf(val) > -1 (v: DataOption) => v.name.indexOf(val) > -1
); );
@ -284,6 +283,7 @@ watch(
} }
); );
/** HooK lifecycle ทำงานเมื่อมีการเรียกใช้งาน Componenets */
onMounted(() => { onMounted(() => {
props.isIdp && fetchData(); props.isIdp && fetchData();
}); });

View file

@ -203,7 +203,6 @@ onMounted(() => {
<q-card-section> <q-card-section>
<div class="row q-col-gutter-sm"> <div class="row q-col-gutter-sm">
<!-- สถานะ --> <!-- สถานะ -->
<!-- v-if="isDone == 'PENDING'" -->
<q-form <q-form
class="col-12" class="col-12"
greedy greedy

View file

@ -97,19 +97,19 @@ interface InsigniasType {
} }
interface InsigniasTypeSub { interface InsigniasTypeSub {
id:string; id: string;
createdAt:Date; createdAt: Date;
createdUserId:string; createdUserId: string;
lastUpdatedAt:Date; lastUpdatedAt: Date;
lastUpdateUserId:string; lastUpdateUserId: string;
createdFullName:string; createdFullName: string;
lastUpdateFullName:string; lastUpdateFullName: string;
name:string; name: string;
shortName:string; shortName: string;
level:string; level: string;
isActive:string; isActive: string;
note:string; note: string;
insigniaTypeId:string; insigniaTypeId: string;
} }
interface ResFileData { interface ResFileData {
@ -118,6 +118,10 @@ interface ResFileData {
path: string; path: string;
pathname: string; pathname: string;
} }
interface DataHistory {
[key: string]: string | number | Date | boolean;
}
export type { export type {
Pagination, Pagination,
DataOption, DataOption,
@ -132,8 +136,8 @@ export type {
DataOptionEducation, DataOptionEducation,
DataOptionEducationLevel, DataOptionEducationLevel,
Request, Request,
InsigniasType, InsigniasType,
InsigniasTypeSub, InsigniasTypeSub,
ResFileData ResFileData,
DataHistory,
}; };

View file

@ -3,8 +3,6 @@ interface RequestItemsObject {
detail: string; detail: string;
remark: string; remark: string;
reference: string; reference: string;
dateStart: Date | null;
dateEnd: Date | null;
profileId: string; profileId: string;
} }

View file

@ -2,7 +2,6 @@
import { onBeforeMount, onMounted, ref } from "vue"; import { onBeforeMount, onMounted, ref } from "vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store"; import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
import TabInformation from "@/modules/04_registryPerson/components/requestEdit/01_TabInformation.vue"; import TabInformation from "@/modules/04_registryPerson/components/requestEdit/01_TabInformation.vue";
@ -18,9 +17,8 @@ const isEmployee = ref<boolean>(
); );
onBeforeMount(async () => { onBeforeMount(async () => {
isIDP.value = await (route.name?.toString() == "registryNewRequestEditEMP" isIDP.value =
? false route.name?.toString() == "registryNewRequestEditEMP" ? false : true;
: true);
}); });
onMounted(() => { onMounted(() => {

View file

@ -36,6 +36,7 @@ const {
success, success,
dialogConfirm, dialogConfirm,
dialogRemove, dialogRemove,
convertDateToAPI,
} = mixin; } = mixin;
/** ตัวแปร */ /** ตัวแปร */
@ -353,9 +354,8 @@ function onSubmitConditions() {
function onSubmitAttached() { function onSubmitAttached() {
dialogConfirm($q, () => { dialogConfirm($q, () => {
const formData = new FormData(); const formData = new FormData();
const send = date.value !== null ? new Date(date.value).toUTCString() : ""; const send = convertDateToAPI(date.value) ?? "";
const activeDate = const activeDate = convertDateToAPI(dateLeave.value) ?? "";
dateLeave.value !== null ? new Date(dateLeave.value).toUTCString() : "";
formData.append("Location", location.value); formData.append("Location", location.value);
formData.append("SendDate", send); formData.append("SendDate", send);
formData.append("ActiveDate", activeDate); formData.append("ActiveDate", activeDate);

View file

@ -30,6 +30,7 @@ const {
hideLoader, hideLoader,
success, success,
findOrgName, findOrgName,
convertDateToAPI,
} = mixin; } = mixin;
/** /**
@ -129,7 +130,7 @@ async function onSubmit() {
amountOld: salary.value.toString().replace(/,/g, ""), amountOld: salary.value.toString().replace(/,/g, ""),
organization: organization.value, organization: organization.value,
reason: reason.value, reason: reason.value,
date: date.value, date: convertDateToAPI(date.value),
}; };
showLoader(); showLoader();
await http await http

View file

@ -46,6 +46,7 @@ const {
hideLoader, hideLoader,
showLoader, showLoader,
downloadRenameFileByLink, downloadRenameFileByLink,
convertDateToAPI,
} = mixin; } = mixin;
const { filterSelector } = complainstStore; // function store complainstStore const { filterSelector } = complainstStore; // function store complainstStore
@ -133,7 +134,12 @@ function onSubmit() {
if (mainStore.rowsAdd) { if (mainStore.rowsAdd) {
formData.persons = await mainStore.rowsAdd; formData.persons = await mainStore.rowsAdd;
} }
await props.onSubmit(formData); await props.onSubmit({
...formData,
dateConsideration: convertDateToAPI(formData.dateConsideration),
dateNotification: convertDateToAPI(formData.dateNotification),
dateReceived: convertDateToAPI(formData.dateReceived),
});
isSave.value = false; isSave.value = false;
}); });
} }

View file

@ -49,6 +49,7 @@ const {
messageError, messageError,
dialogRemove, dialogRemove,
downloadRenameFileByLink, downloadRenameFileByLink,
convertDateToAPI,
} = mixin; } = mixin;
const investigateDis = useInvestigateDisStore(); const investigateDis = useInvestigateDisStore();
const countNum = ref<number>(1); const countNum = ref<number>(1);
@ -167,25 +168,18 @@ const calendarModalclose = () => (calendarModal.value = !calendarModal.value);
function onSubmit() { function onSubmit() {
countNum.value = 1; countNum.value = 1;
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
if (
formData.investigationDateStart !== null &&
formData.investigationDateEnd !== null
) {
const investigationDateStart = new Date(formData.investigationDateStart);
const investigationDateEnd = new Date(formData.investigationDateEnd);
formData.investigationDateStart = moment(investigationDateStart).format(
"YYYY-MM-DD"
);
formData.investigationDateEnd =
moment(investigationDateEnd).format("YYYY-MM-DD");
}
if (mainStore.rowsAdd) { if (mainStore.rowsAdd) {
formData.persons = mainStore.rowsAdd; formData.persons = mainStore.rowsAdd;
} }
props.onSubmit({
props.onSubmit(formData); ...formData,
investigationDateStart: convertDateToAPI(
formData.investigationDateStart as Date
),
investigationDateEnd: convertDateToAPI(
formData.investigationDateEnd as Date
),
});
isSave.value = false; isSave.value = false;
investigationExtendStatus.value = false; investigationExtendStatus.value = false;
}); });

View file

@ -47,6 +47,7 @@ const {
dialogConfirm, dialogConfirm,
messageError, messageError,
success, success,
convertDateToAPI,
} = mixin; } = mixin;
const modalPersonal = ref<boolean>(false); const modalPersonal = ref<boolean>(false);
@ -200,25 +201,29 @@ async function calEndDate(val: string) {
*/ */
function onSubmit() { function onSubmit() {
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
if (
formData.disciplinaryDateStart !== null &&
formData.disciplinaryDateEnd !== null
) {
const disciplinaryDateStart = new Date(formData.disciplinaryDateStart);
const disciplinaryDateEnd = new Date(formData.disciplinaryDateEnd);
formData.disciplinaryDateStart = moment(disciplinaryDateStart).format(
"YYYY-MM-DD"
);
formData.disciplinaryDateEnd =
moment(disciplinaryDateEnd).format("YYYY-MM-DD");
}
if (mainStore.rowsAdd) { if (mainStore.rowsAdd) {
formData.persons = mainStore.rowsAdd as any; formData.persons = mainStore.rowsAdd as any;
} }
emit("submit:disciplinary", formData); emit("submit:disciplinary", {
...formData,
disciplinaryDateStart: convertDateToAPI(
formData.disciplinaryDateStart as Date
),
disciplinaryDateEnd: convertDateToAPI(
formData.disciplinaryDateEnd as Date
),
disciplinaryDateAllegation: convertDateToAPI(
formData.disciplinaryDateAllegation
),
disciplinaryDateEvident: convertDateToAPI(
formData.disciplinaryDateEvident
),
disciplinaryDateInvestigation: convertDateToAPI(
formData.disciplinaryDateInvestigation
),
disciplinaryDateResult: convertDateToAPI(formData.disciplinaryDateResult),
});
isSave.value = false; isSave.value = false;
isSaveInfo.value = false; isSaveInfo.value = false;
extendStatus.value = false; extendStatus.value = false;

View file

@ -11,7 +11,7 @@ import { useDisciplineSuspendStore } from "@/modules/11_discipline/store/Suspend
/**Import type */ /**Import type */
import type { QForm } from "quasar"; import type { QForm } from "quasar";
import type { DataDetail } from "@/modules/11_discipline/interface/response/Suspend"; import type { DataDetail } from "@/modules/11_discipline/interface/response/suspend";
import type { DataProfile } from "@/modules/05_placement/interface/index/Main"; import type { DataProfile } from "@/modules/05_placement/interface/index/Main";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue"; import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
@ -36,6 +36,7 @@ const {
showLoader, showLoader,
hideLoader, hideLoader,
success, success,
convertDateToAPI,
} = mixin; } = mixin;
/** /**
@ -208,8 +209,8 @@ async function saveData() {
positionLevel: data.positionLevel, positionLevel: data.positionLevel,
salary: data.salary, salary: data.salary,
descriptionSuspend: data.descriptionSuspend, descriptionSuspend: data.descriptionSuspend,
startDateSuspend: data.startDateSuspend, startDateSuspend: convertDateToAPI(data.startDateSuspend),
endDateSuspend: data.endDateSuspend, endDateSuspend: convertDateToAPI(data.endDateSuspend),
}; };
showLoader(); showLoader();
await http await http

View file

@ -85,12 +85,8 @@ function onSubmit(formData: FormData) {
.put(config.API.meetingById(personalId.value), { .put(config.API.meetingById(personalId.value), {
round: formData.rounded ?? "", round: formData.rounded ?? "",
title: formData.title, title: formData.title,
dateStart: formData.dateMeetingStart dateStart: formData.dateMeetingStart,
? dateToISO(formData.dateMeetingStart) dateEnd: formData.dateMeetingEnd,
: null,
dateEnd: formData.dateMeetingEnd
? dateToISO(formData.dateMeetingEnd)
: null,
result: formData.consider, result: formData.consider,
duration: formData.period, duration: formData.period,
}) })

View file

@ -24,6 +24,7 @@ const {
date2Thai, date2Thai,
hideLoader, hideLoader,
dialogRemove, dialogRemove,
convertDatetimeToAPI,
} = useCounterMixin(); } = useCounterMixin();
/** /**
@ -62,7 +63,11 @@ const fileDataDownload = ref<any>([]); ///รายการเอกสาร
/** บันทึกข้อมูล */ /** บันทึกข้อมูล */
function submit() { function submit() {
props.onSubmit(formData); props.onSubmit({
...formData,
dateMeetingStart: convertDatetimeToAPI(formData.dateMeetingStart),
dateMeetingEnd: convertDatetimeToAPI(formData.dateMeetingEnd),
});
} }
/** /**

View file

@ -187,7 +187,11 @@ function onSubmit() {
? config.API.kpiPeriodById("12") ? config.API.kpiPeriodById("12")
: config.API.kpiPeriod; : config.API.kpiPeriod;
const method = isStatusEdit.value ? "put" : "post"; const method = isStatusEdit.value ? "put" : "post";
await http[method](url, formData); await http[method](url, {
...formData,
startDate: formData.startDate,
endDate: formData.endDate,
});
await fetchList(); await fetchList();
await success($q, "บันทึกข้อมูลสำเร็จ"); await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog(); closeDialog();

View file

@ -23,7 +23,7 @@ const $q = useQuasar();
const store = useDevelopmentDataStore(); const store = useDevelopmentDataStore();
const route = useRoute(); const route = useRoute();
const itemsDevelopment = uselistDevelopmentDataStore(); const itemsDevelopment = uselistDevelopmentDataStore();
const { showLoader, hideLoader, messageError, date2Thai, diffDay, success } = const { showLoader, hideLoader, messageError, date2Thai, diffDay, success,convertDateToAPI } =
useCounterMixin(); useCounterMixin();
const isChangeData = defineModel<boolean>("isChangeData", { required: true }); const isChangeData = defineModel<boolean>("isChangeData", { required: true });
@ -247,6 +247,8 @@ async function onSubmit() {
await http await http
.put(config.API.developmentMainTab("tab3", projectId.value), { .put(config.API.developmentMainTab("tab3", projectId.value), {
...formData, ...formData,
dateEnd:convertDateToAPI(formData.dateEnd),
dateStart:convertDateToAPI(formData.dateStart),
totalDate: formData.totalDate === "" ? null : formData.totalDate, totalDate: formData.totalDate === "" ? null : formData.totalDate,
projectDayBackPlanned: projectDayBackPlanned:
formData.projectDayBackPlanned === "" formData.projectDayBackPlanned === ""

View file

@ -29,6 +29,7 @@ const {
success, success,
date2Thai, date2Thai,
calculateDurationYmd, calculateDurationYmd,
convertDateToAPI,
} = useCounterMixin(); } = useCounterMixin();
const checkRouteDetail = ref<boolean>( const checkRouteDetail = ref<boolean>(
@ -298,12 +299,26 @@ function onSubmit() {
formBody.reportBackDate = null; formBody.reportBackDate = null;
formBody.changeDetail = ""; formBody.changeDetail = "";
} }
try { try {
const url = scholarshipId.value const url = scholarshipId.value
? config.API.devScholarshipByid(scholarshipId.value) ? config.API.devScholarshipByid(scholarshipId.value)
: config.API.devScholarship; : config.API.devScholarship;
const method = scholarshipId.value ? "put" : "post"; const method = scholarshipId.value ? "put" : "post";
await http[method](url, formBody); await http[method](url, {
...formBody,
bookApproveDate: convertDateToAPI(formBody.bookApproveDate),
bookNoDate: convertDateToAPI(formBody.bookNoDate),
contractDate: convertDateToAPI(formBody.contractDate),
endDate: convertDateToAPI(formBody.endDate),
reportBackDate: convertDateToAPI(formBody.reportBackDate),
reportBackNoDate: convertDateToAPI(formBody.reportBackNoDate),
startDate: convertDateToAPI(formBody.startDate),
studyAbroadEndDate: convertDateToAPI(formBody.studyAbroadEndDate),
studyAbroadStartDate: convertDateToAPI(formBody.studyAbroadStartDate),
studyEndDate: convertDateToAPI(formBody.studyEndDate),
studyStartDate: convertDateToAPI(formBody.studyStartDate),
});
scholarshipId.value scholarshipId.value
? await fetchDataDetail(scholarshipId.value) ? await fetchDataDetail(scholarshipId.value)