feat: 细胞存储缴费催缴、统一样本信息与协议支付能力增强

汇总近期业务改动:催缴菜单与后端、样本信息快捷登记与进度、运费关联、客户档案扩展、协议优惠/期次与押金划转,并同步 SQL 迁移与管理端页面收敛。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-10-10 21:20:37 +08:00
1 parent 2d3472f5c4
commit db31990ebe
235 files changed
+14898 -10196

No files matched your search

+5
View File
@@ -1049,6 +1049,11 @@ export function fetchRegionStaffList(
params
})
}
export function fetchRegionsByStaffUser(userId: string) {
return request.get<{ list: { id: string; regionName: string }[] }>({
url: `/web/admin/collection-regions/by-staff-user/${userId}`
})
}
export function fetchCreateRegionStaff(
regionId: string,
data: { userId: string; isLeader?: boolean; orderNum?: number; remark?: string }
@@ -13,8 +13,13 @@ export function fetchProtocolSampleCollectionList(params?: {
page?: number
pageSize?: number
keyword?: string
/** uncollected | ycj | jcz | yrk | yzf | all */
sampleStatus?: string
collectionFlag?: string
receptionFlag?: string
qcFlag?: string
storageFlag?: string
storageCertHandled?: string
insuranceHandled?: string
}) {
return request.get<PageList<Record<string, unknown>>>({
url: '/web/admin/protocol-sample-collections/list',
+2
View File
@@ -46,6 +46,8 @@ export type QcProtocolPaymentSummary = {
overallPayStatusTagType?: string
installmentCount?: number | null
paymentDetails?: QcProtocolPaymentDetailSummary[]
/** 第 1 期多笔转账中最后一笔的转账时间(协议列表「首期缴费时间」优先用) */
firstPayTransferTime?: string
}
export type QcBasicExperimentFeeSummary = {
@@ -13,8 +13,11 @@ export function fetchResearchDonationSampleCollectionList(params?: {
page?: number
pageSize?: number
keyword?: string
/** uncollected | ycj | jcz | yrk | yzf | all */
sampleStatus?: string
collectionFlag?: string
receptionFlag?: string
qcFlag?: string
storageFlag?: string
}) {
return request.get<PageList<Record<string, unknown>>>({
url: '/web/admin/research-donation-sample-collections/list',
+6
View File
@@ -7,15 +7,21 @@ export type SampleFreightItem = {
sampleCode?: string
protocolNo?: string
sampleTypeName?: string
motherName?: string
newbornName?: string
freightId?: string
}
export type SampleFreight = {
id: string
/** 运费批次号,格式 YF+YYYYMMDD+001~999 */
freightNo?: string
transportMode: string
transportModeLabel?: string
freightAmount: number
linkedSampleCount?: number
createBy?: string
createByName?: string
createTime?: string
items?: SampleFreightItem[]
deleted?: boolean
+37
View File
@@ -0,0 +1,37 @@
import request from '@/utils/http'
export function fetchUpdateStorageCertHandle(
protocolId: string,
data: {
handleTime?: string | null
handlerUserId?: string | null
certImageUrls?: string
remark?: string
}
) {
return request.put({ url: `/web/admin/storage-certs/${protocolId}`, data })
}
export function fetchSampleInfoQuickRegister(data: {
kind: 'storage' | 'storage_cert' | 'insurance'
receptionSource: 'cell_storage' | 'research_donation'
items: Array<{ sampleCode: string; protocolId: string }>
handleTime: string
handlerUserId: string
attachments?: string
remark?: string
}) {
return request.post({ url: '/web/admin/sample-info/quick-register', data })
}
export function fetchUpdateFullmoonHandle(
protocolId: string,
data: {
handleTime?: string | null
handlerUserId?: string | null
insuranceAttachments?: string
handleRemark?: string
}
) {
return request.put({ url: `/web/admin/fullmoon-todos/${protocolId}/handle`, data })
}
+28 -37
View File
@@ -363,6 +363,19 @@ body {
overflow: visible;
}
/* overflow:visible 时,贴顶子块的矩形背景会盖住面板 1px 圆角描边。给首块补内侧圆角,不裁切表格固定列。 */
.panel > .panel-top:first-child,
.panel > .filter-block:first-child,
.panel > .list-toolbar:first-child,
.panel > .list-body:first-child,
.panel > :first-child > .panel-top:first-child,
.panel > :first-child > .filter-block:first-child,
.panel > :first-child > .list-toolbar:first-child,
.panel > :first-child > .list-body:first-child {
border-top-left-radius: calc(var(--mint-radius) - 1px);
border-top-right-radius: calc(var(--mint-radius) - 1px);
}
.panel-top {
display: flex;
align-items: center;
@@ -440,22 +453,7 @@ body {
justify-content: flex-start;
}
&--lg:not(.el-tabs) {
margin: 16px 24px 8px;
.panel-pill-tabs__track {
gap: 6px;
padding: 5px;
border-radius: 10px;
}
.panel-pill-tabs__btn {
min-width: 140px;
padding: 10px 28px;
border-radius: 8px;
font-size: 14px;
}
}
// 注:panel-pill-tabs--lg 曾放大尺寸,现已取消;模板中 class 可保留,视觉与默认一致
&__track {
display: inline-flex;
@@ -641,24 +639,6 @@ body {
}
}
&--lg.el-tabs {
> .el-tabs__header {
margin: 16px 24px 8px;
}
.el-tabs__nav {
gap: 6px;
padding: 5px;
border-radius: 10px;
}
.el-tabs__item {
min-width: 140px;
padding: 10px 28px !important;
border-radius: 8px;
font-size: 14px;
}
}
}
// 缴退费财务确认 — 待确认 / 已确认分区标题(背景与 panel-pill-tabs 轨道一致)
@@ -1302,7 +1282,8 @@ body {
.console-container {
.filter-block {
padding: 12px 16px 10px;
background: var(--mint-surface);
/* 与 .panel 同色;勿铺实心底,否则 overflow:visible 时会盖住面板顶角圆角描边 */
background: transparent;
border-bottom: 1px solid var(--mint-border);
}
@@ -1311,11 +1292,21 @@ body {
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 10px 14px;
margin-bottom: 0;
/* 纵向间距交给 grid gap,避免与操作行叠加出大空隙 */
.el-form-item {
margin-bottom: 0;
}
}
/* 检索栏左右布局:label 与输入框间距 */
.filter-form:not(.el-form--label-top) .el-form-item__label {
padding-right: 12px;
}
.filter-actions-row {
margin-top: 10px;
padding-top: 10px;
margin-top: 8px;
padding-top: 0;
display: flex;
align-items: center;
justify-content: space-between;
@@ -1,8 +1,76 @@
<!-- 缴退费确认流程(纵向倒序时间线 + 独立操作区) -->
<!-- 缴退费确认流程(纵向正序时间线 + 独立操作区) -->
<template>
<div class="clinical-payment-confirm-timeline">
<div v-if="showBasicSummary && isProtocolFlow" class="payment-basic-summary">
<div v-if="showBasicSummary && isPresignFlow" class="payment-basic-summary">
<dl class="payment-basic-summary__grid">
<div class="payment-basic-summary__item">
<dt>缴费类型</dt>
<dd>
<el-tag type="warning" size="small">预签约意向金</el-tag>
</dd>
</div>
<div class="payment-basic-summary__item">
<dt>协议编号</dt>
<dd>{{ dash(detail?.protocolNo) }}</dd>
</div>
<div class="payment-basic-summary__item">
<dt>客户姓名</dt>
<dd>{{ dash(detail?.motherName) }}</dd>
</div>
<div class="payment-basic-summary__item">
<dt>订单状态</dt>
<dd>
<el-tag :type="presignOrderStatusTagType(String(detail?.orderStatus || ''))" size="small">
{{ presignOrderStatusLabel(String(detail?.orderStatus || '')) }}
</el-tag>
</dd>
</div>
<div class="payment-basic-summary__item">
<dt>业务日期</dt>
<dd>{{ formatPaymentDueDate(detail?.orderDate) }}</dd>
</div>
<div class="payment-basic-summary__item">
<dt>预产期</dt>
<dd>{{ formatPaymentDueDate(detail?.expectedDeliveryDate) }}</dd>
</div>
<div class="payment-basic-summary__item">
<dt>样本类型</dt>
<dd>{{ dash(detail?.sampleTypeNames) }}</dd>
</div>
<div class="payment-basic-summary__item">
<dt>合同金额(元)</dt>
<dd>{{ formatProtocolAmount(detail?.contractAmount) }}</dd>
</div>
<div class="payment-basic-summary__item">
<dt>合同缴费方式</dt>
<dd>{{ protocolPayModeLabel(String(detail?.contractPayMode || '')) }}</dd>
</div>
<div class="payment-basic-summary__item">
<dt>本次意向金(元)</dt>
<dd>{{ formatProtocolAmount(detail?.transferAmount) }}</dd>
</div>
<div class="payment-basic-summary__item">
<dt>采集专员</dt>
<dd>{{ dash(detail?.collectorUserName) }}</dd>
</div>
<div v-if="showPayStatus" class="payment-basic-summary__item">
<dt>缴费状态</dt>
<dd>
<el-tag :type="protocolPayStatusTagType(String(detail?.payStatus || ''))" size="small">
{{ protocolPayStatusLabel(String(detail?.payStatus || '')) }}
</el-tag>
</dd>
</div>
</dl>
</div>
<div v-else-if="showBasicSummary && isProtocolFlow" class="payment-basic-summary">
<dl class="payment-basic-summary__grid">
<div class="payment-basic-summary__item">
<dt>缴费类型</dt>
<dd>
<el-tag type="primary" size="small">正式协议缴费</el-tag>
</dd>
</div>
<div class="payment-basic-summary__item">
<dt>协议状态</dt>
<dd>
@@ -148,7 +216,9 @@
<dt>{{ field.label }}</dt>
<dd v-if="field.slot === 'attachments'">
<ProtocolAttachmentReadonly
size="compact"
:files="attachmentFiles(field.attachmentUrls)"
@preview="handleAttachmentPreview"
@download="(f) => emit('download', f)"
/>
</dd>
@@ -171,16 +241,38 @@
<div v-if="$slots['action-panel']" class="action-panel">
<slot name="action-panel" />
</div>
<el-dialog
v-model="previewVisible"
title="文件预览"
width="800px"
align-center
append-to-body
destroy-on-close
modal-class="protocol-dialog-mask"
>
<div v-if="previewType === 'image'" class="preview-container">
<img :src="previewUrl" alt="预览" />
</div>
<div v-else-if="previewType === 'video'" class="preview-container">
<video :src="previewUrl" controls />
</div>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { computed, useSlots } from 'vue'
import { computed, ref, useSlots } from 'vue'
import ProtocolAttachmentReadonly from '@/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue'
import { getPilotBizConfig } from '@/config/pilot-biz-type'
import { maskIdCard } from '@/utils/mask-sensitive'
import { payStatusLabel, payStatusTagType } from '@/utils/status-tag-registry'
import {
payStatusLabel,
payStatusTagType,
presignOrderStatusLabel,
presignOrderStatusTagType
} from '@/utils/status-tag-registry'
import {
buildPaymentFlowSteps,
type PaymentFlowStep,
@@ -192,7 +284,7 @@
payModeLabel,
payStatusLabel as protocolPayStatusLabel,
payStatusTagType as protocolPayStatusTagType,
protocolStatusLabel, protocolStatusDisplayLabel,
protocolStatusDisplayLabel,
protocolStatusTagType
} from '@/utils/protocol-payment-labels'
import { formatMoneyDisplay } from '@/utils/money-format'
@@ -225,7 +317,11 @@
}
function attachmentFiles(urlField?: string) {
const fromDetail = props.detail?.attachments
const urls = String(urlField || '')
if (Array.isArray(fromDetail) && fromDetail.length && !urls.trim()) {
return fromDetail as Array<Record<string, unknown>>
}
if (!urls.trim()) return []
return urls
.split(',')
@@ -238,6 +334,50 @@
.filter(Boolean) as Array<Record<string, unknown>>
}
const previewVisible = ref(false)
const previewUrl = ref('')
const previewType = ref<'image' | 'video'>('image')
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
function resolveFileUrl(suffix: string) {
if (!suffix) return ''
if (/^https?:\/\//i.test(suffix) || suffix.startsWith('/')) return suffix
return minioBaseUrl ? `${minioBaseUrl}/${suffix.replace(/^\//, '')}` : suffix
}
function fileKind(file: Record<string, unknown>): 'image' | 'video' | 'other' {
const url = String(file.fileUrl || '').toLowerCase()
const name = String(file.fileName || '').toLowerCase()
const type = String(file.fileType || '')
if (
/\.(mp4|webm|ogg|mov|avi)(\?|$)/.test(url) ||
/\.(mp4|webm|ogg|mov|avi)$/.test(name) ||
type.startsWith('video/')
) {
return 'video'
}
if (
/\.(pdf|doc|docx|xls|xlsx|zip)(\?|$)/.test(url) ||
/\.(pdf|doc|docx|xls|xlsx|zip)$/.test(name)
) {
return 'other'
}
return 'image'
}
function handleAttachmentPreview(file: Record<string, unknown>) {
const url = resolveFileUrl(String(file.fileUrl || ''))
if (!url) return
const kind = fileKind(file)
if (kind === 'other') {
window.open(url, '_blank')
return
}
previewUrl.value = url
previewType.value = kind
previewVisible.value = true
}
function visibleFields(step: PaymentFlowStep) {
return step.fields.filter(
(field) => field.slot !== 'attachments' || attachmentFiles(field.attachmentUrls).length
@@ -250,7 +390,11 @@
return visibleFields(step).length > 0
}
const isProtocolFlow = computed(() => props.flowVariant === 'protocol')
const isPresignFlow = computed(() => String(props.detail?.source || '') === 'presign')
const isProtocolFlow = computed(
() => props.flowVariant === 'protocol' && !isPresignFlow.value
)
const isBasicExperiment = computed(
() => String(props.detail?.bizType || '') === 'basic_experiment'
@@ -271,14 +415,14 @@
}
const steps = computed(() =>
isProtocolFlow.value
props.flowVariant === 'protocol'
? buildProtocolPaymentFlowSteps(props.detail, props.activeStepKey)
: buildPaymentFlowSteps(props.detail, props.activeStepKey)
)
/** 倒序:最新环节在上,最早环节在下;隐藏尚未到达的环节 */
/** 正序:先缴费确认,后财务确认;隐藏尚未到达的环节 */
const displaySteps = computed(() =>
[...steps.value].filter((step) => step.state !== 'pending').reverse()
steps.value.filter((step) => step.state !== 'pending')
)
</script>
@@ -489,7 +633,7 @@
}
.v-timeline-field--full {
flex: 1 1 220px;
flex: 1 1 100%;
}
@media (max-width: 560px) {
@@ -523,4 +667,14 @@
line-height: 1.4;
}
}
.preview-container {
img,
video {
display: block;
max-width: 100%;
max-height: 70vh;
margin: 0 auto;
}
}
</style>
@@ -363,8 +363,9 @@
</el-table>
</div>
<template #footer>
<el-button @click="cellSelectVisible = false">取消</el-button>
<el-button @click="cellSelectVisible = false"><el-icon><Close /></el-icon>取消</el-button>
<el-button type="primary" :disabled="!cellSelectedRows.length" @click="confirmCellSelect">
<el-icon><Check /></el-icon>
确定(已选 {{ cellSelectedRows.length }} 项)
</el-button>
</template>
@@ -406,7 +407,9 @@
Document,
Download,
View,
VideoPlay
VideoPlay,
Check,
Close
} from '@element-plus/icons-vue'
import { fetchUploadAttachment } from '@/api/business'
import { useIndexedAttachmentDropZone } from '@/composables/useAttachmentDropZone'
@@ -0,0 +1,283 @@
<template>
<div class="protocol-handle-panel">
<el-form label-position="top" class="biz-dialog-form" @submit.prevent>
<div class="form-grid-2">
<el-form-item label="办理时间" required>
<el-date-picker
v-model="form.handleTime"
type="datetime"
placeholder="请选择办理时间"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
clearable
/>
</el-form-item>
<el-form-item label="办理人员" :required="!!form.handleTime">
<el-select
v-model="form.handlerUserId"
filterable
remote
clearable
placeholder="输入姓名检索"
:remote-method="searchUsers"
:loading="userLoading"
style="width: 100%"
>
<el-option
v-for="u in userOptions"
:key="u.id"
:label="u.nickName || u.userName"
:value="u.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="attachmentLabel" class="form-col-span-2">
<div class="attachment-upload">
<div class="attachment-list">
<el-upload
:auto-upload="false"
:show-file-list="false"
:multiple="true"
accept="image/*,video/*,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.zip,.rar"
@change="onFileChange"
>
<div class="upload-card">
<el-icon :size="28" color="#047857"><Plus /></el-icon>
<span class="upload-card-text">上传附件</span>
</div>
</el-upload>
<div v-for="(file, index) in files" :key="file.id || index" class="attachment-item">
<div class="attachment-footer">
<span class="attachment-name" :title="file.fileName">{{ file.fileName }}</span>
<el-icon class="action-btn action-btn--danger" @click="files.splice(index, 1)">
<Delete />
</el-icon>
</div>
</div>
</div>
<span class="upload-hint">支持图片、PDF、Office 等,单文件不超过 20MB</span>
</div>
</el-form-item>
<el-form-item label="备注" class="form-col-span-2">
<el-input v-model="form.remark" type="textarea" :rows="2" maxlength="500" show-word-limit />
</el-form-item>
</div>
<div class="handle-actions">
<el-button class="btn-main" type="primary" :loading="saving" @click="handleSave">
<el-icon><Check /></el-icon>
保存
</el-button>
</div>
</el-form>
</div>
</template>
<script setup lang="ts">
import { Check, Delete, Plus } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import { fetchUserList } from '@/api/admin'
import { fetchUploadAttachment } from '@/api/business'
import {
fetchUpdateFullmoonHandle,
fetchUpdateStorageCertHandle
} from '@/api/sample-info-handle'
import { useUserStore } from '@/store/modules/user'
defineOptions({ name: 'ProtocolHandlePanel' })
const props = defineProps<{
mode: 'storage-cert' | 'insurance'
protocolId: string
initial?: Record<string, unknown> | null
}>()
const emit = defineEmits<{ (e: 'saved'): void }>()
const userStore = useUserStore()
const saving = ref(false)
const userLoading = ref(false)
const userOptions = ref<Array<{ id: string; nickName?: string; userName?: string }>>([])
const files = ref<Array<{ id: string; fileName: string; fileUrl: string }>>([])
const form = reactive({
handleTime: '' as string,
handlerUserId: '' as string,
remark: ''
})
const attachmentLabel = computed(() =>
props.mode === 'storage-cert' ? '储存证附件' : '保险附件'
)
function urlsToFiles(raw: string) {
return String(raw || '')
.split(',')
.map((u) => u.trim())
.filter(Boolean)
.map((url, i) => ({
id: `f_${i}`,
fileName: decodeURIComponent(url.split('/').pop() || `附件${i + 1}`),
fileUrl: url
}))
}
function applyInitial() {
const init = props.initial || {}
form.handleTime = String(init.handleTime || '')
form.handlerUserId = String(init.handlerUserId || '')
form.remark = String(
props.mode === 'storage-cert' ? init.remark || '' : init.handleRemark || ''
)
const urlField = props.mode === 'storage-cert' ? 'certImageUrls' : 'insuranceAttachments'
files.value = urlsToFiles(String(init[urlField] || ''))
const uid = form.handlerUserId || String(userStore.info?.userId || '')
if (!form.handlerUserId && !form.handleTime) {
form.handlerUserId = uid
}
if (form.handlerUserId) {
const name = String(init.handlerUserName || userStore.info?.userName || '')
if (name) {
userOptions.value = [
{ id: form.handlerUserId, nickName: name, userName: name }
]
}
}
}
watch(
() => [props.protocolId, props.initial],
() => applyInitial(),
{ immediate: true, deep: true }
)
async function searchUsers(kw: string) {
userLoading.value = true
try {
const res = await fetchUserList({ page: 1, pageSize: 50, keyword: kw || '', status: '1' })
userOptions.value = ((res as any)?.list || []).map((u: any) => ({
id: String(u.id),
nickName: u.nickName,
userName: u.userName
}))
} finally {
userLoading.value = false
}
}
async function onFileChange(uploadFile: any) {
const file = uploadFile.raw || uploadFile
if (!file) return
const fd = new FormData()
fd.append('folder', props.mode === 'storage-cert' ? 'storage-cert' : 'fullmoon-todo')
fd.append('file', file)
const res = (await fetchUploadAttachment(fd)) as { id?: string; fileName?: string; fileUrl?: string }
files.value.push({
id: String(res.id || Date.now()),
fileName: file.name || res.fileName || '附件',
fileUrl: res.fileUrl || ''
})
}
async function handleSave() {
if (form.handleTime && !form.handlerUserId) {
ElMessage.warning('填写办理时间时必须指定办理人员')
return
}
if (!props.protocolId) return
saving.value = true
try {
const urls = files.value.map((f) => f.fileUrl).filter(Boolean).join(',')
if (props.mode === 'storage-cert') {
await fetchUpdateStorageCertHandle(props.protocolId, {
handleTime: form.handleTime || null,
handlerUserId: form.handleTime ? form.handlerUserId : null,
certImageUrls: urls,
remark: form.remark
})
} else {
await fetchUpdateFullmoonHandle(props.protocolId, {
handleTime: form.handleTime || null,
handlerUserId: form.handleTime ? form.handlerUserId : null,
insuranceAttachments: urls,
handleRemark: form.remark
})
}
ElMessage.success('保存成功')
emit('saved')
} finally {
saving.value = false
}
}
</script>
<style scoped lang="scss">
.handle-actions {
margin-top: 8px;
}
.action-btn--danger {
cursor: pointer;
color: var(--el-color-danger);
}
.attachment-upload {
width: 100%;
}
.upload-card {
width: 140px;
height: 96px;
border: 1px dashed #a7f3d0;
border-radius: 8px;
background: #f0fdf4;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
cursor: pointer;
}
.upload-card-text {
font-size: 12px;
color: #047857;
font-weight: 500;
}
.upload-hint {
display: block;
font-size: 11px;
color: var(--mint-text-muted, #64748b);
margin-top: 8px;
}
.attachment-list {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.attachment-item {
width: 140px;
border: 1px solid #e2e8f0;
border-radius: 8px;
background: #fff;
overflow: hidden;
}
.attachment-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
padding: 8px;
}
.attachment-name {
flex: 1;
min-width: 0;
font-size: 12px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
@@ -59,6 +59,9 @@
align-items: center;
flex-wrap: wrap;
gap: 6px;
/* 避免换行后撑满单元格导致在 align=center 列内左对齐 */
width: fit-content;
max-width: 100%;
vertical-align: middle;
}
@@ -0,0 +1,196 @@
<template>
<div class="list-body list-wrap sample-freight-pick">
<el-table
ref="tableRef"
v-loading="loading"
:data="flatRows"
stripe
class="list-table"
row-key="rowKey"
highlight-current-row
:max-height="maxHeight"
:span-method="spanMethod"
@row-click="onRowClick"
>
<el-table-column prop="radio" label="" min-width="48" align="center" header-align="center">
<template #default="{ row }">
<el-radio
v-if="row.isFirst"
:model-value="modelValue"
:value="row.freightId"
@click.stop
@change="emitSelect(row.freight)"
/>
</template>
</el-table-column>
<el-table-column
prop="batchNo"
label="批次号"
min-width="160"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="transportMode"
label="运输方式"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag type="primary" size="small" effect="plain">
{{ row.transportModeLabel || row.transportMode || '—' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="freightAmount"
label="运费(元)"
min-width="110"
align="right"
header-align="center"
>
<template #default="{ row }">¥{{ formatMoneyDisplay(row.freightAmount) }}</template>
</el-table-column>
<el-table-column
prop="linkedSampleCount"
label="关联数"
min-width="80"
align="center"
header-align="center"
/>
<el-table-column label="来源" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<el-tag
v-if="row.sampleSource"
:type="row.sampleSource === 'cell_storage' ? 'success' : 'warning'"
size="small"
>
{{ row.sampleSource === 'cell_storage' ? '细胞存储' : '科研捐赠' }}
</el-tag>
<span v-else class="muted">—</span>
</template>
</el-table-column>
<el-table-column
prop="sampleCode"
label="样本编码"
min-width="120"
show-overflow-tooltip
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.sampleCode || '—' }}</template>
</el-table-column>
<el-table-column
prop="sampleTypeName"
label="样本类型"
min-width="110"
show-overflow-tooltip
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.sampleTypeName || '—' }}</template>
</el-table-column>
<el-table-column
prop="createByName"
label="创建人"
min-width="100"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.createByName || row.createBy || '—' }}</template>
</el-table-column>
<el-table-column
prop="createTime"
label="创建时间"
min-width="170"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.createTime || '—' }}</template>
</el-table-column>
</el-table>
</div>
</template>
<script setup lang="ts">
import type { SampleFreight } from '@/api/sample-freight'
import { formatMoneyDisplay } from '@/utils/money-format'
import {
flattenSampleFreights,
sampleFreightSpanMethod,
type SampleFreightFlatRow
} from '@/utils/sample-freight-flatten'
defineOptions({ name: 'SampleFreightPickTable' })
const props = withDefaults(
defineProps<{
list: SampleFreight[]
loading?: boolean
modelValue?: string
maxHeight?: number | string
}>(),
{
loading: false,
modelValue: '',
maxHeight: 280
}
)
const emit = defineEmits<{
'update:modelValue': [string]
select: [SampleFreight | null]
}>()
const tableRef = ref()
const flatRows = computed(() => flattenSampleFreights(props.list || []))
function spanMethod(args: { column: any; row: SampleFreightFlatRow }) {
return sampleFreightSpanMethod(args)
}
function emitSelect(freight: SampleFreight | null) {
const id = freight?.id || ''
emit('update:modelValue', id)
emit('select', freight)
}
function onRowClick(row: SampleFreightFlatRow) {
emitSelect(row.freight)
}
watch(
() => [props.modelValue, flatRows.value] as const,
([id, rows]) => {
nextTick(() => {
const table = tableRef.value
if (!table) return
if (!id) {
table.setCurrentRow?.(null)
return
}
const hit = rows.find((r) => r.freightId === id && r.isFirst)
if (hit) table.setCurrentRow?.(hit)
})
},
{ immediate: true }
)
</script>
<style scoped lang="scss">
.sample-freight-pick {
:deep(.el-radio) {
height: auto;
margin-right: 0;
}
.muted {
color: var(--mint-text-muted, #64748b);
}
}
</style>
@@ -3,7 +3,7 @@
<el-dialog
v-model="dialogVisible"
title="样本缴费详情"
width="1080px"
width="min(1200px, 90vw)"
class="dialog-form-layout"
align-center
append-to-body
@@ -14,7 +14,7 @@
>
<div v-loading="loading" class="sample-pay-detail">
<template v-if="detail">
<div class="detail-summary form-grid-2">
<div class="detail-summary form-grid-4">
<div class="detail-field">
<label>协议号</label>
<span>{{ detail.protocolNo || '—' }}</span>
@@ -34,7 +34,11 @@
</div>
<div class="detail-field">
<label>缴费方式</label>
<el-tag :type="payModeTagType(String(detail.payMode || ''))" size="small">
<el-tag
class="detail-tag"
:type="payModeTagType(String(detail.payMode || ''))"
size="small"
>
{{ payModeLabel(String(detail.payMode || '')) || '—' }}
</el-tag>
</div>
@@ -61,6 +65,7 @@
<div class="detail-field">
<label>缴费进度</label>
<el-tag
class="detail-tag"
:type="samplePaymentProgressTagType(String(detail.progressStatus || ''))"
size="small"
>
@@ -227,57 +232,59 @@
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" min-width="300" align="center" fixed="right">
<el-table-column label="操作" min-width="150" align="center" fixed="right">
<template #default="{ row, $index }">
<el-button
v-if="!isTransferFieldsLocked(row)"
link
type="primary"
size="small"
:loading="savingKey === transferRowKey(sIdx, $index, row)"
@click="saveTransferRow(sIdx, $index)"
>
<el-icon><Select /></el-icon>
保存
</el-button>
<el-button
v-if="row.id && row.payStatus === 'dfj'"
link
type="primary"
size="small"
:loading="submittingId === row.id"
@click="submitTransfer(row)"
>
<el-icon><Check /></el-icon>
提交财务确认
</el-button>
<el-button
v-if="row.id && row.payStatus === 'jfqrz'"
link
type="warning"
size="small"
:loading="submittingId === row.id"
@click="withdrawTransfer(row)"
>
<el-icon><RefreshLeft /></el-icon>
撤回
</el-button>
<el-button
v-if="!isTransferFieldsLocked(row)"
link
type="danger"
size="small"
:loading="deletingId === String(row.id || '')"
@click="removeTransfer(sIdx, $index)"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
<span
v-if="isTransferFieldsLocked(row) && row.payStatus !== 'jfqrz'"
class="muted-dash"
>—</span
>
<div class="transfer-action-stack">
<el-button
v-if="!isTransferFieldsLocked(row)"
link
type="primary"
size="small"
:loading="savingKey === transferRowKey(sIdx, $index, row)"
@click="saveTransferRow(sIdx, $index)"
>
<el-icon><Select /></el-icon>
保存
</el-button>
<el-button
v-if="row.id && row.payStatus === 'dfj'"
link
type="primary"
size="small"
:loading="submittingId === row.id"
@click="submitTransfer(row)"
>
<el-icon><Check /></el-icon>
提交财务确认
</el-button>
<el-button
v-if="row.id && row.payStatus === 'jfqrz'"
link
type="warning"
size="small"
:loading="submittingId === row.id"
@click="withdrawTransfer(row)"
>
<el-icon><RefreshLeft /></el-icon>
撤回
</el-button>
<el-button
v-if="!isTransferFieldsLocked(row)"
link
type="danger"
size="small"
:loading="deletingId === String(row.id || '')"
@click="removeTransfer(sIdx, $index)"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
<span
v-if="isTransferFieldsLocked(row) && row.payStatus !== 'jfqrz'"
class="muted-dash"
>—</span
>
</div>
</template>
</el-table-column>
</el-table>
@@ -693,6 +700,11 @@
font-weight: 400;
}
.detail-tag {
align-self: flex-start;
width: fit-content;
}
.amount-text {
font-weight: 600;
color: var(--primary-dark, #059669);
@@ -734,6 +746,17 @@
}
}
.transfer-action-stack {
display: inline-flex;
flex-direction: column;
align-items: center;
gap: 4px;
:deep(.el-button + .el-button) {
margin-left: 0;
}
}
.muted-dash {
color: var(--mint-text-muted, #94a3b8);
}
@@ -199,11 +199,13 @@
}
.sample-card__section-label {
font-size: 11px;
margin: 0 0 10px;
padding-left: 10px;
font-size: 13px;
font-weight: 600;
color: var(--mint-text-muted, #334155);
margin-bottom: 10px;
letter-spacing: 0.3px;
line-height: 1.4;
color: #334155;
border-left: 3px solid #10b981;
}
.sample-production-empty,
@@ -103,11 +103,13 @@
}
.sample-card__section-label {
margin-bottom: 10px;
font-size: 11px;
margin: 0 0 10px;
padding-left: 10px;
font-size: 13px;
font-weight: 600;
color: var(--mint-text-muted, #334155);
letter-spacing: 0.3px;
line-height: 1.4;
color: #334155;
border-left: 3px solid #10b981;
}
.sample-qc-grouped-panel {
@@ -124,9 +126,9 @@
}
.sample-qc-grouped-panel__subtitle {
margin: 0 0 8px;
padding-left: 10px;
margin: 0;
font-size: 12px;
font-size: 13px;
font-weight: 600;
line-height: 1.4;
color: #334155;
@@ -2,7 +2,7 @@
<template>
<div class="sample-reception-dual-readonly">
<div v-if="showQc" class="sample-reception-dual-readonly__block">
<h4 v-if="qcTitle" class="detail-section-title">{{ qcTitle }}</h4>
<h4 v-if="qcTitle" class="sample-card__section-label">{{ qcTitle }}</h4>
<div v-if="!qcReception" class="sample-reception-dual-readonly__empty">{{ qcEmptyHint }}</div>
<template v-else>
<div class="readonly-grid form-grid-4">
@@ -62,7 +62,7 @@
</div>
<div v-if="showProduction" class="sample-reception-dual-readonly__block">
<h4 v-if="productionTitle" class="detail-section-title">{{ productionTitle }}</h4>
<h4 v-if="productionTitle" class="sample-card__section-label">{{ productionTitle }}</h4>
<div v-if="!productionReception" class="sample-reception-dual-readonly__empty">
{{ productionEmptyHint }}
</div>
@@ -185,6 +185,16 @@
</script>
<style scoped lang="scss">
.sample-card__section-label {
margin: 0 0 10px;
padding-left: 10px;
font-size: 13px;
font-weight: 600;
line-height: 1.4;
color: #334155;
border-left: 3px solid #10b981;
}
.sample-reception-dual-readonly__block + .sample-reception-dual-readonly__block {
margin-top: 16px;
padding-top: 16px;
@@ -187,11 +187,13 @@
}
.sample-card__section-label {
font-size: 11px;
margin: 0 0 10px;
padding-left: 10px;
font-size: 13px;
font-weight: 600;
color: var(--mint-text-muted, #334155);
margin-bottom: 10px;
letter-spacing: 0.3px;
line-height: 1.4;
color: #334155;
border-left: 3px solid #10b981;
}
.sample-storage-release-empty {
@@ -41,10 +41,10 @@
align="center"
header-align="center"
/>
<el-table-column label="样本类型" min-width="120" show-overflow-tooltip>
<el-table-column label="样本类型" min-width="120">
<template #default="{ row }">{{ sampleTypeName(row.sampleTypeId) }}</template>
</el-table-column>
<el-table-column label="样本编码" min-width="180" show-overflow-tooltip>
<el-table-column label="样本编码" min-width="180">
<template #default="{ row }">
<SampleCodeWithSpecialDisplay
:sample-code="row.sampleCode"
@@ -89,13 +89,13 @@
<span v-else>—</span>
</template>
</el-table-column>
<el-table-column label="特殊说明" min-width="140" show-overflow-tooltip>
<el-table-column label="特殊说明" min-width="140">
<template #default="{ row }">
<span v-if="row.isSpecial">{{ row.specialRemark || '—' }}</span>
<span v-else>—</span>
</template>
</el-table-column>
<el-table-column label="运输方式" min-width="120" show-overflow-tooltip>
<el-table-column label="运输方式" min-width="120">
<template #default="{ row }">{{ freightModeLabel(row) }}</template>
</el-table-column>
<el-table-column
@@ -103,13 +103,12 @@
min-width="120"
align="right"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ freightAmountText(row) }}</template>
</el-table-column>
<el-table-column
label="操作"
min-width="260"
min-width="180"
fixed="right"
align="center"
header-align="center"
@@ -132,7 +131,7 @@
<el-dialog
v-model="sampleDialogVisible"
:title="sampleDialogMode === 'add' ? '添加样本' : '编辑样本'"
width="840px"
width="980px"
class="dialog-form-layout"
align-center
modal-class="protocol-dialog-mask"
@@ -148,7 +147,7 @@
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
<div class="form-grid-2">
<div class="form-grid-3">
<el-form-item label="样本类型">
<el-select
v-model="sampleDraft.sampleTypeId"
@@ -268,7 +267,7 @@
<el-dialog
v-model="freightDialogVisible"
title="配置运费"
width="720px"
width="1020px"
class="dialog-form-layout"
align-center
modal-class="protocol-dialog-mask"
@@ -308,41 +307,39 @@
</el-form-item>
</div>
</el-form>
<div v-else class="list-body list-wrap">
<el-table
:data="existingFreightList"
stripe
class="list-table inner-table"
highlight-current-row
@current-change="onExistingFreightSelect"
>
<el-table-column label="运输方式" min-width="120" show-overflow-tooltip>
<template #default="{ row }">
{{ row.transportModeLabel || row.transportMode || '—' }}
</template>
</el-table-column>
<el-table-column label="运费(元)" min-width="100" align="right" header-align="center">
<template #default="{ row }">{{ fmtMoney(row.freightAmount) }}</template>
</el-table-column>
<el-table-column
label="关联样本数"
min-width="96"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.linkedSampleCount ?? 0 }}</template>
</el-table-column>
<el-table-column label="创建时间" min-width="160" show-overflow-tooltip>
<template #default="{ row }">{{ row.createTime || '—' }}</template>
</el-table-column>
</el-table>
<div v-else class="link-existing-block">
<div class="sample-pick-toolbar" style="margin-bottom: 10px">
<el-input
v-model="existingFreightKeyword"
placeholder="运输方式/协议单号/样本编码"
clearable
style="width: 260px"
@keyup.enter="reloadExistingFreights"
/>
<el-button class="btn-ghost" @click="reloadExistingFreights">
<el-icon><Search /></el-icon>
搜索
</el-button>
</div>
<SampleFreightPickTable
v-model="selectedFreightId"
:list="existingFreightList"
:loading="existingFreightLoading"
:max-height="320"
@select="onExistingFreightSelect"
/>
</div>
<template #footer>
<el-button class="btn-ghost" @click="freightDialogVisible = false">
<el-icon><Close /></el-icon>
取消
</el-button>
<el-button class="btn-main" type="primary" :loading="freightSubmitting" @click="confirmFreight">
<el-button
class="btn-main"
type="primary"
:loading="freightSubmitting"
@click="confirmFreight"
>
<el-icon><Check /></el-icon>
确定应用
</el-button>
@@ -352,9 +349,10 @@
</template>
<script setup lang="ts">
import { Plus, Edit, Delete, Close, Check, Van } from '@element-plus/icons-vue'
import { Plus, Edit, Delete, Close, Check, Van, Search } from '@element-plus/icons-vue'
import AmountInput from '@/components/common/amount-input/index.vue'
import SampleCodeWithSpecialDisplay from '@/components/business/sample-code-with-special-display/index.vue'
import SampleFreightPickTable from '@/components/business/sample-freight-pick-table/index.vue'
import { sampleStatusLabel, sampleStatusTagType } from '@/utils/status-tag-registry'
import { formatMoneyDisplay } from '@/utils/money-format'
import { fetchDictDataOptions } from '@/api/admin'
@@ -437,7 +435,10 @@
})
const transportModeOptions = ref<Array<{ label: string; value: string }>>([])
const existingFreightList = ref<SampleFreight[]>([])
const existingFreightLoading = ref(false)
const existingFreightKeyword = ref('')
const selectedExistingFreight = ref<SampleFreight | null>(null)
const selectedFreightId = ref('')
const sampleDialogVisible = ref(false)
const sampleDialogMode = ref<'add' | 'edit'>('add')
@@ -692,6 +693,24 @@
selectedSamples.value = rows
}
async function reloadExistingFreights() {
existingFreightLoading.value = true
try {
const res = await fetchSampleFreightList({
page: 1,
pageSize: 50,
includeItems: true,
keyword: existingFreightKeyword.value || undefined
})
const data = (res as any)?.data || res
existingFreightList.value = data?.list || []
} catch {
existingFreightList.value = []
} finally {
existingFreightLoading.value = false
}
}
async function openFreightDialog() {
if (!selectedSamples.value.length) {
ElMessage.warning('请先勾选需要配置运费的样本')
@@ -701,19 +720,16 @@
freightForm.transportMode = ''
freightForm.freightAmount = null
selectedExistingFreight.value = null
selectedFreightId.value = ''
existingFreightKeyword.value = ''
await loadTransportModeOptions()
try {
const res = await fetchSampleFreightList({ page: 1, pageSize: 50 })
const data = (res as any)?.data || res
existingFreightList.value = data?.list || []
} catch {
existingFreightList.value = []
}
await reloadExistingFreights()
freightDialogVisible.value = true
}
function onExistingFreightSelect(row: SampleFreight | null) {
selectedExistingFreight.value = row
selectedFreightId.value = row?.id || ''
}
async function confirmFreight() {
@@ -951,6 +967,14 @@
.sample-transport-table-wrap {
margin-top: 0;
:deep(.list-table .el-table__cell .cell) {
white-space: normal;
word-break: break-word;
overflow: visible;
text-overflow: unset;
line-height: 1.4;
}
}
}
@@ -965,6 +989,13 @@
margin-top: 0;
}
.sample-pick-toolbar {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
}
.sample-transport-form-row {
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
@@ -244,8 +244,8 @@
sections: ViewSection[]
/** 弹窗宽度,默认 720px */
width?: string
/** 字段栅格列数,默认 2 */
gridColumns?: 2 | 3 | 4
/** 字段栅格列数,默认 2;上限 5(与 OpenSpec form-grid 一致) */
gridColumns?: 2 | 3 | 4 | 5
/** 挂到 body,用于嵌套在其它弹窗内时叠层展示 */
appendToBody?: boolean
/** 遮罩类名(可配合全局样式提高 z-index) */
@@ -402,6 +402,10 @@
&--cols-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
&--cols-5 {
grid-template-columns: repeat(5, minmax(0, 1fr));
}
}
.view-kv {
@@ -482,15 +486,23 @@
line-height: 1.5;
}
@media (max-width: 1280px) {
.view-kv-grid--cols-5 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
@media (max-width: 1100px) {
.view-kv-grid--cols-4 {
.view-kv-grid--cols-4,
.view-kv-grid--cols-5 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
@media (max-width: 900px) {
.view-kv-grid--cols-3,
.view-kv-grid--cols-4 {
.view-kv-grid--cols-4,
.view-kv-grid--cols-5 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
@@ -512,7 +524,8 @@
@media (max-width: 640px) {
.view-kv-grid,
.view-kv-grid--cols-3,
.view-kv-grid--cols-4 {
.view-kv-grid--cols-4,
.view-kv-grid--cols-5 {
grid-template-columns: 1fr;
}
}
@@ -25,7 +25,7 @@
<div v-show="panelOpen" class="oa-icon-picker__panel">
<div class="oa-icon-picker__panel-head">
<strong>图标</strong>
<el-button class="btn-ghost" style="height: 24px" @click="panelOpen = false">收起</el-button>
<el-button class="btn-ghost" style="height: 24px" @click="panelOpen = false"><el-icon><ArrowUp /></el-icon>收起</el-button>
</div>
<div class="oa-icon-picker__grid">
<button
@@ -83,7 +83,8 @@
Upload,
User,
Van,
Wallet
Wallet,
ArrowUp
} from '@element-plus/icons-vue'
import { fetchUploadAttachment } from '@/api/business'
import OaAppIcon from '@/components/oa-approval/OaAppIcon.vue'
@@ -21,6 +21,7 @@
<Upload />
</el-icon>
<el-button v-else type="primary">
<el-icon><Upload /></el-icon>
{{ uploadButtonText }}
</el-button>
</slot>
@@ -49,6 +49,7 @@
type="danger"
@click="removeId(item.id)"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
</div>
@@ -232,7 +233,7 @@
<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { Check, Close, Plus, Search } from '@element-plus/icons-vue'
import { Check, Close, Plus, Search, Delete } from '@element-plus/icons-vue'
import {
fetchOaRelatedCandidates,
fetchOaRelatedSummaries,
@@ -22,6 +22,7 @@
/>
<p v-if="confirmationDateManualFields.length" class="oa-start__tip oa-start__confirm-relink">
<el-button link type="primary" @click="restoreConfirmationDateAuto">
<el-icon><RefreshLeft /></el-icon>
恢复转正日期自动计算
</el-button>
</p>
@@ -76,7 +77,7 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { Check, Close, Document, RefreshRight } from '@element-plus/icons-vue'
import { Check, Close, Document, RefreshRight, RefreshLeft } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import { fetchUserList } from '@/api/admin'
import { fetchCnHolidayRange } from '@/api/cnHoliday'
+14 -3
View File
@@ -7,7 +7,7 @@ import type { AppRouteRecord } from '@/types/router'
export const sqxpAdminRoutes: AppRouteRecord[] = [
// ═══════════════════════════════════════════════════════════════════════════
// 1. 市场 (menu:market)
// 二级菜单:细胞存储、科研捐赠、市场基础信息、中试服务、基础实验
// 二级菜单:存储服务、科研捐赠、市场基础信息、中试服务、基础实验
// (主推存储/捐赠在前;中试/基础实验及关联基础信息后置)
// ═══════════════════════════════════════════════════════════════════════════
{
@@ -24,14 +24,14 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
roles: ['admin']
},
children: [
// ── 细胞存储 ──────────────────────────────────────────────────────────
// ── 存储服务(含细胞存储 / 科研捐赠统一业务入口)────────────────────────
{
id: 'CEL00000000000000000000000000001',
name: 'CellStorage',
path: 'cell-storage',
component: '',
meta: {
title: '细胞存储',
title: '存储服务',
icon: 'ri:test-tube-line',
keepAlive: false,
roles: ['admin']
@@ -82,6 +82,17 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
menuCode: 'cellStorage:paymentInfo:list'
}
},
{
id: '50000000000000000000000000000022',
name: 'CellStoragePaymentChase',
path: 'payment-chase',
component: '/cell-storage/payment-chase/index',
meta: {
title: '催缴信息',
keepAlive: true,
menuCode: 'cellStorage:paymentChase:list'
}
},
{
id: '50000000000000000000000000000013',
name: 'CellStorageSampleInfo',
+4
View File
@@ -502,6 +502,10 @@ declare namespace Api {
sex: string
idCardNo: string
age: number | null
birthYm: string
ethnic: string
email: string
address: string
phoneNo: string
customerTags: string
tenantNo: string
+2 -5
View File
@@ -5,8 +5,8 @@ export function looksLikeDateTime(value: unknown): boolean {
}
/**
* 展示用日期时间:若时分秒均为 0(或无时间部分)则只显示 YYYY-MM-DD;
* 否则保留有意义的时间部分。
* 展示用日期时间:若时分均为 0(或无时间部分)则只显示 YYYY-MM-DD;
* 否则显示到时分(不含秒)。
*/
export function formatDateTimeDisplay(value: string | number | null | undefined): string {
const s = String(value ?? '').trim()
@@ -22,9 +22,6 @@ export function formatDateTimeDisplay(value: string | number | null | undefined)
if (hh === '00' && mm === '00' && ss.startsWith('00')) {
return date
}
if (ss && ss !== '00') {
return `${date} ${hh}:${mm}:${ss.slice(0, 2)}`
}
return `${date} ${hh}:${mm}`
}
@@ -1,350 +0,0 @@
import { parseChineseDatetimeText } from '@/utils/chinese-datetime-parse'
import { parseBirthOrder } from '@/utils/chinese-numeral-parse'
import { extractNumericPart } from '@/utils/numeric-input-parse'
import {
SAMPLE_TYPE_PERINATAL_HSC,
SAMPLE_TYPE_UC_MSC
} from '@/utils/sample-production-reception-fields'
export type DonationSampleImportHint = {
typeKey: 'hsc' | 'uc_msc'
typeName: string
collectTime: string
}
export type DonationStandardImportParsed = {
sampleTypeHeader: string
sampleHints: DonationSampleImportHint[]
motherName?: string
newbornSex?: '1' | '0'
newbornWeightGram?: number | null
apgarScore?: number | null
newbornDeliveryTime?: string
/** 协议级样本采集时间:多样本时为各 hint 最早时间 */
sampleCollectTime?: string
maternalBloodCollectTime?: string
maternalBloodExplicitEmpty?: boolean
deliveryMode?: string
birthOrder?: number | null
medicalStaff?: string
hospitalName?: string
/** @deprecated 使用 transportModeText */
transportExpressName?: string
transportModeText?: string
transportType?: 'kdys' | 'ryxd'
salesUserName?: string
}
type CommonFieldKey = keyof Omit<
DonationStandardImportParsed,
'sampleTypeHeader' | 'sampleHints' | 'transportExpressName' | 'transportModeText' | 'transportType'
>
const KEY_ALIASES: Record<string, CommonFieldKey> = {
产妇姓名: 'motherName',
母亲姓名: 'motherName',
新生儿性别: 'newbornSex',
新生儿体重: 'newbornWeightGram',
'新生儿体重(克)': 'newbornWeightGram',
新生儿评分: 'apgarScore',
'新生儿评分1分钟': 'apgarScore',
'新生儿评分5分钟': 'apgarScore',
分娩时间: 'newbornDeliveryTime',
新生儿分娩时间: 'newbornDeliveryTime',
母血采集时间: 'maternalBloodCollectTime',
分娩方式: 'deliveryMode',
胎次: 'birthOrder',
采集医护: 'medicalStaff',
采集医院: 'hospitalName',
运输方式: 'transportModeText',
销售人员: 'salesUserName',
采集专员: 'salesUserName'
}
const MATERNAL_BLOOD_EMPTY_MARKERS = ['未采集', '无', '暂无', '—', '-', '未采']
function normalizeLine(line: string): string {
return line
.replace(/^[\s【】]+|[\s【】]+$/g, '')
.trim()
}
function splitKeyValue(line: string): { key: string; value: string } | null {
const match = line.match(/^([^::]+)[::]\s*(.*)$/)
if (!match) return null
return { key: match[1].trim(), value: match[2].trim() }
}
function resolveSampleCollectHint(key: string): Omit<DonationSampleImportHint, 'collectTime'> | null {
const k = key.trim()
if (/脐带采集时间/.test(k)) {
return { typeKey: 'uc_msc', typeName: SAMPLE_TYPE_UC_MSC }
}
if (/造血干细胞.*采集时间/.test(k) || k === '样本采集时间') {
return { typeKey: 'hsc', typeName: SAMPLE_TYPE_PERINATAL_HSC }
}
return null
}
function parseSex(value: string): '1' | '0' | undefined {
const v = value.trim()
if (!v) return undefined
if (/^男|^男孩/.test(v)) return '1'
if (/^女|^女孩/.test(v)) return '0'
return undefined
}
function parseDeliveryMode(value: string): string | undefined {
const v = value.trim()
if (!v) return undefined
if (/剖宫产|剖腹产|刨宫产/.test(v)) return 'pgc'
if (/顺产|自然分娩/.test(v)) return 'sc'
return undefined
}
function parseWeightGram(value: string): number | null | undefined {
const v = value.trim()
if (!v) return undefined
const num = extractNumericPart(v)
if (num === '' || num == null) return undefined
const n = Number(num)
return Number.isFinite(n) ? n : undefined
}
function parseScore(value: string): number | null | undefined {
const v = value.trim()
if (!v) return undefined
const num = extractNumericPart(v)
if (num === '' || num == null) return undefined
const n = Number(num)
return Number.isFinite(n) ? n : undefined
}
function parseDatetime(value: string, minutePrecision = false): string | undefined {
const v = value.trim()
if (!v) return undefined
if (MATERNAL_BLOOD_EMPTY_MARKERS.some((m) => v === m || v.includes(m))) {
return undefined
}
return (
parseChineseDatetimeText(v, minutePrecision ? 'datetime-minute' : 'datetime') || undefined
)
}
function isMaternalBloodEmpty(value: string): boolean {
const v = value.trim()
if (!v) return true
return MATERNAL_BLOOD_EMPTY_MARKERS.some((m) => v === m || v.includes(m))
}
/** 运输方式文本 → 系统 transportType */
export function resolveTransportType(text: string): 'kdys' | 'ryxd' | null {
const v = (text || '').trim()
if (!v) return null
// 「顺丰车」为「顺风车」笔误,须先于「顺丰」快递匹配
if (/顺风车|顺丰车|自行携带|人员携带|自带|自送|亲自送|自驾/.test(v)) return 'ryxd'
if (/帮助|取样本|送到实验室|专人送|送到/.test(v)) return 'ryxd'
if (/快递|顺丰|圆通|中通|韵达|申通|EMS|邮政|极兔|京东|德邦/.test(v)) return 'kdys'
return null
}
function addSampleHint(
hints: DonationSampleImportHint[],
meta: Omit<DonationSampleImportHint, 'collectTime'>,
collectTime: string
) {
if (hints.some((h) => h.typeKey === meta.typeKey)) return
hints.push({ ...meta, collectTime })
}
function earliestCollectTime(hints: DonationSampleImportHint[]): string | undefined {
if (!hints.length) return undefined
return hints
.map((h) => h.collectTime)
.sort((a, b) => a.localeCompare(b))[0]
}
/** 解析捐赠协议单一键导入标准文本 */
export function parseDonationStandardImportText(text: string): DonationStandardImportParsed | null {
const raw = (text || '').trim()
if (!raw) return null
const lines = raw
.split(/\r?\n/)
.map(normalizeLine)
.filter(Boolean)
if (!lines.length) return null
const result: DonationStandardImportParsed = {
sampleTypeHeader: lines[0],
sampleHints: []
}
for (let i = 1; i < lines.length; i++) {
const kv = splitKeyValue(lines[i])
if (!kv) continue
const sampleMeta = resolveSampleCollectHint(kv.key)
if (sampleMeta) {
const dt = parseDatetime(kv.value, true)
if (dt) addSampleHint(result.sampleHints, sampleMeta, dt)
continue
}
const field = KEY_ALIASES[kv.key]
if (!field) continue
switch (field) {
case 'motherName':
result.motherName = kv.value
break
case 'newbornSex': {
const sex = parseSex(kv.value)
if (sex) result.newbornSex = sex
break
}
case 'newbornWeightGram': {
const w = parseWeightGram(kv.value)
if (w !== undefined) result.newbornWeightGram = w
break
}
case 'apgarScore': {
const s = parseScore(kv.value)
if (s !== undefined) result.apgarScore = s
break
}
case 'newbornDeliveryTime': {
const dt = parseDatetime(kv.value)
if (dt) result.newbornDeliveryTime = dt
break
}
case 'maternalBloodCollectTime':
if (isMaternalBloodEmpty(kv.value)) {
result.maternalBloodExplicitEmpty = true
} else {
const dt = parseDatetime(kv.value, true)
if (dt) result.maternalBloodCollectTime = dt
}
break
case 'deliveryMode': {
const mode = parseDeliveryMode(kv.value)
if (mode) result.deliveryMode = mode
break
}
case 'birthOrder': {
const n = parseBirthOrder(kv.value)
if (n !== undefined) result.birthOrder = n
break
}
case 'medicalStaff':
result.medicalStaff = kv.value
break
case 'hospitalName':
if (!result.hospitalName) result.hospitalName = kv.value
break
case 'transportModeText': {
result.transportModeText = kv.value
result.transportExpressName = kv.value
result.transportType = resolveTransportType(kv.value) ?? undefined
break
}
case 'salesUserName':
result.salesUserName = kv.value
break
default:
break
}
}
if (result.sampleHints.length) {
result.sampleCollectTime = earliestCollectTime(result.sampleHints)
}
return result
}
type CellSampleTypeOption = { id: string; typeName: string; storageYears?: number | null }
const SAMPLE_TYPE_SEGMENTS = ['围产期', '造血', '干细胞', '脐带', '间充质', '胎盘', '亚全能', '捐献']
/** 按类型名称精确或包含匹配 */
export function matchSampleTypeByExactName(
typeName: string,
types: CellSampleTypeOption[]
): CellSampleTypeOption | null {
const target = (typeName || '').trim()
if (!target || !types.length) return null
const exact = types.find((t) => t.typeName === target)
if (exact) return exact
const contains = types.filter(
(t) => t.typeName.includes(target) || target.includes(t.typeName)
)
if (contains.length === 1) return contains[0]
return matchCellSampleType(target, types)
}
/** 根据首行文本与细胞样本类型列表做语义匹配 */
export function matchCellSampleType(
headerLine: string,
types: CellSampleTypeOption[]
): CellSampleTypeOption | null {
const header = normalizeLine(headerLine)
if (!header || !types.length) return null
let best: CellSampleTypeOption | null = null
let bestScore = 0
for (const t of types) {
const name = t.typeName || ''
let score = 0
for (const seg of SAMPLE_TYPE_SEGMENTS) {
if (header.includes(seg) && name.includes(seg)) score += 2
}
if (header.includes('围产期') && name.includes('围产期')) score += 3
if (header.includes('捐献') && name.includes('造血')) score += 2
if (header.includes('间充质') && name.includes('间充质')) score += 3
if (header.includes('胎盘') && name.includes('胎盘')) score += 3
if (header.includes('亚全能') && name.includes('亚全能')) score += 2
if (score > bestScore) {
bestScore = score
best = t
}
}
return bestScore > 0 ? best : null
}
/** 在快递公司列表中匹配名称(优先完全匹配,否则包含匹配) */
export function matchExpressCompany(
name: string,
companies: Array<{ id: string; expressName: string }>
): { id: string; expressName: string } | null {
const target = (name || '').trim()
if (!target || !companies.length) return null
const exact = companies.find((c) => c.expressName === target)
if (exact) return exact
const normalized = target.replace(/快递$/, '')
const contains = companies.filter(
(c) => c.expressName.includes(target) || c.expressName.includes(normalized)
)
if (contains.length === 1) return contains[0]
const sf = companies.find((c) => /顺丰/.test(c.expressName) && /顺丰/.test(target))
if (sf) return sf
return contains[0] || null
}
export function isBlankString(val: unknown): boolean {
return val == null || String(val).trim() === ''
}
export function isEmptyNumber(val: unknown): boolean {
return val == null || val === ''
}
@@ -59,6 +59,17 @@ describe('flattenProtocolAuditRows', () => {
assert.equal(rows.length, 1)
assert.equal(rows[0].isCoStored, false)
})
it('donationNo maps to protocolNo', () => {
const rows = flattenProtocolAuditRows([
{
id: 'd1',
donationNo: 'JZ-001',
sampleItems: [{ sampleTypeName: '脐带血', sampleCode: 'D1', labStorageCode: 'B9' }]
}
])
assert.equal(rows[0].protocolNo, 'JZ-001')
})
})
describe('uniqueProtocolsFromFlatRows', () => {
@@ -80,19 +91,41 @@ describe('uniqueProtocolsFromFlatRows', () => {
})
describe('firstPayTimeLines', () => {
it('prefers transferTime then dueDate; stacks multiple', () => {
it('prefers firstPayTransferTime from summary', () => {
const lines = firstPayTimeLines({
firstPayTransferTime: '2025-09-20 14:30:00',
paymentDetails: [
{ installmentNo: 1, transferTime: '2025-09-15 09:20:00', installmentDueDate: '2025-09-01' },
{ installmentNo: 1, transferTime: '2025-09-15 09:20:00' },
{ installmentNo: 2, transferTime: '2025-10-15 10:05:00' }
]
})
assert.deepEqual(lines, ['2025-09-15 09:20:00', '2025-10-15 10:05:00'])
assert.deepEqual(lines, ['2025-09-20 14:30:00'])
})
it('falls back to dueDate when no transferTime', () => {
it('only first period; ignores later installments', () => {
const lines = firstPayTimeLines({
paymentDetails: [
{ installmentNo: 1, transferTime: '2025-09-15 09:20:00', installmentDueDate: '2025-09-01' },
{ installmentNo: 2, transferTime: '2025-10-15 10:05:00' },
{ installmentNo: 3, transferTime: '2025-11-15 11:00:00' }
]
})
assert.deepEqual(lines, ['2025-09-15 09:20:00'])
})
it('among period-1 transfers picks the latest transferTime', () => {
const lines = firstPayTimeLines({
paymentDetails: [
{ installmentNo: 1, transferTime: '2025-09-15 09:20:00' },
{ installmentNo: 1, transferTime: '2025-09-20 14:30:00' },
{ installmentNo: 1, transferTime: '2025-09-18 08:00:00' },
{ installmentNo: 2, transferTime: '2025-10-15 10:05:00' }
]
})
assert.deepEqual(lines, ['2025-09-20 14:30:00'])
})
it('empty when period 1 has no transferTime', () => {
const lines = firstPayTimeLines({
paymentDetails: [{ installmentNo: 1, installmentDueDate: '2025-09-01' }]
})
assert.deepEqual(lines, ['2025-09-01'])
assert.deepEqual(lines, [])
})
})
+37 -19
View File
@@ -1,6 +1,8 @@
import type { CollectionProtocolRow } from '../api/collection-protocol'
import type { QcProtocolPaymentSummary } from '../api/qc-work-order'
/** 细胞存储协议 / 科研捐赠列表行(均为 Record) */
export type ProtocolAuditSourceRow = Record<string, unknown>
export type ProtocolAuditSampleTransport = {
transportType?: string
destSiteName?: string
@@ -14,13 +16,14 @@ export type ProtocolAuditSampleTransport = {
export type ProtocolAuditFlatRow = {
rowKey: string
protocolId: string
protocol: CollectionProtocolRow
protocol: ProtocolAuditSourceRow
sampleCount: number
sampleIndex: number
isCoStored: boolean
collectDate: string
sampleCollectTime: string
motherName: string
/** 协议编号或捐赠单号 */
protocolNo: string
regionName: string
hospitalName: string
@@ -49,7 +52,7 @@ export function extractCollectDate(raw?: string | null): string {
return m ? m[1] : ''
}
function readSampleItems(protocol: CollectionProtocolRow): Record<string, unknown>[] {
function readSampleItems(protocol: ProtocolAuditSourceRow): Record<string, unknown>[] {
const raw = protocol.sampleItems
if (Array.isArray(raw) && raw.length) {
return raw.map((x) => asRecord(x) || {})
@@ -58,7 +61,7 @@ function readSampleItems(protocol: CollectionProtocolRow): Record<string, unknow
}
export function flattenProtocolAuditRows(
list: CollectionProtocolRow[]
list: ProtocolAuditSourceRow[]
): ProtocolAuditFlatRow[] {
const out: ProtocolAuditFlatRow[] = []
for (const protocol of list || []) {
@@ -81,7 +84,7 @@ export function flattenProtocolAuditRows(
collectDate: extractCollectDate(str(protocol.sampleCollectTime)),
sampleCollectTime: str(protocol.sampleCollectTime),
motherName: str(protocol.motherName),
protocolNo: str(protocol.protocolNo),
protocolNo: str(protocol.protocolNo) || str(protocol.donationNo),
regionName: str(protocol.regionName),
hospitalName: str(protocol.hospitalName),
salesUserName: str(protocol.salesUserName),
@@ -103,9 +106,9 @@ export function flattenProtocolAuditRows(
export function uniqueProtocolsFromFlatRows(
rows: ProtocolAuditFlatRow[]
): CollectionProtocolRow[] {
): ProtocolAuditSourceRow[] {
const seen = new Set<string>()
const out: CollectionProtocolRow[] = []
const out: ProtocolAuditSourceRow[] = []
for (const r of rows) {
if (!r.protocolId || seen.has(r.protocolId)) continue
seen.add(r.protocolId)
@@ -114,22 +117,37 @@ export function uniqueProtocolsFromFlatRows(
return out
}
/**
* 首期缴费时间:优先用后端 firstPayTransferTime(第 1 期转账最后一笔);
* 否则从 paymentDetails 中取第 1 期 transferTime 最晚的一笔。
* 无转账时间时返回空(不回退应缴日)。
*/
export function firstPayTimeLines(
summary: QcProtocolPaymentSummary | null | undefined
): string[] {
const preferred = str(summary?.firstPayTransferTime)
if (preferred) return [preferred]
const details = summary?.paymentDetails
if (!Array.isArray(details) || !details.length) return []
const sorted = [...details].sort((a, b) => {
const na = a.installmentNo == null ? 10_000 : Number(a.installmentNo)
const nb = b.installmentNo == null ? 10_000 : Number(b.installmentNo)
return na - nb
})
const lines: string[] = []
for (const d of sorted) {
const t = str((d as { transferTime?: string }).transferTime)
const due = str(d.installmentDueDate)
const pick = t || due
if (pick) lines.push(pick)
const numbered = details.filter(
(d) => d.installmentNo != null && String(d.installmentNo).trim() !== ''
)
let periodRows = details
if (numbered.some((d) => Number(d.installmentNo) === 1)) {
periodRows = details.filter((d) => Number(d.installmentNo) === 1)
} else if (numbered.length) {
const minNo = Math.min(...numbered.map((d) => Number(d.installmentNo)))
periodRows = details.filter((d) => Number(d.installmentNo) === minNo)
} else {
periodRows = [details[0]]
}
return lines
const times = periodRows
.map((d) => str(d.transferTime))
.filter(Boolean)
.sort()
if (!times.length) return []
return [times[times.length - 1]]
}
@@ -125,7 +125,10 @@ export function buildProtocolPaymentFlowSteps(
time: receiptSubmitTime(d),
fields: [
{ label: '转账方式', value: transferTypeLabel(String(d.transferType || '')) || '—' },
{ label: '实缴金额(元)', value: formatAmount(d.transferAmount) },
{
label: d.source === 'presign' ? '缴费金额(元)' : '实缴金额(元)',
value: formatAmount(d.transferAmount)
},
{ label: '转账时间', value: dash(d.transferTime) },
{ label: '备注', value: dash(d.remark), multiline: true },
{
@@ -1,55 +1,23 @@
/** 采集协议单 · 缴费默认定价表(样本数 × 缴费模式) */
/** 采集协议单 · 缴费模式工具(已废除硬编码价目表) */
export type PayMode = 'dj' | 'fq' | 'djfq'
export type PaymentPreset = {
contractAmount: number
installmentCount?: number
installmentAmounts?: number[]
}
const PRESETS: Record<1 | 2, Partial<Record<PayMode, PaymentPreset>>> = {
1: {
dj: { contractAmount: 22880 },
fq: {
contractAmount: 25880,
installmentCount: 6,
installmentAmounts: [6480, 3880, 3880, 3880, 3880, 3880]
}
},
2: {
dj: { contractAmount: 37880 },
djfq: {
contractAmount: 41000,
installmentCount: 4,
installmentAmounts: [29360, 3880, 3880, 3880]
},
fq: {
contractAmount: 44000,
installmentCount: 5,
installmentAmounts: [12960, 7760, 7760, 7760, 7760]
}
}
}
export type PayMode = 'dj' | 'fq' | 'djfq' | 'fgd'
export function getActiveSampleCount(samples: Array<{ sampleStatus?: string }>): 1 | 2 {
const n = samples.filter((s) => String(s.sampleStatus || '') !== 'yzf').length
return (n >= 2 ? 2 : 1) as 1 | 2
}
export function resolvePaymentPreset(
sampleCount: 1 | 2,
payMode: PayMode
): PaymentPreset | null {
return PRESETS[sampleCount]?.[payMode] ?? null
}
export function isInstallmentPayMode(payMode: string): boolean {
return payMode === 'fq' || payMode === 'djfq'
}
/** 需要配置多期 schedule 的模式(分期 / 趸交+分期 / 分改趸) */
export function isMultiSchedulePayMode(payMode: string): boolean {
return payMode === 'fq' || payMode === 'djfq' || payMode === 'fgd'
}
export function availablePayModes(sampleCount: 1 | 2): PayMode[] {
return sampleCount === 2 ? ['dj', 'djfq', 'fq'] : ['dj', 'fq']
return sampleCount === 2 ? ['dj', 'djfq', 'fq', 'fgd'] : ['dj', 'fq', 'fgd']
}
/** 校验缴费模式与样本数是否匹配(如 djfq 仅双样本) */
@@ -0,0 +1,333 @@
// web-admin/src/utils/protocol-sample-payment.test.ts
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import {
parsePreferentialPrice,
resolveSampleContractAmount,
resolvePerSamplePaymentDefaults,
shouldReplaceContractWithPreferentialPrice,
sampleScheduleRequiredFieldsHint,
sampleScheduleDuesMismatchHint,
sumSampleContractAmounts,
schedulePaidArrears,
planFqToFgdMerge,
applyFqToFgdMergeToPayment,
applyConsolidateRemainingToPayment,
applyExpandRemainingToInstallment,
availableSamplePayModes,
samplePaymentHasConfirmedTransfer
} from './protocol-sample-payment'
describe('parsePreferentialPrice', () => {
it('reads sample.price as preferential amount', () => {
assert.equal(parsePreferentialPrice({ price: 20000 }), 20000)
assert.equal(parsePreferentialPrice({ price: '22000' }), 22000)
})
it('null/empty → null', () => {
assert.equal(parsePreferentialPrice({ price: null }), null)
assert.equal(parsePreferentialPrice({ price: '' }), null)
assert.equal(parsePreferentialPrice({}), null)
assert.equal(parsePreferentialPrice(null), null)
})
})
describe('resolveSampleContractAmount', () => {
it('uses preferential price when set', () => {
assert.equal(resolveSampleContractAmount({ price: 20000 }), 20000)
assert.equal(resolveSampleContractAmount({ price: 22000 }), 22000)
})
it('no fallback to hardcoded price table', () => {
assert.equal(resolveSampleContractAmount({}), null)
assert.equal(resolveSampleContractAmount({ price: null }), null)
})
})
describe('resolvePerSamplePaymentDefaults', () => {
it('dj defaults contract to preferential price', () => {
const d = resolvePerSamplePaymentDefaults({ price: 20000 }, 'dj')
assert.equal(d.contractAmount, 20000)
assert.equal(d.installmentCount, undefined)
})
it('fq has structural count but empty installment amounts', () => {
const d = resolvePerSamplePaymentDefaults({ price: 20000 }, 'fq')
assert.equal(d.contractAmount, 20000)
assert.equal(d.installmentCount, 6)
assert.deepEqual(d.installmentAmounts, [])
})
})
describe('shouldReplaceContractWithPreferentialPrice', () => {
it('only replaces null/empty contract', () => {
assert.equal(shouldReplaceContractWithPreferentialPrice(null, 20000), true)
assert.equal(shouldReplaceContractWithPreferentialPrice(22880, 20000), false)
assert.equal(shouldReplaceContractWithPreferentialPrice(18000, 20000), false)
})
})
describe('sampleScheduleRequiredFieldsHint', () => {
it('requires amount and dueDate for each fq period', () => {
const hint = sampleScheduleRequiredFieldsHint({
sampleCode: 'A1',
payMode: 'fq',
contractAmount: 20000,
schedules: [
{ dueAmount: null, dueDate: '20261001', scheduleStatus: 'open' },
{ dueAmount: 10000, dueDate: '', scheduleStatus: 'open' }
]
})
assert.ok(hint)
assert.match(hint!, /应缴金额/)
})
it('ok when all periods filled', () => {
assert.equal(
sampleScheduleRequiredFieldsHint({
payMode: 'fq',
contractAmount: 20000,
schedules: [
{ dueAmount: 10000, dueDate: '20261001' },
{ dueAmount: 10000, dueDate: '20261101' }
]
}),
null
)
})
})
describe('sampleScheduleDuesMismatchHint', () => {
it('sum must equal contract', () => {
const hint = sampleScheduleDuesMismatchHint({
payMode: 'fq',
contractAmount: 20000,
schedules: [
{ dueAmount: 10000, dueDate: '20261001' },
{ dueAmount: 5000, dueDate: '20261101' }
]
})
assert.ok(hint)
})
})
describe('sumSampleContractAmounts', () => {
it('two samples 20000+22000 → 42000', () => {
const payments = [
{ contractAmount: resolveSampleContractAmount({ price: 20000 }) },
{ contractAmount: resolveSampleContractAmount({ price: 22000 }) }
]
assert.equal(sumSampleContractAmounts(payments), 42000)
})
})
describe('schedulePaidArrears', () => {
it('display paid includes dfj + jfqrz + yjf', () => {
const { paid, arrears } = schedulePaidArrears(25880, [
{ payStatus: 'dfj', transferAmount: 480 },
{ payStatus: 'dfj', transferAmount: 6000 },
{ payStatus: 'jfqrz', transferAmount: 100 },
{ payStatus: 'yjf', transferAmount: 200 },
{ payStatus: 'ytf', transferAmount: 50 }
])
assert.equal(paid, 6780)
assert.equal(arrears, 19100)
})
})
describe('planFqToFgdMerge', () => {
it('keeps paid periods and merges remaining into first unpaid', () => {
const schedules = [
{
id: 's1',
scheduleNo: 1,
dueAmount: 5000,
scheduleStatus: 'cleared',
transfers: [{ payStatus: 'yjf', transferAmount: 5000 }]
},
{
id: 's2',
scheduleNo: 2,
dueAmount: 5000,
scheduleStatus: 'cleared',
transfers: [{ payStatus: 'yjf', transferAmount: 5000 }]
},
{ id: 's3', scheduleNo: 3, dueAmount: 5000, scheduleStatus: 'open', transfers: [] },
{ id: 's4', scheduleNo: 4, dueAmount: 5000, scheduleStatus: 'open', transfers: [] },
{ id: 's5', scheduleNo: 5, dueAmount: 5000, scheduleStatus: 'open', transfers: [] },
{ id: 's6', scheduleNo: 6, dueAmount: 4800, scheduleStatus: 'open', transfers: [] }
]
const plan = planFqToFgdMerge(schedules)
assert.equal(plan.targetScheduleId, 's3')
assert.equal(plan.targetScheduleNo, 3)
assert.equal(plan.newDueAmount, 19800)
assert.deepEqual(plan.softDeleteScheduleIds, ['s4', 's5', 's6'])
assert.equal(plan.newInstallmentCount, 3)
})
it('rejects when a later period already has confirmed transfer', () => {
assert.throws(
() =>
planFqToFgdMerge([
{ id: 's1', scheduleNo: 1, dueAmount: 1000, transfers: [] },
{
id: 's2',
scheduleNo: 2,
dueAmount: 1000,
transfers: [{ payStatus: 'yjf', transferAmount: 1000 }]
}
]),
/后续期/
)
})
})
describe('applyFqToFgdMergeToPayment', () => {
it('updates payMode/count and drops later unpaid schedules', () => {
const next = applyFqToFgdMergeToPayment({
payMode: 'fq',
installmentCount: 6,
contractAmount: 29800,
schedules: [
{
id: 's1',
scheduleNo: 1,
dueAmount: 5000,
scheduleStatus: 'cleared',
transfers: [{ payStatus: 'yjf', transferAmount: 5000 }]
},
{
id: 's2',
scheduleNo: 2,
dueAmount: 5000,
scheduleStatus: 'cleared',
transfers: [{ payStatus: 'yjf', transferAmount: 5000 }]
},
{ id: 's3', scheduleNo: 3, dueAmount: 5000, scheduleStatus: 'open', transfers: [] },
{ id: 's4', scheduleNo: 4, dueAmount: 5000, scheduleStatus: 'open', transfers: [] },
{ id: 's5', scheduleNo: 5, dueAmount: 5000, scheduleStatus: 'open', transfers: [] },
{ id: 's6', scheduleNo: 6, dueAmount: 4800, scheduleStatus: 'open', transfers: [] }
]
})
assert.equal(next.payMode, 'fgd')
assert.equal(next.installmentCount, 3)
assert.equal(next.schedules.length, 3)
assert.equal(next.schedules[2].dueAmount, 19800)
assert.deepEqual(
next.schedules.map((s: { scheduleNo: number }) => s.scheduleNo),
[1, 2, 3]
)
})
})
describe('availableSamplePayModes', () => {
it('fq → dj/fgd allowed', () => {
assert.deepEqual(availableSamplePayModes({ payMode: 'fq' }), ['fq', 'dj', 'fgd'])
})
it('dj cannot switch to fgd', () => {
assert.deepEqual(availableSamplePayModes({ payMode: 'dj' }), ['dj', 'fq'])
})
it('fgd cannot switch to dj', () => {
assert.deepEqual(availableSamplePayModes({ payMode: 'fgd' }), ['fgd', 'fq'])
})
})
describe('applyConsolidateRemainingToPayment', () => {
it('fq→dj keeps paid and consolidates remaining', () => {
const next = applyConsolidateRemainingToPayment(
{
payMode: 'fq',
installmentCount: 6,
contractAmount: 29800,
schedules: [
{
id: 's1',
scheduleNo: 1,
dueAmount: 5000,
transfers: [{ payStatus: 'yjf', transferAmount: 5000 }]
},
{
id: 's2',
scheduleNo: 2,
dueAmount: 5000,
transfers: [{ payStatus: 'yjf', transferAmount: 5000 }]
},
{ id: 's3', scheduleNo: 3, dueAmount: 5000, transfers: [] },
{ id: 's4', scheduleNo: 4, dueAmount: 5000, transfers: [] },
{ id: 's5', scheduleNo: 5, dueAmount: 5000, transfers: [] },
{ id: 's6', scheduleNo: 6, dueAmount: 4800, transfers: [] }
]
},
'dj'
)
assert.equal(next.payMode, 'dj')
assert.equal(next.installmentCount, 3)
assert.equal(next.schedules.length, 3)
assert.equal(next.schedules[2].dueAmount, 19800)
})
})
describe('applyExpandRemainingToInstallment', () => {
it('dj partial paid → keep paid period and split remaining', () => {
const next = applyExpandRemainingToInstallment(
{
payMode: 'dj',
contractAmount: 12000,
schedules: [
{
id: 's1',
scheduleNo: 1,
dueAmount: 12000,
transfers: [{ payStatus: 'yjf', transferAmount: 4000 }]
}
]
},
{
installmentCount: 4,
installmentIntervalMonths: 1,
installmentStartDate: '20261001',
installmentAdvanceDays: 0
}
)
assert.equal(next.payMode, 'fq')
assert.equal(next.schedules[0].dueAmount, 4000)
assert.equal(next.schedules.length, 4) // 1 kept + 3 new (4-1)
const newSum = next.schedules.slice(1).reduce((s, x) => s + Number(x.dueAmount), 0)
assert.equal(newSum, 8000)
assert.equal(next.schedules[1].dueDate, '20261001')
})
it('rejects when already cleared', () => {
assert.throws(
() =>
applyExpandRemainingToInstallment(
{
payMode: 'dj',
contractAmount: 1000,
schedules: [
{
scheduleNo: 1,
dueAmount: 1000,
transfers: [{ payStatus: 'yjf', transferAmount: 1000 }]
}
]
},
{ installmentCount: 6, installmentIntervalMonths: 1, installmentStartDate: '20261001' }
),
/已缴清/
)
})
})
describe('samplePaymentHasConfirmedTransfer', () => {
it('detects yjf', () => {
assert.equal(
samplePaymentHasConfirmedTransfer({
schedules: [{ transfers: [{ payStatus: 'dfj' }] }]
}),
false
)
assert.equal(
samplePaymentHasConfirmedTransfer({
schedules: [{ transfers: [{ payStatus: 'yjf', transferAmount: 1 }] }]
}),
true
)
})
})
+353 -12
View File
@@ -1,4 +1,12 @@
/** 按样本缴费 · 工具函数(payment_model_version=2) */
/** 按样本缴费 · 工具函数(payment_model_version=2)
* 合同金额唯一来源:样本优惠价 price;不再使用硬编码价目表。
*/
import {
calcFqInstallmentDueDate,
defaultInstallmentAmounts,
DEFAULT_INSTALLMENT_ADVANCE_DAYS
} from '@/utils/protocol-payment-installment'
export type SamplePaymentLike = {
contractAmount?: number | null
@@ -7,6 +15,10 @@ export type SamplePaymentLike = {
schedules?: ScheduleLike[]
}
export type SamplePriceLike = {
price?: number | string | null
}
export type TransferLike = {
payStatus?: string
transferAmount?: number | null
@@ -14,6 +26,8 @@ export type TransferLike = {
export type ScheduleLike = {
dueAmount?: number | null
dueDate?: string | null
scheduleStatus?: string
transfers?: TransferLike[]
}
@@ -21,6 +35,18 @@ export function sumSampleContractAmounts(payments: SamplePaymentLike[]): number
return payments.reduce((s, p) => s + (Number(p.contractAmount) || 0), 0)
}
/** 样本优惠价格(元);未填返回 null */
export function parsePreferentialPrice(
sample: SamplePriceLike | null | undefined
): number | null {
if (sample == null) return null
const raw = sample.price
if (raw == null || raw === '') return null
const n = Number(raw)
if (!Number.isFinite(n) || n < 0) return null
return Math.round(n * 100) / 100
}
export function protocolTotalMismatchHint(
total: number | null | undefined,
sampleSum: number
@@ -32,31 +58,118 @@ export function protocolTotalMismatchHint(
return null
}
function activeSchedules(pay: SamplePaymentLike): ScheduleLike[] {
return (pay.schedules || []).filter((s) => String(s.scheduleStatus || 'open') !== 'void')
}
/** 分期/分改趸:每期应缴金额与应缴时间必填 */
export function sampleScheduleRequiredFieldsHint(pay: SamplePaymentLike): string | null {
const mode = String(pay.payMode || '')
if (mode !== 'fq' && mode !== 'fgd' && mode !== 'djfq') return null
const schedules = activeSchedules(pay)
if (!schedules.length) return null
const code = String(pay.sampleCode || '').trim()
const prefix = code ? `样本 ${code} ` : ''
for (let i = 0; i < schedules.length; i++) {
const s = schedules[i]
const amt = Number(s.dueAmount)
if (!Number.isFinite(amt) || amt <= 0) {
return `${prefix}第 ${i + 1} 期应缴金额必须填写`
}
if (!String(s.dueDate || '').trim()) {
return `${prefix}第 ${i + 1} 期应缴时间必须填写`
}
}
return null
}
/** 单样本:未作废期应缴合计须等于合同金额;不一致返回提示文案 */
export function sampleScheduleDuesMismatchHint(pay: SamplePaymentLike): string | null {
const contract = Number(pay.contractAmount)
if (!Number.isFinite(contract)) return null
const schedules = activeSchedules(pay)
if (!schedules.length) return null
const sum = schedules.reduce((acc, x) => acc + (Number(x.dueAmount) || 0), 0)
if (Math.abs(contract - sum) > 0.015) {
const code = String(pay.sampleCode || '').trim()
const prefix = code ? `样本 ${code} ` : ''
return `${prefix}合同金额 ${contract.toFixed(2)} 与各期应缴合计 ${sum.toFixed(2)} 不一致,请调整后再保存`
}
return null
}
/** 展示口径已缴:与后端 chase_period_money / 缴费信息期次一致 */
const DISPLAY_PAID_STATUSES = new Set(['dfj', 'jfqrz', 'yjf'])
function sumTransferAmountByStatuses(
transfers: TransferLike[] | undefined,
statuses: Set<string>
): number {
return (transfers || [])
.filter((t) => statuses.has(String(t.payStatus || '')))
.reduce((s, t) => s + (Number(t.transferAmount) || 0), 0)
}
/**
* 期次已缴/欠缴(展示):已缴 = dfj + jfqrz + yjf;欠缴 = max(应缴 − 已缴, 0)
*/
export function schedulePaidArrears(
dueAmount: number,
transfers: TransferLike[]
): { paid: number; arrears: number } {
const paid = (transfers || [])
.filter((t) => t.payStatus === 'yjf')
.reduce((s, t) => s + (Number(t.transferAmount) || 0), 0)
const paid = Math.round(sumTransferAmountByStatuses(transfers, DISPLAY_PAID_STATUSES) * 100) / 100
const arrears = Math.round((dueAmount - paid) * 100) / 100
return { paid, arrears: arrears > 0 ? arrears : 0 }
}
/** 财务已确认口径(仅 yjf):用于分改趸并期等与后端 plan_fq_to_fgd_merge 对齐 */
export function scheduleFinanceConfirmedPaidArrears(
dueAmount: number,
transfers: TransferLike[]
): { paid: number; arrears: number } {
const paid =
Math.round(sumTransferAmountByStatuses(transfers, new Set(['yjf'])) * 100) / 100
return { paid, arrears: Math.round((dueAmount - paid) * 100) / 100 }
}
/** 单样本默认定价:沿用原「1 个样本」价目 */
export function resolvePerSamplePreset(payMode: 'dj' | 'fq'): {
contractAmount: number
/** 单样本合同金额 = 优惠价格;未填优惠价则 null */
export function resolveSampleContractAmount(
sample: SamplePriceLike | null | undefined
): number | null {
return parsePreferentialPrice(sample)
}
/** 新建/切换缴费模式:合同取优惠价;分期不预填各期金额 */
export function resolvePerSamplePaymentDefaults(
sample: SamplePriceLike | null | undefined,
payMode: 'dj' | 'fq'
): {
contractAmount: number | null
installmentCount?: number
installmentAmounts?: number[]
} | null {
if (payMode === 'dj') return { contractAmount: 22880 }
} {
const contractAmount = resolveSampleContractAmount(sample)
if (payMode === 'fq') {
return {
contractAmount: 25880,
contractAmount,
installmentCount: 6,
installmentAmounts: [6480, 3880, 3880, 3880, 3880, 3880]
installmentAmounts: []
}
}
return null
return { contractAmount }
}
/**
* 是否用优惠价覆盖合同:仅合同为空时(打开编辑不覆盖已有库内金额)。
* 用户改优惠价时由调用方 force=true 强制同步。
*/
export function shouldReplaceContractWithPreferentialPrice(
contractAmount: number | null | undefined,
preferentialPrice: number | null
): boolean {
if (preferentialPrice == null) return false
if (contractAmount == null || !Number.isFinite(Number(contractAmount))) return true
return false
}
export function parseInstallmentRatios(raw: unknown): number[] {
@@ -71,3 +184,231 @@ export function parseInstallmentRatios(raw: unknown): number[] {
}
return []
}
export type FgdScheduleLike = ScheduleLike & {
id?: string
scheduleNo?: number
_deleted?: boolean
}
export type FgdMergePlan = {
targetScheduleId: string
targetScheduleNo: number
newDueAmount: number
softDeleteScheduleIds: string[]
softDeleteScheduleNos: number[]
newInstallmentCount: number
}
function roundMoney(n: number): number {
return Math.round(n * 100) / 100
}
/** fq → fgd:保留已缴期,剩余欠缴并入第一期未清期;软删其后各期(与后端 plan_fq_to_fgd_merge 对齐) */
export function planFqToFgdMerge(schedules: FgdScheduleLike[]): FgdMergePlan {
const schList = (schedules || [])
.filter((s) => String(s.scheduleStatus || 'open') !== 'void' && !s._deleted)
.slice()
.sort((a, b) => Number(a.scheduleNo || 0) - Number(b.scheduleNo || 0))
const arrearsOf = (s: FgdScheduleLike): number => {
const { arrears } = scheduleFinanceConfirmedPaidArrears(
Number(s.dueAmount) || 0,
s.transfers || []
)
return arrears > 0 ? arrears : 0
}
let target: FgdScheduleLike | undefined
for (const s of schList) {
if (arrearsOf(s) > 0) {
target = s
break
}
}
if (!target) {
target = schList.find((s) => String(s.scheduleStatus || 'open') !== 'cleared')
}
if (!target) {
throw new Error('没有可合并的未清期次')
}
const targetNo = Number(target.scheduleNo || 0)
const later = schList.filter((s) => Number(s.scheduleNo || 0) > targetNo)
for (const s of later) {
if ((s.transfers || []).some((t) => t.payStatus === 'yjf')) {
throw new Error('后续期已有已确认转账,无法合并为分改趸')
}
}
const remain = roundMoney(schList.reduce((sum, s) => sum + arrearsOf(s), 0))
const { paid: targetConfirmed } = scheduleFinanceConfirmedPaidArrears(
Number(target.dueAmount) || 0,
target.transfers || []
)
const newDueAmount = roundMoney(targetConfirmed + remain)
const softDeleteScheduleIds = later
.map((s) => String(s.id || '').trim())
.filter(Boolean)
const softDeleteScheduleNos = later.map((s) => Number(s.scheduleNo || 0))
const softNoSet = new Set(softDeleteScheduleNos)
const kept = schList.filter((s) => !softNoSet.has(Number(s.scheduleNo || 0)))
return {
targetScheduleId: String(target.id || ''),
targetScheduleNo: targetNo,
newDueAmount,
softDeleteScheduleIds,
softDeleteScheduleNos,
newInstallmentCount: kept.length
}
}
export type SamplePayMode = 'dj' | 'fq' | 'fgd'
export function samplePaymentHasConfirmedTransfer(pay: {
schedules?: FgdScheduleLike[]
}): boolean {
return (pay.schedules || []).some((s) =>
(s.transfers || []).some((t) => t.payStatus === 'yjf')
)
}
/**
* 下拉可选缴费模式(趸交 ↔ 分改趸 互斥,不可直转):
* - 分期:可改趸交 / 分改趸
* - 趸交:仅可改分期
* - 分改趸:仅可改分期
*/
export function availableSamplePayModes(pay: {
payMode?: string
schedules?: FgdScheduleLike[]
}): SamplePayMode[] {
const mode = String(pay.payMode || 'dj') as SamplePayMode
if (mode === 'fq') return ['fq', 'dj', 'fgd']
if (mode === 'fgd') return ['fgd', 'fq']
return ['dj', 'fq']
}
/** 将剩余欠缴并入当前未清期,软删后续未缴期(fq→dj / fq→fgd) */
export function applyConsolidateRemainingToPayment<T extends Record<string, any>>(
pay: T,
targetMode: 'dj' | 'fgd'
): T {
const plan = planFqToFgdMerge((pay.schedules || []) as FgdScheduleLike[])
const softNoSet = new Set(plan.softDeleteScheduleNos)
const schedules = ((pay.schedules || []) as FgdScheduleLike[])
.filter(
(s) =>
String(s.scheduleStatus || 'open') !== 'void' &&
!s._deleted &&
!softNoSet.has(Number(s.scheduleNo || 0))
)
.map((s) => {
if (Number(s.scheduleNo || 0) !== plan.targetScheduleNo) return { ...s }
return { ...s, dueAmount: plan.newDueAmount }
})
.sort((a, b) => Number(a.scheduleNo || 0) - Number(b.scheduleNo || 0))
return {
...pay,
payMode: targetMode,
installmentCount: plan.newInstallmentCount,
schedules,
installmentRatios: schedules.map((s) => {
const n = Number(s.dueAmount)
return Number.isFinite(n) && n > 0 ? n : 0
})
}
}
/** 将并期结果写回样本缴费方案(前端即时预览;保存时后端仍会按库内数据再执行一遍) */
export function applyFqToFgdMergeToPayment<T extends Record<string, any>>(pay: T): T {
return applyConsolidateRemainingToPayment(pay, 'fgd')
}
export type ExpandInstallmentOpts = {
installmentCount?: number | null
installmentIntervalMonths?: number | null
installmentStartDate?: string
installmentAdvanceDays?: number | null
}
/** dj/fgd → fq:保留已确认实缴期,剩余按分期参数拆成新期 */
export function applyExpandRemainingToInstallment<T extends Record<string, any>>(
pay: T,
opts: ExpandInstallmentOpts
): T {
const schList = ((pay.schedules || []) as FgdScheduleLike[])
.filter((s) => String(s.scheduleStatus || 'open') !== 'void' && !s._deleted)
.slice()
.sort((a, b) => Number(a.scheduleNo || 0) - Number(b.scheduleNo || 0))
for (const s of schList) {
if ((s.transfers || []).some((t) => t.payStatus === 'jfqrz')) {
throw new Error('存在缴费确认中的转账,请先完成财务确认')
}
}
let totalPaid = 0
const kept: FgdScheduleLike[] = []
for (const s of schList) {
const { paid, arrears } = scheduleFinanceConfirmedPaidArrears(
Number(s.dueAmount) || 0,
s.transfers || []
)
totalPaid = roundMoney(totalPaid + paid)
if (paid > 0) {
kept.push({
...s,
dueAmount: arrears > 0 ? paid : s.dueAmount,
scheduleStatus: arrears > 0 ? 'cleared' : s.scheduleStatus || 'cleared',
transfers: [...(s.transfers || [])]
})
}
}
const contract = Number(pay.contractAmount)
if (!Number.isFinite(contract)) {
throw new Error('请先填写样本合同金额')
}
const remaining = roundMoney(contract - totalPaid)
if (remaining <= 0) {
throw new Error('已缴清,无法改为分期')
}
const count = Math.max(1, Number(opts.installmentCount) || 6)
const newCount = Math.max(1, count - kept.length)
const interval = Number(opts.installmentIntervalMonths) || 1
const startDate = String(opts.installmentStartDate || '').trim()
if (!startDate) {
throw new Error('请先填写分期开始时间')
}
const advanceDays = Number(
opts.installmentAdvanceDays ?? DEFAULT_INSTALLMENT_ADVANCE_DAYS
)
const amounts = defaultInstallmentAmounts(remaining, newCount)
const maxNo = kept.reduce((m, s) => Math.max(m, Number(s.scheduleNo) || 0), 0)
const created: FgdScheduleLike[] = amounts.map((amt, i) => ({
scheduleNo: maxNo + 1 + i,
dueAmount: amt,
dueDate: calcFqInstallmentDueDate(startDate, i, interval, advanceDays),
scheduleStatus: 'open',
transfers: []
}))
const schedules = [...kept, ...created]
return {
...pay,
payMode: 'fq',
installmentCount: schedules.length,
installmentIntervalMonths: interval,
installmentStartDate: startDate,
installmentAdvanceDays: advanceDays,
schedules,
installmentRatios: schedules.map((s) => {
const n = Number(s.dueAmount)
return Number.isFinite(n) && n > 0 ? n : 0
})
}
}
@@ -1,443 +0,0 @@
import { parseChineseDatetimeText } from '@/utils/chinese-datetime-parse'
import { parseBirthOrder } from '@/utils/chinese-numeral-parse'
import {
isBlankString,
matchCellSampleType,
resolveTransportType
} from '@/utils/donation-standard-import-parse'
import { extractNumericPart } from '@/utils/numeric-input-parse'
import {
SAMPLE_TYPE_PERINATAL_HSC,
SAMPLE_TYPE_UC_MSC
} from '@/utils/sample-production-reception-fields'
export type ProtocolSampleImportHint = {
typeKey: 'hsc' | 'uc_msc'
typeName: string
sampleCode?: string
collectTime?: string
}
export type ProtocolPaymentTransferHint = {
transferAmount: number
transferTime: string
}
export type ProtocolStandardImportParsed = {
sampleTypeHeader: string
sampleHints: ProtocolSampleImportHint[]
motherName?: string
motherPhone?: string
newbornSex?: '1' | '0'
newbornWeightGram?: number | null
apgarScore?: number | null
newbornDeliveryTime?: string
sampleCollectTime?: string
maternalBloodCollectTime?: string
maternalBloodExplicitEmpty?: boolean
deliveryMode?: string
birthOrder?: number | null
medicalStaff?: string
hospitalName?: string
salesUserName?: string
payMode: 'dj' | 'fq' | 'djfq'
contractAmount?: number | null
transferTypeLabel?: string
paymentTransfers: ProtocolPaymentTransferHint[]
transportModeText?: string
transportType?: 'kdys' | 'ryxd'
carrierName?: string
etaTime?: string
remark?: string
}
const MATERNAL_BLOOD_EMPTY_MARKERS = ['未采集', '无', '暂无', '—', '-', '未采']
const SAMPLE_CODE_RE = /^ZK[A-Z0-9]+$/i
const KEY_ALIASES: Record<string, string> = {
产妇姓名: 'motherName',
母亲姓名: 'motherName',
孕妇电话: 'motherPhone',
母亲联系电话: 'motherPhone',
新生儿性别: 'newbornSex',
新生儿体重: 'newbornWeightGram',
'新生儿体重(克)': 'newbornWeightGram',
新生儿评分: 'apgarScore',
分娩时间: 'newbornDeliveryTime',
新生儿分娩时间: 'newbornDeliveryTime',
母血采集时间: 'maternalBloodCollectTime',
分娩方式: 'deliveryMode',
胎次: 'birthOrder',
采集医护: 'medicalStaff',
采集医院: 'hospitalName',
销售人员: 'salesUserName',
采集专员: 'salesUserName',
缴费方式: 'payModeText',
转账方式: 'transferTypeText',
合同金额: 'contractAmount',
转账金额: 'transferAmount',
转账时间: 'transferTime',
运输方式: 'transportModeText',
预计送达时间: 'etaTime',
备注: 'remark'
}
function normalizeLine(line: string): string {
return line
.replace(/^[\s【】]+|[\s【】]+$/g, '')
.trim()
}
function splitKeyValue(line: string): { key: string; value: string } | null {
const match = line.match(/^([^::]+)[::]\s*(.*)$/)
if (!match) return null
return { key: match[1].trim(), value: match[2].trim() }
}
function normalizeChineseDatetimeLiteral(value: string): string {
let v = (value || '').trim()
v = v.replace(
/^(\d{4})年(\d{1,2})月(\d{1,2})日(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,
(_, y, mo, d, h, mi, s) => `${y}年${Number(mo)}月${Number(d)}日${Number(h)}时${Number(mi)}分${s ? Number(s) + '秒' : ''}`
)
return v
}
function parseDatetime(value: string, minutePrecision = false): string | undefined {
const v = normalizeChineseDatetimeLiteral(value.trim())
if (!v) return undefined
if (MATERNAL_BLOOD_EMPTY_MARKERS.some((m) => v === m || v.includes(m))) {
return undefined
}
return (
parseChineseDatetimeText(v, minutePrecision ? 'datetime-minute' : 'datetime') || undefined
)
}
function parseSex(value: string): '1' | '0' | undefined {
const v = value.trim()
if (!v) return undefined
if (/^男|^男孩/.test(v)) return '1'
if (/^女|^女孩/.test(v)) return '0'
return undefined
}
function parseDeliveryMode(value: string): string | undefined {
const v = value.trim()
if (!v) return undefined
if (/剖宫产|剖腹产|刨宫产/.test(v)) return 'pgc'
if (/顺产|自然分娩/.test(v)) return 'sc'
return undefined
}
function parseMoney(value: string): number | null | undefined {
const num = extractNumericPart(value)
if (num == null || num === '') return undefined
const n = Number(num)
return Number.isFinite(n) ? n : undefined
}
function parseScore(value: string): number | null | undefined {
return parseMoney(value)
}
function isMaternalBloodEmpty(value: string): boolean {
const v = value.trim()
if (!v) return true
return MATERNAL_BLOOD_EMPTY_MARKERS.some((m) => v === m || v.includes(m))
}
function resolveSampleCollectHint(key: string): Pick<ProtocolSampleImportHint, 'typeKey' | 'typeName'> | null {
const k = key.trim()
if (/脐带间充质.*采集时间/.test(k) || k === '脐带采集时间') {
return { typeKey: 'uc_msc', typeName: SAMPLE_TYPE_UC_MSC }
}
if (/造血干细胞.*采集时间/.test(k) || k === '样本采集时间') {
return { typeKey: 'hsc', typeName: SAMPLE_TYPE_PERINATAL_HSC }
}
return null
}
function resolveSampleCodeHint(
key: string,
value: string
): (Pick<ProtocolSampleImportHint, 'typeKey' | 'typeName'> & { sampleCode: string }) | null {
const code = value.trim().toUpperCase()
if (!SAMPLE_CODE_RE.test(code)) return null
const k = key.trim()
if (/脐带间充质/.test(k)) {
return { typeKey: 'uc_msc', typeName: SAMPLE_TYPE_UC_MSC, sampleCode: code }
}
if (/造血干细胞/.test(k)) {
return { typeKey: 'hsc', typeName: SAMPLE_TYPE_PERINATAL_HSC, sampleCode: code }
}
return null
}
function upsertSampleHint(
hints: ProtocolSampleImportHint[],
partial: Partial<ProtocolSampleImportHint> & Pick<ProtocolSampleImportHint, 'typeKey' | 'typeName'>
) {
let hint = hints.find((h) => h.typeKey === partial.typeKey)
if (!hint) {
hint = { typeKey: partial.typeKey, typeName: partial.typeName }
hints.push(hint)
}
if (partial.sampleCode) hint.sampleCode = partial.sampleCode
if (partial.collectTime) hint.collectTime = partial.collectTime
}
function earliestCollectTime(hints: ProtocolSampleImportHint[]): string | undefined {
const times = hints.map((h) => h.collectTime).filter(Boolean) as string[]
if (!times.length) return undefined
return times.sort((a, b) => a.localeCompare(b))[0]
}
/** 缴费方式:趸交+分期 → djfq;仅「分期」→ fq;其余 → dj */
export function parsePayModeFromText(value: string): {
payMode: 'dj' | 'fq' | 'djfq' | 'djfq'
transferLabel?: string
} {
const v = (value || '').trim()
if (/趸交\s*[++]\s*分期|趸交.*分期/.test(v)) return { payMode: 'djfq' }
if (/分期/.test(v)) return { payMode: 'fq' }
if (/微信|支付宝|银行卡|银行|现金/.test(v)) {
return { payMode: 'dj', transferLabel: v }
}
return { payMode: 'dj' }
}
/** 解析转账时间行(支持多笔:…2000元,…付20880元) */
export function parsePaymentTransferSegments(
text: string,
fallbackAmount?: number | null
): ProtocolPaymentTransferHint[] {
const raw = (text || '').trim()
if (!raw) {
if (fallbackAmount != null && fallbackAmount > 0) {
return [{ transferAmount: fallbackAmount, transferTime: '' }]
}
return []
}
const segments = raw.split(/[,,]/).map((s) => s.trim()).filter(Boolean)
const results: ProtocolPaymentTransferHint[] = []
let defaultYear: number | undefined
for (const seg of segments) {
const amountMatch = seg.match(/(?:付)?(\d+(?:\.\d+)?)\s*元\s*$/)
if (!amountMatch) continue
const transferAmount = Number(amountMatch[1])
if (!Number.isFinite(transferAmount)) continue
let dtRaw = seg.slice(0, seg.length - amountMatch[0].length).trim()
dtRaw = normalizeChineseDatetimeLiteral(dtRaw)
if (/^\d{1,2}月/.test(dtRaw) && defaultYear) {
dtRaw = `${defaultYear}年${dtRaw}`
}
const transferTime = parseChineseDatetimeText(dtRaw, 'datetime')
if (transferTime) {
if (!defaultYear) defaultYear = Number(transferTime.slice(0, 4))
results.push({ transferAmount, transferTime })
}
}
if (results.length) return results
const transferTime = parseChineseDatetimeText(normalizeChineseDatetimeLiteral(raw), 'datetime')
if (fallbackAmount != null && fallbackAmount > 0) {
return [{ transferAmount: fallbackAmount, transferTime: transferTime || '' }]
}
if (transferTime) {
return [{ transferAmount: fallbackAmount ?? 0, transferTime }]
}
return []
}
/** 字典 label → transfer_type 值(wxzz 等) */
export function resolveTransferTypeCode(
label: string,
options: Array<{ value: string; label: string }>
): string {
const v = (label || '').trim()
if (!v || !options.length) return ''
const exact = options.find((o) => o.label === v || o.value === v)
if (exact) return exact.value
const contains = options.filter((o) => o.label.includes(v) || v.includes(o.label))
if (contains.length === 1) return contains[0].value
const keywordMap: Array<[RegExp, string]> = [
[/微信/, '微信'],
[/支付宝/, '支付宝'],
[/银行/, '银行'],
[/现金/, '现金']
]
for (const [re, kw] of keywordMap) {
if (!re.test(v)) continue
const hit = options.find((o) => o.label.includes(kw))
if (hit) return hit.value
}
return ''
}
/** 从运输描述中提取携带人姓名(如「露露帮助…」) */
export function extractCarrierNameFromTransport(text: string): string | undefined {
const v = (text || '').trim()
const m = v.match(/^([\u4e00-\u9fa5]{1,4})(?:帮助|协助|取)/)
return m?.[1]
}
/** 解析采集协议单一键导入标准文本 */
export function parseProtocolStandardImportText(text: string): ProtocolStandardImportParsed | null {
const raw = (text || '').trim()
if (!raw) return null
const lines = raw
.split(/\r?\n/)
.map(normalizeLine)
.filter(Boolean)
if (!lines.length) return null
const result: ProtocolStandardImportParsed = {
sampleTypeHeader: lines[0],
sampleHints: [],
payMode: 'dj',
paymentTransfers: []
}
let transferTimeRaw = ''
let transferAmountSingle: number | null | undefined
for (let i = 1; i < lines.length; i++) {
const kv = splitKeyValue(lines[i])
if (!kv) continue
const codeHint = resolveSampleCodeHint(kv.key, kv.value)
if (codeHint) {
upsertSampleHint(result.sampleHints, codeHint)
continue
}
const collectMeta = resolveSampleCollectHint(kv.key)
if (collectMeta) {
const dt = parseDatetime(kv.value, true)
if (dt) upsertSampleHint(result.sampleHints, { ...collectMeta, collectTime: dt })
continue
}
const field = KEY_ALIASES[kv.key]
if (!field) continue
switch (field) {
case 'motherName':
result.motherName = kv.value
break
case 'motherPhone':
result.motherPhone = kv.value.replace(/\s+/g, '')
break
case 'newbornSex': {
const sex = parseSex(kv.value)
if (sex) result.newbornSex = sex
break
}
case 'newbornWeightGram': {
const w = parseMoney(kv.value)
if (w !== undefined) result.newbornWeightGram = w
break
}
case 'apgarScore': {
const s = parseScore(kv.value)
if (s !== undefined) result.apgarScore = s
break
}
case 'newbornDeliveryTime': {
const dt = parseDatetime(kv.value)
if (dt) result.newbornDeliveryTime = dt
break
}
case 'maternalBloodCollectTime':
if (isMaternalBloodEmpty(kv.value)) {
result.maternalBloodExplicitEmpty = true
} else {
const dt = parseDatetime(kv.value, true)
if (dt) result.maternalBloodCollectTime = dt
}
break
case 'deliveryMode': {
const mode = parseDeliveryMode(kv.value)
if (mode) result.deliveryMode = mode
break
}
case 'birthOrder': {
const n = parseBirthOrder(kv.value)
if (n !== undefined) result.birthOrder = n
break
}
case 'medicalStaff':
result.medicalStaff = kv.value
break
case 'hospitalName':
if (!result.hospitalName) result.hospitalName = kv.value
break
case 'salesUserName':
result.salesUserName = kv.value
break
case 'payModeText': {
const pm = parsePayModeFromText(kv.value)
result.payMode = pm.payMode
if (pm.transferLabel && !result.transferTypeLabel) {
result.transferTypeLabel = pm.transferLabel
}
break
}
case 'transferTypeText':
result.transferTypeLabel = kv.value
break
case 'contractAmount': {
const amt = parseMoney(kv.value)
if (amt !== undefined) result.contractAmount = amt
break
}
case 'transferAmount': {
const amt = parseMoney(kv.value)
if (amt !== undefined) transferAmountSingle = amt
break
}
case 'transferTime':
transferTimeRaw = kv.value
break
case 'transportModeText': {
result.transportModeText = kv.value
result.transportType = resolveTransportType(kv.value) ?? undefined
result.carrierName = extractCarrierNameFromTransport(kv.value)
break
}
case 'etaTime': {
const dt = parseDatetime(kv.value)
if (dt) result.etaTime = dt
break
}
case 'remark':
result.remark = kv.value
break
default:
break
}
}
result.paymentTransfers = parsePaymentTransferSegments(transferTimeRaw, transferAmountSingle ?? null)
if (result.sampleHints.length) {
result.sampleCollectTime = earliestCollectTime(result.sampleHints)
}
return result
}
export { matchCellSampleType, isBlankString }
@@ -0,0 +1,98 @@
import type { SampleFreight } from '@/api/sample-freight'
export type SampleFreightFlatRow = {
rowKey: string
freightId: string
/** 当前列表内批次序号(从 0 起,用于斑马纹) */
batchIndex: number
/** 运费批次号 YF+YYYYMMDD+001~999 */
batchNo: string
rowspan: number
isFirst: boolean
transportMode: string
transportModeLabel: string
freightAmount: number
linkedSampleCount: number
createBy?: string
createByName?: string
createTime: string
sampleSource?: string
protocolNo?: string
motherName?: string
newbornName?: string
sampleCode?: string
sampleTypeName?: string
sampleId?: string
protocolId?: string
/** 原始批次,选中时回传 */
freight: SampleFreight
}
export function flattenSampleFreights(list: SampleFreight[]): SampleFreightFlatRow[] {
const rows: SampleFreightFlatRow[] = []
list.forEach((f, batchIndex) => {
const items = f.items?.length ? f.items : [null]
const batchNo = (f.freightNo || '').trim() || '—'
items.forEach((it, idx) => {
rows.push({
rowKey: `${f.id}|${it?.sampleId || idx}`,
freightId: f.id,
batchIndex,
batchNo,
rowspan: idx === 0 ? items.length : 0,
isFirst: idx === 0,
transportMode: f.transportMode,
transportModeLabel: f.transportModeLabel || f.transportMode,
freightAmount: f.freightAmount,
linkedSampleCount: f.linkedSampleCount ?? (f.items?.length || 0),
createBy: f.createBy || '',
createByName: f.createByName || f.createBy || '',
createTime: f.createTime || '',
sampleSource: it?.sampleSource,
protocolNo: it?.protocolNo,
motherName: it?.motherName,
newbornName: it?.newbornName,
sampleCode: it?.sampleCode,
sampleTypeName: it?.sampleTypeName,
sampleId: it?.sampleId,
protocolId: it?.protocolId,
freight: f
})
})
})
return rows
}
const DEFAULT_MERGE_PROPS = new Set([
'selection',
'radio',
'batchNo',
'transportMode',
'freightAmount',
'linkedSampleCount',
'createByName',
'createTime',
'actions'
])
export function sampleFreightSpanMethod(
{
column,
row
}: {
column: { type?: string; property?: string }
row: SampleFreightFlatRow
},
extraMergeProps: string[] = []
): { rowspan: number; colspan: number } {
const mergeProps =
extraMergeProps.length > 0
? new Set([...DEFAULT_MERGE_PROPS, ...extraMergeProps])
: DEFAULT_MERGE_PROPS
const prop = column.type === 'selection' ? 'selection' : column.property || ''
if (mergeProps.has(prop)) {
if (row.rowspan > 0) return { rowspan: row.rowspan, colspan: 1 }
return { rowspan: 0, colspan: 0 }
}
return { rowspan: 1, colspan: 1 }
}
+57 -1
View File
@@ -98,6 +98,45 @@ export const sampleStatus: StatusRegistry = {
export const sampleStatusLabel = createLabelGetter(sampleStatus)
export const sampleStatusTagType = createTagTypeGetter(sampleStatus)
export const sampleCollectionFlag: StatusRegistry = {
uncollected: { label: '未采集', tagType: 'info' },
collected: { label: '已采集', tagType: 'success' },
voided: { label: '已作废', tagType: 'danger' }
}
export const sampleCollectionFlagLabel = createLabelGetter(sampleCollectionFlag)
export const sampleCollectionFlagTagType = createTagTypeGetter(sampleCollectionFlag)
export const sampleReceptionFlag: StatusRegistry = {
none: { label: '未接收', tagType: 'info' },
js: { label: '已接收', tagType: 'success' },
bj: { label: '拒收', tagType: 'danger' }
}
export const sampleReceptionFlagLabel = createLabelGetter(sampleReceptionFlag)
export const sampleReceptionFlagTagType = createTagTypeGetter(sampleReceptionFlag)
export const sampleQcFlag: StatusRegistry = {
incomplete: { label: '未完成', tagType: 'warning' },
complete: { label: '已完成', tagType: 'success' },
voided: { label: '已作废', tagType: 'danger' }
}
export const sampleQcFlagLabel = createLabelGetter(sampleQcFlag)
export const sampleQcFlagTagType = createTagTypeGetter(sampleQcFlag)
export const sampleStorageFlag: StatusRegistry = {
none: { label: '未入库', tagType: 'info' },
yrk: { label: '已入库', tagType: 'success' },
rejected: { label: '拒绝入库', tagType: 'danger' }
}
export const sampleStorageFlagLabel = createLabelGetter(sampleStorageFlag)
export const sampleStorageFlagTagType = createTagTypeGetter(sampleStorageFlag)
export const handleDoneFlag: StatusRegistry = {
'1': { label: '已办理', tagType: 'success' },
'0': { label: '未办理', tagType: 'info' }
}
export const handleDoneFlagLabel = createLabelGetter(handleDoneFlag)
export const handleDoneFlagTagType = createTagTypeGetter(handleDoneFlag)
export const payStatus: StatusRegistry = {
dfj: { label: '已缴费', tagType: 'primary' },
jfqrz: { label: '缴费确认中', tagType: 'warning' },
@@ -118,11 +157,28 @@ export const auditStatusTagType = createTagTypeGetter(auditStatus)
export const payMode: StatusRegistry = {
dj: { label: '趸交', tagType: 'primary' },
fq: { label: '分期', tagType: 'warning' },
djfq: { label: '趸交+分期', tagType: 'warning' }
djfq: { label: '趸交+分期', tagType: 'warning' },
fgd: { label: '分改趸', tagType: 'warning' }
}
export const payModeLabel = createLabelGetter(payMode)
export const payModeTagType = createTagTypeGetter(payMode)
export const paymentChaseStatus: StatusRegistry = {
overdue: { label: '已逾期', tagType: 'danger' },
upcoming: { label: '即将到期', tagType: 'warning' }
}
export const paymentChaseStatusLabel = createLabelGetter(paymentChaseStatus)
export const paymentChaseStatusTagType = createTagTypeGetter(paymentChaseStatus)
export const periodFinanceAudit: StatusRegistry = {
dfj: { label: '待缴费', tagType: 'info' },
jfqrz: { label: '确认中', tagType: 'warning' },
yjf: { label: '已通过', tagType: 'success' },
partial: { label: '部分到账', tagType: 'primary' }
}
export const periodFinanceAuditLabel = createLabelGetter(periodFinanceAudit)
export const periodFinanceAuditTagType = createTagTypeGetter(periodFinanceAudit)
/** 按样本列表整体进度(勿与转账笔 payStatus 混用:payStatus.dfj=已缴费) */
export const samplePaymentProgress: StatusRegistry = {
dfj: { label: '待缴费', tagType: 'info' },
@@ -89,6 +89,7 @@
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
@@ -40,6 +40,7 @@
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
@@ -78,6 +78,7 @@
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
@@ -3,10 +3,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">地区列表</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -42,6 +38,7 @@
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
@@ -577,9 +574,6 @@
filterable
remote
clearable
collapse-tags
collapse-tags-tooltip
:max-collapse-tags="4"
:remote-method="remoteSearchUsers"
:loading="staffUserLoading"
placeholder="搜索并选择一人或多名人员"
+217 -93
View File
@@ -115,12 +115,61 @@
align="center"
header-align="center"
/>
<el-table-column
prop="birthYm"
label="出生年月"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">{{ formatBirthYm(row.birthYm) }}</template>
</el-table-column>
<el-table-column
prop="ethnic"
label="民族"
min-width="90"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.ethnic || '—' }}</template>
</el-table-column>
<el-table-column
prop="email"
label="邮箱"
min-width="160"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.email || '—' }}</template>
</el-table-column>
<el-table-column
prop="address"
label="家庭住址"
min-width="180"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.address || '—' }}</template>
</el-table-column>
<el-table-column
prop="customerTags"
label="客户标签"
min-width="140"
show-overflow-tooltip
/>
>
<template #default="{ row }">{{ row.customerTags || '—' }}</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
min-width="140"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.remark || '—' }}</template>
</el-table-column>
<el-table-column
prop="createTime"
label="创建时间"
@@ -224,6 +273,41 @@
<el-form-item label="联系电话">
<el-input v-model="formData.phoneNo" placeholder="可选" clearable />
</el-form-item>
<el-form-item label="出生年月">
<el-date-picker
v-model="formData.birthYm"
type="month"
value-format="YYYYMM"
format="YYYY-MM"
placeholder="选择月份"
clearable
style="width: 100%"
/>
</el-form-item>
<el-form-item label="民族">
<el-select
v-model="formData.ethnic"
class="w-full"
filterable
clearable
:loading="ethnicLoading"
placeholder="请选择或检索民族"
style="width: 100%"
>
<el-option
v-for="e in ethnicOptions"
:key="e.ethnicCode || e.ethnicName"
:label="e.ethnicName"
:value="e.ethnicName"
/>
</el-select>
</el-form-item>
<el-form-item label="邮箱">
<el-input v-model="formData.email" placeholder="可选" clearable />
</el-form-item>
<el-form-item label="家庭住址" class="form-col-span-2">
<el-input v-model="formData.address" placeholder="可选" />
</el-form-item>
<el-form-item label="客户标签" class="form-col-span-2">
<el-input v-model="formData.customerTags" placeholder="多个标签用英文逗号分隔" />
</el-form-item>
@@ -251,12 +335,12 @@
:meta="`身份证:${viewRow?.idCardNo || '—'}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
:sections="viewSections"
:loading="relationsLoading"
width="820px"
width="1100px"
:grid-columns="5"
>
<template #append>
<div class="customer-relations" v-loading="relationsLoading">
<h3 class="rel-section-title">关联客户</h3>
<div v-if="!(relations?.relatedGroups || []).length" class="rel-empty">暂无关联协议</div>
<template #related-customers>
<div class="customer-relations">
<p v-if="!(relations?.relatedGroups || []).length" class="view-empty-hint">暂无关联客户</p>
<div
v-for="group in relations?.relatedGroups || []"
:key="`${group.bizType}-${group.protocolId}`"
@@ -271,74 +355,74 @@
</button>
<span class="rel-muted">本客户角色:{{ roleLabel(group.myRole) }}</span>
</div>
<el-table :data="group.members" size="small" class="rel-member-table" stripe>
<el-table-column label="角色" min-width="90" align="center" header-align="center">
<div class="view-subtable-wrap">
<el-table :data="group.members" stripe class="list-table view-subtable">
<el-table-column label="角色" min-width="90" align="center" header-align="center">
<template #default="{ row }">
{{ roleLabel(row.role) }}
<el-tag v-if="row.customerId && row.customerId === viewRow?.id" size="small" type="info">
本人
</el-tag>
</template>
</el-table-column>
<el-table-column label="姓名" min-width="110" align="center" header-align="center">
<template #default="{ row }">
<button
v-if="row.customerId && row.customerId !== viewRow?.id"
type="button"
class="rel-link"
@click="openRelatedCustomer(row)"
>
{{ row.name || '—' }}
</button>
<span v-else>{{ row.name || '—' }}</span>
</template>
</el-table-column>
<el-table-column prop="phone" label="电话" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{ row.phone || '—' }}</template>
</el-table-column>
<el-table-column prop="idCardNo" label="身份证" min-width="160" align="center" header-align="center">
<template #default="{ row }">{{ row.idCardNo || '—' }}</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</template>
<template #related-protocols>
<div class="customer-relations">
<p v-if="!(relations?.protocols || []).length" class="view-empty-hint">暂无关联协议</p>
<div v-else class="view-subtable-wrap">
<el-table :data="relations?.protocols || []" stripe class="list-table view-subtable">
<el-table-column label="协议号" min-width="140" align="center" header-align="center">
<template #default="{ row }">
{{ roleLabel(row.role) }}
<el-tag v-if="row.customerId && row.customerId === viewRow?.id" size="small" type="info">
本人
<button type="button" class="rel-link" @click="openProtocol(row)">
{{ row.protocolNo || '—' }}
</button>
</template>
</el-table-column>
<el-table-column label="类型" min-width="110" align="center" header-align="center">
<template #default="{ row }">
<el-tag size="small" :type="row.bizType === 'cell_storage' ? 'primary' : 'success'">
{{ bizTypeLabel(row.bizType) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="姓名" min-width="110" align="center" header-align="center">
<el-table-column label="状态" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<button
v-if="row.customerId && row.customerId !== viewRow?.id"
type="button"
class="rel-link"
@click="openRelatedCustomer(row)"
>
{{ row.name || '—' }}
</button>
<span v-else>{{ row.name || '—' }}</span>
<el-tag size="small" :type="protocolTagType(row)">
{{ protocolLabel(row) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="phone" label="电话" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{ row.phone || '—' }}</template>
<el-table-column label="日期" min-width="110" align="center" header-align="center">
<template #default="{ row }">{{ formatRegisterDate(row.registerDate) }}</template>
</el-table-column>
<el-table-column prop="idCardNo" label="身份证" min-width="160" align="center" header-align="center">
<template #default="{ row }">{{ row.idCardNo || '—' }}</template>
<el-table-column label="本客户角色" min-width="100" align="center" header-align="center">
<template #default="{ row }">{{ roleLabel(row.myRole) }}</template>
</el-table-column>
</el-table>
</div>
<h3 class="rel-section-title rel-section-title--gap">关联协议</h3>
<div v-if="!(relations?.protocols || []).length" class="rel-empty">暂无关联协议</div>
<el-table
v-else
:data="relations?.protocols || []"
size="small"
class="rel-protocol-table"
stripe
>
<el-table-column label="协议号" min-width="140" align="center" header-align="center">
<template #default="{ row }">
<button type="button" class="rel-link" @click="openProtocol(row)">
{{ row.protocolNo || '—' }}
</button>
</template>
</el-table-column>
<el-table-column label="类型" min-width="110" align="center" header-align="center">
<template #default="{ row }">
<el-tag size="small" :type="row.bizType === 'cell_storage' ? 'primary' : 'success'">
{{ bizTypeLabel(row.bizType) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="状态" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<el-tag size="small" :type="protocolTagType(row)">
{{ protocolLabel(row) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="日期" min-width="110" align="center" header-align="center">
<template #default="{ row }">{{ formatRegisterDate(row.registerDate) }}</template>
</el-table-column>
<el-table-column label="本客户角色" min-width="100" align="center" header-align="center">
<template #default="{ row }">{{ roleLabel(row.myRole) }}</template>
</el-table-column>
</el-table>
</div>
</template>
</SystemViewDialog>
@@ -370,6 +454,7 @@
fetchDeleteCustomer,
fetchCustomerRelations
} from '@/api/admin'
import { fetchEthnicList, type EthnicOption } from '@/api/ethnic'
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
import ProtocolViewDialog from '@/views/cell-storage/protocol/ProtocolViewDialog.vue'
import DonationViewDialog from '@/views/research-donation/list/DonationViewDialog.vue'
@@ -406,6 +491,12 @@
const donationViewVisible = ref(false)
const viewDonationId = ref<string | null>(null)
function formatBirthYm(ym: string | undefined | null) {
const s = String(ym || '').trim()
if (/^\d{6}$/.test(s)) return `${s.slice(0, 4)}-${s.slice(4, 6)}`
return s || '—'
}
const viewSections = computed(() => {
const row = viewRow.value
if (!row) return []
@@ -418,10 +509,24 @@
{ label: '身份证号', value: row.idCardNo },
{ label: '年龄', value: row.age },
{ label: '联系电话', value: row.phoneNo },
{ label: '客户标签', value: row.customerTags, span: true },
{ label: '出生年月', value: formatBirthYm(row.birthYm) },
{ label: '民族', value: row.ethnic },
{ label: '邮箱', value: row.email },
{ label: '家庭住址', value: row.address },
{ label: '客户标签', value: row.customerTags },
{ label: '创建时间', value: row.createTime },
{ label: '备注', value: row.remark, span: true }
{ label: '备注', value: row.remark }
]
},
{
title: '关联客户',
fields: [],
slot: 'related-customers'
},
{
title: '关联协议',
fields: [],
slot: 'related-protocols'
}
]
})
@@ -507,12 +612,40 @@
sex: '0',
idCardNo: '',
age: null as number | null,
birthYm: '',
ethnic: '',
email: '',
address: '',
phoneNo: '',
customerTags: '',
orderNum: 0,
remark: ''
})
const ethnicOptions = ref<EthnicOption[]>([])
const ethnicLoading = ref(false)
async function loadEthnicOptions() {
if (ethnicOptions.value.length) return
ethnicLoading.value = true
try {
const res = await fetchEthnicList({ limit: 200 })
ethnicOptions.value = res.list || []
} finally {
ethnicLoading.value = false
}
}
function ensureEthnicOptionInList(name: string) {
const n = (name || '').trim()
if (!n) return
if (ethnicOptions.value.some((e) => e.ethnicName === n)) return
ethnicOptions.value = [
{ id: '', ethnicName: n, ethnicCode: '', orderNum: null },
...ethnicOptions.value
]
}
const formRules = {
customerName: [{ required: true, message: '请输入客户姓名', trigger: 'blur' }]
}
@@ -555,6 +688,10 @@
formData.sex = '0'
formData.idCardNo = ''
formData.age = null
formData.birthYm = ''
formData.ethnic = ''
formData.email = ''
formData.address = ''
formData.phoneNo = ''
formData.customerTags = ''
formData.orderNum = 0
@@ -566,6 +703,7 @@
isEdit.value = false
dialogTitle.value = '新增客户'
resetForm()
void loadEthnicOptions()
dialogVisible.value = true
formRef.value?.clearValidate?.()
}
@@ -578,10 +716,15 @@
formData.sex = row.sex || '2'
formData.idCardNo = row.idCardNo || ''
formData.age = row.age ?? null
formData.birthYm = row.birthYm || ''
formData.ethnic = row.ethnic || ''
formData.email = row.email || ''
formData.address = row.address || ''
formData.phoneNo = row.phoneNo || ''
formData.customerTags = row.customerTags || ''
formData.orderNum = row.orderNum ?? 0
formData.remark = row.remark || ''
void loadEthnicOptions().then(() => ensureEthnicOptionInList(formData.ethnic))
dialogVisible.value = true
formRef.value?.clearValidate?.()
}
@@ -595,6 +738,10 @@
sex: formData.sex,
idCardNo: formData.idCardNo?.trim() || undefined,
age: formData.age,
birthYm: formData.birthYm?.trim() || undefined,
ethnic: formData.ethnic?.trim() || undefined,
email: formData.email?.trim() || undefined,
address: formData.address?.trim() || undefined,
phoneNo: formData.phoneNo?.trim() || undefined,
customerTags: formData.customerTags?.trim() || undefined,
orderNum: formData.orderNum,
@@ -667,29 +814,12 @@
}
.customer-relations {
.rel-section-title {
margin: 0 0 10px;
font-size: 14px;
font-weight: 600;
color: #0f172a;
}
.rel-section-title--gap {
margin-top: 18px;
}
.rel-empty {
padding: 8px 0 4px;
color: var(--mint-text-muted, #64748b);
font-size: 13px;
}
.rel-group {
margin-bottom: 14px;
padding: 10px 12px;
border: 1px solid #e2e8f0;
border-radius: 8px;
background: #f8fafc;
&:last-child {
margin-bottom: 0;
}
}
.rel-group-head {
@@ -702,7 +832,7 @@
.rel-muted {
color: var(--mint-text-muted, #64748b);
font-size: 12px;
font-size: 13px;
}
.rel-link {
@@ -715,11 +845,5 @@
text-decoration: underline;
text-underline-offset: 2px;
}
.rel-member-table,
.rel-protocol-table {
width: 100%;
background: #fff;
}
}
</style>
@@ -3,10 +3,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>保险公司及险种</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -1,4 +1,4 @@
<!-- 旧「满月待办管理」菜单入口:重定向至采集协议单管理 · 满月待办 Tab -->
<!-- 旧「满月待办管理」菜单入口:重定向至样本信息管理 -->
<template>
<div />
</template>
@@ -11,8 +11,8 @@
onMounted(() => {
router.replace({
name: 'CellStorageProtocolAudit',
query: { ...route.query, tab: 'fullmoon-todo' }
name: 'CellStorageSampleInfo',
query: { ...route.query, tab: 'cell_storage' }
})
})
</script>
@@ -2,9 +2,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>我的物料领用记录</h2>
</div>
<MaterialUsageTab mine-only />
</section>
</div>
@@ -0,0 +1,550 @@
<!-- 催缴信息:逾期 ∪ 未来 30 天待催期次 -->
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">催缴信息</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input
v-model="searchForm.keyword"
placeholder="协议号/客户/样本/电话"
clearable
@keyup.enter="handleSearch"
/>
</el-form-item>
<el-form-item label="催缴类型">
<el-select
v-model="searchForm.chaseType"
placeholder="全部"
clearable
style="width: 100%"
>
<el-option label="仅逾期" value="overdue" />
<el-option label="仅未来30天" value="upcoming" />
</el-select>
</el-form-item>
<el-form-item label="缴费方式">
<el-select
v-model="searchForm.payMode"
placeholder="全部"
clearable
style="width: 100%"
>
<el-option label="趸交" value="dj" />
<el-option label="分期" value="fq" />
<el-option label="分改趸" value="fgd" />
</el-select>
</el-form-item>
</div>
<div class="filter-actions-row">
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
</el-button>
<el-button class="btn-main" type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>搜索
</el-button>
</div>
</div>
</el-form>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="tableData"
v-loading="loading"
stripe
row-key="scheduleId"
>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
:index="(i) => (pagination.page - 1) * pagination.pageSize + i + 1"
/>
<el-table-column
prop="protocolNo"
label="协议号"
min-width="140"
align="center"
show-overflow-tooltip
/>
<el-table-column label="客户" min-width="140" align="center">
<template #default="{ row }">
<div>{{ row.motherName || '—' }}</div>
<div v-if="row.motherPhone" class="muted-sub">{{ row.motherPhone }}</div>
</template>
</el-table-column>
<el-table-column
prop="sampleCode"
label="样本编码"
min-width="140"
align="center"
show-overflow-tooltip
/>
<el-table-column label="市场专员" min-width="110" align="center">
<template #default="{ row }">{{ row.salesUserName || '—' }}</template>
</el-table-column>
<el-table-column label="缴费方式" min-width="100" align="center">
<template #default="{ row }">
<el-tag :type="payModeTagType(String(row.payMode || ''))" size="small">
{{ payModeLabel(String(row.payMode || '')) || '—' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="期次" min-width="80" align="center">
<template #default="{ row }">第 {{ row.scheduleNo || '—' }} 期</template>
</el-table-column>
<el-table-column label="应缴日" min-width="120" align="center">
<template #default="{ row }">
<span :class="{ 'is-overdue': row.chaseStatus === 'overdue' }">
{{ row.dueDate || '—' }}
</span>
</template>
</el-table-column>
<el-table-column label="应缴" min-width="100" align="center">
<template #default="{ row }">{{ formatAmount(row.dueAmount) }}</template>
</el-table-column>
<el-table-column label="已缴" min-width="100" align="center">
<template #default="{ row }">
<button
v-if="hasPaidAmount(row)"
type="button"
class="amount-link"
@click="openPeriodDialog(row)"
>
{{ formatAmount(row.paidAmount) }}
</button>
<span v-else class="muted">{{ formatAmount(row.paidAmount) }}</span>
</template>
</el-table-column>
<el-table-column label="欠缴" min-width="100" align="center">
<template #default="{ row }">{{ formatAmount(row.arrearsAmount) }}</template>
</el-table-column>
<el-table-column label="催缴状态" min-width="120" align="center">
<template #default="{ row }">
<el-tag
:type="paymentChaseStatusTagType(String(row.chaseStatus || ''))"
size="small"
>
<template v-if="row.chaseStatus === 'overdue'">
已逾期{{ row.daysOverdue ? ` ${row.daysOverdue} 天` : '' }}
</template>
<template v-else>
{{ row.daysUntilDue != null ? `${row.daysUntilDue} 天内到期` : '即将到期' }}
</template>
</el-tag>
</template>
</el-table-column>
<el-table-column label="协议状态" min-width="100" align="center">
<template #default="{ row }">
<el-tag
:type="protocolStatusTagType(String(row.protocolStatus || ''))"
size="small"
>
{{
protocolStatusDisplayLabel(
String(row.protocolStatus || ''),
String(row.voidType || '')
)
}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" min-width="120" fixed="right" align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleViewProtocol(row)">
<el-icon><Document /></el-icon>协议单
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
@current-change="(val) => ((pagination.page = val), loadData())"
/>
</div>
</div>
</section>
<el-dialog
v-model="periodDialogVisible"
:title="periodDialogTitle"
width="720px"
class="dialog-form-layout"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
>
<div v-loading="periodLoading" class="period-dialog-body">
<div class="summary-grid">
<div class="summary-item">
<label>应缴</label>
<strong>{{ formatAmountYuan(periodSummary.dueAmount) }}</strong>
</div>
<div class="summary-item">
<label>实缴合计</label>
<strong class="amount-strong">{{ formatAmountYuan(periodSummary.paidAmount) }}</strong>
</div>
<div class="summary-item">
<label>欠缴</label>
<strong>{{ formatAmountYuan(periodSummary.arrearsAmount) }}</strong>
</div>
</div>
<div class="section-subtitle">转账明细</div>
<div v-if="!periodTransfers.length" class="muted">暂无转账笔</div>
<div v-for="(tr, idx) in periodTransfers" :key="String(tr.id || idx)" class="transfer-card">
<div class="transfer-card__main">
<div class="transfer-card__top">
<strong>第 {{ idx + 1 }} 笔</strong>
<el-tag :type="payStatusTagType(String(tr.payStatus || ''))" size="small">
{{ payStatusLabel(String(tr.payStatus || '')) || '—' }}
</el-tag>
<span class="amount-strong">{{ formatAmountYuan(tr.transferAmount) }}</span>
</div>
<div class="transfer-card__meta">
<span>{{ transferTypeLabel(String(tr.transferType || '')) || '—' }}</span>
<span>{{ formatDisplayOrDash(tr.transferTime) }}</span>
</div>
</div>
<div class="transfer-card__attach">
<span class="transfer-card__attach-label">转账凭证</span>
<ProtocolAttachmentReadonly
v-if="transferAttachmentFiles(tr).length"
:files="transferAttachmentFiles(tr)"
size="compact"
@preview="handleAttachPreview"
@download="handleAttachDownload"
/>
<span v-else class="muted">暂无凭证</span>
</div>
</div>
</div>
<template #footer>
<el-button class="btn-ghost" @click="periodDialogVisible = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="attachPreviewVisible"
title="附件预览"
width="720px"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
>
<img
v-if="attachPreviewUrl"
:src="attachPreviewUrl"
alt="附件预览"
class="attach-preview-img"
/>
</el-dialog>
<ProtocolViewDialog
v-model="protocolVisible"
:protocol-id="protocolViewId"
:list-row="protocolViewRow"
show-audit-history
show-storage-cert
show-fullmoon-insurance
/>
</div>
</template>
<script setup lang="ts">
import { Search, RefreshLeft, Document, Close } from '@element-plus/icons-vue'
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
import ProtocolAttachmentReadonly from '../protocol/ProtocolAttachmentReadonly.vue'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import {
fetchPaymentChaseList,
fetchSamplePaymentDetail
} from '@/api/protocol-sample-payment'
import { type CollectionProtocolRow } from '@/api/collection-protocol'
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { formatMoneyDisplay } from '@/utils/money-format'
import {
payModeLabel,
payModeTagType,
paymentChaseStatusTagType,
protocolStatusDisplayLabel,
protocolStatusTagType,
payStatusLabel,
payStatusTagType,
transferTypeLabel
} from '@/utils/status-tag-registry'
defineOptions({ name: 'CellStoragePaymentChase' })
const searchForm = reactive({
keyword: '',
chaseType: '',
payMode: ''
})
const loading = ref(false)
const tableData = ref<Record<string, any>[]>([])
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const protocolVisible = ref(false)
const protocolViewId = ref('')
const protocolViewRow = ref<CollectionProtocolRow | null>(null)
const periodDialogVisible = ref(false)
const periodLoading = ref(false)
const periodDialogTitle = ref('')
const periodSummary = reactive({
dueAmount: null as number | null,
paidAmount: null as number | null,
arrearsAmount: null as number | null
})
const periodTransfers = ref<Record<string, any>[]>([])
const attachPreviewVisible = ref(false)
const attachPreviewUrl = ref('')
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
function formatAmount(v: unknown) {
if (v == null || v === '') return '—'
return formatMoneyDisplay(v)
}
function formatAmountYuan(v: unknown) {
if (v == null || v === '') return '—'
return `${formatMoneyDisplay(v)} 元`
}
function hasPaidAmount(row: Record<string, any>) {
const n = Number(row.paidAmount)
return Number.isFinite(n) && n > 0
}
function transferAttachmentFiles(tr: Record<string, any>) {
if (Array.isArray(tr.attachments) && tr.attachments.length) {
return tr.attachments
}
const urls = String(tr.transferAttachments || '')
.split(',')
.map((u) => u.trim())
.filter(Boolean)
return urls.map((url, idx) => ({
id: `url_${idx}`,
fileName: url.split('/').pop() || `附件${idx + 1}`,
fileUrl: url
}))
}
function fullFileUrl(url: string) {
if (!url) return ''
if (/^https?:\/\//i.test(url) || url.startsWith('/')) return url
return minioBaseUrl ? `${minioBaseUrl}/${url.replace(/^\//, '')}` : url
}
function handleAttachPreview(file: Record<string, unknown>) {
const url = String(file.fileUrl || '')
if (!url) return
attachPreviewUrl.value = fullFileUrl(url)
attachPreviewVisible.value = true
}
function handleAttachDownload(file: Record<string, unknown>) {
downloadAttachmentFile(file, { fullFileUrl })
}
async function loadData() {
loading.value = true
try {
const res = await fetchPaymentChaseList({
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined,
chaseType: searchForm.chaseType || undefined,
payMode: searchForm.payMode || undefined
})
tableData.value = (res.list || []) as Record<string, any>[]
pagination.total = res.total || 0
} finally {
loading.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
}
function handleReset() {
searchForm.keyword = ''
searchForm.chaseType = ''
searchForm.payMode = ''
handleSearch()
}
function handleViewProtocol(row: Record<string, any>) {
protocolViewId.value = String(row.protocolId || '')
protocolViewRow.value = {
id: row.protocolId,
protocolNo: row.protocolNo,
motherName: row.motherName,
motherPhone: row.motherPhone,
protocolStatus: row.protocolStatus,
voidType: row.voidType
} as CollectionProtocolRow
protocolVisible.value = true
}
async function openPeriodDialog(row: Record<string, any>) {
const scheduleId = String(row.scheduleId || '')
const samplePaymentId = String(row.samplePaymentId || '')
if (!scheduleId || !samplePaymentId) return
periodDialogTitle.value = `${row.motherName || ''} · ${row.protocolNo || ''} · 第 ${row.scheduleNo || '—'} 期转账记录`
periodDialogVisible.value = true
periodLoading.value = true
periodTransfers.value = []
// 摘要优先用列表口径(与缴费信息期次一致:dfj+jfqrz+yjf)
periodSummary.dueAmount = row.dueAmount ?? null
periodSummary.paidAmount = row.paidAmount ?? null
periodSummary.arrearsAmount = row.arrearsAmount ?? null
try {
const detail = await fetchSamplePaymentDetail(samplePaymentId)
const schedules = ((detail.schedules as any[]) || []) as Record<string, any>[]
const sch = schedules.find((s) => String(s.id) === scheduleId)
if (sch) {
periodSummary.dueAmount = sch.dueAmount ?? periodSummary.dueAmount
periodTransfers.value = (sch.transfers || []) as Record<string, any>[]
}
} finally {
periodLoading.value = false
}
}
onMounted(() => loadData())
</script>
<style scoped lang="scss">
.muted-sub {
font-size: 12px;
color: var(--mint-text-muted, #64748b);
}
.is-overdue {
color: #dc2626;
font-weight: 600;
}
.amount-link {
border: none;
background: none;
padding: 0;
color: var(--primary-dark, #059669);
font-weight: 600;
cursor: pointer;
border-bottom: 1px dashed rgba(5, 150, 105, 0.45);
}
.amount-strong {
color: var(--primary-dark, #059669);
}
.muted {
color: var(--mint-text-muted, #64748b);
}
.summary-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
margin-bottom: 14px;
}
.summary-item {
padding: 10px 12px;
border: 1px solid var(--border, #d9e8e2);
border-radius: 8px;
background: #f8fafc;
label {
display: block;
font-size: 11px;
color: #64748b;
margin-bottom: 2px;
}
}
.section-subtitle {
margin: 0 0 10px;
font-size: 13px;
font-weight: 600;
}
.transfer-card {
display: flex;
gap: 12px 16px;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
padding: 8px 12px;
border: 1px solid var(--border, #d9e8e2);
border-radius: 8px;
}
.transfer-card__main {
min-width: 0;
flex: 1;
}
.transfer-card__top {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 10px;
margin-bottom: 4px;
}
.transfer-card__meta {
display: flex;
flex-wrap: wrap;
gap: 8px 16px;
font-size: 13px;
color: #64748b;
}
.transfer-card__attach {
display: flex;
flex-shrink: 0;
flex-wrap: wrap;
gap: 8px;
align-items: center;
justify-content: flex-end;
max-width: 52%;
}
.transfer-card__attach-label {
flex-shrink: 0;
font-size: 12px;
color: #64748b;
}
.attach-preview-img {
display: block;
max-width: 100%;
margin: 0 auto;
}
</style>
@@ -12,7 +12,7 @@
</div>
<div class="filter-block">
<el-form :model="pendingSearchForm" class="filter-form" label-position="top" @submit.prevent>
<el-form :model="pendingSearchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input
@@ -113,7 +113,6 @@
<el-form
:model="confirmedSearchForm"
class="filter-form"
label-position="top"
@submit.prevent
>
<div class="filter-grid">
@@ -713,8 +712,7 @@
font-size: 13px;
font-weight: 500;
color: var(--mint-text-muted, #64748b);
padding: 0 0 4px;
line-height: 1.2;
padding-right: 12px;
}
.pending-card-section {
@@ -12,7 +12,7 @@
</div>
<div class="filter-block">
<el-form :model="pendingSearchForm" class="filter-form" label-position="top" @submit.prevent>
<el-form :model="pendingSearchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input
@@ -137,7 +137,6 @@
<el-form
:model="confirmedSearchForm"
class="filter-form"
label-position="top"
@submit.prevent
>
<div class="filter-grid">
@@ -651,7 +650,7 @@
async function submitReject() {
if (!currentDetailId.value) return
try {
await ElMessageBox.confirm('确定退回?退回后状态将变为「已缴费」。', '退回确认', {
await ElMessageBox.confirm('确定退回?退回后状态将变为「缴费成功」。', '退回确认', {
type: 'warning'
})
} catch {
@@ -710,8 +709,7 @@
font-size: 13px;
font-weight: 500;
color: var(--mint-text-muted, #64748b);
padding: 0 0 4px;
line-height: 1.2;
padding-right: 12px;
}
.pending-card-section {
@@ -1,88 +1,17 @@
<!-- 缴费信息(流程看板 / 按样本) -->
<!-- 缴费信息 · Excel 单列表 -->
<template>
<div class="page-container">
<section class="panel">
<nav class="pill-tab-nav" role="tablist" aria-label="视图类型">
<div class="pill-tab-nav__rail">
<div class="pill-tab-nav__progress" :style="pillProgressStyle" />
<button
v-for="(item, index) in entityTabs"
:key="item.key"
type="button"
class="pill-tab-nav__step"
:class="{
'is-active': activeTab === item.key,
'is-done': index < activeTabIndex
}"
role="tab"
:aria-selected="activeTab === item.key"
@click="activeTab = item.key"
>
<span class="pill-tab-nav__index">{{ index + 1 }}</span>
<span class="pill-tab-nav__text">
<span class="pill-tab-nav__title">{{ item.title }}</span>
<span class="pill-tab-nav__desc">{{ item.desc }}</span>
</span>
</button>
</div>
</nav>
<PaymentInfoTab v-if="activeTab === 'flow'" />
<PaymentBySampleTab v-else-if="activeTab === 'by-sample'" />
<div class="panel-top">
<h2 class="title-bar-heading">缴费信息</h2>
</div>
<PaymentExcelList />
</section>
</div>
</template>
<script setup lang="ts">
import PaymentInfoTab from '../protocol-audit/PaymentInfoTab.vue'
import PaymentBySampleTab from './PaymentBySampleTab.vue'
import PaymentExcelList from './PaymentExcelList.vue'
defineOptions({ name: 'CellStoragePaymentInfo' })
const VALID_TABS = ['flow', 'by-sample'] as const
type EntityTabKey = (typeof VALID_TABS)[number]
const entityTabs: Array<{
key: EntityTabKey
title: string
desc: string
}> = [
{
key: 'flow',
title: '流程看板',
desc: '按缴费流程状态处理'
},
{
key: 'by-sample',
title: '按样本',
desc: '一协议一样本的缴费总览'
}
]
const route = useRoute()
const activeTab = ref<EntityTabKey>('flow')
const activeTabIndex = computed(() =>
Math.max(
0,
entityTabs.findIndex((item) => item.key === activeTab.value)
)
)
const pillProgressStyle = computed(() => ({
width: `calc(${100 / entityTabs.length}% - 3px)`,
transform: `translateX(${activeTabIndex.value * 100}%)`
}))
onMounted(() => {
const tab = String(route.query.tab || '')
if (tab === 'payment-info') {
activeTab.value = 'flow'
return
}
if (VALID_TABS.includes(tab as EntityTabKey)) {
activeTab.value = tab as EntityTabKey
}
})
</script>
@@ -3,12 +3,8 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">预签约订单</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" label-position="top" @submit.prevent>
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input
@@ -276,7 +272,7 @@
async function handleConvert(row: Record<string, any>) {
await ElMessageBox.confirm(
'确认转为正式采集协议单?意向金不会自动写入样本缴费,仅在正式单中提示已确认合计。',
'确认转为正式采集协议单?将带入采集专员/市场专员/地区经理;意向金通过预签订单关联在正式单中展示(与预签同一数据,不自动写入样本缴费)。',
'转正式协议',
{ type: 'warning' }
)
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,9 +1,8 @@
<!-- 采集协议单管理 · 缴费信息 Tab(五列看板) -->
<!-- eslint-disable vue/no-v-model-argument -->
<!-- 缴费信息 · 按转账笔状态列表(已缴费 / 确认中 / 成功) -->
<template>
<div class="payment-info-tab">
<div class="filter-block">
<el-form :model="searchForm" class="filter-form filter-form--inline-label" @submit.prevent>
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input
@@ -49,144 +48,128 @@
</el-form>
</div>
<div class="payment-kanban-board">
<div
v-for="col in kanbanColumns"
:key="col.key"
class="payment-kanban-col"
:class="`payment-kanban-col--${col.key}`"
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="tableData"
v-loading="loading"
stripe
row-key="id"
@row-dblclick="handleView"
>
<div class="payment-kanban-col-hd">
<span class="payment-kanban-col-title">
{{ col.label }}
<span class="payment-kanban-count">{{ columnStates[col.key].total }}</span>
</span>
</div>
<div v-loading="columnStates[col.key].loading" class="payment-kanban-list">
<article
v-for="row in columnStates[col.key].list"
:key="String(row.id)"
class="payment-card"
:class="{ 'payment-card--due-soon': isDueSoonCard(col.key, row) }"
@dblclick="handleViewProtocol(row)"
>
<div class="payment-card__head">
<div class="payment-card__head-main">
<div class="payment-card__identity">
<span class="payment-card__name">{{ row.motherName || '—' }}</span>
<span class="payment-card__sub">{{
row.motherPhone ? String(row.motherPhone) : '—'
}}</span>
<span class="payment-card__sub payment-card__sub--id">{{
row.motherIdCard ? maskIdCard(row.motherIdCard) : '—'
}}</span>
</div>
<el-tag
:type="protocolStatusTagType(String(row.protocolStatus || ''))"
size="small"
class="payment-card__status"
>
{{
protocolStatusDisplayLabel(
String(row.protocolStatus || ''),
String(row.voidType || '')
)
}}
</el-tag>
</div>
</div>
<div class="payment-card__body">
<div class="payment-card__kv">
<label>缴费方式</label>
<span>{{ formatPayModeSummary(row) }}</span>
</div>
<div class="payment-card__kv">
<label>应缴费时间</label>
<span>{{ formatDate(String(row.installmentDueDate || '')) }}</span>
</div>
<div class="payment-card__kv payment-card__kv--amount">
<label>应缴金额</label>
<span>{{ formatAmount(row.dueAmount) }}</span>
</div>
<div class="payment-card__kv payment-card__kv--amount">
<label>实缴金额</label>
<span>{{ formatAmount(row.transferAmount) }}</span>
</div>
<div class="payment-card__kv">
<label>转账方式</label>
<span>{{ transferTypeLabel(String(row.transferType || '')) || '—' }}</span>
</div>
</div>
<div class="payment-card__expand">
<button
type="button"
class="payment-card__expand-toggle"
@click.stop="toggleCardExpand(String(row.id))"
>
<el-icon>
<ArrowUp v-if="isCardExpanded(String(row.id))" />
<ArrowDown v-else />
</el-icon>
{{ isCardExpanded(String(row.id)) ? '收起详情' : '展开详情' }}
</button>
<div v-if="isCardExpanded(String(row.id))" class="payment-card__expand-body">
<div class="payment-card__kv">
<label>新生儿</label>
<span>{{ row.newbornName || '—' }}</span>
</div>
<div class="payment-card__kv">
<label>新生儿身份证</label>
<span>{{ maskIdCard(row.newbornIdCard) }}</span>
</div>
<div class="payment-card__kv">
<label>转账时间</label>
<span>{{ formatDisplayOrDash(row.transferTime) }}</span>
</div>
<div class="payment-card__kv">
<label>创建时间</label>
<span>{{ formatDisplayOrDash(row.createTime) }}</span>
</div>
</div>
</div>
<div class="payment-card__foot">
<el-button class="btn-op-item" @click.stop="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-button
v-if="col.key === 'dfj'"
class="btn-op-item primary"
@click.stop="openReceiptFinanceDialog(row)"
>
<el-icon><Check /></el-icon>缴费确认
</el-button>
<!-- 新模型退费改协议级登记,看板不再提交退费确认 -->
</div>
</article>
<div
v-if="!columnStates[col.key].loading && !columnStates[col.key].list.length"
class="payment-kanban-empty"
>
暂无{{ col.label }}明细
</div>
</div>
<div v-if="columnStates[col.key].total > 0" class="payment-kanban-col-footer">
<el-pagination
small
:current-page="columnStates[col.key].page"
:page-size="columnStates[col.key].pageSize"
:total="columnStates[col.key].total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(val) => onColumnPageSizeChange(col.key, val)"
@current-change="(val) => onColumnPageChange(col.key, val)"
/>
</div>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(i) => (pagination.page - 1) * pagination.pageSize + i + 1"
/>
<el-table-column
prop="protocolNo"
label="协议号"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.protocolNo || '—' }}</template>
</el-table-column>
<el-table-column label="客户" min-width="150" align="center" header-align="center">
<template #default="{ row }">
<div>{{ row.motherName || '—' }}</div>
<div v-if="row.motherPhone" class="muted-sub">{{ row.motherPhone }}</div>
</template>
</el-table-column>
<el-table-column
prop="sampleCode"
label="样本编码"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.sampleCode || '—' }}</template>
</el-table-column>
<el-table-column
prop="protocolStatus"
label="协议状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
:type="protocolStatusTagType(String(row.protocolStatus || ''))"
size="small"
>
{{
protocolStatusDisplayLabel(
String(row.protocolStatus || ''),
String(row.voidType || '')
)
}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="缴费方式" min-width="130" align="center" header-align="center">
<template #default="{ row }">{{ formatPayModeSummary(row) }}</template>
</el-table-column>
<el-table-column label="应缴费时间" min-width="130" align="center" header-align="center">
<template #default="{ row }">
<span :class="{ 'is-due-soon': isDueSoonRow(row) }">
{{ formatDate(String(row.installmentDueDate || '')) }}
</span>
</template>
</el-table-column>
<el-table-column label="应缴金额" min-width="110" align="center" header-align="center">
<template #default="{ row }">{{ formatAmount(row.dueAmount) }}</template>
</el-table-column>
<el-table-column label="实缴金额" min-width="110" align="center" header-align="center">
<template #default="{ row }">{{ formatAmount(row.transferAmount) }}</template>
</el-table-column>
<el-table-column label="转账方式" min-width="110" align="center" header-align="center">
<template #default="{ row }">
{{ transferTypeLabel(String(row.transferType || '')) || '—' }}
</template>
</el-table-column>
<el-table-column label="转账时间" min-width="160" align="center" header-align="center">
<template #default="{ row }">{{ formatDisplayOrDash(row.transferTime) }}</template>
</el-table-column>
<el-table-column
label="操作"
min-width="260"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-button
v-if="payStatus === 'dfj'"
class="btn-op-item primary"
@click="openReceiptFinanceDialog(row)"
>
<el-icon><Check /></el-icon>缴费确认
</el-button>
<el-button class="btn-op-item" @click="handleViewProtocol(row)">
<el-icon><Document /></el-icon>协议单
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
@current-change="(val) => ((pagination.page = val), loadData())"
/>
</div>
</div>
@@ -195,8 +178,8 @@
:preview-row="receiptPreviewRow"
:is-transfer="receiptIsTransfer"
:target-id="receiptTargetId"
@saved="loadAllColumns()"
@submitted="loadAllColumns()"
@saved="loadData()"
@submitted="loadData()"
/>
<el-dialog
@@ -236,24 +219,13 @@
<script setup lang="ts">
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import {
RefreshLeft,
Search,
View,
Close,
Check,
ArrowDown,
ArrowUp
} from '@element-plus/icons-vue'
import { RefreshLeft, Search, View, Close, Check, Document } from '@element-plus/icons-vue'
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
import ClinicalPaymentConfirmTimeline from '@/components/business/clinical-payment-confirm-timeline/index.vue'
import PaymentReceiptConfirmDialog from '@/components/business/payment-receipt-confirm-dialog/index.vue'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import { fetchPaymentDetailList, type CollectionProtocolRow } from '@/api/collection-protocol'
import { fetchPaymentTransferList } from '@/api/protocol-sample-payment'
import { maskIdCard } from '@/utils/mask-sensitive'
import {
isPaymentDueWithinWarnWindow,
protocolStatusDisplayLabel,
@@ -265,44 +237,21 @@
} from '@/utils/protocol-payment-labels'
import { formatMoneyDisplay } from '@/utils/money-format'
const transferTypeOptions = ref<Api.Dict.DictDataOption[]>([])
defineOptions({ name: 'CellStoragePaymentInfoTab' })
type PayStatusKey = 'dfj' | 'jfqrz' | 'yjf'
interface KanbanColumnDef {
key: PayStatusKey
label: string
}
interface KanbanColumnState {
list: Record<string, unknown>[]
total: number
page: number
pageSize: number
loading: boolean
}
/** P0:看板仅保留收款三列;退费列下线(旧 detail 退费态仍可由财务旧接口处理) */
const kanbanColumns: KanbanColumnDef[] = [
{ key: 'dfj', label: '已缴费' },
{ key: 'jfqrz', label: '缴费确认中' },
{ key: 'yjf', label: '缴费成功' }
]
function createColumnState(): KanbanColumnState {
return { list: [], total: 0, page: 1, pageSize: 10, loading: false }
}
const props = defineProps<{
payStatus: PayStatusKey
}>()
const transferTypeOptions = ref<Api.Dict.DictDataOption[]>([])
const searchForm = reactive({ keyword: '', transferType: '' })
const installmentDueDateRange = ref<[string, string] | null>(null)
const columnStates = reactive<Record<PayStatusKey, KanbanColumnState>>({
dfj: createColumnState(),
jfqrz: createColumnState(),
yjf: createColumnState()
})
const expandedCardIds = ref<Set<string>>(new Set())
const tableData = ref<Record<string, unknown>[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const viewVisible = ref(false)
const viewProtocolId = ref<string | null>(null)
const viewRow = ref<CollectionProtocolRow | null>(null)
@@ -315,7 +264,6 @@
const receiptPreviewRow = ref<Record<string, unknown> | null>(null)
let loadRequestId = 0
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
function listQueryParams() {
@@ -331,76 +279,43 @@
return row.source === 'formal' || Boolean(row.sampleCode && row.scheduleId)
}
async function loadColumn(key: PayStatusKey) {
const col = columnStates[key]
col.loading = true
async function loadData() {
const requestId = ++loadRequestId
loading.value = true
try {
const q = listQueryParams()
const [legacy, transfer] = await Promise.all([
fetchPaymentDetailList({
page: col.page,
pageSize: col.pageSize,
payStatus: key,
page: pagination.page,
pageSize: pagination.pageSize,
payStatus: props.payStatus,
...q
}),
fetchPaymentTransferList({
page: col.page,
pageSize: col.pageSize,
payStatus: key,
page: pagination.page,
pageSize: pagination.pageSize,
payStatus: props.payStatus,
keyword: q.keyword,
installmentDueDateStart: q.installmentDueDateStart,
installmentDueDateEnd: q.installmentDueDateEnd
})
])
if (requestId !== loadRequestId) return
let transferList = transfer.list || []
if (q.transferType) {
transferList = transferList.filter(
(r) => String(r.transferType || '') === String(q.transferType)
)
}
// 新转账笔优先展示,其后拼接旧 detail(version=1)
col.list = [...transferList, ...(legacy.list || [])]
col.total = (transfer.total ?? 0) + (legacy.total ?? 0)
tableData.value = [...transferList, ...(legacy.list || [])]
pagination.total = (transfer.total ?? 0) + (legacy.total ?? 0)
} finally {
col.loading = false
if (requestId === loadRequestId) loading.value = false
}
}
async function loadAllColumns(resetPage = false) {
const requestId = ++loadRequestId
if (resetPage) {
kanbanColumns.forEach((col) => {
columnStates[col.key].page = 1
})
}
await Promise.all(kanbanColumns.map((col) => loadColumn(col.key)))
if (requestId !== loadRequestId) return
pruneExpandedCards()
}
function pruneExpandedCards() {
const allIds = new Set(
kanbanColumns.flatMap((col) => columnStates[col.key].list.map((r) => String(r.id)))
)
expandedCardIds.value = new Set([...expandedCardIds.value].filter((id) => allIds.has(id)))
}
function isCardExpanded(id: string) {
return expandedCardIds.value.has(id)
}
function toggleCardExpand(id: string) {
const next = new Set(expandedCardIds.value)
if (next.has(id)) {
next.delete(id)
} else {
next.add(id)
}
expandedCardIds.value = next
}
function isDueSoonCard(key: PayStatusKey, row: Record<string, unknown>) {
if (key !== 'dfj') return false
function isDueSoonRow(row: Record<string, unknown>) {
if (props.payStatus !== 'dfj') return false
if (String(row.payStatus || '') !== 'dfj') return false
return isPaymentDueWithinWarnWindow(row.installmentDueDate)
}
@@ -451,17 +366,6 @@
return '¥' + formatMoneyDisplay(v)
}
function onColumnPageChange(key: PayStatusKey, page: number) {
columnStates[key].page = page
loadColumn(key)
}
function onColumnPageSizeChange(key: PayStatusKey, pageSize: number) {
columnStates[key].page = 1
columnStates[key].pageSize = pageSize
loadColumn(key)
}
function openReceiptFinanceDialog(row: Record<string, unknown>) {
const id = String(row.id || '')
if (!id) return
@@ -478,51 +382,42 @@
}
function handleSearch() {
loadAllColumns(true)
pagination.page = 1
loadData()
}
function handleReset() {
searchForm.keyword = ''
searchForm.transferType = ''
installmentDueDateRange.value = null
loadAllColumns(true)
pagination.page = 1
loadData()
}
watchDebounced(
[searchForm, installmentDueDateRange],
watch(
() => props.payStatus,
() => {
loadAllColumns(true)
},
{ debounce: 300, deep: true }
pagination.page = 1
loadData()
}
)
onMounted(async () => {
await loadTransferTypeDict()
transferTypeOptions.value = getTransferTypeOptions()
loadAllColumns()
loadData()
})
</script>
<style scoped lang="scss">
@import './payment-info-kanban.scss';
.filter-form--inline-label :deep(.el-form-item) {
margin-bottom: 0;
min-width: 0;
align-items: center;
}
.filter-form--inline-label :deep(.el-form-item__label) {
font-size: 13px;
font-weight: 500;
.muted-sub {
margin-top: 2px;
font-size: 12px;
color: var(--mint-text-muted, #64748b);
padding-right: 8px;
line-height: 36px;
height: 36px;
}
.filter-form--inline-label :deep(.el-form-item__content) {
flex: 1;
min-width: 0;
.is-due-soon {
color: var(--el-color-warning);
font-weight: 600;
}
</style>
@@ -284,7 +284,7 @@
</el-table-column>
<el-table-column
label="操作"
min-width="280"
min-width="200"
fixed="right"
align="center"
header-align="center"
@@ -294,15 +294,27 @@
<el-button class="btn-op-item" @click.stop="openAuditDialog(row.protocol)">
<el-icon><CircleCheck /></el-icon>审核
</el-button>
<el-button class="btn-op-item" @click.stop="handleView(row.protocol)">
<el-icon><View /></el-icon>查看
</el-button>
<el-button class="btn-op-item" @click.stop="handleEdit(row.protocol)">
<el-icon><Edit /></el-icon>编辑
</el-button>
<el-button class="btn-op-item" @click.stop="handleDelete(row.protocol)">
<el-icon><Delete /></el-icon>删除
</el-button>
<el-dropdown
trigger="hover"
@command="(cmd) => handleDropdownCommand(String(cmd), row)"
>
<el-button class="btn-op-item" @click.stop>
<el-icon><More /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="view">
<el-icon><View /></el-icon>查看
</el-dropdown-item>
<el-dropdown-item command="delete" divided>
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
</el-table-column>
@@ -372,7 +384,8 @@
Select,
Switch,
Timer,
Coin
Coin,
More
} from '@element-plus/icons-vue'
import ProtocolFormDialog from '../protocol/ProtocolFormDialog.vue'
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
@@ -437,6 +450,11 @@
handleView(row.protocol)
}
function handleDropdownCommand(cmd: string, row: ProtocolAuditFlatRow) {
if (cmd === 'view') handleView(row.protocol)
else if (cmd === 'delete') handleDelete(row.protocol)
}
function payLines(row: ProtocolAuditFlatRow) {
return firstPayTimeLines(row.paymentSummary)
}
@@ -639,7 +657,8 @@
.op-row {
display: inline-flex;
flex-wrap: wrap;
gap: 4px;
gap: 8px;
justify-content: center;
align-items: center;
}
</style>
@@ -1,301 +0,0 @@
<!-- 样本信息管理 · 样本采集信息 Tab -->
<template>
<div class="sample-collection-info-tab">
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input v-model="searchForm.keyword" placeholder="姓名/样本编码/入库编码" clearable />
</el-form-item>
<el-form-item label="采集状态">
<el-select
v-model="searchForm.sampleStatus"
placeholder="全部"
clearable
style="width: 100%"
>
<el-option label="未采集" value="uncollected" />
<el-option label="已采集" value="ycj" />
<el-option label="检测中" value="jcz" />
<el-option label="已入库" value="yrk" />
<el-option label="已作废" value="yzf" />
</el-select>
</el-form-item>
</div>
<div class="filter-actions-row">
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
</el-button>
<el-button class="btn-main" type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>搜索
</el-button>
</div>
</div>
</el-form>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="tableData"
v-loading="loading"
stripe
row-key="protocolSampleId"
@row-dblclick="handleView"
>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(i) => (pagination.page - 1) * pagination.pageSize + i + 1"
/>
<el-table-column
prop="protocolStatus"
label="协议状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
:type="protocolStatusTagType(String(row.protocolStatus || ''))"
size="small"
>{{ protocolStatusDisplayLabel(String(row.protocolStatus || ''), String(row.voidType || '')) }}</el-tag
>
</template>
</el-table-column>
<el-table-column
prop="expectedDeliveryDate"
label="预产期"
min-width="120"
align="center"
header-align="center"
/>
<el-table-column
prop="motherName"
label="母亲姓名"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
prop="newbornName"
label="新生儿姓名"
min-width="110"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="sampleCode"
label="样本编码"
min-width="160"
align="center"
header-align="center"
>
<template #default="{ row }">
<SampleCodeWithSpecialDisplay
:sample-code="row.sampleCode"
:is-special="!!row.isSpecial"
:special-remark="row.specialRemark"
monospace
/>
</template>
</el-table-column>
<el-table-column
prop="labStorageCode"
label="实验室入库编码"
min-width="150"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.labStorageCode || '—' }}</template>
</el-table-column>
<el-table-column
prop="sampleTypeName"
label="样本类型"
min-width="110"
align="center"
header-align="center"
/>
<el-table-column
prop="sampleStatus"
label="采集状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="collectionStatusTagType(String(row.sampleStatus || ''))" size="small">
{{ row.sampleStatusLabel || collectionStatusLabel(String(row.sampleStatus || '')) }}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="regionName"
label="采集地区"
min-width="120"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="hospitalName"
label="采集医院"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="medicalStaff"
label="采集医护"
min-width="100"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="sampleCollectTime"
label="样本采集时间"
min-width="170"
align="center"
header-align="center"
/>
<el-table-column
prop="maternalBloodCollectTime"
label="母血采集时间"
min-width="170"
align="center"
header-align="center"
/>
<el-table-column
label="操作"
min-width="120"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
@current-change="(val) => ((pagination.page = val), loadData())"
/>
</div>
</div>
<ProtocolViewDialog
v-model="viewVisible"
:protocol-id="viewProtocolId"
:list-row="viewRow"
show-audit-history
show-storage-cert
show-fullmoon-insurance
/>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { Search, RefreshLeft, View } from '@element-plus/icons-vue'
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
import SampleCodeWithSpecialDisplay from '@/components/business/sample-code-with-special-display/index.vue'
import { fetchProtocolSampleCollectionList } from '@/api/protocol-sample-collection'
import { type CollectionProtocolRow } from '@/api/collection-protocol'
import {
protocolStatusDisplayLabel,
protocolStatusTagType,
sampleStatusLabel,
sampleStatusTagType
} from '@/utils/status-tag-registry'
defineOptions({ name: 'CellStorageSampleCollectionInfoTab' })
function collectionStatusLabel(status: string) {
return status ? sampleStatusLabel(status) : '未采集'
}
function collectionStatusTagType(status: string): 'success' | 'warning' | 'danger' | 'info' | 'primary' {
return status ? sampleStatusTagType(status) : 'info'
}
const searchForm = reactive({ keyword: '', sampleStatus: '' })
const tableData = ref<Record<string, unknown>[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const viewVisible = ref(false)
const viewProtocolId = ref<string | null>(null)
const viewRow = ref<CollectionProtocolRow | null>(null)
async function loadData() {
loading.value = true
try {
const result = await fetchProtocolSampleCollectionList({
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined,
sampleStatus: searchForm.sampleStatus || undefined
})
const res = (result as Record<string, unknown>) || {}
tableData.value = (res.list as Record<string, unknown>[]) || []
pagination.total = Number(res.total) || 0
} finally {
loading.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
}
function handleReset() {
Object.assign(searchForm, { keyword: '', sampleStatus: '' })
handleSearch()
}
function handleView(row: Record<string, unknown>) {
const pid = String(row.collectionProtocolId || '')
if (!pid) {
ElMessage.warning('缺少关联协议单,无法查看')
return
}
viewProtocolId.value = pid
viewRow.value = {
id: pid,
motherName: row.motherName,
newbornName: row.newbornName
} as CollectionProtocolRow
viewVisible.value = true
}
watchDebounced(
searchForm,
() => {
pagination.page = 1
loadData()
},
{ debounce: 300, deep: true }
)
onMounted(() => {
loadData()
})
</script>
@@ -1,355 +0,0 @@
<!-- 样本信息管理 · 样本质检信息 Tab -->
<template>
<div class="sample-qc-info-tab">
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input v-model="searchForm.keyword" placeholder="姓名/样本编码/入库编码" clearable />
</el-form-item>
<el-form-item label="质检状态">
<el-select
v-model="searchForm.qcStatus"
placeholder="全部"
clearable
style="width: 100%"
>
<el-option label="待质检" value="dzj" />
<el-option label="质检中" value="zjz" />
<el-option label="通过" value="tg" />
<el-option label="不通过" value="btg" />
<el-option label="已作废" value="yzf" />
</el-select>
</el-form-item>
<el-form-item label="通知状态">
<el-select
v-model="searchForm.smsNotified"
placeholder="全部"
clearable
style="width: 100%"
>
<el-option label="已通知" value="1" />
<el-option label="未通知" value="0" />
</el-select>
</el-form-item>
<el-form-item label="样本时间">
<el-date-picker
v-model="sampleTimeRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</div>
<div class="filter-actions-row">
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
</el-button>
<el-button class="btn-main" type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>搜索
</el-button>
</div>
</div>
</el-form>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="tableData"
v-loading="loading"
stripe
row-key="id"
@row-dblclick="handleView"
>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(i) => (pagination.page - 1) * pagination.pageSize + i + 1"
/>
<el-table-column
prop="protocolStatus"
label="协议状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
:type="protocolStatusTagType(String(row.protocolStatus || ''))"
size="small"
>{{ protocolStatusDisplayLabel(String(row.protocolStatus || ''), String(row.voidType || '')) }}</el-tag
>
</template>
</el-table-column>
<el-table-column
prop="motherName"
label="母亲姓名"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
prop="newbornName"
label="新生儿姓名"
min-width="110"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="sampleCode"
label="样本编码"
min-width="170"
align="center"
header-align="center"
>
<template #default="{ row }">
<SampleCodeWithSpecialDisplay
:sample-code="row.sampleCode"
:is-special="!!row.isSpecial"
:special-remark="row.specialRemark"
monospace
/>
</template>
</el-table-column>
<el-table-column
prop="labStorageCode"
label="实验室入库编码"
min-width="150"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.labStorageCode || '—' }}</template>
</el-table-column>
<el-table-column
prop="sampleTypeName"
label="样本类型"
min-width="110"
align="center"
header-align="center"
/>
<el-table-column
prop="qcCompleteTime"
label="质检完成时间"
min-width="170"
align="center"
header-align="center"
/>
<el-table-column
prop="qcStatusLabel"
label="质检状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="qcStatusTagType(String(row.qcStatus || ''))" size="small">
{{ row.qcStatusLabel || '待质检' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="smsNotified"
label="通知状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="row.smsNotified == 1 ? 'success' : 'info'" size="small">
{{ row.smsNotified == 1 ? '已通知' : '未通知' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="操作"
min-width="360"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-button class="btn-op-item" @click="handleExtractSms(row)">
<el-icon><ChatDotRound /></el-icon>提取短信
</el-button>
<el-button class="btn-op-item" @click="handleToggleNotified(row)">
<el-icon><Bell /></el-icon>{{ row.smsNotified == 1 ? '标记未通知' : '标记已通知' }}
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
@current-change="(val) => ((pagination.page = val), loadData())"
/>
</div>
</div>
<ProtocolViewDialog
v-model="viewVisible"
:protocol-id="viewProtocolId"
:list-row="viewRow"
show-audit-history
show-storage-cert
show-fullmoon-insurance
/>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { Search, RefreshLeft, View, ChatDotRound, Bell } from '@element-plus/icons-vue'
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
import { copyTextWithFallback } from '@/utils/copy-text'
import {
fetchQcSmsList,
fetchToggleQcSmsNotified,
fetchGenerateQcSms
} from '@/api/qc-sms-notification'
import { type CollectionProtocolRow } from '@/api/collection-protocol'
import SampleCodeWithSpecialDisplay from '@/components/business/sample-code-with-special-display/index.vue'
import {
protocolStatusDisplayLabel,
protocolStatusTagType
} from '@/utils/status-tag-registry'
defineOptions({ name: 'CellStorageSampleQcInfoTab' })
function qcStatusTagType(status: string) {
const map: Record<string, 'success' | 'warning' | 'danger' | 'info'> = {
dzj: 'info',
zjz: 'warning',
tg: 'success',
btg: 'danger',
yzf: 'danger'
}
return map[status] || 'info'
}
function isQcCompleted(row: Record<string, unknown>) {
return row.qcStatus === 'tg' || row.qcStatus === 'btg'
}
const searchForm = reactive({ keyword: '', qcStatus: '', smsNotified: '' })
const sampleTimeRange = ref<[string, string] | null>(null)
const tableData = ref<any[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const viewVisible = ref(false)
const viewProtocolId = ref<string | null>(null)
const viewRow = ref<CollectionProtocolRow | null>(null)
async function loadData() {
loading.value = true
try {
const result = await fetchQcSmsList({
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined,
qcStatus: searchForm.qcStatus || undefined,
smsNotified: searchForm.smsNotified || undefined,
qcCompleteTimeStart: sampleTimeRange.value?.[0] || undefined,
qcCompleteTimeEnd: sampleTimeRange.value?.[1] || undefined
})
const res = (result as any) || {}
tableData.value = res.list || []
pagination.total = res.total || 0
} finally {
loading.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
}
function handleReset() {
Object.assign(searchForm, { keyword: '', qcStatus: '', smsNotified: '' })
sampleTimeRange.value = null
handleSearch()
}
function handleView(row: Record<string, unknown>) {
const pid = String(row.collectionProtocolId || row.protocolId || '')
if (!pid) {
ElMessage.warning('缺少关联协议单,无法查看')
return
}
viewProtocolId.value = pid
viewRow.value = {
id: pid,
motherName: row.motherName,
newbornName: row.newbornName
}
viewVisible.value = true
}
async function handleExtractSms(row: any) {
try {
const result = await fetchGenerateQcSms(row.id, {
qcWorkOrderId: row.qcWorkOrderId,
protocolSampleId: row.protocolSampleId
})
const content = (result as any)?.smsContent || ''
if (!content || content.startsWith('暂无短信内容')) {
ElMessage.warning(content || '短信内容为空')
return
}
await copyTextWithFallback(content, { successMessage: '短信内容已复制到剪贴板' })
} catch {
ElMessage.error('提取短信失败')
}
}
async function handleToggleNotified(row: any) {
if (!isQcCompleted(row)) {
ElMessage.warning('质检尚未完成,暂不可标记通知状态')
return
}
const newVal = row.smsNotified == 1 ? 0 : 1
try {
await fetchToggleQcSmsNotified(row.id, {
smsNotified: newVal,
qcWorkOrderId: row.qcWorkOrderId,
protocolSampleId: row.protocolSampleId
})
ElMessage.success(newVal === 1 ? '已标记为已通知' : '已标记为未通知')
loadData()
} catch {
ElMessage.error('操作失败')
}
}
watchDebounced(
[searchForm, sampleTimeRange],
() => {
pagination.page = 1
loadData()
},
{ debounce: 300, deep: true }
)
onMounted(() => {
loadData()
})
</script>
@@ -1,345 +0,0 @@
<!-- 样本信息管理 · 样本接收信息 Tab -->
<template>
<div class="sample-reception-info-tab">
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input v-model="searchForm.keyword" placeholder="姓名/样本编码/入库编码" clearable />
</el-form-item>
<el-form-item label="接收结论">
<el-select
v-model="searchForm.acceptConclusion"
placeholder="全部"
clearable
style="width: 100%"
>
<el-option label="接收" value="js" />
<el-option label="拒收" value="bj" />
<el-option label="待接收确认" value="dqr" />
</el-select>
</el-form-item>
<el-form-item label="通知状态">
<el-select
v-model="searchForm.smsNotified"
placeholder="全部"
clearable
style="width: 100%"
>
<el-option label="已通知" value="1" />
<el-option label="未通知" value="0" />
</el-select>
</el-form-item>
<el-form-item label="接收时间">
<el-date-picker
v-model="receptionTimeRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</div>
<div class="filter-actions-row">
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
</el-button>
<el-button class="btn-main" type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>搜索
</el-button>
</div>
</div>
</el-form>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="tableData"
v-loading="loading"
stripe
row-key="id"
@row-dblclick="handleView"
>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(i) => (pagination.page - 1) * pagination.pageSize + i + 1"
/>
<el-table-column
prop="protocolStatus"
label="协议状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
:type="protocolStatusTagType(String(row.protocolStatus || ''))"
size="small"
>{{ protocolStatusDisplayLabel(String(row.protocolStatus || ''), String(row.voidType || '')) }}</el-tag
>
</template>
</el-table-column>
<el-table-column
prop="motherName"
label="母亲姓名"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
prop="newbornName"
label="新生儿姓名"
min-width="110"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="sampleCode"
label="样本编码"
min-width="170"
align="center"
header-align="center"
>
<template #default="{ row }">
<SampleCodeWithSpecialDisplay
:sample-code="row.sampleCode"
:is-special="!!row.isSpecial"
:special-remark="row.specialRemark"
monospace
/>
</template>
</el-table-column>
<el-table-column
prop="labStorageCode"
label="实验室入库编码"
min-width="150"
align="center"
header-align="center"
>
<template #default="{ row }">
{{ row.labStorageCode || '—' }}
</template>
</el-table-column>
<el-table-column
prop="sampleTypeName"
label="样本类型"
min-width="110"
align="center"
header-align="center"
/>
<el-table-column
prop="receptionTime"
label="接收时间"
min-width="170"
align="center"
header-align="center"
/>
<el-table-column
prop="acceptConclusion"
label="接收结论"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
:type="
row.acceptConclusion === 'js'
? 'success'
: row.acceptConclusion === 'bj'
? 'danger'
: 'warning'
"
size="small"
>
{{
row.acceptConclusionLabel ||
(row.acceptConclusion === 'js'
? '接收'
: row.acceptConclusion === 'bj'
? '拒收'
: '待接收确认')
}}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="smsNotified"
label="通知状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="row.smsNotified == 1 ? 'success' : 'info'" size="small">
{{ row.smsNotified == 1 ? '已通知' : '未通知' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="操作"
min-width="360"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-button class="btn-op-item" @click="handleExtractSms(row)">
<el-icon><ChatDotRound /></el-icon>提取短信
</el-button>
<el-button class="btn-op-item" @click="handleToggleNotified(row)">
<el-icon><Bell /></el-icon>{{ row.smsNotified == 1 ? '标记未通知' : '标记已通知' }}
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
@current-change="(val) => ((pagination.page = val), loadData())"
/>
</div>
</div>
<ProtocolViewDialog
v-model="viewVisible"
:protocol-id="viewProtocolId"
:list-row="viewRow"
show-audit-history
show-storage-cert
show-fullmoon-insurance
/>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { Search, RefreshLeft, View, ChatDotRound, Bell } from '@element-plus/icons-vue'
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
import { copyTextWithFallback } from '@/utils/copy-text'
import {
fetchSampleSmsNotificationList,
fetchToggleSmsNotified,
fetchGenerateSms
} from '@/api/sample-sms-notification'
import { type CollectionProtocolRow } from '@/api/collection-protocol'
import SampleCodeWithSpecialDisplay from '@/components/business/sample-code-with-special-display/index.vue'
import { protocolStatusDisplayLabel, protocolStatusTagType } from '@/utils/status-tag-registry'
defineOptions({ name: 'CellStorageSampleReceptionInfoTab' })
const searchForm = reactive({ keyword: '', acceptConclusion: '', smsNotified: '' })
const receptionTimeRange = ref<[string, string] | null>(null)
const tableData = ref<any[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const viewVisible = ref(false)
const viewProtocolId = ref<string | null>(null)
const viewRow = ref<CollectionProtocolRow | null>(null)
async function loadData() {
loading.value = true
try {
const result = await fetchSampleSmsNotificationList({
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined,
acceptConclusion: searchForm.acceptConclusion || undefined,
smsNotified: searchForm.smsNotified || undefined,
receptionTimeStart: receptionTimeRange.value?.[0] || undefined,
receptionTimeEnd: receptionTimeRange.value?.[1] || undefined
})
const res = (result as any) || {}
tableData.value = res.list || []
pagination.total = res.total || 0
} finally {
loading.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
}
function handleReset() {
Object.assign(searchForm, { keyword: '', acceptConclusion: '', smsNotified: '' })
receptionTimeRange.value = null
handleSearch()
}
function handleView(row: Record<string, unknown>) {
const pid = String(row.collectionProtocolId || row.protocolId || '')
if (!pid) {
ElMessage.warning('缺少关联协议单,无法查看')
return
}
viewProtocolId.value = pid
viewRow.value = {
id: pid,
motherName: row.motherName,
newbornName: row.newbornName
}
viewVisible.value = true
}
async function handleExtractSms(row: any) {
try {
const result = await fetchGenerateSms(row.id, row.sampleReceptionId)
const content = (result as any)?.smsContent || ''
if (!content) {
ElMessage.warning('短信内容为空')
return
}
await copyTextWithFallback(content, { successMessage: '短信内容已复制到剪贴板' })
} catch {
ElMessage.error('提取短信失败')
}
}
async function handleToggleNotified(row: any) {
const newVal = row.smsNotified == 1 ? 0 : 1
try {
await fetchToggleSmsNotified(row.id, {
smsNotified: newVal,
sampleReceptionId: row.sampleReceptionId
})
ElMessage.success(newVal === 1 ? '已标记为已通知' : '已标记为未通知')
loadData()
} catch {
ElMessage.error('操作失败')
}
}
// 输入检索条件时自动搜索(防抖 300ms)
watchDebounced(
[searchForm, receptionTimeRange],
() => {
pagination.page = 1
loadData()
},
{ debounce: 300, deep: true }
)
onMounted(() => {
loadData()
})
</script>
@@ -1,866 +0,0 @@
<!-- 采集协议单管理 · 储存证 Tab -->
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="storage-cert-tab">
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input v-model="searchForm.keyword" placeholder="姓名" clearable />
</el-form-item>
<el-form-item label="制作状态">
<el-select
v-model="searchForm.makeStatus"
placeholder="全部"
clearable
style="width: 100%"
>
<el-option label="未制作" value="0" />
<el-option label="已制作" value="1" />
</el-select>
</el-form-item>
<el-form-item label="入库日期">
<el-date-picker
v-model="storageInDateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</div>
<div class="filter-actions-row">
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
</el-button>
<el-button class="btn-main" type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>搜索
</el-button>
</div>
</div>
</el-form>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="tableData"
v-loading="loading"
stripe
row-key="id"
:row-class-name="storageCertRowClassName"
@row-dblclick="handleView"
>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(i) => (pagination.page - 1) * pagination.pageSize + i + 1"
/>
<el-table-column
prop="protocolStatus"
label="协议状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
:type="protocolStatusTagType(String(row.protocolStatus || ''))"
size="small"
>{{ protocolStatusDisplayLabel(String(row.protocolStatus || ''), String(row.voidType || '')) }}</el-tag
>
</template>
</el-table-column>
<el-table-column
prop="motherName"
label="母亲姓名"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
prop="motherPhone"
label="母亲联系方式"
min-width="130"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.motherPhone || '—' }}</template>
</el-table-column>
<el-table-column
prop="motherIdCard"
label="身份证号"
min-width="170"
align="center"
header-align="center"
>
<template #default="{ row }">{{ maskIdCard(row.motherIdCard) }}</template>
</el-table-column>
<el-table-column
prop="newbornInfo"
label="新生儿信息"
min-width="200"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="sampleInfo"
label="样本信息"
min-width="200"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="storageInDate"
label="入库日期"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">{{ formatStorageInDate(row.storageInDate) }}</template>
</el-table-column>
<el-table-column
prop="makeStatus"
label="制作状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="row.makeStatus == '1' ? 'success' : 'warning'" size="small">
{{ row.makeStatus == '1' ? '已制作' : '未制作' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="makeDate"
label="制作日期"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">{{ formatStorageInDate(row.makeDate) }}</template>
</el-table-column>
<el-table-column
label="操作"
min-width="260"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleUpload(row)">
<el-icon><Upload /></el-icon>上传储存证
</el-button>
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
@current-change="(val) => ((pagination.page = val), loadData())"
/>
</div>
</div>
<!-- 上传储存证弹窗 -->
<el-dialog
v-model="uploadDialogVisible"
title="上传储存证"
width="720px"
class="dialog-form-layout"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
>
<el-form
ref="uploadFormRef"
:model="uploadForm"
:rules="uploadFormRules"
label-position="top"
class="storage-cert-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
<el-form-item label="母亲姓名">
<el-input :model-value="uploadRow?.motherName" disabled />
</el-form-item>
<el-form-item label="储存证附件" class="form-col-span-2">
<div
class="attachment-upload"
:class="{ 'is-dragover': isCertAttachDragover }"
v-bind="certAttachDropHandlers"
>
<div class="attachment-list">
<el-upload
ref="certAttachmentUploadRef"
:auto-upload="false"
:show-file-list="false"
:multiple="true"
accept="image/*,video/*,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.zip,.rar"
@change="handleCertAttachmentChange"
>
<div class="upload-card">
<el-icon :size="28" color="#047857"><Plus /></el-icon>
<span class="upload-card-text">上传附件</span>
</div>
</el-upload>
<div
v-for="(file, index) in certAttachments"
:key="file.id || index"
class="attachment-item"
:class="{ 'is-uploading': file._uploading }"
>
<div
class="attachment-preview"
@click="
isImageFile(file) && file.fileUrl ? handlePreviewAttachment(file) : undefined
"
>
<template v-if="isImageFile(file) && file.fileUrl">
<img :src="fullFileUrl(file.fileUrl)" :alt="file.fileName" />
</template>
<template v-else-if="isImageFile(file) && !file.fileUrl">
<el-icon :size="24" color="#94a3b8"><Loading /></el-icon>
</template>
<template v-else-if="isVideoFile(file)">
<div class="attachment-preview__icon attachment-preview__icon--video">
<el-icon :size="28"><VideoPlay /></el-icon>
</div>
</template>
<template v-else>
<div class="attachment-preview__icon attachment-preview__icon--doc">
<el-icon :size="28"><Document /></el-icon>
</div>
</template>
</div>
<div class="attachment-footer">
<span class="attachment-name" :title="file.fileName">{{ file.fileName }}</span>
<div class="attachment-actions">
<el-icon
class="action-btn"
title="下载"
@click="handleDownloadAttachment(file)"
><Download
/></el-icon>
<el-icon
class="action-btn action-btn--danger"
title="删除"
@click="removeCertAttachment(index)"
><Delete
/></el-icon>
</div>
</div>
</div>
</div>
<span class="upload-hint"
>支持拖拽或点击上传图片、视频、PDF、Word、Excel等文件,单文件不超过 20MB</span
>
</div>
</el-form-item>
<div class="form-grid-2">
<el-form-item label="制作日期" prop="makeDate">
<el-date-picker
v-model="uploadForm.makeDate"
type="date"
format="YYYYMMDD"
value-format="YYYYMMDD"
placeholder="选择日期"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="uploadForm.remark" type="textarea" :rows="2" placeholder="可选" />
</el-form-item>
</div>
</el-form>
<template #footer>
<el-button class="btn-ghost" @click="uploadDialogVisible = false">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button
class="btn-main"
type="primary"
:loading="submitLoading"
@click="handleSubmitUpload"
>
<el-icon><Check /></el-icon>确定
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="previewVisible"
title="文件预览"
width="800px"
align-center
append-to-body
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>
<!-- 查看弹窗(与满月待办管理等一致:审核+储存证+保险) -->
<ProtocolViewDialog
v-model="viewVisible"
:protocol-id="viewProtocolId"
:list-row="viewRow"
show-audit-history
show-storage-cert
show-fullmoon-insurance
/>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, nextTick } from 'vue'
import { ElMessage } from 'element-plus'
import {
Plus,
Close,
Check,
Search,
RefreshLeft,
View,
Upload,
Delete,
Document,
VideoPlay,
Loading,
Download
} from '@element-plus/icons-vue'
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
import { fetchStorageCertList } from '@/api/admin'
import {
fetchUpdateCollectionProtocol,
type CollectionProtocolRow
} from '@/api/collection-protocol'
import { fetchUploadAttachment } from '@/api/business'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import { useAttachmentDropZone } from '@/composables/useAttachmentDropZone'
import { maskIdCard } from '@/utils/mask-sensitive'
import { protocolStatusDisplayLabel, protocolStatusTagType } from '@/utils/status-tag-registry'
interface CertAttachmentItem {
id: string
fileName: string
fileUrl: string
fileSize?: number
fileSizeDisplay?: string
fileType?: string
_uploading?: boolean
}
defineOptions({ name: 'CellStorageStorageCertTab' })
const searchForm = reactive({ keyword: '', makeStatus: '0' })
const storageInDateRange = ref<[string, string] | null>(null)
const tableData = ref<any[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
// ---------------------------------------------------------------------------
// 上传弹窗
// ---------------------------------------------------------------------------
const uploadDialogVisible = ref(false)
const uploadRow = ref<any>(null)
const uploadFormRef = ref()
const certAttachmentUploadRef = ref()
const certAttachments = ref<CertAttachmentItem[]>([])
const submitLoading = ref(false)
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
const uploadForm = reactive({
makeDate: '',
remark: ''
})
const uploadFormRules = {
makeDate: [{ required: true, message: '请选择制作日期', trigger: 'change' }]
}
const previewVisible = ref(false)
const previewUrl = ref('')
const previewType = ref<'image' | 'video'>('image')
// ---------------------------------------------------------------------------
// 查看弹窗(与满月待办管理等一致)
// ---------------------------------------------------------------------------
const viewVisible = ref(false)
const viewProtocolId = ref<string | null>(null)
const viewRow = ref<CollectionProtocolRow | null>(null)
/** 新生儿已满月且储存证未制作时标红(列表仅含已生效协议) */
function isStorageCertMakePendingRow(row: Record<string, unknown>) {
if (String(row.makeStatus ?? '0') === '1') return false
const delivery = String(row.newbornDeliveryTime || '').trim()
if (!delivery) return false
const deliveryDate = new Date(delivery.replace(/-/g, '/'))
if (Number.isNaN(deliveryDate.getTime())) return false
const fullmoon = new Date(deliveryDate)
fullmoon.setDate(fullmoon.getDate() + 30)
const today = new Date()
today.setHours(0, 0, 0, 0)
fullmoon.setHours(0, 0, 0, 0)
return fullmoon <= today
}
function storageCertRowClassName({ row }: { row: Record<string, unknown> }) {
return isStorageCertMakePendingRow(row) ? 'row-storage-cert-pending' : ''
}
function formatStorageInDate(val: unknown) {
const s = String(val || '').trim()
if (!s) return '—'
const digits = s.replace(/\D/g, '')
if (digits.length >= 8) {
return `${digits.slice(0, 4)}-${digits.slice(4, 6)}-${digits.slice(6, 8)}`
}
return s
}
// ---------------------------------------------------------------------------
// 数据加载
// ---------------------------------------------------------------------------
async function loadData() {
loading.value = true
try {
const res = await fetchStorageCertList({
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined,
makeStatus: searchForm.makeStatus || undefined,
storageInDateStart: storageInDateRange.value?.[0] || undefined,
storageInDateEnd: storageInDateRange.value?.[1] || undefined
})
tableData.value = (res as any)?.list || []
pagination.total = (res as any)?.total ?? 0
} finally {
loading.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
}
function handleReset() {
searchForm.keyword = ''
searchForm.makeStatus = '0'
storageInDateRange.value = null
pagination.page = 1
loadData()
}
// ---------------------------------------------------------------------------
// 上传储存证
// ---------------------------------------------------------------------------
function fullFileUrl(suffix: string) {
if (!suffix) return ''
if (suffix.startsWith('http://') || suffix.startsWith('https://') || suffix.startsWith('/')) {
return suffix
}
return `${minioBaseUrl}/${suffix}`
}
function isImageFile(file: CertAttachmentItem) {
const url = (file.fileUrl || '').toLowerCase()
const name = (file.fileName || '').toLowerCase()
return (
/\.(jpg|jpeg|png|gif|bmp|webp|svg)(\?|$)/.test(url) ||
/\.(jpg|jpeg|png|gif|bmp|webp|svg)$/.test(name) ||
(file.fileType || '').startsWith('image/')
)
}
function isVideoFile(file: CertAttachmentItem) {
const url = (file.fileUrl || '').toLowerCase()
const name = (file.fileName || '').toLowerCase()
return (
/\.(mp4|webm|ogg|mov|avi)(\?|$)/.test(url) ||
/\.(mp4|webm|ogg|mov|avi)$/.test(name) ||
(file.fileType || '').startsWith('video/')
)
}
function parseCertUrlsToAttachments(urls: string): CertAttachmentItem[] {
return urls
.split(',')
.map((u) => u.trim())
.filter(Boolean)
.map((url, index) => {
const rawName = url.split('/').pop() || ''
const fileName = decodeURIComponent(rawName) || `附件${index + 1}`
return {
id: `existing_${index}`,
fileName,
fileUrl: url,
fileType: '',
_uploading: false
}
})
}
function certAttachmentsToUrls() {
return certAttachments.value
.filter((f) => f.fileUrl && !f._uploading)
.map((f) => f.fileUrl)
.join(',')
}
async function handleCertAttachmentChange(uploadFile: any) {
const file = uploadFile.raw || uploadFile
if (!file) return
const tempId = `temp_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`
certAttachments.value.push({
id: tempId,
fileName: file.name,
fileUrl: '',
fileSize: file.size,
fileSizeDisplay: `${(file.size / 1024).toFixed(1)} KB`,
fileType: file.type || '',
_uploading: true
})
const idx = certAttachments.value.length - 1
try {
const fd = new FormData()
fd.append('folder', 'storage-cert')
fd.append('file', file)
const res = await fetchUploadAttachment(fd)
certAttachments.value[idx] = {
...certAttachments.value[idx],
id: res.id || tempId,
fileName: file.name || res.fileName,
fileUrl: res.fileUrl,
fileSize: res.fileSize || file.size,
fileSizeDisplay: res.fileSizeDisplay || `${(file.size / 1024).toFixed(1)} KB`,
fileType: res.fileType || file.type || '',
_uploading: false
}
} catch {
ElMessage.error('文件上传失败')
certAttachments.value.splice(idx, 1)
} finally {
nextTick(() => certAttachmentUploadRef.value?.clearFiles())
}
}
function removeCertAttachment(index: number) {
certAttachments.value.splice(index, 1)
}
const { isDragover: isCertAttachDragover, dropZoneHandlers: certAttachDropHandlers } =
useAttachmentDropZone({
onFiles: (files) => {
for (const file of files) {
void handleCertAttachmentChange({ raw: file })
}
}
})
function handlePreviewAttachment(file: CertAttachmentItem) {
if (file._uploading) return
previewUrl.value = fullFileUrl(file.fileUrl)
previewType.value = isVideoFile(file) ? 'video' : 'image'
previewVisible.value = true
}
function handleDownloadAttachment(file: CertAttachmentItem) {
downloadAttachmentFile(file, { fullFileUrl })
}
function handleUpload(row: any) {
uploadRow.value = row
certAttachments.value = parseCertUrlsToAttachments(String(row.certImageUrls || ''))
uploadForm.makeDate = String(row.makeDate || '').trim() || getTodayStr()
uploadForm.remark = String(row.remark || '').trim()
uploadDialogVisible.value = true
}
async function handleSubmitUpload() {
if (certAttachments.value.some((f) => f._uploading)) {
ElMessage.warning('附件上传中,请稍候')
return
}
const uploaded = certAttachments.value.filter((f) => f.fileUrl && !f._uploading)
const hasAttachments = uploaded.length > 0
if (hasAttachments) {
const valid = await uploadFormRef.value?.validate?.().catch(() => false)
if (!valid) return
}
submitLoading.value = true
try {
const protocolId = uploadRow.value?.protocolId || uploadRow.value?.id
await fetchUpdateCollectionProtocol(protocolId, {
storageCert: {
makeStatus: hasAttachments ? '1' : '0',
certImageUrls: hasAttachments ? certAttachmentsToUrls() : '',
makeDate: hasAttachments ? uploadForm.makeDate : '',
remark: uploadForm.remark?.trim() || undefined
}
})
ElMessage.success(hasAttachments ? '上传成功' : '保存成功')
uploadDialogVisible.value = false
await loadData()
} catch {
/* 全局已处理 */
} finally {
submitLoading.value = false
}
}
function handleView(row: any) {
viewProtocolId.value = String(row.protocolId || row.id)
viewRow.value = row as CollectionProtocolRow
viewVisible.value = true
}
// ---------------------------------------------------------------------------
// 工具函数
// ---------------------------------------------------------------------------
function getTodayStr(): string {
const d = new Date()
const yyyy = d.getFullYear()
const mm = String(d.getMonth() + 1).padStart(2, '0')
const dd = String(d.getDate()).padStart(2, '0')
return `${yyyy}${mm}${dd}`
}
// 输入检索条件时自动搜索(防抖 300ms)
watchDebounced(
[searchForm, storageInDateRange],
() => {
pagination.page = 1
loadData()
},
{ debounce: 300, deep: true }
)
onMounted(() => {
loadData()
})
</script>
<style scoped lang="scss">
.storage-cert-dialog-form {
:deep(.el-form-item) {
margin-bottom: 0;
}
}
.form-col-span-2 {
grid-column: 1 / -1;
}
.attachment-upload {
width: 100%;
}
.upload-card {
width: 140px;
height: 96px;
border: 1px dashed #a8d4c4;
border-radius: 8px;
background: #f0fdf4;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
cursor: pointer;
transition:
border-color 0.15s,
background 0.15s;
&:hover {
border-color: #047857;
border-style: solid;
background: #e8f4ee;
}
}
.upload-card-text {
font-size: 12px;
color: #047857;
font-weight: 500;
line-height: 1;
}
.upload-hint {
display: block;
font-size: 11px;
color: var(--mint-text-muted, #334155);
line-height: 1;
margin-top: 8px;
}
.attachment-list {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.attachment-item {
width: 140px;
display: flex;
flex-direction: column;
border: 1px solid #e2e8f0;
border-radius: 8px;
background: #fff;
overflow: hidden;
transition:
border-color 0.15s,
box-shadow 0.15s;
&:hover {
border-color: #047857;
box-shadow: 0 2px 8px rgba(4, 120, 87, 0.1);
}
&.is-uploading {
opacity: 0.6;
pointer-events: none;
}
}
.attachment-preview {
width: 100%;
height: 96px;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
background: #f8fafc;
overflow: hidden;
cursor: pointer;
img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
}
.attachment-preview__icon {
width: 48px;
height: 48px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
&--video {
background: #ede9fe;
color: #7c3aed;
}
&--doc {
background: #e0f2fe;
color: #0284c7;
}
}
.attachment-footer {
display: flex;
flex-direction: column;
flex: 1;
padding: 6px 8px;
}
.attachment-name {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
font-size: 11px;
color: #334155;
line-height: 1.4;
word-break: break-all;
min-height: calc(11px * 1.4 * 2);
}
.attachment-actions {
display: flex;
justify-content: center;
align-items: center;
gap: 8px;
margin-top: 4px;
flex-shrink: 0;
}
.action-btn {
width: 22px;
height: 22px;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
color: var(--mint-text-muted, #334155);
cursor: pointer;
background: #f1f5f9;
transition:
background 0.15s,
color 0.15s;
&:hover {
background: #047857;
color: #fff;
}
&--danger:hover {
background: #ef4444;
color: #fff;
}
}
.preview-container {
text-align: center;
}
.list-table :deep(tr.row-storage-cert-pending > td.el-table__cell) {
background-color: #fee2e2 !important;
color: #991b1b;
}
.list-table :deep(tr.row-storage-cert-pending:hover > td.el-table__cell) {
background-color: #fecaca !important;
}
</style>
@@ -1,336 +0,0 @@
<!-- 样本信息管理 · 样本入库信息 Tab -->
<template>
<div class="storage-entry-info-tab">
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input v-model="searchForm.keyword" placeholder="姓名/样本编码/入库编码" clearable />
</el-form-item>
<el-form-item label="入库状态">
<el-select
v-model="searchForm.storageStatus"
placeholder="全部"
clearable
style="width: 100%"
>
<el-option label="已入库" value="yrk" />
<el-option label="拒绝入库" value="btg" />
<el-option label="待入库确认" value="drk" />
</el-select>
</el-form-item>
<el-form-item label="通知状态">
<el-select
v-model="searchForm.smsNotified"
placeholder="全部"
clearable
style="width: 100%"
>
<el-option label="已通知" value="1" />
<el-option label="未通知" value="0" />
</el-select>
</el-form-item>
<el-form-item label="入库时间">
<el-date-picker
v-model="storageTimeRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</div>
<div class="filter-actions-row">
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
</el-button>
<el-button class="btn-main" type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>搜索
</el-button>
</div>
</div>
</el-form>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="tableData"
v-loading="loading"
stripe
row-key="id"
@row-dblclick="handleView"
>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(i) => (pagination.page - 1) * pagination.pageSize + i + 1"
/>
<el-table-column
prop="protocolStatus"
label="协议状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
:type="protocolStatusTagType(String(row.protocolStatus || ''))"
size="small"
>{{ protocolStatusDisplayLabel(String(row.protocolStatus || ''), String(row.voidType || '')) }}</el-tag
>
</template>
</el-table-column>
<el-table-column
prop="motherName"
label="母亲姓名"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
prop="newbornName"
label="新生儿姓名"
min-width="110"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="sampleCode"
label="样本编码"
min-width="170"
align="center"
header-align="center"
>
<template #default="{ row }">
<SampleCodeWithSpecialDisplay
:sample-code="row.sampleCode"
:is-special="!!row.isSpecial"
:special-remark="row.specialRemark"
monospace
/>
</template>
</el-table-column>
<el-table-column
prop="labStorageCode"
label="实验室入库编码"
min-width="150"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.labStorageCode || '—' }}</template>
</el-table-column>
<el-table-column
prop="sampleTypeName"
label="样本类型"
min-width="110"
align="center"
header-align="center"
/>
<el-table-column
prop="storageTime"
label="入库时间"
min-width="170"
align="center"
header-align="center"
/>
<el-table-column
prop="storageStatusLabel"
label="入库状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
:type="
row.storageStatusLabel === '已入库'
? 'success'
: row.storageStatusLabel === '拒绝入库'
? 'danger'
: 'warning'
"
size="small"
>
{{ row.storageStatusLabel }}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="smsNotified"
label="通知状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="row.smsNotified == 1 ? 'success' : 'info'" size="small">
{{ row.smsNotified == 1 ? '已通知' : '未通知' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="操作"
min-width="360"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-button class="btn-op-item" @click="handleExtractSms(row)">
<el-icon><ChatDotRound /></el-icon>提取短信
</el-button>
<el-button class="btn-op-item" @click="handleToggleNotified(row)">
<el-icon><Bell /></el-icon>{{ row.smsNotified == 1 ? '标记未通知' : '标记已通知' }}
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
@current-change="(val) => ((pagination.page = val), loadData())"
/>
</div>
</div>
<ProtocolViewDialog
v-model="viewVisible"
:protocol-id="viewProtocolId"
:list-row="viewRow"
show-audit-history
show-storage-cert
show-fullmoon-insurance
/>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { Search, RefreshLeft, View, ChatDotRound, Bell } from '@element-plus/icons-vue'
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
import { copyTextWithFallback } from '@/utils/copy-text'
import {
fetchStorageEntrySmsList,
fetchToggleStorageEntrySmsNotified,
fetchGenerateStorageEntrySms
} from '@/api/storage-entry-sms-notification'
import { type CollectionProtocolRow } from '@/api/collection-protocol'
import SampleCodeWithSpecialDisplay from '@/components/business/sample-code-with-special-display/index.vue'
import { protocolStatusDisplayLabel, protocolStatusTagType } from '@/utils/status-tag-registry'
defineOptions({ name: 'CellStorageStorageEntryInfoTab' })
const searchForm = reactive({ keyword: '', storageStatus: '', smsNotified: '' })
const storageTimeRange = ref<[string, string] | null>(null)
const tableData = ref<any[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const viewVisible = ref(false)
const viewProtocolId = ref<string | null>(null)
const viewRow = ref<CollectionProtocolRow | null>(null)
async function loadData() {
loading.value = true
try {
const result = await fetchStorageEntrySmsList({
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined,
storageStatus: searchForm.storageStatus || undefined,
smsNotified: searchForm.smsNotified || undefined,
storageTimeStart: storageTimeRange.value?.[0] || undefined,
storageTimeEnd: storageTimeRange.value?.[1] || undefined
})
const res = (result as any) || {}
tableData.value = res.list || []
pagination.total = res.total || 0
} finally {
loading.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
}
function handleReset() {
Object.assign(searchForm, { keyword: '', storageStatus: '', smsNotified: '' })
storageTimeRange.value = null
handleSearch()
}
function handleView(row: Record<string, unknown>) {
const pid = String(row.collectionProtocolId || row.protocolId || '')
if (!pid) {
ElMessage.warning('缺少关联协议单,无法查看')
return
}
viewProtocolId.value = pid
viewRow.value = {
id: pid,
motherName: row.motherName,
newbornName: row.newbornName
}
viewVisible.value = true
}
async function handleExtractSms(row: any) {
try {
const result = await fetchGenerateStorageEntrySms(row.id, row.storageReviewId)
const content = (result as any)?.smsContent || ''
if (!content) {
ElMessage.warning('短信内容为空')
return
}
await copyTextWithFallback(content, { successMessage: '短信内容已复制到剪贴板' })
} catch {
ElMessage.error('提取短信失败')
}
}
async function handleToggleNotified(row: any) {
const newVal = row.smsNotified == 1 ? 0 : 1
try {
await fetchToggleStorageEntrySmsNotified(row.id, {
smsNotified: newVal,
storageReviewId: row.storageReviewId
})
ElMessage.success(newVal === 1 ? '已标记为已通知' : '已标记为未通知')
loadData()
} catch {
ElMessage.error('操作失败')
}
}
// 输入检索条件时自动搜索(防抖 300ms)
watchDebounced(
[searchForm, storageTimeRange],
() => {
pagination.page = 1
loadData()
},
{ debounce: 300, deep: true }
)
onMounted(() => {
loadData()
})
</script>
@@ -1,6 +1,6 @@
<template>
<div class="unified-protocol-page">
<div class="panel-pill-tabs panel-pill-tabs--lg">
<div class="panel-pill-tabs">
<div class="panel-pill-tabs__track" role="tablist" aria-label="协议来源">
<button
v-for="item in tabs"
@@ -7,10 +7,11 @@
v-for="(file, index) in files"
:key="file.id || file.fileUrl || index"
class="attachment-item"
:class="{ 'is-compact': size === 'compact' }"
>
<div
class="attachment-preview"
@click="isImageFile(file) && file.fileUrl ? emit('preview', file) : undefined"
@click="file.fileUrl ? emit('preview', file) : undefined"
>
<template v-if="isImageFile(file) && file.fileUrl">
<img :src="resolveFileUrl(file.fileUrl)" :alt="file.fileName" />
@@ -44,9 +45,13 @@
<script setup lang="ts">
import { Document, Download, VideoPlay } from '@element-plus/icons-vue'
defineProps<{
files: Array<Record<string, any>>
}>()
withDefaults(
defineProps<{
files: Array<Record<string, any>>
size?: 'default' | 'compact'
}>(),
{ size: 'default' }
)
const emit = defineEmits<{
(e: 'preview', file: Record<string, any>): void
@@ -205,4 +210,28 @@
color: #fff;
}
}
.attachment-item.is-compact {
width: 88px;
.attachment-preview {
height: 64px;
}
.attachment-preview__icon {
width: 32px;
height: 32px;
border-radius: 8px;
}
.attachment-footer {
padding: 4px 6px;
}
.attachment-name {
-webkit-line-clamp: 1;
min-height: 0;
font-size: 10px;
}
}
</style>
@@ -1,50 +1,64 @@
<!-- 采集协议单 · 退费登记弹窗(列表工具栏入口) -->
<template>
<div class="refund-record-block">
<div class="section-subtitle-row">
<div class="section-subtitle">退费登记</div>
<el-button type="primary" size="small" :disabled="!protocolId" @click="openCreate">
<el-icon><Plus /></el-icon>
新增登记
</el-button>
</div>
<p v-if="!protocolId" class="muted-hint">保存协议后可登记退费(不触发财务退费确认)</p>
<el-dialog
:model-value="modelValue"
:title="dialogTitle"
width="720px"
align-center
append-to-body
destroy-on-close
class="dialog-form-layout"
modal-class="protocol-dialog-mask"
@update:model-value="emit('update:modelValue', $event)"
@opened="loadRecords"
@closed="onClosed"
>
<div class="refund-record-dialog">
<div class="toolbar-row">
<p class="muted-hint">登记退费仅作记录,不触发财务退费确认流程</p>
<el-button type="primary" size="small" :disabled="!protocolId" @click="openCreate">
<el-icon><Plus /></el-icon>
新增登记
</el-button>
</div>
<el-table v-if="records.length" :data="records" class="list-table" stripe>
<el-table-column prop="refundAmount" label="退费金额(元)" min-width="120">
<template #default="{ row }">{{ fmtMoney(row.refundAmount) }}</template>
</el-table-column>
<el-table-column prop="refundTime" label="退费时间" min-width="160" />
<el-table-column prop="refundRemark" label="备注" min-width="180" show-overflow-tooltip />
<el-table-column label="附件" min-width="100">
<template #default="{ row }">
{{ (row.refundAttachmentFiles || []).length || (row.refundAttachments ? 1 : 0) }} 个
</template>
</el-table-column>
<el-table-column label="操作" min-width="140" fixed="right">
<template #default="{ row }">
<el-button link type="primary" size="small" @click="openEdit(row)">
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button link type="danger" size="small" @click="onDelete(row)">
<el-icon><Delete /></el-icon>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-empty v-else description="暂无退费登记" :image-size="40" />
<el-table v-if="records.length" v-loading="loading" :data="records" class="list-table" stripe>
<el-table-column prop="refundAmount" label="退费金额(元)" min-width="120">
<template #default="{ row }">{{ fmtMoney(row.refundAmount) }}</template>
</el-table-column>
<el-table-column prop="refundTime" label="退费时间" min-width="160" />
<el-table-column prop="refundRemark" label="备注" min-width="180" show-overflow-tooltip />
<el-table-column label="附件" min-width="100">
<template #default="{ row }">
{{ (row.refundAttachmentFiles || []).length || (row.refundAttachments ? 1 : 0) }} 个
</template>
</el-table-column>
<el-table-column label="操作" min-width="140" fixed="right">
<template #default="{ row }">
<el-button link type="primary" size="small" @click="openEdit(row)">
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button link type="danger" size="small" @click="onDelete(row)">
<el-icon><Delete /></el-icon>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-empty v-else v-loading="loading" description="暂无退费登记" :image-size="48" />
</div>
<el-dialog
v-model="dialogVisible"
v-model="formVisible"
:title="editingId ? '编辑退费登记' : '新增退费登记'"
width="560px"
align-center
append-to-body
destroy-on-close
class="dialog-form-layout"
modal-class="order-module-dialog-mask"
@closed="resetDialog"
modal-class="protocol-dialog-mask"
@closed="resetForm"
>
<el-form label-position="top" class="dialog-form-body">
<div class="form-grid-2">
@@ -104,7 +118,7 @@
</div>
</el-form>
<template #footer>
<el-button class="btn-ghost" @click="dialogVisible = false">
<el-button class="btn-ghost" @click="formVisible = false">
<el-icon><Close /></el-icon>
取消
</el-button>
@@ -114,11 +128,11 @@
</el-button>
</template>
</el-dialog>
</div>
</el-dialog>
</template>
<script setup lang="ts">
import { onMounted, reactive, ref, watch } from 'vue'
import { computed, reactive, ref } from 'vue'
import { Plus, Edit, Delete, Close, Check } from '@element-plus/icons-vue'
import AmountInput from '@/components/common/amount-input/index.vue'
import { formatMoneyDisplay } from '@/utils/money-format'
@@ -131,11 +145,19 @@
} from '@/api/protocol-sample-payment'
const props = defineProps<{
modelValue: boolean
protocolId?: string
/** 展示在标题中的协议标识,如母亲姓名 / 协议号 */
protocolLabel?: string
}>()
const emit = defineEmits<{
'update:modelValue': [boolean]
}>()
const records = ref<Array<Record<string, any>>>([])
const dialogVisible = ref(false)
const loading = ref(false)
const formVisible = ref(false)
const editingId = ref('')
const saving = ref(false)
const form = reactive({
@@ -145,6 +167,11 @@
attachments: [] as Array<Record<string, any>>
})
const dialogTitle = computed(() => {
const label = String(props.protocolLabel || '').trim()
return label ? `退费登记 · ${label}` : '退费登记'
})
function fmtMoney(v: unknown) {
if (v == null || v === '') return '—'
return formatMoneyDisplay(v)
@@ -155,14 +182,19 @@
records.value = []
return
}
const res = await fetchProtocolRefundRecords(props.protocolId)
records.value = Array.isArray(res) ? res : []
loading.value = true
try {
const res = await fetchProtocolRefundRecords(props.protocolId)
records.value = Array.isArray(res) ? res : []
} finally {
loading.value = false
}
}
function openCreate() {
editingId.value = ''
resetDialog()
dialogVisible.value = true
resetForm()
formVisible.value = true
}
function openEdit(row: Record<string, any>) {
@@ -173,16 +205,23 @@
form.attachments = Array.isArray(row.refundAttachmentFiles)
? [...row.refundAttachmentFiles]
: []
dialogVisible.value = true
formVisible.value = true
}
function resetDialog() {
function resetForm() {
form.refundAmount = null
form.refundTime = ''
form.refundRemark = ''
form.attachments = []
}
function onClosed() {
records.value = []
formVisible.value = false
editingId.value = ''
resetForm()
}
async function onFileChange(uploadFile: any) {
const raw = uploadFile?.raw as File | undefined
if (!raw) return
@@ -227,7 +266,7 @@
} else {
await fetchCreateProtocolRefundRecord(props.protocolId, payload)
}
dialogVisible.value = false
formVisible.value = false
await loadRecords()
} finally {
saving.value = false
@@ -240,47 +279,27 @@
await fetchDeleteProtocolRefundRecord(String(row.id))
await loadRecords()
}
watch(
() => props.protocolId,
() => {
loadRecords()
}
)
onMounted(loadRecords)
</script>
<style scoped lang="scss">
.section-subtitle-row {
display: flex;
align-items: center;
justify-content: space-between;
margin: 16px 0 8px;
.refund-record-dialog {
min-height: 160px;
}
.section-subtitle {
font-size: 13px;
font-weight: 600;
color: var(--mint-text-secondary, #475569);
.toolbar-row {
display: flex;
gap: 12px;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
}
.muted-hint {
margin: 0 0 8px;
margin: 0;
font-size: 12px;
color: var(--mint-text-muted, #94a3b8);
}
.form-grid-2 {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px 12px;
}
.form-col-span-2 {
grid-column: 1 / -1;
}
.attachment-list {
display: flex;
flex-wrap: wrap;
@@ -3,10 +3,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>协议单列表</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -78,6 +74,14 @@
<el-icon><Plus /></el-icon>
新增
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="openRefundDialog"
>
<el-icon><Coin /></el-icon>
退费登记
</el-button>
<el-button class="btn-ghost" :disabled="!selectedRows.length" @click="handleBatchDelete">
<el-icon><Delete /></el-icon>
批量删除
@@ -211,7 +215,7 @@
/>
<el-table-column
prop="salesUserName"
label="销售人员"
label="市场专员"
min-width="100"
align="center"
header-align="center"
@@ -292,6 +296,12 @@
show-storage-cert
show-fullmoon-insurance
/>
<ProtocolRefundRecordDialog
v-model="refundDialogVisible"
:protocol-id="refundProtocolId"
:protocol-label="refundProtocolLabel"
/>
</section>
</div>
</template>
@@ -299,9 +309,10 @@
<script setup lang="ts">
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus, View, Edit, Delete, Search, RefreshLeft, More } from '@element-plus/icons-vue'
import { Plus, View, Edit, Delete, Search, RefreshLeft, More, Coin } from '@element-plus/icons-vue'
import ProtocolFormDialog from './ProtocolFormDialog.vue'
import ProtocolViewDialog from './ProtocolViewDialog.vue'
import ProtocolRefundRecordDialog from './ProtocolRefundRecordDialog.vue'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
import {
fetchCollectionProtocolList,
@@ -404,6 +415,24 @@
loadData()
}
/* ====== 退费登记 ====== */
const refundDialogVisible = ref(false)
const refundProtocolId = ref('')
const refundProtocolLabel = ref('')
function openRefundDialog() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请先勾选一条协议单再登记退费')
return
}
const row = selectedRows.value[0]
refundProtocolId.value = String(row.id || '')
const name = String(row.motherName || '').trim()
const no = String(row.protocolNo || '').trim()
refundProtocolLabel.value = [name, no].filter(Boolean).join(' / ')
refundDialogVisible.value = true
}
/* ====== 删除 ====== */
function handleDropdownCommand(cmd: string, row: CollectionProtocolRow) {
if (cmd === 'edit') handleEdit(row)
@@ -2,7 +2,7 @@
<el-dialog
v-model="visible"
title="配置运费"
width="860px"
width="1280px"
class="dialog-form-layout"
align-center
append-to-body
@@ -42,67 +42,79 @@
</div>
</el-form>
<div v-else class="list-body list-wrap" style="margin-bottom: 12px">
<el-table
:data="existingFreightList"
v-loading="existingLoading"
stripe
class="list-table"
highlight-current-row
max-height="220"
@current-change="onExistingSelect"
>
<el-table-column label="运输方式" min-width="120" show-overflow-tooltip>
<template #default="{ row }">
{{ row.transportModeLabel || row.transportMode || '—' }}
</template>
</el-table-column>
<el-table-column label="运费(元)" min-width="100" align="right" header-align="center">
<template #default="{ row }">¥{{ formatMoneyDisplay(row.freightAmount) }}</template>
</el-table-column>
<el-table-column label="关联数" min-width="80" align="center" header-align="center">
<template #default="{ row }">{{ row.linkedSampleCount ?? 0 }}</template>
</el-table-column>
<el-table-column label="创建时间" min-width="160" show-overflow-tooltip>
<template #default="{ row }">{{ row.createTime || '—' }}</template>
</el-table-column>
</el-table>
<div v-else class="link-existing-block" style="margin-bottom: 12px">
<div class="sample-pick-title">
<span class="sample-pick-required">*</span>
选择运费批次
</div>
<div class="sample-pick-toolbar" style="margin-bottom: 10px">
<el-input
v-model="existingKeyword"
placeholder="运输方式/样本编码"
clearable
style="width: 260px"
@keyup.enter="loadExistingFreights"
/>
<el-button class="btn-ghost" @click="loadExistingFreights">
<el-icon><Search /></el-icon>
搜索
</el-button>
</div>
<SampleFreightPickTable
v-model="selectedFreightId"
:list="existingFreightList"
:loading="existingLoading"
:max-height="260"
@select="onPickFreight"
/>
</div>
<div class="sample-pick-block">
<div class="sample-pick-title">
<span class="sample-pick-required">*</span>
选择样本
</div>
<div class="sample-pick-toolbar">
<el-select
v-model="sampleSourceFilter"
placeholder="样本来源"
clearable
style="width: 160px"
@change="reloadSampleOptions"
@change="handleSampleSearch"
>
<el-option label="细胞存储" value="cell_storage" />
<el-option label="科研捐赠" value="research_donation" />
</el-select>
<el-input
v-model="sampleKeyword"
placeholder="协议单号/样本编码"
placeholder="母亲姓名/子女姓名/样本编码"
clearable
style="width: 220px"
@keyup.enter="reloadSampleOptions"
@keyup.enter="handleSampleSearch"
/>
<el-button class="btn-ghost" @click="reloadSampleOptions">
<el-button class="btn-ghost" @click="handleSampleSearch">
<el-icon><Search /></el-icon>
搜索样本
</el-button>
</div>
<el-table
ref="sampleTableRef"
:data="sampleOptions"
v-loading="sampleLoading"
stripe
class="list-table"
max-height="280"
max-height="320"
row-key="rowKey"
@selection-change="onSampleSelectionChange"
>
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column
type="selection"
min-width="48"
align="center"
header-align="center"
:reserve-selection="true"
:selectable="isSampleSelectable"
/>
<el-table-column label="来源" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="row.sampleSource === 'cell_storage' ? 'success' : 'warning'" size="small">
@@ -110,7 +122,26 @@
</el-tag>
</template>
</el-table-column>
<el-table-column prop="protocolNo" label="协议单号" min-width="140" show-overflow-tooltip />
<el-table-column
prop="motherName"
label="母亲姓名"
min-width="100"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.motherName || '—' }}</template>
</el-table-column>
<el-table-column
prop="newbornName"
label="子女姓名"
min-width="100"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.newbornName || '—' }}</template>
</el-table-column>
<el-table-column prop="sampleCode" label="样本编码" min-width="120" show-overflow-tooltip />
<el-table-column
prop="sampleTypeName"
@@ -125,6 +156,17 @@
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar sample-pick-pager">
<el-pagination
:current-page="samplePagination.page"
:page-size="samplePagination.pageSize"
:total="samplePagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="onSamplePageSizeChange"
@current-change="onSamplePageChange"
/>
</div>
</div>
<template #footer>
@@ -143,8 +185,8 @@
<script setup lang="ts">
import { Check, Close, Search } from '@element-plus/icons-vue'
import AmountInput from '@/components/common/amount-input/index.vue'
import SampleFreightPickTable from '@/components/business/sample-freight-pick-table/index.vue'
import { fetchDictDataOptions } from '@/api/admin'
import { formatMoneyDisplay } from '@/utils/money-format'
import {
fetchCreateSampleFreight,
fetchLinkSampleFreight,
@@ -165,13 +207,21 @@
const submitting = ref(false)
const existingLoading = ref(false)
const sampleLoading = ref(false)
const sampleTableRef = ref()
const transportModeOptions = ref<Array<{ label: string; value: string }>>([])
const existingFreightList = ref<SampleFreight[]>([])
const selectedExisting = ref<SampleFreight | null>(null)
const selectedFreightId = ref('')
const existingKeyword = ref('')
const sampleOptions = ref<SampleOptionRow[]>([])
const selectedSamples = ref<SampleOptionRow[]>([])
const sampleSourceFilter = ref<string>('')
const sampleKeyword = ref('')
const samplePagination = reactive({
page: 1,
pageSize: 10,
total: 0
})
const form = reactive({
transportMode: '',
freightAmount: null as number | null
@@ -196,7 +246,12 @@
async function loadExistingFreights() {
existingLoading.value = true
try {
const res = await fetchSampleFreightList({ page: 1, pageSize: 50 })
const res = await fetchSampleFreightList({
page: 1,
pageSize: 50,
includeItems: true,
keyword: existingKeyword.value || undefined
})
const data = (res as any)?.data || res
existingFreightList.value = data?.list || []
} catch {
@@ -210,32 +265,61 @@
sampleLoading.value = true
try {
const res = await fetchSampleFreightSampleOptions({
page: 1,
pageSize: 50,
page: samplePagination.page,
pageSize: samplePagination.pageSize,
keyword: sampleKeyword.value || undefined,
sampleSource: sampleSourceFilter.value || undefined
})
const data = (res as any)?.data || res
const list = (data?.list || []) as SampleFreightItem[]
samplePagination.total = data?.total || 0
sampleOptions.value = list.map((x) => ({
...x,
rowKey: `${x.sampleSource}|${x.sampleId}`
}))
} catch {
sampleOptions.value = []
samplePagination.total = 0
} finally {
sampleLoading.value = false
}
}
function clearSampleSelection() {
selectedSamples.value = []
sampleTableRef.value?.clearSelection?.()
}
function handleSampleSearch() {
samplePagination.page = 1
clearSampleSelection()
reloadSampleOptions()
}
function onSamplePageChange(page: number) {
samplePagination.page = page
reloadSampleOptions()
}
function onSamplePageSizeChange(size: number) {
samplePagination.page = 1
samplePagination.pageSize = size
reloadSampleOptions()
}
async function open() {
mode.value = 'create'
form.transportMode = ''
form.freightAmount = null
selectedExisting.value = null
selectedFreightId.value = ''
existingKeyword.value = ''
selectedSamples.value = []
sampleKeyword.value = ''
sampleSourceFilter.value = ''
samplePagination.page = 1
samplePagination.pageSize = 10
samplePagination.total = 0
await Promise.all([loadTransportModeOptions(), loadExistingFreights(), reloadSampleOptions()])
visible.value = true
}
@@ -243,14 +327,23 @@
function onClosed() {
selectedSamples.value = []
selectedExisting.value = null
selectedFreightId.value = ''
existingKeyword.value = ''
samplePagination.page = 1
samplePagination.total = 0
}
function onExistingSelect(row: SampleFreight | null) {
function onPickFreight(row: SampleFreight | null) {
selectedExisting.value = row
selectedFreightId.value = row?.id || ''
}
function isSampleSelectable(row: SampleOptionRow) {
return !row.freightId
}
function onSampleSelectionChange(rows: SampleOptionRow[]) {
selectedSamples.value = rows
selectedSamples.value = rows.filter((r) => !r.freightId)
}
function toItems(rows: SampleOptionRow[]): SampleFreightItem[] {
@@ -263,24 +356,12 @@
}
async function handleSubmit() {
if (!selectedSamples.value.length) {
const samples = selectedSamples.value.filter((s) => !s.freightId)
if (!samples.length) {
ElMessage.warning('请勾选需要关联的样本')
return
}
const conflicted = selectedSamples.value.filter((s) => s.freightId)
if (conflicted.length) {
try {
await ElMessageBox.confirm(
`已选 ${conflicted.length} 个样本已有运费关联,确定将替换为本次配置?`,
'确认替换',
{ type: 'warning', confirmButtonText: '确定替换', cancelButtonText: '取消' }
)
} catch {
return
}
}
submitting.value = true
try {
if (mode.value === 'create') {
@@ -296,14 +377,14 @@
await fetchCreateSampleFreight({
transportMode: form.transportMode,
freightAmount: amount,
items: toItems(selectedSamples.value)
items: toItems(samples)
})
} else {
if (!selectedExisting.value?.id) {
ElMessage.warning('请选择一笔已有运费')
return
}
await fetchLinkSampleFreight(selectedExisting.value.id, toItems(selectedSamples.value))
await fetchLinkSampleFreight(selectedExisting.value.id, toItems(samples))
}
visible.value = false
emit('success')
@@ -320,6 +401,20 @@
margin-top: 4px;
}
.sample-pick-title {
margin: 8px 0 10px;
font-size: 14px;
font-weight: 600;
line-height: 1.4;
color: var(--mint-text, #0f172a);
}
.sample-pick-required {
margin-right: 4px;
font-weight: 600;
color: var(--el-color-danger);
}
.sample-pick-toolbar {
display: flex;
flex-wrap: wrap;
@@ -330,4 +425,8 @@
.muted {
color: var(--mint-text-muted, #64748b);
}
.sample-pick-pager {
margin-top: 0;
}
</style>
@@ -12,7 +12,7 @@
<el-form-item label="关键词">
<el-input
v-model="searchForm.keyword"
placeholder="运输方式/协议单号/样本编码"
placeholder="批次号/运输方式/样本编码"
clearable
/>
</el-form-item>
@@ -94,12 +94,12 @@
<div class="list-body list-wrap">
<el-table
class="list-table"
class="list-table freight-batch-table"
:data="flatRows"
v-loading="loading"
stripe
row-key="rowKey"
:span-method="spanMethod"
:row-class-name="freightBatchRowClassName"
@selection-change="handleSelectionChange"
>
<el-table-column
@@ -110,6 +110,14 @@
header-align="center"
:selectable="(row: FlatRow) => row.isFirst"
/>
<el-table-column
prop="batchNo"
label="批次号"
min-width="160"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="transportMode"
label="运输方式"
@@ -152,34 +160,58 @@
</template>
</el-table-column>
<el-table-column
prop="protocolNo"
label="协议单号"
min-width="140"
show-overflow-tooltip
prop="motherName"
label="母亲姓名"
min-width="100"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.protocolNo || '—' }}</template>
<template #default="{ row }">{{ row.motherName || '—' }}</template>
</el-table-column>
<el-table-column
prop="newbornName"
label="子女姓名"
min-width="100"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.newbornName || '—' }}</template>
</el-table-column>
<el-table-column
prop="sampleCode"
label="样本编码"
min-width="120"
show-overflow-tooltip
class-name="freight-cell-wrap"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.sampleCode || '—' }}</template>
<template #default="{ row }">
<span class="cell-wrap-text">{{ row.sampleCode || '—' }}</span>
</template>
</el-table-column>
<el-table-column
prop="sampleTypeName"
label="样本类型"
min-width="110"
show-overflow-tooltip
class-name="freight-cell-wrap"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.sampleTypeName || '—' }}</template>
<template #default="{ row }">
<span class="cell-wrap-text">{{ row.sampleTypeName || '—' }}</span>
</template>
</el-table-column>
<el-table-column
prop="createByName"
label="创建人"
min-width="100"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.createByName || row.createBy || '—' }}</template>
</el-table-column>
<el-table-column
prop="createTime"
@@ -193,7 +225,7 @@
<el-table-column
prop="actions"
label="操作"
min-width="260"
min-width="180"
fixed="right"
align="center"
header-align="center"
@@ -297,29 +329,17 @@
} from '@/api/sample-freight'
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { formatMoneyDisplay } from '@/utils/money-format'
import {
flattenSampleFreights,
sampleFreightSpanMethod,
type SampleFreightFlatRow
} from '@/utils/sample-freight-flatten'
import FreightConfigDialog from './FreightConfigDialog.vue'
import FreightEditDialog from './FreightEditDialog.vue'
defineOptions({ name: 'CellStorageSampleFreight' })
type FlatRow = {
rowKey: string
freightId: string
rowspan: number
isFirst: boolean
transportMode: string
transportModeLabel: string
freightAmount: number
linkedSampleCount: number
createTime: string
sampleSource?: string
protocolNo?: string
sampleCode?: string
sampleTypeName?: string
sampleId?: string
protocolId?: string
}
type FlatRow = SampleFreightFlatRow
type UnlinkItem = SampleFreightItem
const loading = ref(false)
@@ -350,46 +370,15 @@
})
function flattenFreights(list: SampleFreight[]): FlatRow[] {
const rows: FlatRow[] = []
for (const f of list) {
const items = f.items?.length ? f.items : [null]
items.forEach((it, idx) => {
rows.push({
rowKey: `${f.id}|${it?.sampleId || idx}`,
freightId: f.id,
rowspan: idx === 0 ? items.length : 0,
isFirst: idx === 0,
transportMode: f.transportMode,
transportModeLabel: f.transportModeLabel || f.transportMode,
freightAmount: f.freightAmount,
linkedSampleCount: f.linkedSampleCount ?? (f.items?.length || 0),
createTime: f.createTime || '',
sampleSource: it?.sampleSource,
protocolNo: it?.protocolNo,
sampleCode: it?.sampleCode,
sampleTypeName: it?.sampleTypeName,
sampleId: it?.sampleId,
protocolId: it?.protocolId
})
})
}
return rows
return flattenSampleFreights(list)
}
function spanMethod({ column, row }: { column: any; row: FlatRow }) {
const mergeProps = [
'selection',
'transportMode',
'freightAmount',
'linkedSampleCount',
'createTime',
'actions'
]
if (column.type === 'selection' || mergeProps.includes(column.property)) {
if (row.rowspan > 0) return { rowspan: row.rowspan, colspan: 1 }
return { rowspan: 0, colspan: 0 }
}
return { rowspan: 1, colspan: 1 }
function spanMethod(args: { column: any; row: FlatRow }) {
return sampleFreightSpanMethod(args)
}
function freightBatchRowClassName({ row }: { row: FlatRow }) {
return row.batchIndex % 2 === 0 ? 'freight-batch-odd' : 'freight-batch-even'
}
async function loadTransportModeOptions() {
@@ -565,4 +554,34 @@
font-size: 13px;
color: var(--mint-text-muted, #64748b);
}
/* 按运费批次交替底色(同批次多样本行同色) */
:deep(.freight-batch-table) {
.el-table__body tr.freight-batch-even > td.el-table__cell {
background-color: var(--el-fill-color-lighter);
}
.el-table__body tr.freight-batch-odd > td.el-table__cell {
background-color: var(--el-bg-color);
}
.el-table__body tr.freight-batch-even:hover > td.el-table__cell,
.el-table__body tr.freight-batch-odd:hover > td.el-table__cell {
background-color: var(--el-table-row-hover-bg-color);
}
td.freight-cell-wrap .cell {
white-space: normal;
word-break: break-word;
line-height: 1.45;
}
}
.cell-wrap-text {
display: inline-block;
max-width: 100%;
white-space: normal;
word-break: break-word;
line-height: 1.45;
}
</style>
@@ -163,13 +163,17 @@
}
function resetForm() {
const currentUser = userStore.getUserInfo as Record<string, any>
const uid = String(currentUser?.id || currentUser?.userId || '')
const name = String(
currentUser?.realName || currentUser?.userName || currentUser?.username || ''
)
form.handleTime = nowStr()
form.handlerUserId = String(userStore.info?.userId || '')
form.handlerUserId = uid
form.remark = ''
files.value = []
const name = String(userStore.info?.userName || '')
if (form.handlerUserId) {
userOptions.value = [{ id: form.handlerUserId, nickName: name, userName: name }]
if (uid) {
userOptions.value = [{ id: uid, nickName: name, userName: name }]
} else {
userOptions.value = []
}
@@ -168,9 +168,11 @@
<el-table-column prop="sampleCode" label="样本编码" min-width="160" align="center" header-align="center">
<template #default="{ row }">
<SampleCodeWithSpecialDisplay
class="sample-code-col"
:sample-code="row.sampleCode"
:is-special="!!row.isSpecial"
:special-remark="row.specialRemark"
layout="block"
monospace
/>
</template>
@@ -573,4 +575,19 @@
.sample-info-filter-form :deep(.el-input) {
min-width: 0;
}
/* 样本编码上、特殊样本 Tag 下,列内居中(与入库放行审核列表一致) */
.sample-code-col {
display: block;
text-align: center;
:deep(.special-sample-display--block) {
margin-top: 4px;
text-align: center;
.el-tag {
text-align: center;
}
}
}
</style>
@@ -1,4 +1,4 @@
<!-- 旧「样本接收信息」菜单入口:重定向至样本信息管理 · 样本接收 Tab -->
<!-- 旧「样本接收信息」菜单入口:重定向至样本信息管理 -->
<template>
<div />
</template>
@@ -12,7 +12,7 @@
onMounted(() => {
router.replace({
name: 'CellStorageSampleInfo',
query: { ...route.query, tab: 'sample-reception' }
query: { ...route.query, tab: 'cell_storage' }
})
})
</script>
@@ -1,4 +1,4 @@
<!-- 旧「储存证管理」菜单入口:重定向至采集协议单管理 · 储存证 Tab -->
<!-- 旧「储存证管理」菜单入口:重定向至样本信息管理 -->
<template>
<div />
</template>
@@ -11,8 +11,8 @@
onMounted(() => {
router.replace({
name: 'CellStorageProtocolAudit',
query: { ...route.query, tab: 'storage-cert' }
name: 'CellStorageSampleInfo',
query: { ...route.query, tab: 'cell_storage' }
})
})
</script>
@@ -1,4 +1,4 @@
<!-- 旧「样本入库信息」菜单入口:重定向至样本信息管理 · 样本入库 Tab -->
<!-- 旧「样本入库信息」菜单入口:重定向至样本信息管理 -->
<template>
<div />
</template>
@@ -12,7 +12,7 @@
onMounted(() => {
router.replace({
name: 'CellStorageSampleInfo',
query: { ...route.query, tab: 'storage-entry' }
query: { ...route.query, tab: 'cell_storage' }
})
})
</script>
@@ -2,9 +2,6 @@
<template>
<div class="console-container console-lite">
<section class="panel">
<div class="panel-top">
<h2>快速入口</h2>
</div>
<div class="console-lite__body">
<p class="console-lite__hint"
>详见仓库根目录 `.cursorrules` 中「页面级 UI 模板(固定五页)」。</p
@@ -2,10 +2,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">抄送我的</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -2,10 +2,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">已办中心</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -3,10 +3,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">草稿箱</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -2,9 +2,6 @@
<template>
<div class="oa-fc-spike art-full-height">
<section class="panel filter-block">
<div class="panel-top">
<h2 class="title-bar-heading">表单设计器 Spike(FormCreate)</h2>
</div>
<p class="spike-tip">
用于验证 @form-create/designer。可拖拽控件、导出 JSON。正式四步设计器将基于此适配 Fresh Mint 与
§4.5/§4.6 控件契约。
@@ -2,10 +2,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">{{ pageTitle }}</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -2,10 +2,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">提到我的</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -2,10 +2,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">我发起的</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -2,10 +2,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">待办中心</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -3,10 +3,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">收款账户管理</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
+67 -20
View File
@@ -98,7 +98,7 @@
</template>
<script setup lang="ts">
import { computed, onActivated, onMounted, ref } from 'vue'
import { computed, onActivated, onMounted, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { Clock, Promotion, Search } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
@@ -119,6 +119,8 @@
const searchKeyword = ref('')
const activeGroupId = ref('')
const startDialogRef = ref<InstanceType<typeof OaStartFormDialog> | null>(null)
/** 避免 KeepAlive 下 onMounted / onActivated / watch 对同一组 query 重复弹窗 */
let lastHandledQueryKey = ''
const displayGroups = computed(() => {
const kw = (searchKeyword.value || '').trim().toLowerCase()
@@ -192,10 +194,73 @@
worktabStore.resetTabTitle('/system-manage/oa-approval/start')
}
function isStartRoute() {
return route.name === 'OaApprovalStart'
}
function queryOpenKey() {
const qDraftId = String(route.query.draftId || '').trim()
const qAppId = String(route.query.appId || '').trim()
const qCopyFrom = String(route.query.copyFromInstanceId || '').trim()
return { qDraftId, qAppId, qCopyFrom, key: `${qDraftId}|${qAppId}|${qCopyFrom}` }
}
async function tryOpenFromQuery() {
// KeepAlive 缓存实例仍会响应全局 route;离开本页时清掉去重键,便于再次带参进入时重开
if (!isStartRoute()) {
lastHandledQueryKey = ''
return
}
if (!templates.value.length) return
const { qDraftId, qAppId, qCopyFrom, key } = queryOpenKey()
if (!qDraftId && !qAppId) {
lastHandledQueryKey = ''
return
}
if (key === lastHandledQueryKey) return
lastHandledQueryKey = key
if (qDraftId) {
try {
await startDialogRef.value?.openForDraft(qDraftId, templates.value)
} catch {
lastHandledQueryKey = ''
ElMessage.error('无法打开草稿')
}
return
}
const row = templates.value.find((t: any) => t.id === qAppId)
if (!row) {
lastHandledQueryKey = ''
return
}
if (qCopyFrom) {
await startDialogRef.value?.openForAppWithCopy(row, qCopyFrom)
} else {
await startDialogRef.value?.openForApp(row)
}
}
onActivated(() => {
restoreStartTabTitle()
void tryOpenFromQuery()
})
watch(
() =>
[
route.name,
route.query.draftId,
route.query.appId,
route.query.copyFromInstanceId
] as const,
() => {
void tryOpenFromQuery()
}
)
onMounted(async () => {
restoreStartTabTitle()
loading.value = true
@@ -203,25 +268,7 @@
const [tpl, groupsRes] = await Promise.all([fetchOaTemplates(), fetchOaGroupList()])
templates.value = tpl?.list || []
groupOptions.value = groupsRes?.list || []
const qDraftId = String(route.query.draftId || '').trim()
const qAppId = String(route.query.appId || '').trim()
const qCopyFrom = String(route.query.copyFromInstanceId || '').trim()
if (qDraftId) {
try {
await startDialogRef.value?.openForDraft(qDraftId, templates.value)
} catch {
ElMessage.error('无法打开草稿')
}
} else if (qAppId) {
const row = templates.value.find((t: any) => t.id === qAppId)
if (row) {
if (qCopyFrom) {
await startDialogRef.value?.openForAppWithCopy(row, qCopyFrom)
} else {
await startDialogRef.value?.openForApp(row)
}
}
}
await tryOpenFromQuery()
} finally {
loading.value = false
}
@@ -3,10 +3,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>洁净室列表</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -42,6 +38,7 @@
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
@@ -98,9 +95,9 @@
<div v-if="row.areaSqm" class="clean-room-card__meta">面积 {{ row.areaSqm }} m²</div>
</div>
<div class="clean-room-card__footer">
<el-button class="btn-op-item" @click.stop="handleAccessLog(row)">人员进出</el-button>
<el-button class="btn-op-item" @click.stop="handleAccessLog(row)"><el-icon><User /></el-icon>人员进出</el-button>
<el-button class="btn-op-item" @click.stop="handleUvDisinfectLog(row)"
>紫外线消毒</el-button
><el-icon><Sunny /></el-icon>紫外线消毒</el-button
>
<el-dropdown trigger="hover" @command="(cmd) => handleDropdownCommand(cmd, row)">
<el-button class="btn-op-item" @click.stop>
@@ -2,10 +2,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>选择项</h2>
</div>
<div class="filter-block">
<el-form :model="form" label-position="top" @submit.prevent>
<el-form-item label="请选择">
@@ -3,10 +3,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>预约列表</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -57,6 +53,7 @@
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
<ArtExcelExport
@@ -1054,9 +1054,9 @@
</el-form-item>
</el-form>
<template #footer>
<el-button class="btn-ghost" @click="storeDialogVisible = false">取消</el-button>
<el-button class="btn-ghost" @click="storeDialogVisible = false"><el-icon><Close /></el-icon>取消</el-button>
<el-button type="primary" :loading="storeSubmitLoading" @click="handleStoreSubmit"
>确认入库</el-button
><el-icon><Check /></el-icon>确认入库</el-button
>
</template>
</el-dialog>
@@ -86,6 +86,7 @@
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
@@ -79,6 +79,7 @@
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
@@ -37,6 +37,7 @@
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
@@ -350,13 +351,14 @@
/>
</el-table>
<template #footer>
<el-button class="btn-ghost" @click="priceSelectorVisible = false">取消</el-button>
<el-button class="btn-ghost" @click="priceSelectorVisible = false"><el-icon><Close /></el-icon>取消</el-button>
<el-button
class="btn-main"
type="primary"
:disabled="priceSelectorSelected.length === 0"
@click="handleConfirmPriceSelector"
>
<el-icon><Check /></el-icon>
确认添加({{ priceSelectorSelected.length }})
</el-button>
</template>
@@ -3,10 +3,6 @@
<template>
<div class="page-container cell-product-kanban-page">
<section class="panel">
<div class="panel-top">
<h2>细胞产品基础信息维护</h2>
</div>
<section class="cell-product-stats">
<div class="stat-card">
<div class="stat-icon">
@@ -20,7 +20,7 @@
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" label-position="top" @submit.prevent>
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="渠道名称">
<el-input
@@ -40,6 +40,7 @@
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
@@ -359,8 +360,9 @@
link
size="small"
@click="handleEditInvoice(row)"
>编辑</el-button
>
<el-icon><Edit /></el-icon>编辑
</el-button>
<el-button
class="btn-op-item"
type="danger"
@@ -370,7 +372,7 @@
:disabled="!!deletingInvoiceId"
@click="handleDeleteInvoice(row)"
>
删除
<el-icon><Delete /></el-icon>删除
</el-button>
</div>
</div>
@@ -427,8 +429,9 @@
link
size="small"
@click="handleEditMail(row)"
>编辑</el-button
>
<el-icon><Edit /></el-icon>编辑
</el-button>
<el-button
class="btn-op-item"
type="danger"
@@ -438,7 +441,7 @@
:disabled="!!deletingMailId"
@click="handleDeleteMail(row)"
>
删除
<el-icon><Delete /></el-icon>删除
</el-button>
</div>
</div>
@@ -3,10 +3,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>体检机构及项目</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -3,9 +3,6 @@
<div v-if="isPilotRedirect" />
<div v-else class="page-container">
<section class="panel">
<div class="panel-top">
<h2>体检记录</h2>
</div>
<CheckupManagementTab :biz-type="bizType" />
</section>
</div>
@@ -12,7 +12,7 @@
</div>
<div class="filter-block">
<el-form :model="pendingSearchForm" class="filter-form" label-position="top" @submit.prevent>
<el-form :model="pendingSearchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input
@@ -119,7 +119,6 @@
<el-form
:model="confirmedSearchForm"
class="filter-form"
label-position="top"
@submit.prevent
>
<div class="filter-grid">
@@ -1013,8 +1012,7 @@
font-size: 13px;
font-weight: 500;
color: var(--mint-text-muted, #64748b);
padding: 0 0 4px;
line-height: 1.2;
padding-right: 12px;
}
.refund-confirm-table-wrap {
@@ -48,7 +48,6 @@
<el-form
:model="pendingSearchForm"
class="filter-form"
label-position="top"
@submit.prevent
>
<div class="filter-grid">
@@ -159,7 +158,6 @@
<el-form
:model="confirmedSearchForm"
class="filter-form"
label-position="top"
@submit.prevent
>
<div class="filter-grid">
@@ -1091,8 +1089,7 @@
font-size: 13px;
font-weight: 500;
color: var(--mint-text-muted, #64748b);
padding: 0 0 4px;
line-height: 1.2;
padding-right: 12px;
}
.payment-confirm-table-wrap {
@@ -3,9 +3,6 @@
<div v-if="isPilotRedirect || isClinicalRedirect" />
<div v-else class="page-container">
<section class="panel">
<div class="panel-top">
<h2>输注计划</h2>
</div>
<InfusionScheduleTab :biz-type="bizType" />
</section>
</div>
@@ -3,10 +3,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>审核列表</h2>
</div>
<div class="panel-pill-tabs panel-pill-tabs--lg">
<div class="panel-pill-tabs__track" role="tablist">
<button
@@ -2,30 +2,22 @@
<template>
<div class="page-container">
<section class="panel">
<nav class="pill-tab-nav" role="tablist" aria-label="视图类型">
<div class="pill-tab-nav__rail">
<div class="pill-tab-nav__progress" :style="pillProgressStyle" />
<div v-if="tabCards.length > 1" class="panel-pill-tabs panel-pill-tabs--lg">
<div class="panel-pill-tabs__track" role="tablist" aria-label="视图类型">
<button
v-for="(item, index) in tabCards"
v-for="item in tabCards"
:key="item.key"
type="button"
class="pill-tab-nav__step"
:class="{
'is-active': activeTab === item.key,
'is-done': index < activeTabIndex
}"
role="tab"
class="panel-pill-tabs__btn"
:class="{ 'is-active': activeTab === item.key }"
:aria-selected="activeTab === item.key"
@click="activeTab = item.key"
>
<span class="pill-tab-nav__index">{{ index + 1 }}</span>
<span class="pill-tab-nav__text">
<span class="pill-tab-nav__title">{{ item.title }}</span>
<span class="pill-tab-nav__desc">{{ item.desc }}</span>
</span>
{{ item.title }}
</button>
</div>
</nav>
</div>
<PilotApplicationTab v-if="activeTab === 'application'" :biz-type="effectiveBizType" />
<CheckupManagementTab v-else-if="activeTab === 'checkup'" :biz-type="effectiveBizType" />
@@ -56,30 +48,26 @@
const tabCards = computed(() => {
const cfg = bizConfig.value
const cards: Array<{ key: TabKey; title: string; desc: string }> = [
const cards: Array<{ key: TabKey; title: string }> = [
{
key: 'application',
title: effectiveBizType.value === 'basic_experiment' ? '申请单' : `${cfg.label}申请单`,
desc: '申请单录入、审核与跟踪'
title: effectiveBizType.value === 'basic_experiment' ? '申请单' : `${cfg.label}申请单`
}
]
if (cfg.showCheckup) {
cards.push({
key: 'checkup',
title: '体检管理',
desc: '体检预约、登记与结果'
title: '体检管理'
})
}
cards.push({
key: 'infusion',
title: `${cfg.scheduleLabel}管理`,
desc: `${cfg.scheduleLabel}安排与执行`
title: `${cfg.scheduleLabel}管理`
})
if (cfg.showPayment) {
cards.push({
key: 'payment',
title: '缴费信息',
desc: '缴费提交与状态跟踪'
title: '缴费信息'
})
}
return cards
@@ -90,18 +78,6 @@
const route = useRoute()
const activeTab = ref<TabKey>('application')
const activeTabIndex = computed(() =>
Math.max(
0,
tabCards.value.findIndex((item) => item.key === activeTab.value)
)
)
const pillProgressStyle = computed(() => ({
width: `calc(${100 / tabCards.value.length}% - 3px)`,
transform: `translateX(${activeTabIndex.value * 100}%)`
}))
onMounted(() => {
const tab = String(route.query.tab || '')
if (validTabKeys.value.includes(tab as TabKey)) {
@@ -3,10 +3,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>产品列表</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -82,6 +78,7 @@
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
@@ -3,10 +3,6 @@
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>洁净服管理</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
@@ -41,6 +41,7 @@
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
@@ -363,6 +364,7 @@
size="small"
@click="formData.items.splice($index, 1)"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
</template>
@@ -478,13 +480,14 @@
/>
</el-table>
<template #footer>
<el-button class="btn-ghost" @click="selectConsumableVisible = false">取消</el-button>
<el-button class="btn-ghost" @click="selectConsumableVisible = false"><el-icon><Close /></el-icon>取消</el-button>
<el-button
class="btn-main"
type="primary"
:disabled="selectedConsumables.length === 0"
@click="confirmAddConsumable"
>
<el-icon><Check /></el-icon>
确定添加
</el-button>
</template>
Loaded 100 of 235 files, more files were not shown because too many files have changed in this diff. Show more