fix: แก้ Page
This commit is contained in:
parent
230eb3f656
commit
de4aa8c585
2 changed files with 41 additions and 18 deletions
|
|
@ -202,6 +202,10 @@ const totalProduct = ref<number>(0);
|
|||
const totalService = ref<number>(0);
|
||||
const totalProductAndService = ref<number>(0);
|
||||
|
||||
const currentPage = ref<number>(1);
|
||||
const maxPage = ref<number>(1);
|
||||
const pageSize = ref<number>(30);
|
||||
|
||||
const currentId = ref<string>('');
|
||||
const currentIdType = ref<string>('');
|
||||
const currentIdService = ref<string>('');
|
||||
|
|
@ -238,7 +242,7 @@ async function searchGroup() {
|
|||
});
|
||||
|
||||
if (resultList) {
|
||||
resultSearchGroup.value = resultList;
|
||||
resultSearchGroup.value = resultList.result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -314,7 +318,7 @@ async function fetchListType() {
|
|||
});
|
||||
|
||||
if (res) {
|
||||
productType.value = res;
|
||||
productType.value = res.result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -329,7 +333,7 @@ async function fetchListGroups() {
|
|||
});
|
||||
|
||||
if (res) {
|
||||
productGroup.value = res;
|
||||
productGroup.value = res.result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -382,7 +386,7 @@ async function searchType() {
|
|||
});
|
||||
|
||||
if (res) {
|
||||
resultSearchType.value = res;
|
||||
resultSearchType.value = res.result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1247,6 +1251,17 @@ watch(currentStatus, async () => {
|
|||
>
|
||||
<NoData />
|
||||
</div>
|
||||
|
||||
<!-- <div class="flex justify-center">
|
||||
<q-pagination
|
||||
claess="pagination"
|
||||
v-model="currentPage"
|
||||
:max="maxPage"
|
||||
direction-links
|
||||
active-color="primary"
|
||||
gutter="sm"
|
||||
/>
|
||||
</div> -->
|
||||
</AppBox>
|
||||
<AppBox bordered v-else-if="productMode === 'service'" no-padding>
|
||||
<div class="row justify-between q-px-md">
|
||||
|
|
@ -1255,6 +1270,7 @@ watch(currentStatus, async () => {
|
|||
name="all"
|
||||
@click="
|
||||
async () => {
|
||||
inputSearchProductAndService = '';
|
||||
currentStatus = 'All';
|
||||
await fetchListOfProductAndService();
|
||||
}
|
||||
|
|
@ -1285,6 +1301,7 @@ watch(currentStatus, async () => {
|
|||
name="product"
|
||||
@click="
|
||||
async () => {
|
||||
inputSearchProductAndService = '';
|
||||
currentStatus = 'All';
|
||||
await fetchListOfProduct(currentIdType);
|
||||
}
|
||||
|
|
@ -1298,7 +1315,8 @@ watch(currentStatus, async () => {
|
|||
: 'app-text-muted'
|
||||
"
|
||||
>
|
||||
{{ $t('service') }}
|
||||
{{ $t('product') }}
|
||||
|
||||
<q-badge
|
||||
class="rounded q-ml-sm"
|
||||
:class="
|
||||
|
|
@ -1314,6 +1332,7 @@ watch(currentStatus, async () => {
|
|||
name="service"
|
||||
@click="
|
||||
async () => {
|
||||
inputSearchProductAndService = '';
|
||||
currentStatus = 'All';
|
||||
await fetchListOfService();
|
||||
}
|
||||
|
|
@ -1327,7 +1346,7 @@ watch(currentStatus, async () => {
|
|||
: 'app-text-muted'
|
||||
"
|
||||
>
|
||||
{{ $t('product') }}
|
||||
{{ $t('service') }}
|
||||
<q-badge
|
||||
class="rounded q-ml-sm"
|
||||
:class="
|
||||
|
|
@ -1351,7 +1370,7 @@ watch(currentStatus, async () => {
|
|||
class="q-mr-md"
|
||||
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
||||
v-model="inputSearchProductAndService"
|
||||
debounce="500"
|
||||
debounce="250"
|
||||
@update:model-value="
|
||||
async () => {
|
||||
await fetchSearch();
|
||||
|
|
@ -1416,7 +1435,12 @@ watch(currentStatus, async () => {
|
|||
</div>
|
||||
|
||||
<div
|
||||
v-if="productAndService && productAndService.length === 0"
|
||||
v-if="
|
||||
(productAndServiceTab === 'all' &&
|
||||
productAndService?.length === 0) ||
|
||||
(productAndServiceTab === 'product' && product?.length === 0) ||
|
||||
(productAndServiceTab === 'service' && service?.length === 0)
|
||||
"
|
||||
class="flex justify-center items-center"
|
||||
style="min-height: 70vh; background-color: var(--surface-2)"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -73,16 +73,15 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
|||
|
||||
const query = params.toString();
|
||||
|
||||
const res = await api.get<(ProductGroup & { productGroupId: string })[]>(
|
||||
`/product-type${(params && '?'.concat(query)) || ''}`,
|
||||
{
|
||||
headers: {
|
||||
'X-Session-Id': flow?.sessionId,
|
||||
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
|
||||
'X-Tid': flow?.transactionId,
|
||||
},
|
||||
const res = await api.get<
|
||||
Pagination<(ProductGroup & { productGroupId: string })[]>
|
||||
>(`/product-type${(params && '?'.concat(query)) || ''}`, {
|
||||
headers: {
|
||||
'X-Session-Id': flow?.sessionId,
|
||||
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
|
||||
'X-Tid': flow?.transactionId,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
if (!res) return false;
|
||||
if (res.status === 200) {
|
||||
|
|
@ -187,7 +186,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
|||
|
||||
const query = params.toString();
|
||||
|
||||
const res = await api.get<ProductGroup[]>(
|
||||
const res = await api.get<Pagination<ProductGroup[]>>(
|
||||
`/product-group${(params && '?'.concat(query)) || ''}`,
|
||||
{
|
||||
headers: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue