This commit is contained in:
zlwu committed 2026-07-29 10:26:07 +08:00
1 parent 56cee052d4
commit 3317d4a077
29 files changed
+9759 -7961

No files matched your search

@@ -1,95 +1,196 @@
<!-- 细胞产品 — 来源链质检只读 -->
<!-- 细胞产品 — 来源链质检只读(默认任务卡片,点击查看详情) -->
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<el-dialog
:model-value="modelValue"
title="来源链质检"
width="1040px"
class="dialog-form-layout cell-lineage-qc-dialog"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
style="backdrop-filter: none"
@update:model-value="emit('update:modelValue', $event)"
@closed="resetState"
>
<div v-loading="loading" class="lineage-qc-body">
<div v-if="data" class="lineage-qc-summary">
<span class="lineage-qc-summary__code">{{ data.productCode || '—' }}</span>
<span class="lineage-qc-summary__name">{{ data.productName || '—' }}</span>
<div>
<el-dialog
:model-value="modelValue"
title="来源链质检"
width="1040px"
class="dialog-form-layout cell-lineage-qc-dialog"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
style="backdrop-filter: none"
@update:model-value="emit('update:modelValue', $event)"
@closed="resetState"
>
<div v-loading="loading" class="lineage-qc-body">
<div v-if="data" class="lineage-qc-summary">
<span class="lineage-qc-summary__code">{{ data.productCode || '—' }}</span>
<span class="lineage-qc-summary__name">{{ data.productName || '—' }}</span>
</div>
<el-empty
v-if="!loading && (!data?.nodes || !data.nodes.length)"
description="暂无来源链数据"
/>
<el-collapse
v-else-if="data?.nodes?.length"
v-model="activeNames"
class="lineage-qc-collapse"
>
<el-collapse-item
v-for="(node, idx) in data.nodes"
:key="`${node.nodeType}-${node.id}-${idx}`"
:name="String(idx)"
>
<template #title>
<div class="lineage-qc-node-title">
<el-tag v-if="node.isCurrent" type="success" size="small">当前</el-tag>
<el-tag v-if="node.nodeType === 'sample'" type="info" size="small">样本</el-tag>
<el-tag v-else type="primary" size="small">细胞产品</el-tag>
<span class="lineage-qc-node-title__label">{{ node.label || '—' }}</span>
<span v-if="node.productName" class="lineage-qc-node-title__sub">{{
node.productName
}}</span>
<span v-if="node.passage" class="lineage-qc-node-title__sub"
>代次 {{ node.passage }}</span
>
<span v-if="node.receptionSourceLabel" class="lineage-qc-node-title__sub">{{
node.receptionSourceLabel
}}</span>
<span class="lineage-qc-node-title__count"
>{{ taskCountOfNode(node) }} 个质检任务</span
>
</div>
</template>
<div v-if="!(node.workOrders || []).length" class="lineage-qc-empty">暂无质检工单</div>
<div v-for="wo in node.workOrders || []" :key="wo.id" class="lineage-qc-wo">
<div class="lineage-qc-wo__head">
<span class="lineage-qc-wo__no">{{ wo.workOrderNo || '—' }}</span>
<el-tag v-if="wo.workOrderType" type="info" size="small">{{
workOrderTypeLabel(wo.workOrderType)
}}</el-tag>
<el-tag
v-if="wo.workOrderStatus"
:type="workOrderStatusTagType(wo.workOrderStatus)"
size="small"
>
{{ wo.workOrderStatusLabel || wo.workOrderStatus }}
</el-tag>
</div>
<div v-if="!(wo.tasks || []).length" class="lineage-qc-empty">暂无质检任务</div>
<div v-else class="lineage-qc-task-list">
<article
v-for="(task, ti) in wo.tasks || []"
:key="task.id || ti"
class="lineage-qc-task-card"
@click="openTaskDetail(task, wo, node)"
>
<div class="lineage-qc-task-card__main">
<div class="lineage-qc-task-card__title">
<span v-if="(wo.tasks || []).length > 1" class="lineage-qc-task-card__index">{{
ti + 1
}}</span>
<span class="lineage-qc-task-card__name">{{ task.itemName || '—' }}</span>
<span v-if="task.itemCode" class="lineage-qc-task-card__code">{{
task.itemCode
}}</span>
</div>
<dl class="lineage-qc-task-card__meta">
<div class="lineage-qc-task-card__meta-item">
<dt>任务号</dt>
<dd>{{ task.taskNo || '—' }}</dd>
</div>
<div
v-if="task.taskType === 'dsfjc' && task.companyName"
class="lineage-qc-task-card__meta-item"
>
<dt>第三方</dt>
<dd>{{ task.companyName }}</dd>
</div>
<div class="lineage-qc-task-card__meta-item">
<dt>完成时间</dt>
<dd>{{ task.completedTime || '—' }}</dd>
</div>
</dl>
</div>
<div class="lineage-qc-task-card__aside">
<div class="lineage-qc-task-card__tags">
<el-tag :type="taskStatusTagType(task.taskStatus) as any" size="small">
{{ taskStatusLabel(task.taskStatus || '') }}
</el-tag>
<el-tag
:type="qcConclusionDisplayTagType(task.conclusion) as any"
size="small"
>
{{
task.conclusionLabel || qcConclusionDisplayLabel(task.conclusion)
}}
</el-tag>
</div>
<el-button type="primary" link class="lineage-qc-task-card__action" @click.stop="openTaskDetail(task, wo, node)">
<el-icon><View /></el-icon>
查看详情
</el-button>
</div>
</article>
</div>
</div>
</el-collapse-item>
</el-collapse>
</div>
<el-empty
v-if="!loading && (!data?.nodes || !data.nodes.length)"
description="暂无来源链数据"
/>
<template #footer>
<el-button class="btn-ghost" @click="emit('update:modelValue', false)">
<el-icon><Close /></el-icon>
关闭
</el-button>
</template>
</el-dialog>
<el-collapse v-else-if="data?.nodes?.length" v-model="activeNames" class="lineage-qc-collapse">
<el-collapse-item
v-for="(node, idx) in data.nodes"
:key="`${node.nodeType}-${node.id}-${idx}`"
:name="String(idx)"
>
<template #title>
<div class="lineage-qc-node-title">
<el-tag v-if="node.isCurrent" type="success" size="small">当前</el-tag>
<el-tag v-if="node.nodeType === 'sample'" type="info" size="small">样本</el-tag>
<el-tag v-else type="primary" size="small">细胞产品</el-tag>
<span class="lineage-qc-node-title__label">{{ node.label || '—' }}</span>
<span v-if="node.productName" class="lineage-qc-node-title__sub">{{
node.productName
}}</span>
<span v-if="node.passage" class="lineage-qc-node-title__sub"
>代次 {{ node.passage }}</span
>
<span v-if="node.receptionSourceLabel" class="lineage-qc-node-title__sub">{{
node.receptionSourceLabel
}}</span>
</div>
</template>
<div v-if="!(node.workOrders || []).length" class="lineage-qc-empty">暂无质检工单</div>
<div v-for="wo in node.workOrders || []" :key="wo.id" class="lineage-qc-wo">
<div class="lineage-qc-wo__head">
<span class="lineage-qc-wo__no">{{ wo.workOrderNo || '—' }}</span>
<el-tag v-if="wo.workOrderType" type="info" size="small">{{
workOrderTypeLabel(wo.workOrderType)
}}</el-tag>
<el-tag
v-if="wo.workOrderStatus"
:type="workOrderStatusTagType(wo.workOrderStatus)"
size="small"
>
{{ wo.workOrderStatusLabel || wo.workOrderStatus }}
</el-tag>
</div>
<QcWorkOrderTaskResultPanel :tasks="mapTasks(wo.tasks)" />
</div>
</el-collapse-item>
</el-collapse>
</div>
<template #footer>
<el-button class="btn-ghost" @click="emit('update:modelValue', false)">
<el-icon><Close /></el-icon>
关闭
</el-button>
</template>
</el-dialog>
<!-- 质检任务详情 -->
<el-dialog
v-model="detailVisible"
title="质检任务详情"
width="880px"
class="dialog-form-layout cell-lineage-qc-detail-dialog"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
style="backdrop-filter: none"
@closed="resetDetail"
>
<div v-if="detailContext" class="lineage-qc-detail-context">
<span>{{ detailContext.nodeLabel }}</span>
<span v-if="detailContext.workOrderNo">· 工单 {{ detailContext.workOrderNo }}</span>
</div>
<QcWorkOrderTaskResultPanel v-if="detailTask" :tasks="[detailTask]" />
<template #footer>
<el-button class="btn-ghost" @click="detailVisible = false">
<el-icon><Close /></el-icon>
关闭
</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { ElMessage } from 'element-plus'
import { Close } from '@element-plus/icons-vue'
import { Close, View } from '@element-plus/icons-vue'
import {
fetchCellProductLineageQc,
type CellProductLineageQc,
type CellProductLineageQcTask
type CellProductLineageQcNode,
type CellProductLineageQcTask,
type CellProductLineageQcWorkOrder
} from '@/api/cell-product'
import QcWorkOrderTaskResultPanel from '@/views/quality-inspection/qc-work-order/QcWorkOrderTaskResultPanel.vue'
import type { QcWorkOrderTaskView } from '@/views/quality-inspection/qc-work-order/composables/useQcWorkOrderTaskViewSections'
import {
taskStatusLabel,
taskStatusTagType,
qcConclusionDisplayLabel,
qcConclusionDisplayTagType
} from '@/utils/qc-labels'
defineOptions({ name: 'CellProductLineageQcDialog' })
@@ -106,6 +207,10 @@
const data = ref<CellProductLineageQc | null>(null)
const activeNames = ref<string[]>([])
const detailVisible = ref(false)
const detailTask = ref<QcWorkOrderTaskView | null>(null)
const detailContext = ref<{ nodeLabel: string; workOrderNo: string } | null>(null)
function workOrderTypeLabel(type?: string) {
const map: Record<string, string> = {
inbound: '入库',
@@ -122,13 +227,38 @@
return 'info'
}
function mapTasks(tasks?: CellProductLineageQcTask[]): QcWorkOrderTaskView[] {
return (tasks || []).map((t) => ({
...(t as any),
results: t.results || [],
attachmentFiles: t.attachmentFiles || [],
function taskCountOfNode(node: CellProductLineageQcNode) {
return (node.workOrders || []).reduce((sum, wo) => sum + (wo.tasks || []).length, 0)
}
function mapTask(task: CellProductLineageQcTask): QcWorkOrderTaskView {
return {
...(task as any),
results: task.results || [],
attachmentFiles: task.attachmentFiles || [],
materialUsages: []
}))
}
}
function openTaskDetail(
task: CellProductLineageQcTask,
wo: CellProductLineageQcWorkOrder,
node: CellProductLineageQcNode
) {
detailTask.value = mapTask(task)
const parts = [node.label, node.productName, node.passage ? `代次 ${node.passage}` : '']
.filter(Boolean)
.join(' ')
detailContext.value = {
nodeLabel: parts || '—',
workOrderNo: wo.workOrderNo || ''
}
detailVisible.value = true
}
function resetDetail() {
detailTask.value = null
detailContext.value = null
}
async function loadData() {
@@ -153,6 +283,8 @@
data.value = null
activeNames.value = []
loading.value = false
detailVisible.value = false
resetDetail()
}
watch(
@@ -225,7 +357,8 @@
color: #1e293b;
}
.lineage-qc-node-title__sub {
.lineage-qc-node-title__sub,
.lineage-qc-node-title__count {
font-size: 12px;
color: var(--mint-text-muted, #64748b);
}
@@ -261,4 +394,118 @@
font-weight: 600;
color: #1e293b;
}
.lineage-qc-task-list {
display: flex;
flex-direction: column;
gap: 8px;
}
.lineage-qc-task-card {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
padding: 12px 14px;
border: 1px solid #e2e8f0;
border-radius: 8px;
background: #f8fafc;
cursor: pointer;
transition: border-color 0.15s, background 0.15s;
&:hover {
border-color: #a7f3d0;
background: #ecfdf5;
}
}
.lineage-qc-task-card__main {
flex: 1;
min-width: 0;
}
.lineage-qc-task-card__title {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin-bottom: 8px;
}
.lineage-qc-task-card__index {
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
border-radius: 4px;
background: #e2e8f0;
font-size: 12px;
font-weight: 600;
color: #475569;
}
.lineage-qc-task-card__name {
font-size: 14px;
font-weight: 600;
color: #1e293b;
}
.lineage-qc-task-card__code {
font-size: 12px;
color: var(--mint-text-muted, #64748b);
}
.lineage-qc-task-card__meta {
display: flex;
flex-wrap: wrap;
gap: 8px 20px;
margin: 0;
}
.lineage-qc-task-card__meta-item {
display: flex;
gap: 6px;
font-size: 12px;
dt {
margin: 0;
color: var(--mint-text-muted, #64748b);
}
dd {
margin: 0;
color: #334155;
font-weight: 500;
}
}
.lineage-qc-task-card__aside {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 8px;
flex-shrink: 0;
}
.lineage-qc-task-card__tags {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 6px;
}
.lineage-qc-task-card__action {
padding: 0;
}
.lineage-qc-detail-context {
margin-bottom: 12px;
padding: 10px 12px;
border-radius: 8px;
background: #f8fafc;
border: 1px solid #e2e8f0;
font-size: 13px;
color: var(--mint-text-muted, #64748b);
}
</style>
@@ -458,7 +458,7 @@
remark?: string
}
const PAPER_NAME_OPTIONS = ['细胞产品检测报告', '出库单', '接收确认书']
const PAPER_NAME_OPTIONS = ['细胞放行检测报告', '出库单', '接收确认书']
defineOptions({ name: 'OutboundMaterialFormSections' })