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

+1 -1
View File
@@ -80,7 +80,7 @@
const panelTitleClassList = panelTitleIconByText.map(([, cls]) => cls)
const panelTitleBarClass = 'title-bar-heading'
const panelTitleBarTextRules: RegExp[] = [
/(数据概览|快捷菜单|分类列表|单位列表|商品列表|参数列表|用户列表|租户列表|区域列表|区域与询报价概览|报价管理|订单列表|最新订单|待结算订单|结算单记录|配送任务列表|预警列表|订单设置|客服设置|请求列表|近30日趋势|今日各区域|组织|组织管理|角色列表|菜单列表|字典类型|字典数据|站点列表|职位列表|快递公司列表|流程配置|流程列表|待办列表|已办列表|申请列表|客户列表|细胞样本类型列表|采集地区列表|采集协议号列表|样本编码列表|医院列表|协议单列表|审核记录列表|缴费确认列表|退费确认列表|分期预警列表|请假列表|洁净室列表|库位树|预约列表|缴费信息列表|样本接收列表|接收检查项列表|公司列表|项目列表|工单列表|任务列表|类型列表|规格列表|价格列表|体系列表|渠道列表|机构列表|耗材列表|试剂列表|SOP列表|工艺列表|耗材包列表)/
/(数据概览|快捷菜单|分类列表|单位列表|商品列表|参数列表|用户列表|租户列表|区域列表|区域与询报价概览|报价管理|订单列表|最新订单|待结算订单|结算单记录|配送任务列表|预警列表|订单设置|客服设置|请求列表|近30日趋势|今日各区域|组织|组织管理|角色列表|菜单列表|字典类型|字典数据|站点列表|职位列表|快递公司列表|流程配置|流程列表|待办列表|已办列表|申请列表|客户列表|细胞样本类型列表|采集地区列表|采集协议号列表|样本编码列表|医院列表|协议单列表|审核记录列表|缴费确认列表|退费确认列表|分期预警列表|请假列表|洁净室列表|库位树|预约列表|缴费信息列表|样本接收列表|接收检查项列表|公司列表|项目列表|工单列表|任务列表|类型列表|规格列表|价格列表|体系列表|渠道列表|机构列表|耗材列表|试剂列表|SOP列表|工艺列表|路线列表|耗材包列表)/
]
const refreshPanelTitleIcons = () => {
+78
View File
@@ -225,3 +225,81 @@ export function fetchDeleteProcess(id: string) {
export function fetchProcessDetail(id: string) {
return request.get<any>({ url: `/web/admin/processes/${id}` })
}
// ---------------------------------------------------------------------------
// 工艺路线管理
// ---------------------------------------------------------------------------
export function fetchProcessRouteList(params?: {
page?: number
pageSize?: number
routeName?: string
routeCode?: string
productTypeId?: string
}) {
return request.get<{
list: any[]
total: number
page: number
pageSize: number
totalPages: number
}>({ url: '/web/admin/process-routes', params })
}
export function fetchProcessRouteDetail(id: string) {
return request.get<any>({ url: `/web/admin/process-routes/${id}` })
}
export function fetchCreateProcessRoute(data: Record<string, any>) {
return request.post({ url: '/web/admin/process-routes', params: data })
}
export function fetchUpdateProcessRoute(id: string, data: Record<string, any>) {
return request.put({ url: `/web/admin/process-routes/${id}`, params: data })
}
export function fetchSetCurrentProcessRoute(routeId: string) {
return request.put({ url: '/web/admin/process-routes/set-current', params: { routeId } })
}
export function fetchDeleteProcessRoute(id: string) {
return request.del({ url: `/web/admin/process-routes/${id}` })
}
// 步骤操作
export function fetchAddRouteStep(data: { routeId: string; processId: string; stepOrder?: number }) {
return request.post({ url: '/web/admin/process-routes/step/add', params: data })
}
export function fetchCopyRouteStep(data: { stepId: string }) {
return request.post({ url: '/web/admin/process-routes/step/copy', params: data })
}
export function fetchUpdateRouteStep(data: Record<string, any>) {
return request.put({ url: '/web/admin/process-routes/step/update', params: data })
}
export function fetchReorderRouteSteps(data: { routeId: string; stepIds: string[] }) {
return request.put({ url: '/web/admin/process-routes/step/reorder', params: data })
}
export function fetchDeleteRouteStep(stepId: string) {
return request.del({ url: `/web/admin/process-routes/step/${stepId}` })
}
// 步骤子表
export function fetchUpdateStepReagents(data: { stepId: string; items: any[] }) {
return request.put({ url: '/web/admin/process-routes/step/reagent/update', params: data })
}
export function fetchUpdateStepConsumables(data: { stepId: string; items: any[] }) {
return request.put({ url: '/web/admin/process-routes/step/consumable/update', params: data })
}
export function fetchUpdateStepOutputs(data: { stepId: string; items: any[] }) {
return request.put({ url: '/web/admin/process-routes/step/output/update', params: data })
}
export function fetchUpdateStepDataCollections(data: { stepId: string; items: any[] }) {
return request.put({ url: '/web/admin/process-routes/step/data-collection/update', params: data })
}
+6 -1
View File
@@ -17,7 +17,12 @@ export function fetchQcTaskResults(taskId: string) {
export function fetchCompleteTaskWithResult(
taskId: string,
data: { results: QcTaskResultItem[]; thirdPartyAttachments?: string }
data: {
conclusion: string
results: QcTaskResultItem[]
remark?: string
thirdPartyAttachments?: string
}
) {
return request.post({
url: `/web/admin/qc-tasks/${taskId}/complete-with-result`,
+44 -2
View File
@@ -8,6 +8,36 @@ type PageList<T> = {
totalPages: number
}
export type QcTaskReceptionDetail = {
protocolNo?: string
sampleCode?: string
sampleTypeName?: string
sourceType?: string
sourceTypeLabel?: string
receptionTime?: string
handlerName?: string
receiveTemperature?: string
volumeMl?: number
netWeightG?: number
acceptConclusion?: string
acceptConclusionLabel?: string
remark?: string
transportType?: string
expressCompanyName?: string
waybillNo?: string
carrierName?: string
carrierPhone?: string
etaTime?: string
checkResults?: Array<{ itemName?: string; checked?: boolean }>
receiveAttachments?: string
receiveAttachmentFiles?: Array<{
id?: string
fileUrl?: string
fileName?: string
fileType?: string
}>
}
export type QcTask = {
id: string
workOrderId: string
@@ -20,6 +50,18 @@ export type QcTask = {
companyName?: string
feeAmount?: number
taskStatus: string
conclusion?: string
conclusionLabel?: string
qcBizType?: string
qcBizTypeLabel?: string
receptionSource?: string
receptionSourceLabel?: string
protocolNo?: string
sampleCode?: string
sampleTypeName?: string
receptionTime?: string
handlerName?: string
workOrderStatus?: string
thirdPartyAttachments?: string
attachmentFiles?: Array<{ id?: string; fileUrl: string; fileName?: string; fileType?: string }>
completedTime?: string
@@ -30,8 +72,7 @@ export type QcTask = {
}
export type QcTaskDetail = QcTask & {
protocolNo?: string
sampleCode?: string
reception?: QcTaskReceptionDetail
attachmentFiles?: Array<{ id?: string; fileUrl: string; fileName?: string }>
results?: Array<{
paramName: string
@@ -48,6 +89,7 @@ export function fetchQcTaskList(params?: {
taskType?: string
taskStatus?: string
workOrderId?: string
qcBizType?: string
}) {
return request.get<PageList<QcTask>>({
url: '/web/admin/qc-tasks',
+45 -5
View File
@@ -8,6 +8,45 @@ type PageList<T> = {
totalPages: number
}
export type SampleReceptionCheckResult = {
itemCode: string
itemName: string
checked: boolean
checkItemId?: string
}
export type QcWorkOrderReceptionDetail = {
protocolNo?: string
sampleCode?: string
sampleTypeName?: string
sourceType?: string
sourceTypeLabel?: string
receptionTime?: string
handlerName?: string
receiveTemperature?: string
volumeMl?: number
netWeightG?: number
acceptConclusion?: string
acceptConclusionLabel?: string
remark?: string
etaTime?: string
transportType?: string
expressCompanyName?: string
waybillNo?: string
carrierName?: string
carrierPhone?: string
checkResults?: SampleReceptionCheckResult[]
receiveAttachments?: string
receiveAttachmentFiles?: Array<{
id?: string
fileUrl?: string
fileName?: string
fileType?: string
fileSize?: number
fileSizeDisplay?: string
}>
}
export type QcWorkOrder = {
id: string
workOrderNo: string
@@ -16,6 +55,11 @@ export type QcWorkOrder = {
collectionProtocolId: string
protocolNo: string
sampleCode: string
receptionSource?: string
receptionSourceLabel?: string
sampleTypeName?: string
receptionTime?: string
handlerName?: string
workOrderStatus: string
hasLab: boolean
hasThirdParty: boolean
@@ -28,11 +72,7 @@ export type QcWorkOrder = {
}
export type QcWorkOrderDetail = QcWorkOrder & {
reception?: {
receptionTime?: string
handlerName?: string
acceptConclusion?: string
}
reception?: QcWorkOrderReceptionDetail
labItems?: Array<{ id: string; labTestItemId: string; itemCode: string; itemName: string }>
thirdPartyItems?: Array<{
id: string
+5 -1
View File
@@ -12,6 +12,7 @@ export function fetchSampleReceptionPendingList(params?: {
page?: number
pageSize?: number
keyword?: string
sourceType?: string
}) {
return request.get<PageList<Record<string, unknown>>>({
url: '/web/admin/sample-receptions/pending',
@@ -23,6 +24,7 @@ export function fetchSampleReceptionReceivedList(params?: {
page?: number
pageSize?: number
keyword?: string
sourceType?: string
}) {
return request.get<PageList<Record<string, unknown>>>({
url: '/web/admin/sample-receptions/received',
@@ -46,7 +48,9 @@ export type SampleReceptionCheckResult = {
}
export function fetchSampleReceptionSubmit(data: {
protocolSampleId: string
protocolSampleId?: string
sourceType?: 'cell_storage' | 'research_donation'
donationSampleId?: string
receptionTime: string
handlerUserId?: string
handlerName?: string
@@ -1,7 +1,7 @@
<!-- 财务确认弹窗:附件上传 + 财务备注(对齐采集协议单附件 UI) -->
<template>
<div class="protocol-finance-confirm-fields">
<el-form-item :label="remarkLabel" class="form-col-span-2">
<el-form-item v-if="showRemark" :label="remarkLabel" class="form-col-span-2">
<el-input
:model-value="financeRemark"
type="textarea"
@@ -97,11 +97,13 @@
uploadFolder?: string
remarkLabel?: string
attachmentLabel?: string
showRemark?: boolean
}>(),
{
uploadFolder: 'protocol-finance-confirm',
remarkLabel: '财务备注',
attachmentLabel: '财务确认附件'
attachmentLabel: '财务确认附件',
showRemark: true
}
)
@@ -0,0 +1,303 @@
<!-- 质检任务 — 只读查看(参数、结论、附件) -->
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<SystemViewDialog
v-model:visible="innerVisible"
title="质检任务详情"
width="960px"
:grid-columns="3"
:icon="Tickets"
:meta="viewDetail?.taskNo || ''"
:sections="viewSections"
append-to-body
compact
modal-class="qc-task-view-dialog-mask"
>
<template #reception-extra>
<div class="view-reception-attachments">
<div class="view-kv view-kv-span-2">
<dt>接收附件</dt>
<dd>
<ProtocolAttachmentReadonly
:files="viewReceptionAttachmentFiles"
@preview="handleAttachmentPreview"
@download="handleAttachmentDownload"
/>
</dd>
</div>
</div>
</template>
<template #append>
<div
v-if="viewDetail?.attachmentFiles?.length"
class="view-section qc-task-view-attachments"
>
<h3>{{ viewDetail?.taskType === 'dsfjc' ? '检测材料' : '检测附件' }}</h3>
<ProtocolAttachmentReadonly
:files="viewDetail.attachmentFiles"
@preview="handleAttachmentPreview"
@download="handleAttachmentDownload"
/>
</div>
</template>
</SystemViewDialog>
</template>
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import { Tickets } from '@element-plus/icons-vue'
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 { fetchQcTaskDetail, type QcTaskDetail } from '@/api/qc-task'
import { fetchQcTaskResults } from '@/api/qc-task-result'
import {
taskTypeLabel,
taskStatusLabel,
qcBizTypeLabel,
receptionSourceLabel,
acceptConclusionLabel,
transportTypeLabel,
workOrderStatusLabel,
qcTaskConclusionLabel
} from '@/utils/qc-labels'
import { downloadAttachmentFile } from '@/utils/download-attachment'
const props = defineProps<{
visible: boolean
taskId?: string
}>()
const emit = defineEmits<{
(e: 'update:visible', val: boolean): void
}>()
const innerVisible = computed({
get: () => props.visible,
set: (val) => emit('update:visible', val)
})
const loading = ref(false)
const viewDetail = ref<QcTaskDetail | null>(null)
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
watch(
() => [props.visible, props.taskId] as const,
async ([vis, id]) => {
if (!vis || !id) {
viewDetail.value = null
return
}
loading.value = true
try {
const detail = await fetchQcTaskDetail(id)
try {
const results = await fetchQcTaskResults(id)
;(detail as QcTaskDetail).results = results || []
} catch {
;(detail as QcTaskDetail).results = []
}
viewDetail.value = detail
} catch {
viewDetail.value = null
} finally {
loading.value = false
}
},
{ immediate: true }
)
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 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) => u.trim())
.filter(Boolean)
.map((fileUrl, i) => ({ id: `rec_${i}`, fileUrl, fileName: fileUrl.split('/').pop() || '' }))
})
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.results && d.results.length > 0
? [
{
title: '检测参数',
fields: d.results.map((item) => ({
label: item.paramName + (item.paramUnit ? `(${item.paramUnit})` : ''),
value: item.paramValue || '—'
}))
}
]
: []
return [
{
title: '任务信息',
fields: [
{ label: '任务号', value: d.taskNo },
{ label: '业务类型', value: d.qcBizTypeLabel || qcBizTypeLabel(d.qcBizType || ''), tagType: 'success' },
{ label: '工单号', value: d.workOrderNo || '—' },
{
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),
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
]
})
function attachmentFullUrl(url: string) {
const u = String(url || '').trim()
if (!u) return ''
if (/^https?:\/\//i.test(u)) return u
return minioBaseUrl ? `${minioBaseUrl}/${u.replace(/^\//, '')}` : u
}
function handleAttachmentPreview(file: Record<string, unknown>) {
const url = attachmentFullUrl(String(file.fileUrl || ''))
if (url) window.open(url, '_blank')
}
function handleAttachmentDownload(file: Record<string, unknown>) {
downloadAttachmentFile(file, { fullFileUrl: attachmentFullUrl })
}
</script>
<style lang="scss">
/* 叠在协议/捐赠查看弹窗之上 */
.qc-task-view-dialog-mask {
z-index: 4000 !important;
}
</style>
<style scoped lang="scss">
.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;
}
}
}
.qc-task-view-attachments {
padding: 12px 18px;
border-bottom: none;
h3 {
margin: 0 0 10px;
padding-left: 10px;
font-size: 13px;
font-weight: 600;
color: #1e293b;
border-left: 3px solid #10b981;
line-height: 1;
}
}
</style>
@@ -0,0 +1,299 @@
<!-- 样本查看 — 质检信息卡片(协议单/捐赠单查看弹窗复用) -->
<template>
<div class="sample-card__section sample-card__section--qc">
<div class="sample-card__section-label">质检信息</div>
<div v-if="!qcInfo" class="sample-qc-empty">{{ emptyHint }}</div>
<template v-else>
<div class="qc-work-order-row">
<div class="qc-kv">
<span class="qc-kv__label">工单号</span>
<span class="qc-kv__value qc-kv__value--code">{{ qcInfo.workOrderNo || '—' }}</span>
</div>
<div class="qc-kv">
<span class="qc-kv__label">业务类型</span>
<span class="qc-kv__value">{{
qcInfo.qcBizTypeLabel || qcBizTypeLabel(qcInfo.qcBizType || '')
}}</span>
</div>
<div class="qc-kv">
<span class="qc-kv__label">工单状态</span>
<span class="qc-kv__value">
<el-tag :type="workOrderStatusTagType(qcInfo.workOrderStatus || '')" size="small">
{{ qcInfo.workOrderStatusLabel || workOrderStatusLabel(qcInfo.workOrderStatus || '') }}
</el-tag>
</span>
</div>
</div>
<div v-if="qcInfo.workOrderStatus === 'dpz' && !qcInfo.tasks?.length" class="sample-qc-hint">
工单待配置检测项目
</div>
<div v-if="qcInfo.tasks?.length" class="qc-detail-cards qc-detail-cards--tasks">
<div
v-for="task in qcInfo.tasks"
:key="task.id"
class="qc-detail-card qc-detail-card--task"
>
<div class="qc-detail-card__header">
<span class="qc-detail-card__name">{{ task.itemName || '—' }}</span>
<el-tag type="info" size="small">{{
task.taskTypeLabel || taskTypeLabel(task.taskType || '')
}}</el-tag>
</div>
<div class="qc-detail-card__body">
<div class="qc-kv">
<span class="qc-kv__label">任务号</span>
<span class="qc-kv__value">{{ task.taskNo || '—' }}</span>
</div>
<div class="qc-kv">
<span class="qc-kv__label">任务状态</span>
<span class="qc-kv__value">
<el-tag :type="taskStatusTagType(task.taskStatus)" size="small">
{{ task.taskStatusLabel || taskStatusLabel(task.taskStatus || '') }}
</el-tag>
</span>
</div>
<div class="qc-kv">
<span class="qc-kv__label">检测结论</span>
<span class="qc-kv__value">
<el-tag
v-if="task.conclusion"
:type="qcTaskConclusionTagType(task.conclusion)"
size="small"
>
{{ task.conclusionLabel || qcTaskConclusionLabel(task.conclusion) }}
</el-tag>
<span v-else class="qc-kv__muted">—</span>
</span>
</div>
</div>
<div class="qc-detail-card__foot">
<button type="button" class="qc-detail-card__link" @click.stop="openTaskView(task)">
点击查看详情
</button>
</div>
</div>
</div>
<div
v-else-if="qcInfo.workOrderStatus !== 'dpz'"
class="sample-qc-hint"
>
暂无检测任务
</div>
</template>
<Teleport to="body">
<QcTaskViewDialog v-model:visible="taskViewVisible" :task-id="taskViewId" />
</Teleport>
</div>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import {
qcBizTypeLabel,
workOrderStatusLabel,
taskTypeLabel,
taskStatusLabel,
qcTaskConclusionLabel,
qcTaskConclusionTagType
} from '@/utils/qc-labels'
import { workOrderStatusTagType, taskStatusTagType } from '@/utils/status-tag-registry'
import QcTaskViewDialog from '@/components/business/qc-task-view-dialog/index.vue'
export type SampleQcTask = {
id?: string
taskNo?: string
taskType?: string
taskTypeLabel?: string
itemName?: string
itemCode?: string
companyName?: string
taskStatus?: string
taskStatusLabel?: string
conclusion?: string
conclusionLabel?: string
completedTime?: string
remark?: string
}
export type SampleQcInfo = {
workOrderNo?: string
workOrderStatus?: string
workOrderStatusLabel?: string
qcBizType?: string
qcBizTypeLabel?: string
configuredTime?: string
hasLab?: boolean
hasThirdParty?: boolean
labItems?: Array<{ id?: string; itemCode?: string; itemName?: string }>
thirdPartyItems?: Array<{
id?: string
itemCode?: string
itemName?: string
companyName?: string
}>
tasks?: SampleQcTask[]
}
export type SampleReceptionBrief = {
acceptConclusion?: string
}
const props = defineProps<{
qcInfo?: SampleQcInfo | null
sampleReception?: SampleReceptionBrief | null
}>()
const taskViewVisible = ref(false)
const taskViewId = ref('')
const emptyHint = computed(() => {
const rec = props.sampleReception
if (!rec) {
return '暂未接收样本,接收结论为「接收」后将自动生成质检工单'
}
if (rec.acceptConclusion === 'bj') {
return '样本拒收,不生成质检工单'
}
if (rec.acceptConclusion === 'js') {
return '已接收,质检工单生成中或待配置'
}
return '暂无质检信息'
})
function openTaskView(task: SampleQcTask) {
if (!task.id) return
taskViewId.value = task.id
taskViewVisible.value = true
}
</script>
<style scoped lang="scss">
.sample-card__section--qc {
margin-top: 4px;
padding-top: 14px;
border-top: 1px dashed #e2e8f0;
}
.sample-qc-empty,
.sample-qc-hint {
font-size: 13px;
color: #94a3b8;
padding: 8px 0;
}
.qc-work-order-row {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: 12px 24px;
margin-bottom: 12px;
padding: 0 2px;
}
.qc-work-order-row .qc-kv {
flex: 1;
min-width: 140px;
}
.qc-detail-cards {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 10px;
&--tasks {
margin-bottom: 0;
}
}
.qc-detail-card {
border: 1px solid #e2e8f0;
border-radius: 8px;
background: #fff;
overflow: hidden;
&--task {
border-left: 3px solid #0ea5e9;
}
}
.qc-detail-card__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 8px;
padding: 10px 12px;
border-bottom: 1px solid #f1f5f9;
}
.qc-detail-card__name {
font-size: 13px;
font-weight: 600;
color: #1e293b;
text-align: left;
flex: 1;
word-break: break-word;
}
.qc-detail-card__body {
padding: 10px 12px;
display: flex;
flex-direction: column;
gap: 8px;
}
.qc-detail-card__foot {
padding: 2px 12px 8px;
text-align: right;
border-top: 1px dashed #f1f5f9;
}
.qc-detail-card__link {
padding: 0;
border: none;
background: none;
font-size: 11px;
line-height: 1.4;
color: #10b981;
cursor: pointer;
&:hover {
color: #059669;
text-decoration: underline;
}
}
.qc-kv__muted {
color: #94a3b8;
font-weight: 400;
}
.qc-kv {
display: flex;
align-items: flex-start;
gap: 8px;
font-size: 12px;
}
.qc-kv__label {
color: #94a3b8;
flex-shrink: 0;
min-width: 56px;
}
.qc-kv__value {
color: #1e293b;
font-weight: 500;
word-break: break-word;
&--code {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 12px;
}
}
</style>
@@ -3,11 +3,14 @@
<template>
<el-dialog
v-model="innerVisible"
width="720px"
:width="width"
class="system-view-dialog"
:class="[dialogClass, { 'system-view-dialog--compact': compact }]"
align-center
destroy-on-close
:show-close="false"
:append-to-body="appendToBody"
:modal-class="modalClass"
style="backdrop-filter: none"
>
<div class="dialog-scroll">
@@ -25,7 +28,7 @@
<!-- sections -->
<div v-for="section in sections" :key="section.title" class="view-section">
<h3>{{ section.title }}</h3>
<dl class="view-kv-grid">
<dl class="view-kv-grid" :class="`view-kv-grid--cols-${gridColumns}`">
<div
v-for="field in section.fields"
:key="field.label"
@@ -33,9 +36,13 @@
:class="{ 'view-kv-span-2': field.span }"
>
<dt>{{ field.label }}</dt>
<dd>{{ field.value ?? '—' }}</dd>
<dd>
<el-tag v-if="field.tagType" :type="field.tagType" size="small">{{ field.value ?? '—' }}</el-tag>
<template v-else>{{ field.value ?? '—' }}</template>
</dd>
</div>
</dl>
<slot v-if="section.slot" :name="section.slot" />
</div>
<slot name="append" />
</div>
@@ -52,24 +59,52 @@
import { computed, type Component } from 'vue'
import { Close } from '@element-plus/icons-vue'
export type TagType = 'success' | 'warning' | 'danger' | 'info' | '' | 'primary'
export interface ViewField {
label: string
value: string | number | boolean | null | undefined
span?: boolean
/** 传入后以 el-tag 渲染,值为 el-tag 的 type 属性 */
tagType?: TagType
}
export interface ViewSection {
title: string
fields: ViewField[]
/** 区块内追加内容(如附件列表),对应具名插槽名 */
slot?: string
}
const props = defineProps<{
visible: boolean
title: string
icon?: Component
meta?: string
sections: ViewSection[]
}>()
const props = withDefaults(
defineProps<{
visible: boolean
title: string
icon?: Component
meta?: string
sections: ViewSection[]
/** 弹窗宽度,默认 720px */
width?: string
/** 字段栅格列数,默认 2 */
gridColumns?: 2 | 3
/** 挂到 body,用于嵌套在其它弹窗内时叠层展示 */
appendToBody?: boolean
/** 遮罩类名(可配合全局样式提高 z-index) */
modalClass?: string
/** 附加 dialog class */
dialogClass?: string
/** 紧凑布局:缩小头部/区块间距与内容区最大高度 */
compact?: boolean
}>(),
{
width: '720px',
gridColumns: 2,
appendToBody: false,
modalClass: '',
dialogClass: '',
compact: false
}
)
const emit = defineEmits<{
(e: 'update:visible', val: boolean): void
@@ -153,7 +188,11 @@
.view-kv-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px 28px;
gap: 12px 20px;
&--cols-3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
.view-kv {
@@ -180,8 +219,15 @@
grid-column: 1 / -1;
}
@media (max-width: 900px) {
.view-kv-grid--cols-3 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 640px) {
.view-kv-grid {
.view-kv-grid,
.view-kv-grid--cols-3 {
grid-template-columns: 1fr;
}
@@ -190,6 +236,60 @@
gap: 4px;
}
}
.system-view-dialog--compact {
.dialog-scroll {
max-height: min(68vh, 560px);
}
.view-hero {
gap: 12px;
padding: 12px 18px;
}
.view-hero-icon {
width: 48px;
height: 48px;
border-radius: 10px;
.el-icon {
font-size: 22px !important;
}
}
.view-hero-main h2 {
margin-bottom: 4px;
font-size: 16px;
}
.view-hero-meta {
font-size: 12px;
}
.view-section {
padding: 12px 18px;
h3 {
margin-bottom: 10px;
font-size: 13px;
}
}
.view-kv-grid {
gap: 8px 16px;
}
.view-kv {
font-size: 12px;
grid-template-columns: 84px 1fr;
}
}
</style>
<style lang="scss">
.system-view-dialog--compact.el-dialog .el-dialog__footer {
padding: 8px 18px;
}
</style>
<style lang="scss">
+8 -1
View File
@@ -329,7 +329,7 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
path: 'qc-work-order',
component: '/quality-inspection/qc-work-order/index',
meta: {
title: '质检工单',
title: '入库质检工单',
keepAlive: true,
menuCode: 'biz:qcWorkOrder:list'
}
@@ -456,6 +456,13 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
path: 'sop',
component: '/production/sop/index',
meta: { title: 'SOP文档', keepAlive: true, menuCode: 'production:sop:list' }
},
{
id: '90000000000000000000000000000010',
name: 'ProductionProcessRoute',
path: 'process-route',
component: '/production/process-route/index',
meta: { title: '工艺路线管理', keepAlive: true, menuCode: 'production:process-route:list' }
}
]
},
+10 -39
View File
@@ -1,40 +1,13 @@
export function protocolStatusLabel(s: string) {
const map: Record<string, string> = {
dsx: '待生效',
sxz: '生效中',
ygq: '已过期',
yzf: '已作废',
zky: '转科研'
}
return map[s] || s || '-'
}
export function payModeLabel(s: string) {
if (s === 'dj') return '趸交'
if (s === 'fq') return '分期'
return s || '-'
}
export function payStatusLabel(s: string) {
const map: Record<string, string> = {
dfj: '待缴费',
jfqrz: '缴费确认中',
yjf: '已缴费',
tfqrz: '退费确认中',
ytf: '已退费'
}
return map[s] || '未知'
}
export function transferTypeLabel(t: string) {
const map: Record<string, string> = {
wxzz: '微信转账',
zzbzz: '支付宝转账',
yhkzz: '银行卡转账',
xj: '现金'
}
return map[t] || t || '-'
}
export {
protocolStatusLabel,
protocolStatusTagType,
payStatusLabel,
payStatusTagType,
payModeLabel,
payModeTagType,
transferTypeLabel,
transferTypeTagType
} from './status-tag-registry'
export function formatPaymentDueDate(d: unknown) {
const s = String(d || '')
@@ -43,7 +16,6 @@ export function formatPaymentDueDate(d: unknown) {
return s
}
/** 分期应缴预警天数(与分期预警规则一致:应缴日在当天起未来 N 天内,含逾期) */
export const PAYMENT_DUE_WARN_DAYS = 15
function parsePaymentDueYmd(ymd: unknown): Date | null {
@@ -61,7 +33,6 @@ function startOfLocalDay(d: Date) {
return new Date(d.getFullYear(), d.getMonth(), d.getDate())
}
/** 应缴日是否不晚于「今天 + warnDays」(含当天与已逾期) */
export function isPaymentDueWithinWarnWindow(
installmentDueDate: unknown,
warnDays = PAYMENT_DUE_WARN_DAYS
+18 -25
View File
@@ -1,25 +1,18 @@
export function workOrderStatusLabel(v: string) {
const m: Record<string, string> = {
dpz: '待配置',
ypz: '已配置',
ywc: '已完成'
}
return m[v] || v || '—'
}
export function taskTypeLabel(v: string) {
const m: Record<string, string> = {
sysz: '实验室自检',
dsfjc: '第三方检测'
}
return m[v] || v || '—'
}
export function taskStatusLabel(v: string) {
const m: Record<string, string> = {
dzx: '待执行',
jxz: '进行中',
ywc: '已完成'
}
return m[v] || v || '—'
}
export {
qcBizTypeLabel,
qcBizTypeTagType,
receptionSourceLabel,
receptionSourceTagType,
acceptConclusionLabel,
acceptConclusionTagType,
transportTypeLabel,
transportTypeTagType,
workOrderStatusLabel,
workOrderStatusTagType,
taskTypeLabel,
taskTypeTagType,
qcTaskConclusionLabel,
qcTaskConclusionTagType,
taskStatusLabel,
taskStatusTagType
} from './status-tag-registry'
+328
View File
@@ -0,0 +1,328 @@
/**
* 状态标签注册表 — 全局集中定义所有枚举字段的 label + tagType
*
* 使用方式:
* import { protocolStatusLabel, protocolStatusTagType } from '@/utils/status-tag-registry'
* <el-tag :type="protocolStatusTagType(row.status)">{{ protocolStatusLabel(row.status) }}</el-tag>
*
* 规范:同一枚举值在任何地方(表格、查看弹窗、导出)颜色必须一致。
* tagType 语义色:success=正常/已完成, warning=进行中/已过期, danger=异常/已作废,
* info=待执行/停用, primary=特殊分类/转出, ''=默认
*/
// ── 类型定义 ──────────────────────────────────────────────────────────────────
/** el-tag 的 type 属性值 */
export type TagType = 'success' | 'warning' | 'danger' | 'info' | '' | 'primary'
/** 单条枚举映射 */
export interface StatusItem {
label: string
tagType: TagType
}
/** 注册表类型 */
export type StatusRegistry = Record<string, StatusItem>
// ── 工厂函数 ──────────────────────────────────────────────────────────────────
function createLabelGetter(registry: StatusRegistry) {
return (code: string): string => registry[code]?.label ?? code ?? '—'
}
function createTagTypeGetter(registry: StatusRegistry) {
return (code: string): TagType => registry[code]?.tagType ?? 'info'
}
// ══════════════════════════════════════════════════════════════════════════════
// 协议 / 存储 域
// ══════════════════════════════════════════════════════════════════════════════
export const protocolStatus: StatusRegistry = {
dsx: { label: '待生效', tagType: 'info' },
sxz: { label: '生效中', tagType: 'success' },
ygq: { label: '已过期', tagType: 'warning' },
yzf: { label: '已作废', tagType: 'danger' },
zky: { label: '转科研', tagType: 'primary' }
}
export const protocolStatusLabel = createLabelGetter(protocolStatus)
export const protocolStatusTagType = createTagTypeGetter(protocolStatus)
export const donationStatus: StatusRegistry = {
dsx: { label: '待生效', tagType: 'info' },
sxz: { label: '生效中', tagType: 'success' },
ygq: { label: '已过期', tagType: 'warning' },
yzf: { label: '已作废', tagType: 'danger' },
zckc: { label: '转细胞存储', tagType: 'primary' }
}
export const donationStatusLabel = createLabelGetter(donationStatus)
export const donationStatusTagType = createTagTypeGetter(donationStatus)
export const sampleStatus: StatusRegistry = {
ycj: { label: '已采集', tagType: 'primary' },
jcz: { label: '检测中', tagType: 'warning' },
yrk: { label: '已入库', tagType: 'success' },
yzf: { label: '已作废', tagType: 'danger' }
}
export const sampleStatusLabel = createLabelGetter(sampleStatus)
export const sampleStatusTagType = createTagTypeGetter(sampleStatus)
export const payStatus: StatusRegistry = {
dfj: { label: '待缴费', tagType: 'info' },
jfqrz: { label: '缴费确认中', tagType: 'warning' },
yjf: { label: '已缴费', tagType: 'success' },
tfqrz: { label: '退费确认中', tagType: 'warning' },
ytf: { label: '已退费', tagType: 'danger' }
}
export const payStatusLabel = createLabelGetter(payStatus)
export const payStatusTagType = createTagTypeGetter(payStatus)
export const auditStatus: StatusRegistry = {
shtg: { label: '审核通过', tagType: 'success' },
shth: { label: '审核退回', tagType: 'danger' }
}
export const auditStatusLabel = createLabelGetter(auditStatus)
export const auditStatusTagType = createTagTypeGetter(auditStatus)
export const payMode: StatusRegistry = {
dj: { label: '趸交', tagType: 'info' },
fq: { label: '分期', tagType: 'warning' }
}
export const payModeLabel = createLabelGetter(payMode)
export const payModeTagType = createTagTypeGetter(payMode)
export const transferType: StatusRegistry = {
wxzz: { label: '微信转账', tagType: 'success' },
zzbzz: { label: '支付宝转账', tagType: 'primary' },
yhkzz: { label: '银行卡转账', tagType: 'info' },
xj: { label: '现金', tagType: 'warning' }
}
export const transferTypeLabel = createLabelGetter(transferType)
export const transferTypeTagType = createTagTypeGetter(transferType)
export const transportType: StatusRegistry = {
kdys: { label: '快递运输', tagType: 'info' },
ryxd: { label: '人员携带', tagType: 'success' }
}
export const transportTypeLabel = createLabelGetter(transportType)
export const transportTypeTagType = createTagTypeGetter(transportType)
export const receptionSource: StatusRegistry = {
cell_storage: { label: '细胞存储', tagType: 'primary' },
research_donation: { label: '科研捐赠', tagType: 'success' }
}
export const receptionSourceLabel = createLabelGetter(receptionSource)
export const receptionSourceTagType = createTagTypeGetter(receptionSource)
export const newbornSex: StatusRegistry = {
'1': { label: '男', tagType: 'primary' },
'0': { label: '女', tagType: 'success' }
}
export const newbornSexLabel = createLabelGetter(newbornSex)
export const newbornSexTagType = createTagTypeGetter(newbornSex)
export const deliveryMode: StatusRegistry = {
sc: { label: '顺产', tagType: 'info' },
pgc: { label: '剖宫产', tagType: 'warning' }
}
export const deliveryModeLabel = createLabelGetter(deliveryMode)
export const deliveryModeTagType = createTagTypeGetter(deliveryMode)
export const sourceType: StatusRegistry = {
direct: { label: '独立新建', tagType: 'info' },
from_storage: { label: '从存储转来', tagType: 'primary' }
}
export const sourceTypeLabel = createLabelGetter(sourceType)
export const sourceTypeTagType = createTagTypeGetter(sourceType)
// ══════════════════════════════════════════════════════════════════════════════
// 质检域
// ══════════════════════════════════════════════════════════════════════════════
export const qcBizType: StatusRegistry = {
inbound: { label: '入库质检', tagType: 'success' },
outbound: { label: '出库质检', tagType: 'primary' }
}
export const qcBizTypeLabel = createLabelGetter(qcBizType)
export const qcBizTypeTagType = createTagTypeGetter(qcBizType)
export const workOrderStatus: StatusRegistry = {
dpz: { label: '待配置', tagType: 'info' },
ypz: { label: '已配置', tagType: 'success' },
ywc: { label: '已完成', tagType: 'success' }
}
export const workOrderStatusLabel = createLabelGetter(workOrderStatus)
export const workOrderStatusTagType = createTagTypeGetter(workOrderStatus)
export const taskType: StatusRegistry = {
sysz: { label: '实验室自检', tagType: 'info' },
dsfjc: { label: '第三方检测', tagType: 'primary' }
}
export const taskTypeLabel = createLabelGetter(taskType)
export const taskTypeTagType = createTagTypeGetter(taskType)
export const qcConclusion: StatusRegistry = {
tg: { label: '通过', tagType: 'success' },
btg: { label: '不通过', tagType: 'danger' }
}
export const qcTaskConclusionLabel = createLabelGetter(qcConclusion)
export const qcTaskConclusionTagType = createTagTypeGetter(qcConclusion)
export const taskStatus: StatusRegistry = {
dzx: { label: '待执行', tagType: 'info' },
jxz: { label: '进行中', tagType: 'warning' },
ywc: { label: '已完成', tagType: 'success' }
}
export const taskStatusLabel = createLabelGetter(taskStatus)
export const taskStatusTagType = createTagTypeGetter(taskStatus)
export const acceptConclusion: StatusRegistry = {
js: { label: '接收', tagType: 'success' },
bj: { label: '拒收', tagType: 'danger' }
}
export const acceptConclusionLabel = createLabelGetter(acceptConclusion)
export const acceptConclusionTagType = createTagTypeGetter(acceptConclusion)
// ══════════════════════════════════════════════════════════════════════════════
// 渠道域
// ══════════════════════════════════════════════════════════════════════════════
export const channelType: StatusRegistry = {
yy: { label: '医院', tagType: 'primary' },
hzjg: { label: '合作机构', tagType: 'success' },
zs: { label: '诊所', tagType: 'warning' },
zfjg: { label: '政府机构', tagType: 'danger' },
qt: { label: '其他', tagType: 'info' }
}
export const channelTypeLabel = createLabelGetter(channelType)
export const channelTypeTagType = createTagTypeGetter(channelType)
export const agreementType: StatusRegistry = {
kyxy: { label: '框架协议', tagType: 'primary' },
zsxy: { label: '中试协议', tagType: 'success' },
lcxy: { label: '临床协议', tagType: 'warning' }
}
export const agreementTypeLabel = createLabelGetter(agreementType)
export const agreementTypeTagType = createTagTypeGetter(agreementType)
export const agreementStatus: StatusRegistry = {
dsx: { label: '待生效', tagType: 'info' },
sxz: { label: '生效中', tagType: 'success' },
yzf: { label: '已作废', tagType: 'danger' }
}
export const agreementStatusLabel = createLabelGetter(agreementStatus)
export const agreementStatusTagType = createTagTypeGetter(agreementStatus)
export const settlementType: StatusRegistry = {
yj: { label: '月结', tagType: '' },
jj: { label: '季结', tagType: 'success' },
nj: { label: '年结', tagType: 'warning' },
dcjs: { label: '单次结算', tagType: 'danger' }
}
export const settlementTypeLabel = createLabelGetter(settlementType)
export const settlementTypeTagType = createTagTypeGetter(settlementType)
// ══════════════════════════════════════════════════════════════════════════════
// 订单域
// ══════════════════════════════════════════════════════════════════════════════
export const orderStatus: StatusRegistry = {
pending_payment: { label: '待支付', tagType: 'warning' },
pending_confirm: { label: '待收货', tagType: 'info' },
completed: { label: '已完成', tagType: 'success' },
cancelled: { label: '已取消', tagType: 'danger' }
}
export const orderStatusLabel = createLabelGetter(orderStatus)
export const orderStatusTagType = createTagTypeGetter(orderStatus)
export const deliveryStatusMap: StatusRegistry = {
pending_dispatch: { label: '待分配配送', tagType: 'info' },
delivering: { label: '配送中', tagType: 'warning' },
delivered: { label: '配送完成', tagType: 'success' }
}
export const deliveryStatusLabel = createLabelGetter(deliveryStatusMap)
export const deliveryStatusTagType = createTagTypeGetter(deliveryStatusMap)
export const paymentMethod: StatusRegistry = {
online: { label: '线上支付', tagType: 'success' },
offline: { label: '线下支付', tagType: 'info' }
}
export const paymentMethodLabel = createLabelGetter(paymentMethod)
export const paymentMethodTagType = createTagTypeGetter(paymentMethod)
export const orderPayStatus: StatusRegistry = {
pending_payment: { label: '待支付', tagType: 'warning' },
paid: { label: '已支付', tagType: 'success' }
}
export const orderPayStatusLabel = createLabelGetter(orderPayStatus)
export const orderPayStatusTagType = createTagTypeGetter(orderPayStatus)
// ══════════════════════════════════════════════════════════════════════════════
// 系统 / 通用域
// ══════════════════════════════════════════════════════════════════════════════
/** 通用启用/停用(数据库 status 字段 1/0) */
export const enableStatus: StatusRegistry = {
'1': { label: '正常', tagType: 'success' },
'0': { label: '停用', tagType: 'danger' }
}
export const enableStatusLabel = createLabelGetter(enableStatus)
export const enableStatusTagType = createTagTypeGetter(enableStatus)
/** 性别(客户等业务表) */
export const sex: StatusRegistry = {
'0': { label: '男', tagType: 'primary' },
'1': { label: '女', tagType: 'success' }
}
export const sexLabel = createLabelGetter(sex)
export const sexTagType = createTagTypeGetter(sex)
/** 请假状态 */
export const leaveStatus: StatusRegistry = {
draft: { label: '草稿', tagType: 'info' },
pending: { label: '审批中', tagType: 'warning' },
approved: { label: '已通过', tagType: 'success' },
rejected: { label: '已驳回', tagType: 'danger' },
cancelled: { label: '已取消', tagType: 'info' }
}
export const leaveStatusLabel = createLabelGetter(leaveStatus)
export const leaveStatusTagType = createTagTypeGetter(leaveStatus)
/** 数据权限范围 */
export const dataScope: StatusRegistry = {
'1': { label: '全部数据', tagType: '' },
'2': { label: '本部门数据', tagType: 'info' },
'3': { label: '本部门及以下', tagType: 'info' },
'4': { label: '仅本人', tagType: 'warning' },
'5': { label: '自定义', tagType: 'primary' }
}
export const dataScopeLabel = createLabelGetter(dataScope)
export const dataScopeTagType = createTagTypeGetter(dataScope)
/** 洁净室等级 */
export const cleanRoomGrade: StatusRegistry = {
A: { label: 'A级', tagType: 'warning' },
B: { label: 'B级', tagType: '' },
C: { label: 'C级', tagType: 'info' },
D: { label: 'D级', tagType: 'info' }
}
export const cleanRoomGradeLabel = createLabelGetter(cleanRoomGrade)
export const cleanRoomGradeTagType = createTagTypeGetter(cleanRoomGrade)
/** 样本编码类型 */
export const sampleCodeType: StatusRegistry = {
zxbm: { label: '造血编码', tagType: 'info' },
qdbm: { label: '脐带编码', tagType: 'primary' }
}
export const sampleCodeTypeLabel = createLabelGetter(sampleCodeType)
export const sampleCodeTypeTagType = createTagTypeGetter(sampleCodeType)
/** 耗材包类型 */
export const packType: StatusRegistry = {
bzhcb: { label: '标准耗材包', tagType: 'info' },
zdyhcb: { label: '自定义耗材包', tagType: 'primary' }
}
export const packTypeLabel = createLabelGetter(packType)
export const packTypeTagType = createTagTypeGetter(packType)
@@ -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 }
]