แก้ฟิลเตอร์ระบบ บรรจุ

This commit is contained in:
setthawutttty 2024-12-11 11:49:34 +07:00
parent a15efd7b45
commit b8f336d2ba
7 changed files with 88 additions and 23 deletions

View file

@ -52,7 +52,7 @@ const mixin = useCounterMixin();
const {
date2Thai,
success,
onSearchDataTable,
messageError,
showLoader,
hideLoader,
@ -82,6 +82,7 @@ const modalHistory = ref<boolean>(false); //modal ประวัติการ
const profileId = ref<string>("");
const rows = ref<Certificate[]>([]);
const rowsData = ref<Certificate[]>([]);
const filter = ref<string>(""); //search data table
const visibleColumns = ref<String[]>([]);
profileData.certicate.columns.length == 0
@ -333,6 +334,7 @@ const saveData = async () => {
await props.fetch("Certificate");
await success($q, "บันทึกข้อมูลสำเร็จ");
rows.value = props.data;
rowsData.value = props.data;
modal.value = false;
})
.catch((e) => {
@ -359,6 +361,7 @@ const editData = async () => {
await props.fetch("Certificate");
await success($q, "บันทึกข้อมูลสำเร็จ");
rows.value = props.data;
rowsData.value = props.data;
modal.value = false;
})
.catch((e) => {
@ -384,6 +387,7 @@ const clickDelete = async () => {
await props.fetch("Certificate");
await success($q, "ลบข้อมูลสำเร็จ");
rows.value = props.data;
rowsData.value = props.data;
modal.value = false;
})
.catch((e) => {
@ -488,6 +492,14 @@ const getClass = (val: boolean) => {
};
};
function onSearch() {
rows.value = onSearchDataTable(
filter.value,
rowsData.value,
columns.value ? columns.value : []
);
}
watch(visibleColumns, async (count: String[], prevCount: String[]) => {
changeProfileColumns("certicate", count);
});
@ -497,6 +509,7 @@ onMounted(() => {
profileId.value = route.params.personalId.toString();
}
rows.value = props.data;
rowsData.value = props.data;
});
</script>
<template>
@ -505,7 +518,7 @@ onMounted(() => {
<ProfileTable
:rows="rows"
:columns="columns"
:filter="filter"
:on-search="onSearch"
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
v-model:inputvisible="visibleColumns"