am-freescan/am-web/src/views/lab/inspection/InspectionWorkbench.vue

1936 lines
62 KiB
Vue
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.

<template>
<div class="inspection-workspace" v-loading="initialLoading">
<el-alert v-if="error" :title="error" type="error" show-icon @close="error = ''" />
<section class="inspect-panel task-overview">
<div class="task-heading"
><div
><div class="inspect-sub">检测任务 / {{ recordId }}</div
><h2>{{ current.title || '读取检测任务…' }}</h2></div
><el-tag :type="statusType">{{ statusLabel }}</el-tag
><el-button :disabled="busy" @click="reload">刷新状态</el-button></div
>
<el-progress v-if="processing" :percentage="current.progress || 0" />
<el-alert
v-if="current.engine_unavailable"
title="计算服务暂不可用,当前显示已保存的记录和报告;三维交互需计算服务恢复。"
type="warning"
:closable="false"
/>
<el-alert
v-else-if="current.message && !ready"
:title="userMessage(current.message, '正在处理检测任务')"
:type="current.status === 'error' ? 'error' : 'info'"
:closable="false"
/>
<el-alert
v-if="current.auto_measure_error"
:title="userMessage(current.auto_measure_error, '部分检测项未完成,请核对检测配置')"
type="error"
:closable="false"
/>
<div class="task-files"
><span><Icon icon="ep:aim" />扫描:{{ inputs.source?.name || '—' }}</span
><span><Icon icon="ep:box" />数模:{{ inputs.target?.name || '—' }}</span
><span><Icon icon="ep:document" />图纸:{{ inputs.drawing?.name || '未上传' }}</span></div
>
<div
class="workspace-nav"
:class="{ 'is-surface': surfaceOnly }"
role="tablist"
aria-label="检测工作区"
><button
v-for="item in availablePanels"
:key="item.id"
type="button"
role="tab"
:aria-selected="panel === item.id"
:disabled="item.id === 'features' && !featureAvailable"
:class="{ active: panel === item.id }"
@click="switchPanel(item.id)"
><Icon :icon="item.icon" :size="20" /><span
><strong>{{ item.title }}</strong
><small>{{ item.text }}</small></span
></button
></div
>
</section>
<InspectionCleanup
v-if="cleanupOpened && (current.preview_available || ready || current.status === 'review')"
v-show="panel === 'cleanup' && !processing"
:key="current.revision"
:record-id="recordId"
:blocked="dirty || featureDirty"
:export-enabled="featureAvailable"
@dirty="cleanupDirty = $event"
@applied="cleaned"
/>
<el-alert
v-if="panel === 'cleanup' && processing"
title="正在读取文件或重新计算,完成后可继续处理点云。"
type="info"
:closable="false"
/>
<InspectionFeatures
v-if="panel === 'features' && ready"
:record-id="recordId"
:focus-control-id="featureFocus"
@dirty="featureDirty = $event"
@reported="featureReported"
/>
<section
v-show="panel !== 'results' && panel !== 'cleanup' && panel !== 'features'"
class="inspect-panel workspace-visual"
>
<div class="workspace-section-heading"
><div
><h3>{{ panel === 'plan' ? '测量位置与几何调整' : '数模与点云对比' }}</h3
><p>{{
panel === 'plan'
? '先选择检测项,在三维视图核对位置;可切换推荐几何或重新选点。'
: '设计数模与扫描点云共用设计坐标系,切换图层检查清理和对齐效果。'
}}</p></div
><div class="workspace-actions"
><el-button v-if="ready" @click="switchPanel('cleanup')">配置点云处理</el-button
><el-button :loading="cloudLoading" :disabled="processing" @click="loadVisual(true)"
>重新加载三维</el-button
></div
></div
>
<div v-if="visualError" class="visual-error"><Icon icon="ep:warning" />{{ visualError }}</div>
<div v-if="panel === 'plan' && dirty" class="workspace-dirty"
>有未保存的计划或绑定修改。保存后可重新测量;原有报告版本仍保留。</div
>
<div v-if="panel === 'plan' && ready && selectedRow" class="binding-quickbar">
<strong>{{ selectedIndex + 1 }}. {{ selectedRow.name }}</strong>
<el-button v-if="isCircle" size="small" :disabled="!aligned" @click="beginPick('circle')"
>三点指定圆截面</el-button
>
<el-button
v-if="selectedRow.table === 'feature'"
size="small"
:disabled="!aligned"
@click="beginPick('center')"
>点选近似位置</el-button
>
<el-button
v-if="selectedRow.table === 'gauge'"
size="small"
:disabled="!aligned"
@click="beginPick('pair')"
>点间距 A / B</el-button
>
<el-button size="small" :disabled="!undoStack.length" @click="undoBinding"
>撤销调整</el-button
>
<span>Esc 取消选点 / 撤销调整</span>
</div>
<div class="binding-layout" :class="{ 'is-plan': panel === 'plan' }">
<aside v-if="panel === 'plan'" class="binding-list"
><el-input v-model="itemFilter" placeholder="搜索检测项" clearable /><div
class="binding-count"
>{{ rows.length }} 项 · {{ measuredCount }} 项有测量值</div
><div class="binding-scroll"
><button
v-for="entry in filteredRows"
:key="entry.index"
type="button"
:class="['binding-list-item', { selected: selectedIndex === entry.index }]"
@click="select(entry.index)"
><strong>{{ entry.index + 1 }}. {{ entry.row.name }}</strong
><small>{{ entry.row.control }} · 名义 {{ entry.row.nominal_mm ?? '—' }} mm</small
><span
>{{ entry.row.measured_mm ?? entry.row.trial_measured_mm ?? '—' }}
<i v-if="entry.row.measured_mm != null || entry.row.trial_measured_mm != null">mm</i
><em>{{
entry.row.inspection_result || entry.row.measurement_status || '待测'
}}</em></span
></button
></div
></aside
>
<div class="binding-view"
><InspectionViewer
ref="viewer"
:points="visual.points || []"
:reference="visual.reference || []"
:mesh="visual.mesh"
:thermal="visual.thermal"
:total="visual.total || 0"
:frame="visual.coordinate_frame || 'source_mm'"
:loading="cloudLoading"
:hint="panel === 'plan' ? selectedRow?.geometry_hint : undefined"
:seeds="pickSession?.points || []"
:pick="pickLabel"
:empty-message="processing ? '正在处理,三维预览将在数据就绪后加载' : visualError"
@point="pickPoint"
@cancel="cancelPick"
/><div class="inspect-sub viewer-sampling"
>视图已优化显示;测量使用完整保留数据。</div
></div
>
</div>
<div v-if="panel === 'model'" class="model-summary"
><div
><span>点云清理</span
><strong
>{{
current.summary?.cleanup?.retained_count?.toLocaleString() ||
current.kept?.toLocaleString() ||
'—'
}}
/
{{
current.summary?.cleanup?.original_count?.toLocaleString() ||
current.total?.toLocaleString() ||
'—'
}}</strong
><small>保留点 / 原始点</small></div
><div
><span>表面均方根偏差</span
><strong>{{ number(current.summary?.statistics?.rms_mm) }} <small>mm</small></strong
><small>点到设计表面的偏差</small></div
><div v-if="!surfaceOnly"
><span>检测计划</span><strong>{{ rows.length }} <small>项</small></strong
><small>{{ current.automatic_setup?.template?.label || '当前任务计划' }}</small></div
><div
><span>下一步</span
><el-button
v-if="surfaceOnly"
type="primary"
:disabled="!surfaceReady"
@click="switchPanel('results')"
>查看表面偏差图</el-button
><el-button v-else type="primary" :disabled="!ready" @click="switchPanel('plan')"
>核对计划与选点 <Icon icon="ep:right" class="ml-6px" /></el-button
><small v-if="!surfaceOnly">可修正几何位置与公差</small></div
></div
>
<template v-if="panel === 'plan'">
<div v-if="!ready" class="workspace-empty"
><el-empty description="请先完成点云清理与配准,再调整测量计划" /><el-button
v-if="current.status === 'review'"
type="primary"
:loading="busy"
@click="compare"
>确认保留点云并开始比对</el-button
></div
>
<div v-else-if="selectedRow" class="binding-editor">
<div class="workspace-section-heading"
><div
><h3>{{ selectedIndex + 1 }}. {{ selectedRow.name }}</h3
><p>{{ selectedRow.control }} · {{ bindingLabel }} · 设计坐标系 / mm</p></div
><div class="workspace-actions"
><el-button :disabled="selectedIndex <= 0" @click="select(selectedIndex - 1)"
>上一项</el-button
><el-button
:disabled="selectedIndex >= rows.length - 1"
@click="select(selectedIndex + 1)"
>下一项</el-button
><el-button :disabled="!undoStack.length" @click="undoBinding"
>撤销调整</el-button
></div
></div
>
<div class="binding-editor-grid"
><div
><div class="binding-method"
><strong>设计几何推荐</strong
><el-button
link
type="primary"
:loading="proposalsLoading"
:disabled="busy || !!current.engine_unavailable"
@click="recommend"
>提取 / 刷新推荐</el-button
></div
><el-select
v-model="candidateChoice"
placeholder="选择候选,三维中立即定位"
class="w-full"
@change="chooseCandidate"
><el-option
v-for="(c, i) in candidates[selectedIndex] || []"
:key="c.id"
:value="i"
:label="c.label" /></el-select
><div class="binding-help">选择对应的几何位置,或通过三维选点调整。</div>
<div class="workspace-actions"
><el-button
v-if="selectedRow.table === 'feature'"
:disabled="!aligned"
@click="beginPick('center')"
>点选近似位置</el-button
><el-button v-if="isCircle" :disabled="!aligned" @click="beginPick('circle')"
>三点指定圆截面</el-button
><el-button
v-if="selectedRow.table === 'gauge'"
:disabled="!aligned"
@click="beginPick('pair')"
>改用扫描点间距 A / B</el-button
><el-button @click="clearBinding">清除绑定</el-button></div
>
<div class="binding-help">{{
selectedRow.table === 'gauge'
? '点间距测量两个选定点之间的距离;孔心距或面距请选择对应几何特征。'
: '近似位置用于查找附近 CAD 圆;三点指定需在同一截面选择分散圆周点,测量时再用附近扫描点拟合。'
}}</div
><el-alert
v-if="selectedRow.measurement_reason"
:title="userMessage(selectedRow.measurement_reason, '请核对测量位置与参数')"
type="info"
:closable="false"
/></div>
<div class="binding-fields"
><el-form label-position="top" size="small"
><el-row :gutter="12"
><el-col :span="12"
><el-form-item label="名义值 / mm"
><el-input
v-model="selectedRow.nominal_mm"
@change="invalidateSelected" /></el-form-item></el-col
><el-col :span="12"
><el-form-item label="公差"
><el-input
v-model="selectedRow.tol_text"
placeholder="如 ±0.1"
@change="invalidateSelected" /></el-form-item></el-col></el-row></el-form
><div class="binding-values"
><span
>测量值<strong
>{{
number(selectedRow.measured_mm ?? selectedRow.trial_measured_mm)
}}
mm</strong
></span
><span
>判定<strong>{{ selectedRow.inspection_result || '待重测' }}</strong></span
></div
><div class="binding-coordinates"
><span>中心 / A</span
><code>{{
pointText(
selectedRow.geometry_hint?.approx_center_mm ||
selectedRow.geometry_hint?.point_a
)
}}</code
><span>B</span><code>{{ pointText(selectedRow.geometry_hint?.point_b) }}</code></div
></div
></div
> </div
><div v-else class="workspace-empty"
>当前任务暂无检测项,可导入 CSV / JSON 或载入检测模板。</div
>
</template>
<div v-if="current.status === 'review' && panel === 'model'" class="workspace-bottom"
><span>当前为原始扫描坐标,确认保留点云后执行配准。</span
><el-button type="primary" :loading="busy" @click="compare"
>确认点云并开始比对</el-button
></div
>
</section>
<section v-if="panel === 'plan' && ready" class="inspect-panel plan-table-panel"
><div class="workspace-section-heading"
><div
><h3>完整检测计划</h3
><p>点击一行即可在上方定位并调整;修改不会直接覆盖已归档报告。</p></div
><div class="workspace-actions"
><el-select v-model="selectedTemplate" placeholder="选择检测模板" style="width: 240px"
><el-option
v-for="t in catalog.filter((t) => t.automatic)"
:key="t.id"
:value="t.id"
:label="`${t.label} · V${t.version}`" /></el-select
><el-button :disabled="!selectedTemplate || busy" @click="applyTemplate"
>载入模板</el-button
><el-button :disabled="busy" @click="importInput?.click()">导入计划</el-button
><el-button @click="router.push('/lab/dimension/inspection-templates')"
>模板维护</el-button
><input
ref="importInput"
type="file"
accept=".csv,.json"
hidden
@change="importPlan" /></div
></div>
<el-table
:data="rows"
border
max-height="450"
highlight-current-row
:row-class-name="
({ rowIndex }: any) => (rowIndex === selectedIndex ? 'is-selected-row' : '')
"
@row-click="(row: any) => select(rows.indexOf(row), true)"
><el-table-column type="index" width="55" /><el-table-column
prop="name"
label="检测项"
min-width="180"
/><el-table-column prop="control" label="控制" width="100" /><el-table-column
label="名义 / mm"
width="115"
><template #default="s"
><el-input
v-model="s.row.nominal_mm"
size="small"
@change="invalidate(s.row)" /></template></el-table-column
><el-table-column label="公差" width="130"
><template #default="s"
><el-input
v-model="s.row.tol_text"
size="small"
@change="invalidate(s.row)" /></template></el-table-column
><el-table-column label="测量 / mm" width="115"
><template #default="s">{{
number(s.row.measured_mm ?? s.row.trial_measured_mm)
}}</template></el-table-column
><el-table-column prop="inspection_result" label="判定" width="100" /><el-table-column
label="几何绑定"
width="100"
><template #default="s">{{
s.row.geometry_hint?.binding_status === 'bound' ? '已绑定' : '待核对'
}}</template></el-table-column
><el-table-column label="操作" width="100" fixed="right"
><template #default="s"
><el-button link type="primary" @click.stop="select(rows.indexOf(s.row), true)"
>定位 / 调整</el-button
></template
></el-table-column
></el-table
>
</section>
<section v-if="panel === 'results' && surfaceOnly" class="inspect-panel results-panel">
<div class="workspace-section-heading"
><h3>表面偏差图</h3>
<el-button
v-if="surfaceReady"
type="primary"
:loading="busy"
:disabled="current.engine_unavailable"
@click="download('chromatogram_signed.png')"
>下载 PNG</el-button
>
</div>
<img
v-if="surfaceReady && chromatogram"
:src="chromatogram"
class="workspace-spectrum"
alt="零件表面偏差图"
/>
<el-alert
v-else-if="surfaceReady && surfaceChartError"
:title="surfaceChartError"
type="error"
:closable="false"
>
<el-button link type="primary" @click="loadSurfaceChart">重新读取</el-button>
</el-alert>
<el-empty
v-else
:description="surfaceReady ? '正在读取表面偏差图' : '表面比对完成后显示偏差图'"
/>
</section>
<section v-else-if="panel === 'results'" class="inspect-panel results-panel"
><el-alert
v-if="dirty"
title="当前计划有未重测的修改;此处报告和色谱对应上一次计算。请保存并重新测量后查看新版报告。"
type="warning"
:closable="false"
/>
<div class="workspace-section-heading"
><div
><h3>检测结果与报告</h3
><p>测量结果、表面色谱和报告下载集中展示,历史版本在报告管理中查询。</p></div
><div class="workspace-actions"
><el-button @click="switchPanel(featureResults.length ? 'features' : 'plan')"
>调整检测定义</el-button
><el-button @click="emit('history')">历史报告</el-button></div
></div
><p v-if="current.summary?.surface_statistics" class="inspect-sub">
统计搜索范围 {{ current.summary.surface_statistics.search_mm }} mm:参与
{{ current.summary.surface_statistics.in_search_count?.toLocaleString() }} 点,范围外
{{ current.summary.surface_statistics.outside_search_count?.toLocaleString() }}
点;局部法向投影均值
{{
number(
current.summary.surface_statistics.within_search?.triangle_normal_projection?.mean_mm
)
}}
mm。 </p
><div class="result-metrics"
><div
><span>全部保留点数</span
><strong>{{ current.summary?.statistics?.count?.toLocaleString() ?? '—' }}</strong></div
><div
><span>最短距离 RMS / mm</span
><strong>{{ number(current.summary?.statistics?.rms_mm) }}</strong></div
><div
><span>有测量值</span
><strong
>{{
resultLoadState === 'ready'
? resultRows.filter((r) => r.measured_mm != null).length
: '—'
}}
/ {{ resultLoadState === 'ready' ? resultRows.length : '—' }}</strong
></div
><div
><span>通过 / 超差</span
><strong
>{{
resultLoadState === 'ready'
? resultRows.filter((r) => ['通过', '合格'].includes(r.inspection_result)).length
: '—'
}}
/
{{
resultLoadState === 'ready'
? resultRows.filter((r) => ['失败', '不合格'].includes(r.inspection_result)).length
: '—'
}}</strong
></div
></div
>
<div v-if="hasReport" class="workspace-actions"
><ProcessedStlDownload
:record-id="recordId"
:disabled="!featureAvailable || busy || processing || cleanupDirty"
/>
<el-button type="primary" :loading="busy" @click="previewReport">预览报告</el-button
><el-button
:loading="busy"
:disabled="!hasReport"
@click="download('report_signed_chromatogram.pdf')"
>下载 PDF</el-button
><el-button :loading="busy" @click="download('result.zip')">下载结果包</el-button
><el-button :loading="busy" @click="download('worker.log')">处理日志</el-button
><el-button
v-hasPermi="['lab:data:upload', 'lab:document:update']"
type="primary"
:loading="busy"
:disabled="!canArchive"
@click="archiveResults"
>{{ archived ? '已归档' : '归档' }}</el-button
><el-button
v-if="archived"
v-hasPermi="['lab:document:publish']"
type="primary"
:loading="busy"
:disabled="!canConfirmDelivery"
@click="confirmDelivery"
>{{ delivered ? '已确认交付' : '确认交付' }}</el-button
></div
><div v-if="archiving" class="archive-progress" role="status"
><el-progress :percentage="Math.max(0, Math.min(100, archiveProgress.progress || 0))" />
<span>{{ archiveProgress.message || '正在准备处理后STL并归档成果,请稍候' }}</span></div
><el-empty
v-if="!hasReport"
:description="
processing ? '正在测量与生成报告,请稍候' : '报告尚未生成,可在计划核对后点击生成报告'
"
/><img
v-if="chromatogram"
:src="chromatogram"
class="workspace-spectrum"
alt="零件表面偏差色谱"
/>
<h4>检测项目结果</h4>
<el-alert
v-if="resultLoadState === 'error'"
:title="resultLoadError"
type="error"
:closable="false"
>
<el-button link type="primary" @click="loadFeatureResults">重新读取</el-button>
</el-alert>
<el-empty
v-else-if="resultLoadState !== 'ready'"
:description="resultLoadState === 'loading' ? '正在读取检测结果' : '任务完成后显示检测结果'"
/>
<el-table v-if="resultRows.length" :data="resultRows" border
><el-table-column
v-if="featureResults.length"
prop="result_source"
label="来源"
width="110"
/><el-table-column prop="name" label="检测项" min-width="200" /><el-table-column
prop="control"
label="控制"
/><el-table-column prop="nominal_mm" label="名义 / mm" /><el-table-column label="测量 / mm"
><template #default="s">{{ number(s.row.measured_mm) }}</template></el-table-column
><el-table-column label="偏差"
><template #default="s">{{ number(s.row.error_mm) }}</template></el-table-column
><el-table-column prop="tol_text" label="公差" /><el-table-column
v-if="featureResults.length"
prop="datum"
label="基准"
/><el-table-column prop="inspection_result" label="判定" /><el-table-column
label="状态说明"
min-width="210"
><template #default="s">{{ resultNote(s.row) }}</template></el-table-column
><el-table-column label="操作" width="100"
><template #default="s"
><el-button link type="primary" @click="focusResult(s.row)">{{
resultAction(s.row)
}}</el-button></template
></el-table-column
></el-table
>
</section>
<div
v-if="
!surfaceOnly &&
ready &&
panel !== 'features' &&
!(panel === 'results' && featureResults.length)
"
class="workspace-savebar"
><div
><strong>{{ dirty ? '有修改待保存' : '计划已同步' }}</strong
><span
>{{ rows.length }} 个检测项 ·
{{ panel === 'plan' ? '选择左侧检测项进行调整' : '可进入计划与选点核对测量位置' }}</span
></div
><div class="workspace-actions"
><el-button v-if="panel !== 'plan'" @click="switchPanel('plan')">计划与选点</el-button
><el-button
v-hasPermi="['lab:result:confirm']"
:disabled="!dirty || busy || !!pickSession"
@click="savePlan"
>保存计划</el-button
><el-button
v-hasPermi="['lab:result:confirm']"
type="primary"
:loading="busy"
:disabled="!!pickSession"
@click="generate"
>{{ dirty ? '保存并重新测量' : '重新测量 / 生成报告' }}</el-button
></div
></div
>
<el-dialog v-model="reportDialog" title="三维检测报告" width="90%" destroy-on-close
><iframe
v-if="reportHtml"
:srcdoc="reportHtml"
sandbox=""
referrerpolicy="no-referrer"
title="三维检测报告预览"
class="inspect-report-frame"
></iframe
><iframe
v-else-if="reportPdfUrl"
:src="reportPdfUrl"
title="PDF报告预览"
class="inspect-report-frame"
></iframe
><template #footer
><el-button :disabled="!hasReport" @click="download('report_signed_chromatogram.pdf')"
>下载 PDF</el-button
></template
></el-dialog
>
</div>
</template>
<script setup lang="ts">
import * as Api from '@/api/lab/inspection'
import * as DimensionApi from '@/api/lab/dimension'
import { prepareProcessedStl } from './stlDownload'
import {
snapshotResultRows,
type ResultLoadState,
useFeatureResults,
featureDisplayControls,
toleranceLabel,
resultNote as getResultNote,
resultAction
} from './featurePresentation'
import { ElMessage, ElMessageBox } from 'element-plus'
import { onBeforeRouteLeave, onBeforeRouteUpdate } from 'vue-router'
import InspectionViewer from './InspectionViewer.vue'
import InspectionCleanup from './InspectionCleanup.vue'
import ProcessedStlDownload from './ProcessedStlDownload.vue'
import InspectionFeatures from './InspectionFeatures.vue'
import { clone, applyHint, circleThrough, xyz, distance, type Vec3 } from './geometry'
import { userMessage, statusText } from './display'
import { inspectionCompletionLabel, pendingInspectionCount } from '@/utils/inspectionPresentation'
const props = defineProps<{ recordId: string }>()
const router = useRouter()
const emit = defineEmits<{ changed: []; history: [] }>()
const featureAvailable = ref(false)
const current = ref<any>({}),
inputs = ref<any>({}),
rows = ref<any[]>([]),
catalog = ref<any[]>([]),
visual = shallowRef<any>({}),
error = ref(''),
visualError = ref(''),
initialLoading = ref(true),
cloudLoading = ref(false),
busy = ref(false),
proposalsLoading = ref(false)
const panel = ref('model'),
selectedIndex = ref(0),
itemFilter = ref(''),
selectedTemplate = ref(''),
candidates = ref<any[][]>([]),
candidateChoice = ref<number>(),
reportDialog = ref(false),
reportHtml = ref(''),
reportPdfUrl = ref(''),
chromatogram = ref(''),
surfaceChartError = ref(''),
cleanupOpened = ref(panel.value === 'cleanup'),
cleanupDirty = ref(false)
const featureDirty = ref(false)
const archiving = ref(false),
archiveProgress = ref<any>({}),
delivery = ref<any>(),
deliveryRevision = ref<number>()
const featureFocus = ref('')
const resultNote = (row: any) => getResultNote(row, userMessage)
function focusResult(row: any) {
if (row.result_source === 'CAD 特征') {
featureFocus.value = row.next_action === 'recalculate' ? '' : row.control_id
switchPanel('features')
} else reviewRow(row)
}
const featureResults = ref<any[]>([])
const featurePlanPrimary = ref(false)
const resultLoadState = ref<ResultLoadState>('idle')
const resultLoadError = ref('')
let featureRequest = 0
const resultRows = computed(() =>
snapshotResultRows(
rows.value,
featureResults.value,
featurePlanPrimary.value,
resultLoadState.value
)
)
async function loadFeatureResults() {
if (surfaceOnly.value) return
const owner = ++featureRequest,
recordId = props.recordId
featureResults.value = []
featurePlanPrimary.value = false
resultLoadError.value = ''
resultLoadState.value = ready.value ? 'loading' : 'idle'
if (!ready.value) return
if (!featureAvailable.value) {
resultLoadState.value = 'ready'
return
}
try {
const { document: graph, capabilities } = await Api.get(recordId, 'feature-plan')
if (!active || owner !== featureRequest || recordId !== props.recordId) return
featurePlanPrimary.value =
graph.report_scope === 'feature_plan' &&
(!!graph.evaluation || graph.evaluation_state === 'stale')
if (!useFeatureResults(graph)) {
resultLoadState.value = 'ready'
return
}
const features = Object.fromEntries(graph.features.map((f: any) => [f.id, f]))
const frames = Object.fromEntries(graph.datum_systems.map((d: any) => [d.id, d]))
const labels = {
pass: '合格',
fail: '不合格',
capability_unverified: '待判定',
fit_unverified: '待复核',
measured: '已计算',
indeterminate: '待判定',
unsupported: '配置不支持',
not_measured: '测量失败',
stale: '待重算'
}
featureResults.value = featureDisplayControls(
graph,
!featurePlanPrimary.value && rows.value.length > 0
).map((c: any) => {
const t = c.tolerance,
frame = frames[c.datum_system_id]
return {
control_id: c.id,
feature_id: c.feature_id,
status: c.result?.status,
diagnostic: c.result?.diagnostic || features[c.feature_id]?.diagnostic,
measurement_state: c.measurement_state,
assessment_state: c.assessment_state,
reason_code: c.reason_code,
next_action: c.next_action,
workflow_note: c.workflow_note,
name: c.name || features[c.feature_id]?.name,
control: capabilities[c.kind]?.label || '其他控制',
nominal_mm: c.nominal,
measured_mm: c.result?.value,
error_mm: c.result?.error,
tol_text: toleranceLabel(t),
datum: frame
? frame.precedence
.map((group: string[]) => group.map((id) => features[id]?.datum_label).join('-'))
.join(' | ')
: '—',
inspection_result: labels[c.result?.status] || '待计算'
}
})
resultLoadState.value = 'ready'
} catch (e: any) {
if (!active || owner !== featureRequest || recordId !== props.recordId) return
resultLoadState.value = 'error'
resultLoadError.value = userMessage(e, '读取检测结果失败,请重试')
}
}
async function featureReported() {
await refresh()
switchPanel('results')
}
const viewer = ref<InstanceType<typeof InspectionViewer>>(),
importInput = ref<HTMLInputElement>(),
undoStack = ref<{ index: number; row: any }[]>([]),
pickSession = ref<{ mode: string; index: number; points: Vec3[] } | null>(null)
const baseline = ref('[]'),
dirty = computed(() => JSON.stringify(rows.value) !== baseline.value),
selectedRow = computed(() => rows.value[selectedIndex.value]),
ready = computed(() => current.value.status === 'done'),
processing = computed(() => ['created', 'processing'].includes(current.value.status)),
surfaceOnly = computed(() => current.value.surface_only === true),
surfaceReady = computed(
() => surfaceOnly.value && ready.value && current.value.surface_ready === true
),
aligned = computed(() => visual.value.coordinate_frame === 'target_mm' && ready.value),
isCircle = computed(
() =>
selectedRow.value?.table === 'feature' &&
['circle', 'hole', 'cylinder'].includes(selectedRow.value?.type || 'circle')
)
const measuredCount = computed(
() => rows.value.filter((r) => r.measured_mm != null || r.trial_measured_mm != null).length
),
filteredRows = computed(() =>
rows.value
.map((row, index) => ({ row, index }))
.filter((v) => !itemFilter.value || v.row.name?.includes(itemFilter.value))
),
hasReport = computed(
() =>
!surfaceOnly.value &&
current.value.report_ready !== false &&
['done', 'blocked'].includes(current.value.status)
),
statusType = computed(() =>
ready.value
? pendingInspectionCount(current.value) || current.value.measurement_complete === false
? 'warning'
: 'success'
: ['error', 'blocked'].includes(current.value.status)
? 'danger'
: 'info'
),
statusLabel = computed(() =>
processing.value
? '计算中'
: surfaceOnly.value
? surfaceReady.value
? '表面偏差图已生成'
: statusText(current.value.status)
: inspectionCompletionLabel(current.value) || statusText(current.value.status)
)
const archived = computed(
() =>
current.value.platform_job?.status === 'ARCHIVED' && !!current.value.platform_job?.delivery_id
)
const canArchive = computed(
() =>
ready.value &&
hasReport.value &&
!archived.value &&
!busy.value &&
!dirty.value &&
!cleanupDirty.value &&
!featureDirty.value &&
!current.value.engine_unavailable
)
const delivered = computed(() => delivery.value?.status === 'DELIVERED')
const canConfirmDelivery = computed(
() =>
archived.value &&
!!delivery.value?.current &&
deliveryRevision.value != null &&
!delivered.value &&
!busy.value &&
!dirty.value &&
!cleanupDirty.value &&
!featureDirty.value
)
async function loadDelivery() {
const job = current.value.platform_job
delivery.value = undefined
deliveryRevision.value = undefined
if (!archived.value || !job.task_id || !job.unit_id) return
const data = await DimensionApi.detail(job.task_id, job.unit_id)
if (!active || current.value.platform_job?.delivery_id !== job.delivery_id) return
delivery.value = data.deliveries.find((row: any) => String(row.id) === String(job.delivery_id))
deliveryRevision.value = data.case.revision
}
const bindingLabel = computed(
() =>
({
bound: '已绑定',
candidate: '设计候选',
incomplete: '绑定未完整',
needs_rebind: '需要重新绑定'
})[selectedRow.value?.geometry_hint?.binding_status] || '未绑定'
)
const pickLabel = computed(() =>
!pickSession.value
? ''
: pickSession.value.mode === 'circle'
? `选取同一截面圆周点 ${pickSession.value.points.length + 1} / 3`
: pickSession.value.mode === 'pair'
? `选择扫描端点 ${pickSession.value.points.length ? 'B' : 'A'}(点间距)`
: '选择近似位置'
)
const panels = [
{ id: 'cleanup', icon: 'ep:filter', title: '点云处理', text: '去噪 / 裁剪 / 主体' },
{ id: 'model', icon: 'ep:box', title: '三维查看', text: '数模 / 点云 / 对齐' },
{ id: 'features', icon: 'ep:aim', title: 'CAD 特征', text: '选面 / 基准 / 形位' },
{ id: 'plan', icon: 'ep:aim', title: '计划与选点', text: '定位 / 调整 / 重测' },
{ id: 'results', icon: 'ep:document-checked', title: '结果与报告', text: '色谱 / 测量 / 下载' }
]
const availablePanels = computed(() =>
surfaceOnly.value
? [
...panels.filter((item) => ['cleanup', 'model'].includes(item.id)),
{ id: 'results', icon: 'ep:document-checked', title: '表面偏差图', text: '查看 / 下载' }
]
: panels
)
let active = true,
timer: ReturnType<typeof setTimeout> | undefined,
visualRequest = 0,
proposalRequest = 0,
lastPlanRevision = '',
lastVisualRevision = '',
loadedSurfaceRevision = '',
surfaceChartRequest = 0,
expectReport = false
const number = (v: any) =>
v == null || v === '' ? '—' : Number.isFinite(Number(v)) ? Number(v).toFixed(3) : '—'
const pointText = (v: any) => (xyz(v) ? v.map((n) => n.toFixed(3)).join(' , ') : '—')
async function guard(fn: () => Promise<void>) {
if (busy.value) return
busy.value = true
error.value = ''
try {
await fn()
} catch (e: any) {
if (e !== 'cancel' && e !== 'close') {
error.value = userMessage(e)
ElMessage.error(error.value)
}
} finally {
busy.value = false
}
}
function acceptRows(value: any[]) {
rows.value = value
baseline.value = JSON.stringify(value)
selectedIndex.value = Math.min(selectedIndex.value, Math.max(0, value.length - 1))
undoStack.value = []
candidates.value = []
pickSession.value = null
candidateChoice.value = undefined
}
async function refresh() {
clearTimeout(timer)
try {
const result = await Api.state(props.recordId)
if (!active) return
current.value = result
await loadDelivery()
if (surfaceOnly.value && !availablePanels.value.some((item) => item.id === panel.value))
switchPanel(surfaceReady.value ? 'results' : 'model')
if (!surfaceReady.value && surfaceOnly.value) {
surfaceChartRequest++
if (chromatogram.value) URL.revokeObjectURL(chromatogram.value)
chromatogram.value = ''
loadedSurfaceRevision = ''
}
if (result.engine_unavailable) {
timer = setTimeout(refresh, 5000)
return
}
if (result.status === 'review' && panel.value === 'model') switchPanel('cleanup')
if (result.inputs) inputs.value = result.inputs
if (processing.value && !result.engine_unavailable) {
timer = setTimeout(refresh, 1800)
return
}
const rev = String(
result.surface_revision || result.report_revision || result.revision || 'initial'
)
if (
!surfaceOnly.value &&
ready.value &&
(lastPlanRevision !== rev || !rows.value.length) &&
!dirty.value
) {
const data = await Api.get(props.recordId, 'plan')
if (!active) return
acceptRows(data.rows || [])
lastPlanRevision = rev
}
if (panel.value === 'results') await loadFeatureResults()
if (
(ready.value || result.preview_available || result.status === 'review') &&
!result.engine_unavailable &&
(!surfaceOnly.value || panel.value === 'model') &&
lastVisualRevision !== `${result.status}:${rev}`
) {
await loadVisual()
lastVisualRevision = `${result.status}:${rev}`
}
if (surfaceReady.value) await loadSurfaceChart()
else if (hasReport.value && !chromatogram.value) {
try {
const image = await Api.artifact(props.recordId, 'chromatogram_signed.png')
if (active) chromatogram.value = URL.createObjectURL(image)
} catch {
/* A diagnostic report may not have a chromatogram. */
}
}
if (['ARCHIVE_PENDING', 'PROCESSING'].includes(result.platform_job?.status) && hasReport.value)
timer = setTimeout(refresh, 1800)
if (expectReport && !processing.value) {
expectReport = false
switchPanel('results')
if (!hasReport.value) error.value = result.auto_measure_error || '报告未生成,请查看处理日志'
}
} catch (e: any) {
if (active) error.value = e?.message || '读取检测状态失败'
} finally {
initialLoading.value = false
}
}
async function loadSurfaceChart() {
const revision = String(current.value.surface_revision || current.value.revision || '')
if (
!surfaceReady.value ||
current.value.engine_unavailable ||
(loadedSurfaceRevision === revision && chromatogram.value)
)
return
const owner = ++surfaceChartRequest,
id = props.recordId
if (chromatogram.value) URL.revokeObjectURL(chromatogram.value)
chromatogram.value = ''
surfaceChartError.value = ''
try {
const image = await Api.artifact(id, 'chromatogram_signed.png')
if (
!active ||
owner !== surfaceChartRequest ||
id !== props.recordId ||
!surfaceReady.value ||
revision !== String(current.value.surface_revision || current.value.revision || '')
)
return
chromatogram.value = URL.createObjectURL(image)
loadedSurfaceRevision = revision
} catch (e: any) {
if (active && owner === surfaceChartRequest && id === props.recordId)
surfaceChartError.value = userMessage(e, '读取表面偏差图失败')
}
}
async function reload() {
const health = await Api.health().catch(() => ({}))
featureAvailable.value =
!!health.feature_capabilities?.types && !!health.feature_capabilities?.controls
if (dirty.value) {
await guard(async () => {
await ElMessageBox.confirm('刷新计划将放弃未保存的修改,是否继续?', '刷新检测任务')
const data = await Api.get(props.recordId, 'plan')
acceptRows(data.rows || [])
lastPlanRevision = ''
lastVisualRevision = ''
await refresh()
})
} else {
lastPlanRevision = ''
lastVisualRevision = ''
await refresh()
}
}
async function loadVisual(force = false) {
if (cloudLoading.value && !force) return
const owner = ++visualRequest
cloudLoading.value = true
visualError.value = ''
try {
const data = await Api.get(props.recordId, ready.value ? 'plan-preview' : 'preview')
if (!active || owner !== visualRequest) return
visual.value = ready.value
? data
: {
points: data.points.filter((_: any, i: number) => data.retained[i]),
total: data.kept,
coordinate_frame: 'source_mm'
}
if (data.mesh_warning) visualError.value = '显示网格未加载,当前展示设计表面采样点。'
} catch (e: any) {
if (owner === visualRequest)
visualError.value = userMessage(e, '三维数据暂不可用,请稍后重新加载')
} finally {
if (owner === visualRequest) cloudLoading.value = false
}
}
function switchPanel(value: string) {
if (!availablePanels.value.some((item) => item.id === value)) return
if (featureDirty.value && value !== 'features') {
ElMessage.warning('请先保存 CAD 特征定义,再切换工作区')
return
}
if (value === 'features' && !featureAvailable.value) {
ElMessage.info('CAD 特征功能需要新版检测 EXE,请安装后重新打开工作区')
return
}
cancelPick()
panel.value = value
if (value === 'cleanup') cleanupOpened.value = true
if (value === 'results') void loadFeatureResults()
if (value === 'model' && surfaceOnly.value && ready.value && !visual.value.points)
void loadVisual()
if (value === 'plan' && !candidates.value.length && ready.value && !proposalsLoading.value)
void recommend()
nextTick(() => viewer.value?.fit())
}
function select(index: number, scroll = false) {
cancelPick()
selectedIndex.value = index
candidateChoice.value = undefined
if (scroll)
document
.querySelector('.workspace-visual')
?.scrollIntoView({ block: 'start', behavior: 'smooth' })
nextTick(() => viewer.value?.fit(true))
}
function reviewRow(row: any) {
switchPanel('plan')
const index = Number.isInteger(row.plan_index) ? row.plan_index : rows.value.indexOf(row)
if (index >= 0) select(index, true)
}
function remember() {
undoStack.value.push({ index: selectedIndex.value, row: clone(selectedRow.value) })
}
function undoBinding() {
if (pickSession.value) {
cancelPick()
return
}
const old = undoStack.value.pop()
if (old) {
rows.value[old.index] = old.row
selectedIndex.value = old.index
candidateChoice.value = undefined
ElMessage.success('已撤销绑定调整')
}
}
function invalidate(row: any) {
for (const key of ['measured_mm', 'trial_measured_mm', 'inspection_result']) row[key] = null
row.measurement_status = '待重测'
row.measurement_reason = '计划已修改,请保存并重新测量'
}
function invalidateSelected() {
invalidate(selectedRow.value)
candidates.value[selectedIndex.value] = []
}
function clearBinding() {
remember()
applyHint(selectedRow.value, {})
candidateChoice.value = undefined
}
async function recommend() {
if (!ready.value || proposalsLoading.value) return
const request = ++proposalRequest,
signature = JSON.stringify(rows.value)
proposalsLoading.value = true
try {
const data = await Api.post(props.recordId, 'binding-proposals', { rows: clone(rows.value) })
if (!active || request !== proposalRequest || signature !== JSON.stringify(rows.value)) return
candidates.value = data.candidates || []
} catch (e: any) {
ElMessage.warning(userMessage(e, '推荐暂不可用,可使用扫描点选修正'))
} finally {
if (request === proposalRequest) proposalsLoading.value = false
}
}
function chooseCandidate(index: number) {
const c = candidates.value[selectedIndex.value]?.[index]
if (!c) return
remember()
selectedRow.value.type = c.kind
if (selectedRow.value.table === 'gauge' && selectedRow.value.control === '点间距')
selectedRow.value.control = c.kind === 'hole_distance' ? '孔距' : '3D距离'
applyHint(selectedRow.value, {
...c.geometry_hint,
source: 'confirmed_cad',
binding_status: 'bound'
})
nextTick(() => viewer.value?.fit(true))
}
function beginPick(mode: string) {
if (!aligned.value) {
ElMessage.warning('请先加载已对齐点云')
return
}
pickSession.value = { mode, index: selectedIndex.value, points: [] }
}
function cancelPick() {
pickSession.value = null
}
function pickPoint(p: Vec3) {
const s = pickSession.value
if (!s || s.index !== selectedIndex.value) return
if (s.points.some((a) => distance(a, p) < 0.01)) {
ElMessage.warning('请选取不同且分散的扫描点')
return
}
const points = [...s.points, clone(p)]
if ((s.mode === 'circle' && points.length < 3) || (s.mode === 'pair' && points.length < 2)) {
s.points = points
return
}
try {
let hint: any = { source: 'pick_bind', coordinate_frame: 'target_mm', binding_status: 'bound' }
if (s.mode === 'circle') {
const c = circleThrough(points)
Object.assign(hint, {
measurement_kind: 'manual_circle_section',
approx_center_mm: c.center,
normal: c.normal,
radius_mm: c.radius,
seed_points: points
})
} else if (s.mode === 'pair')
Object.assign(hint, {
measurement_kind: 'point_distance',
point_a: points[0],
point_b: points[1]
})
else Object.assign(hint, { approx_center_mm: p })
remember()
if (s.mode === 'pair') {
selectedRow.value.type = 'point_distance'
selectedRow.value.control = '点间距'
}
applyHint(selectedRow.value, hint)
candidateChoice.value = undefined
cancelPick()
ElMessage.success('已更新绑定,可保存并重新测量;Esc 撤销本次修改')
} catch (e: any) {
ElMessage.warning(userMessage(e))
}
}
const savePlan = () =>
guard(async () => {
const result = await Api.post(props.recordId, 'plan', { rows: rows.value })
acceptRows(result.rows || [])
ElMessage.success('计划已保存')
})
const generate = () =>
guard(async () => {
current.value = await Api.post(props.recordId, 'generate-report', { rows: rows.value })
baseline.value = JSON.stringify(rows.value)
undoStack.value = []
release()
expectReport = true
lastPlanRevision = ''
lastVisualRevision = ''
await refresh()
})
const applyTemplate = () =>
guard(async () => {
await ElMessageBox.confirm('载入模板会替换当前检测计划,已归档报告仍保留。', '更换计划')
const result = await Api.post(props.recordId, 'plan/template', {
template_id: selectedTemplate.value
})
acceptRows(result.rows || [])
void recommend()
})
async function importPlan(e: Event) {
const input = e.target as HTMLInputElement,
file = input.files?.[0]
if (!file) return
await guard(async () => {
const result = await Api.post(props.recordId, 'plan/import', {
text: await file.text(),
filename: file.name,
save: true
})
acceptRows(result.rows || [])
void recommend()
})
input.value = ''
}
const compare = () =>
guard(async () => {
if (cleanupDirty.value) {
switchPanel('cleanup')
throw new Error('点云处理规则尚未应用,请先预览并确认当前规则')
}
current.value = await Api.post(props.recordId, 'compare', { revision: current.value.revision })
lastPlanRevision = ''
lastVisualRevision = ''
await refresh()
})
const cleaned = (result: any) =>
guard(async () => {
current.value = result
acceptRows([])
cleanupDirty.value = false
lastPlanRevision = ''
lastVisualRevision = ''
visual.value = {}
release()
current.value = await Api.post(props.recordId, 'compare', { revision: result.revision })
switchPanel(surfaceOnly.value ? 'results' : 'model')
await refresh()
})
function release() {
surfaceChartRequest++
loadedSurfaceRevision = ''
surfaceChartError.value = ''
if (chromatogram.value) URL.revokeObjectURL(chromatogram.value)
chromatogram.value = ''
reportHtml.value = ''
if (reportPdfUrl.value) URL.revokeObjectURL(reportPdfUrl.value)
reportPdfUrl.value = ''
}
const previewReport = () =>
guard(async () => {
if (reportPdfUrl.value) URL.revokeObjectURL(reportPdfUrl.value)
reportPdfUrl.value = ''
reportHtml.value = ''
try {
const blob = await Api.artifact(props.recordId, 'report_signed_chromatogram.html')
reportHtml.value = (await blob.text()).replace(/<nav[\s\S]*?<\/nav>/gi, '')
} catch {
const blob = await Api.artifact(props.recordId, 'report_signed_chromatogram.pdf')
reportPdfUrl.value = URL.createObjectURL(blob)
}
reportDialog.value = true
})
const download = (name: string) =>
guard(async () => Api.saveBlob(await Api.artifact(props.recordId, name), name))
function archiveResults() {
if (!canArchive.value) return
const recordId = props.recordId
return guard(async () => {
archiving.value = true
archiveProgress.value = {}
let result
try {
const prepared = await prepareProcessedStl(
{
state: () => Api.state(recordId),
start: (revision) => Api.post(recordId, 'cleanup', { operation: 'export_stl', revision })
},
(progress) => {
archiveProgress.value = progress
},
() => active && props.recordId === recordId
)
if (!prepared || !active || props.recordId !== recordId) return
archiveProgress.value = { progress: 100, message: 'STL已准备完成,正在成套归档STL与PDF' }
result = await Api.sync(recordId)
} finally {
archiving.value = false
}
if (!active || props.recordId !== recordId) return
current.value = result
emit('changed')
if (archived.value) {
await loadDelivery()
ElMessage.success('STL与PDF已成套归档,可点击“确认交付”')
} else {
error.value =
result.platform_job?.last_error ||
'成果尚未归档,请确认当前版本的处理后STL与PDF已生成,再重试归档'
ElMessage.warning(error.value)
}
})
}
function confirmDelivery() {
if (!canConfirmDelivery.value) return
const recordId = props.recordId
return guard(async () => {
await loadDelivery()
if (!active || props.recordId !== recordId) return
if (!delivery.value?.current || deliveryRevision.value == null)
throw Error('成果或输入版本已变化,请刷新后核对当前成果')
if (delivered.value) return
const deliveryId = delivery.value.id,
revision = deliveryRevision.value
await ElMessageBox.confirm(
'已核对当前样件、输入版本、比对STL和PDF报告一致,确认交付此成果版本?',
'确认交付'
)
if (!active || props.recordId !== recordId) return
await DimensionApi.confirm({ deliveryId, revision, filesConfirmed: true })
if (!active || props.recordId !== recordId) return
emit('changed')
await loadDelivery()
ElMessage.success('已确认交付')
})
}
function escape(e: KeyboardEvent) {
if (e.key !== 'Escape' || reportDialog.value || panel.value === 'cleanup') return
if (pickSession.value) {
cancelPick()
e.preventDefault()
} else if (!(e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement)) {
undoBinding()
}
}
function beforeUnload(e: BeforeUnloadEvent) {
if (dirty.value || cleanupDirty.value || featureDirty.value) {
e.preventDefault()
e.returnValue = ''
}
}
async function confirmLeave() {
if (!dirty.value && !cleanupDirty.value && !featureDirty.value && !pickSession.value) return true
try {
await ElMessageBox.confirm('当前计划有未保存修改,离开将丢失这些修改。', '离开检测工作区', {
confirmButtonText: '放弃修改并离开',
cancelButtonText: '继续编辑'
})
return true
} catch {
return false
}
}
defineExpose({ confirmLeave })
watch(
() => [
current.value.status,
current.value.report_revision,
current.value.surface_revision,
current.value.surface_ready
],
() => emit('changed')
)
onBeforeRouteLeave(confirmLeave)
onBeforeRouteUpdate((to, from) => (to.params.id !== from.params.id ? confirmLeave() : true))
onMounted(async () => {
if (!panels.some((p) => p.id === panel.value)) panel.value = 'model'
window.addEventListener('keydown', escape)
window.addEventListener('beforeunload', beforeUnload)
try {
const [record, templates] = await Promise.all([
Api.record(props.recordId),
Api.templates().catch(() => ({ templates: [] }))
])
const health = await Api.health().catch(() => ({}))
featureAvailable.value =
!!health.feature_capabilities?.types && !!health.feature_capabilities?.controls
inputs.value = record.inputs || {}
current.value = record
catalog.value = templates.templates || []
await refresh()
if (panel.value === 'plan' && ready.value) void recommend()
} catch (e: any) {
error.value = userMessage(e, '读取任务失败')
initialLoading.value = false
}
})
onBeforeUnmount(() => {
active = false
featureRequest++
clearTimeout(timer)
visualRequest++
proposalRequest++
release()
window.removeEventListener('keydown', escape)
window.removeEventListener('beforeunload', beforeUnload)
})
</script>
<style scoped>
.inspection-workspace {
padding-bottom: 84px;
}
.binding-quickbar {
display: flex;
padding: 10px 14px;
margin-bottom: 14px;
background: var(--el-color-primary-light-9);
border-radius: 8px;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.binding-quickbar strong {
margin-right: auto;
font-size: 13px;
}
.binding-quickbar span {
font-size: 11px;
color: var(--el-text-color-secondary);
}
.inspection-workspace .el-alert {
margin: 12px 0;
}
.task-heading {
display: flex;
align-items: center;
gap: 14px;
}
.task-heading > div {
flex: 1;
min-width: 0;
}
.task-heading h2 {
margin: 8px 0;
font-size: 20px;
}
.task-files {
display: flex;
margin: 20px 0;
font-size: 12px;
color: var(--el-text-color-secondary);
gap: 24px;
flex-wrap: wrap;
}
.task-files > span {
display: flex;
align-items: center;
gap: 7px;
min-width: 0;
overflow-wrap: anywhere;
}
.workspace-nav {
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 14px;
margin-top: 24px;
}
.workspace-nav.is-surface {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.workspace-nav button {
display: flex;
padding: 17px;
color: var(--el-text-color-secondary);
text-align: left;
cursor: pointer;
background: var(--el-fill-color-lighter);
border: 1px solid var(--el-border-color-light);
border-radius: 10px;
align-items: center;
gap: 13px;
}
.workspace-nav button.active {
color: var(--el-color-primary);
background: var(--el-color-primary-light-9);
border-color: var(--el-color-primary);
}
.workspace-nav strong,
.workspace-nav small {
display: block;
}
.workspace-nav strong {
margin-bottom: 5px;
font-size: 14px;
}
.workspace-nav small {
font-size: 11px;
font-weight: 400;
}
.workspace-section-heading {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
margin-bottom: 18px;
}
.workspace-section-heading h3 {
margin: 0 0 7px;
font-size: 16px;
}
.workspace-section-heading p {
margin: 0;
font-size: 12px;
line-height: 1.7;
color: var(--el-text-color-secondary);
}
.workspace-actions {
display: flex;
align-items: center;
gap: 9px;
flex-wrap: wrap;
}
.workspace-actions .el-button + .el-button {
margin-left: 0;
}
.binding-layout {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 16px;
}
.binding-layout.is-plan {
grid-template-columns: 235px minmax(0, 1fr);
}
.binding-list {
min-width: 0;
padding: 12px;
border: 1px solid var(--el-border-color-lighter);
border-radius: 10px;
}
.binding-count {
padding: 12px 0;
font-size: 11px;
color: var(--el-text-color-secondary);
}
.binding-scroll {
max-height: 500px;
overflow-y: auto;
}
.binding-list-item {
display: block;
width: 100%;
padding: 12px 10px;
margin-bottom: 7px;
color: var(--el-text-color-primary);
text-align: left;
cursor: pointer;
background: var(--el-bg-color);
border: 1px solid var(--el-border-color-lighter);
border-radius: 7px;
}
.binding-list-item.selected {
background: var(--el-color-primary-light-9);
border-color: var(--el-color-primary);
}
.binding-list-item strong {
display: block;
font-size: 12px;
line-height: 1.6;
}
.binding-list-item small {
display: block;
margin: 5px 0 10px;
font-size: 11px;
color: var(--el-text-color-secondary);
}
.binding-list-item span {
display: block;
font-size: 13px;
}
.binding-list-item i {
font-size: 11px;
font-style: normal;
}
.binding-list-item em {
float: right;
font-size: 11px;
font-style: normal;
color: var(--el-text-color-secondary);
}
.binding-view {
min-width: 0;
}
.viewer-sampling {
margin-top: 9px;
font-size: 11px;
}
.model-summary,
.result-metrics {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
margin-top: 24px;
}
.model-summary > div,
.result-metrics > div {
padding: 17px 20px;
background: var(--el-fill-color-lighter);
border-radius: 9px;
}
.model-summary span,
.result-metrics span {
display: block;
margin-bottom: 12px;
font-size: 12px;
color: var(--el-text-color-secondary);
}
.model-summary strong,
.result-metrics strong {
display: block;
font-size: 21px;
font-weight: 600;
}
.model-summary small {
display: block;
margin-top: 9px;
font-size: 11px;
color: var(--el-text-color-secondary);
}
.model-summary strong small {
display: inline;
font-size: 12px;
font-weight: 400;
}
.binding-editor {
padding-top: 22px;
margin-top: 24px;
border-top: 1px solid var(--el-border-color-lighter);
}
.binding-editor-grid {
display: grid;
grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
gap: 30px;
}
.binding-method {
display: flex;
margin-bottom: 10px;
font-size: 13px;
align-items: center;
justify-content: space-between;
}
.binding-help {
margin: 10px 0;
font-size: 12px;
line-height: 1.8;
color: var(--el-text-color-secondary);
}
.binding-values {
display: flex;
gap: 35px;
font-size: 12px;
color: var(--el-text-color-secondary);
}
.binding-values strong {
display: block;
margin: 8px 0 16px;
font-size: 17px;
color: var(--el-text-color-primary);
}
.binding-coordinates {
display: grid;
grid-template-columns: 70px 1fr;
gap: 9px;
font-size: 12px;
color: var(--el-text-color-secondary);
}
.binding-coordinates code {
overflow-wrap: anywhere;
font-size: 11px;
}
.binding-editor .workspace-actions {
margin: 15px 0;
}
.workspace-savebar {
position: sticky;
bottom: 12px;
z-index: 8;
display: flex;
padding: 15px 22px;
background: var(--el-bg-color);
border: 1px solid var(--el-border-color-light);
border-radius: 10px;
box-shadow: 0 5px 28px #132d4314;
justify-content: space-between;
gap: 16px;
align-items: center;
}
.workspace-savebar strong {
display: block;
margin-bottom: 6px;
font-size: 13px;
}
.workspace-savebar span {
font-size: 12px;
color: var(--el-text-color-secondary);
}
.workspace-spectrum {
display: block;
max-width: 100%;
max-height: 650px;
margin: 24px auto;
object-fit: contain;
}
.results-panel > .workspace-actions {
margin: 22px 0;
}
.archive-progress {
max-width: 560px;
margin: 16px 0;
color: var(--el-text-color-secondary);
}
.workspace-empty {
padding: 25px;
color: var(--el-text-color-secondary);
text-align: center;
}
.workspace-dirty,
.visual-error {
padding: 10px 14px;
margin-bottom: 15px;
font-size: 12px;
line-height: 1.7;
color: var(--el-color-warning-dark-2);
background: var(--el-color-warning-light-9);
border-radius: 6px;
}
.workspace-bottom {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20px;
font-size: 12px;
color: var(--el-text-color-secondary);
}
.cleanup-box {
padding-top: 15px;
font-size: 12px;
color: var(--el-text-color-secondary);
}
.cleanup-box > div {
display: flex;
align-items: center;
gap: 10px;
margin: 12px 0;
}
.cleanup-box .el-input-number {
width: 190px;
}
.plan-table-panel :deep(.is-selected-row td) {
background: var(--el-color-primary-light-9);
}
@media (width <= 1050px) {
.binding-layout.is-plan {
grid-template-columns: 190px minmax(0, 1fr);
}
.workspace-section-heading {
align-items: flex-start;
flex-wrap: wrap;
}
.binding-editor-grid {
gap: 18px;
}
.model-summary,
.result-metrics {
grid-template-columns: repeat(2, 1fr);
}
}
@media (width <= 720px) {
.binding-layout.is-plan,
.binding-editor-grid {
grid-template-columns: minmax(0, 1fr);
}
.binding-scroll {
max-height: 210px;
}
.workspace-nav {
gap: 6px;
}
.workspace-nav button {
padding: 12px 8px;
gap: 6px;
}
.workspace-nav small {
display: none;
}
.workspace-savebar {
flex-wrap: wrap;
}
.task-heading {
flex-wrap: wrap;
}
.model-summary {
gap: 8px;
}
.model-summary > div {
padding: 12px;
}
.task-overview {
padding: 16px;
}
}
</style>