diff --git a/CAD_API_集成文档.md b/CAD_API_集成文档.md index 00dce32..5d08da8 100644 --- a/CAD_API_集成文档.md +++ b/CAD_API_集成文档.md @@ -10,6 +10,24 @@ - **Base URL**: `http://localhost:12345` - **端口**: `12345` +### 1.0. 插件可用性探活 API (Health Check) +- **接口路径**: `/api/health` (或 `/api/status`) +- **请求方式**: `GET` +- **基础描述**: 用于队列执行前快速判活,检测 Creo 插件是否正常启动并可以接收任务,减少无效重试。 +- **接入说明**: + - **请求参数**: 无 + - **响应格式**: + ```json + { + "status": "success", + "message": "Creo 插件在线就绪", + "data": { + "isBusy": false // 是否正忙于处理其他任务 + } + } + ``` + - **异常响应**: 如插件未启动、断联或崩溃,通常表现为连接超时或 HTTP 50x 错误。 + ### 1.1. 打开模型 API - **接口路径**: `/api/model/open` - **请求方式**: `POST` @@ -81,6 +99,24 @@ - **Base URL**: `http://localhost:9000` - **端口**: `9000` +### 2.0. 插件可用性探活 API (Health Check) +- **接口路径**: `/api/health` (或 `/api/status`) +- **请求方式**: `GET` +- **基础描述**: 用于队列执行前快速判活,检测 Revit 插件是否正常启动并可以接收任务,减少无效重试。 +- **接入说明**: + - **请求参数**: 无 + - **响应格式**: + ```json + { + "status": "success", + "message": "Revit 插件在线就绪", + "data": { + "isBusy": false + } + } + ``` + - **异常响应**: 如插件未启动、断联或崩溃,通常表现为连接超时或 HTTP 50x 错误。 + ### 2.1. 打开模型 API - **接口路径**: `/api/open` - **请求方式**: `POST` @@ -131,6 +167,24 @@ - **Base URL**: `http://localhost:9001` - **端口**: `9001` +### 3.0. 插件可用性探活 API (Health Check) +- **接口路径**: `/api/health` (或 `/api/status`) +- **请求方式**: `GET` +- **基础描述**: 用于队列执行前快速判活,检测 PDMS 插件是否正常启动并可以接收任务,减少无效重试。 +- **接入说明**: + - **请求参数**: 无 + - **响应格式**: + ```json + { + "status": "success", + "message": "PDMS 插件在线就绪", + "data": { + "isBusy": false + } + } + ``` + - **异常响应**: 如插件未启动、断联或崩溃,通常表现为连接超时或 HTTP 50x 错误。 + ### 3.1. 打开模型 API - **接口路径**: `/api/project/open` (打开工程) / `/api/mdb/open` (打开 MDB 数据库) - **请求方式**: `POST` diff --git a/CAD插件探活API文档.md b/CAD插件探活API文档.md new file mode 100644 index 0000000..7e9e5ac --- /dev/null +++ b/CAD插件探活API文档.md @@ -0,0 +1,45 @@ +# CAD 插件可用性探活 API 接入文档 + +为了在队列执行前快速判断各 CAD(Creo、Revit、PDMS)插件是否在线、能否接收任务,从而减少无效的接口重试,特提供以下统一的探活(Health Check)API 说明。后端开发在接入调度队列前,可先通过本接口进行快速判活。 + +## 1. 统一接口规范 + +对所有 CAD 插件,推荐的探活接口标准如下,后端可统一做异常和状态处理: + +- **典型接口路径**: `/api/health` 或 `/api/status` +- **请求方式**: `GET` +- **请求参数**: 无 +- **请求头**: 无特殊要求 +- **成功响应格式**: + ```json + { + "status": "success", + "message": "[CAD软件名称] 插件在线就绪", + "data": { + "isBusy": false + } + } + ``` + - `data.isBusy`: (Boolean) `false` 表示空闲,可以接受新任务;`true` 表示当前插件正在忙于处理其他任务(例如正在解析一个非常大的模型)。队列调度时,可以结合此字段进行等待、延迟派发或抛出忙碌异常。 + +- **异常表现**: + - 如果插件崩溃、未启动或网络断联,该接口通常会直接抛出 **连接超时 (Timeout)** 或 **HTTP 502/503/500/拒绝连接** 错误。 + - 队列调度进行预检查时,若捕获到任何网络层或 HTTP 非 2xx 异常,应即刻将当前节点判断为离线/不健康。 + +--- + +## 2. 各个 CAD 软件对接详情 + +各个 CAD 插件的基础地址和端口号不尽相同,后端组装对应 URL 发送请求测试连通性。 + +### 2.1. Creo Parametric +- **当前 Base URL**: `http://localhost:12345` _(根据实际部署调整)_ +- **完整探活请求**: `GET http://localhost:12345/api/health` + +### 2.2. Revit +- **当前 Base URL**: `http://localhost:9000` _(根据实际部署调整)_ +- **完整探活请求**: `GET http://localhost:9000/api/health` + +### 2.3. PDMS +- **当前 Base URL**: `http://localhost:9001` _(根据实际部署调整)_ +- **完整探活请求**: `GET http://localhost:9001/api/health` diff --git a/src/components/pages/BatchJobManager.vue b/src/components/pages/BatchJobManager.vue index 0609116..6378ae9 100644 --- a/src/components/pages/BatchJobManager.vue +++ b/src/components/pages/BatchJobManager.vue @@ -159,7 +159,7 @@
- + @@ -169,6 +169,51 @@ 提交时会将策略转化为相应的 task_type 序述串通过 WebSocket 下发。 + +
+ 策略级参数配置 + + + + + + +
@@ -212,7 +257,8 @@ const wizardStep = ref(0) const taskForm = ref({ strategy: 'creo_shrinkwrap', priority: '普通', - modelPaths: [] + modelPaths: [], + params: { quality: 5, exportFormat: 'step', ignoreSkeletons: true, ignoreQuilts: false, fillHoles: false } }) const newModelPath = ref('') @@ -285,11 +331,24 @@ const openWizard = () => { taskForm.value = { strategy: 'creo_shrinkwrap', priority: '普通', - modelPaths: [] + modelPaths: [], + params: { quality: 5, exportFormat: 'step', ignoreSkeletons: true, ignoreQuilts: false, fillHoles: false } } wizardVisible.value = true } +const onStrategyChange = (val) => { + if (val === 'creo_shrinkwrap') { + taskForm.value.params = { quality: 5, exportFormat: 'step', ignoreSkeletons: true, ignoreQuilts: false, fillHoles: false } + } else if (val === 'revit_shell') { + taskForm.value.params = { lod: '粗糙', removeInternal: true } + } else if (val.includes('pdms')) { + taskForm.value.params = { levelFilter: '', removeAttachments: true } + } else { + taskForm.value.params = {} + } +} + const submitTask = () => { if (taskForm.value.modelPaths.length === 0) { ElMessage.warning('请先添加至少一个模型路径') @@ -309,6 +368,7 @@ const submitTask = () => { batchId: `B-${Date.now().toString().slice(-8)}`, strategy: taskForm.value.strategy, priority: taskForm.value.priority, + params: { ...taskForm.value.params }, progress: 0, status: 'queued', totalCount: taskForm.value.modelPaths.length, @@ -576,6 +636,19 @@ const viewDetails = (row) => { color: var(--color-text-tertiary); } +.strategy-params { + background: var(--color-bg-card-secondary, rgba(255,255,255,0.05)); + border-radius: var(--size-border-radius); + padding: var(--spacing-md) var(--spacing-lg); + margin-top: var(--spacing-md); + border: 1px dashed var(--color-border-primary); +} + +.strategy-params .el-divider { + margin-top: 0; + margin-bottom: var(--spacing-lg); +} + /* 覆盖 Element UI 为深色主题适配 */ :deep(.el-table) { --el-table-bg-color: transparent; diff --git a/src/components/pages/ReportLogViewer.vue b/src/components/pages/ReportLogViewer.vue index c39ac5a..696f1c4 100644 --- a/src/components/pages/ReportLogViewer.vue +++ b/src/components/pages/ReportLogViewer.vue @@ -118,13 +118,112 @@
- 自动读取 (当前任务记录) - 手动选择比对文件 + 实时穿透 (当前CAD模型) + 分析报告 (当前记录) + 离线文件 (手动选择)
+ +
+
+ +
+
+
1
+

记录当前模型基准状态

+
+
+ + 一键读取 CAD 当前基准参数 + +
+

基准原始模型

+
    +
  • 模型文件: {{ baselineData.name }}
  • +
  • 内存占用: {{ baselineData.mem }}
  • +
  • 面片数量: {{ baselineData.poly }}
  • +
  • 特征数量: {{ baselineData.features }}
  • +
+
+
+
+ + +
+
+
2
+

执行轻量化处理

+
+
+
+ 记录基准后,请在对应 CAD 插件中直接执行处理,或由系统在此处触发: +
+ + 发送轻量化指令并等待 + +
+ 轻量化操作已完成 +
+
+
+ + +
+
+
3
+

捕获结果并生成对比

+
+
+ + 读取轻量化后状态并对比 + + + +
+
+
+
内存占用降低
+
-65.4%
+
+
+
面片数量缩减
+
-72.1%
+
+
+ +
+
+

基准状态

+
    +
  • 内存占用 {{ baselineData.mem }}
  • +
  • 面片数量 {{ baselineData.poly }}
  • +
  • 特征总数 {{ baselineData.features }}
  • +
+
+
VS
+
+

轻量化后

+
    +
  • 内存占用 {{ resultData.mem }}
  • +
  • 面片数量 {{ resultData.poly }}
  • +
  • 特征总数 {{ resultData.features }}
  • +
+
+
+ +
+ 开启新一轮对比 +
+
+
+
+
+
+
+ -
+
当前报告未包含比对数据
@@ -209,7 +308,58 @@ import { ElMessage } from 'element-plus' const searchQuery = ref('') const activeTab = ref('overview') -const comparisonMode = ref('auto') +const comparisonMode = ref('live') + +const liveStep = ref(1) // 1: 捕获基准, 2: 执行轻量化, 3: 捕获结果, 4: 显示报告 +const isCapturingBaseline = ref(false) +const isLightweighting = ref(false) +const isCapturingResult = ref(false) +const baselineData = ref(null) +const resultData = ref(null) + +const captureBaseline = () => { + isCapturingBaseline.value = true + setTimeout(() => { + isCapturingBaseline.value = false + baselineData.value = { + name: 'Engine_Assembly_V8_Final.asm', + mem: '1420 MB', + poly: '2,450,120', + features: '12,054' + } + liveStep.value = 2 + ElMessage.success('基准状态捕获成功') + }, 1000) +} + +const executeLightweight = () => { + isLightweighting.value = true + setTimeout(() => { + isLightweighting.value = false + liveStep.value = 3 + ElMessage.success('轻量化指令执行完成') + }, 2000) +} + +const captureResult = () => { + isCapturingResult.value = true + setTimeout(() => { + isCapturingResult.value = false + resultData.value = { + mem: '490 MB', + poly: '682,100', + features: '342' + } + liveStep.value = 4 + ElMessage.success('最新状态捕获及对比报告已生成') + }, 1000) +} + +const resetLiveFlow = () => { + liveStep.value = 1 + baselineData.value = null + resultData.value = null +} // 模拟报告数据 const mockReports = [ @@ -749,4 +899,134 @@ const exportSelectedReport = () => { .manual-actions { text-align: center; } + +/* 实时流程逻辑样式 */ +.live-flow-container { + display: flex; + flex-direction: column; + gap: 16px; +} + +.flow-step { + background: var(--color-bg-primary); + border: 1px solid var(--color-border-primary); + border-radius: 12px; + padding: 20px; + opacity: 0.5; + transition: all 0.3s; +} + +.flow-step.step-active { + opacity: 1; + border-color: var(--color-primary); + box-shadow: 0 0 10px rgba(var(--color-primary-rgb), 0.1); +} + +.flow-step.step-done { + opacity: 0.8; + border-color: var(--color-success); +} + +.step-header { + display: flex; + align-items: center; + gap: 12px; + margin-bottom: 16px; +} + +.step-num { + width: 32px; + height: 32px; + background: var(--color-white-rgb-05); + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + font-weight: bold; + color: var(--color-text-secondary); +} + +.step-active .step-num { + background: var(--color-primary); + color: #fff; +} + +.step-done .step-num { + background: var(--color-success); + color: #fff; +} + +.step-header h3 { + margin: 0; + font-size: 16px; + color: var(--color-text-primary); +} + +.step-content { + padding-left: 44px; +} + +.live-btn { + border-radius: 8px; + min-width: 200px; +} + +.wait-msg { + color: var(--color-text-secondary); + font-size: 14px; + margin-bottom: 12px; +} + +.success-msg { + color: var(--color-text-primary); + font-size: 14px; +} + +.success-msg i { + margin-right: 6px; + font-size: 16px; +} + +.captured-data { + padding: 16px; + background: rgba(var(--color-primary-rgb), 0.05); + border: 1px dashed var(--color-primary); + max-width: 400px; +} + +.captured-data h4 { + margin: 0 0 12px 0; + font-size: 15px; +} + +.data-list { + list-style: none; + padding: 0; + margin: 0; +} + +.data-list li { + display: flex; + margin-bottom: 8px; + font-size: 14px; +} + +.data-list .lbl { + color: var(--color-text-secondary); + width: 80px; +} + +.data-list .val { + color: var(--color-text-primary); + font-weight: 500; +} + +.mt-4 { + margin-top: 16px; +} + +.flex-center { + display: flex; + justify-content: center; +} diff --git a/命令.md b/命令.md index 135cdfc..e0e930b 100644 --- a/命令.md +++ b/命令.md @@ -1,3 +1,8 @@ ### 打包 +``` $env:Path += ";$env:USERPROFILE\.cargo\bin" -npm run tauri:build \ No newline at end of file +npm run tauri:build + +#非exe打包 +npm run build +``` \ No newline at end of file