mes-vue/src/api/plmModel.ts
2026-07-08 10:43:59 +08:00

52 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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,
})
},
}