fix filter ==> รายชื่อลูกจ้างชั่วคราว

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-10 13:37:22 +07:00
parent e7a271dd8e
commit 0796c36f73
2 changed files with 38 additions and 84 deletions

View file

@ -29,6 +29,7 @@ const {
messageError,
dialogMessageNotify,
dialogConfirm,
onSearchDataTable,
} = useCounterMixin();
const route = useRoute();
@ -197,6 +198,8 @@ const visibleColumns = ref<string[]>([
/** Position*/
const positionNo = ref<PositionNo[]>([]); //
const positionNoMain = ref<PositionNo[]>([]); //
const positionId = ref<string>(""); //id
const seletcId = ref<string>(""); // id
const selectedPos = ref<any[]>([]); //
@ -278,6 +281,7 @@ async function fetchDataTable(id: string, level: number = 0) {
}
});
positionNo.value = dataMain;
positionNoMain.value = dataMain;
})
.catch((err) => {
messageError($q, err);
@ -416,6 +420,14 @@ async function onClickSelectPos(id: string) {
}
}
function serchDataTable() {
positionNo.value = onSearchDataTable(
filters.value,
positionNoMain.value,
columns.value ? columns.value : []
);
}
/** callback function เมื่อมีการเปิด popup*/
watch(
() => modal.value,
@ -489,12 +501,7 @@ onBeforeMount(async () => {
label="ค้นหา"
>
<template v-slot:append>
<q-icon
v-if="filterTree !== ''"
name="clear"
class="cursor-pointer"
@click="filterTree = ''"
/>
<q-icon name="search" color="grey-5" />
</template>
</q-input>
<q-tree
@ -503,7 +510,7 @@ onBeforeMount(async () => {
default-expand-all
:nodes="lazy"
node-key="orgTreeId"
label-key="orgTreeName"
label-key="labelName"
:filter="filterTree.trim()"
no-results-label="ไม่พบข้อมูลที่ค้นหา"
no-nodes-label="ไม่มีข้อมูล"
@ -566,7 +573,7 @@ onBeforeMount(async () => {
<div class="col-12"><q-separator /></div>
<div class="col-12 q-pa-md">
<q-toolbar style="padding: 0px">
<div class="row q-gutter-md">
<div class="row q-gutter-sm">
<q-checkbox
keep-color
v-model="isBlank"
@ -578,7 +585,7 @@ onBeforeMount(async () => {
</div>
<q-space />
<div class="row q-gutter-md">
<div class="row q-gutter-sm">
<q-checkbox
keep-color
v-model="isAll"
@ -595,6 +602,7 @@ onBeforeMount(async () => {
dense
v-model="filters"
label="ค้นหา"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append>
<q-icon name="search" color="grey-5" />
@ -613,7 +621,6 @@ onBeforeMount(async () => {
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>
@ -623,7 +630,6 @@ onBeforeMount(async () => {
ref="table"
:columns="columns"
:rows="positionNo"
:filter="filters"
row-key="id"
flat
bordered
@ -686,73 +692,6 @@ onBeforeMount(async () => {
</q-tr>
</template>
</d-table>
<!-- <d-table
ref="table"
:columns="columns"
:rows="positionNo"
:filter="filters"
row-key="id"
flat
bordered
:paging="true"
dense
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
>
<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">{{
col.label
}}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
@click="onClickSelectPos(props.row.id)"
:class="
props.row.id === positionId ? 'bg-blue-2' : ''
"
>
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name === 'posMasterNo'">
{{
props.row.isSit
? col.value + " " + "(นั่งทับตำแหน่ง)"
: col.value
}}
</div>
<div v-else-if="col.name === 'isPosition'">
<div v-if="col.value">
<q-icon
name="done"
color="primary"
size="24px"
>
<q-tooltip>ตรงตามตำแหน </q-tooltip>
</q-icon>
</div>
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table> -->
</div>
</q-card>
</div>