hrms-mgt/src/modules/09_leave/views/LeaveListMain.vue

117 lines
3.3 KiB
Vue
Raw Normal View History

2023-10-06 13:32:54 +07:00
<script setup lang="ts">
import { ref, onMounted } from "vue";
2023-10-20 16:57:32 +07:00
import type { DataRows } from "@/modules/09_leave/interface/response/leave";
2023-10-06 13:32:54 +07:00
// importStroe
2023-10-20 10:31:07 +07:00
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
2023-10-06 13:32:54 +07:00
// importComponets
2023-10-20 10:31:07 +07:00
import TableList from "@/modules/09_leave/components/2_Leave/TableList.vue";
2023-10-20 16:57:32 +07:00
import ToolBar from "@/modules/09_leave/components/2_Leave/ToolBar.vue";
2023-10-06 13:32:54 +07:00
const leaveStore = useLeavelistDataStore();
2023-10-19 15:39:18 +07:00
const { fetchList, clearFilter } = leaveStore;
2023-10-06 13:32:54 +07:00
onMounted(() => {
fecthLeaveList();
});
2023-10-09 09:31:01 +07:00
// เรียกข้อมูลจาก API
2023-10-06 13:32:54 +07:00
function fecthLeaveList() {
2023-10-20 16:57:32 +07:00
const data: DataRows = [
2023-10-06 13:32:54 +07:00
{
leaveType: "ลาป่วย",
name: "นายกัณฐิมา กาฬสินธ์ุ",
Date: "",
status: "1",
},
{
leaveType: "ลากิจส่วนตัว",
name: "นายนครชัย วันดี",
Date: "",
status: "3",
},
{
leaveType: "ลากิจส่วนตัว",
name: "นายกัณฐิมา กาฬสินธ์ุ",
Date: "",
status: "2",
},
{
leaveType: "ลาป่วย",
name: "นายปิยรมย์ ศิริธาราฟ",
Date: "",
status: "2",
},
];
2023-10-19 15:39:18 +07:00
fetchList(data); // ส่งข้อมูลไป stores
2023-10-06 13:32:54 +07:00
}
//เปลี่ยน Tab
function changTab() {
clearFilter();
fecthLeaveList();
}
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">รายการลา</div>
<div>
<!-- <q-card flat bordered class="col-12 q-mt-sm"> -->
2023-10-19 15:39:18 +07:00
<q-card bordered flat>
2023-10-06 13:32:54 +07:00
<q-tabs
v-model="leaveStore.tab"
dense
align="left"
inline-label
class="rounded-borders"
indicator-color="primary"
active-bg-color="teal-1"
active-class="text-primary"
2023-10-06 13:32:54 +07:00
>
<q-tab
@click="changTab"
name="1"
label="รายการลาที่อยู่ระหว่างดำเนินการ"
2023-10-06 13:32:54 +07:00
>
<q-badge
color="grey-4"
:class="
leaveStore.tab == '1'
? 'q-px-sm text-weight-medium text-primary q-ml-xl bg-teal-1'
2023-10-06 13:32:54 +07:00
: 'q-px-sm text-weight-medium text-black q-ml-xl'
"
:label="leaveStore.amounttab1"
rounded
/>
</q-tab>
2023-10-19 15:39:18 +07:00
<q-tab @click="changTab" name="2" label="รายการลาทั้งหมด">
2023-10-06 13:32:54 +07:00
<q-badge
color="grey-4"
:class="
leaveStore.tab == '2'
? 'q-px-sm text-weight-medium text-primary q-ml-xl bg-teal-1'
2023-10-06 13:32:54 +07:00
: 'q-px-sm text-weight-medium text-black q-ml-xl'
"
:label="leaveStore.amounttab2"
rounded
/>
</q-tab>
</q-tabs>
<q-separator />
2023-10-06 13:32:54 +07:00
<q-tab-panels v-model="leaveStore.tab" animated>
<q-tab-panel name="1">
<!-- <TableList1 /> -->
2023-10-20 16:57:32 +07:00
<ToolBar />
2023-10-06 13:32:54 +07:00
<TableList />
</q-tab-panel>
<q-tab-panel name="2">
<!-- <TabList2Vue /> -->
2023-10-20 16:57:32 +07:00
<ToolBar />
2023-10-06 13:32:54 +07:00
<TableList />
</q-tab-panel>
</q-tab-panels>
2023-10-19 15:39:18 +07:00
<!-- </q-card> -->
</q-card>
2023-10-06 13:32:54 +07:00
</div>
</template>
<style scoped></style>