fix: แก้ layout แบ่งหน้า กลุ่ม และ ประเภท
This commit is contained in:
parent
557924ad6c
commit
53bb20a8c1
1 changed files with 42 additions and 26 deletions
|
|
@ -24,6 +24,7 @@ import useOptionStore from 'src/stores/options';
|
||||||
import FormServiceProperties from 'components/04_product-service/FormServiceProperties.vue';
|
import FormServiceProperties from 'components/04_product-service/FormServiceProperties.vue';
|
||||||
import InfoForm from 'components/02_personnel-management/InfoForm.vue';
|
import InfoForm from 'components/02_personnel-management/InfoForm.vue';
|
||||||
import NoData from 'components/NoData.vue';
|
import NoData from 'components/NoData.vue';
|
||||||
|
import PaginationComponent from 'src/components/PaginationComponent.vue';
|
||||||
|
|
||||||
import useFlowStore from 'src/stores/flow';
|
import useFlowStore from 'src/stores/flow';
|
||||||
import { Status } from 'src/stores/types';
|
import { Status } from 'src/stores/types';
|
||||||
|
|
@ -210,6 +211,8 @@ const pageSizeProduct = ref<number>(30);
|
||||||
const currentPageService = ref<number>(1);
|
const currentPageService = ref<number>(1);
|
||||||
const maxPageService = ref<number>(1);
|
const maxPageService = ref<number>(1);
|
||||||
const pageSizeService = ref<number>(30);
|
const pageSizeService = ref<number>(30);
|
||||||
|
const totalType = ref<number>(0);
|
||||||
|
const totalGroup = ref<number>(0);
|
||||||
|
|
||||||
// เก็บ id ที่เข้ามา
|
// เก็บ id ที่เข้ามา
|
||||||
const currentId = ref<string>('');
|
const currentId = ref<string>('');
|
||||||
|
|
@ -293,6 +296,7 @@ async function fetchListType() {
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
currentPageType.value = res.page;
|
currentPageType.value = res.page;
|
||||||
|
totalType.value = res.total;
|
||||||
maxPageType.value = Math.ceil(res.total / pageSizeType.value);
|
maxPageType.value = Math.ceil(res.total / pageSizeType.value);
|
||||||
productType.value = res.result;
|
productType.value = res.result;
|
||||||
}
|
}
|
||||||
|
|
@ -313,6 +317,7 @@ async function fetchListGroups() {
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
currentPageGroup.value = res.page;
|
currentPageGroup.value = res.page;
|
||||||
|
totalGroup.value = res.total;
|
||||||
maxPageGroup.value = Math.ceil(res.total / pageSizeGroup.value);
|
maxPageGroup.value = Math.ceil(res.total / pageSizeGroup.value);
|
||||||
productGroup.value = res.result;
|
productGroup.value = res.result;
|
||||||
}
|
}
|
||||||
|
|
@ -959,16 +964,6 @@ watch(currentStatus, async () => {
|
||||||
flowStore.rotate();
|
flowStore.rotate();
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(currentPageGroup, async () => {
|
|
||||||
await fetchListGroups();
|
|
||||||
flowStore.rotate();
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(currentPageType, async () => {
|
|
||||||
await fetchListType();
|
|
||||||
flowStore.rotate();
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(currentPageServiceAndProduct, async () => {
|
watch(currentPageServiceAndProduct, async () => {
|
||||||
await fetchListOfProductAndService();
|
await fetchListOfProductAndService();
|
||||||
flowStore.rotate();
|
flowStore.rotate();
|
||||||
|
|
@ -1292,6 +1287,7 @@ watch(inputSearchProductAndService, async () => {
|
||||||
"
|
"
|
||||||
@on-click="
|
@on-click="
|
||||||
async () => {
|
async () => {
|
||||||
|
inputSearch = undefined;
|
||||||
pathTypeName = v.name;
|
pathTypeName = v.name;
|
||||||
currentIdType = v.id;
|
currentIdType = v.id;
|
||||||
productMode = 'service';
|
productMode = 'service';
|
||||||
|
|
@ -1367,29 +1363,49 @@ watch(inputSearchProductAndService, async () => {
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div
|
<div
|
||||||
v-if="productMode === 'group'"
|
v-if="productMode === 'group'"
|
||||||
class="flex justify-center q-pt-xl"
|
class="flex justify-between q-pt-xl"
|
||||||
>
|
>
|
||||||
<q-pagination
|
<div class="app-text-muted">
|
||||||
claess="pagination"
|
{{
|
||||||
v-model="currentPageGroup"
|
$t('recordsPage', {
|
||||||
:max="maxPageGroup"
|
resultcurrentPage: productGroup?.length,
|
||||||
direction-links
|
total: totalGroup,
|
||||||
active-color="primary"
|
})
|
||||||
gutter="sm"
|
}}
|
||||||
|
</div>
|
||||||
|
<PaginationComponent
|
||||||
|
v-model:current-page="currentPageGroup"
|
||||||
|
v-model:max-page="maxPageGroup"
|
||||||
|
:fetch-data="
|
||||||
|
async () => {
|
||||||
|
await fetchListGroups();
|
||||||
|
flowStore.rotate();
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="productMode === 'type'"
|
v-if="productMode === 'type'"
|
||||||
class="flex justify-center q-pt-xl"
|
class="flex justify-between q-pt-xl"
|
||||||
>
|
>
|
||||||
<q-pagination
|
<div class="app-text-muted">
|
||||||
claess="pagination"
|
{{
|
||||||
v-model="currentPageType"
|
$t('recordsPage', {
|
||||||
:max="maxPageType"
|
resultcurrentPage: productType?.length,
|
||||||
direction-links
|
total: totalType,
|
||||||
active-color="primary"
|
})
|
||||||
gutter="sm"
|
}}
|
||||||
|
</div>
|
||||||
|
<PaginationComponent
|
||||||
|
v-model:current-page="currentPageType"
|
||||||
|
v-model:max-page="maxPageType"
|
||||||
|
:fetch-data="
|
||||||
|
async () => {
|
||||||
|
await fetchListTypes();
|
||||||
|
flowStore.rotate();
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue