hrms-mgt/src/modules/04_registryNew/components/registry/TableView.vue

89 lines
2.5 KiB
Vue

<script setup lang="ts">
import { QTableColumn } from "quasar";
const visibleColumns = defineModel<string[]>("visibleColumns");
const props = defineProps<{
columns: QTableColumn[];
}>();
const rows = [
{
no: 1,
fullName: "นางสาวกัณฐิมา กานสิน",
citizenId: "1231231231234",
posNo: "สกก.1",
position: "นักบริหาร",
posPath: "บริหาร",
posType: "บริหาร",
posLevel: "ชำนาญการพิเศษ",
posOc: "ฝ่ายบริหารงานทั่วไป",
year: 2566,
salary: "40,000",
},
{
no: 2,
fullName: "นายธามไทย คนคูเมือง",
citizenId: "5555555555555",
posNo: "สกก.5",
position: "นักจัดการงานทั่วไป",
posPath: "จัดการงานทั่วไป",
posType: "วิชาการ",
posLevel: "ปฏิบัติการ",
posOc: "ฝ่ายบริหารงานทั่วไป",
year: 2566,
salary: "25,000",
},
];
</script>
<!-- :filter="filterKeyword"
:visible-columns="visibleColumns" -->
<template>
<d-table
ref="table"
:columns="props.columns"
:rows="rows"
row-key="name"
flat
bordered
:paging="true"
dense
class="custom-header-table q-mx-lg"
:visible-columns="visibleColumns"
>
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.id">
<template v-if="col.name == 'fullName'">
<q-item v-ripple>
<q-item-section avatar>
<img
src="@/assets/avatar_user.jpg"
class="col-4 img-info"
style="width: 35px; height: 40px; border-radius: 50%"
/>
</q-item-section>
<q-item-section>
<div class="text-weight-medium">{{ props.row.fullName }}</div>
<div class="text-weight-light">{{ props.row.citizenId }}</div>
</q-item-section>
</q-item>
</template>
<template v-else>
{{ col.value }}
</template>
</q-td>
</q-tr>
</template>
</d-table>
</template>