feat: 联想弹层,反显不经过接口及翻页显示修改

This commit is contained in:
GAOANG
2024-07-03 16:36:42 +08:00
parent 105c8cb768
commit d72eec1a1b
6 changed files with 392 additions and 361 deletions

View File

@ -45,7 +45,7 @@ export function camelCaseString(string: string) {
return str;
}
export async function apiConfigFunc(apiConfig, isCustomForm = false, formModel?, index?) {
export async function apiConfigFunc(apiConfig, isCustomForm = false, formModel?, index?, paginationProps?, backPagination) {
if (!apiConfig?.path) return [];
const queryParam = {};
const headerParam = {};
@ -57,6 +57,10 @@ export async function apiConfigFunc(apiConfig, isCustomForm = false, formModel?,
for (const query of param.tableInfo) {
queryParam[query.name] = apiConfig.input||getParamsValue(query, formModel, isCustomForm, index);
}
if (backPagination) {
queryParam.limit = paginationProps.current
queryParam.size = paginationProps.pageSize
}
}
//header
if (param.key === '2' && param.tableInfo && param.tableInfo.length) {
@ -79,6 +83,9 @@ export async function apiConfigFunc(apiConfig, isCustomForm = false, formModel?,
body: bodyParam,
query: queryParam,
});
if(paginationProps) {
paginationProps.total = res?.total || res?.length || 0
}
if (res && Array.isArray(res)) return res; //不分页接口
if (res && Array.isArray(res.list)) return res.list; //分页接口
return res;