fix bug โครงสร้าง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-03 16:27:30 +07:00
parent daecd9524a
commit 62e7284d5d
6 changed files with 118 additions and 90 deletions

View file

@ -41,7 +41,6 @@ const {
messageError,
dialogMessageNotify,
success,
onSearchDataTable,
} = useCounterMixin();
/**
@ -70,6 +69,7 @@ const props = defineProps({
type: Object,
required: true,
},
fetchDataTable: Function,
});
const title = ref<string>("ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน");
@ -80,7 +80,14 @@ const levelTree = ref<number>(0);
const filterTable = ref<string>("");
const selectedFilter = ref<PosMaster2[]>([]);
const dataMain = ref<PosMaster2[]>([...rows.value]);
/**
* function เช filter
*/
function resetFilter() {
filterTree.value = "";
filterRef.value.focus();
}
/**
* function เลอกขอมลหนวยงาน
@ -149,12 +156,10 @@ const pagination = ref({
rowsPerPage: reqMaster.value.pageSize,
});
function onSearchTable() {
rows.value = onSearchDataTable(
filterTable.value,
dataMain.value,
columns.value ? columns.value : []
);
function onSearchData() {
reqMaster.value.page = 1;
reqMaster.value.keyword = filterTable.value;
props.fetchDataTable?.(store.treeId, store.level, false);
}
watch(
@ -162,9 +167,8 @@ watch(
() => {
reqMaster.value.page = 1;
filterTree.value = "";
pagination.value.rowsPerPage = reqMaster.value.pageSize;
dataMain.value = rows.value;
filterTable.value = "";
pagination.value.rowsPerPage = reqMaster.value.pageSize;
title.value = `ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน ${props.mainTree.orgName}`;
if (modal.value && props.type === "SINGER") {
@ -188,7 +192,10 @@ watch(
>
<q-header>
<q-toolbar>
<HeaderDialog :tittle="title" :close="() => (modal = false)" />
<HeaderDialog
:tittle="title"
:close="() => ((modal = false), (reqMaster.keyword = ''))"
/>
</q-toolbar>
<q-separator color="grey-4" />
</q-header>
@ -209,7 +216,7 @@ watch(
dense
v-model="filterTable"
label="ค้นหา"
@keydown.enter="onSearchTable"
@keydown.enter="onSearchData"
>
<template v-slot:append>
<q-icon name="search" />
@ -217,6 +224,7 @@ watch(
</q-input>
</div>
</q-toolbar>
<div class="col-12">
<d-table
flat
@ -227,7 +235,7 @@ watch(
no-data-label="ไม่มีข้อมูล"
selection="multiple"
v-model:selected="selectedFilter"
:rows-per-page-options="[10, 25, 50, 100]"
:rows-per-page-options="[1, 10, 25, 50, 100]"
v-model:pagination="pagination"
@update:pagination="updatePagination"
>

View file

@ -366,6 +366,10 @@ watch(
if (!modalDialogMMove.value) {
pagination.value.page = 1;
pagination.value.rowsPerPage = reqMaster.value.pageSize;
if (posMaster.value.length === 0) {
props.fetchDataTable?.(reqMaster.value.id, reqMaster.value.type, false);
}
}
}
);
@ -475,7 +479,7 @@ watch(
bordered
:paging="true"
dense
:rows-per-page-options="[10, 25, 50, 100]"
:rows-per-page-options="[1, 10, 25, 50, 100]"
@update:pagination="updatePagination"
class="tableTb"
v-model:pagination="pagination"
@ -682,6 +686,7 @@ watch(
:type="typeMove"
:rowId="rowId"
:mainTree="props.mainTree ? props.mainTree : []"
:fetchDataTable="props.fetchDataTable"
/>
<!-- ประวตำแหน -->

View file

@ -94,10 +94,10 @@ function fetchDataTable(id: string, level: number, action: boolean) {
if (action === true) {
isLoad.value = true;
}
posMaster.value = [];
http
.post(config.API.orgPosMasterListEmp, reqMaster)
.then(async (res) => {
posMaster.value = [];
const dataMain: PosMaster[] = [];
totalPage.value = Math.ceil(res.data.result.total / reqMaster.pageSize);
res.data.result.data.forEach((e: PosMaster) => {