feat(shipping-notice): 添加 MinerU 订单附件表格结构化功能,更新环境配置和数据模型以支持新布局解析和文档模板管理
This commit is contained in:
1 parent
c4095b08da
commit
c35223d49d
148 files changed
+15709
-1353
No files matched your search
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* features/admin/api/shipping-order-document-profile.api.ts
|
||||
* 用途:订单文档 Profile 管理、MinerU 样本选择和发布 API。
|
||||
* 依赖:shared/api/client、auth headers、Profile DTO。
|
||||
* 逻辑:页面只使用结构化接口;结构指纹和 HTML 始终由后端持有。
|
||||
*/
|
||||
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import type {
|
||||
CreateOrderProfileFromSampleInput,
|
||||
OrderProfileSampleDocument,
|
||||
OrderProfileSamplePreview,
|
||||
ShippingOrderDocumentProfile,
|
||||
} from '../types/shipping-order-document-profile.types';
|
||||
|
||||
const auth = () => ({ headers: getAuthHeaders() });
|
||||
const jsonAuth = () => ({ headers: { 'Content-Type': 'application/json', ...getAuthHeaders() } });
|
||||
|
||||
/** 列出全部 Profile 版本。 */
|
||||
export const listOrderDocumentProfiles = () =>
|
||||
requestJson<ShippingOrderDocumentProfile[]>('/api/admin/shipping-notice/order-document-profiles', auth());
|
||||
|
||||
/** 列出已具备 ready MinerU 表格的样本文档。 */
|
||||
export const listOrderProfileSamples = () =>
|
||||
requestJson<OrderProfileSampleDocument[]>('/api/admin/shipping-notice/order-document-profile-samples', auth());
|
||||
|
||||
/** 读取一个样本文档的网格预览,不返回 HTML 或 bbox。 */
|
||||
export const getOrderProfileSampleTables = (documentId: number) =>
|
||||
requestJson<OrderProfileSamplePreview>(
|
||||
`/api/admin/shipping-notice/order-document-profile-samples/${documentId}/tables`, auth(),
|
||||
);
|
||||
|
||||
/** 由真实样本和结构化列选择创建 Profile 草稿。 */
|
||||
export const createOrderProfileFromSample = (payload: CreateOrderProfileFromSampleInput) =>
|
||||
requestJson<ShippingOrderDocumentProfile>('/api/admin/shipping-notice/order-document-profiles/from-sample', {
|
||||
method: 'POST', body: JSON.stringify(payload), ...jsonAuth(),
|
||||
});
|
||||
|
||||
/** 用新样本和乐观锁更新已存在草稿。 */
|
||||
export const updateOrderProfileFromSample = (
|
||||
profileId: number, payload: CreateOrderProfileFromSampleInput & { expected_lock_version: number },
|
||||
) => requestJson<ShippingOrderDocumentProfile>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}/from-sample`, {
|
||||
method: 'PUT', body: JSON.stringify(payload), ...jsonAuth(),
|
||||
},
|
||||
);
|
||||
|
||||
/** 发布草稿并退役同编码旧版本。 */
|
||||
export const publishOrderDocumentProfile = (profileId: number, expectedLockVersion: number) =>
|
||||
requestJson<ShippingOrderDocumentProfile>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}/publish`,
|
||||
{ method: 'POST', body: JSON.stringify({ expected_lock_version: expectedLockVersion }), ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** 从不可变版本复制下一草稿。 */
|
||||
export const cloneOrderDocumentProfile = (profileId: number) =>
|
||||
requestJson<ShippingOrderDocumentProfile>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}/clone`,
|
||||
{ method: 'POST', ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** 退役当前发布版本。 */
|
||||
export const retireOrderDocumentProfile = (profileId: number) =>
|
||||
requestJson<ShippingOrderDocumentProfile>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}/retire`,
|
||||
{ method: 'POST', ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** 删除错误草稿。 */
|
||||
export const deleteOrderDocumentProfile = (profileId: number) =>
|
||||
requestJson<void>(`/api/admin/shipping-notice/order-document-profiles/${profileId}`, {
|
||||
method: 'DELETE', ...auth(),
|
||||
});
|
||||
Reference in new issue
Block a user