bug修复
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled
This commit is contained in:
@@ -32,9 +32,29 @@ export async function exportCmsCompanyList(params?: API.CompanyList.Params) {
|
||||
return downLoadXlsx(`/cms/company/export`, { params }, `dict_data_${new Date().getTime()}.xlsx`);
|
||||
}
|
||||
|
||||
/** 解析企业详情接口响应(兼容 data 包裹与平铺字段两种格式) */
|
||||
export function parseCmsCompanyDetailResponse(
|
||||
resp?: { code?: number; data?: API.CompanyList.Company; msg?: string; [key: string]: any },
|
||||
): API.CompanyList.Company | undefined {
|
||||
if (!resp || resp.code !== 200) {
|
||||
return undefined;
|
||||
}
|
||||
if (resp.data && typeof resp.data === 'object' && !Array.isArray(resp.data)) {
|
||||
return resp.data;
|
||||
}
|
||||
const { code, msg, data, rows, total, ...rest } = resp;
|
||||
if (Object.keys(rest).length > 0) {
|
||||
return rest as API.CompanyList.Company;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export async function getCmsCompanyDetail(companyId: number | string) {
|
||||
return request<any>(`/api/cms/company/${companyId}`, {
|
||||
return request<{
|
||||
code: number;
|
||||
msg?: string;
|
||||
data?: API.CompanyList.Company;
|
||||
}>(`/api/cms/company/${companyId}`, {
|
||||
method: 'GET',
|
||||
params: { companyId },
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user