filter ==> ข้อมูลตำแหน่งลูกจ้างประจำ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-12 14:17:48 +07:00
parent a8576f902c
commit b4c9762a2a
3 changed files with 32 additions and 20 deletions

View file

@ -30,10 +30,12 @@ const {
messageError,
success,
date2Thai,
onSearchDataTable,
} = useCounterMixin();
// Table
const rows = ref<DataGroup[]>([]); //
const rowsMain = ref<DataGroup[]>([]); //
const filter = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([
{
@ -138,16 +140,20 @@ const formDataLevel = reactive<FormDataLevel>({
* เกบขอมลรรายการระดบชนงานไวใน rows.value
*/
async function fetchData() {
rows.value = [];
rowsMain.value = [];
showLoader();
await http
.get(config.API.orgEmployeeTypeById(posTypeId.value))
.then(async (res) => {
titleName.value = res.data.result.posTypeName ?? null;
formDataLevel.posTypeName = res.data.result.posTypeName;
rows.value = await res.data.result.posLevels.map((x: ResLevel) => ({
const lists = await res.data.result.posLevels.map((x: ResLevel) => ({
...x,
posTypeName: res.data.result.posTypeName,
}));
rows.value = lists;
rowsMain.value = lists;
})
.catch((err) => {
messageError($q, err);
@ -160,9 +166,7 @@ async function fetchData() {
/**
* งกนเป popup แกไขขอมลระดบชนงาน
* @param data อมลระดบชนงานทจะแกไข
*
* กำหนด isStatusEdit เป true และกำหนดให ฟอรมขอมลระดบชนงาน เป อมลทจะแกไข
*
*/
function onClickOpenDialog(
statusEdit: boolean = false,
@ -183,7 +187,6 @@ function onClickOpenDialog(
/**
* งกนป popup แกไขหรอเพมขอมลระดบชนงาน
*
* และกำหนดให ฟอรมขอมลระดบชนงาน เปนคาวาง
*/
function onClickCloseDialog() {
@ -195,7 +198,6 @@ function onClickCloseDialog() {
/**
* นยนการบนทกขอมลรายการระดบชนงาน
*
* dialogStatus เป 'false' จะทำการเพมขอมลรายการระดบชนงาน าไมจะทำการแกไขขอม
* เมอบนทกขอมลเสรจจะเรยก function fetchData() เพอดงขอมลรายการระดบชนงานใหม
*
@ -239,9 +241,16 @@ function convertPosLevelAuthority(val: string) {
return result?.label;
}
function serchDataTable() {
rows.value = onSearchDataTable(
filter.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/**
* hook ทำงานเม Components กเรยกใชงาน
*
* าม posTypeId จะดงขอมลรายการระดบชนงาน
*/
onMounted(() => {
@ -281,12 +290,11 @@ onMounted(() => {
<q-input
dense
outlined
clearable
v-model="filter"
placeholder="ค้นหา"
@clear="filter = ''"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append v-if="filter === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -310,7 +318,6 @@ onMounted(() => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filter"
row-key="name"
flat
bordered