refactor: set page Size

This commit is contained in:
Thanaphon Frappet 2024-11-12 17:12:20 +07:00
parent 7cb55879f8
commit 829a5d8221
2 changed files with 13 additions and 4 deletions

View file

@ -213,8 +213,10 @@ function openEmployerBranchForm(formType: 'create' | 'edit' | 'info') {
customerBranchFormState.value.dialogModal = true;
}
async function fetchEmployee(branchId: string) {
const res = await fetchBranchEmployee(branchId);
async function fetchEmployee(opts: { branchId: string; pageSize?: number }) {
const res = await fetchBranchEmployee(opts.branchId, {
pageSize: opts.pageSize,
});
if (res) {
listEmployee.value = res.data.result;
@ -232,7 +234,10 @@ watch(
() => statusEmployeeCreate.value,
async () => {
if (statusEmployeeCreate.value) {
await fetchEmployee(currentBranchEmployee.value);
await fetchEmployee({
branchId: currentBranchEmployee.value,
pageSize: 999,
});
const br = branch.value?.find(
(v) => v.id === currentBranchEmployee.value,
@ -512,7 +517,10 @@ watch(
@click.stop="
async () => {
currentBranchEmployee = props.row.id;
await fetchEmployee(currentBranchEmployee);
await fetchEmployee({
branchId: currentBranchEmployee,
pageSize: 999,
});
currentBtnOpen.map((v, i) => {
if (i !== props.rowIndex) {

View file

@ -1346,6 +1346,7 @@ const emptyCreateDialog = ref(false);
async () => {
const res = await employeeStore.fetchList({
customerId: props.row.id,
pageSize: 999,
});
if (res) {