done don-vi-chu-quan page

parent f76fae5e
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<q-pagination <q-pagination
:model-value="currentPage" :model-value="currentPage"
:max="totalPage" :max="totalPage"
:max-pages="maxPages"
direction-links direction-links
boundary-links boundary-links
unelevated unelevated
...@@ -41,7 +42,7 @@ export default defineComponent({ ...@@ -41,7 +42,7 @@ export default defineComponent({
}, },
maxPages: { maxPages: {
type: Number, type: Number,
default: 5, default: 10,
}, },
pageSize: { pageSize: {
type: Number, type: Number,
......
...@@ -4,6 +4,7 @@ import Pagination from 'components/pagination/index.vue'; ...@@ -4,6 +4,7 @@ import Pagination from 'components/pagination/index.vue';
import { API_PATHS } from 'src/assets/configurations.example'; import { API_PATHS } from 'src/assets/configurations.example';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
import { api, BaseResponseBody } from 'src/boot/axios'; import { api, BaseResponseBody } from 'src/boot/axios';
export default defineComponent({ export default defineComponent({
components: { components: {
Pagination, Pagination,
...@@ -93,6 +94,7 @@ export default defineComponent({ ...@@ -93,6 +94,7 @@ export default defineComponent({
{ id: 2, text: 'Âm nhạc' }, { id: 2, text: 'Âm nhạc' },
{ id: 1, text: 'Thể thao' }, { id: 1, text: 'Thể thao' },
]); ]);
const totalPage = ref(10);
const fieldSelected: Ref<number | undefined> = ref(); const fieldSelected: Ref<number | undefined> = ref();
const getListUnits = () => { const getListUnits = () => {
// const response = (await api({ // const response = (await api({
...@@ -116,6 +118,20 @@ export default defineComponent({ ...@@ -116,6 +118,20 @@ export default defineComponent({
]; ];
managingUnitTableRows.value = fakeData; managingUnitTableRows.value = fakeData;
}; };
const filterListUnit = () => {
// const response = (await api({
// url: API_PATHS.filterListUnit,
// method: 'GET',
// params: {
// unitName: unitNameKeyword.value,
// fieldName: fieldSelected.value,
// },
// })) as AxiosResponse<BaseResponseBody<unknown>>;
};
const changePageSize = () => {
pageIndex.value = 1;
void getListUnits();
};
onMounted(() => { onMounted(() => {
void getListUnits(); void getListUnits();
}); });
...@@ -128,6 +144,9 @@ export default defineComponent({ ...@@ -128,6 +144,9 @@ export default defineComponent({
unitNameKeyword, unitNameKeyword,
fieldOptions, fieldOptions,
fieldSelected, fieldSelected,
filterListUnit,
totalPage,
changePageSize,
}; };
}, },
}); });
...@@ -20,7 +20,12 @@ ...@@ -20,7 +20,12 @@
></q-select> ></q-select>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<q-btn color="primary" no-caps :label="$t('crudActions.search')"> </q-btn> <q-btn
color="primary"
no-caps
:label="$t('crudActions.search')"
@click="filterListUnit"
></q-btn>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<q-btn color="primary" no-caps :label="$t('crudActions.add')"> </q-btn> <q-btn color="primary" no-caps :label="$t('crudActions.add')"> </q-btn>
...@@ -37,6 +42,15 @@ ...@@ -37,6 +42,15 @@
> >
</q-table> </q-table>
</div> </div>
<div class="col-12 q-mt-sm">
<Pagination
v-model:currentPage="pageIndex"
v-model:pageSize="pageSize"
:totalPage="totalPage"
@update:pageSize="changePageSize"
@update:currentPage="getListUnits"
/>
</div>
</div> </div>
</template> </template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment