ปรับ code รายการลา
This commit is contained in:
parent
52bfaeb0e8
commit
7b8f8d705f
5 changed files with 168 additions and 248 deletions
|
|
@ -1,23 +1,16 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, useAttrs, onMounted, watch } from "vue";
|
||||
import { ref, useAttrs, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useLeaveStore } from "@/modules/05_leave/store";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
/** import stort*/
|
||||
const leaveStore = useLeaveStore();
|
||||
const { messageError } = mixin;
|
||||
const { fetchLeaveType, filterOption } = leaveStore;
|
||||
const { filterOption } = leaveStore;
|
||||
|
||||
const attrs = ref<any>(useAttrs());
|
||||
|
||||
const $q = useQuasar();
|
||||
|
||||
const table = ref<any>(null);
|
||||
const filterRef = ref<any>(null);
|
||||
|
||||
/** รับ props มาจากหน้าหลัก */
|
||||
const props = defineProps({
|
||||
count: Number,
|
||||
|
|
@ -54,6 +47,8 @@ const emit = defineEmits([
|
|||
"update:editvisible",
|
||||
]);
|
||||
|
||||
const table = ref<any>(null);
|
||||
|
||||
/**
|
||||
* ตั้งค่า pagination
|
||||
*/
|
||||
|
|
@ -65,9 +60,10 @@ const pagination = ref({
|
|||
rowsPerPage: Number(props.pageSize),
|
||||
});
|
||||
|
||||
const updateVisible = (value: []) => {
|
||||
/** updateVisible*/
|
||||
function updateVisible(value: []) {
|
||||
emit("update:inputvisible", value);
|
||||
};
|
||||
}
|
||||
|
||||
/** filter */
|
||||
const year = ref<number>(new Date().getFullYear());
|
||||
|
|
@ -75,38 +71,25 @@ const type = ref<string>("00000000-0000-0000-0000-000000000000");
|
|||
const status = ref<string>("ALL");
|
||||
const filter = ref<string>("");
|
||||
|
||||
/** function updateFilter*/
|
||||
function filterTable() {
|
||||
emit("update:filter", year.value, type.value, status.value, filter.value);
|
||||
}
|
||||
|
||||
/** function updatePagination*/
|
||||
function updatePagination(p: number, ps: number) {
|
||||
emit("update:Pagination", p, ps);
|
||||
}
|
||||
|
||||
/** function updatePageSize*/
|
||||
function updatePageSize(newPageSize: any) {
|
||||
currentPage.value = 1;
|
||||
pagination.value.rowsPerPage = newPageSize.rowsPerPage;
|
||||
}
|
||||
|
||||
// async function fectOptionType() {
|
||||
// await http
|
||||
// .get(config.API.leaveType())
|
||||
// .then(async (res) => {
|
||||
// const data = res.data.result;
|
||||
// await fetchLeaveType(data);
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// messageError($q, err);
|
||||
// });
|
||||
// }
|
||||
|
||||
watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
|
||||
updatePagination(currentPage.value, pagination.value.rowsPerPage);
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
// await fectOptionType();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="q-py-sm row">
|
||||
|
|
@ -198,28 +181,7 @@ onMounted(async () => {
|
|||
</template></q-select
|
||||
>
|
||||
<q-space />
|
||||
<!-- <q-input
|
||||
standout
|
||||
dense
|
||||
v-model="filter"
|
||||
ref="filterRef"
|
||||
@keydown.enter.prevent="filterTable"
|
||||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
class="gt-xs"
|
||||
style="max-width: 150px"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filter == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="filter !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="filter = ''"
|
||||
/>
|
||||
</template>
|
||||
</q-input> -->
|
||||
|
||||
<!-- แสดงคอลัมน์ใน table -->
|
||||
<q-select
|
||||
:model-value="inputvisible"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue