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

122 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";
// importStroe
import { useLeavelistDataStore } from "../stores/LeaveStore";
// importComponets
import TableList from "../components/2_Leave/TableList.vue";
const leaveStore = useLeavelistDataStore();
const { fecthList, clearFilter } = leaveStore;
onMounted(() => {
fecthLeaveList();
});
2023-10-09 09:31:01 +07:00
// เรียกข้อมูลจาก API
2023-10-06 13:32:54 +07:00
function fecthLeaveList() {
const data = [
{
leaveType: "ลาป่วย",
name: "นายกัณฐิมา กาฬสินธ์ุ",
Date: "",
status: "1",
},
{
leaveType: "ลากิจส่วนตัว",
name: "นายนครชัย วันดี",
Date: "",
status: "3",
},
{
leaveType: "ลากิจส่วนตัว",
name: "นายกัณฐิมา กาฬสินธ์ุ",
Date: "",
status: "2",
},
{
leaveType: "ลาป่วย",
name: "นายปิยรมย์ ศิริธาราฟ",
Date: "",
status: "2",
},
];
2023-10-09 09:31:01 +07:00
fecthList(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"> -->
<div class="q-pa-md">
<q-tabs
v-model="leaveStore.tab"
dense
align="left"
inline-label
class="bg-grey-4 rounded-borders"
indicator-color="white"
>
<q-tab
@click="changTab"
name="1"
label="รายการลาที่อยู่ระหว่างดำเนิดการ"
:class="
leaveStore.tab == '1' ? 'bg-white text-primary rounded-borders ' : ''
"
>
<q-badge
color="grey-4"
:class="
leaveStore.tab == '1'
? 'q-px-sm text-weight-medium text-primary q-ml-xl'
: 'q-px-sm text-weight-medium text-black q-ml-xl'
"
:label="leaveStore.amounttab1"
rounded
/>
</q-tab>
<q-tab
@click="changTab"
name="2"
label="รายการลาทั้งหมด"
:class="
leaveStore.tab == '2'
? 'bg-white text-primary rounded rounded-borders '
: ''
"
>
<q-badge
color="grey-4"
:class="
leaveStore.tab == '2'
? 'q-px-sm text-weight-medium text-primary q-ml-xl'
: 'q-px-sm text-weight-medium text-black q-ml-xl'
"
:label="leaveStore.amounttab2"
rounded
/>
</q-tab>
</q-tabs>
<q-tab-panels v-model="leaveStore.tab" animated>
<q-tab-panel name="1">
<!-- <TableList1 /> -->
<TableList />
</q-tab-panel>
<q-tab-panel name="2">
<!-- <TabList2Vue /> -->
<TableList />
</q-tab-panel>
</q-tab-panels>
</div>
<!-- </q-card> -->
</div>
</template>
<style scoped></style>