feat(web-admin): print relatedApproval as recursive multi-line blocks

PDF export fetches summaries and renders up to three nested levels with
dedupe, instead of dumping raw instance ids.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-07-22 23:04:06 +08:00
1 parent cba3b0cccd
commit 600adfb6d8
3 files changed
+113 -9

No files matched your search

@@ -39,7 +39,10 @@
<tr v-for="(row, idx) in model.rows" :key="`r-${idx}`">
<th>{{ row.label }}</th>
<td>
<template v-if="row.urls?.length">
<template v-if="row.blocks?.length">
<OaPrintRelatedTree :blocks="row.blocks" />
</template>
<template v-else-if="row.urls?.length">
<div v-for="(u, ui) in row.urls" :key="ui" class="oa-print-url">{{ u }}</div>
</template>
<template v-else>
@@ -78,6 +81,7 @@
<script setup lang="ts">
import type { OaPrintModel } from '@/utils/oa-approval-print'
import OaPrintRelatedTree from '@/components/oa-approval/OaPrintRelatedTree.vue'
defineOptions({ name: 'OaApprovalPrintSheet' })
@@ -0,0 +1,67 @@
<!-- 关联审批单打印树(递归,最多 3 层由组装器保证) -->
<template>
<div class="oa-print-related">
<div
v-for="(b, bi) in blocks"
:key="`blk-${b.indexLabel}-${bi}`"
class="oa-print-related__block"
>
<div class="oa-print-related__title">{{ b.indexLabel }}. {{ b.title }}</div>
<div
v-for="(line, li) in b.lines || []"
:key="`ln-${bi}-${li}`"
class="oa-print-related__line"
>
<span class="oa-print-related__k">{{ line.label }}</span>
<span class="oa-print-related__v">{{ line.value }}</span>
</div>
<div v-if="b.children?.length" class="oa-print-related__children">
<OaPrintRelatedTree :blocks="b.children" />
</div>
</div>
</div>
</template>
<script setup lang="ts">
import type { RelatedPrintBlock } from '@/utils/oa-approval-print-related'
defineOptions({ name: 'OaPrintRelatedTree' })
defineProps<{
blocks: RelatedPrintBlock[]
}>()
</script>
<style scoped lang="scss">
.oa-print-related__block {
margin: 0 0 8px;
}
.oa-print-related__title {
margin-bottom: 2px;
font-weight: 600;
}
.oa-print-related__line {
display: flex;
gap: 8px;
font-size: 12px;
line-height: 1.5;
}
.oa-print-related__k {
flex: 0 0 auto;
color: #64748b;
}
.oa-print-related__v {
color: #334155;
word-break: break-all;
}
.oa-print-related__children {
margin: 4px 0 0 14px;
padding-left: 8px;
border-left: 2px solid #cbd5e1;
}
</style>