ปรับ 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

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

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

View file

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

View file

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

View file

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