This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-24 11:39:10 +07:00
parent 36b136bd0e
commit 4a852f580d
2 changed files with 71 additions and 114 deletions

View file

@ -69,13 +69,6 @@ const pagination = ref({
//
const filterKeyword = ref<string>("");
const filterRef = ref<HTMLInputElement | null>(null);
const resetFilter = () => {
filterKeyword.value = "";
fetchData();
if (filterRef.value) {
filterRef.value.focus();
}
};
const visibleColumns = ref<String[]>([
"no",
@ -193,7 +186,6 @@ function closeDialog() {
async function clickSave(reason: string) {
dialogConfirm($q, async () => {
showLoader();
modalUnapprove.value = false;
const body = {
reason: reason,
};
@ -202,6 +194,7 @@ async function clickSave(reason: string) {
.then(async () => {
await fetchData();
success($q, "บันทึกข้อมูลสำเร็จ");
modalUnapprove.value = false;
})
.catch((e) => {
messageError($q, e);
@ -253,6 +246,8 @@ watch(
* งชนเรยกดอม
*/
async function fetchData() {
console.log(pagination.value.page);
showLoader();
await http
.get(
@ -264,7 +259,7 @@ async function fetchData() {
}&keyword=${filterKeyword.value.trim()}`
)
.then(async (res) => {
let data = res.data.result.data;
let data = await res.data.result.data;
total.value = res.data.result.total;
totalList.value = Math.ceil(
res.data.result.total / pagination.value.rowsPerPage
@ -310,7 +305,6 @@ async function fetchData() {
})
.finally(() => {
hideLoader();
console.log(month.value);
});
}
@ -403,7 +397,7 @@ onMounted(async () => {
<d-table
:columns="columns"
:rows="rows"
row-key="tb-list"
row-key="id"
flat
bordered
:paging="false"
@ -412,20 +406,6 @@ onMounted(async () => {
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="pagination.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="fetchData()"
></q-pagination>
</template>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
@ -500,14 +480,29 @@ onMounted(async () => {
v-else-if="col.name === 'description'"
class="table_ellipsis"
>
{{ props.row.description }}
{{ col.value ?? "-" }}
</div>
<div v-else>
{{ col.value }}
{{ col.value ?? "-" }}
</div>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="pagination.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="fetchData()"
></q-pagination>
</template>
</d-table>
</div>
</q-card>
@ -528,6 +523,7 @@ onMounted(async () => {
:id="id"
:editCheck="editCheck"
:detailData="detailData"
:fetch-data="fetchData"
/>
</template>