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 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 pageSize = ref<number>(30);
|
||||||
|
|
||||||
const currentId = ref<string>('');
|
const currentId = ref<string>('');
|
||||||
const currentIdType = ref<string>('');
|
const currentIdType = ref<string>('');
|
||||||
const currentIdService = ref<string>('');
|
const currentIdService = ref<string>('');
|
||||||
|
|
@ -238,7 +242,7 @@ async function searchGroup() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (resultList) {
|
if (resultList) {
|
||||||
resultSearchGroup.value = resultList;
|
resultSearchGroup.value = resultList.result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -314,7 +318,7 @@ async function fetchListType() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
productType.value = res;
|
productType.value = res.result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -329,7 +333,7 @@ async function fetchListGroups() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
productGroup.value = res;
|
productGroup.value = res.result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -382,7 +386,7 @@ async function searchType() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
resultSearchType.value = res;
|
resultSearchType.value = res.result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1247,6 +1251,17 @@ watch(currentStatus, async () => {
|
||||||
>
|
>
|
||||||
<NoData />
|
<NoData />
|
||||||
</div>
|
</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>
|
||||||
<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">
|
||||||
|
|
@ -1255,6 +1270,7 @@ watch(currentStatus, async () => {
|
||||||
name="all"
|
name="all"
|
||||||
@click="
|
@click="
|
||||||
async () => {
|
async () => {
|
||||||
|
inputSearchProductAndService = '';
|
||||||
currentStatus = 'All';
|
currentStatus = 'All';
|
||||||
await fetchListOfProductAndService();
|
await fetchListOfProductAndService();
|
||||||
}
|
}
|
||||||
|
|
@ -1285,6 +1301,7 @@ watch(currentStatus, async () => {
|
||||||
name="product"
|
name="product"
|
||||||
@click="
|
@click="
|
||||||
async () => {
|
async () => {
|
||||||
|
inputSearchProductAndService = '';
|
||||||
currentStatus = 'All';
|
currentStatus = 'All';
|
||||||
await fetchListOfProduct(currentIdType);
|
await fetchListOfProduct(currentIdType);
|
||||||
}
|
}
|
||||||
|
|
@ -1298,7 +1315,8 @@ watch(currentStatus, async () => {
|
||||||
: 'app-text-muted'
|
: 'app-text-muted'
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ $t('service') }}
|
{{ $t('product') }}
|
||||||
|
|
||||||
<q-badge
|
<q-badge
|
||||||
class="rounded q-ml-sm"
|
class="rounded q-ml-sm"
|
||||||
:class="
|
:class="
|
||||||
|
|
@ -1314,6 +1332,7 @@ watch(currentStatus, async () => {
|
||||||
name="service"
|
name="service"
|
||||||
@click="
|
@click="
|
||||||
async () => {
|
async () => {
|
||||||
|
inputSearchProductAndService = '';
|
||||||
currentStatus = 'All';
|
currentStatus = 'All';
|
||||||
await fetchListOfService();
|
await fetchListOfService();
|
||||||
}
|
}
|
||||||
|
|
@ -1327,7 +1346,7 @@ watch(currentStatus, async () => {
|
||||||
: 'app-text-muted'
|
: 'app-text-muted'
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ $t('product') }}
|
{{ $t('service') }}
|
||||||
<q-badge
|
<q-badge
|
||||||
class="rounded q-ml-sm"
|
class="rounded q-ml-sm"
|
||||||
:class="
|
:class="
|
||||||
|
|
@ -1351,7 +1370,7 @@ watch(currentStatus, async () => {
|
||||||
class="q-mr-md"
|
class="q-mr-md"
|
||||||
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
||||||
v-model="inputSearchProductAndService"
|
v-model="inputSearchProductAndService"
|
||||||
debounce="500"
|
debounce="250"
|
||||||
@update:model-value="
|
@update:model-value="
|
||||||
async () => {
|
async () => {
|
||||||
await fetchSearch();
|
await fetchSearch();
|
||||||
|
|
@ -1416,7 +1435,12 @@ watch(currentStatus, async () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<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"
|
class="flex justify-center items-center"
|
||||||
style="min-height: 70vh; background-color: var(--surface-2)"
|
style="min-height: 70vh; background-color: var(--surface-2)"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -73,16 +73,15 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
|
|
||||||
const query = params.toString();
|
const query = params.toString();
|
||||||
|
|
||||||
const res = await api.get<(ProductGroup & { productGroupId: string })[]>(
|
const res = await api.get<
|
||||||
`/product-type${(params && '?'.concat(query)) || ''}`,
|
Pagination<(ProductGroup & { productGroupId: string })[]>
|
||||||
{
|
>(`/product-type${(params && '?'.concat(query)) || ''}`, {
|
||||||
headers: {
|
headers: {
|
||||||
'X-Session-Id': flow?.sessionId,
|
'X-Session-Id': flow?.sessionId,
|
||||||
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
|
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
|
||||||
'X-Tid': flow?.transactionId,
|
'X-Tid': flow?.transactionId,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
);
|
});
|
||||||
|
|
||||||
if (!res) return false;
|
if (!res) return false;
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
|
@ -187,7 +186,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
||||||
|
|
||||||
const query = params.toString();
|
const query = params.toString();
|
||||||
|
|
||||||
const res = await api.get<ProductGroup[]>(
|
const res = await api.get<Pagination<ProductGroup[]>>(
|
||||||
`/product-group${(params && '?'.concat(query)) || ''}`,
|
`/product-group${(params && '?'.concat(query)) || ''}`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue