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

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

View file

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

View file

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

View file

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