ปรับ filte Table ข้อมูลทะเบียนประวัติ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-04 15:15:36 +07:00
parent 7ab17d378f
commit 2b36b70715
26 changed files with 841 additions and 682 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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