52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import { request } from '@/utils/request'
|
||
|
||
/** 模型预览状态 */
|
||
export type PlmModelPreviewStatus = 'ready' | 'converting' | 'failed' | 'not_found'
|
||
|
||
/** 预览请求参数(按业务场景传其一组合即可) */
|
||
export interface PlmModelPreviewQuery {
|
||
/** 生产订单 id */
|
||
orderItemId?: number | string
|
||
/** 物料编码 / 图号 */
|
||
materialCode?: string
|
||
/** PLM 图号(不传则后端可用 materialCode) */
|
||
drawingNo?: string
|
||
/** 工序计划 id */
|
||
processPlanId?: number | string
|
||
/** 派工任务 id */
|
||
dispatchId?: number | string
|
||
}
|
||
|
||
/** 预览结果 */
|
||
export interface PlmModelPreviewResult {
|
||
status: PlmModelPreviewStatus
|
||
/** glTF / glb 访问地址(相对或绝对) */
|
||
previewUrl?: string
|
||
message?: string
|
||
materialCode?: string
|
||
drawingNo?: string
|
||
materialName?: string
|
||
originalFormat?: string
|
||
}
|
||
|
||
/** 打开预览抽屉时的上下文 */
|
||
export interface PlmModelOpenContext extends PlmModelPreviewQuery {
|
||
title?: string
|
||
materialName?: string
|
||
}
|
||
|
||
export const plmModelApi = {
|
||
/**
|
||
* 获取三维模型预览(后端:PLM 按需下载 → 转 glTF)
|
||
* 首次可能返回 converting,前端需轮询直至 ready
|
||
*/
|
||
getPreview(params: PlmModelPreviewQuery) {
|
||
return request<PlmModelPreviewResult>({
|
||
url: '/biz/plm/model/preview',
|
||
method: 'get',
|
||
params,
|
||
timeout: 600000,
|
||
})
|
||
},
|
||
}
|