refactor: ปรับ ui เปลี่ยนหน้า
This commit is contained in:
parent
02e89010d8
commit
fa7e87d537
1 changed files with 42 additions and 10 deletions
|
|
@ -501,15 +501,15 @@ watch(
|
||||||
);
|
);
|
||||||
|
|
||||||
const currentPage = ref(1);
|
const currentPage = ref(1);
|
||||||
|
const pageSize = ref(30);
|
||||||
const currentMaxPage = computed(() =>
|
const currentMaxPage = computed(() =>
|
||||||
userData.value
|
userData.value ? Math.ceil(userData.value?.total / pageSize.value) : 1,
|
||||||
? Math.ceil(userData.value?.total / userData.value?.pageSize)
|
|
||||||
: 1,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
async function fetchUserList() {
|
async function fetchUserList() {
|
||||||
await userStore.fetchList({
|
await userStore.fetchList({
|
||||||
includeBranch: true,
|
includeBranch: true,
|
||||||
|
pageSize: pageSize.value,
|
||||||
page: currentPage.value,
|
page: currentPage.value,
|
||||||
query: !!inputSearch.value ? inputSearch.value : undefined,
|
query: !!inputSearch.value ? inputSearch.value : undefined,
|
||||||
userType: selectorLabel.value ?? undefined,
|
userType: selectorLabel.value ?? undefined,
|
||||||
|
|
@ -682,8 +682,38 @@ watch(inputSearch, async () => await fetchUserList());
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row justify-between q-pt-md" v-if="currentMaxPage > 0">
|
<div
|
||||||
<div class="app-text-muted">
|
class="row justify-between items-center q-pt-md"
|
||||||
|
v-if="currentMaxPage > 0"
|
||||||
|
>
|
||||||
|
<div class="col-4">
|
||||||
|
<div class="row items-center">
|
||||||
|
<div style="width: 80px">{{ $t('showing') }}</div>
|
||||||
|
<div>
|
||||||
|
<q-btn-dropdown dense unelevated :label="pageSize">
|
||||||
|
<q-list>
|
||||||
|
<q-item
|
||||||
|
v-for="v in [10, 30, 50, 100, 500, 1000]"
|
||||||
|
clickable
|
||||||
|
v-close-popup
|
||||||
|
@click="
|
||||||
|
async () => {
|
||||||
|
pageSize = v;
|
||||||
|
await fetchUserList();
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<q-item-section>
|
||||||
|
<q-item-label>{{ v }}</q-item-label>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
</q-btn-dropdown>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-4 row justify-center app-text-muted">
|
||||||
{{
|
{{
|
||||||
$t('recordsPage', {
|
$t('recordsPage', {
|
||||||
resultcurrentPage: userData?.result.length,
|
resultcurrentPage: userData?.result.length,
|
||||||
|
|
@ -691,6 +721,7 @@ watch(inputSearch, async () => await fetchUserList());
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-4 row justify-end">
|
||||||
<PaginationComponent
|
<PaginationComponent
|
||||||
v-model:current-page="currentPage"
|
v-model:current-page="currentPage"
|
||||||
v-model:max-page="currentMaxPage"
|
v-model:max-page="currentMaxPage"
|
||||||
|
|
@ -698,6 +729,7 @@ watch(inputSearch, async () => await fetchUserList());
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<DrawerInfo
|
<DrawerInfo
|
||||||
v-if="currentUser"
|
v-if="currentUser"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue