Merge branch 'nice' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-04 15:16:11 +07:00
commit 60115401a0
26 changed files with 841 additions and 682 deletions

View file

@ -25,6 +25,7 @@ const {
success, success,
date2Thai, date2Thai,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
const id = ref<string>(route.params.id.toString()); const id = ref<string>(route.params.id.toString());
@ -44,6 +45,7 @@ const editId = ref<string>(""); //id ที่ต้องการแก้ไ
//Table Main //Table Main
const rows = ref<ResponseObject[]>([]); // const rows = ref<ResponseObject[]>([]); //
const rowsMain = ref<ResponseObject[]>([]); //
const keyword = ref<string>(""); // const keyword = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
@ -118,6 +120,8 @@ const pagination = ref({
//Table //Table
const historyRows = ref<ResponseObject[]>([]); // const historyRows = ref<ResponseObject[]>([]); //
const historyRowsMain = ref<ResponseObject[]>([]); //
const historyKeyword = ref<string>(""); // const historyKeyword = ref<string>(""); //
const historyColumns = ref<QTableProps["columns"]>([ const historyColumns = ref<QTableProps["columns"]>([
{ {
@ -224,9 +228,7 @@ const profesLicenseData = reactive<RequestItemsObject>({
profileId: id.value, profileId: id.value,
}); });
/** /** ยืนยันการบันทึกข้อมูล*/
* นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -238,31 +240,26 @@ function onSubmit() {
); );
} }
/** /** ปิด form ข้อมูลใบอนุญาตประกอบวิชาชีพ*/
* form อมลใบอนญาตประกอบวชาช
*/
function closeDialog() { function closeDialog() {
dialog.value = false; dialog.value = false;
} }
/** /** ปิด popup ประวัติการแก้ไขข้อมูลใบอนุญาตประกอบวิชาชีพ*/
* popup ประวการแกไขขอมลใบอนญาตประกอบวชาช
*/
function closeHistoryDialog() { function closeHistoryDialog() {
historyDialog.value = false; historyDialog.value = false;
historyRows.value = []; historyRows.value = [];
historyKeyword.value = ""; historyKeyword.value = "";
} }
/** /** fetch ข้อมูลรายการใบอนุญาตประกอบวิชาชีพ*/
* fetch อมลรายการใบอนญาตประกอบวชาช
*/
async function fetchData(id: string) { async function fetchData(id: string) {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewCertificateByProfileId(id, empType.value)) .get(config.API.profileNewCertificateByProfileId(id, empType.value))
.then(async (res) => { .then(async (res) => {
rows.value = await res.data.result; rows.value = await res.data.result;
rowsMain.value = await res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -272,9 +269,7 @@ async function fetchData(id: string) {
}); });
} }
/** /** เคลียร์ form ข้อมูลใบอนุญาตประกอบวิชาชีพ*/
* เคลยร form อมลใบอนญาตประกอบวชาช
*/
function clearForm() { function clearForm() {
profesLicenseData.expireDate = null; profesLicenseData.expireDate = null;
profesLicenseData.issueDate = new Date(); profesLicenseData.issueDate = new Date();
@ -349,15 +344,14 @@ function editData(idData: string) {
}); });
} }
/** /** fetch ข้อมูลประวัติการแก้ไขข้อมูลใบอนุญาตประกอบวิชาชีพ*/
* fetch อมลประวการแกไขขอมลใบอนญาตประกอบวชาช
*/
function fetchHistoryData(id: string) { function fetchHistoryData(id: string) {
showLoader(); showLoader();
http http
.get(config.API.profileNewCertificateHisByCertificateId(id, empType.value)) .get(config.API.profileNewCertificateHisByCertificateId(id, empType.value))
.then(async (res) => { .then(async (res) => {
historyRows.value = res.data.result; historyRows.value = res.data.result;
historyRowsMain.value = res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -367,6 +361,22 @@ function fetchHistoryData(id: string) {
}); });
} }
function serchDataTable() {
rows.value = onSearchDataTable(
keyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
function serchDataTableHistory() {
historyRows.value = onSearchDataTable(
historyKeyword.value,
historyRowsMain.value,
historyColumns.value ? historyColumns.value : []
);
}
/** /**
* ทำงานเม Components กเรยกใชงาน * ทำงานเม Components กเรยกใชงาน
*/ */
@ -394,7 +404,13 @@ onMounted(() => {
> >
<q-space /> <q-space />
<q-input dense outlined v-model="keyword" label="ค้นหา"> <q-input
dense
outlined
v-model="keyword"
label="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
</template> </template>
@ -456,7 +472,6 @@ onMounted(() => {
bordered bordered
:paging="true" :paging="true"
dense dense
:filter="keyword.trim()"
v-model:pagination="pagination" v-model:pagination="pagination"
:rows-per-page-options="[20, 50, 100]" :rows-per-page-options="[20, 50, 100]"
class="custom-header-table" class="custom-header-table"
@ -730,6 +745,7 @@ onMounted(() => {
bg-color="white" bg-color="white"
v-model="historyKeyword" v-model="historyKeyword"
label="ค้นหา" label="ค้นหา"
@keydown.enter.pervent="serchDataTableHistory"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -757,7 +773,6 @@ onMounted(() => {
:rows="historyRows" :rows="historyRows"
row-key="name" row-key="name"
flat flat
:filter="historyKeyword.trim()"
v-model:pagination="historyPagination" v-model:pagination="historyPagination"
bordered bordered
:paging="true" :paging="true"
@ -771,7 +786,6 @@ onMounted(() => {
<q-th v-for="col in props.cols" :key="col.name" :props="props"> <q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span> <span class="text-weight-medium">{{ col.label }}</span>
</q-th> </q-th>
<q-th auto-width />
</q-tr> </q-tr>
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">

View file

@ -13,9 +13,7 @@ import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/r
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Training"; import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Training";
import dialogHeader from "@/components/DialogHeader.vue"; import dialogHeader from "@/components/DialogHeader.vue";
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -31,6 +29,7 @@ const {
success, success,
date2Thai, date2Thai,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
const id = ref<string>(route.params.id.toString()); const id = ref<string>(route.params.id.toString());
@ -62,6 +61,7 @@ const trainData = reactive<RequestItemsObject>({
//Table Main //Table Main
const rows = ref<ResponseObject[]>([]); const rows = ref<ResponseObject[]>([]);
const rowsMain = ref<ResponseObject[]>([]);
const keyword = ref<string>(""); const keyword = ref<string>("");
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
@ -91,10 +91,12 @@ const columns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "วันเริ่มต้นการฝึกอบรม/ดูงาน", label: "วันเริ่มต้นการฝึกอบรม/ดูงาน",
sortable: true, sortable: true,
field: (v) => field: "startDate",
v.isDate format(val, row) {
? date2Thai(v.startDate) return row.isDate
: new Date(v.startDate).getFullYear() + 543, ? date2Thai(row.startDate)
: new Date(row.startDate).getFullYear() + 543;
},
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) =>
@ -105,8 +107,12 @@ const columns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "วันสิ้นสุดการฝึกอบรม/ดูงาน", label: "วันสิ้นสุดการฝึกอบรม/ดูงาน",
sortable: true, sortable: true,
field: (v) => field: "endDate",
v.isDate ? date2Thai(v.endDate) : new Date(v.endDate).getFullYear() + 543, format(val, row) {
return row.isDate
? date2Thai(row.endDate)
: new Date(row.endDate).getFullYear() + 543;
},
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) =>
@ -200,6 +206,7 @@ const pagination = ref({
//Table //Table
const historyRows = ref<ResponseObject[]>([]); const historyRows = ref<ResponseObject[]>([]);
const historyRowsMain = ref<ResponseObject[]>([]);
const historyKeyword = ref<string>(""); const historyKeyword = ref<string>("");
const historyColumns = ref<QTableProps["columns"]>([ const historyColumns = ref<QTableProps["columns"]>([
{ {
@ -229,10 +236,12 @@ const historyColumns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "วันเริ่มต้นการฝึกอบรม/ดูงาน", label: "วันเริ่มต้นการฝึกอบรม/ดูงาน",
sortable: true, sortable: true,
field: (v) => field: "startDate",
v.isDate format(val, row) {
? date2Thai(v.startDate) return row.isDate
: new Date(v.startDate).getFullYear() + 543, ? date2Thai(row.startDate)
: new Date(row.startDate).getFullYear() + 543;
},
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) =>
@ -243,8 +252,12 @@ const historyColumns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "วันสิ้นสุดการฝึกอบรม/ดูงาน", label: "วันสิ้นสุดการฝึกอบรม/ดูงาน",
sortable: true, sortable: true,
field: (v) => field: "endDate",
v.isDate ? date2Thai(v.endDate) : new Date(v.endDate).getFullYear() + 543, format(val, row) {
return row.isDate
? date2Thai(row.endDate)
: new Date(row.endDate).getFullYear() + 543;
},
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) =>
@ -361,9 +374,7 @@ const historyPagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** ยืนยันการบันทึกข้อมูล*/
* นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -375,9 +386,7 @@ function onSubmit() {
); );
} }
/** /** เคลียร์ form ฝึกอบรม/ดูงาน */
* เคลยร form กอบรม/งาน
*/
function clearForm() { function clearForm() {
isDate.value = "false"; isDate.value = "false";
trainData.name = ""; trainData.name = "";
@ -392,9 +401,7 @@ function clearForm() {
trainData.endDate = new Date(); trainData.endDate = new Date();
} }
/** /** เปิด popoup แก้ไขข้อมูลฝึกอบรม/ดูงาน */
* เป popoup แกไขขอมลฝกอบรม/งาน
*/
function editForm(row: any) { function editForm(row: any) {
dialogStatus.value = "edit"; dialogStatus.value = "edit";
editId.value = row.id; editId.value = row.id;
@ -414,9 +421,7 @@ function editForm(row: any) {
dialog.value = true; dialog.value = true;
} }
/** /** เพิ่มข้อมูลการฝึกอบรม/ดูงาน*/
* เพมขอมลการฝกอบรม/งาน
*/
function addData() { function addData() {
showLoader(); showLoader();
http http
@ -468,32 +473,27 @@ function editData(idData: string) {
}); });
} }
/** /** ปิด from การฝึกอบรม/ดูงาน*/
* from การฝกอบรม/งาน
*/
function closeDialog() { function closeDialog() {
dialog.value = false; dialog.value = false;
clearForm(); clearForm();
} }
/** /** ปิด ประวัติการแก่ไขการฝึกอบรม/ดูงาน */
* ประวการแกไขการฝกอบรม/งาน
*/
function closeHistoryDialog() { function closeHistoryDialog() {
historyDialog.value = false; historyDialog.value = false;
historyRows.value = []; historyRows.value = [];
historyKeyword.value = ""; historyKeyword.value = "";
} }
/** /** fetch รายการการฝึกอบรม/ดูงาน*/
* fetch รายการการฝกอบรม/งาน
*/
async function fetchData(id: string) { async function fetchData(id: string) {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewTrainingByProfileId(id, empType.value)) .get(config.API.profileNewTrainingByProfileId(id, empType.value))
.then(async (res) => { .then(async (res) => {
rows.value = await res.data.result; rows.value = await res.data.result;
rowsMain.value = await res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -503,15 +503,14 @@ async function fetchData(id: string) {
}); });
} }
/** /** fetch ประวัติรายการแก้ไขการฝึกอบรม/ดูงาน*/
* fetch ประวรายการแกไขการฝกอบรม/งาน
*/
function fetchHistoryData(id: string) { function fetchHistoryData(id: string) {
showLoader(); showLoader();
http http
.get(config.API.profileNewTrainingHisByTrainingId(id, empType.value)) .get(config.API.profileNewTrainingHisByTrainingId(id, empType.value))
.then((res) => { .then((res) => {
historyRows.value = res.data.result; historyRows.value = res.data.result;
historyRowsMain.value = res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -521,9 +520,23 @@ function fetchHistoryData(id: string) {
}); });
} }
/** function serchDataTable() {
* ทำงานเม Components กเรยกใชงาน rows.value = onSearchDataTable(
*/ keyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
function serchDataTableHistory() {
historyRows.value = onSearchDataTable(
historyKeyword.value,
historyRowsMain.value,
historyColumns.value ? historyColumns.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => { onMounted(() => {
fetchData(id.value); fetchData(id.value);
}); });
@ -550,7 +563,14 @@ onMounted(() => {
> >
<q-space /> <q-space />
<q-input dense outlined v-model="keyword" label="ค้นหา">
<q-input
dense
outlined
v-model="keyword"
label="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
</template> </template>
@ -612,7 +632,6 @@ onMounted(() => {
bordered bordered
:paging="true" :paging="true"
dense dense
:filter="keyword.trim()"
:rows-per-page-options="[20, 50, 100]" :rows-per-page-options="[20, 50, 100]"
v-model:pagination="pagination" v-model:pagination="pagination"
class="custom-header-table" class="custom-header-table"
@ -1114,6 +1133,7 @@ onMounted(() => {
bg-color="white" bg-color="white"
v-model="historyKeyword" v-model="historyKeyword"
label="ค้นหา" label="ค้นหา"
@keydown.enter.pervent="serchDataTableHistory"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -1141,7 +1161,6 @@ onMounted(() => {
:rows="historyRows" :rows="historyRows"
row-key="name" row-key="name"
flat flat
:filter="historyKeyword.trim()"
v-model:pagination="historyPagination" v-model:pagination="historyPagination"
bordered bordered
:paging="true" :paging="true"
@ -1155,7 +1174,6 @@ onMounted(() => {
<q-th v-for="col in props.cols" :key="col.name" :props="props"> <q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span> <span class="text-weight-medium">{{ col.label }}</span>
</q-th> </q-th>
<q-th auto-width />
</q-tr> </q-tr>
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">

View file

@ -33,11 +33,10 @@ const {
messageError, messageError,
dialogConfirm, dialogConfirm,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -82,7 +81,8 @@ const Ops = ref<InsigniaOps>({
//Table Main //Table Main
const rows = ref<ResponseObject[]>([]); const rows = ref<ResponseObject[]>([]);
const filterSearch = ref(""); const rowsMain = ref<ResponseObject[]>([]);
const filterSearch = ref<string>("");
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "year", name: "year",
@ -123,7 +123,10 @@ const columns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "ลำดับชั้น", label: "ลำดับชั้น",
sortable: true, sortable: true,
field: (v) => v.insignia.insigniaType.name, field: "insigniaType",
format(val, row) {
return row.insignia.insigniaType.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) =>
@ -265,6 +268,7 @@ const pagination = ref({
//Table //Table
const rowsHistory = ref<RequestItemsObject[]>([]); const rowsHistory = ref<RequestItemsObject[]>([]);
const rowsHistoryMain = ref<RequestItemsObject[]>([]);
const filterHistory = ref<string>(""); const filterHistory = ref<string>("");
const columnsHistory = ref<QTableProps["columns"]>([ const columnsHistory = ref<QTableProps["columns"]>([
{ {
@ -306,7 +310,10 @@ const columnsHistory = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "ลำดับชั้น", label: "ลำดับชั้น",
sortable: true, sortable: true,
field: (v) => v.insignia.insigniaType.name, field: "insigniaType",
format(val, row) {
return row.insignia.insigniaType.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) =>
@ -459,9 +466,7 @@ const historyPagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** fetch ข้อมูลรายการเครื่องราชอิสริยาภรณ์*/
* fetch อมลรายการเครองราชอสรยาภรณ
*/
async function fetchData() { async function fetchData() {
if (!profileId.value) return; if (!profileId.value) return;
showLoader(); showLoader();
@ -470,6 +475,7 @@ async function fetchData() {
config.API.profileNewInsignByProfileId(profileId.value, empType.value) config.API.profileNewInsignByProfileId(profileId.value, empType.value)
); );
rows.value = res.data.result; rows.value = res.data.result;
rowsMain.value = res.data.result;
} catch (error) { } catch (error) {
messageError($q, error); messageError($q, error);
} finally { } finally {
@ -477,9 +483,7 @@ async function fetchData() {
} }
} }
/** /** fetch ข้อมูลเครื่องราชอิสริยาภรณ์*/
* fetch อมลเครองราชอสรยาภรณ
*/
async function fetchInsignia() { async function fetchInsignia() {
showLoader(); showLoader();
try { try {
@ -523,9 +527,7 @@ async function addEditData(editStatus: boolean = false) {
} }
} }
/** /** เปิด form ข้อมูลเครื่องราชอิสริยาภรณ์*/
* เป form อมลเครองราชอสรยาภรณ
*/
function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) { function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
modal.value = true; modal.value = true;
isEdit.value = editStatus; isEdit.value = editStatus;
@ -551,17 +553,13 @@ function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
} }
} }
/** /** ปิด form ข้อมูลเครื่องราชอิสริยาภรณ์*/
* form อมลเครองราชอสรยาภรณ
*/
function clickClose() { function clickClose() {
clearData(); clearData();
modal.value = false; modal.value = false;
} }
/** /** fetch ช้อมูลประวัติการแก้ไขรายการข้อมูลเครื่องราชอิสริยาภรณ์ */
* fetch อมลประวการแกไขรายการขอมลเครองราชอสรยาภรณ
*/
async function clickHistory(row: ResponseObject) { async function clickHistory(row: ResponseObject) {
modalHistory.value = true; modalHistory.value = true;
filterSearch.value = ""; filterSearch.value = "";
@ -571,6 +569,7 @@ async function clickHistory(row: ResponseObject) {
config.API.profileNewInsignHisById(row.id, empType.value) config.API.profileNewInsignHisById(row.id, empType.value)
); );
rowsHistory.value = res.data.result; rowsHistory.value = res.data.result;
rowsHistoryMain.value = res.data.result;
} catch (e) { } catch (e) {
messageError($q, e); messageError($q, e);
} finally { } finally {
@ -578,9 +577,7 @@ async function clickHistory(row: ResponseObject) {
} }
} }
/** /** ยืนยีนการบันทึกข้อมูล*/
* นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -612,9 +609,7 @@ function filterSelector(val: string, update: Function, refData: string) {
} }
} }
/** /** ค้นหาลำดับชั้น*/
* นหาลำดบช
*/
function insigniaTypeSelection() { function insigniaTypeSelection() {
const insigniaTypeFilter = Ops.value.insigniaOptions.filter( const insigniaTypeFilter = Ops.value.insigniaOptions.filter(
(r: DataOptionInsignia) => r.id === insigniaForm.insigniaId (r: DataOptionInsignia) => r.id === insigniaForm.insigniaId
@ -624,9 +619,7 @@ function insigniaTypeSelection() {
} }
} }
/** /** เคลียร์ formData*/
* เคลยร formDฟta
*/
function clearData() { function clearData() {
id.value = ""; id.value = "";
(insigniaType.value = ""), (insigniaForm.year = 0); (insigniaType.value = ""), (insigniaForm.year = 0);
@ -644,9 +637,23 @@ function clearData() {
insigniaForm.note = ""; insigniaForm.note = "";
} }
/** function serchDataTable() {
* ทำงานเม Components กเรยกใชงาน rows.value = onSearchDataTable(
*/ filterSearch.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
function serchDataTableHistory() {
rowsHistory.value = onSearchDataTable(
filterHistory.value,
rowsHistoryMain.value,
columnsHistory.value ? columnsHistory.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(async () => { onMounted(async () => {
await fetchData(); await fetchData();
store.insigniaOption.length === 0 ? await fetchInsignia() : ""; store.insigniaOption.length === 0 ? await fetchInsignia() : "";
@ -677,7 +684,7 @@ onMounted(async () => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -736,7 +743,6 @@ onMounted(async () => {
:rows="rows" :rows="rows"
:paging="true" :paging="true"
:columns="columns" :columns="columns"
:filter="filterSearch.trim()"
v-model:pagination="pagination" v-model:pagination="pagination"
:grid="modeView === 'card'" :grid="modeView === 'card'"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
@ -1180,7 +1186,7 @@ onMounted(async () => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTableHistory"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -1211,7 +1217,6 @@ onMounted(async () => {
:paging="true" :paging="true"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumnsHistory" :visible-columns="visibleColumnsHistory"
:filter="filterHistory.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -25,6 +25,7 @@ const {
hideLoader, hideLoader,
dialogConfirm, dialogConfirm,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
const profileId = ref<string>( const profileId = ref<string>(
@ -32,9 +33,7 @@ const profileId = ref<string>(
); );
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -57,17 +56,20 @@ const modalHistory = ref<boolean>(false); //แสดง popup ประวั
//Table Main //Table Main
const rows = ref<ResponseObject[]>([]); const rows = ref<ResponseObject[]>([]);
const filterSearch = ref(""); const rowsMain = ref<ResponseObject[]>([]);
const filterSearch = ref<string>("");
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "issueDate", name: "issueDate",
align: "left", align: "left",
label: "วันที่ได้รับ", label: "วันที่ได้รับ",
sortable: true, sortable: true,
field: (v) => field: "issueDate",
v.isDate format(val, row) {
? date2Thai(v.issueDate) return row.isDate
: new Date(v.issueDate).getFullYear() + 543, ? date2Thai(row.issueDate)
: new Date(row.issueDate).getFullYear() + 543;
},
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
@ -131,6 +133,7 @@ const pagination = ref({
//Table //Table
const rowsHistory = ref<ResponseObject[]>([]); const rowsHistory = ref<ResponseObject[]>([]);
const rowsHistoryMain = ref<ResponseObject[]>([]);
const filterHistory = ref<string>(""); const filterHistory = ref<string>("");
const columnsHistory = ref<QTableProps["columns"]>([ const columnsHistory = ref<QTableProps["columns"]>([
{ {
@ -138,10 +141,12 @@ const columnsHistory = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "วันที่ได้รับ", label: "วันที่ได้รับ",
sortable: true, sortable: true,
field: (v) => field: "issueDate",
v.isDate format(val, row) {
? date2Thai(v.issueDate) return row.isDate
: new Date(v.issueDate).getFullYear() + 543, ? date2Thai(row.issueDate)
: new Date(row.issueDate).getFullYear() + 543;
},
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
@ -228,9 +233,7 @@ const historyPagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** fetch รายการข้อมูลประกาศเกียรติคุณ*/
* fetch รายการขอมลประกาศเกยรต
*/
async function fetchData() { async function fetchData() {
if (!profileId.value) return; if (!profileId.value) return;
@ -240,6 +243,7 @@ async function fetchData() {
config.API.profileNewHonorByProfileId(profileId.value, empType.value) config.API.profileNewHonorByProfileId(profileId.value, empType.value)
); );
rows.value = res.data.result; rows.value = res.data.result;
rowsMain.value = res.data.result;
} catch (error) { } catch (error) {
messageError($q, error); messageError($q, error);
} finally { } finally {
@ -284,9 +288,7 @@ async function addEditData(editStatus: boolean = false) {
} }
} }
/** /** เปิด form ข้อมูลประกาศเกียรติคุณ*/
* เป form อมลประกาศเกยรต
*/
function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) { function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
modal.value = true; modal.value = true;
isEdit.value = editStatus; isEdit.value = editStatus;
@ -306,27 +308,23 @@ function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
} }
} }
/** /** ปิด form ข้อมูลประกาศเกียรติคุณ*/
* form อมลประกาศเกยรต
*/
async function clickClose() { async function clickClose() {
clearData(); clearData();
modal.value = false; modal.value = false;
} }
/** /** fetch ช้อมูลประวัติการแก้ไขรายการข้อมูลประกาศเกียรติคุณ*/
* fetch อมลประวการแกไขรายการขอมลประกาศเกยรต
*/
async function clickHistory(row: ResponseObject) { async function clickHistory(row: ResponseObject) {
modalHistory.value = true; modalHistory.value = true;
filterSearch.value = ""; filterSearch.value = "";
showLoader(); showLoader();
try { try {
const res = await http.get( const res = await http.get(
config.API.profileNewHonorHisById(row.id, empType.value) config.API.profileNewHonorHisById(row.id, empType.value)
); );
rowsHistory.value = res.data.result; rowsHistory.value = res.data.result;
rowsHistoryMain.value = res.data.result;
} catch (e) { } catch (e) {
messageError($q, e); messageError($q, e);
} finally { } finally {
@ -334,9 +332,7 @@ async function clickHistory(row: ResponseObject) {
} }
} }
/** /** ยืนยีนการบันทึกข้อมูล*/
* นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -348,9 +344,7 @@ function onSubmit() {
); );
} }
/** /** เคลียร์ formDฟta*/
* เคลยร formDฟta
*/
function clearData() { function clearData() {
id.value = ""; id.value = "";
issueDateYear.value = new Date().getFullYear(); issueDateYear.value = new Date().getFullYear();
@ -362,9 +356,23 @@ function clearData() {
declHonorForm.isDate = "false"; declHonorForm.isDate = "false";
} }
/** function serchDataTable() {
* ทำงานเม Components กเรยกใชงาน rows.value = onSearchDataTable(
*/ filterSearch.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
function serchDataTableHistory() {
rowsHistory.value = onSearchDataTable(
filterHistory.value,
rowsHistoryMain.value,
columnsHistory.value ? columnsHistory.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => { onMounted(() => {
fetchData(); fetchData();
}); });
@ -390,7 +398,7 @@ onMounted(() => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -449,7 +457,6 @@ onMounted(() => {
:rows="rows" :rows="rows"
:paging="true" :paging="true"
:columns="columns" :columns="columns"
:filter="filterSearch.trim()"
:grid="modeView === 'card'" :grid="modeView === 'card'"
v-model:pagination="pagination" v-model:pagination="pagination"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
@ -785,7 +792,7 @@ onMounted(() => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTableHistory"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -816,7 +823,6 @@ onMounted(() => {
v-model:pagination="historyPagination" v-model:pagination="historyPagination"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumnsHistory" :visible-columns="visibleColumnsHistory"
:filter="filterHistory.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -29,6 +29,7 @@ const {
hideLoader, hideLoader,
dialogConfirm, dialogConfirm,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
const profileId = ref<string>( const profileId = ref<string>(
@ -46,9 +47,7 @@ const modeViewPlan = ref<string>("table"); //การแสดงผล Table,C
const modalHistory = ref<boolean>(false); // popup const modalHistory = ref<boolean>(false); // popup
const kpiDevelopmentId = ref<string>(""); // id const kpiDevelopmentId = ref<string>(""); // id
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -75,6 +74,7 @@ const resPerformForm = reactive<RequestItemsObject>({
//Table //Table
const rows = ref<ResponseObject[]>([]); const rows = ref<ResponseObject[]>([]);
const rowsMain = ref<ResponseObject[]>([]);
const filterSearch = ref<string>(""); const filterSearch = ref<string>("");
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
@ -158,7 +158,10 @@ const columns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "ผลประเมิน", label: "ผลประเมิน",
sortable: true, sortable: true,
field: (v) => `${textPoint(v.pointSum)} ${textRangePoint(v.pointSum)}`, field: "name",
format(val, row) {
return `${textPoint(row.pointSum)} ${textRangePoint(row.pointSum)}`;
},
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) =>
@ -261,6 +264,7 @@ const visibleColumnsPlan = ref<String[]>([
//Table //Table
const rowsHistory = ref<ResponseObject[]>([]); const rowsHistory = ref<ResponseObject[]>([]);
const rowsHistoryMain = ref<ResponseObject[]>([]);
const filterHistory = ref<string>(""); const filterHistory = ref<string>("");
const columnsHistory = ref<QTableProps["columns"]>([ const columnsHistory = ref<QTableProps["columns"]>([
{ {
@ -342,7 +346,10 @@ const columnsHistory = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "ผลประเมิน", label: "ผลประเมิน",
sortable: true, sortable: true,
field: (v) => `${textPoint(v.pointSum)} ${textRangePoint(v.pointSum)}`, field: "name",
format(val, row) {
return `${textPoint(row.pointSum)} ${textRangePoint(row.pointSum)}`;
},
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) =>
@ -389,9 +396,7 @@ const historyPagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** fetch รายการข้อมูลผลการประเมินการปฏิบัติราชการ*/
* fetch รายการขอมลผลการประเมนการปฏราชการ
*/
async function fetchData() { async function fetchData() {
if (!profileId.value) return; if (!profileId.value) return;
showLoader(); showLoader();
@ -403,6 +408,7 @@ async function fetchData() {
) )
); );
rows.value = res.data.result; rows.value = res.data.result;
rowsMain.value = res.data.result;
} catch (error) { } catch (error) {
messageError($q, error); messageError($q, error);
hideLoader(); hideLoader();
@ -410,9 +416,7 @@ async function fetchData() {
} }
} }
/** /** fetch รายการการพัฒนารายบุคคล (Individual Development Plan)*/
* fetch รายการการพฒนารายบคคล (Individual Development Plan)
*/
async function getDevelop(isLoad?: boolean) { async function getDevelop(isLoad?: boolean) {
if (!profileId.value) return; if (!profileId.value) return;
isLoad && showLoader(); isLoad && showLoader();
@ -473,9 +477,7 @@ async function addEditData(editStatus: boolean = false) {
} }
} }
/** /** เปิด form ข้อมูลผลการประเมินการปฏิบัติราชการ*/
* เป form อมลผลการประเมนการปฏราชการ
*/
function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) { function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
modal.value = true; modal.value = true;
isEdit.value = editStatus; isEdit.value = editStatus;
@ -494,17 +496,13 @@ function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
} }
} }
/** /** ปิด form ข้อมูลผลการประเมินการปฏิบัติราชการ*/
* form อมลผลการประเมนการปฏราชการ
*/
async function clickClose() { async function clickClose() {
clearData(); clearData();
modal.value = false; modal.value = false;
} }
/** /** fetch ช้อมูลประวัติการแก้ไขรายการข้อมูลผลการประเมินการปฏิบัติราชการ*/
* fetch อมลประวการแกไขรายการขอมลผลการประเมนการปฏราชการ
*/
async function clickHistory(row: ResponseObject) { async function clickHistory(row: ResponseObject) {
modalHistory.value = true; modalHistory.value = true;
filterSearch.value = ""; filterSearch.value = "";
@ -515,6 +513,7 @@ async function clickHistory(row: ResponseObject) {
); );
rowsHistory.value = res.data.result; rowsHistory.value = res.data.result;
rowsHistoryMain.value = res.data.result;
} catch (e) { } catch (e) {
messageError($q, e); messageError($q, e);
} finally { } finally {
@ -522,9 +521,7 @@ async function clickHistory(row: ResponseObject) {
} }
} }
/** /** ยืนยีนการบันทึกข้อมูล*/
* นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -536,9 +533,7 @@ function onSubmit() {
); );
} }
/** /** เคลียร์ formDฟta */
* เคลยร formDฟta
*/
function clearData() { function clearData() {
(id.value = ""), (id.value = ""),
(resPerformForm.name = ""), (resPerformForm.name = ""),
@ -565,6 +560,22 @@ function updatePaginationIdp(newPagination: any) {
paginationIdp.value.rowsPerPage = newPagination.rowsPerPage; paginationIdp.value.rowsPerPage = newPagination.rowsPerPage;
} }
function serchDataTable() {
rows.value = onSearchDataTable(
filterSearch.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
function serchDataTableHistory() {
rowsHistory.value = onSearchDataTable(
filterHistory.value,
rowsHistoryMain.value,
columnsHistory.value ? columnsHistory.value : []
);
}
watch( watch(
() => paginationIdp.value.rowsPerPage, () => paginationIdp.value.rowsPerPage,
async () => { async () => {
@ -608,7 +619,7 @@ onMounted(async () => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -669,7 +680,6 @@ onMounted(async () => {
:rows="rows" :rows="rows"
:paging="true" :paging="true"
:columns="columns" :columns="columns"
:filter="filterSearch.trim()"
v-model:pagination="pagination" v-model:pagination="pagination"
:grid="modeView === 'card'" :grid="modeView === 'card'"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
@ -1208,7 +1218,7 @@ onMounted(async () => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTableHistory"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -1239,7 +1249,6 @@ onMounted(async () => {
:paging="true" :paging="true"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumnsHistory" :visible-columns="visibleColumnsHistory"
:filter="filterHistory.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -27,15 +27,14 @@ const {
date2Thai, date2Thai,
messageError, messageError,
dialogConfirm, dialogConfirm,
onSearchDataTable,
} = useCounterMixin(); } = useCounterMixin();
const profileId = ref<string>( const profileId = ref<string>(
route.params.id ? route.params.id.toString() : "" route.params.id ? route.params.id.toString() : ""
); );
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -69,7 +68,7 @@ const formData = reactive<FormEmployee>({
}); });
/** function fetch ข้อมูลลูกจ้างชั่วคราว*/ /** function fetch ข้อมูลลูกจ้างชั่วคราว*/
function fetchData() { async function fetchData() {
showLoader(); showLoader();
http http
.get(config.API.informationEmployee(profileId.value)) .get(config.API.informationEmployee(profileId.value))
@ -148,6 +147,7 @@ function onSubmit() {
const modalHistory = ref<boolean>(false); const modalHistory = ref<boolean>(false);
const filter = ref<string>(""); const filter = ref<string>("");
const rows = ref<EmployeeHistory[]>([]); const rows = ref<EmployeeHistory[]>([]);
const rowsMain = ref<EmployeeHistory[]>([]);
const columns = ref<QTableColumn[]>([ const columns = ref<QTableColumn[]>([
{ {
name: "positionEmployeeGroupId", name: "positionEmployeeGroupId",
@ -286,6 +286,7 @@ function onClickHistory() {
new Date(b.lastUpdatedAt).getTime() - new Date(b.lastUpdatedAt).getTime() -
new Date(a.lastUpdatedAt).getTime() new Date(a.lastUpdatedAt).getTime()
); );
rowsMain.value = rows.value;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -295,6 +296,14 @@ function onClickHistory() {
}); });
} }
function serchDataTable() {
rows.value = onSearchDataTable(
filter.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
onMounted(() => { onMounted(() => {
profileId.value && fetchData(); profileId.value && fetchData();
}); });
@ -593,7 +602,7 @@ onMounted(() => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -623,7 +632,6 @@ onMounted(() => {
:rows="rows" :rows="rows"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:filter="filter.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -27,19 +27,19 @@ const {
messageError, messageError,
hideLoader, hideLoader,
showLoader, showLoader,
onSearchDataTable,
} = useCounterMixin(); } = useCounterMixin();
const profileId = ref<string>(route.params.id.toString()); const profileId = ref<string>(route.params.id.toString());
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
/** ข้อมูลการจ้าง*/ /** ข้อมูลการจ้าง*/
const rows = ref<Employment[]>([]); const rows = ref<Employment[]>([]);
const rowsMain = ref<Employment[]>([]);
const filter = ref<string>(""); const filter = ref<string>("");
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
@ -103,6 +103,7 @@ async function fetchListEmployment() {
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rows.value = data; rows.value = data;
rowsMain.value = data;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -201,6 +202,7 @@ function onDeleteEmployment(id: string) {
/** ประวัติข้อมูลการจ้าง*/ /** ประวัติข้อมูลการจ้าง*/
const modalHistory = ref<boolean>(false); const modalHistory = ref<boolean>(false);
const rowsHistory = ref<EmploymentHistory[]>([]); const rowsHistory = ref<EmploymentHistory[]>([]);
const rowsHistoryMain = ref<EmploymentHistory[]>([]);
const filterHistory = ref<string>(""); const filterHistory = ref<string>("");
/** /**
@ -215,6 +217,7 @@ function onClickHistory(id: string) {
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
rowsHistory.value = data; rowsHistory.value = data;
rowsHistoryMain.value = data;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -224,6 +227,22 @@ function onClickHistory(id: string) {
}); });
} }
function serchDataTable() {
rows.value = onSearchDataTable(
filter.value,
rowsMain.value,
columns.value ? columns.value.slice(0, 2) : []
);
}
function serchDataTableHistory() {
rowsHistory.value = onSearchDataTable(
filterHistory.value,
rowsHistoryMain.value,
columns.value ? columns.value : []
);
}
onMounted(() => { onMounted(() => {
profileId.value && fetchListEmployment(); profileId.value && fetchListEmployment();
}); });
@ -247,7 +266,13 @@ onMounted(() => {
<q-space /> <q-space />
<div class="q-gutter-sm" style="display: flex"> <div class="q-gutter-sm" style="display: flex">
<q-input outlined dense v-model="filter" label="ค้นหา" debounce="300"> <q-input
outlined
dense
v-model="filter"
label="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append> <q-icon name="search" /> </template <template v-slot:append> <q-icon name="search" /> </template
></q-input> ></q-input>
@ -275,7 +300,6 @@ onMounted(() => {
ref="table" ref="table"
:columns="columns?.slice(0, 2)" :columns="columns?.slice(0, 2)"
:rows="rows" :rows="rows"
:filter="filter.trim()"
row-key="dateEmployment" row-key="dateEmployment"
:paging="true" :paging="true"
dense dense
@ -436,7 +460,7 @@ onMounted(() => {
v-model="filterHistory" v-model="filterHistory"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTableHistory"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -466,7 +490,6 @@ onMounted(() => {
:rows="rowsHistory" :rows="rowsHistory"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:filter="filterHistory.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -28,11 +28,10 @@ const {
hideLoader, hideLoader,
success, success,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -73,7 +72,9 @@ const reasonSameDateRef = ref<object | null>(null);
// //
const filterKeyword = ref<string>(""); // const filterKeyword = ref<string>(""); //
const modalHistory = ref<boolean>(false); // popup ; const modalHistory = ref<boolean>(false); // popup ;
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); // const rowsHistory = ref<RequestItemsHistoryObject[]>([]);
const rowsHistoryMain = ref<RequestItemsHistoryObject[]>([]); //
//
const visibleColumnsHistory = ref<String[]>([ const visibleColumnsHistory = ref<String[]>([
"dateAppoint", "dateAppoint",
"dateStart", "dateStart",
@ -142,9 +143,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
}, },
]); ]);
/** /** เปิด dialog */
* เป dialog *
*/
function openDialogEdit() { function openDialogEdit() {
modalEdit.value = true; modalEdit.value = true;
containDate.value = formMain.containDate ? formMain.containDate : null; containDate.value = formMain.containDate ? formMain.containDate : null;
@ -154,18 +153,14 @@ function openDialogEdit() {
: null; : null;
} }
/** /** เปิด dialog ประวัติแก้ไขข้อมูลราชการ*/
* เป dialog ประวแกไขขอมลราชการ
*/
function openDialogHistory() { function openDialogHistory() {
modalHistory.value = true; modalHistory.value = true;
filterKeyword.value = ""; filterKeyword.value = "";
getDataHistory(); getDataHistory();
} }
/** /** ปิด dialog*/
* dialog
*/
function closeDialog() { function closeDialog() {
modalEdit.value = false; modalEdit.value = false;
containDate.value = null; containDate.value = null;
@ -173,9 +168,7 @@ function closeDialog() {
reasonSameDate.value = null; reasonSameDate.value = null;
} }
/** /** function ยืนยันการบันทึกข้อมูลราชการ*/
* function นยนการบนทกขอมลราชการ
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, () => {
showLoader(); showLoader();
@ -206,16 +199,13 @@ function onSubmit() {
}); });
} }
/** /** ดึงข้อมูลราชการ*/
* งขอมลราชการ
*/
async function getData() { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewGovernmentById(profileId.value, empType.value)) .get(config.API.profileNewGovernmentById(profileId.value, empType.value))
.then(async (res) => { .then(async (res) => {
const data = await res.data.result; const data = await res.data.result;
console.log(data);
formMain.ocId = data.org ?? "-"; // formMain.ocId = data.org ?? "-"; //
formMain.positionId = data.position ?? "-"; // formMain.positionId = data.position ?? "-"; //
@ -244,9 +234,7 @@ async function getData() {
}); });
} }
/** /** ดึงข้อมูลประวัติ */
* งขอมลประว
*/
async function getDataHistory() { async function getDataHistory() {
showLoader(); showLoader();
await http await http
@ -279,6 +267,7 @@ async function getDataHistory() {
lastUpdateFullName: e.lastUpdateFullName, lastUpdateFullName: e.lastUpdateFullName,
}); });
}); });
rowsHistoryMain.value = rowsHistory.value;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -288,9 +277,16 @@ async function getDataHistory() {
}); });
} }
/** /** ฟังก์ค้นหาข้อมูลรายการประวัติข้อมูลราชการ */
* ทำงานเม Components กเรยกใชงาน function serchDataTableHistory() {
*/ rowsHistory.value = onSearchDataTable(
filterKeyword.value,
rowsHistoryMain.value,
columnsHistory.value ? columnsHistory.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => { onMounted(() => {
getData(); getData();
}); });
@ -656,7 +652,7 @@ onMounted(() => {
tittle="ประวัติแก้ไขข้อมูลราชการ" tittle="ประวัติแก้ไขข้อมูลราชการ"
:close="() => (modalHistory = !modalHistory)" :close="() => (modalHistory = !modalHistory)"
/> />
<q-separator color="grey-4" /> <q-separator />
<q-card-section style="max-height: 50vh" class="scroll"> <q-card-section style="max-height: 50vh" class="scroll">
<div class="row q-pb-sm q-gutter-x-sm"> <div class="row q-pb-sm q-gutter-x-sm">
@ -668,8 +664,7 @@ onMounted(() => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
class="col-2" @keydown.enter.pervent="serchDataTableHistory"
debounce="300"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -697,8 +692,6 @@ onMounted(() => {
bordered bordered
:paging="true" :paging="true"
dense dense
class="custom-header-table"
:filter="filterKeyword.trim()"
:visible-columns="visibleColumnsHistory" :visible-columns="visibleColumnsHistory"
> >
<template v-slot:header="props"> <template v-slot:header="props">
@ -711,7 +704,6 @@ onMounted(() => {
> >
<span class="text-weight-medium">{{ col.label }}</span> <span class="text-weight-medium">{{ col.label }}</span>
</q-th> </q-th>
<q-th auto-width></q-th>
</q-tr> </q-tr>
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">

View file

@ -29,6 +29,7 @@ const {
messageError, messageError,
success, success,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
const profileId = ref<string>( const profileId = ref<string>(
@ -36,9 +37,7 @@ const profileId = ref<string>(
); );
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -55,6 +54,7 @@ const disciplineData = reactive<RequestItemsObject>({
}); });
const rows = ref<RequestItemsObject[]>([]); // const rows = ref<RequestItemsObject[]>([]); //
const rowsMain = ref<RequestItemsObject[]>([]); //
const mode = ref<string>("table"); // Table card const mode = ref<string>("table"); // Table card
const filterKeyword = ref<string>(""); // const filterKeyword = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
@ -206,9 +206,7 @@ function filterSelector(val: string, update: Function, refData: string) {
} }
} }
/** /** ปิด dialog ข้อมูลวินัย*/
* dialog อมลว
*/
function closeDialog() { function closeDialog() {
modal.value = false; modal.value = false;
edit.value = false; edit.value = false;
@ -220,15 +218,14 @@ function closeDialog() {
disciplineData.refCommandDate = null; disciplineData.refCommandDate = null;
} }
/** /** เปิด dialog ข้อมูลวินัย*/
* เป dialog อมลว
*/
function openDialogAdd() { function openDialogAdd() {
modal.value = true; modal.value = true;
} }
/** /**
* function fetch อมลรายการว * function fetch อมลรายการว
* @param id id Profile
*/ */
async function fetchData(id: string) { async function fetchData(id: string) {
showLoader(); showLoader();
@ -236,6 +233,7 @@ async function fetchData(id: string) {
.get(config.API.profileNewDisciplineByProfileId(id, empType.value)) .get(config.API.profileNewDisciplineByProfileId(id, empType.value))
.then((res) => { .then((res) => {
rows.value = res.data.result; rows.value = res.data.result;
rowsMain.value = res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -245,9 +243,7 @@ async function fetchData(id: string) {
}); });
} }
/** /** funciton เพิ่มช้อมูลวินัย*/
* funciton เพมชอมลว
*/
function addData() { function addData() {
showLoader(); showLoader();
const body = { const body = {
@ -278,6 +274,7 @@ function addData() {
/** /**
* funciton นทกแกไขชอมลว * funciton นทกแกไขชอมลว
* @param idData id องการแกไข
*/ */
function editData(idData: string) { function editData(idData: string) {
showLoader(); showLoader();
@ -327,9 +324,7 @@ function openDialogHistory(idOrder: string) {
id.value = idOrder; id.value = idOrder;
} }
/** /** function ยืนยันการบันทึกข้อมูล*/
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -341,9 +336,16 @@ function onSubmit() {
); );
} }
/** /** ฟังก์ค้นหาข้อมูลรายการวินัย */
* ทำงานเม Components กเรยกใชงาน function serchDataTable() {
*/ rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => { onMounted(() => {
fetchData(profileId.value); fetchData(profileId.value);
}); });
@ -369,7 +371,7 @@ onMounted(() => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -432,7 +434,6 @@ onMounted(() => {
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
:paging="true" :paging="true"
:filter="filterKeyword.trim()"
v-model:pagination="pagination" v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"

View file

@ -14,8 +14,14 @@ import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } = const {
mixin; showLoader,
hideLoader,
messageError,
date2Thai,
pathRegistryEmp,
onSearchDataTable,
} = mixin;
/** /**
* props * props
@ -24,12 +30,10 @@ const modal = defineModel<boolean>("modal", { required: true }); //แสดง
const id = defineModel<string>("id", { required: true }); //id const id = defineModel<string>("id", { required: true }); //id
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
/**
* props
*/
const filterKeyword = ref<string>(""); // const filterKeyword = ref<string>(""); //
const rows = ref<RequestItemsObject[]>([]); // const rows = ref<RequestItemsObject[]>([]); //
const rowsMain = ref<RequestItemsObject[]>([]); //
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "date", name: "date",
@ -140,9 +144,7 @@ const historyPagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** fetch ข้อมูลประวัติการแก่ไขข้อมูลวินัย*/
* fetch อมลประวการแกไขขอมลว
*/
async function getHistory() { async function getHistory() {
showLoader(); showLoader();
await http await http
@ -164,6 +166,7 @@ async function getHistory() {
e.refCommandDate == null ? null : new Date(e.refCommandDate), e.refCommandDate == null ? null : new Date(e.refCommandDate),
}); });
}); });
rowsMain.value = rows.value;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -173,9 +176,17 @@ async function getHistory() {
}); });
} }
/** ฟังก์ค้นหาข้อมูลรายการวินัย */
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** /**
* การเปลยนแปลงของ modal * การเปลยนแปลงของ modal
*
* modal เป true เรยก getHistory เพอดงขอมลประวการแกไขว * modal เป true เรยก getHistory เพอดงขอมลประวการแกไขว
*/ */
watch(modal, (status) => { watch(modal, (status) => {
@ -207,7 +218,7 @@ watch(modal, (status) => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -238,7 +249,6 @@ watch(modal, (status) => {
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
v-model:pagination="historyPagination" v-model:pagination="historyPagination"
:filter="filterKeyword.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -22,9 +22,7 @@ import type {
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/03_LeaveHistory.vue"; import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/03_LeaveHistory.vue";
/** /**props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -41,6 +39,7 @@ const {
date2Thai, date2Thai,
dateToISO, dateToISO,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
const profileId = ref<string>( const profileId = ref<string>(
@ -83,6 +82,7 @@ const statLeaveOptionFilter = ref<DataOption[]>([
//Table //Table
const rows = ref<DetailData[]>([]); const rows = ref<DetailData[]>([]);
const rowsMain = ref<DetailData[]>([]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "no", name: "no",
@ -112,6 +112,9 @@ const columns = ref<QTableProps["columns"]>([
label: "วัน เดือน ปี ที่ลา", label: "วัน เดือน ปี ที่ลา",
sortable: true, sortable: true,
field: "dateLeave", field: "dateLeave",
format(val, row) {
return dateThaiRange([row.dateStartLeave, row.dateEndLeave]);
},
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) =>
@ -134,6 +137,9 @@ const columns = ref<QTableProps["columns"]>([
label: "สถานะ", label: "สถานะ",
sortable: true, sortable: true,
field: "status", field: "status",
format(val, row) {
return statusLeave(val);
},
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) =>
@ -184,9 +190,7 @@ const clickEditRowType = () => {
} }
}; };
/** /** function เปิด dialog ข้อมูลการลา*/
* function เป dialog อมลการลา
*/
function openDialogAdd() { function openDialogAdd() {
modal.value = true; modal.value = true;
edit.value = false; edit.value = false;
@ -239,6 +243,7 @@ function clickTotal() {
/** /**
* function เป dialog แกไขขอมลการลา * function เป dialog แกไขขอมลการลา
* @param props อมลทองการแกไข
*/ */
function openDialogEdit(props: DetailData) { function openDialogEdit(props: DetailData) {
edit.value = true; edit.value = true;
@ -271,9 +276,7 @@ function openDialogEdit(props: DetailData) {
} }
} }
/** /** ปิด dialog ข้อมูลการลา*/
* dialog อมลการลา
*/
function closeDialog() { function closeDialog() {
modal.value = false; modal.value = false;
edit.value = false; edit.value = false;
@ -330,16 +333,14 @@ function dateThaiRange(val: [Date, Date]) {
/** /**
* งชนดอมลประวแกไขขอมลทเลอก * งชนดอมลประวแกไขขอมลทเลอก
* @param row อม row ประวการแกไข * @param id id รายการ
*/ */
function openDialogHistory(idOrder: string) { function openDialogHistory(idOrder: string) {
modalHistory.value = true; modalHistory.value = true;
id.value = idOrder; id.value = idOrder;
} }
/** /** function ยืนยันการบันทึกข้อมูล*/
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
if (edit.value == false) { if (edit.value == false) {
@ -350,9 +351,7 @@ function onSubmit() {
}); });
} }
/** /** บันทึกเพิ่มข้อมูล*/
* นทกเพมขอม
*/
function saveData() { function saveData() {
showLoader(); showLoader();
http http
@ -381,9 +380,7 @@ function saveData() {
}); });
} }
/** /** บันทึกแก้ไขข้อมูล*/
* นทกแกไขขอม
*/
async function editData() { async function editData() {
showLoader(); showLoader();
http http
@ -410,9 +407,7 @@ async function editData() {
}); });
} }
/** /** function fetch ข้อมูลรายการลา*/
* function fetch อมลรายการลา
*/
async function getData() { async function getData() {
showLoader(); showLoader();
await http await http
@ -430,6 +425,7 @@ async function getData() {
reason: item.reason, reason: item.reason,
typeLeaveId: item.leaveTypeId, typeLeaveId: item.leaveTypeId,
})); }));
rowsMain.value = rows.value;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -439,6 +435,15 @@ async function getData() {
}); });
} }
/** ฟังก์ค้นหาข้อมูลรายการวินัย */
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** /**
* ทำงานเม Components กเรยกใชงาน * ทำงานเม Components กเรยกใชงาน
*/ */
@ -467,7 +472,7 @@ onMounted(() => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -532,7 +537,6 @@ onMounted(() => {
v-model:pagination="pagination" v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:filter="filterKeyword.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">
@ -573,14 +577,7 @@ onMounted(() => {
<div v-if="col.name === 'no'"> <div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }} {{ props.rowIndex + 1 }}
</div> </div>
<div v-else-if="col.name == 'dateLeave'">
{{
dateThaiRange([props.row.dateStartLeave, props.row.dateEndLeave])
}}
</div>
<div v-else-if="col.name == 'status'">
{{ statusLeave(col.value) }}
</div>
<div v-else> <div v-else>
{{ col.value ? col.value : "-" }} {{ col.value ? col.value : "-" }}
</div> </div>

View file

@ -21,13 +21,21 @@ const id = defineModel<string>("id", { required: true });
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } = const {
mixin; showLoader,
hideLoader,
messageError,
date2Thai,
pathRegistryEmp,
onSearchDataTable,
} = mixin;
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
const rows = ref<DetailData[]>([]); //data history const rows = ref<DetailData[]>([]); //data history
const rowsMain = ref<DetailData[]>([]); //data history
const formFilter = reactive<FormFilter>({ const formFilter = reactive<FormFilter>({
page: 1, page: 1,
pageSize: 12, pageSize: 12,
@ -71,6 +79,9 @@ const columns = ref<QTableProps["columns"]>([
sortable: true, sortable: true,
field: "dateLeave", field: "dateLeave",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
format(val, row) {
return dateThaiRange([row.dateStartLeave, row.dateEndLeave]);
},
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" }),
@ -94,6 +105,9 @@ const columns = ref<QTableProps["columns"]>([
field: "status", field: "status",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return statusLeave(val);
},
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" }),
}, },
@ -149,9 +163,7 @@ const historyPagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** function fetch ข้อมูลประวัติการแก้ไขการลา */
* function fetch อมลประวการแกไขการลา
*/
async function getHistory() { async function getHistory() {
showLoader(); showLoader();
await http await http
@ -176,6 +188,7 @@ async function getHistory() {
: "", : "",
}); });
}); });
rowsMain.value = rows.value;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -217,9 +230,17 @@ function statusLeave(val: string) {
} }
} }
/** ฟังก์ค้นหาข้อมูลรายการประวัติแก้ไขการลา */
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** /**
* การเปลยนแปลงของ modal * การเปลยนแปลงของ modal
*
* modal เป true เรยก getHistory เพอดงขอมลประวการแกไข * modal เป true เรยก getHistory เพอดงขอมลประวการแกไข
*/ */
watch(modal, (status) => { watch(modal, (status) => {
@ -250,7 +271,7 @@ watch(modal, (status) => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -281,7 +302,6 @@ watch(modal, (status) => {
v-model:pagination="historyPagination" v-model:pagination="historyPagination"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:filter="filterKeyword.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">
@ -301,17 +321,7 @@ watch(modal, (status) => {
1 1
}} }}
</div> </div>
<div v-else-if="col.name == 'dateLeave'">
{{
dateThaiRange([
props.row.dateStartLeave,
props.row.dateEndLeave,
])
}}
</div>
<div v-else-if="col.name == 'status'">
{{ statusLeave(col.value) }}
</div>
<div v-else> <div v-else>
{{ col.value ? col.value : "-" }} {{ col.value ? col.value : "-" }}
</div> </div>

View file

@ -25,6 +25,7 @@ const {
hideLoader, hideLoader,
success, success,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
const profileId = ref<string>( const profileId = ref<string>(
@ -32,9 +33,7 @@ const profileId = ref<string>(
); );
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -56,6 +55,7 @@ const dutyData = reactive<RequestItemsObject>({
const mode = ref<string>("table"); // Table card const mode = ref<string>("table"); // Table card
const filterKeyword = ref<string>(""); // const filterKeyword = ref<string>(""); //
const rows = ref<RequestItemsObject[]>([]); // const rows = ref<RequestItemsObject[]>([]); //
const rowsMain = ref<RequestItemsObject[]>([]); //
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "dateStart", name: "dateStart",
@ -179,15 +179,14 @@ function closeDialog() {
dutyData.refCommandDate = null; dutyData.refCommandDate = null;
} }
/** /** fetch ข้อมูลรายการพิเศษ*/
* fetch อมลรายการพเศษ
*/
async function fetchData(id: string) { async function fetchData(id: string) {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewDutyByProfileId(id, empType.value)) .get(config.API.profileNewDutyByProfileId(id, empType.value))
.then(async (res) => { .then(async (res) => {
rows.value = await res.data.result; rows.value = await res.data.result;
rowsMain.value = await res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -197,9 +196,7 @@ async function fetchData(id: string) {
}); });
} }
/** /** functoin บันทึกการเพิ่มข้อมูล*/
* functoin นทกการเพมขอม
*/
function addData() { function addData() {
showLoader(); showLoader();
const body = { const body = {
@ -227,9 +224,7 @@ function addData() {
}); });
} }
/** /** functoin บันทึกการแก้ไขข้อมูล*/
* functoin นทกการแกไขขอม
*/
function editData(idData: string) { function editData(idData: string) {
showLoader(); showLoader();
http http
@ -250,9 +245,7 @@ function editData(idData: string) {
}); });
} }
/** /** ยืนยันการบันทึกข้อมูล*/
* นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -264,9 +257,15 @@ function onSubmit() {
); );
} }
/** function serchDataTable() {
* ทำงานเม Components กเรยกใชงาน rows.value = onSearchDataTable(
*/ filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งา*/
onMounted(() => { onMounted(() => {
fetchData(profileId.value); fetchData(profileId.value);
}); });
@ -292,7 +291,7 @@ onMounted(() => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -356,7 +355,6 @@ onMounted(() => {
:paging="true" :paging="true"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:filter="filterKeyword.trim()"
v-model:pagination="pagination" v-model:pagination="pagination"
> >
> >

View file

@ -16,13 +16,20 @@ const id = defineModel<string>("id", { required: true });
const route = useRoute(); const route = useRoute();
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } = const {
mixin; showLoader,
hideLoader,
messageError,
date2Thai,
pathRegistryEmp,
onSearchDataTable,
} = mixin;
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const filterKeyword = ref<string>(""); // const filterKeyword = ref<string>(""); //
const rows = ref<ResponseObject[]>([]); //data history const rows = ref<ResponseObject[]>([]); //data history
const rowsMain = ref<ResponseObject[]>([]); //data history
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "dateStart", name: "dateStart",
@ -132,9 +139,7 @@ const historyPagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** function fetch ข้อมูลประวติการแก้ไขข้อมูล*/
* function fetch อมลประวตการแกไขขอม
*/
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
@ -158,6 +163,7 @@ function getHistory() {
lastUpdatedAt: e.lastUpdatedAt, lastUpdatedAt: e.lastUpdatedAt,
}); });
}); });
rowsMain.value = rows.value;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -167,9 +173,16 @@ function getHistory() {
}); });
} }
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** /**
* การเปลยนแปลงของ modal * การเปลยนแปลงของ modal
*
* modal เป true เรยก getHistory เพอดงขอมลประวการแกไข * modal เป true เรยก getHistory เพอดงขอมลประวการแกไข
*/ */
watch(modal, (status) => { watch(modal, (status) => {
@ -189,6 +202,7 @@ watch(modal, (status) => {
tittle="ประวัติแก้ไขปฏิบัติราชการพิเศษ" tittle="ประวัติแก้ไขปฏิบัติราชการพิเศษ"
:close="() => ((modal = false), (rows = []))" :close="() => ((modal = false), (rows = []))"
/> />
<q-separator />
<q-card-section style="max-height: 60vh" class="scroll"> <q-card-section style="max-height: 60vh" class="scroll">
<div class="row q-gutter-sm q-mb-sm"> <div class="row q-gutter-sm q-mb-sm">
<q-space /> <q-space />
@ -199,7 +213,7 @@ watch(modal, (status) => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -230,7 +244,6 @@ watch(modal, (status) => {
v-model:pagination="historyPagination" v-model:pagination="historyPagination"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:filter="filterKeyword.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -24,13 +24,12 @@ const {
messageError, messageError,
dialogConfirm, dialogConfirm,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
const id = ref<string>(""); const id = ref<string>("");
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -50,6 +49,7 @@ const detail = ref<string>(""); //รายละเอียด
//Table //Table
const rows = ref<RowList[]>([]); const rows = ref<RowList[]>([]);
const rowsMain = ref<RowList[]>([]);
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
@ -80,15 +80,14 @@ const pagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** fetch รายการข้อมูลอื่นๆ*/
* fetch รายการขอมลอนๆ
*/
async function getData() { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewOtherByProfileId(profileId.value, empType.value)) .get(config.API.profileNewOtherByProfileId(profileId.value, empType.value))
.then((res) => { .then((res) => {
rows.value = res.data.result; rows.value = res.data.result;
rowsMain.value = res.data.result;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -98,9 +97,7 @@ async function getData() {
}); });
} }
/** /** เปิด dialog ข้อมูลอื่นๆ*/
* เป dialog อมลอนๆ
*/
function openDialogAdd() { function openDialogAdd() {
modal.value = true; modal.value = true;
} }
@ -126,9 +123,7 @@ function openDialogHistory(idOrder: string) {
modalHistory.value = true; modalHistory.value = true;
} }
/** /** ปิด dialog */
* dialog
*/
function closeDialog() { function closeDialog() {
modal.value = false; modal.value = false;
edit.value = false; edit.value = false;
@ -136,9 +131,7 @@ function closeDialog() {
detail.value = ""; detail.value = "";
} }
/** /** validate check*/
* validate check
*/
function validateForm() { function validateForm() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -154,9 +147,7 @@ function validateForm() {
); );
} }
/** /** บันทึกเพิ่มข้อมูล*/
* นทกเพมขอม
*/
function saveData() { function saveData() {
showLoader(); showLoader();
http http
@ -179,9 +170,7 @@ function saveData() {
}); });
} }
/** /** บันทึกแก้ไขข้อมูล*/
* นทกแกไขขอม
*/
function editData() { function editData() {
showLoader(); showLoader();
http http
@ -202,6 +191,14 @@ function editData() {
}); });
} }
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
onMounted(() => { onMounted(() => {
getData(); getData();
}); });
@ -227,7 +224,7 @@ onMounted(() => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -290,7 +287,6 @@ onMounted(() => {
:grid="mode === 'card'" :grid="mode === 'card'"
:paging="true" :paging="true"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:filter="filterKeyword.trim()"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -14,18 +14,23 @@ import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } = const {
mixin; showLoader,
hideLoader,
messageError,
date2Thai,
pathRegistryEmp,
onSearchDataTable,
} = mixin;
/** /** props*/
* props
*/
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const id = defineModel<string>("id", { required: true }); const id = defineModel<string>("id", { required: true });
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const rows = ref<RowList[]>([]); // data history const rows = ref<RowList[]>([]); // data history
const rowsMain = ref<RowList[]>([]); // data history
const filterKeyword = ref<string>(""); const filterKeyword = ref<string>("");
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
@ -80,9 +85,7 @@ const visibleColumns = ref<String[]>([
"lastUpdatedAt", "lastUpdatedAt",
]); ]);
/** /** ฟังก์ชันดึงข้อมูลประวัติการแก่ไขข้อมูล*/
* งกนดงขอมลประวการแกไขขอม
*/
function getHistory() { function getHistory() {
showLoader(); showLoader();
http http
@ -99,6 +102,7 @@ function getHistory() {
lastUpdatedAt: new Date(e.lastUpdatedAt), lastUpdatedAt: new Date(e.lastUpdatedAt),
}); });
}); });
rowsMain.value = rows.value;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -108,9 +112,16 @@ function getHistory() {
}); });
} }
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** /**
* การเปลยนแปลงของ modal * การเปลยนแปลงของ modal
*
* modal เป true เรยก getHistory เพอดงขอมลประวการแกไข * modal เป true เรยก getHistory เพอดงขอมลประวการแกไข
*/ */
watch(modal, (status) => { watch(modal, (status) => {
@ -141,7 +152,7 @@ watch(modal, (status) => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -171,7 +182,6 @@ watch(modal, (status) => {
:paging="true" :paging="true"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:filter="filterKeyword.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -9,21 +9,15 @@ import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile"
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
/** /** importType*/
* importType
*/
import type { QTableColumn } from "quasar"; import type { QTableColumn } from "quasar";
import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Profile"; import type { RequestObject } from "@/modules/04_registryPerson/interface/request/Profile";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Profile"; import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Profile";
/** /** importComponents*/
* importComponents
*/
import DialogHeader from "@/components/DialogHeader.vue"; import DialogHeader from "@/components/DialogHeader.vue";
/** /** use*/
* use
*/
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
const store = useProfileDataStore(); const store = useProfileDataStore();
@ -36,11 +30,10 @@ const {
messageError, messageError,
dialogConfirm, dialogConfirm,
dialogMessageNotify, dialogMessageNotify,
onSearchDataTable,
} = useCounterMixin(); } = useCounterMixin();
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -63,6 +56,7 @@ 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 rowsHistory = ref<ResponseObject[]>([]); //
const rowsHistoryMain = ref<ResponseObject[]>([]); //
const filterHistory = ref<string>(""); // const filterHistory = ref<string>(""); //
const modalHistory = ref<boolean>(false); // const modalHistory = ref<boolean>(false); //
const age = ref<string | null>(""); // const age = ref<string | null>(""); //
@ -285,10 +279,7 @@ const pagination = ref({
descending: true, descending: true,
}); });
/** /** function เรียกข้อมูลข้อมูลส่วนตัว*/
* function เรยกขอมลขอมลสวนต
*
*/
async function getData() { async function getData() {
showLoader(); showLoader();
await http await http
@ -310,9 +301,7 @@ async function getData() {
}); });
} }
/** /** function แก้ไขข้อมูลประวัติส่วนตัว*/
* function แกไขขอมลประววนต
*/
function onClickOpenDialog() { function onClickOpenDialog() {
if (!informaData.value) return; if (!informaData.value) return;
modal.value = true; modal.value = true;
@ -334,9 +323,7 @@ function onClickOpenDialog() {
formData.phone = informaData.value.phone; formData.phone = informaData.value.phone;
} }
/** /** function ยืนยันการบันทึกข้อมูล*/
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -366,9 +353,7 @@ function onSubmit() {
); );
} }
/** /** function ดูข้อมูลประวัติแก้ไขข้อมูลส่วนตัว*/
* function อมลประวแกไขขอมลสวนต
*/
async function clickHistory() { async function clickHistory() {
showLoader(); showLoader();
modalHistory.value = true; modalHistory.value = true;
@ -377,6 +362,7 @@ async function clickHistory() {
.get(config.API.profileNewProfileHisById(id.value, empType.value)) .get(config.API.profileNewProfileHisById(id.value, empType.value))
.then(async (res) => { .then(async (res) => {
rowsHistory.value = await res.data.result; rowsHistory.value = await res.data.result;
rowsHistoryMain.value = await res.data.result;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -409,18 +395,14 @@ function changeCardID(citizenId: string | number | null) {
} }
} }
/** /** function เช็คอายุไม่เกิน 18 ปี*/
* function เชคอายไมเก 18
*/
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;
} }
/** /** ดูการเปลี่ยนแปลงของวันเกิดเมื่อมีการเปลี่ยนแปลงจะคำนวนอายูใหม่*/
* การเปลยนแปลงของวนเกดเมอมการเปลยนแปลงจะคำนวนอายใหม
*/
watch( watch(
() => formData.birthDate, () => formData.birthDate,
(v) => { (v) => {
@ -430,9 +412,16 @@ watch(
} }
); );
/** /** ฟังก์ค้นหาข้อมูลรายการประวัติแก้ไขข้อมูลส่วนตัว */
* ทำงานเม Components กเรยกใชงาน function serchDataTable() {
*/ rowsHistory.value = onSearchDataTable(
filterHistory.value,
rowsHistoryMain.value,
columnsHistory.value
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => { onMounted(() => {
const promises = []; const promises = [];
@ -556,7 +545,7 @@ onMounted(() => {
</div> </div>
</q-card> </q-card>
<!-- Edit Dialog --> <!-- แกไขประววนต -->
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card> <q-card>
<q-form greedy @submit.prevent @validation-success="onSubmit"> <q-form greedy @submit.prevent @validation-success="onSubmit">
@ -866,11 +855,16 @@ onMounted(() => {
</q-card> </q-card>
</q-dialog> </q-dialog>
<!-- ประวแกไขขอมลสวนต -->
<q-dialog v-model="modalHistory" persistent> <q-dialog v-model="modalHistory" persistent>
<q-card style="min-width: 80%"> <q-card style="min-width: 80%">
<DialogHeader <DialogHeader
tittle="ประวัติแก้ไขข้อมูลส่วนตัว" tittle="ประวัติแก้ไขข้อมูลส่วนตัว"
:close="() => ((modalHistory = false), (rowsHistory = []))" :close="
() => (
(modalHistory = false), ((rowsHistory = []), (filterHistory = ''))
)
"
/> />
<q-separator /> <q-separator />
@ -883,7 +877,7 @@ onMounted(() => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -915,7 +909,6 @@ onMounted(() => {
v-model:pagination="pagination" v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumnsHistory" :visible-columns="visibleColumnsHistory"
:filter="filterHistory.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -10,22 +10,16 @@ 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";
/** /** importType*/
* importType
*/
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
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";
/** /** importComponents*/
* importComponents
*/
import dialogHeader from "@/components/DialogHeader.vue"; import dialogHeader from "@/components/DialogHeader.vue";
/** /** use*/
* use
*/
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
const store = useProfileDataStore(); const store = useProfileDataStore();
@ -39,11 +33,10 @@ const {
showLoader, showLoader,
hideLoader, hideLoader,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = useCounterMixin(); } = useCounterMixin();
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -99,6 +92,7 @@ const alertUpload = ref<boolean>(false);
// Table // Table
const rows = ref<ResponseObject[]>([]); const rows = ref<ResponseObject[]>([]);
const rowsMain = ref<ResponseObject[]>([]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "prefix", name: "prefix",
@ -173,9 +167,7 @@ const pagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** ฟังก์ชันดึงข้อมูลส่วนตัว*/
* งกนดงขอมลสวนต
*/
async function fetchDataPersonal() { async function fetchDataPersonal() {
showLoader(); showLoader();
await http await http
@ -194,7 +186,6 @@ async function fetchDataPersonal() {
/** /**
* งกนดงขอมลรายการประวการเปลยนช-นามสก * งกนดงขอมลรายการประวการเปลยนช-นามสก
*
* @param id id profile * @param id id profile
*/ */
async function fetchData(id: string) { async function fetchData(id: string) {
@ -203,6 +194,7 @@ async function fetchData(id: string) {
.get(config.API.profileNewChangeNameByProfileId(id, empType.value)) .get(config.API.profileNewChangeNameByProfileId(id, empType.value))
.then(async (res) => { .then(async (res) => {
rows.value = await res.data.result; rows.value = await res.data.result;
rowsMain.value = await res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -212,9 +204,7 @@ async function fetchData(id: string) {
}); });
} }
/** /** ฟังก์ชันยืนยันการบันทึกข้อมูล*/
* งกนยนยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
if (!!fileUpload.value || dialogStatus.value === "edit") { if (!!fileUpload.value || dialogStatus.value === "edit") {
dialogConfirm( dialogConfirm(
@ -307,9 +297,7 @@ async function onDownloadFile(id: string) {
}); });
} }
/** /** ฟังกชันเพิ่มการเปลี่ยนชื่อ - นามสกุล */
* งกชนเพมการเปลยนช - นามสก
*/
async function addData() { async function addData() {
showLoader(); showLoader();
await http await http
@ -397,18 +385,23 @@ function filterSelector(val: string, update: Function, refData: string) {
} }
} }
/** /** ฟังก์ชันปิด popup เปลี่ยนชื่อ-นามสกุล*/
* งกนป popup เปลยนช-นามสก
*/
function closeDialog() { function closeDialog() {
selection.value = []; selection.value = [];
alertUpload.value = false; alertUpload.value = false;
dialog.value = false; dialog.value = false;
} }
/** /** ฟังก์ค้นหาข้อมูลรายการประวัติการเปลีียนชื่อ-นามสกุล*/
* การเปลยนแปลงของขอมลฟอร เปลยนช-นามสก function serchDataTable() {
*/ rows.value = onSearchDataTable(
filterSearch.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** ดูการเปลี่ยนแปลงของข้อมูลฟอร์ท เปลี่ยนชื่อ-นามสกุล*/
watch( watch(
() => [ () => [
changeNameData.prefix, changeNameData.prefix,
@ -423,9 +416,7 @@ watch(
} }
); );
/** /** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(async () => { onMounted(async () => {
// //
if ( if (
@ -476,6 +467,7 @@ onMounted(async () => {
label="ค้นหา" label="ค้นหา"
class="q-mr-sm" class="q-mr-sm"
v-model="filterSearch" v-model="filterSearch"
@keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -507,7 +499,6 @@ onMounted(async () => {
v-model:pagination="pagination" v-model:pagination="pagination"
:rows="rows" :rows="rows"
:columns="columns" :columns="columns"
:filter="filterSearch.trim()"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:virtual-scroll-sticky-size-start="48" :virtual-scroll-sticky-size-start="48"

View file

@ -35,6 +35,7 @@ const {
hideLoader, hideLoader,
dialogConfirm, dialogConfirm,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
/** /**
@ -80,16 +81,19 @@ const dataLabel = {
const modalHistory = ref<boolean>(false); // Popup const modalHistory = ref<boolean>(false); // Popup
const rowsHistory = ref<ResponseObject[]>([]); // const rowsHistory = ref<ResponseObject[]>([]); //
const rowsHistoryMain = ref<ResponseObject[]>([]); //
const filterHistory = ref<string>(""); // const filterHistory = ref<string>(""); //
const visibleColumnsHistory = ref<String[]>([ const visibleColumnsHistory = ref<String[]>([
"currentAddress", "currentAddress",
"currentDistrict", "currentDistrict",
"currentSubDistrict", "currentSubDistrict",
"currentZipCode", "currentZipCode",
"currentProvince",
"registrationAddress", "registrationAddress",
"registrationDistrict", "registrationDistrict",
"registrationProvince", "registrationProvince",
"registrationSame", "registrationSame",
"registrationSubDistrict", "registrationSubDistrict",
"registrationZipCode", "registrationZipCode",
"lastUpdateFullName", "lastUpdateFullName",
@ -251,7 +255,6 @@ const columnsHistory = ref<QTableProps["columns"]>([
/** /**
* งกนดงขอมลทอย * งกนดงขอมลทอย
*
* งขอมลทอย อมลจงหว อม เขต / อำเภอ และขอม แขวง/ตำบล * งขอมลทอย อมลจงหว อม เขต / อำเภอ และขอม แขวง/ตำบล
*/ */
async function getData() { async function getData() {
@ -354,11 +357,7 @@ function selectSubDistrict(e: string | null, name: string) {
} }
} }
/** /** ฟังก์ชันดึงข่้อมูลทั่งหมด*/
* งกนดงขอมลทงหมด
*
*
*/
async function fetchAll() { async function fetchAll() {
await getData(); await getData();
if (!store.profileIdBefore) { if (!store.profileIdBefore) {
@ -392,9 +391,7 @@ async function fetchAll() {
).name; ).name;
} }
/** /** ฟังก์ชันบันทึกข้อมูลข้อมูลที่อยู่*/
* งกนบนทกขอมลขอมลทอย
*/
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -434,9 +431,7 @@ function onSubmit() {
); );
} }
/** /** ฟังก์ชันเปิด popup การแก้ไขข้อมูลข้อมูลที่อยู่*/
* งกนเป popup การแกไขขอมลขอมลทอย
*/
async function onClickOpenDialog() { async function onClickOpenDialog() {
if (!addressData) return; if (!addressData) return;
Object.assign(formData, addressData); Object.assign(formData, addressData);
@ -466,9 +461,7 @@ async function onClickOpenDialog() {
} }
} }
/** /** ฟังก์ชันปิด Popup การแก้ไขข้อมูลที่อยู่ */
* งกนป Popup การแกไขขอมลทอย
*/
function clickClose() { function clickClose() {
Object.assign(formData, store.defaultAddressForm); Object.assign(formData, store.defaultAddressForm);
modal.value = false; modal.value = false;
@ -476,7 +469,6 @@ function clickClose() {
/** /**
* งกนเป popup ประวแกไขขอมลทอย * งกนเป popup ประวแกไขขอมลทอย
*
* และดงขอมลรายการประวแกไขขอมลทอย * และดงขอมลรายการประวแกไขขอมลทอย
*/ */
async function clickHistory() { async function clickHistory() {
@ -487,6 +479,7 @@ async function clickHistory() {
.get(config.API.profileNewAddressHisById(profileId.value, empType.value)) .get(config.API.profileNewAddressHisById(profileId.value, empType.value))
.then(async (res) => { .then(async (res) => {
rowsHistory.value = await res.data.result; rowsHistory.value = await res.data.result;
rowsHistoryMain.value = await res.data.result;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -512,9 +505,16 @@ function sameAddressToggle(v: string) {
} }
} }
/** /** ฟังก์ค้นหาข้อมูลรายการประวัติแก้ไขข้อมูลที่อยู่ */
* การเปลยนแปลงทอยจจนตรงกบทอยตามทะเบยนบาน function serchDataTable() {
*/ rowsHistory.value = onSearchDataTable(
filterHistory.value,
rowsHistoryMain.value,
columnsHistory.value ? columnsHistory.value : []
);
}
/** ดูการเปลี่ยนแปลงที่อยู่ปัจจุบันตรงกับที่อยู่ตามทะเบียนบ้า*/
watch( watch(
() => sameAddress.value, () => sameAddress.value,
(v) => { (v) => {
@ -522,9 +522,7 @@ watch(
} }
); );
/** /** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
* ทำงานเม Components กเรยกใชงาน
*/
onMounted(async () => { onMounted(async () => {
await fetchAll(); await fetchAll();
}); });
@ -661,7 +659,7 @@ onMounted(async () => {
</div> </div>
</div> </div>
<!-- Edit Dialog --> <!-- แกไขขอมลทอย -->
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card> <q-card>
<q-form greedy @submit.prevent @validation-success="onSubmit"> <q-form greedy @submit.prevent @validation-success="onSubmit">
@ -902,6 +900,7 @@ onMounted(async () => {
</q-card> </q-card>
</q-dialog> </q-dialog>
<!-- ประวแกไขขอมลทอย -->
<q-dialog v-model="modalHistory" persistent> <q-dialog v-model="modalHistory" persistent>
<q-card style="min-width: 80%"> <q-card style="min-width: 80%">
<DialogHeader <DialogHeader
@ -919,7 +918,7 @@ onMounted(async () => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -949,7 +948,6 @@ onMounted(async () => {
:paging="true" :paging="true"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumnsHistory" :visible-columns="visibleColumnsHistory"
:filter="filterHistory.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -30,11 +30,10 @@ const {
messageError, messageError,
success, success,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = useCounterMixin(); } = useCounterMixin();
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -147,10 +146,11 @@ const columns = ref<QTableProps["columns"]>([
field: "lastUpdatedAt", field: "lastUpdatedAt",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format: (val) => date2Thai(val), format: (val) => date2Thai(val, false, true),
}, },
]); ]);
const rows = ref<any[]>([]); const rows = ref<any[]>([]);
const rowsMain = ref<any[]>([]);
/** ข้อมูล*/ /** ข้อมูล*/
const fatherData = reactive<FormPerson>({ const fatherData = reactive<FormPerson>({
@ -204,9 +204,7 @@ const fromData = reactive({
statusMarital: "", statusMarital: "",
}); });
/** /** function fetch ข้อมูลบิดา*/
* function fetch อมลบดา
*/
async function fetchDataFather() { async function fetchDataFather() {
await http await http
.get( .get(
@ -229,9 +227,7 @@ async function fetchDataFather() {
}); });
} }
/** /** function fetch ข้อมูลมารดา*/
* function fetch อมลมารดา
*/
async function fetchDataMother() { async function fetchDataMother() {
await http await http
.get( .get(
@ -254,9 +250,7 @@ async function fetchDataMother() {
}); });
} }
/** /** function fetch ข้อมูลคู่สมรส*/
* function fetch อมลคสมรส
*/
async function fetchDataCouple() { async function fetchDataCouple() {
await http await http
.get( .get(
@ -280,9 +274,7 @@ async function fetchDataCouple() {
}); });
} }
/** /** function fetch ข้อมูลบุตร*/
* function fetch อมลบตร
*/
async function fetchDataChildren() { async function fetchDataChildren() {
await http await http
.get( .get(
@ -345,9 +337,7 @@ function onSubmit(type: string) {
}); });
} }
/** /** function ปิด popup*/
* function popup
*/
function closeDialog() { function closeDialog() {
modal.value = false; modal.value = false;
modalHistory.value = false; modalHistory.value = false;
@ -431,9 +421,7 @@ async function onOpenDialogHistory(type: string, id: string = "") {
await fetchHistory(historyId, type); await fetchHistory(historyId, type);
} }
/** /** function fetch ข้อมูลความสัมพันธ์ */
* function fetch อมลความสมพนธ
*/
function fetchDataRelationship() { function fetchDataRelationship() {
http http
.get(config.API.orgRelationship) .get(config.API.orgRelationship)
@ -454,10 +442,10 @@ function fetchDataRelationship() {
* @param val คำคนหา * @param val คำคนหา
* @param update function * @param update function
*/ */
function filterSelectorRelation(val: any, update: Function) { function filterSelectorRelation(val: string, update: Function) {
update(() => { update(() => {
optionRelationship.value = optionRelationshipMain.value.filter( optionRelationship.value = optionRelationshipMain.value.filter(
(v: any) => v.name.indexOf(val) > -1 (v: DataOption) => v.name.indexOf(val) > -1
); );
}); });
} }
@ -490,6 +478,7 @@ async function fetchHistory(id: string, type: string) {
lastUpdatedAt: e.lastUpdatedAt, lastUpdatedAt: e.lastUpdatedAt,
statusMarital: type === "couple" ? e.relationship : undefined, statusMarital: type === "couple" ? e.relationship : undefined,
})); }));
rowsMain.value = rows.value;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -499,9 +488,24 @@ async function fetchHistory(id: string, type: string) {
}); });
} }
/** /** ฟังก์ค้นหาข้อมูลรายการประวัติแก้ไขข้อมูล */
* ทำงานเม Components กเรยกใชงาน function serchDataTable() {
*/ const baseColumns =
typeForm.value === "couple"
? columns.value
: typeForm.value === "mother"
? columns.value?.filter((e) => e.name !== "statusMarital")
: columns.value?.filter(
(e) => e.name !== "lastNameOld" && e.name !== "statusMarital"
);
rows.value = onSearchDataTable(
filterHistory.value,
rowsMain.value,
baseColumns ? baseColumns : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(async () => { onMounted(async () => {
showLoader(); showLoader();
await Promise.all([ await Promise.all([
@ -875,6 +879,7 @@ onMounted(async () => {
</div> </div>
</div> </div>
<!-- แกไขขอม -->
<q-dialog v-model="modal" class="dialog" persistent> <q-dialog v-model="modal" class="dialog" persistent>
<q-card style="min-width: 80%"> <q-card style="min-width: 80%">
<q-form @submit.prevent greedy @validation-success="onSubmit(typeForm)"> <q-form @submit.prevent greedy @validation-success="onSubmit(typeForm)">
@ -1063,6 +1068,7 @@ onMounted(async () => {
</q-card> </q-card>
</q-dialog> </q-dialog>
<!-- ประวการแกไขขอม -->
<q-dialog v-model="modalHistory" class="dialog" persistent> <q-dialog v-model="modalHistory" class="dialog" persistent>
<q-card style="min-width: 80%"> <q-card style="min-width: 80%">
<DialogHeader <DialogHeader
@ -1087,7 +1093,7 @@ onMounted(async () => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -1105,7 +1111,12 @@ onMounted(async () => {
:options=" :options="
typeForm === 'couple' typeForm === 'couple'
? columns ? columns
: columns?.filter((e) => e.name !== 'lastNameOld') : typeForm === 'mother'
? columns?.filter((e) => e.name !== 'statusMarital')
: columns?.filter(
(e) =>
e.name !== 'lastNameOld' && e.name !== 'statusMarital'
)
" "
option-value="name" option-value="name"
style="min-width: 140px" style="min-width: 140px"
@ -1130,7 +1141,6 @@ onMounted(async () => {
:paging="true" :paging="true"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:filter="filterHistory.trim()"
> >
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -32,6 +32,7 @@ const {
success, success,
date2Thai, date2Thai,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
const id = ref<string>(route.params.id.toString()); //id profile const id = ref<string>(route.params.id.toString()); //id profile
@ -39,14 +40,15 @@ const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const dialog = ref<boolean>(false); // popup const dialog = ref<boolean>(false); // popup
const dialogStatus = ref<string>("create"); // const dialogStatus = ref<string>("create"); //
const mode = ref<string>("table"); // Table card const mode = ref<string>("table"); // Table card
/**
* props /** props*/
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
//Table /** Table*/
const keyword = ref<string>("");
const rows = ref<ResponseObject[]>([]); const rows = ref<ResponseObject[]>([]);
const rowsMain = ref<ResponseObject[]>([]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "educationLevel", name: "educationLevel",
@ -75,10 +77,12 @@ const columns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "ตั้งแต่", label: "ตั้งแต่",
sortable: true, sortable: true,
field: (v) => field: "startDate",
v.isDate format(val, row) {
? date2Thai(v.startDate) return row.isDate
: new Date(v.startDate).getFullYear() + 543, ? date2Thai(row.startDate)
: new Date(row.startDate).getFullYear() + 543;
},
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) =>
@ -89,8 +93,13 @@ const columns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "ถึง", label: "ถึง",
sortable: true, sortable: true,
field: (v) => field: "endDate",
v.isDate ? date2Thai(v.endDate) : new Date(v.endDate).getFullYear() + 543,
format(val, row) {
return row.isDate
? date2Thai(row.endDate)
: new Date(row.endDate).getFullYear() + 543;
},
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) =>
@ -220,9 +229,32 @@ const columns = ref<QTableProps["columns"]>([
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
]); ]);
const visibleColumns = ref<string[]>([
"educationLevel",
"institute",
"degree",
"field",
"gpa",
"country",
"duration",
"durationYear",
"other",
"fundName",
"isEducation",
"endDate",
"startDate",
"finishDate",
"note",
]);
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
//Table /** Table ประวัติแก้ไขประวัติการศึกษา*/
const historyKeyword = ref<string>("");
const historyRows = ref<ResponseObject[]>([]); const historyRows = ref<ResponseObject[]>([]);
const historyRowsMain = ref<ResponseObject[]>([]);
const historyColumns = ref<QTableProps["columns"]>([ const historyColumns = ref<QTableProps["columns"]>([
{ {
name: "educationLevel", name: "educationLevel",
@ -251,10 +283,12 @@ const historyColumns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "ตั้งแต่", label: "ตั้งแต่",
sortable: true, sortable: true,
field: (v) => field: "startDate",
v.isDate format(val, row) {
? date2Thai(v.startDate) return row.isDate
: new Date(v.startDate).getFullYear() + 543, ? date2Thai(row.startDate)
: new Date(row.startDate).getFullYear() + 543;
},
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) =>
@ -265,8 +299,12 @@ const historyColumns = ref<QTableProps["columns"]>([
align: "left", align: "left",
label: "ถึง", label: "ถึง",
sortable: true, sortable: true,
field: (v) => field: "endDate",
v.isDate ? date2Thai(v.endDate) : new Date(v.endDate).getFullYear() + 543, format(val, row) {
row.isDate
? date2Thai(row.endDate)
: new Date(row.endDate).getFullYear() + 543;
},
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) =>
@ -420,6 +458,30 @@ const historyColumns = ref<QTableProps["columns"]>([
}, },
]); ]);
const historyVisibleColumns = ref<string[]>([
"educationLevel",
"institute",
"degree",
"field",
"gpa",
"country",
"duration",
"durationYear",
"other",
"fundName",
"isEducation",
"endDate",
"startDate",
"finishDate",
"note",
"lastUpdateFullName",
"lastUpdatedAt",
]);
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
const editId = ref<string>(""); //id const editId = ref<string>(""); //id
const isDate = ref<string>("false"); const isDate = ref<string>("false");
@ -461,59 +523,7 @@ const educationData = reactive<RequestItemsObject>({
positionPathId: "", positionPathId: "",
}); });
const keyword = ref<string>(""); /** function ยืนยันการบันทึกข้อมูล*/
const historyKeyword = ref<string>("");
const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const historyPagination = ref({
page: 1,
rowsPerPage: 10,
});
const visibleColumns = ref<string[]>([
"educationLevel",
"institute",
"degree",
"field",
"gpa",
"country",
"duration",
"durationYear",
"other",
"fundName",
"isEducation",
"endDate",
"startDate",
"finishDate",
"note",
]);
const historyVisibleColumns = ref<string[]>([
"educationLevel",
"institute",
"degree",
"field",
"gpa",
"country",
"duration",
"durationYear",
"other",
"fundName",
"isEducation",
"endDate",
"startDate",
"finishDate",
"note",
"lastUpdateFullName",
"lastUpdatedAt",
]);
/**
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -552,9 +562,7 @@ function filterSelector(val: string, update: Function, refData: string) {
} }
} }
/** /** function เคลียร์ formData*/
* function เคลยร formData
*/
function clearForm() { function clearForm() {
isDate.value = "false"; isDate.value = "false";
educationData.educationLevel = ""; educationData.educationLevel = "";
@ -610,17 +618,13 @@ function editForm(row: any) {
dialog.value = true; dialog.value = true;
} }
/** /** function ปิด popup มูลประวัติการศึกษา*/
* function popup ลประวการศกษา
*/
function closeDialog() { function closeDialog() {
clearForm(); clearForm();
dialog.value = false; dialog.value = false;
} }
/** /** funcitob ปิด popup ประวัติการศึกษา*/
* funcitob popup ประวการศกษา
*/
function closeHistoryDialog() { function closeHistoryDialog() {
historyDialog.value = false; historyDialog.value = false;
historyKeyword.value = ""; historyKeyword.value = "";
@ -637,6 +641,7 @@ async function fetchData(id: string) {
.get(config.API.profileNewEducationByProfileId(id, empType.value)) .get(config.API.profileNewEducationByProfileId(id, empType.value))
.then(async (res) => { .then(async (res) => {
rows.value = await res.data.result; rows.value = await res.data.result;
rowsMain.value = await res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -646,9 +651,7 @@ async function fetchData(id: string) {
}); });
} }
/** /** function fetch ข้อมูลระดับการศึกษา*/
* function fetch อมลระดบการศกษา
*/
function fetchEducationLevel() { function fetchEducationLevel() {
http http
.get(config.API.orgEducationLevel) .get(config.API.orgEducationLevel)
@ -676,6 +679,7 @@ function fetchHistoryData(id: string) {
.get(config.API.profileNewEducationHisByEducationId(id, empType.value)) .get(config.API.profileNewEducationHisByEducationId(id, empType.value))
.then(async (res) => { .then(async (res) => {
historyRows.value = await res.data.result; historyRows.value = await res.data.result;
historyRowsMain.value = await res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -685,9 +689,7 @@ function fetchHistoryData(id: string) {
}); });
} }
/** /** function เพิ่มข้อมูลประวัติการศึกษา*/
* function เพมขอมลประวการศกษา
*/
function addData() { function addData() {
showLoader(); showLoader();
http http
@ -741,9 +743,25 @@ function editData(idData: string) {
}); });
} }
/** /** ฟังก์ค้นหาข้อมูลรายการประวัติการศึกษา */
* ทำงานเม Components กเรยกใชงาน function serchDataTable() {
*/ rows.value = onSearchDataTable(
keyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** ฟังก์ค้นหาข้อมูลรายการประวัติการศึกษา */
function serchDataTableHistory() {
historyRows.value = onSearchDataTable(
historyKeyword.value,
historyRowsMain.value,
historyColumns.value ? historyColumns.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(async () => { onMounted(async () => {
await fetchData(id.value); await fetchData(id.value);
fetchEducationLevel(); fetchEducationLevel();
@ -771,7 +789,13 @@ onMounted(async () => {
> >
<q-space /> <q-space />
<q-input dense outlined v-model="keyword" label="ค้นหา"> <q-input
dense
outlined
v-model="keyword"
label="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
</template> </template>
@ -832,7 +856,6 @@ onMounted(async () => {
flat flat
bordered bordered
:paging="true" :paging="true"
:filter="keyword.trim()"
dense dense
v-model:pagination="pagination" v-model:pagination="pagination"
:rows-per-page-options="[20, 50, 100]" :rows-per-page-options="[20, 50, 100]"
@ -998,6 +1021,7 @@ onMounted(async () => {
</template> </template>
</d-table> </d-table>
<!-- แกไขขอมลประวการศกษา -->
<q-dialog v-model="dialog" class="dialog" persistent> <q-dialog v-model="dialog" class="dialog" persistent>
<q-card> <q-card>
<q-form @submit.prevent greedy @validation-success="onSubmit()"> <q-form @submit.prevent greedy @validation-success="onSubmit()">
@ -1433,6 +1457,7 @@ onMounted(async () => {
</q-card> </q-card>
</q-dialog> </q-dialog>
<!-- ประวแกไขประวการศกษา -->
<q-dialog v-model="historyDialog" class="dialog" persistent> <q-dialog v-model="historyDialog" class="dialog" persistent>
<q-card style="min-width: 80%"> <q-card style="min-width: 80%">
<dialog-header <dialog-header
@ -1451,6 +1476,7 @@ onMounted(async () => {
v-model="historyKeyword" v-model="historyKeyword"
label="ค้นหา" label="ค้นหา"
class="q-mr-sm" class="q-mr-sm"
@keydown.enter.pervent="serchDataTableHistory"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -1481,7 +1507,6 @@ onMounted(async () => {
bordered bordered
:paging="true" :paging="true"
dense dense
:filter="historyKeyword.trim()"
v-model:pagination="historyPagination" v-model:pagination="historyPagination"
:rows-per-page-options="[20, 50, 100]" :rows-per-page-options="[20, 50, 100]"
class="custom-header-table" class="custom-header-table"

View file

@ -26,6 +26,7 @@ const {
success, success,
date2Thai, date2Thai,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = mixin; } = mixin;
const id = ref<string>(route.params.id.toString()); //id profile const id = ref<string>(route.params.id.toString()); //id profile
@ -41,6 +42,7 @@ const isLeave = defineModel<boolean>("isLeave", {
//Table //Table
const keyword = ref<string>(""); // const keyword = ref<string>(""); //
const rows = ref<ResponseObject[]>([]); // const rows = ref<ResponseObject[]>([]); //
const rowsMain = ref<ResponseObject[]>([]); //
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "field", name: "field",
@ -100,6 +102,7 @@ const editId = ref<string>(""); //idที่ต้องการแก้ไ
const historyDialog = ref<boolean>(false); // popup const historyDialog = ref<boolean>(false); // popup
const historyRows = ref<ResponseObject[]>([]); // const historyRows = ref<ResponseObject[]>([]); //
const historyRowsMain = ref<ResponseObject[]>([]); //
const historyKeyword = ref<string>(""); // const historyKeyword = ref<string>(""); //
const historyColumns = ref<QTableProps["columns"]>([ const historyColumns = ref<QTableProps["columns"]>([
{ {
@ -200,9 +203,7 @@ const historyPagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** function ยืนยันการบันทึกข้อมูล*/
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm( dialogConfirm(
$q, $q,
@ -214,9 +215,7 @@ function onSubmit() {
); );
} }
/** /** function เคลียร์ formData*/
* function เคลยร formData
*/
function clearForm() { function clearForm() {
specialSkill.detail = ""; specialSkill.detail = "";
specialSkill.field = ""; specialSkill.field = "";
@ -238,15 +237,14 @@ function editForm(row: any) {
dialog.value = true; dialog.value = true;
} }
/** /** function fetch ข้อมูลความสามรรถพิเศษ*/
* function fetch อมลความสามรรถพเศษ
*/
async function fetchData(id: string) { async function fetchData(id: string) {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewAbilityByProfileId(id, empType.value)) .get(config.API.profileNewAbilityByProfileId(id, empType.value))
.then(async (res) => { .then(async (res) => {
rows.value = await res.data.result; rows.value = await res.data.result;
rowsMain.value = await res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -266,6 +264,7 @@ async function fetchHistoryData(id: string) {
.get(config.API.profileNewAbilityHisByAbilityId(id, empType.value)) .get(config.API.profileNewAbilityHisByAbilityId(id, empType.value))
.then(async (res) => { .then(async (res) => {
historyRows.value = await res.data.result; historyRows.value = await res.data.result;
historyRowsMain.value = await res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -275,9 +274,7 @@ async function fetchHistoryData(id: string) {
}); });
} }
/** /** function เพิ่มข้อมูลความสามรรถพิเศษ*/
* function เพมขอมลความสามรรถพเศษ
*/
async function addData() { async function addData() {
showLoader(); showLoader();
await http await http
@ -327,29 +324,42 @@ async function editData(idData: string) {
}); });
} }
/** /** function ปิด popup ข้อมูลความสามารถพิเศษ*/
* function popup อมลความสามารถพเศษ
*/
function closeDialog() { function closeDialog() {
dialog.value = false; dialog.value = false;
} }
/** /** function ปิด popup รายการประวัติ*/
* function popup รายการประว
*/
function closeHistoryDialog() { function closeHistoryDialog() {
historyDialog.value = false; historyDialog.value = false;
historyKeyword.value = ""; historyKeyword.value = "";
historyRows.value = []; historyRows.value = [];
} }
/** /** ฟังก์ค้นหาข้อมูลรายการความสามาพิเศษ */
* ทำงานเม Components กเรยกใชงาน function serchDataTable() {
*/ rows.value = onSearchDataTable(
keyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** ฟังก์ค้นหาข้อมูลรายการประวัติแก้ไขความสามารถพิเศษ */
function serchDataTableHistory() {
historyRows.value = onSearchDataTable(
historyKeyword.value,
historyRowsMain.value,
historyColumns.value ? historyColumns.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => { onMounted(() => {
fetchData(id.value); fetchData(id.value);
}); });
</script> </script>
<template> <template>
<div class="row items-center q-gutter-x-sm q-pb-sm"> <div class="row items-center q-gutter-x-sm q-pb-sm">
<q-btn <q-btn
@ -364,7 +374,13 @@ onMounted(() => {
<q-tooltip>เพมขอม</q-tooltip> <q-tooltip>เพมขอม</q-tooltip>
</q-btn> </q-btn>
<q-space /> <q-space />
<q-input dense outlined v-model="keyword" label="ค้นหา"> <q-input
dense
outlined
v-model="keyword"
label="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
</template> </template>
@ -426,7 +442,6 @@ onMounted(() => {
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
:paging="true" :paging="true"
:filter="keyword.trim()"
v-model:pagination="pagination" v-model:pagination="pagination"
:rows-per-page-options="[20, 50, 100]" :rows-per-page-options="[20, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
@ -530,6 +545,7 @@ onMounted(() => {
</template> </template>
</d-table> </d-table>
<!-- แกไขขอมลความสามารถพเศษ -->
<q-dialog v-model="dialog" class="dialog" persistent> <q-dialog v-model="dialog" class="dialog" persistent>
<q-card> <q-card>
<q-form @submit.prevent greedy @validation-success="onSubmit()"> <q-form @submit.prevent greedy @validation-success="onSubmit()">
@ -602,6 +618,7 @@ onMounted(() => {
</q-card> </q-card>
</q-dialog> </q-dialog>
<!-- ประวแกไขความสามารถพเศษ -->
<q-dialog v-model="historyDialog" persistent> <q-dialog v-model="historyDialog" persistent>
<q-card style="width: 900px; max-width: 80vw"> <q-card style="width: 900px; max-width: 80vw">
<dialog-header <dialog-header
@ -619,6 +636,7 @@ onMounted(() => {
v-model="historyKeyword" v-model="historyKeyword"
label="ค้นหา" label="ค้นหา"
class="q-mr-sm" class="q-mr-sm"
@keydown.enter.pervent="serchDataTableHistory"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -649,7 +667,6 @@ onMounted(() => {
bordered bordered
:paging="true" :paging="true"
dense dense
:filter="historyKeyword.trim()"
v-model:pagination="historyPagination" v-model:pagination="historyPagination"
:rows-per-page-options="[20, 50, 100]" :rows-per-page-options="[20, 50, 100]"
class="custom-header-table" class="custom-header-table"

View file

@ -32,9 +32,7 @@ const profileId = ref<string>(
route.params.id ? route.params.id.toString() : "" route.params.id ? route.params.id.toString() : ""
); );
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -48,12 +46,14 @@ const {
messageError, messageError,
success, success,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = useCounterMixin(); } = useCounterMixin();
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
//Table //Table
const rows = ref<ResListSalary[]>([]); // const rows = ref<ResListSalary[]>([]); //
const rowsMain = ref<ResListSalary[]>([]); //
const keyword = ref<string>(""); // const keyword = ref<string>(""); //
const modalCommand = ref<boolean>(false); const modalCommand = ref<boolean>(false);
const command = ref<string>(""); const command = ref<string>("");
@ -214,15 +214,14 @@ const posExecutiveOptionMain = ref<DataOption[]>([]);
const docOption = ref<DataOption2[]>(store.optionTemplateDoc); const docOption = ref<DataOption2[]>(store.optionTemplateDoc);
/** /** function fetch รายการ ตำแหน่งเงินเดือน*/
* function fetch รายการ ตำแหนงเงนเดอน
*/
async function fetchListSalary() { async function fetchListSalary() {
showLoader(); showLoader();
await http await http
.get(config.API.profileListSalaryNew(profileId.value, empType.value)) .get(config.API.profileListSalaryNew(profileId.value, empType.value))
.then((res) => { .then((res) => {
rows.value = res.data.result; rows.value = res.data.result;
rowsMain.value = res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -232,9 +231,7 @@ async function fetchListSalary() {
}); });
} }
/** /** function fetch รายการ ตำแหน่งเงินเดือน*/
* function fetch รายการ ตำแหนงเงนเดอน
*/
function fetchType() { function fetchType() {
http http
.get(config.API.orgPosType) .get(config.API.orgPosType)
@ -316,9 +313,7 @@ function onClickOpenDialog(statusEdit: boolean = false, data: any = []) {
formDataSalary.doc = statusEdit ? data.templateDoc : ""; formDataSalary.doc = statusEdit ? data.templateDoc : "";
} }
/** /** function ปิด dialog ตำแหน่งเงินเดือน*/
* function dialog ตำแหนงเงนเดอน
*/
function onClickCloseDialog() { function onClickCloseDialog() {
modalDialogSalary.value = false; modalDialogSalary.value = false;
} }
@ -403,9 +398,7 @@ function updateDoc(val: string) {
formDataSalary.doc = val; formDataSalary.doc = val;
} }
/** /** function ยืนยันการบันทึกข้อมูล */
* function นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
showLoader(); showLoader();
@ -511,9 +504,7 @@ function onClikcHistory(id: string) {
modalHistory.value = true; modalHistory.value = true;
} }
/** /** function fetch ข้อมูลสายงาน*/
* function fetch อมลสายงาน
*/
function fetchDataOption() { function fetchDataOption() {
showLoader(); showLoader();
http http
@ -563,9 +554,7 @@ function fetchDataOption() {
}); });
} }
/** /** function fetch ข้อมูลตำแหน่งข้อมูลทางการบริหาร*/
* function fetch อมลตำแหนงขอมลทางการบรหาร
*/
function fetchDataOptionExecutive() { function fetchDataOptionExecutive() {
showLoader(); showLoader();
http http
@ -585,9 +574,7 @@ function fetchDataOptionExecutive() {
}); });
} }
/** /** function fetch ข้อมูลปรเภทตำแหน่ง*/
* function fetch อมลปรเภทตำแหน
*/
function fetchOptionGroup() { function fetchOptionGroup() {
showLoader(); showLoader();
http http
@ -621,9 +608,16 @@ function onRefCommand(data: ResListSalary) {
commandId.value = data.commandId; commandId.value = data.commandId;
// commandId.value = 'bdf9da91-ba45-497a-a2b7-cc49e2446d97'; // // commandId.value = 'bdf9da91-ba45-497a-a2b7-cc49e2446d97'; //
} }
/**
* ทำงานเม Components กเรยกใชงาน function serchDataTable() {
*/ rows.value = onSearchDataTable(
keyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => { onMounted(() => {
fetchListSalary(); fetchListSalary();
}); });
@ -642,7 +636,14 @@ onMounted(() => {
<q-tooltip>เพมขอม</q-tooltip> <q-tooltip>เพมขอม</q-tooltip>
</q-btn> </q-btn>
<q-space /> <q-space />
<q-input dense outlined v-model="keyword" label="ค้นหา" class="q-mr-sm"> <q-input
dense
outlined
v-model="keyword"
label="ค้นหา"
class="q-mr-sm"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
</template> </template>
@ -668,12 +669,11 @@ onMounted(() => {
flat flat
bordered bordered
dense dense
:filter="keyword.trim()"
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
:paging="true" :paging="true"
v-model:pagination="pagination" v-model:pagination="pagination"
:rows-per-page-options="[20, 50, 100]" :rows-per-page-options="[10, 20, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
> >
<template v-slot:header="props"> <template v-slot:header="props">

View file

@ -14,18 +14,23 @@ import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
const { date2Thai, showLoader, hideLoader, messageError, pathRegistryEmp } = const {
useCounterMixin(); date2Thai,
showLoader,
hideLoader,
messageError,
pathRegistryEmp,
onSearchDataTable,
} = useCounterMixin();
/** /** props*/
* props
*/
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const salaryId = defineModel<string>("salaryId", { required: true }); const salaryId = defineModel<string>("salaryId", { required: true });
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const rows = ref<ResListSalary[]>([]); // const rows = ref<ResListSalary[]>([]); //
const rowsMain = ref<ResListSalary[]>([]); //
const keyword = ref<string>(""); // const keyword = ref<string>(""); //
const baseColumns = ref<QTableProps["columns"]>([ const baseColumns = ref<QTableProps["columns"]>([
{ {
@ -233,15 +238,14 @@ const pagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** function fetch ข้อมูลประวัติการแก้ไข*/
* function fetch อมลประวการแกไข
*/
function fetchListHistory() { function fetchListHistory() {
showLoader(); showLoader();
http http
.get(config.API.profileListSalaryHistoryNew(salaryId.value, empType.value)) .get(config.API.profileListSalaryHistoryNew(salaryId.value, empType.value))
.then((res) => { .then((res) => {
rows.value = res.data.result; rows.value = res.data.result;
rowsMain.value = res.data.result;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -251,18 +255,24 @@ function fetchListHistory() {
}); });
} }
/** /** ฟังก์ชันปิด Popup*/
* งกนป Popup
*/
function closeDialog() { function closeDialog() {
modal.value = false; modal.value = false;
keyword.value = ""; keyword.value = "";
rows.value = []; rows.value = [];
} }
/** ฟังก์ค้นหาข้อมูลรายการวินัย */
function serchDataTable() {
rows.value = onSearchDataTable(
keyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** /**
* การเปลยนแปลงของ modal * การเปลยนแปลงของ modal
*
* modal เป true เรยก getHistory เพอดงขอมลประวการแกไข * modal เป true เรยก getHistory เพอดงขอมลประวการแกไข
*/ */
watch( watch(
@ -289,6 +299,7 @@ watch(
v-model="keyword" v-model="keyword"
label="ค้นหา" label="ค้นหา"
class="q-mr-sm" class="q-mr-sm"
@keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -315,7 +326,6 @@ watch(
flat flat
bordered bordered
dense dense
:filter="keyword.trim()"
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
:paging="true" :paging="true"

View file

@ -25,6 +25,7 @@ const {
messageError, messageError,
success, success,
pathRegistryEmp, pathRegistryEmp,
onSearchDataTable,
} = useCounterMixin(); } = useCounterMixin();
const id = ref<string>(""); const id = ref<string>("");
@ -33,9 +34,7 @@ const profileId = ref<string>(
); );
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
/** /** props*/
* props
*/
const isLeave = defineModel<boolean>("isLeave", { const isLeave = defineModel<boolean>("isLeave", {
required: true, required: true,
}); });
@ -55,6 +54,7 @@ const formData = reactive<RequestNoPaidObject>({
//Table //Table
const rows = ref<RowList[]>([]); // const rows = ref<RowList[]>([]); //
const rowsMain = ref<RowList[]>([]); //
const keyword = ref<string>(""); // const keyword = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
@ -128,9 +128,7 @@ const pagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** funciton ยืนยันการบันทึกข้อมูล*/
* funciton นยนการบนทกขอม
*/
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, () => {
isStatusEdit.value ? editData() : saveData(); isStatusEdit.value ? editData() : saveData();
@ -153,23 +151,20 @@ function onClickOpenDialog(StatusEdit: boolean = false, data: any = []) {
modalDialog.value = true; modalDialog.value = true;
} }
/** /** function ปิด Didalig บันทึกวันที่ไม่ได้รับเงินเดือนฯ*/
* function Didalig นทกวนทไมไดบเงนเดอนฯ
*/
function onClickCloseDialog() { function onClickCloseDialog() {
modalDialog.value = false; modalDialog.value = false;
isStatusEdit.value = false; isStatusEdit.value = false;
} }
/** /** function fetch รายการบันทึกวันที่ไม่ได้รับเงินเดือนฯ*/
* function fetch รายการบนทกวนทไมไดบเงนเดอนฯ
*/
async function getData() { async function getData() {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewNoPaidByProfileId(profileId.value, empType.value)) .get(config.API.profileNewNoPaidByProfileId(profileId.value, empType.value))
.then(async (res) => { .then(async (res) => {
rows.value = await res.data.result; rows.value = await res.data.result;
rowsMain.value = await res.data.result;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -179,9 +174,7 @@ async function getData() {
}); });
} }
/** /** function เพิ่มข้อมูลรายการบันทึกวันที่ไม่ได้รับเงินเดือนฯ*/
* function เพมขอมลรายการบนทกวนทไมไดบเงนเดอนฯ
*/
function saveData() { function saveData() {
showLoader(); showLoader();
http http
@ -203,9 +196,7 @@ function saveData() {
}); });
} }
/** /** function แก้ไขข้อมูลรายการบันทึกวันที่ไม่ได้รับเงินเดือนฯ*/
* function แกไขขอมลรายการบนทกวนทไมไดบเงนเดอนฯ
*/
function editData() { function editData() {
showLoader(); showLoader();
http http
@ -226,17 +217,21 @@ function editData() {
}); });
} }
/** /** function เปิดข้อมูลประวัติการแก้ไช*/
* function เปดขอมลประวการแกไช
*/
function onClickHistory(rowId: string) { function onClickHistory(rowId: string) {
id.value = rowId; id.value = rowId;
modalHistory.value = true; modalHistory.value = true;
} }
/** function serchDataTable() {
* ทำงานเม Components กเรยกใชงาน rows.value = onSearchDataTable(
*/ keyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน */
onMounted(() => { onMounted(() => {
getData(); getData();
}); });
@ -262,7 +257,7 @@ onMounted(() => {
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
debounce="300" @keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -323,7 +318,6 @@ onMounted(() => {
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
:paging="true" :paging="true"
:filter="keyword.trim()"
v-model:pagination="pagination" v-model:pagination="pagination"
:rows-per-page-options="[20, 50, 100]" :rows-per-page-options="[20, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"

View file

@ -14,8 +14,14 @@ import DialogHeader from "@/components/DialogHeader.vue";
const route = useRoute(); const route = useRoute();
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, pathRegistryEmp } = const {
mixin; showLoader,
hideLoader,
messageError,
date2Thai,
pathRegistryEmp,
onSearchDataTable,
} = mixin;
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
@ -25,6 +31,7 @@ const id = defineModel<string>("id", { required: true });
//Table //Table
const filter = ref<string>(""); // const filter = ref<string>(""); //
const rows = ref<RowList[]>([]); // const rows = ref<RowList[]>([]); //
const rowsMain = ref<RowList[]>([]); //
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "date", name: "date",
@ -121,15 +128,14 @@ const pagination = ref({
rowsPerPage: 10, rowsPerPage: 10,
}); });
/** /** fetch รายการข้อมูลประวัติการแก้ไช*/
* fetch รายการขอมลประวการแกไช
*/
async function getHistory() { async function getHistory() {
showLoader(); showLoader();
await http await http
.get(config.API.profileNewNoPaidHisById(id.value, empType.value)) .get(config.API.profileNewNoPaidHisById(id.value, empType.value))
.then(async (res) => { .then(async (res) => {
rows.value = await res.data.result; rows.value = await res.data.result;
rowsMain.value = await res.data.result;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -139,17 +145,22 @@ async function getHistory() {
}); });
} }
/** /** ฟังก์ชันปิด Popup*/
* งกนป Popup
*/
function closeDialog() { function closeDialog() {
modal.value = false; modal.value = false;
rows.value = []; rows.value = [];
} }
function serchDataTable() {
rows.value = onSearchDataTable(
filter.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/** /**
* การเปลยนแปลงของ modal * การเปลยนแปลงของ modal
*
* modal เป true เรยก getHistory เพอดงขอมลประวการแกไข * modal เป true เรยก getHistory เพอดงขอมลประวการแกไข
*/ */
watch(modal, (status) => { watch(modal, (status) => {
@ -162,7 +173,7 @@ watch(modal, (status) => {
}); });
</script> </script>
<template> <template>
<q-dialog v-model="modal" persistent full-width> <q-dialog v-model="modal" persistent>
<q-card style="min-width: 80%"> <q-card style="min-width: 80%">
<DialogHeader <DialogHeader
:tittle="'ประวัติแก้ไขบันทึกวันที่ไม่ได้รับเงินเดือนฯ'" :tittle="'ประวัติแก้ไขบันทึกวันที่ไม่ได้รับเงินเดือนฯ'"
@ -179,6 +190,7 @@ watch(modal, (status) => {
v-model="filter" v-model="filter"
label="ค้นหา" label="ค้นหา"
class="q-mr-sm" class="q-mr-sm"
@keydown.enter.pervent="serchDataTable"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" /> <q-icon name="search" />
@ -205,7 +217,6 @@ watch(modal, (status) => {
flat flat
bordered bordered
dense dense
:filter="filter.trim()"
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
:paging="true" :paging="true"