ปรับ paging ทะเบียนประวัติ และตำแหน่งของทะเบียนประวัติใหม่

This commit is contained in:
Warunee Tamkoo 2024-04-03 16:26:02 +07:00
parent 1958d4db7d
commit 93c4fb9139
3 changed files with 33 additions and 32 deletions

View file

@ -22,6 +22,7 @@ const props = defineProps({
rows: { type: Array },
fetchData: { type: Function },
fetchType: { type: Function },
total: { type: Number },
});
const columns = ref<QTableProps["columns"]>([
@ -74,7 +75,7 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "สายงาน",
sortable: true,
field: (v) => (v.posType ? v.posType.posTypeName : "-"),
field: "posType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
@ -85,7 +86,7 @@ const columns = ref<QTableProps["columns"]>([
align: "left",
label: "ระดับตำแหน่ง",
sortable: true,
field: (v) => (v.posLevel ? v.posLevel.posLevelName : "-"),
field: "posLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
@ -282,12 +283,8 @@ watch(
</q-tr>
</template>
<template v-slot:body="props" v-if="store.mode === 'table'">
<q-tr :props="props" class="cursor-pointer">
<q-td
v-for="col in props.cols"
:key="col.id"
@click="onClickViewDetail(props.row.id)"
>
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{
(formFilter.page - 1) * formFilter.pageSize + props.rowIndex + 1
@ -311,7 +308,11 @@ watch(
</q-avatar>
</q-item-section>
<q-item-section>
<div class="text-weight-medium">
<div
class="text-weight-medium text-primary cursor-pointer"
@click="onClickViewDetail(props.row.id)"
>
<q-tooltip>ทะเบยนประว</q-tooltip>
{{
`${props.row.prefix}${props.row.firstName} ${props.row.lastName}`
}}
@ -329,18 +330,13 @@ watch(
</template>
<template v-slot:item="props" v-else>
<div class="col-xs-12 col-sm-4 col-md-3">
<q-card
flat
bordered
class="cardRO"
@click="onClickViewDetail(props.row.id)"
>
<q-card flat bordered class="">
<q-card-section class="text-center q-pb-none">
<q-avatar size="80px">
<img src="@/assets/avatar_user.jpg" />
</q-avatar>
<div class="text-weight-medium q-mt-md textName">
<div class="text-weight-medium q-mt-md">
{{
`${props.row.prefix}${props.row.firstName} ${props.row.lastName}`
}}
@ -384,7 +380,7 @@ watch(
<q-item-section>
<q-item-label caption class="text-black">
{{
props.row.posType ? props.row.posType.posTypeName : "-"
props.row.posType ? props.row.posType : "-"
}}</q-item-label
>
</q-item-section>
@ -397,9 +393,7 @@ watch(
<q-item-section>
<q-item-label caption class="text-black">
{{
props.row.posLevel
? props.row.posLevel.posLevelName
: "-"
props.row.posLevel ? props.row.posLevel : "-"
}}</q-item-label
>
</q-item-section>
@ -407,18 +401,19 @@ watch(
</q-list>
</q-card>
</q-card-section>
<!-- <q-separator inset />
<q-separator inset />
<q-btn
flat
color="black"
label="ดูเพิ่มเติม"
class="hover-button full-width q-pa-md"
@click="onClickViewDetail(props.row.id)"
/> -->
/>
</q-card>
</div>
</template>
<template v-slot:pagination="scope">
งหมด {{ props.total }} รายการ
<q-pagination
v-model="formFilter.page"
active-color="primary"