fix bug โครงสร้าง
This commit is contained in:
parent
daecd9524a
commit
62e7284d5d
6 changed files with 118 additions and 90 deletions
|
|
@ -67,6 +67,7 @@ const props = defineProps({
|
|||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
fetchDataTable: Function,
|
||||
});
|
||||
|
||||
const title = ref<string>("ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน"); //title Dialog
|
||||
|
|
@ -93,14 +94,6 @@ const isDisable = computed(() => {
|
|||
} else return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* function รีเช็ด filter
|
||||
*/
|
||||
function resetFilter() {
|
||||
filterTree.value = "";
|
||||
filterRef.value.focus();
|
||||
}
|
||||
|
||||
/**
|
||||
* function เลือกข้อมูลหน่วยงาน
|
||||
*/
|
||||
|
|
@ -157,6 +150,12 @@ function updatePagination(newPagination: NewPagination) {
|
|||
reqMaster.value.page = 1;
|
||||
}
|
||||
|
||||
function onSearchData() {
|
||||
reqMaster.value.page = 1;
|
||||
reqMaster.value.keyword = filterTable.value;
|
||||
props.fetchDataTable?.(store.treeId, store.level, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* ดูการเปลี่ยนแปลง modal เมื่อเป็น true
|
||||
*/
|
||||
|
|
@ -165,6 +164,7 @@ watch(
|
|||
() => {
|
||||
reqMaster.value.page = 1;
|
||||
filterTree.value = "";
|
||||
filterTable.value = "";
|
||||
pagination.value.rowsPerPage = reqMaster.value.pageSize;
|
||||
|
||||
title.value = `ย้ายตำแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน ${props.mainTree.orgName}`;
|
||||
|
|
@ -190,7 +190,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>
|
||||
|
|
@ -206,7 +209,13 @@ watch(
|
|||
<q-space />
|
||||
|
||||
<div>
|
||||
<q-input outlined dense v-model="filterTable" label="ค้นหา">
|
||||
<q-input
|
||||
outlined
|
||||
dense
|
||||
v-model="filterTable"
|
||||
label="ค้นหา"
|
||||
@keydown.enter="onSearchData"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
</template>
|
||||
|
|
@ -214,71 +223,72 @@ watch(
|
|||
</div>
|
||||
</q-toolbar>
|
||||
|
||||
<d-table
|
||||
flat
|
||||
bordered
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:filter="filterTable.trim()"
|
||||
no-data-label="ไม่มีข้อมูล"
|
||||
selection="multiple"
|
||||
v-model:selected="selectedFilter"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
v-model:pagination="pagination"
|
||||
@update:pagination="updatePagination"
|
||||
>
|
||||
<template v-slot:header-selection="scope">
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="scope.selected"
|
||||
/>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props">
|
||||
<q-td>
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="props.selected"
|
||||
/>
|
||||
</q-td>
|
||||
<div class="col-12">
|
||||
<d-table
|
||||
flat
|
||||
bordered
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
no-data-label="ไม่มีข้อมูล"
|
||||
selection="multiple"
|
||||
v-model:selected="selectedFilter"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
v-model:pagination="pagination"
|
||||
@update:pagination="updatePagination"
|
||||
>
|
||||
<template v-slot:header-selection="scope">
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="scope.selected"
|
||||
/>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props">
|
||||
<q-td>
|
||||
<q-checkbox
|
||||
keep-color
|
||||
color="primary"
|
||||
dense
|
||||
v-model="props.selected"
|
||||
/>
|
||||
</q-td>
|
||||
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>
|
||||
<div v-if="col.name == 'no'">
|
||||
{{
|
||||
(reqMaster.page - 1) * Number(reqMaster.pageSize) +
|
||||
props.rowIndex +
|
||||
1
|
||||
}}
|
||||
</div>
|
||||
<q-td
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>
|
||||
<div v-if="col.name == 'no'">
|
||||
{{
|
||||
(reqMaster.page - 1) * Number(reqMaster.pageSize) +
|
||||
props.rowIndex +
|
||||
1
|
||||
}}
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:pagination="scope">
|
||||
<q-pagination
|
||||
v-model="reqMaster.page"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="totalPage"
|
||||
:max-pages="5"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
></q-pagination>
|
||||
</template>
|
||||
</d-table>
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:pagination="scope">
|
||||
<q-pagination
|
||||
v-model="reqMaster.page"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="totalPage"
|
||||
:max-pages="5"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
></q-pagination>
|
||||
</template>
|
||||
</d-table>
|
||||
</div>
|
||||
</q-card>
|
||||
|
||||
<q-card
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ async function fetchDataTable(id: string, level: number, action: boolean) {
|
|||
: store.historyId;
|
||||
isLoad.value = true;
|
||||
}
|
||||
posMaster.value = [];
|
||||
|
||||
await http
|
||||
.post(config.API.orgPosMasterList, {
|
||||
|
|
@ -113,7 +114,6 @@ async function fetchDataTable(id: string, level: number, action: boolean) {
|
|||
keyword: reqMaster.keyword.trim(),
|
||||
})
|
||||
.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) => {
|
||||
|
|
|
|||
|
|
@ -528,6 +528,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -616,7 +620,7 @@ watch(
|
|||
@keydown.enter.prevent="props.filterKeyword(reqMaster.keyword)"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" color="grey-5" />
|
||||
<q-icon name="search" />
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
|
|
@ -936,6 +940,7 @@ watch(
|
|||
:type="typeMove"
|
||||
:rowId="rowId"
|
||||
:mainTree="props.mainTree ? props.mainTree : []"
|
||||
:fetchDataTable="props.fetchDataTable"
|
||||
/>
|
||||
|
||||
<!-- ประวัติตำแหน่ง -->
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
/>
|
||||
|
||||
<!-- ประวัติตำแหน่ง -->
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue