hrms-user/src/modules/06_evaluate/components/directorandmeet/Table.vue
2023-12-22 17:36:09 +07:00

178 lines
3.9 KiB
Vue

<script setup lang="ts">
import { ref, onMounted } from "vue";
import type { QTableProps } from "quasar";
const props = defineProps({
type: {
type: String,
},
row: {
type: Object,
},
});
const columnsDrictor = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fullName",
align: "left",
label: "ชื่อ - นามสกุล",
sortable: true,
field: "fullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "position",
align: "left",
label: "ตำแหน่ง",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
// {
// name: "duty",
// align: "left",
// label: "หน้าที่",
// sortable: true,
// field: "duty",
// headerStyle: "font-size: 14px",
// style: "font-size: 14px",
// },
{
name: "email",
align: "left",
label: "อีเมล",
sortable: true,
field: "email",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "phone",
align: "left",
label: "เบอร์โทรศัพท์",
sortable: true,
field: "phone",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const columnsMeeting = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateMeeting",
align: "left",
label: "วันเวลาในการประชุม",
sortable: true,
field: "dateMeeting",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "result",
align: "left",
label: "ผลการพิจารณาของคณะกรรมการประเมินผลงานแต่ละคณะ",
sortable: true,
field: "result",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "duration",
align: "left",
label: "ระยะเวลาในการแก้ไขผลงาน",
sortable: true,
field: "duration",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const columns = ref<QTableProps["columns"]>([]);
onMounted(() => {
columns.value =
props.type === "director" ? columnsDrictor.value : columnsMeeting.value;
});
</script>
<template>
<q-table
ref="table"
flat
bordered
class="custom-header-table"
:columns="columns"
:rows="props.row"
dense
:rows-per-page-options="[10, 25, 50, 100]"
>
<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" v-html="col.label" />
</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.name" :props="props">
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div>
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
</q-table>
</template>
<style lang="scss" scoped>
.custom-header-table {
height: auto;
.q-table tr:nth-child(odd) td {
background: white;
}
.q-table tr:nth-child(even) td {
background: #f8f8f8;
}
.q-table thead tr {
background: #ecebeb;
}
.q-table thead tr th {
position: sticky;
z-index: 1;
}
/* this will be the loading indicator */
.q-table thead tr:last-child th {
/* height of all previous header rows */
top: 48px;
}
.q-table thead tr:first-child th {
top: 0;
}
}
</style>