fix: แก้ layout ของ แบ่งหน้า
This commit is contained in:
parent
6e64a041f0
commit
05c4521aff
1 changed files with 41 additions and 40 deletions
|
|
@ -30,6 +30,7 @@ import InfoForm from 'src/components/02_personnel-management/InfoForm.vue';
|
||||||
import CustomerInfoComponent from 'src/components/03_customer-management/CustomerInfoComponent.vue';
|
import CustomerInfoComponent from 'src/components/03_customer-management/CustomerInfoComponent.vue';
|
||||||
import NoData from 'components/NoData.vue';
|
import NoData from 'components/NoData.vue';
|
||||||
import HistoryEditComponent from 'src/components/03_customer-management/HistoryEditComponent.vue';
|
import HistoryEditComponent from 'src/components/03_customer-management/HistoryEditComponent.vue';
|
||||||
|
import PaginationComponent from 'src/components/PaginationComponent.vue';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CustomerCreate,
|
CustomerCreate,
|
||||||
|
|
@ -245,11 +246,10 @@ const branch = ref<CustomerBranch[]>();
|
||||||
|
|
||||||
const currentPageCustomer = ref<number>(1);
|
const currentPageCustomer = ref<number>(1);
|
||||||
const maxPageCustomer = ref<number>(1);
|
const maxPageCustomer = ref<number>(1);
|
||||||
const pageSizeCustomer = ref<number>(30);
|
const pageSize = ref<number>(10);
|
||||||
|
|
||||||
const currentPageEmployee = ref<number>(1);
|
const currentPageEmployee = ref<number>(1);
|
||||||
const maxPageEmployee = ref<number>(1);
|
const maxPageEmployee = ref<number>(1);
|
||||||
const pageSizeEmployee = ref<number>(30);
|
|
||||||
|
|
||||||
const currentBranchId = ref<string>('');
|
const currentBranchId = ref<string>('');
|
||||||
const currentCustomerName = ref<string>('');
|
const currentCustomerName = ref<string>('');
|
||||||
|
|
@ -683,7 +683,7 @@ async function fetchListCustomer() {
|
||||||
const resultList = await fetchList({
|
const resultList = await fetchList({
|
||||||
includeBranch: true,
|
includeBranch: true,
|
||||||
page: currentPageCustomer.value,
|
page: currentPageCustomer.value,
|
||||||
pageSize: pageSizeCustomer.value,
|
pageSize: pageSize.value,
|
||||||
status:
|
status:
|
||||||
currentStatus.value === 'All'
|
currentStatus.value === 'All'
|
||||||
? undefined
|
? undefined
|
||||||
|
|
@ -695,9 +695,7 @@ async function fetchListCustomer() {
|
||||||
|
|
||||||
if (resultList) {
|
if (resultList) {
|
||||||
currentPageCustomer.value = resultList.page;
|
currentPageCustomer.value = resultList.page;
|
||||||
maxPageCustomer.value = Math.ceil(
|
maxPageCustomer.value = Math.ceil(resultList.total / pageSize.value);
|
||||||
resultList.total / pageSizeCustomer.value,
|
|
||||||
);
|
|
||||||
|
|
||||||
listCustomer.value = resultList.result;
|
listCustomer.value = resultList.result;
|
||||||
}
|
}
|
||||||
|
|
@ -705,8 +703,8 @@ async function fetchListCustomer() {
|
||||||
|
|
||||||
async function fetchListEmployee() {
|
async function fetchListEmployee() {
|
||||||
const resultListEmployee = await employeeStore.fetchList({
|
const resultListEmployee = await employeeStore.fetchList({
|
||||||
page: currentPageCustomer.value,
|
page: currentPageEmployee.value,
|
||||||
pageSize: pageSizeCustomer.value,
|
pageSize: pageSize.value,
|
||||||
status:
|
status:
|
||||||
currentStatus.value === 'All'
|
currentStatus.value === 'All'
|
||||||
? undefined
|
? undefined
|
||||||
|
|
@ -718,7 +716,7 @@ async function fetchListEmployee() {
|
||||||
});
|
});
|
||||||
if (resultListEmployee) {
|
if (resultListEmployee) {
|
||||||
maxPageEmployee.value = Math.ceil(
|
maxPageEmployee.value = Math.ceil(
|
||||||
resultListEmployee.total / pageSizeEmployee.value,
|
resultListEmployee.total / pageSize.value,
|
||||||
);
|
);
|
||||||
listEmployee.value = resultListEmployee.result;
|
listEmployee.value = resultListEmployee.result;
|
||||||
}
|
}
|
||||||
|
|
@ -752,7 +750,7 @@ async function onSubmitEdit(id: string) {
|
||||||
personName: formData.value.personName,
|
personName: formData.value.personName,
|
||||||
};
|
};
|
||||||
|
|
||||||
if(tempValue.status === 'CREATED') delete tempValue['status']
|
if (tempValue.status === 'CREATED') delete tempValue['status'];
|
||||||
|
|
||||||
await editById(id, tempValue);
|
await editById(id, tempValue);
|
||||||
infoDrawer.value = false;
|
infoDrawer.value = false;
|
||||||
|
|
@ -1088,7 +1086,7 @@ onMounted(async () => {
|
||||||
const resultList = await fetchList({
|
const resultList = await fetchList({
|
||||||
includeBranch: true,
|
includeBranch: true,
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: pageSizeCustomer.value,
|
pageSize: pageSize.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (resultStats) {
|
if (resultStats) {
|
||||||
|
|
@ -1107,9 +1105,7 @@ onMounted(async () => {
|
||||||
|
|
||||||
if (resultList) {
|
if (resultList) {
|
||||||
currentPageCustomer.value = resultList.page;
|
currentPageCustomer.value = resultList.page;
|
||||||
maxPageCustomer.value = Math.ceil(
|
maxPageCustomer.value = Math.ceil(resultList.total / pageSize.value);
|
||||||
resultList.total / pageSizeCustomer.value,
|
|
||||||
);
|
|
||||||
listCustomer.value = resultList.result;
|
listCustomer.value = resultList.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1123,12 +1119,12 @@ onMounted(async () => {
|
||||||
|
|
||||||
const resultListEmployee = await employeeStore.fetchList({
|
const resultListEmployee = await employeeStore.fetchList({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: pageSizeEmployee.value,
|
pageSize: pageSize.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (resultListEmployee) {
|
if (resultListEmployee) {
|
||||||
maxPageEmployee.value = Math.ceil(
|
maxPageEmployee.value = Math.ceil(
|
||||||
resultListEmployee.total / pageSizeEmployee.value,
|
resultListEmployee.total / pageSize.value,
|
||||||
);
|
);
|
||||||
listEmployee.value = resultListEmployee.result;
|
listEmployee.value = resultListEmployee.result;
|
||||||
}
|
}
|
||||||
|
|
@ -1142,14 +1138,6 @@ watch(locale, () => {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(currentPageCustomer, async () => {
|
|
||||||
await fetchListCustomer();
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(currentPageEmployee, async () => {
|
|
||||||
await fetchListEmployee();
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(fieldSelectedCustomer, async () => {
|
watch(fieldSelectedCustomer, async () => {
|
||||||
let resultList;
|
let resultList;
|
||||||
|
|
||||||
|
|
@ -1549,14 +1537,22 @@ watch([inputSearch, currentStatus], async () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="listCustomer.length !== 0" class="row flex-center q-pt-md">
|
<div
|
||||||
<q-pagination
|
v-if="listCustomer.length !== 0"
|
||||||
claess="pagination"
|
class="row justify-between q-pt-md"
|
||||||
v-model="currentPageCustomer"
|
>
|
||||||
:max="maxPageCustomer"
|
<div class="app-text-muted">
|
||||||
direction-links
|
{{
|
||||||
active-color="primary"
|
$t('recordsPage', {
|
||||||
gutter="sm"
|
resultcurrentPage: listCustomer.length,
|
||||||
|
total: statsCustomerType.PERS + statsCustomerType.CORP,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
<PaginationComponent
|
||||||
|
v-model:current-page="currentPageCustomer"
|
||||||
|
v-model:max-page="maxPageCustomer"
|
||||||
|
:fetch-data="async () => await fetchListCustomer()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -1608,14 +1604,19 @@ watch([inputSearch, currentStatus], async () => {
|
||||||
@toggle-status="(id, status) => toggleStatusEmployee(id, status)"
|
@toggle-status="(id, status) => toggleStatusEmployee(id, status)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="row flex-center q-pt-md">
|
<div class="row justify-between q-pt-md">
|
||||||
<q-pagination
|
<div class="app-text-muted">
|
||||||
claess="pagination"
|
{{
|
||||||
v-model="currentPageEmployee"
|
$t('recordsPage', {
|
||||||
:max="maxPageEmployee"
|
resultcurrentPage: listEmployee.length,
|
||||||
direction-links
|
total: statsEmployee,
|
||||||
active-color="primary"
|
})
|
||||||
gutter="sm"
|
}}
|
||||||
|
</div>
|
||||||
|
<PaginationComponent
|
||||||
|
v-model:current-page="currentPageEmployee"
|
||||||
|
v-model:max-page="maxPageEmployee"
|
||||||
|
:fetch-data="async () => await fetchListEmployee()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue