Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00635740f1 | ||
|
|
76316fad7a | ||
|
|
d4617b4988 |
No files matched your search
@@ -42,7 +42,7 @@ describe('protocol-source-attachment', () => {
|
||||
})
|
||||
assert.deepEqual(
|
||||
groups.map((g) => g.label),
|
||||
['协议附件', '知情同意书', '孕妇健康调查表']
|
||||
['知情同意书', '孕妇健康调查表', '协议附件']
|
||||
)
|
||||
assert.ok(groups.every((g) => g.files.length === 1))
|
||||
})
|
||||
|
||||
@@ -37,13 +37,17 @@ export function getConsentProtocolAttachment(
|
||||
|
||||
/**
|
||||
* 样本接收弹窗:按来源返回质检需查看的协议附件分组。
|
||||
* 细胞存储:协议附件 / 知情同意书 / 孕妇健康调查表
|
||||
* 细胞存储:知情同意书 / 孕妇健康调查表 / 协议附件(评论优先前两项)
|
||||
* 科研捐赠:知情同意书 / 传染病检测报告 / 其他附件
|
||||
* 兼容 attachments 别名(协议详情字段名)。
|
||||
*/
|
||||
export function getSourceProtocolAttachmentGroups(
|
||||
row: Record<string, unknown>
|
||||
): ProtocolSourceAttachmentMeta[] {
|
||||
const source = String(row.sourceType || 'cell_storage').trim()
|
||||
const protocolFiles = normalizeAttachmentFiles(
|
||||
row.protocolAttachmentFiles ?? row.attachments
|
||||
)
|
||||
if (source === 'research_donation') {
|
||||
return [
|
||||
{
|
||||
@@ -56,15 +60,11 @@ export function getSourceProtocolAttachmentGroups(
|
||||
},
|
||||
{
|
||||
label: '其他附件',
|
||||
files: normalizeAttachmentFiles(row.attachmentFiles)
|
||||
files: normalizeAttachmentFiles(row.attachmentFiles ?? row.otherAttachmentFiles)
|
||||
}
|
||||
]
|
||||
}
|
||||
return [
|
||||
{
|
||||
label: '协议附件',
|
||||
files: normalizeAttachmentFiles(row.protocolAttachmentFiles)
|
||||
},
|
||||
{
|
||||
label: '知情同意书',
|
||||
files: normalizeAttachmentFiles(row.consentAttachmentFiles)
|
||||
@@ -72,6 +72,10 @@ export function getSourceProtocolAttachmentGroups(
|
||||
{
|
||||
label: '孕妇健康调查表',
|
||||
files: normalizeAttachmentFiles(row.healthSurveyAttachmentFiles)
|
||||
},
|
||||
{
|
||||
label: '协议附件',
|
||||
files: protocolFiles
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Document, Download, VideoPlay } from '@element-plus/icons-vue'
|
||||
import { attachmentFullUrl } from '@/composables/useAttachmentActions'
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
@@ -58,14 +59,8 @@
|
||||
(e: 'download', file: Record<string, any>): void
|
||||
}>()
|
||||
|
||||
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
|
||||
|
||||
function resolveFileUrl(suffix: string) {
|
||||
if (!suffix) return ''
|
||||
if (suffix.startsWith('http://') || suffix.startsWith('https://') || suffix.startsWith('/')) {
|
||||
return suffix
|
||||
}
|
||||
return `${minioBaseUrl}/${suffix}`
|
||||
return attachmentFullUrl(suffix)
|
||||
}
|
||||
|
||||
function isImageFile(file: { fileType?: string; fileName?: string; fileUrl?: string }) {
|
||||
|
||||
@@ -253,8 +253,9 @@
|
||||
class="sample-protocol-attachments__item"
|
||||
>
|
||||
<div class="data-label">{{ group.label }}</div>
|
||||
<ProtocolAttachmentReadonly
|
||||
<ProtocolAttachmentMiniReadonly
|
||||
:files="group.files"
|
||||
empty-text="暂无附件"
|
||||
@preview="handleAttachmentPreview"
|
||||
@download="handleAttachmentDownload"
|
||||
/>
|
||||
@@ -743,6 +744,7 @@
|
||||
import SampleCodeWithSpecialDisplay from '@/components/business/sample-code-with-special-display/index.vue'
|
||||
import ProtocolFinanceConfirmFields from '@/components/business/protocol-finance-confirm-fields/index.vue'
|
||||
import ProtocolAttachmentReadonly from '@/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue'
|
||||
import ProtocolAttachmentMiniReadonly from '@/components/business/protocol-attachment-mini-readonly/index.vue'
|
||||
import SampleReceptionCardList from './SampleReceptionCardList.vue'
|
||||
import SampleReceptionDualReadonlyPanel from '@/components/business/sample-reception-dual-readonly-panel/index.vue'
|
||||
import {
|
||||
@@ -980,7 +982,7 @@
|
||||
const receiveProtocolAttachmentGroups = computed(() => {
|
||||
const row = currentRow.value
|
||||
if (!row) return []
|
||||
return getSourceProtocolAttachmentGroups(row)
|
||||
return getSourceProtocolAttachmentGroups(row as Record<string, unknown>)
|
||||
})
|
||||
|
||||
function formatMetric(v: unknown) {
|
||||
@@ -1513,6 +1515,8 @@
|
||||
let detail: Record<string, unknown> = row
|
||||
try {
|
||||
detail = (await fetchSampleReceptionDetail(receptionId)) as Record<string, unknown>
|
||||
// 详情可能带更完整的协议附件字段,合并后供弹窗右侧展示
|
||||
currentRow.value = { ...row, ...detail }
|
||||
} catch {
|
||||
/* 列表行已含主要字段,详情失败时回退 */
|
||||
}
|
||||
@@ -1698,6 +1702,7 @@
|
||||
border-radius: 8px;
|
||||
padding: 12px 14px;
|
||||
border: 1px solid #a7f3d0;
|
||||
min-height: 72px;
|
||||
}
|
||||
|
||||
.sample-protocol-attachments__list {
|
||||
@@ -1707,8 +1712,16 @@
|
||||
}
|
||||
|
||||
.sample-protocol-attachments__item {
|
||||
min-width: 0;
|
||||
|
||||
.data-label {
|
||||
margin-bottom: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
}
|
||||
|
||||
:deep(.protocol-attachment-mini) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user