This commit is contained in:
zlwu committed 2026-08-19 10:45:07 +08:00
1 parent 1618035e4b
commit cd8ab170ba
30 files changed
+13705 -11072

No files matched your search

@@ -4,7 +4,7 @@
<SystemViewDialog
v-model:visible="innerVisible"
title="生产任务详情"
width="960px"
width="1320px"
:grid-columns="4"
:icon="Operation"
:meta="viewDetail?.taskNo || ''"
@@ -395,9 +395,7 @@
{ label: '样本类型', value: r.sampleTypeName || d.sampleTypeName || '—' }
]
},
...(transportFields.length > 1 || r.transportType
? [{ title: '运输信息', fields: transportFields }]
: []),
{ title: '运输信息', fields: transportFields },
{
title: '质检接收',
slot: 'reception-extra',
@@ -441,78 +439,75 @@
: [])
]
}
const resultSection: ViewSection[] = [
{
title: '质检结论',
fields: taskResultSummaryFields
},
...(d.results && d.results.length > 0
? [
{
title: '检测参数',
fields: d.results.map((item) => ({
label: item.paramName + (item.paramUnit ? `(${item.paramUnit})` : ''),
value: item.paramValue || '—'
}))
}
]
: [{ title: '检测参数', fields: [], slot: 'params-empty' }])
]
const tailSections: ViewSection[] = []
const taskInfoSection: ViewSection = {
title: '任务信息',
fields: [
{ label: '任务号', value: d.taskNo },
{
label: '业务类型',
value: d.qcBizTypeLabel || qcBizTypeLabel(d.qcBizType || ''),
tagType: qcBizTypeTagType(d.qcBizType || '')
},
{ label: '工单号', value: d.workOrderNo || '—' },
...(viewBatchName.value || viewBatchNo.value
? [
{
label: '检测批次',
value: [viewBatchName.value, viewBatchNo.value].filter(Boolean).join(' · ')
}
]
: []),
{
label: '工单状态',
value: d.workOrderStatus ? workOrderStatusLabel(d.workOrderStatus) : '—',
tagType:
d.workOrderStatus === 'ywc'
? 'success'
: d.workOrderStatus === 'ypz'
? 'warning'
: 'info'
},
{
label: '任务状态',
value: taskStatusLabel(d.taskStatus),
tagType: taskStatusTagType(d.taskStatus)
},
{ label: '负责人', value: d.assigneeUserNames || '—' },
{ label: '完成时间', value: d.completedTime || '—' },
{ label: '创建时间', value: d.createTime || '—' }
]
}
const conclusionSection: ViewSection = {
title: '质检结论',
fields: taskResultSummaryFields
}
const paramsSection: ViewSection =
d.results && d.results.length > 0
? {
title: '检测参数',
fields: d.results.map((item) => ({
label: item.paramName + (item.paramUnit ? `(${item.paramUnit})` : ''),
value: item.paramValue || '—'
}))
}
: { title: '检测参数', fields: [], slot: 'params-empty' }
const materialSections: ViewSection[] = []
if (SHOW_QC_TASK_MATERIAL_USAGE && d.taskType !== 'dsfjc') {
tailSections.push({ title: '物料使用', fields: [], slot: 'material-usages' })
}
if (d.taskType === 'dsfjc' || taskAttachmentFiles.value.length) {
tailSections.push({
title: d.taskType === 'dsfjc' ? '检测材料' : '检测附件',
fields: [],
slot: 'task-attachments'
})
materialSections.push({ title: '物料使用', fields: [], slot: 'material-usages' })
}
materialSections.push({
title: '检测材料',
fields: [],
slot: 'task-attachments'
})
return [
{
title: '任务信息',
fields: [
{ label: '任务号', value: d.taskNo },
{
label: '业务类型',
value: d.qcBizTypeLabel || qcBizTypeLabel(d.qcBizType || ''),
tagType: qcBizTypeTagType(d.qcBizType || '')
},
{ label: '工单号', value: d.workOrderNo || '—' },
...(viewBatchName.value || viewBatchNo.value
? [
{
label: '检测批次',
value: [viewBatchName.value, viewBatchNo.value].filter(Boolean).join(' · ')
}
]
: []),
{
label: '工单状态',
value: d.workOrderStatus ? workOrderStatusLabel(d.workOrderStatus) : '—',
tagType:
d.workOrderStatus === 'ywc'
? 'success'
: d.workOrderStatus === 'ypz'
? 'warning'
: 'info'
},
{
label: '任务状态',
value: taskStatusLabel(d.taskStatus),
tagType: taskStatusTagType(d.taskStatus)
},
{ label: '负责人', value: d.assigneeUserNames || '—' },
{ label: '完成时间', value: d.completedTime || '—' },
{ label: '创建时间', value: d.createTime || '—' }
]
},
taskInfoSection,
itemSection,
...cellProductSection,
...sampleSections,
...resultSection,
...tailSections
conclusionSection,
paramsSection,
...materialSections,
...sampleSections
]
})
@@ -91,14 +91,21 @@
</template>
<Teleport to="body">
<ProductionTaskViewDialog v-model:visible="taskViewVisible" :task-id="taskViewId" />
<TaskExecutionDialog
v-model:visible="taskViewVisible"
:task-id="taskViewId"
:task-name="taskViewName"
readonly
append-to-body
modal-class="protocol-dialog-mask production-task-execution-nested-mask"
/>
</Teleport>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import ProductionTaskViewDialog from '@/components/business/production-task-view-dialog/index.vue'
import TaskExecutionDialog from '@/views/production/production-work-order/TaskExecutionDialog.vue'
import { productionConclusionLabel, productionConclusionTagType } from '@/utils/production-labels'
export type ProductionTaskInput = {
@@ -153,10 +160,12 @@
const taskViewVisible = ref(false)
const taskViewId = ref('')
const taskViewName = ref('')
function openTaskView(task: ProductionTask) {
if (!task.id) return
taskViewId.value = task.id
taskViewName.value = task.taskName || task.taskNo || ''
taskViewVisible.value = true
}
@@ -301,3 +310,9 @@
}
}
</style>
<style lang="scss">
.production-task-execution-nested-mask {
z-index: 4000 !important;
}
</style>
@@ -6,11 +6,7 @@
v-model="activeBatchKey"
class="panel-pill-tabs panel-pill-tabs--start sample-qc-batch-readonly__tabs"
>
<el-tab-pane
v-for="section in batchSections"
:key="section.key"
:name="section.key"
>
<el-tab-pane v-for="section in batchSections" :key="section.key" :name="section.key">
<template #label>
<span class="sample-qc-batch-readonly__tab-label">{{ section.batchName }}</span>
<span class="sample-qc-batch-readonly__tab-count">
@@ -18,44 +14,51 @@
</span>
</template>
<div
v-if="section.batchNo || section.assigneeUserNames"
v-if="(section.batchNo && !showTaskResults) || section.assigneeUserNames"
class="sample-qc-batch-readonly__meta"
>
<span v-if="section.batchNo" class="sample-qc-batch-readonly__meta-item">{{
section.batchNo
}}</span>
<span
v-if="section.batchNo && !showTaskResults"
class="sample-qc-batch-readonly__meta-item"
>{{ section.batchNo }}</span
>
<span v-if="section.assigneeUserNames" class="sample-qc-batch-readonly__meta-item">
负责人:{{ section.assigneeUserNames }}
</span>
</div>
<div class="qc-detail-cards qc-detail-cards--tasks">
<div
class="qc-detail-cards qc-detail-cards--tasks"
:class="{ 'is-stacked': showTaskResults }"
>
<div
v-for="task in section.tasks"
v-for="(task, tIdx) in section.tasks"
:key="task.id || `${section.key}-${task.taskNo}`"
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="taskTypeTagType(task.taskType || '')" 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">
<span class="qc-detail-card__name">
<span v-if="showTaskResults" class="qc-detail-card__index">{{ tIdx + 1 }}.</span>
{{ task.itemName || '—' }}
<el-tag
v-if="showTaskResults"
:type="taskTypeTagType(task.taskType || '')"
size="small"
>
{{ task.taskTypeLabel || taskTypeLabel(task.taskType || '') }}
</el-tag>
</span>
<div class="qc-detail-card__header-right">
<el-tag
v-if="!showTaskResults"
:type="taskTypeTagType(task.taskType || '')"
size="small"
>
{{ task.taskTypeLabel || taskTypeLabel(task.taskType || '') }}
</el-tag>
<template v-if="showTaskResults">
<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)"
@@ -64,11 +67,70 @@
{{ task.conclusionLabel || qcTaskConclusionLabel(task.conclusion) }}
</el-tag>
<span v-else class="qc-kv__muted">—</span>
</span>
</template>
</div>
</div>
<div class="qc-detail-card__body">
<div v-if="!showTaskResults" class="qc-kv">
<span class="qc-kv__label">任务号</span>
<span class="qc-kv__value">{{ task.taskNo || '—' }}</span>
</div>
<div v-if="!showTaskResults" class="qc-kv-row">
<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>
<template v-if="showTaskResults">
<div v-if="taskResults(task).length" class="qc-param-row">
<div
v-for="(item, pIdx) in taskResults(task)"
:key="`${task.id || task.taskNo}-${pIdx}`"
class="qc-param-item"
>
<span class="qc-param-item__label">{{ paramLabel(item) }}</span>
<span class="qc-param-item__value">{{ item.paramValue || '—' }}</span>
</div>
</div>
<div v-else class="qc-kv">
<span class="qc-kv__label">检测参数</span>
<span class="qc-kv__muted">—</span>
</div>
<div v-if="taskAttachmentFiles(task).length" class="qc-kv qc-kv--attachments">
<span class="qc-kv__label">附件</span>
<span class="qc-kv__value">
<ProtocolAttachmentReadonly
:files="taskAttachmentFiles(task)"
@preview="previewAttachment"
@download="downloadAttachment"
/>
</span>
</div>
</template>
</div>
<div v-if="task.id" class="qc-detail-card__foot">
<button type="button" class="qc-detail-card__link" @click.stop="emit('view-task', task)">
<button
type="button"
class="qc-detail-card__link"
@click.stop="emit('view-task', task)"
>
点击查看详情
</button>
</div>
@@ -93,10 +155,24 @@
qcTaskConclusionTagType
} from '@/utils/qc-labels'
import { taskStatusTagType } from '@/utils/status-tag-registry'
import { loadQcInspectionBatches, resolveBatchSections,
import {
loadQcInspectionBatches,
resolveBatchSections,
type QcBatchTaskSection,
type QcInspectionBatch
} from '@/utils/qc-inspection-batch'
import ProtocolAttachmentReadonly from '@/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue'
import {
qcAttachmentFilesFromCommaUrls,
qcPreviewAttachment,
qcDownloadAttachment
} from '@/views/quality-inspection/qc-work-order/composables/useQcViewAttachmentHelpers'
export type SampleQcBatchTaskResult = {
paramName?: string
paramUnit?: string
paramValue?: string
}
export type SampleQcBatchTask = {
id?: string
@@ -109,20 +185,47 @@
conclusion?: string
conclusionLabel?: string
batchId?: string
thirdPartyAttachments?: string
attachmentFiles?: Array<{ id?: string; fileUrl?: string; fileName?: string; fileType?: string }>
results?: SampleQcBatchTaskResult[]
}
defineOptions({ name: 'SampleQcBatchReadonly' })
const props = defineProps<{
workOrderId?: string
tasks?: SampleQcBatchTask[]
inspectionBatches?: QcInspectionBatch[]
}>()
const props = withDefaults(
defineProps<{
workOrderId?: string
tasks?: SampleQcBatchTask[]
inspectionBatches?: QcInspectionBatch[]
showTaskResults?: boolean
}>(),
{ showTaskResults: false }
)
const emit = defineEmits<{
'view-task': [task: SampleQcBatchTask]
}>()
function taskResults(task: SampleQcBatchTask) {
return task.results || []
}
function paramLabel(item: SampleQcBatchTaskResult) {
const name = String(item.paramName || '').trim() || '参数'
const unit = String(item.paramUnit || '').trim()
return unit ? `${name}(${unit})` : name
}
function taskAttachmentFiles(task: SampleQcBatchTask) {
if (Array.isArray(task.attachmentFiles) && task.attachmentFiles.length) {
return task.attachmentFiles as Array<Record<string, unknown>>
}
return qcAttachmentFilesFromCommaUrls(String(task.thirdPartyAttachments || ''))
}
const previewAttachment = qcPreviewAttachment
const downloadAttachment = qcDownloadAttachment
const loading = ref(false)
const batches = ref<QcInspectionBatch[]>([])
const batchSections = ref<QcBatchTaskSection<SampleQcBatchTask>[]>([])
@@ -140,7 +243,10 @@
}
function syncSections() {
batchSections.value = resolveBatchSections(props.inspectionBatches || batches.value, props.tasks)
batchSections.value = resolveBatchSections(
props.inspectionBatches || batches.value,
props.tasks
)
ensureActiveBatchKey(batchSections.value)
}
@@ -233,38 +339,61 @@
&--tasks {
margin-bottom: 0;
}
&.is-stacked {
grid-template-columns: 1fr;
}
}
.qc-detail-card {
overflow: hidden;
background: #fff;
border: 1px solid #e2e8f0;
border-radius: 8px;
background: #fff;
overflow: hidden;
}
.qc-detail-card__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 8px;
align-items: center;
justify-content: space-between;
padding: 10px 12px;
border-bottom: 1px solid #f1f5f9;
}
.qc-detail-card__header-right {
display: flex;
flex-shrink: 0;
flex-wrap: wrap;
gap: 6px;
align-items: center;
justify-content: flex-end;
}
.qc-detail-card__name {
display: flex;
flex: 1;
gap: 8px;
align-items: center;
min-width: 0;
font-size: 13px;
font-weight: 600;
color: #1e293b;
text-align: left;
flex: 1;
word-break: break-word;
}
.qc-detail-card__index {
flex-shrink: 0;
font-variant-numeric: tabular-nums;
color: var(--mint-text-muted, #64748b);
}
.qc-detail-card__body {
padding: 10px 12px;
display: flex;
flex-direction: column;
gap: 8px;
padding: 10px 12px;
}
.qc-detail-card__foot {
@@ -275,12 +404,12 @@
.qc-detail-card__link {
padding: 0;
border: none;
background: none;
font-size: 11px;
line-height: 1.4;
color: #047857;
cursor: pointer;
background: none;
border: none;
&:hover {
color: #065f46;
@@ -289,26 +418,88 @@
}
.qc-kv__muted {
color: var(--mint-text-muted, #334155);
font-weight: 400;
color: var(--mint-text-muted, #334155);
}
.qc-kv {
display: flex;
align-items: flex-start;
gap: 8px;
align-items: flex-start;
font-size: 12px;
}
.qc-kv-row {
display: flex;
flex-wrap: wrap;
gap: 8px 16px;
.qc-kv {
flex: 1;
min-width: 120px;
}
.qc-kv__label {
max-width: none;
}
}
.qc-kv__label {
color: var(--mint-text-muted, #334155);
flex-shrink: 0;
min-width: 56px;
max-width: 52%;
color: var(--mint-text-muted, #334155);
}
.qc-kv__value {
color: #1e293b;
font-weight: 500;
color: #1e293b;
word-break: break-word;
}
.qc-param-row {
display: flex;
flex-wrap: wrap;
gap: 6px 20px;
}
.qc-param-item {
display: inline-flex;
gap: 6px;
align-items: baseline;
min-width: 0;
font-size: 12px;
}
.qc-param-item__label {
flex-shrink: 0;
color: var(--mint-text-muted, #334155);
}
.qc-param-item__value {
font-weight: 500;
color: #1e293b;
word-break: break-word;
}
.qc-kv--attachments {
flex-direction: column;
gap: 6px;
.qc-kv__label {
min-width: 0;
}
:deep(.attachment-item) {
width: 96px;
}
:deep(.attachment-preview) {
height: 64px;
}
:deep(.attachment-name) {
font-size: 11px;
}
}
</style>
@@ -32,10 +32,7 @@
</div>
</div>
<div
v-if="qcInfo.workOrderStatus === 'dpz' && !hasTaskContent"
class="sample-qc-hint"
>
<div v-if="qcInfo.workOrderStatus === 'dpz' && !hasTaskContent" class="sample-qc-hint">
工单待配置检测项目
</div>
@@ -44,6 +41,7 @@
:work-order-id="qcInfo.id"
:tasks="qcInfo.tasks"
:inspection-batches="qcInfo.inspectionBatches"
:show-task-results="showTaskResults"
@view-task="openTaskView"
/>
@@ -85,6 +83,13 @@
completedTime?: string
remark?: string
batchId?: string
thirdPartyAttachments?: string
attachmentFiles?: Array<{ id?: string; fileUrl?: string; fileName?: string; fileType?: string }>
results?: Array<{
paramName?: string
paramUnit?: string
paramValue?: string
}>
}
export type SampleQcInfo = {
@@ -126,9 +131,12 @@
/** 嵌入分组面板时隐藏区块标题与顶部分隔 */
embedded?: boolean
sectionLabel?: string
/** 任务卡片内直接展示检测参数与附件 */
showTaskResults?: boolean
}>(),
{
embedded: false
embedded: false,
showTaskResults: false
}
)
@@ -137,8 +145,7 @@
const taskViewPreset = ref<SampleQcTask | null>(null)
const hasTaskContent = computed(
() =>
!!(props.qcInfo?.inspectionBatches?.length || props.qcInfo?.tasks?.length)
() => !!(props.qcInfo?.inspectionBatches?.length || props.qcInfo?.tasks?.length)
)
const emptyHint = computed(() => {
@@ -166,39 +173,39 @@
<style scoped lang="scss">
.sample-card__section--qc {
margin-top: 4px;
padding-top: 14px;
margin-top: 4px;
border-top: 1px dashed #e2e8f0;
&.sample-card__section--embedded {
margin-top: 0;
padding-top: 0;
margin-top: 0;
border-top: none;
}
}
.sample-card__section-label {
margin-bottom: 10px;
font-size: 11px;
font-weight: 600;
color: var(--mint-text-muted, #334155);
margin-bottom: 10px;
letter-spacing: 0.3px;
}
.sample-qc-empty,
.sample-qc-hint {
padding: 8px 0;
font-size: 13px;
color: var(--mint-text-muted, #334155);
padding: 8px 0;
}
.qc-work-order-row {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: 12px 24px;
margin-bottom: 12px;
align-items: flex-start;
padding: 0 2px;
margin-bottom: 12px;
}
.qc-work-order-row .qc-kv {
@@ -208,20 +215,20 @@
.qc-kv {
display: flex;
align-items: flex-start;
gap: 8px;
align-items: flex-start;
font-size: 12px;
}
.qc-kv__label {
color: var(--mint-text-muted, #334155);
flex-shrink: 0;
min-width: 56px;
color: var(--mint-text-muted, #334155);
}
.qc-kv__value {
color: #1e293b;
font-weight: 500;
color: #1e293b;
word-break: break-word;
&--code {
@@ -13,6 +13,7 @@
:qc-info="gateQcInfo"
:sample-reception="sampleReception"
:hide-sample-context="hideSampleContext"
:show-task-results="showTaskResults"
/>
</section>
@@ -46,6 +47,7 @@
embedded
:qc-info="item"
:hide-sample-context="hideSampleContext"
:show-task-results="showTaskResults"
/>
</article>
</div>
@@ -74,13 +76,16 @@
showGateSection?: boolean
gateSectionLabel?: string
processSectionLabel?: string
/** 任务卡片内直接展示检测参数与附件 */
showTaskResults?: boolean
}>(),
{
processQcInfoList: () => [],
showSectionLabel: true,
showGateSection: true,
gateSectionLabel: '样本接收质检(入库门禁)',
processSectionLabel: '生产过程质检'
processSectionLabel: '生产过程质检',
showTaskResults: false
}
)
@@ -92,16 +97,16 @@
<style scoped lang="scss">
.sample-qc-grouped-panel-root--section {
margin-top: 4px;
padding-top: 14px;
margin-top: 4px;
border-top: 1px dashed #e2e8f0;
}
.sample-card__section-label {
margin-bottom: 10px;
font-size: 11px;
font-weight: 600;
color: var(--mint-text-muted, #334155);
margin-bottom: 10px;
letter-spacing: 0.3px;
}
@@ -119,12 +124,12 @@
}
.sample-qc-grouped-panel__subtitle {
margin: 0;
padding-left: 10px;
margin: 0;
font-size: 12px;
font-weight: 600;
color: #334155;
line-height: 1.4;
color: #334155;
border-left: 3px solid #10b981;
}
@@ -143,16 +148,16 @@
.sample-qc-grouped-panel__process-item {
padding: 10px 12px;
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 8px;
background: #f8fafc;
}
.process-qc-meta {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: 8px 16px;
align-items: flex-start;
margin-bottom: 8px;
}
@@ -167,20 +172,20 @@
.qc-kv {
display: flex;
align-items: flex-start;
gap: 8px;
align-items: flex-start;
font-size: 12px;
}
.qc-kv__label {
color: var(--mint-text-muted, #334155);
flex-shrink: 0;
min-width: 56px;
color: var(--mint-text-muted, #334155);
}
.qc-kv__value {
color: #1e293b;
font-weight: 500;
color: #1e293b;
word-break: break-word;
&--code {