import type { PageParam, PageResult } from '#/packages/effects/request/src';
|
|
import { requestClient } from '#/api/request';
|
|
import { isPdMockEnabled } from '../mock/enabled';
|
import { pdMockStore } from '../mock/store';
|
|
export namespace MesPdArchiveApi {
|
/** 数字化设计归档台账 */
|
export interface Archive {
|
id?: number;
|
code?: string;
|
projectId?: number;
|
projectCode?: string;
|
projectName?: string;
|
productCode?: string;
|
productName?: string;
|
version?: string;
|
archiveStatus?: number;
|
archiveTime?: number;
|
archiverId?: number;
|
archiverName?: string;
|
documentCount?: number;
|
bomCount?: number;
|
storagePath?: string;
|
remark?: string;
|
createTime?: number;
|
}
|
|
export interface PageParams extends PageParam {
|
code?: string;
|
projectCode?: string;
|
productCode?: string;
|
archiveStatus?: number;
|
}
|
}
|
|
export function getPdArchivePage(params: MesPdArchiveApi.PageParams) {
|
if (isPdMockEnabled()) {
|
return pdMockStore.getArchivePage(params);
|
}
|
return requestClient.get<PageResult<MesPdArchiveApi.Archive>>(
|
'/mes/pd/archive/page',
|
{ params },
|
);
|
}
|
|
export function getPdArchive(id: number) {
|
if (isPdMockEnabled()) {
|
return pdMockStore.getArchive(id);
|
}
|
return requestClient.get<MesPdArchiveApi.Archive>(
|
`/mes/pd/archive/get?id=${id}`,
|
);
|
}
|
|
export function exportPdArchive(params: MesPdArchiveApi.PageParams) {
|
if (isPdMockEnabled()) {
|
return Promise.resolve(new Blob());
|
}
|
return requestClient.download('/mes/pd/archive/export-excel', { params });
|
}
|