hrms-user/src/modules/03_leave/views/Main.vue

174 lines
4.8 KiB
Vue
Raw Normal View History

2023-07-21 16:34:06 +07:00
<script setup lang="ts">
2023-08-09 10:23:41 +07:00
import type { QTableProps } from "quasar";
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
2023-07-21 16:34:06 +07:00
2023-08-09 10:23:41 +07:00
import Table from "@/components/Table.vue";
2023-07-21 16:34:06 +07:00
2023-08-09 10:23:41 +07:00
const router = useRouter();
const $q = useQuasar();
2023-07-21 16:34:06 +07:00
2023-08-09 10:23:41 +07:00
const filter = ref<string>("");
const visibleColumns = ref<String[]>([
"no",
"placeLeave",
"dateStartLeave",
"dateLeave",
"status",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px; width:5px;",
},
{
name: "placeLeave",
align: "left",
label: "สถานที่ยื่นขอลาออกจากราชการ",
sortable: true,
field: "placeLeave",
headerStyle: "font-size: 14px",
style: "font-size: 14px; width:15%;",
},
{
name: "dateStartLeave",
align: "left",
label: "วันที่ยื่นขอลาออกจากราชการ",
sortable: true,
field: "dateStartLeave",
headerStyle: "font-size: 14px",
style: "font-size: 14px; width:15%;",
},
{
name: "dateLeave",
align: "left",
label: "วันที่ขอลาออกจากราชการ",
sortable: true,
field: "dateLeave",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px; width:10%;",
},
]);
2023-07-21 16:34:06 +07:00
const rows = ref<any>([
2023-08-09 10:23:41 +07:00
{
placeLeave: "สํานักงานกรุงเทพมหานคร ",
dateStartLeave: "02/02/2566",
dateLeave: "10/03/2565",
status: "รอดำเนินการ",
},
{
placeLeave: "สํานักงานกรุงเทพมหานคร ",
dateStartLeave: "02/02/2566",
dateLeave: "10/03/2565",
status: "เสร็จสิ้น",
},
{
placeLeave: "สํานักงานกรุงเทพมหานคร ",
dateStartLeave: "02/02/2566",
dateLeave: "10/03/2565",
status: "เสร็จสิ้น",
},
]);
2023-07-21 16:34:06 +07:00
const initialPagination = ref({
2023-08-09 10:23:41 +07:00
rowsPerPage: 0,
});
onMounted(() => {
fectListleave();
});
const fectListleave = async () => {
2023-08-09 10:57:44 +07:00
// console.log(config.API.listUser());
2023-08-09 10:23:41 +07:00
2023-08-09 10:57:44 +07:00
await http.get(config.API.listUser()).then((res:any)=>{}).catch((e:any)=>{});
2023-08-09 10:23:41 +07:00
};
2023-07-21 16:34:06 +07:00
const clickAdd = async () => {
2023-08-09 10:23:41 +07:00
router.push(`/leave/add`);
};
2023-07-21 16:34:06 +07:00
</script>
<template>
2023-08-09 10:23:41 +07:00
<div class="col-12 row justify-center">
<div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle text-white col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="router.go(-1)"
/>
ลาออก
</div>
<div class="col-12">
<q-card bordered class="q-pa-md">
<Table
style="max-height: 80vh"
:rows="rows"
:columns="columns"
:filter="filter"
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
v-model:inputvisible="visibleColumns"
:pagination="initialPagination"
:inputShow="false"
:add="clickAdd"
:titleText="''"
>
<template #columns="props">
<q-tr
:props="props"
class="cursor-pointer"
@click="router.push(`/leave/1`)"
>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'status'">
<q-icon
size="20px"
v-if="props.row.status == 'รอดำเนินการ'"
name="mdi-timer-sand"
color="deep-orange"
>
<q-tooltip>รอดำเนนการ</q-tooltip>
</q-icon>
<q-icon size="20px" v-else name="mdi-check" color="teal">
<q-tooltip>เสรจส</q-tooltip>
</q-icon>
</div>
<div v-else>
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
</Table>
</q-card>
</div>
</div>
</div>
2023-07-21 16:34:06 +07:00
</template>
<style></style>