提交
This commit is contained in:
1 parent
246ad2228e
commit
8e2dd8b9f0
186 files changed
+38821
-2571
No files matched your search
@@ -0,0 +1,865 @@
|
||||
<!-- 采集协议单 — 只读查看(字段与新增/编辑弹窗一致) -->
|
||||
<template>
|
||||
<el-dialog
|
||||
:model-value="modelValue"
|
||||
:title="dialogTitle"
|
||||
width="1600px"
|
||||
class="dialog-form-layout protocol-view-dialog"
|
||||
align-center
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
@update:model-value="emit('update:modelValue', $event)"
|
||||
@closed="handleClosed"
|
||||
>
|
||||
<div v-loading="loading" class="protocol-view-body">
|
||||
<div class="detail-tabs">
|
||||
<div
|
||||
v-for="tab in formTabs"
|
||||
:key="tab.key"
|
||||
class="detail-tab"
|
||||
:class="{ active: activeTab === tab.key }"
|
||||
@click="scrollToSection(tab.key)"
|
||||
>
|
||||
{{ tab.label }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="bundle">
|
||||
<!-- 基本信息 -->
|
||||
<div id="view-section-basic" class="form-tab-pane">
|
||||
<dl class="view-kv-grid view-kv-grid--5">
|
||||
<div class="view-kv">
|
||||
<dt>协议号</dt>
|
||||
<dd>{{ dash(protocol?.protocolNo) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>协议状态</dt>
|
||||
<dd>{{ protocolStatusLabel(String(protocol?.protocolStatus || '')) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>登记日期</dt>
|
||||
<dd>{{ formatYmd(protocol?.registerDate) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>采集专员</dt>
|
||||
<dd>{{ collectorDisplay }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>创建时间</dt>
|
||||
<dd>{{ dash(protocol?.createTime) }}</dd>
|
||||
</div>
|
||||
<div class="view-field-block view-kv-span-2">
|
||||
<div class="view-field-block__label">协议附件</div>
|
||||
<ProtocolAttachmentReadonly
|
||||
:files="protocolAttachments"
|
||||
@preview="openPreview"
|
||||
@download="downloadFile"
|
||||
/>
|
||||
</div>
|
||||
<div class="view-kv view-kv-span-2">
|
||||
<dt>备注</dt>
|
||||
<dd>{{ dash(protocol?.remark) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<!-- 客户信息 -->
|
||||
<div id="view-section-party" class="form-tab-pane">
|
||||
<h3 class="detail-section-title">母亲信息</h3>
|
||||
<dl class="view-kv-grid view-kv-grid--5">
|
||||
<div class="view-kv">
|
||||
<dt>关联客户</dt>
|
||||
<dd>{{ partyCustomer?.customerId ? dash(partyCustomer?.motherName) : '—' }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>母亲姓名</dt>
|
||||
<dd>{{ dash(partyCustomer?.motherName) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>母亲联系电话</dt>
|
||||
<dd>{{ dash(partyCustomer?.motherPhone) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>母亲身份证号</dt>
|
||||
<dd>{{ dash(partyCustomer?.motherIdCard) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>母亲出生年月</dt>
|
||||
<dd>{{ formatYm(partyCustomer?.motherBirthYm) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>母亲民族</dt>
|
||||
<dd>{{ dash(partyCustomer?.motherEthnic) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv view-kv-span-2">
|
||||
<dt>母亲家庭住址</dt>
|
||||
<dd>{{ dash(partyCustomer?.motherAddress) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div class="form-section-divider" />
|
||||
<h3 class="detail-section-title">父亲信息</h3>
|
||||
<dl class="view-kv-grid view-kv-grid--5">
|
||||
<div class="view-kv">
|
||||
<dt>父亲姓名</dt>
|
||||
<dd>{{ dash(partyCustomer?.fatherName) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>父亲电话</dt>
|
||||
<dd>{{ dash(partyCustomer?.fatherPhone) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>父亲身份证号</dt>
|
||||
<dd>{{ dash(partyCustomer?.fatherIdCard) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div class="form-section-divider" />
|
||||
<h3 class="detail-section-title">新生儿信息</h3>
|
||||
<dl class="view-kv-grid view-kv-grid--5">
|
||||
<div class="view-kv">
|
||||
<dt>新生儿姓名</dt>
|
||||
<dd>{{ dash(partyCustomer?.newbornName) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>新生儿身份证</dt>
|
||||
<dd>{{ dash(partyCustomer?.newbornIdCard) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>新生儿分娩时间</dt>
|
||||
<dd>{{ dash(partyCustomer?.newbornDeliveryTime) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>新生儿性别</dt>
|
||||
<dd>{{ newbornSexLabel(String(partyCustomer?.newbornSex || '')) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>分娩方式</dt>
|
||||
<dd>{{ deliveryModeLabel(String(partyCustomer?.deliveryMode || '')) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>胎次</dt>
|
||||
<dd>{{ dash(partyCustomer?.birthOrder) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>新生儿体重(克)</dt>
|
||||
<dd>{{ dash(partyCustomer?.newbornWeightGram) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>新生儿评分1分钟</dt>
|
||||
<dd>{{ dash(partyCustomer?.apgar1min) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>新生儿评分5分钟</dt>
|
||||
<dd>{{ dash(partyCustomer?.apgar5min) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<!-- 采集信息 -->
|
||||
<div id="view-section-collection" class="form-tab-pane">
|
||||
<dl class="view-kv-grid view-kv-grid--5">
|
||||
<div class="view-kv">
|
||||
<dt>采集地区</dt>
|
||||
<dd>{{ regionDisplay }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>采集医院</dt>
|
||||
<dd>{{ hospitalDisplay }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>采集医护</dt>
|
||||
<dd>{{ dash(collectionInfo?.medicalStaff) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>销售人员</dt>
|
||||
<dd>{{ salesDisplay }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>样本采集时间</dt>
|
||||
<dd>{{ dash(collectionInfo?.sampleCollectTime) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>母血采集时间</dt>
|
||||
<dd>{{ dash(collectionInfo?.maternalBloodCollectTime) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<!-- 样本及运输 -->
|
||||
<div id="view-section-sample" class="form-tab-pane">
|
||||
<el-table :data="samples" row-key="id" stripe border size="small" class="sub-view-table">
|
||||
<el-table-column label="样本类型" min-width="140">
|
||||
<template #default="{ row }">{{ sampleTypeName(row.sampleTypeId) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sampleCode" label="样本编码" min-width="140" />
|
||||
<el-table-column prop="collectAmount" label="采集量" width="100" align="center" />
|
||||
<el-table-column label="单位" width="100" align="center">
|
||||
<template #default="{ row }">{{ unitName(row.unitId) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="price" label="价格" width="100" align="center" />
|
||||
<el-table-column prop="storageYears" label="存储年限(年)" width="120" align="center" />
|
||||
<el-table-column label="样本状态" width="100" align="center">
|
||||
<template #default="{ row }">{{
|
||||
sampleStatusLabel(String(row.sampleStatus || ''))
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="运输类型" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ transportTypeLabel(String(row.transport?.transportType || '')) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="目的站点" min-width="110" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ siteName(String(row.transport?.destSiteId || '')) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="预计到达" min-width="150" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ dash(row.transport?.etaTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="快递/携带" min-width="160" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ sampleTransportExtra(row.transport) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注" min-width="120" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<el-empty v-if="!samples.length" description="暂无样本" :image-size="48" />
|
||||
</div>
|
||||
|
||||
<!-- 缴费信息 -->
|
||||
<div id="view-section-payment" class="form-tab-pane">
|
||||
<h3 class="detail-section-title">缴费主表</h3>
|
||||
<dl class="view-kv-grid view-kv-grid--5">
|
||||
<div class="view-kv">
|
||||
<dt>缴费模式</dt>
|
||||
<dd>{{ payModeLabel(String(payment?.payMode || '')) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>合同金额</dt>
|
||||
<dd>{{ dash(payment?.contractAmount) }}</dd>
|
||||
</div>
|
||||
<template v-if="payment?.payMode === 'dj'">
|
||||
<div class="view-kv">
|
||||
<dt>趸交截止时间</dt>
|
||||
<dd>{{ formatYmd(payment?.lumpSumDeadline) }}</dd>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="payment?.payMode === 'fq'">
|
||||
<div class="view-kv">
|
||||
<dt>分期期数</dt>
|
||||
<dd>{{ dash(payment?.installmentCount) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>每期间隔(月)</dt>
|
||||
<dd>{{ dash(payment?.installmentIntervalMonths) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>分期开始时间</dt>
|
||||
<dd>{{ formatYmd(payment?.installmentStartDate) }}</dd>
|
||||
</div>
|
||||
</template>
|
||||
</dl>
|
||||
|
||||
<div class="form-section-divider" />
|
||||
<h3 class="detail-section-title">缴费明细</h3>
|
||||
<div v-if="paymentDetails.length" class="payment-detail-cards">
|
||||
<div
|
||||
v-for="(detail, dIdx) in paymentDetails"
|
||||
:key="detail.id || dIdx"
|
||||
class="payment-detail-card"
|
||||
>
|
||||
<div class="payment-detail-card__header">
|
||||
<span class="payment-detail-card__title">缴费明细 #{{ dIdx + 1 }}</span>
|
||||
</div>
|
||||
<div class="payment-detail-card__body">
|
||||
<dl class="view-kv-grid view-kv-grid--4">
|
||||
<div class="view-kv">
|
||||
<dt>应缴费金额</dt>
|
||||
<dd>{{ dash(detail.dueAmount) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>转账方式</dt>
|
||||
<dd>{{ transferTypeLabel(String(detail.transferType || '')) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>转账金额</dt>
|
||||
<dd>{{ dash(detail.transferAmount) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>转账时间</dt>
|
||||
<dd>{{ dash(detail.transferTime) }}</dd>
|
||||
</div>
|
||||
<div class="view-kv">
|
||||
<dt>缴费状态</dt>
|
||||
<dd>{{ payStatusLabel(String(detail.payStatus || '')) }}</dd>
|
||||
</div>
|
||||
<div v-if="payment?.payMode === 'fq'" class="view-kv">
|
||||
<dt>应缴费时间</dt>
|
||||
<dd>{{ formatYmd(detail.installmentDueDate) }}</dd>
|
||||
</div>
|
||||
<div v-if="payment?.payMode === 'fq'" class="view-kv">
|
||||
<dt>分期期序号</dt>
|
||||
<dd>{{ dash(detail.installmentNo) }}</dd>
|
||||
</div>
|
||||
<div class="view-field-block view-kv-span-2 payment-detail-card__attachments">
|
||||
<div class="view-field-block__label">转账凭证</div>
|
||||
<ProtocolAttachmentReadonly
|
||||
:files="detailAttachments(detail)"
|
||||
@preview="openPreview"
|
||||
@download="downloadFile"
|
||||
/>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-empty v-else description="暂无缴费明细" :image-size="48" />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button class="btn-ghost" @click="emit('update:modelValue', false)">
|
||||
<el-icon><Close /></el-icon>
|
||||
关闭
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="previewVisible" title="文件预览" width="800px" align-center destroy-on-close>
|
||||
<div v-if="previewType === 'image'" class="preview-container">
|
||||
<img
|
||||
:src="previewUrl"
|
||||
alt="预览"
|
||||
style="max-width: 100%; max-height: 70vh; display: block; margin: 0 auto"
|
||||
/>
|
||||
</div>
|
||||
<div v-else class="preview-container">
|
||||
<video
|
||||
:src="previewUrl"
|
||||
controls
|
||||
style="max-width: 100%; max-height: 70vh; display: block; margin: 0 auto"
|
||||
/>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref, watch } from 'vue'
|
||||
import { Close } from '@element-plus/icons-vue'
|
||||
import ProtocolAttachmentReadonly from './ProtocolAttachmentReadonly.vue'
|
||||
import {
|
||||
fetchCollectionProtocolDetail,
|
||||
type CollectionProtocolRow
|
||||
} from '@/api/collection-protocol'
|
||||
import {
|
||||
fetchCellSampleTypeList,
|
||||
fetchItemUnitList,
|
||||
fetchExpressCompanyList,
|
||||
fetchSiteList,
|
||||
fetchCollectionRegionList,
|
||||
fetchHospitalList,
|
||||
fetchUserList
|
||||
} from '@/api/admin'
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
protocolId: string | null
|
||||
listRow?: CollectionProtocolRow | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', val: boolean): void
|
||||
}>()
|
||||
|
||||
const formTabs = [
|
||||
{ key: 'basic', label: '基本信息' },
|
||||
{ key: 'party', label: '客户信息' },
|
||||
{ key: 'collection', label: '采集信息' },
|
||||
{ key: 'sample', label: '样本及运输信息' },
|
||||
{ key: 'payment', label: '缴费信息' }
|
||||
] as const
|
||||
|
||||
const loading = ref(false)
|
||||
const bundle = ref<Record<string, any> | null>(null)
|
||||
const activeTab = ref('basic')
|
||||
|
||||
const sampleTypeOptions = ref<Array<{ id: string; typeName: string }>>([])
|
||||
const unitOptions = ref<Array<{ id: string; unitName: string }>>([])
|
||||
const siteOptions = ref<Array<{ id: string; siteName: string }>>([])
|
||||
const expressCompanyOptions = ref<Array<{ id: string; expressName: string }>>([])
|
||||
const regionOptions = ref<Array<{ id: string; regionName: string }>>([])
|
||||
const hospitalOptions = ref<Array<{ id: string; hospitalName: string }>>([])
|
||||
const collectorUserOptions = ref<Array<{ id: string; nickName: string }>>([])
|
||||
const salesUserOptions = ref<Array<{ id: string; nickName: string }>>([])
|
||||
|
||||
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
|
||||
|
||||
const protocol = computed(() => bundle.value?.protocol as Record<string, any> | undefined)
|
||||
const partyCustomer = computed(() => bundle.value?.partyCustomer as Record<string, any> | null)
|
||||
const collectionInfo = computed(() => bundle.value?.collectionInfo as Record<string, any> | null)
|
||||
const payment = computed(() => bundle.value?.payment as Record<string, any> | null)
|
||||
const samples = computed(() => (bundle.value?.samples as Array<Record<string, any>>) || [])
|
||||
const paymentDetails = computed(
|
||||
() => (bundle.value?.paymentDetails as Array<Record<string, any>>) || []
|
||||
)
|
||||
const protocolAttachments = computed(() => {
|
||||
const list = bundle.value?.attachments
|
||||
return Array.isArray(list) ? list : []
|
||||
})
|
||||
|
||||
const dialogTitle = computed(() => {
|
||||
const no = protocol.value?.protocolNo || props.listRow?.protocolNo
|
||||
return no ? `查看协议单 — ${no}` : '查看协议单'
|
||||
})
|
||||
|
||||
const collectorDisplay = computed(() => {
|
||||
const fromList = props.listRow?.collectorUserName
|
||||
if (fromList) return String(fromList)
|
||||
const id = protocol.value?.collectorUserId
|
||||
const u = collectorUserOptions.value.find((x) => x.id === id)
|
||||
return u?.nickName || dash(id)
|
||||
})
|
||||
|
||||
const salesDisplay = computed(() => {
|
||||
const fromList = props.listRow?.salesUserName
|
||||
if (fromList) return String(fromList)
|
||||
const id = collectionInfo.value?.salesUserId
|
||||
const u = salesUserOptions.value.find((x) => x.id === id)
|
||||
return u?.nickName || dash(id)
|
||||
})
|
||||
|
||||
const regionDisplay = computed(() => {
|
||||
const fromList = props.listRow?.regionName
|
||||
if (fromList) return String(fromList)
|
||||
const id = collectionInfo.value?.regionId
|
||||
const r = regionOptions.value.find((x) => x.id === id)
|
||||
return r?.regionName || dash(id)
|
||||
})
|
||||
|
||||
const hospitalDisplay = computed(() => {
|
||||
const fromList = props.listRow?.hospitalName
|
||||
if (fromList) return String(fromList)
|
||||
const id = collectionInfo.value?.hospitalId
|
||||
const h = hospitalOptions.value.find((x) => x.id === id)
|
||||
return h?.hospitalName || dash(id)
|
||||
})
|
||||
|
||||
function dash(val: unknown) {
|
||||
if (val === null || val === undefined || val === '') return '—'
|
||||
return String(val)
|
||||
}
|
||||
|
||||
function formatYmd(val: unknown) {
|
||||
const s = String(val || '').replace(/-/g, '')
|
||||
if (s.length === 8) return `${s.slice(0, 4)}-${s.slice(4, 6)}-${s.slice(6, 8)}`
|
||||
return dash(val)
|
||||
}
|
||||
|
||||
function formatYm(val: unknown) {
|
||||
const s = String(val || '')
|
||||
if (s.length === 6) return `${s.slice(0, 4)}-${s.slice(4, 6)}`
|
||||
return dash(val)
|
||||
}
|
||||
|
||||
function protocolStatusLabel(s: string) {
|
||||
const m: Record<string, string> = {
|
||||
dsx: '待生效',
|
||||
sxz: '生效中',
|
||||
ygq: '已过期',
|
||||
yzf: '已作废',
|
||||
zky: '转科研'
|
||||
}
|
||||
return m[s] || s || '—'
|
||||
}
|
||||
|
||||
function payModeLabel(s: string) {
|
||||
if (s === 'dj') return '趸交'
|
||||
if (s === 'fq') return '分期'
|
||||
return s || '—'
|
||||
}
|
||||
|
||||
function newbornSexLabel(s: string) {
|
||||
if (s === '1') return '男'
|
||||
if (s === '0') return '女'
|
||||
return s || '—'
|
||||
}
|
||||
|
||||
function deliveryModeLabel(s: string) {
|
||||
if (s === 'sc') return '顺产'
|
||||
if (s === 'pgc') return '剖宫产'
|
||||
return s || '—'
|
||||
}
|
||||
|
||||
function sampleStatusLabel(s: string) {
|
||||
const m: Record<string, string> = { ycj: '已采集', jcz: '检测中', yrk: '已入库', yzf: '已作废' }
|
||||
return m[s] || s || '—'
|
||||
}
|
||||
|
||||
function transportTypeLabel(s: string) {
|
||||
if (s === 'kdys') return '快递运输'
|
||||
if (s === 'ryxd') return '人员携带'
|
||||
return s || '—'
|
||||
}
|
||||
|
||||
function transferTypeLabel(s: string) {
|
||||
const m: Record<string, string> = { wxzz: '微信', zzbzz: '支付宝', yhkzz: '银行卡', xj: '现金' }
|
||||
return m[s] || s || '—'
|
||||
}
|
||||
|
||||
function payStatusLabel(s: string) {
|
||||
const m: Record<string, string> = {
|
||||
dfj: '待缴费',
|
||||
jfqrz: '缴费确认中',
|
||||
yjf: '已缴费',
|
||||
tfqrz: '退费确认中',
|
||||
ytf: '已退费'
|
||||
}
|
||||
return m[s] || s || '—'
|
||||
}
|
||||
|
||||
function sampleTypeName(id: string) {
|
||||
return sampleTypeOptions.value.find((x) => x.id === id)?.typeName || dash(id)
|
||||
}
|
||||
|
||||
function unitName(id: string) {
|
||||
return unitOptions.value.find((x) => x.id === id)?.unitName || dash(id)
|
||||
}
|
||||
|
||||
function siteName(id: string) {
|
||||
return siteOptions.value.find((x) => x.id === id)?.siteName || dash(id)
|
||||
}
|
||||
|
||||
function expressName(id: string) {
|
||||
return expressCompanyOptions.value.find((x) => x.id === id)?.expressName || dash(id)
|
||||
}
|
||||
|
||||
function sampleTransportExtra(transport: Record<string, any> | undefined) {
|
||||
if (!transport?.transportType) return '—'
|
||||
if (transport.transportType === 'kdys') {
|
||||
const parts: string[] = []
|
||||
const ec = expressName(String(transport.expressCompanyId || ''))
|
||||
if (ec !== '—') parts.push(ec)
|
||||
if (transport.waybillNo) parts.push(String(transport.waybillNo))
|
||||
if (transport.expressFee != null && transport.expressFee !== '') {
|
||||
parts.push(`¥${transport.expressFee}`)
|
||||
}
|
||||
return parts.length ? parts.join(' · ') : '—'
|
||||
}
|
||||
if (transport.transportType === 'ryxd') {
|
||||
const parts: string[] = []
|
||||
if (transport.carrierName) parts.push(String(transport.carrierName))
|
||||
if (transport.carrierPhone) parts.push(String(transport.carrierPhone))
|
||||
return parts.length ? parts.join(' · ') : '—'
|
||||
}
|
||||
return '—'
|
||||
}
|
||||
|
||||
function detailAttachments(detail: Record<string, any>) {
|
||||
return Array.isArray(detail.attachments) ? detail.attachments : []
|
||||
}
|
||||
|
||||
function fullFileUrl(suffix: string) {
|
||||
if (!suffix) return ''
|
||||
if (suffix.startsWith('http://') || suffix.startsWith('https://') || suffix.startsWith('/'))
|
||||
return suffix
|
||||
return `${minioBaseUrl}/${suffix}`
|
||||
}
|
||||
|
||||
function isVideoFile(file: { fileType?: string; fileName?: string }) {
|
||||
const t = (file.fileType || '').toLowerCase()
|
||||
if (t.startsWith('video/')) return true
|
||||
return /\.(mp4|webm|ogg|mov)$/i.test(file.fileName || '')
|
||||
}
|
||||
|
||||
const previewVisible = ref(false)
|
||||
const previewUrl = ref('')
|
||||
const previewType = ref<'image' | 'video'>('image')
|
||||
|
||||
function openPreview(file: Record<string, any>) {
|
||||
if (!file.fileUrl) return
|
||||
previewUrl.value = fullFileUrl(file.fileUrl)
|
||||
previewType.value = isVideoFile(file) ? 'video' : 'image'
|
||||
previewVisible.value = true
|
||||
}
|
||||
|
||||
function downloadFile(file: Record<string, any>) {
|
||||
const url = fullFileUrl(file.fileUrl)
|
||||
if (!url) return
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = file.fileName || ''
|
||||
a.target = '_blank'
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
}
|
||||
|
||||
async function loadLookups(data: Record<string, any>) {
|
||||
const [stRes, uRes, ecRes, siteRes] = await Promise.all([
|
||||
fetchCellSampleTypeList({ page: 1, pageSize: 100 }),
|
||||
fetchItemUnitList({ page: 1, pageSize: 100 }),
|
||||
fetchExpressCompanyList({ page: 1, pageSize: 100 }),
|
||||
fetchSiteList({ page: 1, pageSize: 100 })
|
||||
])
|
||||
sampleTypeOptions.value = (stRes.list || []) as any
|
||||
unitOptions.value = (uRes.list || []) as any
|
||||
expressCompanyOptions.value = ecRes.list || []
|
||||
siteOptions.value = siteRes.list || []
|
||||
|
||||
const ci = data.collectionInfo as Record<string, any> | null
|
||||
const p = data.protocol as Record<string, any> | undefined
|
||||
const tasks: Promise<void>[] = []
|
||||
|
||||
if (ci?.regionId) {
|
||||
tasks.push(
|
||||
fetchCollectionRegionList({ page: 1, pageSize: 100 }).then((res) => {
|
||||
regionOptions.value = res.list || []
|
||||
})
|
||||
)
|
||||
tasks.push(
|
||||
fetchHospitalList(String(ci.regionId), { page: 1, pageSize: 100 }).then((res) => {
|
||||
hospitalOptions.value = res.list || []
|
||||
})
|
||||
)
|
||||
}
|
||||
if (p?.collectorUserId) {
|
||||
tasks.push(
|
||||
fetchUserList({ page: 1, pageSize: 50, status: '1' }).then((res) => {
|
||||
collectorUserOptions.value = res.list || []
|
||||
})
|
||||
)
|
||||
}
|
||||
if (ci?.salesUserId) {
|
||||
tasks.push(
|
||||
fetchUserList({ page: 1, pageSize: 50, status: '1' }).then((res) => {
|
||||
salesUserOptions.value = res.list || []
|
||||
})
|
||||
)
|
||||
}
|
||||
await Promise.all(tasks)
|
||||
}
|
||||
|
||||
async function loadDetail() {
|
||||
if (!props.protocolId) return
|
||||
loading.value = true
|
||||
bundle.value = null
|
||||
try {
|
||||
const data = await fetchCollectionProtocolDetail(props.protocolId)
|
||||
bundle.value = data as Record<string, any>
|
||||
await loadLookups(data as Record<string, any>)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function scrollToSection(key: string) {
|
||||
activeTab.value = key
|
||||
nextTick(() => {
|
||||
document
|
||||
.getElementById(`view-section-${key}`)
|
||||
?.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
||||
})
|
||||
}
|
||||
|
||||
function handleClosed() {
|
||||
bundle.value = null
|
||||
activeTab.value = 'basic'
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.modelValue, props.protocolId] as const,
|
||||
([visible, id]) => {
|
||||
if (visible && id) loadDetail()
|
||||
}
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.protocol-view-body {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.detail-tabs {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
background: #f5f7fa;
|
||||
padding: 4px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 16px;
|
||||
width: fit-content;
|
||||
isolation: isolate;
|
||||
box-shadow: 0 1px 0 #f5f7fa;
|
||||
}
|
||||
|
||||
.detail-tab {
|
||||
padding: 10px 20px;
|
||||
cursor: pointer;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
transition: all 0.3s;
|
||||
|
||||
&.active {
|
||||
background: #fff;
|
||||
color: #059669;
|
||||
font-weight: 500;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
&:hover:not(.active) {
|
||||
color: #059669;
|
||||
}
|
||||
}
|
||||
|
||||
.form-tab-pane {
|
||||
padding: 0 0 4px;
|
||||
|
||||
& + .form-tab-pane {
|
||||
margin-top: 20px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px dashed #e2e8f0;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-section-title {
|
||||
margin: 8px 0 12px;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
border-left: 3px solid #10b981;
|
||||
}
|
||||
|
||||
.form-section-divider {
|
||||
margin: 16px 0;
|
||||
border: none;
|
||||
border-top: 1px dashed #e2e8f0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.view-kv-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px 28px;
|
||||
|
||||
&--4 {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
&--5 {
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.view-kv {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 4px 12px;
|
||||
font-size: 13px;
|
||||
align-items: start;
|
||||
|
||||
dt {
|
||||
margin: 0;
|
||||
color: #64748b;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
color: #1e293b;
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
.view-kv-span-2 {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.view-field-empty {
|
||||
font-size: 13px;
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.sample-transport-panel {
|
||||
padding: 12px 16px;
|
||||
background: #f8fafc;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.sample-transport-title {
|
||||
margin: 0 0 12px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.sub-view-table {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.payment-detail-cards {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.payment-detail-card {
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.payment-detail-card__header {
|
||||
padding: 10px 16px;
|
||||
background: #f8fafc;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.payment-detail-card__title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.payment-detail-card__body {
|
||||
padding: 14px 16px;
|
||||
}
|
||||
|
||||
.payment-detail-card__attachments {
|
||||
margin-top: 8px;
|
||||
padding-top: 8px;
|
||||
border-top: 1px dashed #e2e8f0;
|
||||
}
|
||||
|
||||
.view-field-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.view-field-block__label {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.preview-container {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.view-kv-grid--4,
|
||||
.view-kv-grid--5 {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user