This commit is contained in:
zlwu committed 2026-05-19 23:12:56 +08:00
1 parent 93cd506a90
commit 3b875ec370
93 files changed
+11514 -2304

No files matched your search

@@ -237,16 +237,11 @@
} from '@/api/admin'
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
import { useAuth } from '@/hooks/core/useAuth'
import { sexLabel } from '@/utils/status-tag-registry'
const { hasAuth } = useAuth()
defineOptions({ name: 'BizCustomer' })
function sexLabel(s: string) {
if (s === '0') return '男'
if (s === '1') return '女'
return '未知'
}
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
const tableData = ref<Api.BizCustomer.CustomerItem[]>([])
const selectedRows = ref<Api.BizCustomer.CustomerItem[]>([])
@@ -393,16 +393,11 @@
fetchBatchRevokeSampleCodes
} from '@/api/admin'
import { useAuth } from '@/hooks/core/useAuth'
import { sampleCodeTypeLabel } from '@/utils/status-tag-registry'
const { hasAuth } = useAuth()
defineOptions({ name: 'BizSampleCode' })
function sampleCodeTypeLabel(t: string) {
if (t === 'zxbm') return '造血编码'
if (t === 'qdbm') return '脐带编码'
return t || '-'
}
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
const tableData = ref<Api.BizSampleCode.SampleCodeItem[]>([])
const selectedRows = ref<Api.BizSampleCode.SampleCodeItem[]>([])
@@ -61,7 +61,7 @@
</el-table-column>
<el-table-column prop="protocolStatus" label="协议状态" width="100" align="center" header-align="center">
<template #default="{ row }">
{{ protocolStatusLabel(String(row.protocolStatus || '')) }}
<el-tag :type="protocolStatusTagType(String(row.protocolStatus || ''))" size="small">{{ protocolStatusLabel(String(row.protocolStatus || '')) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="payMode" label="缴费方式" width="100" align="center" header-align="center">
@@ -87,7 +87,9 @@
</el-table-column>
<el-table-column prop="payStatus" label="状态" width="110" align="center" header-align="center">
<template #default>
{{ activeTab === 'pending' ? '缴费确认中' : '已缴费' }}
<el-tag :type="activeTab === 'pending' ? 'warning' : 'success'" size="small">
{{ activeTab === 'pending' ? '缴费确认中' : '已缴费' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
@@ -248,6 +250,7 @@
formatPaymentDueDate,
payModeLabel,
protocolStatusLabel,
protocolStatusTagType,
transferTypeLabel
} from '@/utils/protocol-payment-labels'
@@ -166,7 +166,7 @@
header-align="center"
>
<template #default="{ row }">
{{ protocolStatusLabel(String(row.protocolStatus || '')) }}
<el-tag :type="protocolStatusTagType(String(row.protocolStatus || ''))" size="small">{{ protocolStatusLabel(String(row.protocolStatus || '')) }}</el-tag>
</template>
</el-table-column>
<el-table-column
@@ -433,6 +433,14 @@
import { fetchUploadAttachment } from '@/api/business'
import { maskIdCard } from '@/utils/mask-sensitive'
import { isPaymentDueWithinWarnWindow } from '@/utils/protocol-payment-labels'
import {
protocolStatusLabel,
protocolStatusTagType,
payModeLabel,
payStatusLabel,
payStatusTagType,
transferTypeLabel
} from '@/utils/status-tag-registry'
defineOptions({ name: 'CellStoragePaymentInfo' })
@@ -496,55 +504,6 @@
viewVisible.value = true
}
function protocolStatusLabel(s: string) {
const map: Record<string, string> = {
dsx: '待生效',
sxz: '生效中',
ygq: '已过期',
yzf: '已作废',
zky: '转科研'
}
return map[s] || s || '-'
}
function payModeLabel(s: string) {
if (s === 'dj') return '趸交'
if (s === 'fq') return '分期'
return s || '-'
}
function payStatusLabel(s: string) {
const map: Record<string, string> = {
dfj: '待缴费',
jfqrz: '缴费确认中',
yjf: '已缴费',
tfqrz: '退费确认中',
ytf: '已退费'
}
return map[s] || '未知'
}
function payStatusTagType(s: string) {
const map: Record<string, string> = {
dfj: 'info',
jfqrz: 'warning',
yjf: 'success',
tfqrz: 'warning',
ytf: 'danger'
}
return (map[s] || 'info') as 'info' | 'warning' | 'success' | 'danger'
}
function transferTypeLabel(t: string) {
const map: Record<string, string> = {
wxzz: '微信转账',
zzbzz: '支付宝转账',
yhkzz: '银行卡转账',
xj: '现金'
}
return map[t] || t || '-'
}
function formatDate(d: string) {
if (!d || d.length !== 8) return d || '-'
return `${d.slice(0, 4)}-${d.slice(4, 6)}-${d.slice(6, 8)}`
@@ -112,9 +112,11 @@
align="center"
header-align="center"
>
<template #default="{ row }">{{
protocolStatusLabel(String(row.protocolStatus || ''))
}}</template>
<template #default="{ row }">
<el-tag :type="protocolStatusTagType(String(row.protocolStatus || ''))" size="small">{{
protocolStatusLabel(String(row.protocolStatus || ''))
}}</el-tag>
</template>
</el-table-column>
<el-table-column
prop="registerDate"
@@ -318,33 +320,10 @@
fetchDeleteCollectionProtocol,
type CollectionProtocolRow
} from '@/api/collection-protocol'
import { protocolStatusLabel, protocolStatusTagType, newbornSexLabel, deliveryModeLabel } from '@/utils/status-tag-registry'
defineOptions({ name: 'CellStorageProtocolAudit' })
/* ====== 标签映射 ====== */
function protocolStatusLabel(s: string) {
const m: Record<string, string> = {
dsx: '待生效',
sxz: '生效中',
ygq: '已过期',
yzf: '已作废',
zky: '转科研'
}
return m[s] || s || '-'
}
function newbornSexLabel(s: string) {
if (s === '1') return '男'
if (s === '0') return '女'
return s || '-'
}
function deliveryModeLabel(s: string) {
if (s === 'sc') return '顺产'
if (s === 'pgc') return '剖宫产'
return s || '-'
}
/* ====== 列表 ====== */
const searchForm = reactive<{ keyword: string; protocolStatus: string }>({
keyword: '',
@@ -1211,6 +1211,15 @@
import { fetchEthnicList, type EthnicOption } from '@/api/ethnic'
import { useUserStore } from '@/store/modules/user'
import { syncFqPaymentDetailRowCount } from '@/utils/protocol-payment-installment'
import {
payModeLabel,
newbornSexLabel,
deliveryModeLabel,
sampleStatusLabel,
transportTypeLabel,
transferTypeLabel,
payStatusLabel
} from '@/utils/status-tag-registry'
const userStore = useUserStore()
@@ -1332,47 +1341,6 @@
(e: 'saved'): void
}>()
/* ====== 标签映射 ====== */
function protocolStatusLabel(s: string) {
const m: Record<string, string> = {
dsx: '待生效',
sxz: '生效中',
ygq: '已过期',
yzf: '已作废',
zky: '转科研'
}
return m[s] || s || '-'
}
function payModeLabel(s: string) {
if (s === 'dj') return '趸交'
if (s === 'fq') return '分期'
return s || '-'
}
function newbornSexLabel(s: string) {
if (s === '1') return '男'
if (s === '0') return '女'
return s || '-'
}
function deliveryModeLabel(s: string) {
if (s === 'sc') return '顺产'
if (s === 'pgc') return '剖宫产'
return s || '-'
}
function sampleStatusLabel(s: string) {
const m: Record<string, string> = { ycj: '已采集', jcz: '检测中', yrk: '已入库', yzf: '已作废' }
return m[s] || s || '-'
}
function transportTypeLabel(s: string) {
if (s === 'kdys') return '快递运输'
if (s === 'ryxd') return '人员携带'
return s || '-'
}
function siteName(id: string) {
if (!id) return '-'
return siteOptions.value.find((x) => x.id === id)?.siteName || '-'
@@ -1411,11 +1379,6 @@
return `样本 ${index + 1}`
}
function transferTypeLabel(s: string) {
const m: Record<string, string> = { wxzz: '微信', zzbzz: '支付宝', yhkzz: '银行卡', xj: '现金' }
return m[s] || s || '-'
}
function formatPaymentDateYmd(val: string) {
const s = String(val || '').trim()
if (s.length === 8 && /^\d{8}$/.test(s)) {
@@ -1464,17 +1427,6 @@
}
}
function payStatusLabel(s: string) {
const m: Record<string, string> = {
dfj: '待缴费',
jfqrz: '缴费确认中',
yjf: '已缴费',
tfqrz: '退费确认中',
ytf: '已退费'
}
return m[s] || s || '-'
}
/* ====== Tab 常量 ====== */
const formTabs = [
{ key: 'basic', label: '基本信息' },
@@ -34,8 +34,9 @@
<div class="kpi-card">
<div class="kpi-label">协议状态</div>
<div class="kpi-value">
<span class="status-dot" :class="statusDotClass(String(protocol?.protocolStatus || ''))" />
{{ protocolStatusLabel(String(protocol?.protocolStatus || '')) }}
<el-tag :type="protocolStatusTagType(String(protocol?.protocolStatus || ''))" size="small">
{{ protocolStatusLabel(String(protocol?.protocolStatus || '')) }}
</el-tag>
</div>
</div>
<div class="kpi-card">
@@ -53,7 +54,7 @@
<div class="section-title"><h3>基本信息</h3></div>
<div class="data-grid data-grid--3">
<div class="data-item"><div class="data-label">协议号</div><div class="data-value">{{ dash(protocol?.protocolNo) }}</div></div>
<div class="data-item"><div class="data-label">协议状态</div><div class="data-value"><span class="badge" :class="statusBadgeClass(String(protocol?.protocolStatus || ''))">{{ protocolStatusLabel(String(protocol?.protocolStatus || '')) }}</span></div></div>
<div class="data-item"><div class="data-label">协议状态</div><div class="data-value"><el-tag :type="protocolStatusTagType(String(protocol?.protocolStatus || ''))" size="small">{{ protocolStatusLabel(String(protocol?.protocolStatus || '')) }}</el-tag></div></div>
<div class="data-item"><div class="data-label">登记日期</div><div class="data-value">{{ formatYmd(protocol?.registerDate) }}</div></div>
<div class="data-item"><div class="data-label">采集专员</div><div class="data-value">{{ collectorDisplay }}</div></div>
<div class="data-item"><div class="data-label">创建时间</div><div class="data-value">{{ dash(protocol?.createTime) }}</div></div>
@@ -162,9 +163,9 @@
<span class="sample-card__seq">{{ sIdx + 1 }}</span>
{{ sampleTypeName(row.sampleTypeId) }}
</div>
<span class="badge" :class="sampleStatusBadgeClass(String(row.sampleStatus || ''))">
<el-tag :type="sampleStatusTagType(String(row.sampleStatus || ''))" size="small">
{{ sampleStatusLabel(String(row.sampleStatus || '')) }}
</span>
</el-tag>
</div>
<div class="sample-card__body">
<div class="sample-card__section">
@@ -238,14 +239,9 @@
<div class="data-item">
<div class="data-label">结论</div>
<div class="data-value">
<span
class="badge"
:class="
row.sampleReception.acceptConclusion === 'js' ? 'success' : 'danger'
"
>
<el-tag :type="acceptConclusionTagType(String(row.sampleReception.acceptConclusion || ''))" size="small">
{{ acceptConclusionLabel(String(row.sampleReception.acceptConclusion || '')) }}
</span>
</el-tag>
</div>
</div>
<div class="data-item data-item--full">
@@ -284,6 +280,7 @@
</template>
<div v-else class="sample-reception-empty">暂未接收</div>
</div>
<SampleQcInfoCards :qc-info="row.qcInfo" :sample-reception="row.sampleReception" />
</div>
</div>
</div>
@@ -333,12 +330,9 @@
{{ detail.dueAmount ? `¥${detail.dueAmount}` : '—' }}
</span>
</div>
<span
class="badge"
:class="payDetailBadgeClass(String(detail.payStatus || ''))"
>
<el-tag :type="payStatusTagType(String(detail.payStatus || ''))" size="small">
{{ payStatusLabel(String(detail.payStatus || '')) }}
</span>
</el-tag>
</div>
<!-- Info row -->
@@ -427,7 +421,7 @@
<!-- 缴费确认 -->
<div class="flow-detail-card__kv">
<span class="flow-detail-card__label">确认状态</span>
<span class="flow-detail-card__value badge badge--green">已缴费</span>
<span class="flow-detail-card__value"><el-tag type="success" size="small">已缴费</el-tag></span>
</div>
<div v-if="detail.transferTime" class="flow-detail-card__kv">
<span class="flow-detail-card__label">缴费时间</span>
@@ -446,7 +440,7 @@
<!-- 财务确认 -->
<div class="flow-detail-card__kv">
<span class="flow-detail-card__label">确认状态</span>
<span class="flow-detail-card__value badge badge--green">已确认</span>
<span class="flow-detail-card__value"><el-tag type="success" size="small">已确认</el-tag></span>
</div>
<div v-if="detail.updateTime" class="flow-detail-card__kv">
<span class="flow-detail-card__label">确认时间</span>
@@ -491,7 +485,7 @@
<!-- 退费确认(已退费) -->
<div class="flow-detail-card__kv">
<span class="flow-detail-card__label">确认状态</span>
<span class="flow-detail-card__value badge badge--red">已退费</span>
<span class="flow-detail-card__value"><el-tag type="danger" size="small">已退费</el-tag></span>
</div>
<div v-if="detail.updateTime" class="flow-detail-card__kv">
<span class="flow-detail-card__label">确认时间</span>
@@ -590,12 +584,12 @@
header-align="center"
>
<template #default="{ row }">
<span
class="tag"
:class="String(row.auditStatus) === 'shtg' ? 'success' : 'warning'"
<el-tag
:type="String(row.auditStatus) === 'shtg' ? 'success' : 'warning'"
size="small"
>
{{ auditStatusLabel(String(row.auditStatus || '')) }}
</span>
</el-tag>
</template>
</el-table-column>
<el-table-column
@@ -650,6 +644,7 @@
import { computed, nextTick, ref, watch } from 'vue'
import { Close } from '@element-plus/icons-vue'
import ProtocolAttachmentReadonly from './ProtocolAttachmentReadonly.vue'
import SampleQcInfoCards from '@/components/business/sample-qc-info-cards/index.vue'
import {
fetchCollectionProtocolAuditList,
fetchCollectionProtocolDetail,
@@ -665,6 +660,22 @@
fetchUserList
} from '@/api/admin'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import {
protocolStatusLabel,
protocolStatusTagType,
auditStatusLabel,
payModeLabel,
newbornSexLabel,
deliveryModeLabel,
sampleStatusLabel,
sampleStatusTagType,
transportTypeLabel,
transferTypeLabel,
payStatusLabel,
payStatusTagType,
acceptConclusionLabel,
acceptConclusionTagType
} from '@/utils/status-tag-registry'
const props = withDefaults(
defineProps<{
@@ -821,39 +832,6 @@
return dash(val)
}
function protocolStatusLabel(s: string) {
const m: Record<string, string> = {
dsx: '待生效',
sxz: '生效中',
ygq: '已过期',
yzf: '已作废',
zky: '转科研'
}
return m[s] || s || '—'
}
function statusDotClass(s: string): string {
const m: Record<string, string> = {
dsx: 'pending',
sxz: 'active',
ygq: 'expired',
yzf: 'void',
zky: 'research'
}
return m[s] || ''
}
function statusBadgeClass(s: string): string {
const m: Record<string, string> = {
dsx: 'badge--amber',
sxz: 'badge--green',
ygq: 'badge--gray',
yzf: 'badge--red',
zky: 'badge--purple'
}
return m[s] || 'badge--gray'
}
function payDetailColorClass(payStatus: string): string {
const s = String(payStatus || '')
if (s === 'ytf') return 'red'
@@ -861,15 +839,6 @@
return 'green'
}
function payDetailBadgeClass(payStatus: string): string {
const s = String(payStatus || '')
if (s === 'ytf') return 'badge--red'
if (s === 'tfqrz') return 'badge--amber'
if (s === 'yjf') return 'badge--green'
if (s === 'jfqrz') return 'badge--amber'
return 'badge--gray'
}
interface MiniFlowStep {
key: string
label: string
@@ -1059,73 +1028,12 @@
return `left: calc(${leftPct}% + 14px); width: calc(${widthPct}% - 14px);`
}
function auditStatusLabel(s: string) {
if (s === 'shtg') return '审核通过'
if (s === 'shth') return '审核退回'
return s || '—'
}
function auditorDisplay(row: Record<string, unknown>) {
const name = String(row.auditorUserName || '').trim()
if (name) return name
return dash(row.auditorUserId)
}
function payModeLabel(s: string) {
if (s === 'dj') return '趸交'
if (s === 'fq') return '分期'
return s || '—'
}
function newbornSexLabel(s: string) {
if (s === '1') return '男'
if (s === '0') return '女'
return s || '—'
}
function deliveryModeLabel(s: string) {
if (s === 'sc') return '顺产'
if (s === 'pgc') return '剖宫产'
return s || '—'
}
function sampleStatusLabel(s: string) {
const m: Record<string, string> = { ycj: '已采集', jcz: '检测中', yrk: '已入库', yzf: '已作废' }
return m[s] || s || '—'
}
function sampleStatusBadgeClass(s: string): string {
const m: Record<string, string> = {
ycj: 'badge--blue',
jcz: 'badge--amber',
yrk: 'badge--green',
yzf: 'badge--red'
}
return m[s] || 'badge--gray'
}
function transportTypeLabel(s: string) {
if (s === 'kdys') return '快递运输'
if (s === 'ryxd') return '人员携带'
return s || '—'
}
function transferTypeLabel(s: string) {
const m: Record<string, string> = { wxzz: '微信', zzbzz: '支付宝', yhkzz: '银行卡', xj: '现金' }
return m[s] || s || '—'
}
function payStatusLabel(s: string) {
const m: Record<string, string> = {
dfj: '待缴费',
jfqrz: '缴费确认中',
yjf: '已缴费',
tfqrz: '退费确认中',
ytf: '已退费'
}
return m[s] || s || '—'
}
function sampleTypeName(id: string) {
return sampleTypeOptions.value.find((x) => x.id === id)?.typeName || dash(id)
}
@@ -1163,12 +1071,6 @@
return '—'
}
function acceptConclusionLabel(v: string) {
if (v === 'js') return '接收'
if (v === 'bj') return '拒收'
return v || '—'
}
function sampleReceptionCheckList(reception: Record<string, any>) {
const list = reception?.checkResults
return Array.isArray(list) ? list : []
@@ -1549,35 +1451,6 @@
gap: 6px;
}
.status-dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
flex-shrink: 0;
&.pending {
background: #f59e0b;
box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}
&.active {
background: #10b981;
box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}
&.expired {
background: #94a3b8;
box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.2);
}
&.void {
background: #ef4444;
box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}
&.research {
background: #8b5cf6;
box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}
}
/* ---- Section Card ---- */
.section-card {
border-radius: 12px;
@@ -1671,41 +1544,6 @@
}
}
/* ---- Badge ---- */
.badge {
display: inline-block;
padding: 2px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
line-height: 1.6;
&--green {
background: #ecfdf5;
color: #059669;
}
&--amber {
background: #fffbeb;
color: #d97706;
}
&--gray {
background: #f1f5f9;
color: #64748b;
}
&--red {
background: #fef2f2;
color: #dc2626;
}
&--purple {
background: #faf5ff;
color: #7c3aed;
}
&--blue {
background: #eff6ff;
color: #2563eb;
}
}
/* ---- Attachment / Remark Row ---- */
.attachment-row {
margin-top: 12px;
@@ -96,9 +96,11 @@
align="center"
header-align="center"
>
<template #default="{ row }">{{
protocolStatusLabel(String(row.protocolStatus || ''))
}}</template>
<template #default="{ row }">
<el-tag :type="protocolStatusTagType(String(row.protocolStatus || ''))" size="small">{{
protocolStatusLabel(String(row.protocolStatus || ''))
}}</el-tag>
</template>
</el-table-column>
<el-table-column
prop="registerDate"
@@ -276,33 +278,10 @@
fetchDeleteCollectionProtocol,
type CollectionProtocolRow
} from '@/api/collection-protocol'
import { protocolStatusLabel, protocolStatusTagType, newbornSexLabel, deliveryModeLabel } from '@/utils/status-tag-registry'
defineOptions({ name: 'CellStorageProtocol' })
/* ====== 标签映射 ====== */
function protocolStatusLabel(s: string) {
const m: Record<string, string> = {
dsx: '待生效',
sxz: '生效中',
ygq: '已过期',
yzf: '已作废',
zky: '转科研'
}
return m[s] || s || '-'
}
function newbornSexLabel(s: string) {
if (s === '1') return '男'
if (s === '0') return '女'
return s || '-'
}
function deliveryModeLabel(s: string) {
if (s === 'sc') return '顺产'
if (s === 'pgc') return '剖宫产'
return s || '-'
}
/* ====== 列表 ====== */
const searchForm = reactive<{ keyword: string; protocolStatus: string }>({
keyword: '',
@@ -61,7 +61,7 @@
</el-table-column>
<el-table-column prop="protocolStatus" label="协议状态" width="100" align="center" header-align="center">
<template #default="{ row }">
{{ protocolStatusLabel(String(row.protocolStatus || '')) }}
<el-tag :type="protocolStatusTagType(String(row.protocolStatus || ''))" size="small">{{ protocolStatusLabel(String(row.protocolStatus || '')) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="payMode" label="缴费方式" width="100" align="center" header-align="center">
@@ -100,7 +100,9 @@
</el-table-column>
<el-table-column prop="payStatus" label="状态" width="110" align="center" header-align="center">
<template #default>
{{ activeTab === 'pending' ? '退费确认中' : '已退费' }}
<el-tag :type="activeTab === 'pending' ? 'warning' : 'success'" size="small">
{{ activeTab === 'pending' ? '退费确认中' : '已退费' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
@@ -265,6 +267,7 @@
formatPaymentDueDate,
payModeLabel,
protocolStatusLabel,
protocolStatusTagType,
transferTypeLabel
} from '@/utils/protocol-payment-labels'
@@ -374,6 +374,7 @@
import { Plus, Close, Check, View, Edit, Delete, User, OfficeBuilding } from '@element-plus/icons-vue'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
import { buildTreePathLabelFromFlat } from '@/utils/tree-path'
import { cleanRoomGradeLabel, cleanRoomGradeTagType } from '@/utils/status-tag-registry'
import {
fetchCleanRoomList,
fetchCreateCleanRoom,
@@ -418,22 +419,9 @@
roomName: [{ required: true, message: '请输入名称', trigger: 'blur' }]
}
// ── 等级映射 ──────────────────────────────────────
const gradeOptions = [
{ label: 'A级', value: 'A' },
{ label: 'B级', value: 'B' },
{ label: 'C级', value: 'C' },
{ label: 'D级', value: 'D' }
]
function gradeTagType(grade: string) {
const map: Record<string, string> = { A: 'warning', B: '', C: 'info', D: 'info' }
return map[grade] ?? ''
}
function gradeLabel(grade: string) {
return gradeOptions.find((o) => o.value === grade)?.label ?? grade
}
// ── 等级映射(使用 registry 函数) ──────────────────
const gradeTagType = cleanRoomGradeTagType
const gradeLabel = cleanRoomGradeLabel
// ── 选择 ──────────────────────────────────────────
const handleSelectionChange = (rows: any[]) => {
@@ -451,7 +439,7 @@
{ label: '编号', value: row.roomCode },
{ label: '名称', value: row.roomName },
{ label: '等级', value: gradeLabel(row.roomGrade) },
{ label: '状态', value: row.roomStatus === 'zc' ? '正常' : '异常' },
{ label: '状态', value: row.roomStatus === 'zc' ? '正常' : '异常', tagType: row.roomStatus === 'zc' ? 'success' : 'danger' },
{ label: '面积', value: row.areaSqm ? `${row.areaSqm} m²` : '' },
{ label: '备注', value: row.remark, span: true }
]
@@ -34,9 +34,9 @@
<div class="kpi-card">
<div class="kpi-label">渠道类型</div>
<div class="kpi-value">
<span class="badge" :class="channelTypeBadgeClass(channel.channelType)">
<el-tag :type="channelTypeTagType(channel.channelType)" size="small">
{{ channelTypeLabel(channel.channelType) }}
</span>
</el-tag>
</div>
</div>
<div class="kpi-card">
@@ -63,9 +63,9 @@
<div class="data-item">
<div class="data-label">渠道类型</div>
<div class="data-value">
<span class="badge" :class="channelTypeBadgeClass(channel.channelType)">
<el-tag :type="channelTypeTagType(channel.channelType)" size="small">
{{ channelTypeLabel(channel.channelType) }}
</span>
</el-tag>
</div>
</div>
<div class="data-item">
@@ -167,21 +167,21 @@
>
<div class="agreement-card__header">
<div class="agreement-card__tags">
<span class="badge" :class="agreementTypeBadgeClass(agr.agreementType)">
<el-tag :type="agreementTypeTagType(agr.agreementType)" size="small">
{{ agreementTypeLabel(agr.agreementType) }}
</span>
<span class="badge" :class="agreementStatusBadgeClass(agr.status)">
</el-tag>
<el-tag :type="agreementStatusTagType(agr.status)" size="small">
{{ agreementStatusLabel(agr.status) }}
</span>
</el-tag>
</div>
</div>
<div class="data-grid data-grid--4">
<div v-if="agr.settlementType" class="data-item">
<div class="data-label">结算方式</div>
<div class="data-value">
<span class="badge" :class="settlementTypeBadgeClass(agr.settlementType)">
<el-tag :type="settlementTypeTagType(agr.settlementType)" size="small">
{{ settlementTypeLabel(agr.settlementType) }}
</span>
</el-tag>
</div>
</div>
<div v-if="agr.creditLimit != null" class="data-item">
@@ -236,6 +236,16 @@
import { Close } from '@element-plus/icons-vue'
import ProtocolAttachmentReadonly from '@/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import {
channelTypeLabel,
channelTypeTagType,
agreementTypeLabel,
agreementTypeTagType,
agreementStatusLabel,
agreementStatusTagType,
settlementTypeLabel,
settlementTypeTagType
} from '@/utils/status-tag-registry'
import {
fetchChannelInvoices,
fetchChannelMailAddresses,
@@ -259,33 +269,6 @@
{ key: 'agreement', label: '协议信息' }
] as const
const channelTypeMap: Record<string, string> = {
yy: '医院',
hzjg: '合作机构',
zs: '诊所',
zfjg: '政府机构',
qt: '其他'
}
const agreementTypeMap: Record<string, string> = {
kyxy: '框架协议',
zsxy: '中试协议',
lcxy: '临床协议'
}
const settlementTypeMap: Record<string, string> = {
yj: '月结',
jj: '季结',
nj: '年结',
dcjs: '单次结算'
}
const agreementStatusMap: Record<string, string> = {
dsx: '待生效',
sxz: '生效中',
yzf: '已作废'
}
const loading = ref(false)
const activeTab = ref('basic')
const invoiceList = ref<any[]>([])
@@ -325,50 +308,6 @@
return String(val)
}
function channelTypeLabel(type: string) {
const key = String(type || '').trim()
if (!key) return '—'
return channelTypeMap[key] || key
}
function channelTypeBadgeClass(type: string): string {
const m: Record<string, string> = {
yy: 'badge--blue',
hzjg: 'badge--green',
zs: 'badge--amber',
zfjg: 'badge--red',
qt: 'badge--gray'
}
return m[String(type || '')] || 'badge--gray'
}
function agreementTypeLabel(type: string) {
return agreementTypeMap[String(type || '')] || dash(type)
}
function agreementTypeBadgeClass(type: string): string {
const m: Record<string, string> = {
kyxy: 'badge--blue',
zsxy: 'badge--green',
lcxy: 'badge--amber'
}
return m[String(type || '')] || 'badge--gray'
}
function settlementTypeLabel(type: string) {
return settlementTypeMap[String(type || '')] || dash(type)
}
function settlementTypeBadgeClass(type: string): string {
const m: Record<string, string> = {
yj: 'badge--gray',
jj: 'badge--green',
nj: 'badge--amber',
dcjs: 'badge--red'
}
return m[String(type || '')] || 'badge--gray'
}
function normalizeAgreementRow(row: Record<string, any>) {
const status = String(row.agreementStatus ?? row.status ?? 'dsx').trim() || 'dsx'
return {
@@ -381,19 +320,6 @@
}
}
function agreementStatusLabel(status: string) {
return agreementStatusMap[String(status || '')] || dash(status)
}
function agreementStatusBadgeClass(status: string): string {
const m: Record<string, string> = {
dsx: 'badge--amber',
sxz: 'badge--green',
yzf: 'badge--red'
}
return m[String(status || '')] || 'badge--gray'
}
function fullFileUrl(suffix: string) {
if (!suffix) return ''
if (suffix.startsWith('http://') || suffix.startsWith('https://') || suffix.startsWith('/')) {
@@ -660,40 +586,6 @@
}
}
.badge {
display: inline-block;
padding: 2px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
line-height: 1.6;
&--green {
background: #ecfdf5;
color: #059669;
}
&--amber {
background: #fffbeb;
color: #d97706;
}
&--gray {
background: #f1f5f9;
color: #64748b;
}
&--red {
background: #fef2f2;
color: #dc2626;
}
&--blue {
background: #eff6ff;
color: #2563eb;
}
}
.attachment-row {
margin-top: 12px;
padding-top: 12px;
@@ -90,7 +90,7 @@
header-align="center"
>
<template #default="{ row }">
<el-tag :type="channelTagType[row.channelType] || 'info'" size="small">
<el-tag :type="channelTypeTagType(row.channelType)" size="small">
{{ channelTypeLabel(row.channelType) }}
</el-tag>
</template>
@@ -198,9 +198,9 @@
style="width: 100%"
>
<el-option
v-for="(label, key) in channelTypeMap"
v-for="(item, key) in channelTypeRegistry"
:key="key"
:label="label"
:label="item.label"
:value="key"
/>
</el-select>
@@ -569,16 +569,16 @@
<div class="protocol-card__header">
<div class="protocol-card__tags">
<el-tag
:type="agreementTypeTagMap[agr.agreementType]?.type || 'info'"
:type="agreementTypeTagType(agr.agreementType)"
size="small"
>
{{ agreementTypeTagMap[agr.agreementType]?.label || agr.agreementType }}
{{ agreementTypeLabel(agr.agreementType) }}
</el-tag>
<el-tag
:type="agreementStatusTagMap[agr.status]?.type || 'info'"
:type="agreementStatusTagType(agr.status)"
size="small"
>
{{ agreementStatusTagMap[agr.status]?.label || agr.status || '—' }}
{{ agreementStatusLabel(agr.status) }}
</el-tag>
</div>
<div class="protocol-card__actions">
@@ -623,10 +623,10 @@
<span class="field-label">结算方式</span>
<span class="field-value">
<el-tag
:type="settlementTypeTagMap[agr.settlementType]?.type || 'info'"
:type="settlementTypeTagType(agr.settlementType)"
size="small"
>
{{ settlementTypeTagMap[agr.settlementType]?.label || agr.settlementType }}
{{ settlementTypeLabel(agr.settlementType) }}
</el-tag>
</span>
</div>
@@ -822,10 +822,10 @@
<div class="form-grid-2">
<el-form-item label="协议状态" class="form-col-span-2">
<el-tag
:type="agreementStatusTagMap[agreementFormStatus]?.type || 'info'"
:type="agreementStatusTagType(agreementFormStatus)"
size="default"
>
{{ agreementStatusTagMap[agreementFormStatus]?.label || agreementFormStatus || '—' }}
{{ agreementStatusLabel(agreementFormStatus) }}
</el-tag>
<span v-if="!agreementIsEdit" class="form-label-tip" style="margin-left: 8px">
保存后为待生效,可在协议卡片点击「生效」变为生效中
@@ -834,7 +834,7 @@
<el-form-item label="协议类型" prop="agreementType">
<el-select v-model="agreementFormData.agreementType" placeholder="请选择协议类型" style="width: 100%">
<el-option
v-for="(item, key) in agreementTypeTagMap"
v-for="(item, key) in agreementType"
:key="key"
:label="item.label"
:value="key"
@@ -844,7 +844,7 @@
<el-form-item label="结算方式" prop="settlementType">
<el-select v-model="agreementFormData.settlementType" placeholder="请选择结算方式" style="width: 100%">
<el-option
v-for="(item, key) in settlementTypeTagMap"
v-for="(item, key) in settlementType"
:key="key"
:label="item.label"
:value="key"
@@ -1047,6 +1047,19 @@
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
import { fetchUploadAttachment } from '@/api/business'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import {
channelType as channelTypeRegistry,
channelTypeLabel,
channelTypeTagType,
agreementType,
agreementTypeLabel,
agreementTypeTagType,
agreementStatusLabel,
agreementStatusTagType,
settlementType,
settlementTypeLabel,
settlementTypeTagType
} from '@/utils/status-tag-registry'
import {
fetchChannelList,
fetchCreateChannel,
@@ -1080,26 +1093,6 @@
// ---------------------------------------------------------------------------
// 常量映射
// ---------------------------------------------------------------------------
const channelTypeMap: Record<string, string> = {
yy: '医院',
hzjg: '合作机构',
zs: '诊所',
zfjg: '政府机构',
qt: '其他'
}
const channelTagType: Record<string, string> = {
yy: 'primary',
hzjg: 'success',
zs: 'warning',
zfjg: 'danger',
qt: 'info'
}
function channelTypeLabel(type: string) {
const key = String(type || '').trim()
if (!key) return '—'
return channelTypeMap[key] || key
}
/** 子表列表接口可能直接返回数组,也可能包在 list 中 */
function normalizeSubList(res: unknown): any[] {
@@ -1197,23 +1190,6 @@
return protocolUrlsToAttachments(String(row?.protocolAttachments || ''))
}
const agreementTypeTagMap: Record<string, { label: string; type: string }> = {
kyxy: { label: '框架协议', type: 'primary' },
zsxy: { label: '中试协议', type: 'success' },
lcxy: { label: '临床协议', type: 'warning' }
}
const settlementTypeTagMap: Record<string, { label: string; type: string }> = {
yj: { label: '月结', type: '' },
jj: { label: '季结', type: 'success' },
nj: { label: '年结', type: 'warning' },
dcjs: { label: '单次结算', type: 'danger' }
}
const agreementStatusTagMap: Record<string, { label: string; type: string }> = {
dsx: { label: '待生效', type: 'info' },
sxz: { label: '生效中', type: 'success' },
yzf: { label: '已作废', type: 'danger' }
}
// ---------------------------------------------------------------------------
// 搜索 & 主表
// ---------------------------------------------------------------------------
@@ -34,9 +34,7 @@
</el-table-column>
<el-table-column prop="status" label="状态" width="90" align="center">
<template #default="{ row }">
<span :class="['tag', row.status == '1' ? 'success' : 'muted']">
{{ row.status == '1' ? '正常' : '停用' }}
</span>
<el-tag :type="row.status == '1' ? 'success' : 'info'" size="small">{{ row.status == '1' ? '正常' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column
@@ -124,9 +122,7 @@
</el-table-column>
<el-table-column label="状态" width="90" align="center" header-align="center">
<template #default="{ row }">
<span :class="['tag', row.status == '1' ? 'success' : 'muted']">
{{ row.status == '1' ? '正常' : '停用' }}
</span>
<el-tag :type="row.status == '1' ? 'success' : 'info'" size="small">{{ row.status == '1' ? '正常' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="备注" min-width="140" align="center" header-align="center">
@@ -187,9 +183,7 @@
</el-table-column>
<el-table-column prop="status" label="状态" width="90" align="center">
<template #default="{ row }">
<span :class="['tag', row.status == '1' ? 'success' : 'muted']">
{{ row.status == '1' ? '正常' : '停用' }}
</span>
<el-tag :type="row.status == '1' ? 'success' : 'info'" size="small">{{ row.status == '1' ? '正常' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column
@@ -74,9 +74,7 @@
<el-table-column prop="contactPhone" label="联系电话" min-width="120" align="center" header-align="center" />
<el-table-column prop="tag" label="状态" width="90" align="center" header-align="center">
<template #default="{ row }">
<span :class="['tag', row.status == '1' ? 'success' : 'muted']">
{{ row.status == '1' ? '正常' : '停用' }}
</span>
<el-tag :type="row.status == '1' ? 'success' : 'info'" size="small">{{ row.status == '1' ? '正常' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="400" fixed="right" align="center" header-align="center">
@@ -207,9 +205,7 @@
</el-table-column>
<el-table-column prop="status" label="状态" width="90" align="center" header-align="center">
<template #default="{ row }">
<span :class="['tag', row.status == '1' ? 'success' : 'muted']">
{{ row.status == '1' ? '正常' : '停用' }}
</span>
<el-tag :type="row.status == '1' ? 'success' : 'info'" size="small">{{ row.status == '1' ? '正常' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" min-width="140" align="center" header-align="center" show-overflow-tooltip />
@@ -583,7 +579,7 @@
{ label: '机构地址', value: row.institutionAddress, span: true },
{ label: '联系人', value: row.contactName },
{ label: '联系电话', value: row.contactPhone },
{ label: '状态', value: row.status == '1' ? '正常' : '停用' },
{ label: '状态', value: row.status == '1' ? '正常' : '停用', tagType: row.status == '1' ? 'success' : 'info' },
{ label: '备注', value: row.remark, span: true }
]
}
@@ -365,7 +365,8 @@
{ label: '体系编码', value: row.systemCode },
{
label: '状态',
value: String(row.status) === '1' ? '正常' : '停用'
value: String(row.status) === '1' ? '正常' : '停用',
tagType: String(row.status) === '1' ? 'success' : 'info'
},
{ label: '备注', value: row.remark, span: true },
{ label: '创建时间', value: row.createTime }
@@ -398,6 +398,7 @@
fetchAllConsumables
} from '@/api/production'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
import { packTypeLabel } from '@/utils/status-tag-registry'
defineOptions({ name: 'ProductionConsumablePack' })
@@ -416,12 +417,6 @@
const viewLoading = ref(false)
const viewDetail = ref<any>(null)
function packTypeLabel(packType?: string) {
if (packType === 'bzhcb') return '标准耗材包'
if (packType === 'zdyhcb') return '自定义耗材包'
return packType || '—'
}
const formData = reactive({
packCode: '',
packName: '',
File diff suppressed because it is too large. Load diff
+148 -27
View File
@@ -112,7 +112,7 @@
/>
<el-table-column
prop="estimatedDuration"
label="预估耗时"
label="预估耗时(min)"
min-width="100"
align="center"
header-align="center"
@@ -405,13 +405,27 @@
<div id="form-section-data-collections" class="form-tab-pane">
<div class="section-card">
<div class="section-title">
<div class="section-title-left"><h3>数据采集</h3></div>
<div class="section-title-left">
<h3>数据采集</h3>
<span class="inner-table-sort-tip">拖拽左侧手柄可调整排序</span>
</div>
<el-button class="btn-main" type="primary" size="small" @click="addDataCollectionRow">
<el-icon><Plus /></el-icon>
添加采集项
</el-button>
</div>
<el-table :data="dataCollectionList" stripe class="inner-table">
<el-table
ref="dataCollectionTableRef"
:data="dataCollectionList"
row-key="_clientKey"
stripe
class="inner-table data-collection-sort-table"
>
<el-table-column label="" width="52" align="center" header-align="center" class-name="drag-col">
<template #default>
<el-icon class="data-collection-drag-handle" title="拖拽排序"><Rank /></el-icon>
</template>
</el-table-column>
<el-table-column
type="index"
label="序号"
@@ -430,15 +444,9 @@
<el-input v-model="row.unit" placeholder="如 °C、mL、%" class="inner-cell-input" />
</template>
</el-table-column>
<el-table-column label="排序号" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<el-input-number
v-model="row.orderNum"
:min="0"
:max="9999"
controls-position="right"
class="inner-cell-input"
/>
<el-table-column label="排序号" width="88" align="center" header-align="center">
<template #default="{ $index }">
<span class="data-collection-order-num">{{ $index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="备注" min-width="120" align="center" header-align="center">
@@ -448,7 +456,7 @@
</el-table-column>
<el-table-column label="操作" width="80" align="center" header-align="center">
<template #default="{ $index }">
<el-button link type="danger" size="small" @click="dataCollectionList.splice($index, 1)">删除</el-button>
<el-button link type="danger" size="small" @click="removeDataCollectionRow($index)">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -622,7 +630,9 @@
</template>
<script setup lang="ts">
import { Plus, Close, Check } from '@element-plus/icons-vue'
import { Plus, Close, Check, Rank } from '@element-plus/icons-vue'
import Sortable from 'sortablejs'
import type { SortableEvent } from 'sortablejs'
import {
fetchProcessList,
fetchProcessDetail,
@@ -712,6 +722,57 @@
const consumableList = ref<any[]>([])
const outputList = ref<any[]>([])
const dataCollectionList = ref<any[]>([])
const dataCollectionTableRef = ref()
let dataCollectionSortable: Sortable | null = null
let dataCollectionKeySeq = 0
function nextDataCollectionClientKey() {
dataCollectionKeySeq += 1
return `dc_${Date.now()}_${dataCollectionKeySeq}`
}
function withDataCollectionClientKey(row: Record<string, any>) {
return {
...row,
_clientKey: row._clientKey || nextDataCollectionClientKey()
}
}
function syncDataCollectionOrderNum() {
dataCollectionList.value.forEach((item, index) => {
item.orderNum = index + 1
})
}
function destroyDataCollectionSortable() {
dataCollectionSortable?.destroy()
dataCollectionSortable = null
}
function initDataCollectionSortable() {
destroyDataCollectionSortable()
nextTick(() => {
const tableEl = dataCollectionTableRef.value?.$el as HTMLElement | undefined
const tbody = tableEl?.querySelector('.el-table__body-wrapper tbody')
if (!tbody || dataCollectionList.value.length === 0) return
dataCollectionSortable = Sortable.create(tbody as HTMLElement, {
handle: '.data-collection-drag-handle',
animation: 150,
ghostClass: 'data-collection-row-ghost',
onEnd: (evt: SortableEvent) => {
const { oldIndex, newIndex } = evt
if (oldIndex == null || newIndex == null || oldIndex === newIndex) return
const list = [...dataCollectionList.value]
const [moved] = list.splice(oldIndex, 1)
list.splice(newIndex, 0, moved)
dataCollectionList.value = list
syncDataCollectionOrderNum()
}
})
})
}
// 选择试剂弹窗
const selectReagentVisible = ref(false)
const filteredReagentList = ref<any[]>([])
@@ -881,14 +942,17 @@
resetForm()
await loadReferenceData()
dialogVisible.value = true
nextTick(() => formRef.value?.clearValidate?.())
nextTick(() => {
formRef.value?.clearValidate?.()
initDataCollectionSortable()
})
}
async function handleEdit(row: any) {
resetForm()
isEdit.value = true
dialogTitle.value = '编辑工艺'
editingId.value = row.id
resetForm()
await loadReferenceData()
try {
const detail = await fetchProcessDetail(row.id)
@@ -914,15 +978,20 @@
...o,
remark: o.remark ?? ''
}))
dataCollectionList.value = (detail.dataCollections || []).map((d: any) => ({
...d,
remark: d.remark ?? ''
}))
dataCollectionList.value = (detail.dataCollections || []).map((d: any) =>
withDataCollectionClientKey({
...d,
remark: d.remark ?? ''
})
)
} catch {
ElMessage.error('加载详情失败')
}
dialogVisible.value = true
nextTick(() => formRef.value?.clearValidate?.())
nextTick(() => {
formRef.value?.clearValidate?.()
initDataCollectionSortable()
})
}
async function handleSubmit() {
@@ -1184,14 +1253,34 @@
}
function addDataCollectionRow() {
dataCollectionList.value.push({
collectionName: '',
unit: '',
orderNum: dataCollectionList.value.length + 1,
remark: ''
})
dataCollectionList.value.push(
withDataCollectionClientKey({
collectionName: '',
unit: '',
orderNum: dataCollectionList.value.length + 1,
remark: ''
})
)
syncDataCollectionOrderNum()
nextTick(() => initDataCollectionSortable())
}
function removeDataCollectionRow(index: number) {
dataCollectionList.value.splice(index, 1)
syncDataCollectionOrderNum()
nextTick(() => initDataCollectionSortable())
}
watch(dialogVisible, (visible) => {
if (!visible) {
destroyDataCollectionSortable()
}
})
onBeforeUnmount(() => {
destroyDataCollectionSortable()
})
// 初始化加载列表 & 分类数据(用于列表列的分类名映射)
onMounted(async () => {
await loadData()
@@ -1286,6 +1375,7 @@
.section-title-left {
display: flex;
align-items: center;
gap: 12px;
&::before {
content: '';
@@ -1320,6 +1410,37 @@
grid-column: 1 / -1;
}
.inner-table-sort-tip {
font-size: 12px;
font-weight: 400;
color: var(--mint-text-muted, #64748b);
}
.data-collection-drag-handle {
cursor: move;
color: #909399;
font-size: 18px;
&:hover {
color: #059669;
}
}
.data-collection-order-num {
display: inline-block;
min-width: 24px;
font-size: 14px;
color: var(--mint-text-muted, #64748b);
line-height: 32px;
}
.data-collection-sort-table {
:deep(.data-collection-row-ghost) {
opacity: 0.55;
background: #ecfdf5 !important;
}
}
.inner-table {
width: 100%;
@@ -58,7 +58,7 @@
<el-table-column prop="description" label="描述" min-width="200" align="center" show-overflow-tooltip />
<el-table-column prop="status" label="状态" width="90" align="center">
<template #default="{ row }">
<span :class="['tag', row.status === '1' ? 'success' : 'muted']">{{ row.status === '1' ? '启用' : '停用' }}</span>
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">{{ row.status === '1' ? '启用' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="320" fixed="right" align="center">
@@ -284,7 +284,7 @@
fields: [
{ label: '项目编码', value: row.itemCode },
{ label: '项目名称', value: row.itemName },
{ label: '状态', value: row.status === '1' ? '启用' : '停用' }
{ label: '状态', value: row.status === '1' ? '启用' : '停用', tagType: row.status === '1' ? 'success' : 'info' }
]
},
{
@@ -4,7 +4,7 @@
<div class="page-container">
<header class="page-head">
<h1>质检任务</h1>
<p class="page-desc">按检测项目跟进任务;实验室自检需开始/完成,第三方需上传检测材料后完成。</p>
<p class="page-desc">按检测项目跟进任务;实验室自检需开始后再填写结果,第三方在填写结果时一并上传检测材料。</p>
</header>
<section class="panel">
@@ -16,7 +16,17 @@
<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-input
v-model="searchForm.keyword"
placeholder="任务号/工单号/样本编码/项目"
clearable
/>
</el-form-item>
<el-form-item label="业务类型">
<el-select v-model="searchForm.qcBizType" placeholder="全部" clearable style="width: 100%">
<el-option label="入库质检" value="inbound" />
<el-option label="出库质检" value="outbound" />
</el-select>
</el-form-item>
<el-form-item label="任务类型">
<el-select v-model="searchForm.taskType" placeholder="全部" clearable style="width: 100%">
@@ -45,33 +55,75 @@
<el-table class="list-table" :data="tableData" v-loading="loading" stripe @row-dblclick="handleView">
<el-table-column type="index" label="序号" width="68" align="center" :index="(i) => (pagination.page - 1) * pagination.pageSize + i + 1" />
<el-table-column prop="taskNo" label="任务号" min-width="150" align="center" />
<el-table-column prop="workOrderNo" label="工单号" min-width="140" align="center" />
<el-table-column prop="taskType" label="类型" width="110" align="center">
<el-table-column prop="qcBizTypeLabel" label="业务类型" width="100" align="center">
<template #default="{ row }">
<span :class="['tag', row.taskType === 'sysz' ? 'success' : 'muted']">{{ taskTypeLabel(row.taskType) }}</span>
<el-tag type="success" size="small">{{ row.qcBizTypeLabel || qcBizTypeLabel(row.qcBizType || '') }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="workOrderNo" label="工单号" min-width="140" align="center" />
<el-table-column prop="receptionSourceLabel" label="样本来源" width="100" align="center">
<template #default="{ row }">
<el-tag :type="row.receptionSource === 'research_donation' ? 'warning' : 'success'" size="small">
{{ row.receptionSourceLabel || receptionSourceLabel(row.receptionSource || '') }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="sampleTypeName" label="样本类型" min-width="110" align="center">
<template #default="{ row }">{{ row.sampleTypeName || '—' }}</template>
</el-table-column>
<el-table-column prop="sampleCode" label="样本编码" min-width="120" align="center">
<template #default="{ row }">{{ row.sampleCode || '—' }}</template>
</el-table-column>
<el-table-column prop="receptionTime" label="接收时间" min-width="170" align="center">
<template #default="{ row }">{{ row.receptionTime || '—' }}</template>
</el-table-column>
<el-table-column prop="handlerName" label="接收经手人" min-width="110" align="center">
<template #default="{ row }">{{ row.handlerName || '—' }}</template>
</el-table-column>
<el-table-column prop="taskType" label="检测类型" width="110" align="center">
<template #default="{ row }">
<el-tag :type="row.taskType === 'sysz' ? 'success' : 'info'" size="small">{{ taskTypeLabel(row.taskType) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="itemName" label="检测项目" min-width="160" align="center" />
<el-table-column prop="companyName" label="第三方公司" min-width="120" align="center">
<template #default="{ row }">{{ row.companyName || '—' }}</template>
</el-table-column>
<el-table-column prop="taskStatus" label="状态" width="100" align="center">
<el-table-column prop="conclusion" label="质检结论" width="100" align="center">
<template #default="{ row }">
<span :class="['tag', row.taskStatus === 'ywc' ? 'success' : row.taskStatus === 'jxz' ? 'warning' : 'muted']">
{{ taskStatusLabel(row.taskStatus) }}
</span>
<el-tag
v-if="row.conclusion === 'tg'"
type="success"
size="small"
>
{{ row.conclusionLabel || qcTaskConclusionLabel(row.conclusion) }}
</el-tag>
<el-tag
v-else-if="row.conclusion === 'btg'"
type="danger"
size="small"
>
{{ row.conclusionLabel || qcTaskConclusionLabel(row.conclusion) }}
</el-tag>
<el-tag v-else type="info" size="small">—</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="300" fixed="right" align="center">
<el-table-column prop="taskStatus" label="状态" width="100" align="center">
<template #default="{ row }">
<el-tag :type="row.taskStatus === 'ywc' ? 'success' : row.taskStatus === 'jxz' ? 'warning' : 'info'" size="small">
{{ taskStatusLabel(row.taskStatus) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" min-width="140" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.remark || '—' }}</template>
</el-table-column>
<el-table-column label="操作" width="260" fixed="right" align="center">
<template #default="{ row }">
<template v-if="row.taskType === 'sysz' && row.taskStatus === 'dzx'">
<el-button class="btn-op-item primary" @click="handleStart(row)"><el-icon><VideoPlay /></el-icon>开始</el-button>
</template>
<template v-if="row.taskType === 'sysz' && row.taskStatus === 'jxz'">
<el-button class="btn-op-item primary" @click="openResult(row)"><el-icon><EditPen /></el-icon>填写结果</el-button>
</template>
<template v-if="row.taskType === 'dsfjc' && row.taskStatus !== 'ywc'">
<el-button class="btn-op-item" @click="openAttach(row)"><el-icon><Upload /></el-icon>上传材料</el-button>
<template v-if="canFillResult(row)">
<el-button class="btn-op-item primary" @click="openResult(row)"><el-icon><EditPen /></el-icon>填写结果</el-button>
</template>
<el-button class="btn-op-item" @click="handleView(row)"><el-icon><View /></el-icon>查看</el-button>
@@ -90,20 +142,6 @@
</div>
</div>
<el-dialog v-model="attachVisible" title="上传第三方检测材料" width="720px" class="dialog-form-layout" align-center destroy-on-close :close-on-click-modal="false">
<ProtocolFinanceConfirmFields
v-model:finance-remark="attachRemark"
v-model:attachments="attachments"
remark-label="备注"
attachment-label="检测材料"
upload-folder="qc-third-party"
/>
<template #footer>
<el-button class="btn-ghost" @click="attachVisible = false"><el-icon><Close /></el-icon>取消</el-button>
<el-button class="btn-main" type="primary" :loading="attachLoading" @click="saveAttachments"><el-icon><Check /></el-icon>保存</el-button>
</template>
</el-dialog>
<el-dialog
v-model="resultVisible"
title="填写检测结果"
@@ -113,48 +151,93 @@
destroy-on-close
:close-on-click-modal="false"
>
<el-form label-position="top" class="biz-dialog-form">
<el-form v-loading="resultLoading" label-position="top" class="biz-dialog-form">
<div class="form-section">
<div class="section-title">检测参数</div>
<div v-if="resultParams.length === 0" style="text-align: center; padding: 8px 0; color: #94a3b8; font-size: 13px">
该项目暂无配置参数
<div
v-if="!resultLoading && resultParams.length === 0"
style="text-align: center; padding: 8px 0; color: #94a3b8; font-size: 13px"
>
该项目暂无配置参数,请先在实验室/第三方项目中维护检测参数
</div>
<div class="form-grid-2">
<el-form-item v-for="(param, idx) in resultParams" :key="idx" :label="param.paramName + (param.paramUnit ? `(${param.paramUnit})` : '')">
<el-form-item
v-for="(param, idx) in resultParams"
:key="param.paramId || param.paramCode || idx"
:label="param.paramName + (param.paramUnit ? `(${param.paramUnit})` : '')"
>
<el-input v-if="param.paramType === 'text'" v-model="param.paramValue" placeholder="请输入" />
<el-input-number v-else v-model="param.paramValue" :precision="2" style="width: 100%" placeholder="请输入" />
<el-input-number
v-else
:model-value="toResultNumber(param.paramValue)"
:precision="2"
style="width: 100%"
placeholder="请输入"
@update:model-value="(v) => setResultNumber(param, v)"
/>
</el-form-item>
</div>
</div>
<div v-if="resultTaskType === 'dsfjc'" style="margin-top: 12px">
<div class="form-section result-conclusion-section">
<div class="section-title">检测结论</div>
<el-form-item label="结论" required>
<el-radio-group v-model="resultConclusion">
<el-radio value="tg">通过</el-radio>
<el-radio value="btg">不通过</el-radio>
</el-radio-group>
</el-form-item>
</div>
<div class="form-section result-remark-section">
<div class="section-title">备注</div>
<el-form-item label="备注">
<el-input v-model="resultRemark" type="textarea" :rows="3" placeholder="选填" />
</el-form-item>
</div>
<div class="form-section result-attachment-section">
<ProtocolFinanceConfirmFields
v-model:finance-remark="resultRemark"
v-model:attachments="resultAttachments"
remark-label="备注"
attachment-label="检测材料"
upload-folder="qc-third-party"
:show-remark="false"
:attachment-label="resultAttachmentLabel"
:upload-folder="resultUploadFolder"
/>
</div>
</el-form>
<template #footer>
<el-button class="btn-ghost" @click="resultVisible = false"><el-icon><Close /></el-icon>取消</el-button>
<el-button class="btn-main" type="primary" :loading="resultLoading" @click="submitResult"><el-icon><Check /></el-icon>提交并完成</el-button>
<el-button class="btn-main" type="primary" :loading="resultLoading" @click="submitResult"><el-icon><Check /></el-icon>{{ resultSubmitLabel }}</el-button>
</template>
</el-dialog>
<SystemViewDialog
v-model:visible="viewVisible"
title="任务详情"
width="960px"
:grid-columns="3"
:icon="Tickets"
:meta="viewDetail?.taskNo || ''"
:sections="viewSections"
>
<template #reception-extra>
<div class="view-reception-attachments">
<div class="view-kv view-kv-span-2">
<dt>接收附件</dt>
<dd>
<ProtocolAttachmentReadonly
:files="viewReceptionAttachmentFiles"
@preview="handleReceptionAttachmentPreview"
@download="handleReceptionAttachmentDownload"
/>
</dd>
</div>
</div>
</template>
<template #append>
<div
v-if="viewDetail?.attachmentFiles?.length"
class="view-section qc-task-view-attachments"
>
<h3>检测材料</h3>
<h3>{{ viewDetail?.taskType === 'dsfjc' ? '检测材料' : '检测附件' }}</h3>
<ProtocolAttachmentReadonly
:files="viewDetail.attachmentFiles"
@preview="handleViewAttachmentPreview"
@@ -170,7 +253,7 @@
<script setup lang="ts">
import { ref, reactive, computed, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { Close, Check, Search, RefreshLeft, VideoPlay, Upload, View, Tickets, EditPen } from '@element-plus/icons-vue'
import { Close, Check, Search, RefreshLeft, VideoPlay, View, Tickets, EditPen } from '@element-plus/icons-vue'
import ProtocolFinanceConfirmFields from '@/components/business/protocol-finance-confirm-fields/index.vue'
import ProtocolAttachmentReadonly from '@/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue'
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
@@ -183,36 +266,61 @@
fetchQcTaskList,
fetchQcTaskDetail,
fetchStartQcTask,
fetchCompleteQcTask,
fetchUpdateQcTaskAttachments,
type QcTask,
type QcTaskDetail
} from '@/api/qc-task'
import { fetchQcTaskResults, fetchCompleteTaskWithResult, type QcTaskResultItem } from '@/api/qc-task-result'
import { taskTypeLabel, taskStatusLabel } from '@/utils/qc-labels'
import {
taskTypeLabel,
taskStatusLabel,
qcBizTypeLabel,
receptionSourceLabel,
acceptConclusionLabel,
transportTypeLabel,
workOrderStatusLabel,
qcTaskConclusionLabel
} from '@/utils/qc-labels'
import { downloadAttachmentFile } from '@/utils/download-attachment'
defineOptions({ name: 'QualityInspectionQcTask' })
const searchForm = reactive({ keyword: '', taskType: '', taskStatus: '' })
const searchForm = reactive({ keyword: '', qcBizType: '', taskType: '', taskStatus: '' })
const tableData = ref<QcTask[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const attachVisible = ref(false)
const attachLoading = ref(false)
const attachTaskId = ref('')
const attachRemark = ref('')
const attachments = ref<FinanceAttachmentItem[]>([])
const resultVisible = ref(false)
const resultLoading = ref(false)
const resultTaskId = ref('')
const resultTaskType = ref('')
const resultTaskStatus = ref('')
const resultParams = ref<QcTaskResultItem[]>([])
const resultRemark = ref('')
const resultConclusion = ref('')
const resultAttachments = ref<FinanceAttachmentItem[]>([])
function canFillResult(row: QcTask) {
if (row.taskType === 'sysz') {
return row.taskStatus === 'jxz' || row.taskStatus === 'ywc'
}
if (row.taskType === 'dsfjc') {
return row.taskStatus === 'dzx' || row.taskStatus === 'jxz' || row.taskStatus === 'ywc'
}
return false
}
const resultSubmitLabel = computed(() =>
resultTaskStatus.value === 'ywc' ? '保存' : '提交并完成'
)
const resultAttachmentLabel = computed(() =>
resultTaskType.value === 'dsfjc' ? '检测材料' : '检测附件'
)
const resultUploadFolder = computed(() =>
resultTaskType.value === 'dsfjc' ? 'qc-third-party' : 'qc-lab'
)
const viewVisible = ref(false)
const viewDetail = ref<QcTaskDetail | null>(null)
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
@@ -245,31 +353,163 @@
downloadAttachmentFile(file, { fullFileUrl: attachmentFullUrl })
}
const viewReceptionAttachmentFiles = computed(() => {
const r = viewDetail.value?.reception
if (!r) return []
if (Array.isArray(r.receiveAttachmentFiles) && r.receiveAttachmentFiles.length) {
return r.receiveAttachmentFiles as Array<Record<string, unknown>>
}
const urls = String(r.receiveAttachments || '')
if (!urls.trim()) return []
return urls
.split(',')
.map((u, i) => {
const url = u.trim()
if (!url) return null
const name = url.includes('/') ? url.split('/').pop() || `附件${i + 1}` : url
return { id: `url_${i}`, fileUrl: url, fileName: name }
})
.filter(Boolean) as Array<Record<string, unknown>>
})
function handleReceptionAttachmentPreview(file: Record<string, unknown>) {
const url = attachmentFullUrl(String(file.fileUrl || ''))
if (url) window.open(url, '_blank')
}
function handleReceptionAttachmentDownload(file: Record<string, unknown>) {
downloadAttachmentFile(file, { fullFileUrl: attachmentFullUrl })
}
function normalizeResultParams(items: QcTaskResultItem[]): QcTaskResultItem[] {
return (items || []).map((p) => ({
...p,
paramType: p.paramType || 'text',
paramValue: p.paramValue ?? ''
}))
}
function toResultNumber(v: string | undefined) {
if (v === '' || v === undefined || v === null) return undefined
const n = Number(v)
return Number.isFinite(n) ? n : undefined
}
function setResultNumber(param: QcTaskResultItem, v: number | undefined) {
param.paramValue = v === undefined || v === null ? '' : String(v)
}
function hasResultValue(v: unknown) {
return v !== '' && v !== undefined && v !== null
}
function formatMetric(v: unknown) {
if (v === null || v === undefined || v === '') return '—'
return String(v)
}
function formatCheckResults(items?: Array<{ itemName?: string; checked?: boolean }>) {
if (!items?.length) return '—'
return items.map((x) => `${x.itemName || ''}${x.checked ? '(✓)' : '(×)'}`).join('、')
}
const viewSections = computed<ViewSection[]>(() => {
const d = viewDetail.value
if (!d) return []
const r = d.reception || {}
const transportFields: ViewSection['fields'] = [
{ label: '运输方式', value: transportTypeLabel(String(r.transportType || '')) }
]
if (r.transportType === 'kdys') {
transportFields.push(
{ label: '快递公司', value: r.expressCompanyName || '—' },
{ label: '快递单号', value: r.waybillNo || '—' }
)
} else if (r.transportType === 'ryxd') {
transportFields.push(
{ label: '携带人', value: r.carrierName || '—' },
{ label: '携带人电话', value: r.carrierPhone || '—' }
)
}
if (r.etaTime) {
transportFields.push({ label: '预计到达', value: r.etaTime })
}
const resultSection =
(d as any).results && (d as any).results.length > 0
d.results && d.results.length > 0
? [
{
title: '检测结果',
fields: (d as any).results.map((r: any) => ({
label: r.paramName + (r.paramUnit ? `(${r.paramUnit})` : ''),
value: r.paramValue || '—'
fields: d.results.map((item) => ({
label: item.paramName + (item.paramUnit ? `(${item.paramUnit})` : ''),
value: item.paramValue || '—'
}))
}
]
: []
return [
{
title: '基本信息',
title: '任务信息',
fields: [
{ label: '任务号', value: d.taskNo },
{ label: '业务类型', value: d.qcBizTypeLabel || qcBizTypeLabel(d.qcBizType || ''), tagType: 'success' },
{ label: '工单号', value: d.workOrderNo },
{ label: '类型', value: taskTypeLabel(d.taskType) },
{
label: '工单状态',
value: d.workOrderStatus ? workOrderStatusLabel(d.workOrderStatus) : '—',
tagType: d.workOrderStatus === 'ywc' ? 'success' : d.workOrderStatus === 'ypz' ? 'warning' : 'info'
},
{ label: '检测类型', value: taskTypeLabel(d.taskType), tagType: d.taskType === 'sysz' ? 'success' : 'info' },
{ label: '检测项目', value: d.itemName },
{ label: '项目编码', value: d.itemCode || '—' },
{ label: '第三方公司', value: d.companyName || '—' },
{ label: '状态', value: taskStatusLabel(d.taskStatus) }
{ label: '检测费用', value: d.feeAmount != null ? `¥${d.feeAmount}` : '—' },
{ label: '任务状态', value: taskStatusLabel(d.taskStatus), tagType: d.taskStatus === 'ywc' ? 'success' : d.taskStatus === 'jxz' ? 'warning' : 'info' },
{
label: '检测结论',
value: d.conclusionLabel || qcTaskConclusionLabel(d.conclusion || ''),
tagType: d.conclusion === 'tg' ? 'success' : d.conclusion === 'btg' ? 'danger' : 'info'
},
{ label: '完成时间', value: d.completedTime || '—' },
{ label: '创建时间', value: d.createTime || '—' },
{ label: '备注', value: d.remark || '—', span: true }
]
},
{
title: '样本信息',
fields: [
{ label: '协议号', value: r.protocolNo || d.protocolNo || '—' },
{ label: '样本编码', value: r.sampleCode || d.sampleCode || '—' },
{
label: '样本来源',
value: r.sourceTypeLabel || d.receptionSourceLabel || receptionSourceLabel(d.receptionSource || ''),
tagType: 'primary'
},
{ label: '样本类型', value: r.sampleTypeName || d.sampleTypeName || '—' }
]
},
...(transportFields.length > 1 || r.transportType
? [{ title: '运输信息', fields: transportFields }]
: []),
{
title: '样本接收',
slot: 'reception-extra',
fields: [
{ label: '接收时间', value: r.receptionTime || d.receptionTime || '—' },
{ label: '接收经手人', value: r.handlerName || d.handlerName || '—' },
{
label: '接收温度(℃)',
value: r.receiveTemperature ? `${r.receiveTemperature}℃` : '—'
},
{ label: '体积(ml)', value: formatMetric(r.volumeMl) },
{ label: '净重(g)', value: formatMetric(r.netWeightG) },
{
label: '结论',
value:
r.acceptConclusionLabel ||
acceptConclusionLabel(String(r.acceptConclusion || ''))
},
{ label: '检查项', value: formatCheckResults(r.checkResults), span: true },
{ label: '备注', value: r.remark || '—', span: true }
]
},
...resultSection
@@ -283,6 +523,7 @@
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined,
qcBizType: searchForm.qcBizType || undefined,
taskType: searchForm.taskType || undefined,
taskStatus: searchForm.taskStatus || undefined
})
@@ -299,6 +540,7 @@
}
function handleReset() {
searchForm.keyword = ''
searchForm.qcBizType = ''
searchForm.taskType = ''
searchForm.taskStatus = ''
pagination.page = 1
@@ -311,46 +553,6 @@
loadData()
}
async function handleComplete(row: QcTask) {
await fetchCompleteQcTask(row.id)
ElMessage.success('已完成')
loadData()
}
async function openAttach(row: QcTask) {
attachTaskId.value = row.id
attachRemark.value = row.remark || ''
attachments.value = apiFilesToFinanceItems(row.attachmentFiles)
attachVisible.value = true
if (attachments.value.length) return
try {
const detail = await fetchQcTaskDetail(row.id)
attachRemark.value = detail.remark || ''
attachments.value = apiFilesToFinanceItems(detail.attachmentFiles)
} catch {
/* 列表未带附件时拉详情 */
}
}
async function saveAttachments() {
if (attachments.value.some((a) => a._uploading)) {
ElMessage.warning('附件正在上传,请稍候')
return
}
attachLoading.value = true
try {
await fetchUpdateQcTaskAttachments(
attachTaskId.value,
financeAttachmentsToUrlString(attachments.value)
)
ElMessage.success('已保存')
attachVisible.value = false
loadData()
} finally {
attachLoading.value = false
}
}
async function handleView(row: QcTask) {
const detail = await fetchQcTaskDetail(row.id)
try {
@@ -364,23 +566,29 @@
}
async function openResult(row: QcTask) {
if (!canFillResult(row)) {
if (row.taskType === 'sysz') {
ElMessage.warning('请先开始任务后再填写结果')
} else {
ElMessage.warning('当前状态不可填写结果')
}
return
}
resultTaskStatus.value = row.taskStatus
resultTaskId.value = row.id
resultTaskType.value = row.taskType
resultRemark.value = row.remark || ''
resultConclusion.value = ''
resultAttachments.value = apiFilesToFinanceItems(row.attachmentFiles)
resultLoading.value = true
try {
if (row.taskType === 'dsfjc' && !resultAttachments.value.length) {
const detail = await fetchQcTaskDetail(row.id)
resultRemark.value = detail.remark || ''
resultAttachments.value = apiFilesToFinanceItems(detail.attachmentFiles)
}
const detail = await fetchQcTaskDetail(row.id)
resultTaskStatus.value = detail.taskStatus || row.taskStatus
resultRemark.value = detail.remark || row.remark || ''
resultConclusion.value = detail.conclusion || ''
resultAttachments.value = apiFilesToFinanceItems(detail.attachmentFiles)
const results = await fetchQcTaskResults(row.id)
if (results && results.length > 0) {
resultParams.value = results
} else {
resultParams.value = []
}
resultParams.value = normalizeResultParams(results || [])
} catch {
resultParams.value = []
} finally {
@@ -394,16 +602,34 @@
ElMessage.warning('附件正在上传,请稍候')
return
}
if (!resultConclusion.value) {
ElMessage.warning('请选择检测结论')
return
}
if (resultTaskType.value === 'dsfjc' && !financeAttachmentsToUrlString(resultAttachments.value)) {
ElMessage.warning('请上传第三方检测材料')
return
}
resultLoading.value = true
try {
const data: { results: QcTaskResultItem[]; thirdPartyAttachments?: string } = {
results: resultParams.value.filter((p) => p.paramValue !== '' && p.paramValue !== undefined)
}
if (resultTaskType.value === 'dsfjc') {
data.thirdPartyAttachments = financeAttachmentsToUrlString(resultAttachments.value)
const data: {
conclusion: string
results: QcTaskResultItem[]
remark?: string
thirdPartyAttachments?: string
} = {
conclusion: resultConclusion.value,
remark: resultRemark.value,
results: resultParams.value
.filter((p) => hasResultValue(p.paramValue))
.map((p) => ({
...p,
paramValue: p.paramValue === undefined || p.paramValue === null ? '' : String(p.paramValue)
}))
}
data.thirdPartyAttachments = financeAttachmentsToUrlString(resultAttachments.value)
await fetchCompleteTaskWithResult(resultTaskId.value, data)
ElMessage.success('已完成')
ElMessage.success(resultTaskStatus.value === 'ywc' ? '已保存' : '已完成')
resultVisible.value = false
loadData()
} finally {
@@ -432,6 +658,21 @@
border-left: 3px solid #10b981;
}
.result-conclusion-section {
margin-top: 12px;
}
.result-remark-section {
margin-top: 12px;
}
.result-attachment-section {
margin-top: 12px;
background: #fafafa;
border-radius: 8px;
padding: 20px;
}
.biz-dialog-form {
:deep(.el-form-item) {
margin-bottom: 0;
@@ -452,4 +693,27 @@
line-height: 1;
}
}
.view-reception-attachments {
margin-top: 4px;
.view-kv {
display: grid;
grid-template-columns: 96px 1fr;
gap: 8px 12px;
font-size: 13px;
align-items: start;
dt {
margin: 0;
color: #64748b;
font-weight: 500;
}
dd {
margin: 0;
color: #1e293b;
}
}
}
</style>
@@ -1,10 +1,10 @@
<!-- 质量检测 — 质检工单 -->
<!-- 质量检测 — 入库质检工单 -->
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="page-container">
<header class="page-head">
<h1>质检工单</h1>
<p class="page-desc">样本接收(结论为接收)后自动生成工单;在此配置检测方式与具体项目。</p>
<h1>入库质检工单</h1>
<p class="page-desc">样本接收(结论为接收)后自动生成工单;在此配置或调整检测方式与具体项目。</p>
</header>
<section class="panel">
@@ -41,25 +41,45 @@
<el-table-column prop="workOrderNo" label="工单号" min-width="150" align="center" />
<el-table-column prop="protocolNo" label="协议号" min-width="140" align="center" />
<el-table-column prop="sampleCode" label="样本编码" min-width="120" align="center" />
<el-table-column prop="receptionSourceLabel" label="来源类型" width="100" align="center">
<template #default="{ row }">
<el-tag :type="row.receptionSource === 'research_donation' ? 'warning' : 'success'" size="small">
{{ row.receptionSourceLabel || receptionSourceLabel(row.receptionSource || '') }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="sampleTypeName" label="样本类型" min-width="110" align="center">
<template #default="{ row }">{{ row.sampleTypeName || '—' }}</template>
</el-table-column>
<el-table-column prop="receptionTime" label="接收时间" min-width="170" align="center">
<template #default="{ row }">{{ row.receptionTime || '—' }}</template>
</el-table-column>
<el-table-column prop="handlerName" label="接收经手人" min-width="110" align="center">
<template #default="{ row }">{{ row.handlerName || '—' }}</template>
</el-table-column>
<el-table-column prop="workOrderStatus" label="状态" width="100" align="center">
<template #default="{ row }">
<span :class="['tag', row.workOrderStatus === 'ywc' ? 'success' : row.workOrderStatus === 'ypz' ? 'warning' : 'muted']">
<el-tag :type="row.workOrderStatus === 'ywc' ? 'success' : row.workOrderStatus === 'ypz' ? 'warning' : 'info'" size="small">
{{ workOrderStatusLabel(row.workOrderStatus) }}
</span>
</el-tag>
</template>
</el-table-column>
<el-table-column label="检测方式" min-width="160" align="center">
<template #default="{ row }">
<span v-if="row.hasLab" class="tag success">实验室</span>
<span v-if="row.hasThirdParty" class="tag muted" style="margin-left: 4px">第三方</span>
<span v-if="!row.hasLab && !row.hasThirdParty">—</span>
<span>{{ formatDetectMethods(row) }}</span>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center" />
<el-table-column label="操作" width="280" fixed="right" 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="row.workOrderStatus === 'dpz'" class="btn-op-item primary" @click="handleConfigure(row)"><el-icon><Setting /></el-icon>配置检测</el-button>
<el-button
v-if="row.workOrderStatus === 'dpz' || row.workOrderStatus === 'ypz'"
class="btn-op-item primary"
@click="handleConfigure(row)"
>
<el-icon><Setting /></el-icon>{{ row.workOrderStatus === 'ypz' ? '调整检测' : '配置检测' }}
</el-button>
</template>
</el-table-column>
</el-table>
@@ -75,7 +95,15 @@
</div>
</div>
<el-dialog v-model="configureVisible" title="配置检测" width="800px" class="dialog-form-layout" align-center destroy-on-close :close-on-click-modal="false">
<el-dialog
v-model="configureVisible"
:title="configureIsEdit ? '调整检测' : '配置检测'"
width="800px"
class="dialog-form-layout"
align-center
destroy-on-close
:close-on-click-modal="false"
>
<el-form label-position="top" class="biz-dialog-form">
<el-form-item label="检测方式">
<el-checkbox v-model="configureForm.hasLab">实验室自检</el-checkbox>
@@ -113,7 +141,22 @@
:icon="Document"
:meta="detail?.workOrderNo || ''"
:sections="viewSections"
/>
>
<template #reception-extra>
<div class="view-reception-attachments">
<div class="view-kv view-kv-span-2">
<dt>接收附件</dt>
<dd>
<ProtocolAttachmentReadonly
:files="viewReceptionAttachmentFiles"
@preview="handleReceptionAttachmentPreview"
@download="handleReceptionAttachmentDownload"
/>
</dd>
</div>
</div>
</template>
</SystemViewDialog>
</section>
</div>
</template>
@@ -131,9 +174,16 @@
type QcWorkOrder,
type QcWorkOrderDetail
} from '@/api/qc-work-order'
import { workOrderStatusLabel } from '@/utils/qc-labels'
import {
workOrderStatusLabel,
receptionSourceLabel,
acceptConclusionLabel,
transportTypeLabel
} from '@/utils/qc-labels'
import ProtocolAttachmentReadonly from '@/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue'
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
import type { ViewSection } from '@/components/business/system-view-dialog/index.vue'
import { downloadAttachmentFile } from '@/utils/download-attachment'
defineOptions({ name: 'QualityInspectionQcWorkOrder' })
@@ -144,6 +194,7 @@
const configureVisible = ref(false)
const configureLoading = ref(false)
const configureIsEdit = ref(false)
const configuringId = ref('')
const labOptions = ref<QcLabTestItem[]>([])
const thirdOptions = ref<QcThirdPartyItem[]>([])
@@ -167,10 +218,91 @@
const viewVisible = ref(false)
const detail = ref<QcWorkOrderDetail | null>(null)
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
const viewReceptionAttachmentFiles = computed(() => {
const r = detail.value?.reception
if (!r) return []
if (Array.isArray(r.receiveAttachmentFiles) && r.receiveAttachmentFiles.length) {
return r.receiveAttachmentFiles as Array<Record<string, unknown>>
}
const urls = String(r.receiveAttachments || '')
if (!urls.trim()) return []
return urls
.split(',')
.map((u, i) => {
const url = u.trim()
if (!url) return null
const name = url.includes('/') ? url.split('/').pop() || `附件${i + 1}` : url
return { id: `url_${i}`, fileUrl: url, fileName: name }
})
.filter(Boolean) as Array<Record<string, unknown>>
})
function receptionAttachmentFullUrl(url: string) {
const u = String(url || '').trim()
if (!u) return ''
if (/^https?:\/\//i.test(u)) return u
return minioBaseUrl ? `${minioBaseUrl}/${u.replace(/^\//, '')}` : u
}
function handleReceptionAttachmentPreview(file: Record<string, unknown>) {
const url = receptionAttachmentFullUrl(String(file.fileUrl || ''))
if (url) window.open(url, '_blank')
}
function handleReceptionAttachmentDownload(file: Record<string, unknown>) {
downloadAttachmentFile(file, { fullFileUrl: receptionAttachmentFullUrl })
}
function formatDetectMethods(row: QcWorkOrder) {
const parts: string[] = []
if (row.hasLab) parts.push('实验室')
if (row.hasThirdParty) parts.push('第三方')
return parts.length ? parts.join(' \\ ') : '—'
}
function formatMetric(v: unknown) {
if (v === null || v === undefined || v === '') return '—'
return String(v)
}
function formatCheckResults(
items?: Array<{ itemName?: string; checked?: boolean }>
) {
if (!items?.length) return '—'
return items.map((x) => `${x.itemName || ''}${x.checked ? '(✓)' : '(×)'}`).join('、')
}
const viewSections = computed<ViewSection[]>(() => {
if (!detail.value) return []
const d = detail.value
const r = d.reception || {}
const transportFields: ViewSection['fields'] = [
{
label: '运输方式',
value: transportTypeLabel(String(r.transportType || ''))
}
]
if (r.transportType === 'kdys') {
transportFields.push(
{ label: '快递公司', value: r.expressCompanyName || '—' },
{ label: '快递单号', value: r.waybillNo || '—' }
)
} else if (r.transportType === 'ryxd') {
transportFields.push(
{ label: '携带人', value: r.carrierName || '—' },
{ label: '携带人电话', value: r.carrierPhone || '—' }
)
}
if (r.etaTime) {
transportFields.push({ label: '预计到达', value: r.etaTime })
}
const transportSection =
transportFields.length > 1 || r.transportType
? [{ title: '运输信息', fields: transportFields }]
: []
return [
{
title: '基本信息',
@@ -178,7 +310,36 @@
{ label: '工单号', value: d.workOrderNo },
{ label: '协议号', value: d.protocolNo },
{ label: '样本编码', value: d.sampleCode },
{ label: '状态', value: workOrderStatusLabel(d.workOrderStatus) }
{
label: '来源类型',
value: r.sourceTypeLabel || d.receptionSourceLabel || receptionSourceLabel(d.receptionSource || ''),
tagType: 'primary'
},
{ label: '样本类型', value: r.sampleTypeName || d.sampleTypeName || '—' },
{ label: '状态', value: workOrderStatusLabel(d.workOrderStatus), tagType: d.workOrderStatus === 'ywc' ? 'success' : d.workOrderStatus === 'ypz' ? 'warning' : 'info' },
{ label: '创建时间', value: d.createTime || '—' }
]
},
...transportSection,
{
title: '样本接收',
slot: 'reception-extra',
fields: [
{ label: '接收时间', value: r.receptionTime || d.receptionTime || '—' },
{ label: '接收经手人', value: r.handlerName || d.handlerName || '—' },
{
label: '接收温度(℃)',
value: r.receiveTemperature ? `${r.receiveTemperature}℃` : '—'
},
{ label: '体积(ml)', value: formatMetric(r.volumeMl) },
{ label: '净重(g)', value: formatMetric(r.netWeightG) },
{
label: '结论',
value: r.acceptConclusionLabel || acceptConclusionLabel(String(r.acceptConclusion || '')),
tagType: r.acceptConclusion === 'js' ? 'success' : r.acceptConclusion === 'jj' ? 'danger' : 'info'
},
{ label: '检查项', value: formatCheckResults(r.checkResults), span: true },
{ label: '备注', value: r.remark || '—', span: true }
]
},
{
@@ -235,12 +396,23 @@
async function handleConfigure(row: QcWorkOrder) {
configuringId.value = row.id
configureForm.hasLab = false
configureForm.hasThirdParty = false
configureForm.labItemIds = []
configureForm.thirdPartyItemIds = []
configureIsEdit.value = row.workOrderStatus === 'ypz'
labOptions.value = (await fetchQcLabTestItemsActive()) || []
thirdOptions.value = (await fetchQcThirdPartyItemsActive()) || []
if (configureIsEdit.value) {
const d = await fetchQcWorkOrderDetail(row.id)
configureForm.hasLab = !!d.hasLab
configureForm.hasThirdParty = !!d.hasThirdParty
configureForm.labItemIds = (d.labItems || []).map((li) => li.labTestItemId).filter(Boolean)
configureForm.thirdPartyItemIds = (d.thirdPartyItems || [])
.map((li) => li.thirdPartyItemId)
.filter(Boolean)
} else {
configureForm.hasLab = false
configureForm.hasThirdParty = false
configureForm.labItemIds = []
configureForm.thirdPartyItemIds = []
}
configureVisible.value = true
}
@@ -252,7 +424,7 @@
configureLoading.value = true
try {
await fetchConfigureQcWorkOrder(configuringId.value, { ...configureForm })
ElMessage.success('配置成功,已生成质检任务')
ElMessage.success(configureIsEdit.value ? '检测项目已更新' : '配置成功,已生成质检任务')
configureVisible.value = false
loadData()
} finally {
@@ -302,4 +474,27 @@
font-size: 13px;
color: var(--mint-text-muted, #64748b);
}
.view-reception-attachments {
margin-top: 4px;
.view-kv {
display: grid;
grid-template-columns: 96px 1fr;
gap: 8px 12px;
font-size: 13px;
align-items: start;
dt {
margin: 0;
color: #64748b;
font-weight: 500;
}
dd {
margin: 0;
color: #1e293b;
}
}
}
</style>
@@ -81,9 +81,7 @@
<el-table-column prop="orderNum" label="排序" width="80" align="center" header-align="center" />
<el-table-column prop="status" label="状态" width="90" align="center" header-align="center">
<template #default="{ row }">
<span :class="['tag', row.status === '1' ? 'success' : 'muted']">
{{ row.status === '1' ? '启用' : '停用' }}
</span>
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">{{ row.status === '1' ? '启用' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center" header-align="center" />
@@ -40,6 +40,12 @@
clearable
/>
</el-form-item>
<el-form-item label="来源类型">
<el-select v-model="searchForm.sourceType" placeholder="全部" clearable>
<el-option label="细胞存储" value="cell_storage" />
<el-option label="科研捐赠" value="research_donation" />
</el-select>
</el-form-item>
</div>
<div class="filter-actions-row">
<span class="filter-hint">
@@ -99,6 +105,13 @@
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column prop="protocolNo" label="协议号" min-width="130" align="center" header-align="center" />
<el-table-column prop="sourceTypeLabel" label="来源类型" width="100" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="row.sourceType === 'research_donation' ? 'warning' : 'success'" size="small">
{{ row.sourceTypeLabel || '细胞存储' }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="sampleCode" label="样本编码" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{ row.sampleCode || '-' }}</template>
</el-table-column>
@@ -114,9 +127,21 @@
<el-table-column prop="etaTime" label="预计到达时间" min-width="170" align="center" header-align="center">
<template #default="{ row }">{{ row.etaTime || '-' }}</template>
</el-table-column>
<el-table-column prop="transportType" label="运输方式" width="100" align="center" header-align="center">
<template #default="{ row }">{{ transportTypeLabel(String(row.transportType || '')) }}</template>
</el-table-column>
<el-table-column prop="waybillNo" label="快递单号" min-width="140" align="center" header-align="center">
<template #default="{ row }">{{ row.waybillNo || '-' }}</template>
</el-table-column>
<el-table-column prop="expressCompanyName" label="快递公司" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{ row.expressCompanyName || '-' }}</template>
</el-table-column>
<el-table-column prop="carrierName" label="携带人" min-width="100" align="center" header-align="center">
<template #default="{ row }">{{ row.carrierName || '-' }}</template>
</el-table-column>
<el-table-column prop="carrierPhone" label="携带人联系电话" min-width="130" align="center" header-align="center">
<template #default="{ row }">{{ row.carrierPhone || '-' }}</template>
</el-table-column>
<el-table-column
v-if="activeTab === 'received'"
prop="receptionTime"
@@ -144,9 +169,9 @@
header-align="center"
>
<template #default="{ row }">
<span :class="['tag', row.acceptConclusion === 'js' ? 'success' : 'danger']">
<el-tag :type="row.acceptConclusion === 'js' ? 'success' : 'danger'" size="small">
{{ acceptConclusionLabel(String(row.acceptConclusion || '')) }}
</span>
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="140" fixed="right" align="center" header-align="center">
@@ -196,6 +221,22 @@
</div>
</div>
</div>
<div v-if="currentRow" class="form-section-divider" />
<h4 class="detail-section-title">运输信息</h4>
<div class="readonly-grid form-grid-2">
<div class="readonly-item">
<span class="label">运输方式</span>{{ transportTypeLabel(String(currentRow?.transportType || '')) }}
</div>
<div class="readonly-item"><span class="label">预计到达</span>{{ currentRow?.etaTime || '-' }}</div>
<template v-if="currentRow?.transportType === 'kdys'">
<div class="readonly-item"><span class="label">快递公司</span>{{ currentRow?.expressCompanyName || '-' }}</div>
<div class="readonly-item"><span class="label">快递单号</span>{{ currentRow?.waybillNo || '-' }}</div>
</template>
<template v-else-if="currentRow?.transportType === 'ryxd'">
<div class="readonly-item"><span class="label">携带人</span>{{ currentRow?.carrierName || '-' }}</div>
<div class="readonly-item"><span class="label">携带人电话</span>{{ currentRow?.carrierPhone || '-' }}</div>
</template>
</div>
<div class="form-section-divider" />
<h4 class="detail-section-title">接收登记</h4>
<el-form
@@ -308,6 +349,22 @@
<div class="readonly-item"><span class="label">预计到达</span>{{ viewRow.etaTime || '-' }}</div>
</div>
<div class="form-section-divider" />
<h4 class="detail-section-title">运输信息</h4>
<div class="readonly-grid form-grid-2">
<div class="readonly-item">
<span class="label">运输方式</span>{{ transportTypeLabel(String(viewRow.transportType || '')) }}
</div>
<div class="readonly-item"><span class="label">预计到达</span>{{ viewRow.etaTime || '-' }}</div>
<template v-if="viewRow.transportType === 'kdys'">
<div class="readonly-item"><span class="label">快递公司</span>{{ viewRow.expressCompanyName || '-' }}</div>
<div class="readonly-item"><span class="label">快递单号</span>{{ viewRow.waybillNo || '-' }}</div>
</template>
<template v-else-if="viewRow.transportType === 'ryxd'">
<div class="readonly-item"><span class="label">携带人</span>{{ viewRow.carrierName || '-' }}</div>
<div class="readonly-item"><span class="label">携带人电话</span>{{ viewRow.carrierPhone || '-' }}</div>
</template>
</div>
<div class="form-section-divider" />
<h4 class="detail-section-title">接收信息</h4>
<div class="readonly-grid form-grid-2">
<div class="readonly-item"><span class="label">接收时间</span>{{ viewRow.receptionTime || '-' }}</div>
@@ -316,7 +373,7 @@
<div class="readonly-item"><span class="label">体积(ml)</span>{{ formatMetric(viewRow.volumeMl) }}</div>
<div class="readonly-item"><span class="label">净重(g)</span>{{ formatMetric(viewRow.netWeightG) }}</div>
<div class="readonly-item">
<span class="label">结论</span>{{ acceptConclusionLabel(String(viewRow.acceptConclusion || '')) }}
<span class="label">结论</span><el-tag :type="viewRow.acceptConclusion === 'js' ? 'success' : 'danger'" size="small">{{ acceptConclusionLabel(String(viewRow.acceptConclusion || '')) }}</el-tag>
</div>
<div class="readonly-item form-col-span-2 check-items-readonly">
<span class="label">检查项</span>
@@ -378,6 +435,13 @@
<div class="readonly-item form-col-span-2">
<span class="label">客户</span>{{ entry.motherName || '—' }} / {{ entry.newbornName || '—' }}
</div>
<div class="readonly-item">
<span class="label">来源</span>
<el-tag :type="entry.sourceType === 'research_donation' ? 'warning' : 'success'" size="small">
{{ entry.sourceType === 'research_donation' ? '科研捐赠' : '细胞存储' }}
</el-tag>
</div>
<div class="readonly-item"><span class="label">运输方式</span>{{ entry.transportType === 'kdys' ? '快递运输' : entry.transportType === 'ryxd' ? '人员携带' : '-' }}</div>
</div>
<el-form label-position="top" class="biz-dialog-form">
<div class="form-grid-2">
@@ -494,6 +558,7 @@
} from '@/components/business/protocol-finance-confirm-fields/finance-attachments'
import { useUserStore } from '@/store/modules/user'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import { transportTypeLabel, acceptConclusionLabel } from '@/utils/status-tag-registry'
defineOptions({ name: 'QualityInspectionSampleReception' })
@@ -504,7 +569,7 @@
]
const activeTab = ref('pending')
const searchForm = reactive({ keyword: '' })
const searchForm = reactive({ keyword: '', sourceType: '' })
const tableData = ref<Record<string, unknown>[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
@@ -530,6 +595,8 @@
waybillNo: string
motherName: string
newbornName: string
sourceType: 'cell_storage' | 'research_donation'
transportType: string
receptionTime: string
handlerUserId: string
handlerName: string
@@ -590,12 +657,6 @@
.filter(Boolean) as Array<Record<string, unknown>>
})
function acceptConclusionLabel(v: string) {
if (v === 'js') return '接收'
if (v === 'bj') return '拒收'
return v || '-'
}
function formatMetric(v: unknown) {
if (v === null || v === undefined || v === '') return '-'
const n = Number(v)
@@ -685,6 +746,8 @@
waybillNo: String(row.waybillNo || ''),
motherName: String(row.motherName || ''),
newbornName: String(row.newbornName || ''),
sourceType: (row.sourceType as 'cell_storage' | 'research_donation') || 'cell_storage',
transportType: String(row.transportType || ''),
receptionTime: formatNowDatetime(),
handlerUserId: userId,
handlerName: label,
@@ -766,7 +829,13 @@
for (const entry of batchEntries.value) {
try {
await fetchSampleReceptionSubmit({
protocolSampleId: entry.protocolSampleId,
sourceType: entry.sourceType,
donationSampleId: entry.sourceType === 'research_donation'
? entry.protocolSampleId
: undefined,
protocolSampleId: entry.sourceType !== 'research_donation'
? entry.protocolSampleId
: undefined,
receptionTime: entry.receptionTime,
handlerUserId: entry.handlerUserId,
handlerName: entry.handlerName,
@@ -819,7 +888,8 @@
const params = {
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined
keyword: searchForm.keyword || undefined,
sourceType: searchForm.sourceType || undefined,
}
const res =
activeTab.value === 'pending'
@@ -847,6 +917,7 @@
function handleReset() {
searchForm.keyword = ''
searchForm.sourceType = ''
pagination.page = 1
loadData()
}
@@ -906,7 +977,13 @@
submitLoading.value = true
try {
await fetchSampleReceptionSubmit({
protocolSampleId: String(currentRow.value.protocolSampleId),
sourceType: (currentRow.value.sourceType as string) || 'cell_storage',
donationSampleId: currentRow.value.sourceType === 'research_donation'
? String(currentRow.value.protocolSampleId)
: undefined,
protocolSampleId: currentRow.value.sourceType !== 'research_donation'
? String(currentRow.value.protocolSampleId)
: undefined,
receptionTime: receiveForm.receptionTime,
handlerUserId: receiveForm.handlerUserId,
handlerName: receiveForm.handlerName,
@@ -73,9 +73,7 @@
<el-table-column prop="contactPhone" label="联系电话" min-width="120" align="center" />
<el-table-column prop="status" label="状态" width="90" align="center">
<template #default="{ row }">
<span :class="['tag', row.status === '1' ? 'success' : 'muted']">
{{ row.status === '1' ? '启用' : '停用' }}
</span>
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">{{ row.status === '1' ? '启用' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="400" fixed="right" align="center">
@@ -208,9 +206,7 @@
</el-table-column>
<el-table-column prop="status" label="状态" width="90" align="center">
<template #default="{ row }">
<span :class="['tag', row.status === '1' ? 'success' : 'muted']">
{{ row.status === '1' ? '启用' : '停用' }}
</span>
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">{{ row.status === '1' ? '启用' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="260" fixed="right" align="center">
@@ -537,7 +533,7 @@
{ label: '联系人', value: row.contactName },
{ label: '联系电话', value: row.contactPhone },
{ label: '地址', value: row.address, span: true },
{ label: '状态', value: row.status === '1' ? '启用' : '停用' },
{ label: '状态', value: row.status === '1' ? '启用' : '停用', tagType: row.status === '1' ? 'success' : 'info' },
{ label: '备注', value: row.remark, span: true }
]
},
@@ -128,9 +128,11 @@
align="center"
header-align="center"
>
<template #default="{ row }">{{
donationStatusLabel(String(row.donationStatus || ''))
}}</template>
<template #default="{ row }">
<el-tag :type="donationStatusTagType(String(row.donationStatus || ''))" size="small">{{
donationStatusLabel(String(row.donationStatus || ''))
}}</el-tag>
</template>
</el-table-column>
<el-table-column
prop="donationDate"
@@ -332,33 +334,15 @@
fetchDeleteResearchDonation,
type ResearchDonationRow
} from '@/api/research-donation'
import {
donationStatusLabel,
donationStatusTagType,
newbornSexLabel,
deliveryModeLabel
} from '@/utils/status-tag-registry'
defineOptions({ name: 'ResearchDonationAudit' })
/* ====== 标签映射 ====== */
function donationStatusLabel(s: string) {
const m: Record<string, string> = {
dsx: '待生效',
sxz: '生效中',
ygq: '已过期',
yzf: '已作废',
zckc: '转细胞存储'
}
return m[s] || s || '-'
}
function newbornSexLabel(s: string) {
if (s === '1') return '男'
if (s === '0') return '女'
return s || '-'
}
function deliveryModeLabel(s: string) {
if (s === 'sc') return '顺产'
if (s === 'pgc') return '剖宫产'
return s || '-'
}
/* ====== 列表 ====== */
const searchForm = reactive<{ keyword: string; donationStatus: string }>({
keyword: '',
@@ -937,6 +937,7 @@
} from '@/api/research-donation'
import { fetchUploadAttachment } from '@/api/business'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import { transportTypeLabel } from '@/utils/status-tag-registry'
import {
fetchCustomerList,
fetchUserList,
@@ -1072,12 +1073,6 @@
(e: 'saved'): void
}>()
function transportTypeLabel(s: string) {
if (s === 'kdys') return '快递运输'
if (s === 'ryxd') return '人员携带'
return s || '-'
}
function siteName(id: string) {
if (!id) return '-'
return siteOptions.value.find((x) => x.id === id)?.siteName || '-'
@@ -34,11 +34,9 @@
<div class="kpi-card">
<div class="kpi-label">状态</div>
<div class="kpi-value">
<span
class="status-dot"
:class="statusDotClass(String(donation?.donationStatus || ''))"
/>
{{ donationStatusLabel(String(donation?.donationStatus || '')) }}
<el-tag :type="donationStatusTagType(String(donation?.donationStatus || ''))" size="small">
{{ donationStatusLabel(String(donation?.donationStatus || '')) }}
</el-tag>
</div>
</div>
<div class="kpi-card">
@@ -62,11 +60,7 @@
<div class="data-item"
><div class="data-label">状态</div
><div class="data-value"
><span
class="badge"
:class="statusBadgeClass(String(donation?.donationStatus || ''))"
>{{ donationStatusLabel(String(donation?.donationStatus || '')) }}</span
></div
><el-tag :type="donationStatusTagType(String(donation?.donationStatus || ''))" size="small">{{ donationStatusLabel(String(donation?.donationStatus || '')) }}</el-tag></div
></div
>
<div class="data-item"
@@ -307,9 +301,9 @@
<span class="sample-card__seq">{{ sIdx + 1 }}</span>
{{ sampleTypeName(row.sampleTypeId) }}
</div>
<span class="badge" :class="sampleStatusBadgeClass(String(row.sampleStatus || ''))">
<el-tag :type="sampleStatusTagType(String(row.sampleStatus || ''))" size="small">
{{ sampleStatusLabel(String(row.sampleStatus || '')) }}
</span>
</el-tag>
</div>
<div class="sample-card__body">
<div class="sample-card__section">
@@ -363,6 +357,7 @@
</div>
</div>
</div>
<SampleQcInfoCards :qc-info="row.qcInfo" :sample-reception="row.sampleReception" />
</div>
</div>
</div>
@@ -433,12 +428,12 @@
header-align="center"
>
<template #default="{ row }">
<span
class="tag"
:class="String(row.auditStatus) === 'shtg' ? 'success' : 'warning'"
<el-tag
:type="String(row.auditStatus) === 'shtg' ? 'success' : 'warning'"
size="small"
>
{{ auditStatusLabel(String(row.auditStatus || '')) }}
</span>
</el-tag>
</template>
</el-table-column>
<el-table-column
@@ -493,6 +488,7 @@
import { computed, nextTick, ref, watch } from 'vue'
import { Close } from '@element-plus/icons-vue'
import ProtocolAttachmentReadonly from '@/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue'
import SampleQcInfoCards from '@/components/business/sample-qc-info-cards/index.vue'
import {
fetchResearchDonationAuditList,
fetchResearchDonationDetail,
@@ -508,6 +504,18 @@
fetchUserList
} from '@/api/admin'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import {
donationStatusLabel,
donationStatusTagType,
sourceTypeLabel,
auditStatusLabel,
auditStatusTagType,
newbornSexLabel,
deliveryModeLabel,
sampleStatusLabel,
sampleStatusTagType,
transportTypeLabel
} from '@/utils/status-tag-registry'
defineOptions({ name: 'DonationViewDialog' })
@@ -666,90 +674,12 @@
return dash(val)
}
function donationStatusLabel(s: string) {
const m: Record<string, string> = {
dsx: '待生效',
sxz: '生效中',
ygq: '已过期',
yzf: '已作废',
zckc: '转细胞存储'
}
return m[s] || s || '—'
}
function statusDotClass(s: string): string {
const m: Record<string, string> = {
dsx: 'pending',
sxz: 'active',
ygq: 'expired',
yzf: 'void',
zckc: 'research'
}
return m[s] || ''
}
function statusBadgeClass(s: string): string {
const m: Record<string, string> = {
dsx: 'badge--amber',
sxz: 'badge--green',
ygq: 'badge--gray',
yzf: 'badge--red',
zckc: 'badge--purple'
}
return m[s] || 'badge--gray'
}
function sourceTypeLabel(s: string) {
if (s === 'direct') return '独立新建'
if (s === 'from_storage') return '从存储转来'
return s || '—'
}
function auditStatusLabel(s: string) {
if (s === 'shtg') return '审核通过'
if (s === 'shth') return '审核退回'
return s || '—'
}
function auditorDisplay(row: Record<string, unknown>) {
const name = String(row.auditorUserName || '').trim()
if (name) return name
return dash(row.auditorUserId)
}
function newbornSexLabel(s: string) {
if (s === '1') return '男'
if (s === '0') return '女'
return s || '—'
}
function deliveryModeLabel(s: string) {
if (s === 'sc') return '顺产'
if (s === 'pgc') return '剖宫产'
return s || '—'
}
function sampleStatusLabel(s: string) {
const m: Record<string, string> = { ycj: '已采集', jcz: '检测中', yrk: '已入库', yzf: '已作废' }
return m[s] || s || '—'
}
function sampleStatusBadgeClass(s: string): string {
const m: Record<string, string> = {
ycj: 'badge--blue',
jcz: 'badge--amber',
yrk: 'badge--green',
yzf: 'badge--red'
}
return m[s] || 'badge--gray'
}
function transportTypeLabel(s: string) {
if (s === 'kdys') return '快递运输'
if (s === 'ryxd') return '人员携带'
return s || '—'
}
function sampleTypeName(id: string) {
return sampleTypeOptions.value.find((x) => x.id === id)?.typeName || dash(id)
}
@@ -1020,35 +950,6 @@
gap: 6px;
}
.status-dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
flex-shrink: 0;
&.pending {
background: #f59e0b;
box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}
&.active {
background: #10b981;
box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}
&.expired {
background: #94a3b8;
box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.2);
}
&.void {
background: #ef4444;
box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}
&.research {
background: #8b5cf6;
box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}
}
/* ---- Section Card ---- */
.section-card {
border-radius: 12px;
@@ -1144,41 +1045,6 @@
}
}
/* ---- Badge ---- */
.badge {
display: inline-block;
padding: 2px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
line-height: 1.6;
&--green {
background: #ecfdf5;
color: #059669;
}
&--amber {
background: #fffbeb;
color: #d97706;
}
&--gray {
background: #f1f5f9;
color: #64748b;
}
&--red {
background: #fef2f2;
color: #dc2626;
}
&--purple {
background: #faf5ff;
color: #7c3aed;
}
&--blue {
background: #eff6ff;
color: #2563eb;
}
}
/* ---- Attachment / Remark Row ---- */
.attachment-row {
margin-top: 12px;
@@ -96,9 +96,11 @@
align="center"
header-align="center"
>
<template #default="{ row }">{{
donationStatusLabel(String(row.donationStatus || ''))
}}</template>
<template #default="{ row }">
<el-tag :type="donationStatusTagType(String(row.donationStatus || ''))" size="small">{{
donationStatusLabel(String(row.donationStatus || ''))
}}</el-tag>
</template>
</el-table-column>
<el-table-column
prop="donationDate"
@@ -269,33 +271,15 @@
fetchDeleteResearchDonation,
type ResearchDonationRow
} from '@/api/research-donation'
import {
donationStatusLabel,
donationStatusTagType,
newbornSexLabel,
deliveryModeLabel
} from '@/utils/status-tag-registry'
defineOptions({ name: 'ResearchDonationList' })
/* ====== 标签映射 ====== */
function donationStatusLabel(s: string) {
const m: Record<string, string> = {
dsx: '待生效',
sxz: '生效中',
ygq: '已过期',
yzf: '已作废',
zckc: '转细胞存储'
}
return m[s] || s || '-'
}
function newbornSexLabel(s: string) {
if (s === '1') return '男'
if (s === '0') return '女'
return s || '-'
}
function deliveryModeLabel(s: string) {
if (s === 'sc') return '顺产'
if (s === 'pgc') return '剖宫产'
return s || '-'
}
/* ====== 列表 ====== */
const searchForm = reactive<{ keyword: string; donationStatus: string }>({
keyword: '',
@@ -479,7 +479,7 @@
{ label: '分类名称', value: row.name },
{ label: '上级分类', value: row.parentId ? parentCategoryList.value.find((c: any) => c.id === row.parentId)?.name || row.parentId : '无' },
{ label: '价格系数', value: formatPriceCoefficient(row.priceCoefficient) },
{ label: '状态', value: row.isActive ? '启用' : '禁用' },
{ label: '状态', value: row.isActive ? '启用' : '禁用', tagType: row.isActive ? 'success' : 'info' },
{ label: '图片', value: row.imageUrl || '无' },
{ label: '创建时间', value: row.createAt }
]
+1 -1
View File
@@ -399,7 +399,7 @@
fields: [
{ label: '组织名称', value: viewRow.value?.deptName },
{ label: '组织类别', value: getDeptCategoryLabel(viewRow.value?.deptCategoryCode || '') },
{ label: '状态', value: viewRow.value?.status === '1' ? '正常' : '停用' },
{ label: '状态', value: viewRow.value?.status === '1' ? '正常' : '停用', tagType: viewRow.value?.status === '1' ? 'success' : 'info' },
{ label: '负责人', value: viewRow.value?.leader },
{ label: '联系电话', value: viewRow.value?.leaderPhone },
{ label: '备注', value: viewRow.value?.remark, span: true }
+3 -15
View File
@@ -177,6 +177,7 @@
<script setup lang="ts">
import { Close, Check } from '@element-plus/icons-vue'
import { leaveStatusLabel, leaveStatusTagType } from '@/utils/status-tag-registry'
import {
fetchLeaveList,
fetchCreateLeave,
@@ -208,21 +209,8 @@ const formData = reactive({
remark: ''
})
const statusMap: Record<string, { label: string; type: string }> = {
draft: { label: '草稿', type: 'info' },
pending: { label: '审批中', type: 'warning' },
approved: { label: '已通过', type: 'success' },
rejected: { label: '已驳回', type: 'danger' },
cancelled: { label: '已取消', type: 'info' }
}
function statusLabel(s: string) {
return statusMap[s]?.label || s
}
function statusTagType(s: string) {
return statusMap[s]?.type || 'info'
}
const statusLabel = leaveStatusLabel
const statusTagType = leaveStatusTagType
function resetForm() {
formData.leaveType = 'personal'
+3 -3
View File
@@ -343,13 +343,13 @@
title: '基本信息',
fields: [
{ label: '菜单名称', value: viewRow.value?.menuName },
{ label: '菜单类型', value: menuTypeTagMap[viewRow.value?.menuType || '']?.label || viewRow.value?.menuType },
{ label: '菜单类型', value: menuTypeTagMap[viewRow.value?.menuType || '']?.label || viewRow.value?.menuType, tagType: 'primary' },
{ label: '路由路径', value: viewRow.value?.path },
{ label: '组件路径', value: viewRow.value?.component },
{ label: '权限标识', value: viewRow.value?.perms },
{ label: '是否外链', value: viewRow.value?.isFrame === 1 ? '否' : '是' },
{ label: '显示状态', value: viewRow.value?.visible === '1' ? '显示' : '隐藏' },
{ label: '状态', value: viewRow.value?.status === '1' ? '正常' : '停用' },
{ label: '显示状态', value: viewRow.value?.visible === '1' ? '显示' : '隐藏', tagType: viewRow.value?.visible === '1' ? 'success' : 'info' },
{ label: '状态', value: viewRow.value?.status === '1' ? '正常' : '停用', tagType: viewRow.value?.status === '1' ? 'success' : 'info' },
{ label: '备注', value: viewRow.value?.remark, span: true }
]
}
+2 -2
View File
@@ -72,7 +72,7 @@
<el-table-column prop="postCode" label="职位编码" min-width="120" align="center" header-align="center" />
<el-table-column prop="status" label="状态" min-width="80" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="row.status === '1' ? 'success' : 'danger'" size="small">
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">
{{ row.status === '1' ? '正常' : '停用' }}
</el-tag>
</template>
@@ -330,7 +330,7 @@
fields: [
{ label: '职位名称', value: row.postName },
{ label: '职位编码', value: row.postCode },
{ label: '状态', value: row.status === '1' ? '正常' : '停用' },
{ label: '状态', value: row.status === '1' ? '正常' : '停用', tagType: row.status === '1' ? 'success' : 'info' },
{ label: '创建时间', value: row.createTime },
{ label: '备注', value: row.remark, span: true }
]
+4 -13
View File
@@ -94,7 +94,7 @@
header-align="center"
>
<template #default="{ row }">
<el-tag :type="row.status === '1' ? 'success' : 'danger'" size="small">
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">
{{ row.status === '1' ? '正常' : '停用' }}
</el-tag>
</template>
@@ -373,6 +373,7 @@
import { MAX_ADMIN_LIST_PAGE_SIZE } from '@/utils/fetch-paged-list'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
import { buildPathLabelMapFromTreeRoots } from '@/utils/tree-path'
import { dataScopeLabel as dataScopeLabelFn, dataScopeTagType } from '@/utils/status-tag-registry'
import {
fetchRoleList,
fetchCreateRole,
@@ -389,17 +390,7 @@
defineOptions({ name: 'SystemRole' })
const DATA_SCOPE_MAP: Record<string, string> = {
'1': '全部数据',
'2': '本部门数据',
'3': '本部门及以下',
'4': '仅本人',
'5': '自定义'
}
function dataScopeLabel(val: string) {
return DATA_SCOPE_MAP[val] || '未知'
}
const dataScopeLabel = dataScopeLabelFn
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
const tableData = ref<Api.Role.RoleItem[]>([])
@@ -813,7 +804,7 @@
fields: [
{ label: '角色名称', value: row.roleName },
{ label: '数据权限', value: dataScopeLabel(row.dataScope) },
{ label: '状态', value: row.status === '1' ? '正常' : '停用' },
{ label: '状态', value: row.status === '1' ? '正常' : '停用', tagType: row.status === '1' ? 'success' : 'info' },
{ label: '创建时间', value: row.createTime },
{ label: '备注', value: row.remark, span: true }
]
+3 -3
View File
@@ -77,7 +77,7 @@
</el-table-column>
<el-table-column prop="status" label="状态" min-width="80" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="row.status === '1' ? 'success' : 'danger'" size="small">
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">
{{ row.status === '1' ? '正常' : '停用' }}
</el-tag>
</template>
@@ -255,8 +255,8 @@
fields: [
{ label: '站点名称', value: row.siteName },
{ label: '站点编码', value: row.siteCode },
{ label: '站点类型', value: getSiteTypeLabel(row.siteType) },
{ label: '状态', value: row.status === '1' ? '正常' : '停用' },
{ label: '站点类型', value: getSiteTypeLabel(row.siteType), tagType: 'primary' },
{ label: '状态', value: row.status === '1' ? '正常' : '停用', tagType: row.status === '1' ? 'success' : 'info' },
{ label: '地址', value: row.address, span: true }
]
},
+2 -2
View File
@@ -100,7 +100,7 @@
</el-table-column>
<el-table-column prop="status" label="状态" width="80" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="row.status === '1' ? 'success' : 'danger'" size="small">
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">
{{ row.status === '1' ? '正常' : '停用' }}
</el-tag>
</template>
@@ -450,7 +450,7 @@
label: '性别',
value: ({ '0': '男', '1': '女', '2': '未知' } as Record<string, string>)[row.sex] || '未知'
},
{ label: '状态', value: row.status === '1' ? '正常' : '停用' },
{ label: '状态', value: row.status === '1' ? '正常' : '停用', tagType: row.status === '1' ? 'success' : 'info' },
{ label: '创建时间', value: row.createTime },
{ label: '备注', value: row.remark, span: true }
]