feat: แบ่งหน้าของ กลุ่ม และ ประเภท
This commit is contained in:
parent
4267203914
commit
d464b1fcbb
2 changed files with 51 additions and 14 deletions
|
|
@ -190,32 +190,35 @@ const serviceTab = [
|
||||||
|
|
||||||
const workItems = ref<WorkItems[]>([]);
|
const workItems = ref<WorkItems[]>([]);
|
||||||
const workNameRef = ref();
|
const workNameRef = ref();
|
||||||
|
const selectProduct = ref<ProductList[]>([]);
|
||||||
|
const currentWorkIndex = ref<number>(0);
|
||||||
|
|
||||||
const currentServiceTab = ref('serviceInformation');
|
const currentServiceTab = ref('serviceInformation');
|
||||||
const propertiesDialog = ref<boolean>(false);
|
const propertiesDialog = ref<boolean>(false);
|
||||||
|
|
||||||
const selectProduct = ref<ProductList[]>([]);
|
|
||||||
|
|
||||||
const currentWorkIndex = ref<number>(0);
|
|
||||||
|
|
||||||
const totalProduct = ref<number>(0);
|
const totalProduct = ref<number>(0);
|
||||||
const totalService = ref<number>(0);
|
const totalService = ref<number>(0);
|
||||||
const totalProductAndService = ref<number>(0);
|
const totalProductAndService = ref<number>(0);
|
||||||
|
|
||||||
const currentPage = ref<number>(1);
|
// แบ่งหน้า
|
||||||
const maxPage = ref<number>(1);
|
const currentPageGroup = ref<number>(1);
|
||||||
const pageSize = ref<number>(30);
|
const maxPageGroup = ref<number>(1);
|
||||||
|
const pageSizeGroup = ref<number>(2);
|
||||||
|
const currentPageType = ref<number>(1);
|
||||||
|
const maxPageType = ref<number>(1);
|
||||||
|
const pageSizeType = ref<number>(2);
|
||||||
|
|
||||||
|
// เก็บ id ที่เข้ามา
|
||||||
const currentId = ref<string>('');
|
const currentId = ref<string>('');
|
||||||
const currentIdType = ref<string>('');
|
const currentIdType = ref<string>('');
|
||||||
const currentIdService = ref<string>('');
|
const currentIdService = ref<string>('');
|
||||||
const currentIdProduct = ref<string>('');
|
const currentIdProduct = ref<string>('');
|
||||||
|
|
||||||
|
const currentStatus = ref<Status | 'All'>('All');
|
||||||
|
|
||||||
const resultSearchGroup = ref<ProductGroup[]>();
|
const resultSearchGroup = ref<ProductGroup[]>();
|
||||||
const resultSearchType = ref<(ProductGroup & { productGroupId: string })[]>();
|
const resultSearchType = ref<(ProductGroup & { productGroupId: string })[]>();
|
||||||
|
|
||||||
const currentStatus = ref<Status | 'All'>('All');
|
|
||||||
|
|
||||||
const inputFile = (() => {
|
const inputFile = (() => {
|
||||||
const element = document.createElement('input');
|
const element = document.createElement('input');
|
||||||
element.type = 'file';
|
element.type = 'file';
|
||||||
|
|
@ -308,6 +311,8 @@ async function featchStatsProduct() {
|
||||||
|
|
||||||
async function fetchListType() {
|
async function fetchListType() {
|
||||||
const res = await fetchListProductServiceType({
|
const res = await fetchListProductServiceType({
|
||||||
|
page: currentPageType.value,
|
||||||
|
pageSize: pageSizeType.value,
|
||||||
productGroupId: currentId.value,
|
productGroupId: currentId.value,
|
||||||
status:
|
status:
|
||||||
currentStatus.value === 'All'
|
currentStatus.value === 'All'
|
||||||
|
|
@ -318,12 +323,16 @@ async function fetchListType() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
currentPageType.value = res.page;
|
||||||
|
maxPageType.value = Math.ceil(res.total / pageSizeType.value);
|
||||||
productType.value = res.result;
|
productType.value = res.result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchListGroups() {
|
async function fetchListGroups() {
|
||||||
const res = await fetchListProductService({
|
const res = await fetchListProductService({
|
||||||
|
page: currentPageGroup.value,
|
||||||
|
pageSize: pageSizeGroup.value,
|
||||||
status:
|
status:
|
||||||
currentStatus.value === 'All'
|
currentStatus.value === 'All'
|
||||||
? undefined
|
? undefined
|
||||||
|
|
@ -333,6 +342,8 @@ async function fetchListGroups() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
currentPageGroup.value = res.page;
|
||||||
|
maxPageGroup.value = Math.ceil(res.total / pageSizeGroup.value);
|
||||||
productGroup.value = res.result;
|
productGroup.value = res.result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -891,6 +902,14 @@ watch(currentStatus, async () => {
|
||||||
await fetchListType();
|
await fetchListType();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(currentPageGroup, async () => {
|
||||||
|
await fetchListGroups();
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(currentPageType, async () => {
|
||||||
|
await fetchListType();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -1254,16 +1273,27 @@ watch(currentStatus, async () => {
|
||||||
<NoData />
|
<NoData />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="flex justify-center">
|
<div v-if="productMode === 'group'" class="flex justify-center q-pt-xl">
|
||||||
<q-pagination
|
<q-pagination
|
||||||
claess="pagination"
|
claess="pagination"
|
||||||
v-model="currentPage"
|
v-model="currentPageGroup"
|
||||||
:max="maxPage"
|
:max="maxPageGroup"
|
||||||
direction-links
|
direction-links
|
||||||
active-color="primary"
|
active-color="primary"
|
||||||
gutter="sm"
|
gutter="sm"
|
||||||
/>
|
/>
|
||||||
</div> -->
|
</div>
|
||||||
|
|
||||||
|
<div v-if="productMode === 'type'" class="flex justify-center q-pt-xl">
|
||||||
|
<q-pagination
|
||||||
|
claess="pagination"
|
||||||
|
v-model="currentPageType"
|
||||||
|
:max="maxPageType"
|
||||||
|
direction-links
|
||||||
|
active-color="primary"
|
||||||
|
gutter="sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</AppBox>
|
</AppBox>
|
||||||
<AppBox bordered v-else-if="productMode === 'service'" no-padding>
|
<AppBox bordered v-else-if="productMode === 'service'" no-padding>
|
||||||
<div class="row justify-between q-px-md">
|
<div class="row justify-between q-px-md">
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
|
|
||||||
async function fetchListProductServiceType(
|
async function fetchListProductServiceType(
|
||||||
opts?: {
|
opts?: {
|
||||||
|
page?: number;
|
||||||
|
pageSize?: number;
|
||||||
query?: string;
|
query?: string;
|
||||||
productGroupId?: string;
|
productGroupId?: string;
|
||||||
status?: 'CREATED' | 'ACTIVE' | 'INACTIVE';
|
status?: 'CREATED' | 'ACTIVE' | 'INACTIVE';
|
||||||
|
|
@ -171,7 +173,12 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchListProductService(
|
async function fetchListProductService(
|
||||||
opts?: { query?: string; status?: 'CREATED' | 'ACTIVE' | 'INACTIVE' },
|
opts?: {
|
||||||
|
page?: number;
|
||||||
|
pageSize?: number;
|
||||||
|
query?: string;
|
||||||
|
status?: 'CREATED' | 'ACTIVE' | 'INACTIVE';
|
||||||
|
},
|
||||||
flow?: {
|
flow?: {
|
||||||
sessionId?: string;
|
sessionId?: string;
|
||||||
refTransactionId?: string;
|
refTransactionId?: string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue