fix(leave):sort

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-10-08 10:37:36 +07:00
parent 7a833e0ee5
commit fb3902edce
15 changed files with 388 additions and 973 deletions

View file

@ -188,7 +188,8 @@ watch(
formData.checkOutLocationName = stores.formData.checkOutLocationName;
}
}
}
},
{ deep: true }
);
</script>

View file

@ -2,9 +2,6 @@
import { ref, watch } from "vue";
import { loadModules } from "esri-loader";
// const apiKey = ref<string>(
// "YLATgWuywoeRLHn6KImj5rg7UaP8bJoR9jiTldoCVBHlqFIebwMSA5wIXEmcYhwXwMHkmNISEYtUz3x0oiGIIx0bIXXnUwi0OzupoOEtDrQIsRPVtor7gaPpXEmH8TrNaMT3snf6zO_yujHLGzborg"
// );
const props = defineProps({
modal: {
type: Boolean,

View file

@ -1,8 +1,10 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { usePagination } from "@/composables/usePagination";
/** importType*/
import type { QTableProps } from "quasar";
@ -20,20 +22,21 @@ import { useCounterMixin } from "@/stores/mixin";
import { useWorklistDataStore } from "@/modules/09_leave/stores/WorkStore";
const $q = useQuasar(); // noti quasar
const mixin = useCounterMixin();
const workStore = useWorklistDataStore();
const { date2Thai, dateToISO, showLoader, hideLoader, messageError } = mixin;
const { date2Thai, dateToISO, showLoader, hideLoader, messageError } =
useCounterMixin();
const { pagination, params, onRequest } = usePagination(
"",
fetchListTimeRecord
);
/** ตัวแปร querySting*/
const total = ref<number>(0);
const keyword = ref<string>("");
const page = ref<number>(1);
const rowsPerPage = ref<number>(10);
const maxPage = ref<number>(1);
const filetStatus = ref<string>("ALL");
const roleStatus = ref<string>("ALL");
const keyword = ref<string>(""); //keyword
const filetStatus = ref<string>("ALL"); //*
const roleStatus = ref<string>("ALL"); //*
/** ข้อมูลตาราง*/
const rows = ref<TableRowsTime[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -112,7 +115,7 @@ const columns = ref<QTableProps["columns"]>([
name: "checkOutStatus",
align: "left",
label: "สถานะ",
sortable: true,
sortable: false,
field: "checkOutStatus",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
@ -129,33 +132,31 @@ const visibleColumns = ref<string[]>([
"checkOutLocation",
"checkOutStatus",
]);
const rows = ref<TableRowsTime[]>([]);
/** function เรียกข้อมูล รายการลงเวลาที่ประมวลผลแล้ว*/
/** ฟังก์ชันเรียกข้อมูลรายการลงเวลาที่ประมวลผลแล้ว*/
async function fetchListTimeRecord() {
rows.value = [];
showLoader();
const date = new Date(workStore.selectDate as string | Date);
const querySting = {
...params.value,
startDate: dateToISO(date), //*
endDate: dateToISO(date), //*
status: filetStatus.value, //*
page: page.value, //*
pageSize: rowsPerPage.value, //*
keyword: keyword.value.trim(), //keyword
profileType: roleStatus.value.trim(), //keyword
};
showLoader();
await http
.get(
config.API.timeRecord() +
`?startDate=${querySting.startDate}&endDate=${querySting.startDate}&status=${querySting.status}&page=${querySting.page}&pageSize=${querySting.pageSize}&keyword=${querySting.keyword}&profileType=${querySting.profileType}`
)
.get(config.API.timeRecord(), {
params: {
...querySting,
},
})
.then((res) => {
total.value = res.data.result.total;
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
const datalist: TableRowsTime[] = res.data.result.data.map(
(e: DataResTime) => ({
const result = res.data.result;
pagination.value.rowsNumber = result.total;
if (result.data.length > 0) {
rows.value = result.data.map((e: DataResTime) => ({
id: e.id,
fullName: e.fullName,
profileType: e.profileType,
@ -175,35 +176,21 @@ async function fetchListTimeRecord() {
checkOutStatus: e.checkOutStatus
? workStore.convertSatatus(e.checkOutStatus)
: "-",
})
);
rows.value = datalist;
}));
}
})
.catch((err) => {
messageError($q, err);
rows.value = [];
})
.finally(() => {
hideLoader();
});
}
/**
* function updatePaging และเรยกขอมลอกรอบ
* @param params pagin
* @param currentPage page
* @param key คำคนหา
* @param status สถานะ
*/
async function updatePaging(
params: any,
currentPage: number,
key: string,
status: string
) {
page.value = currentPage;
rowsPerPage.value = params.rowsPerPage ?? rowsPerPage.value;
keyword.value = key ?? keyword.value;
filetStatus.value = status ?? filetStatus.value;
/** ฟังก์ชันค้นหาข้อมูล */
async function onSearchData() {
pagination.value.page = 1;
await fetchListTimeRecord();
}
@ -214,22 +201,23 @@ onMounted(async () => {
await fetchListTimeRecord();
});
</script>
<template>
<!-- Toolbar -->
<ToolBar
:filetStatus="filetStatus"
@update:pagination="updatePaging"
v-model:filetStatus="filetStatus"
v-model:role-status="roleStatus"
v-model:keyword="keyword"
:on-search-data="onSearchData"
/>
<!-- ตาราง -->
<TableList
:total="total"
:rows="rows.length > 0 ? rows : []"
v-model:page="page"
:rowsPerPage="rowsPerPage"
:maxPage="maxPage"
@update:pagination="updatePaging"
:tab="'time-record'"
:fetchData="fetchListTimeRecord"
:on-request="onRequest"
v-model:pagination="pagination"
/>
</template>

View file

@ -1,8 +1,10 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { usePagination } from "@/composables/usePagination";
/** importType*/
import type { QTableProps } from "quasar";
@ -20,14 +22,18 @@ import { useCounterMixin } from "@/stores/mixin";
import { useWorklistDataStore } from "@/modules/09_leave/stores/WorkStore";
/** useStore */
const total = ref<number>(0);
const mixin = useCounterMixin();
const workStore = useWorklistDataStore();
const { date2Thai, dateToISO, showLoader, hideLoader, messageError } = mixin;
const roleStatus = ref<string>("ALL");
const $q = useQuasar(); // noti quasar
const workStore = useWorklistDataStore();
const { date2Thai, dateToISO, showLoader, hideLoader, messageError } =
useCounterMixin();
const { pagination, params, onRequest } = usePagination("", fetchListLogRecord);
/** ตัวแปร QueryString*/
const keyword = ref<string>("");
const roleStatus = ref<string>("ALL");
/** ข้อมูลตาราง*/
const rows = ref<TableRows[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -102,66 +108,55 @@ const visibleColumns = ref<string[]>([
"checkOutTime",
"checkOutLocation",
]);
const rows = ref<TableRows[]>([]);
/** ตัวแปร QueryString*/
const keyword = ref<string>("");
const page = ref<number>(1);
const rowsPerPage = ref<number>(10);
const maxPage = ref<number>(1);
/** function เรียกข้อมูลรายการลงเวลาปฏิบัติงาน (รายการลงเวลา) */
/** ฟังก์ชันเรียกข้อมูลรายการลงเวลาปฏิบัติงาน (รายการลงเวลา) */
async function fetchListLogRecord() {
rows.value = [];
showLoader();
const date = new Date(workStore.selectDate as string | Date);
await http
.get(
config.API.logRecord() +
`?startDate=${dateToISO(date)}&endDate=${dateToISO(date)}&page=${
page.value
}&pageSize=${rowsPerPage.value}&keyword=${keyword.value}&profileType=${
roleStatus.value
}`
)
.get(config.API.logRecord(), {
params: {
...params.value,
startDate: dateToISO(date), //*
endDate: dateToISO(date), //*
keyword: keyword.value.trim(), //keyword
profileType: roleStatus.value.trim(), //keyword
},
})
.then((res) => {
total.value = res.data.result.total;
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
let datalist: TableRows[] = res.data.result.data.map((e: DataResLog) => ({
id: e.id,
profileType: e.profileType,
fullName: e.fullName,
checkInDate: e.checkInDate && date2Thai(e.checkInDate),
checkInTime: e.checkInTime ? e.checkInTime : "-",
checkInLocation: e.checkInLocation ? e.checkInLocation : "-",
checkInLat: e.checkInLat ? e.checkInLat : "",
checkInLon: e.checkInLon ? e.checkInLon : "",
checkOutDate: e.checkOutDate && date2Thai(e.checkOutDate),
checkOutLocation: e.checkOutLocation ? e.checkOutLocation : "-",
checkOutTime: e.checkOutTime ? e.checkOutTime : "-",
checkOutLat: e.checkOutLat ? e.checkOutLat : "",
checkOutLon: e.checkOutLon ? e.checkOutLon : "",
}));
rows.value = datalist;
const result = res.data.result;
pagination.value.rowsNumber = result.total;
if (result.data.length > 0) {
rows.value = result.data.map((e: DataResLog) => ({
id: e.id,
profileType: e.profileType,
fullName: e.fullName,
checkInDate: e.checkInDate && date2Thai(e.checkInDate),
checkInTime: e.checkInTime ? e.checkInTime : "-",
checkInLocation: e.checkInLocation ? e.checkInLocation : "-",
checkInLat: e.checkInLat ? e.checkInLat : "",
checkInLon: e.checkInLon ? e.checkInLon : "",
checkOutDate: e.checkOutDate && date2Thai(e.checkOutDate),
checkOutLocation: e.checkOutLocation ? e.checkOutLocation : "-",
checkOutTime: e.checkOutTime ? e.checkOutTime : "-",
checkOutLat: e.checkOutLat ? e.checkOutLat : "",
checkOutLon: e.checkOutLon ? e.checkOutLon : "",
}));
}
})
.catch((err) => {
messageError($q, err);
rows.value = [];
})
.finally(() => {
hideLoader();
});
}
/**
* function นหาตามหนาทเลอก
* @param params pagination
* @param currentPage page
* @param key keyword นหา
*/
async function updatePagingProp(params: any, currentPage: number, key: string) {
page.value = currentPage;
rowsPerPage.value = params.rowsPerPage ?? rowsPerPage.value;
keyword.value = key ?? keyword.value;
/*** ฟังก์ชันค้นหาข้อมูล */
async function onSearchData() {
pagination.value.page = 1;
await fetchListLogRecord();
}
@ -174,18 +169,17 @@ onMounted(async () => {
</script>
<template>
<ToolBarDate
:keyword="keyword"
@update:pagination="updatePagingProp"
v-model:keyword="keyword"
v-model:role-status="roleStatus"
:on-search-data="onSearchData"
/>
<TableList
:total="total"
:rows="rows.length > 0 ? rows : []"
v-model:page="page"
:rowsPerPage="rowsPerPage"
:maxPage="maxPage"
@update:pagination="updatePagingProp"
:tab="'log-record'"
:fetchData="fetchListLogRecord"
:on-request="onRequest"
v-model:pagination="pagination"
/>
</template>

View file

@ -1,38 +1,26 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { ref, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useWorklistDataStore } from "@/modules/09_leave/stores/WorkStore";
import type { PropsTable } from "@/interface/index/PropsTable";
import type { DataWorkList } from "@/modules/09_leave/interface/index/Main";
/** importComponents */
import DialogDetail from "@/modules/09_leave/components/02_WorkList/DialogDetail.vue";
import DialogEdit from "@/modules/09_leave/components/02_WorkList/DialogEdit.vue";
const workStore = useWorklistDataStore();
const currentPage = defineModel<number>("page", {
default: 1,
const pagination = defineModel<PropsTable.Pagination>("pagination", {
required: true,
});
const props = defineProps({
rows: {
type: Object,
require: true,
},
// page: {
// type: Number,
// require: true,
// },
rowsPerPage: {
type: Number,
require: true,
},
maxPage: {
type: Number,
require: true,
},
total: {
type: Number,
require: true,
},
tab: {
type: String,
require: true,
@ -41,48 +29,30 @@ const props = defineProps({
type: Function,
require: true,
},
onRequest: {
type: Function,
require: true,
},
});
const emit = defineEmits(["update:pagination"]);
/** ข้อมูล popup */
const modal = ref<boolean>(false);
const dataDetail = ref<any>();
const modalEdit = ref<boolean>(false);
/** pagination */
// const currentPage = ref<number>(1);
const pagination = ref({
descending: false,
page: Number(currentPage.value),
rowsPerPage: props.rowsPerPage,
});
/**
* function ปเดท props
* @param newPagination paging
* @param page หนาป
*/
function updateProp(newPagination: any, page: number) {
// event parent component props
emit("update:pagination", newPagination, page);
}
const typeTab = ref<string>("");
const modal = ref<boolean>(false); //modal
const dataDetail = ref<DataWorkList>(); //
const modalEdit = ref<boolean>(false); //modal
const typeTab = ref<string>(""); // tab
/**
* Function openPopup และแสดงรายละเอยด
* @param data อมลรายละเอยด
*/
function clickDetail(data: any) {
function clickDetail(data: DataWorkList) {
typeTab.value = props.tab as string;
modal.value = true;
dataDetail.value = data;
}
function onClickEdit(data: any) {
function onClickEdit(data: DataWorkList) {
modalEdit.value = !modalEdit.value;
dataDetail.value = modalEdit.value ? data : [];
dataDetail.value = modalEdit.value ? data : undefined;
}
/** Function ปิด popup */
@ -90,27 +60,13 @@ function closeDetail() {
modal.value = false;
}
/** function Callblck ทำงานเมื่อ pagination มีการเปลี่ยนแปลง */
watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
updateProp(pagination.value, currentPage.value);
});
/**
* function updatePageSize
* @param newPagination PageSize
*/
function updateRowsPerPagen(newPagination: any) {
pagination.value.rowsPerPage = newPagination.rowsPerPage;
currentPage.value = 1;
}
onMounted(() => {
typeTab.value = props.tab as string;
});
</script>
<template>
<d-table
<p-table
ref="table"
:columns="workStore.columns"
:rows="props.rows"
@ -120,9 +76,9 @@ onMounted(() => {
dense
class="custom-header-table"
:visible-columns="workStore.visibleColumns"
:rows-per-page-options="[10, 25, 50, 100]"
:pagination="pagination"
@update:pagination="updateRowsPerPagen"
:rows-per-page-options="[1, 10, 25, 50, 100]"
v-model:pagination="pagination"
@request="props.onRequest"
>
<template v-slot:header="props">
<q-tr :props="props">
@ -164,11 +120,7 @@ onMounted(() => {
</q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">
{{
(currentPage - 1) * Number(pagination.rowsPerPage) +
props.rowIndex +
1
}}
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'checkInLocation'">
<q-item style="padding: 0">
@ -203,19 +155,7 @@ onMounted(() => {
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="currentPage"
active-color="primary"
color="dark"
:max="Number(props.maxPage)"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</d-table>
</p-table>
<DialogDetail
:modal="modal"

View file

@ -13,23 +13,24 @@ const workStore = useWorklistDataStore();
const mixin = useCounterMixin();
const { date2Thai } = mixin;
const filetStatus = defineModel<string>("filetStatus", {
required: true,
});
const roleStatus = defineModel<string>("roleStatus", {
required: true,
});
const keyword = defineModel<string>("keyword", {
required: true,
});
/** props จาก Tab 1*/
const props = defineProps({
filetStatus: {
type: String,
onSearchData: {
type: Function,
require: true,
},
});
const emit = defineEmits(["update:pagination"]);
/** ตัแปร filter**/
const filetStatus = ref<string>(
props.filetStatus?.toString() || "default-value"
);
const roleStatus = defineModel<string>("roleStatus", { required: true });
const keyword = ref<string>("");
const optionMain = ref<DataOption[]>([
{ id: "ALL", name: "ทั้งหมด" },
{ id: "NORMAL", name: "ปกติ" },
@ -45,20 +46,9 @@ const roleMainOp = ref<DataOption[]>([
const option = ref<DataOption[]>(optionMain.value);
const roleOp = ref<DataOption[]>(roleMainOp.value);
/**
* function updateProps
* @param newPagination paging
* @param keyword คำค
* @param status สถานะ
*/
function updateProp(newPagination: any, keyword: string, status: string) {
// event parent component props
emit("update:pagination", newPagination, 1, keyword, status);
}
/** function ค้นหาข้อมูลแล้วไปอัปเดท props*/
function filterFn() {
updateProp([], keyword.value, filetStatus.value);
props.onSearchData?.();
}
/**
@ -70,13 +60,13 @@ function filterOptionFn(val: string, update: Function, type?: string) {
if (type == "role") {
update(() => {
roleOp.value = roleMainOp.value.filter(
(e: any) => e.name.search(val) !== -1
(e: DataOption) => e.name.search(val) !== -1
);
});
} else {
update(() => {
option.value = optionMain.value.filter(
(e: any) => e.name.search(val) !== -1
(e: DataOption) => e.name.search(val) !== -1
);
});
}
@ -92,7 +82,7 @@ function calculateMaxDate() {
<template>
<div class="row col-12 q-col-gutter-sm q-mb-sm">
<div class="col-xs-12 col-sm-3 col-md-2">
<div class="col-xs-12 col-sm-4 col-md-2">
<datepicker
v-model="workStore.selectDate"
:locale="'th'"
@ -127,7 +117,7 @@ function calculateMaxDate() {
</template>
</datepicker>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<div class="col-xs-12 col-sm- col-md-3">
<q-select
for="selectStatus"
emit-value
@ -162,7 +152,7 @@ function calculateMaxDate() {
</template>
</q-select>
</div>
<div class="col-xs-12 col-sm-3 col-md-2">
<div class="col-xs-12 col-sm-4 col-md-2">
<q-select
for="selectStatus"
emit-value
@ -197,7 +187,7 @@ function calculateMaxDate() {
</q-select>
</div>
<q-space />
<div class="col-xs-12 col-sm-3 col-md-2">
<div class="col-xs-12 col-sm-5 col-md-2">
<q-input
for="filterTable"
dense

View file

@ -16,9 +16,13 @@ const emit = defineEmits(["update:pagination"]);
/** ตัวแปร filter*/
const roleStatus = defineModel<string>("roleStatus", { required: true });
const keyword = ref<string>("");
const pagination = ref({
page: 1,
const keyword = defineModel<string>("keyword", { required: true });
const props = defineProps({
onSearchData: {
type: Function,
require: true,
},
});
const roleMainOp = ref<DataOption[]>([
@ -28,16 +32,6 @@ const roleMainOp = ref<DataOption[]>([
]);
const roleOp = ref<DataOption[]>(roleMainOp.value);
/**
* function updateProps
* @param newPagination paging
* @param keyword คำคนหา
*/
function updateProp(newPagination: any, keyword: string) {
// event parent component props
emit("update:pagination", newPagination, 1, keyword);
}
/** Functicon หาค่ามากสุดและปิดวันที่ไม่ให้เลือกวันล่วงหน้า*/
function calculateMaxDate() {
const today = new Date();
@ -45,9 +39,9 @@ function calculateMaxDate() {
return today;
}
/** function ค้นหาข้อมูล แล้ว อัปเดท Props*/
/** function ค้นหาข้อมูล */
function filterFn() {
updateProp(pagination.value, keyword.value);
props.onSearchData?.();
}
/**
@ -58,7 +52,7 @@ function filterFn() {
function filterOptionFn(val: string, update: Function) {
update(() => {
roleOp.value = roleMainOp.value.filter(
(e: any) => e.name.search(val) !== -1
(e: DataOption) => e.name.search(val) !== -1
);
});
}
@ -66,7 +60,7 @@ function filterOptionFn(val: string, update: Function) {
<template>
<div class="row col-12 q-col-gutter-sm q-mb-sm">
<div class="col-xs-12 col-sm-3 col-md-2">
<div class="col-xs-12 col-sm-6 col-md-2">
<datepicker
v-model="workStore.selectDate"
:locale="'th'"
@ -101,7 +95,7 @@ function filterOptionFn(val: string, update: Function) {
</template>
</datepicker>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<div class="col-xs-12 col-sm-6 col-md-3">
<q-select
for="selectStatus"
emit-value
@ -136,7 +130,7 @@ function filterOptionFn(val: string, update: Function) {
</q-select>
</div>
<q-space />
<div class="col-xs-12 col-sm-3 col-md-2">
<div class="col-xs-12 col-sm-5 col-md-2">
<q-input
for="filterTable"
dense

View file

@ -1,239 +0,0 @@
<script setup lang="ts">
import { ref, useAttrs } from "vue";
/** import Stoer*/
import { useCounterMixin } from "@/stores/mixin";
import { useSpecialTimeStore } from "@/modules/09_leave/stores/SpecialTimeStore";
const attrs = ref<any>(useAttrs());
const SpecialTimeStore = useSpecialTimeStore();
const mixin = useCounterMixin();
const { date2Thai } = mixin;
const { searchFilterTable } = SpecialTimeStore;
/** props*/
const props = defineProps({
count: Number,
pass: Number,
notpass: Number,
inputfilter: String,
name: String,
icon: String,
inputvisible: Array,
editvisible: Boolean,
add: {
type: Function,
default: () => console.log("not function"),
},
validate: {
type: Function,
default: () => console.log("not function"),
},
nornmalData: {
type: Boolean,
defualt: true,
},
conclude: {
type: Boolean,
defualt: false,
},
});
/**emit Function*/
const emit = defineEmits([
"update:inputfilter",
"update:inputvisible",
"update:editvisible",
]);
const table = ref<any>(null);
const filterRef = ref<any>(null);
/** pagination*/
const paging = ref<boolean>(true);
const pagination = ref({
descending: false,
page: 1,
rowsPerPage: 10,
});
function paginationLabel(start: string, end: string, total: string) {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
}
/**
* function update filter
* @param value คำคนหา
*/
function updateInput(value: string | number | null) {
emit("update:inputfilter", value);
}
/**
* function updateVisible
* @param value Visible
*/
function updateVisible(value: []) {
emit("update:inputvisible", value);
}
function resetFilter() {
// reset X
emit("update:inputfilter", "");
filterRef.value.focus();
}
</script>
<template>
<div class="q-pb-sm row q-col-gutter-sm">
<!-- -->
<div class="q-gutter-sm" v-if="nornmalData == true">
<datepicker
v-model="SpecialTimeStore.selectDate"
:locale="'th'"
autoApply
:enableTimePicker="false"
week-start="0"
@update:model-value="searchFilterTable(SpecialTimeStore.selectDate)"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
for="selectDate"
dense
outlined
:model-value="
SpecialTimeStore.selectDate !== null
? date2Thai(SpecialTimeStore.selectDate)
: null
"
hide-bottom-space
:label="`${'วันที่'}`"
>
<template v-slot:prepend>
<q-icon name="event" class="cursor-pointer text-primary">
</q-icon>
</template>
</q-input>
</template>
</datepicker>
</div>
<q-space />
<!-- นหาขอความใน table -->
<q-input
standout
dense
:model-value="inputfilter"
ref="filterRef"
@update:model-value="updateInput"
outlined
placeholder="ค้นหา"
style="max-width: 200px"
class="col-xs-12 col-sm-3 col-md-2"
>
<template v-slot:append>
<q-icon v-if="inputfilter == ''" name="search" />
<q-icon
v-if="inputfilter !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
<!-- แสดงคอลมนใน table -->
<q-select
:model-value="inputvisible"
@update:model-value="updateVisible"
:display-value="$q.lang.table.columns"
multiple
outlined
dense
:options="attrs.columns"
options-dense
option-value="name"
map-options
emit-value
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2 gt-xs"
>
<template> </template>
</q-select>
</div>
<d-table
ref="table"
flat
v-bind="attrs"
virtual-scroll
:virtual-scroll-sticky-size-start="48"
dense
:pagination-label="paginationLabel"
v-model:pagination="pagination"
>
<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-th auto-width />
<q-th auto-width />
<q-th auto-width v-if="nornmalData == true" />
</q-tr>
</template>
<template #body="props">
<slot v-bind="props" name="columns"></slot>
</template>
</d-table>
</template>
<style lang="scss">
.icon-color {
color: #4154b3;
}
.custom-table2 {
max-height: 64vh;
.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;
}
.q-table td:nth-of-type(2) {
z-index: 3 !important;
}
.q-table th:nth-of-type(2),
.q-table td:nth-of-type(2) {
position: sticky;
left: 0;
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>