refactor: 更新API接口与数据结构,统一分页返回格式
This commit is contained in:
@@ -525,7 +525,7 @@ import type { EditorConfiguration } from "codemirror";
|
||||
import { FormTypeEnum, QueryTypeEnum } from "@/enums/codegen";
|
||||
|
||||
import GeneratorAPI from "@/api/codegen";
|
||||
import type { FieldConfig, GenConfigForm, TablePageQuery, TablePageVo } from "@/api/types";
|
||||
import type { FieldConfig, GenConfigForm, TableQueryParams, TableItem } from "@/api/types";
|
||||
import { ElLoading } from "element-plus";
|
||||
|
||||
import DictAPI from "@/api/system/dict";
|
||||
@@ -574,7 +574,7 @@ const filteredTreeData = computed<TreeNode[]>(() => {
|
||||
});
|
||||
|
||||
const queryFormRef = ref();
|
||||
const queryParams = reactive<TablePageQuery>({
|
||||
const queryParams = reactive<TableQueryParams>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
@@ -582,13 +582,13 @@ const queryParams = reactive<TablePageQuery>({
|
||||
const loading = ref(false);
|
||||
const loadingText = ref("loading...");
|
||||
|
||||
const pageData = ref<TablePageVo[]>([]);
|
||||
const pageData = ref<TableItem[]>([]);
|
||||
const total = ref(0);
|
||||
|
||||
const formTypeOptions: Record<string, OptionType> = FormTypeEnum;
|
||||
const queryTypeOptions: Record<string, OptionType> = QueryTypeEnum;
|
||||
const dictOptions = ref<OptionType[]>();
|
||||
const menuOptions = ref<OptionType[]>([]);
|
||||
const formTypeOptions: Record<string, OptionItem> = FormTypeEnum;
|
||||
const queryTypeOptions: Record<string, OptionItem> = QueryTypeEnum;
|
||||
const dictOptions = ref<OptionItem[]>();
|
||||
const menuOptions = ref<OptionItem[]>([]);
|
||||
const genConfigFormData = ref<GenConfigForm>({
|
||||
fieldConfigs: [],
|
||||
pageType: "classic",
|
||||
@@ -818,9 +818,9 @@ function handleNextClick() {
|
||||
function handleQuery() {
|
||||
loading.value = true;
|
||||
GeneratorAPI.getTablePage(queryParams)
|
||||
.then((data) => {
|
||||
pageData.value = data.list;
|
||||
total.value = data.total;
|
||||
.then((res) => {
|
||||
pageData.value = res.data;
|
||||
total.value = res.page?.total ?? 0;
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
|
||||
Reference in New Issue
Block a user