feat(inspection): add archive action after processing log

This commit is contained in:
Codex 2026-11-26 15:42:41 +08:00
parent e60419bd3b
commit 877793f0e9

View File

@ -503,7 +503,15 @@
@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></div
><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
></div
><el-empty
v-if="!hasReport"
:description="
@ -810,6 +818,20 @@ const measuredCount = computed(
: 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 bindingLabel = computed(
() =>
({
@ -1259,6 +1281,24 @@ const previewReport = () =>
})
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 () => {
const result = await Api.sync(recordId)
if (!active || props.recordId !== recordId) return
current.value = result
emit('changed')
if (archived.value) {
ElMessage.success('STL与PDF已成套归档,可在任务成果中查看')
} else {
error.value =
result.platform_job?.last_error ||
'成果尚未归档,请确认当前版本的处理后STL与PDF已生成,再重试归档'
ElMessage.warning(error.value)
}
})
}
function escape(e: KeyboardEvent) {
if (e.key !== 'Escape' || reportDialog.value || panel.value === 'cleanup') return
if (pickSession.value) {