|
@@ -10,6 +10,8 @@ import * as api from '../api';
|
|
|
import { Link, Picture as IconPicture } from '@element-plus/icons-vue';
|
|
|
import { platformColumns } from '../useColumns';
|
|
|
import router from '/@/router';
|
|
|
+import { useTableData } from '/@/utils/useTableData';
|
|
|
+import { usePagination } from '/@/utils/usePagination';
|
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
@@ -17,6 +19,7 @@ const platform = route.query.platform;
|
|
|
const platformOverview: any = ref([]);
|
|
|
const overviewLoading = ref();
|
|
|
// const selectedTab = ref('1');
|
|
|
+const { tableOptions, handlePageChange } = usePagination(fetchPlatformDetail);
|
|
|
const platformTableData = ref([]);
|
|
|
const gridOptions: any = reactive({
|
|
|
border: false,
|
|
@@ -34,9 +37,9 @@ const gridOptions: any = reactive({
|
|
|
resizable: true
|
|
|
},
|
|
|
pagerConfig: {
|
|
|
- total: 0,
|
|
|
- page: 1,
|
|
|
- limit: 10
|
|
|
+ total: tableOptions.value.total,
|
|
|
+ page: tableOptions.value.page,
|
|
|
+ limit: tableOptions.value.limit
|
|
|
},
|
|
|
loading: false,
|
|
|
loadingConfig: {
|
|
@@ -58,11 +61,7 @@ async function fetchPlatformDetail() {
|
|
|
page: gridOptions.pagerConfig.page,
|
|
|
limit: gridOptions.pagerConfig.limit
|
|
|
};
|
|
|
- const res = await useResponse(query, api.getTableData, gridOptions);
|
|
|
- gridOptions.pagerConfig.total = res.total;
|
|
|
- gridOptions.pagerConfig.page = res.page;
|
|
|
- gridOptions.pagerConfig.limit = res.limit;
|
|
|
- platformTableData.value = res.data;
|
|
|
+ await useTableData(api.getTableData, query, gridOptions)
|
|
|
}
|
|
|
|
|
|
function pageChange({ pageSize, currentPage }: any) {
|
|
@@ -71,6 +70,7 @@ function pageChange({ pageSize, currentPage }: any) {
|
|
|
fetchPlatformDetail();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
async function fetchPlatformDetailOverview() {
|
|
|
const res = await useResponse({ platform }, api.getPlatformDetailOverview, overviewLoading);
|
|
|
platformOverview.value = res.data;
|
|
@@ -143,7 +143,7 @@ function handleNavigate(item: any) {
|
|
|
v-model:currentPage="gridOptions.pagerConfig.page"
|
|
|
v-model:pageSize="gridOptions.pagerConfig.limit"
|
|
|
:total="gridOptions.pagerConfig.total"
|
|
|
- @page-change="pageChange"
|
|
|
+ @page-change="handlePageChange"
|
|
|
>
|
|
|
</vxe-pager>
|
|
|
</template>
|