feat(sample): 展示样本状态并支持样本废弃与作废原因
生产/质检入库卡片展示样本状态并支持【样本废弃】;市场 Web 列表与移动市场部卡片补充样本状态及问号查看作废原因;样本表新增 void_desc,人工作废不联动接收但全部作废时自动作废协议(#131)。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
7751cc0f4a
commit
0b4c8dfda8
53 files changed
+1527
-82
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/http'
|
||||
|
||||
export type SampleVoidTarget = {
|
||||
receptionSource: 'cell_storage' | 'research_donation'
|
||||
sampleId?: string
|
||||
sampleCode?: string
|
||||
protocolId?: string
|
||||
}
|
||||
|
||||
export type VoidBusinessSamplePayload = SampleVoidTarget & {
|
||||
voidDesc: string
|
||||
}
|
||||
|
||||
export type VoidBusinessSampleResult = {
|
||||
id: string
|
||||
sampleCode: string
|
||||
sampleStatus: string
|
||||
voidDate: string
|
||||
voidDesc: string
|
||||
}
|
||||
|
||||
export function fetchVoidBusinessSample(data: VoidBusinessSamplePayload) {
|
||||
return request.put<VoidBusinessSampleResult>({
|
||||
url: '/web/admin/business-samples/void',
|
||||
data
|
||||
})
|
||||
}
|
||||
@@ -17,6 +17,10 @@ export interface ProductionWorkOrderItem {
|
||||
workOrderType?: string
|
||||
protocolNo?: string
|
||||
sampleCode?: string
|
||||
sampleStatus?: string
|
||||
voidDesc?: string
|
||||
protocolSampleId?: string
|
||||
collectionProtocolId?: string
|
||||
receptionSource?: string
|
||||
receptionSourceLabel?: string
|
||||
sampleTypeName?: string
|
||||
|
||||
@@ -100,6 +100,8 @@ export type QcWorkOrder = {
|
||||
collectionProtocolId: string
|
||||
protocolNo: string
|
||||
sampleCode: string
|
||||
sampleStatus?: string
|
||||
voidDesc?: string
|
||||
labStorageCode?: string
|
||||
receptionSource?: string
|
||||
receptionSourceLabel?: string
|
||||
|
||||
@@ -5,6 +5,8 @@ export type SampleFreightItem = {
|
||||
sampleId: string
|
||||
protocolId?: string
|
||||
sampleCode?: string
|
||||
sampleStatus?: string
|
||||
voidDesc?: string
|
||||
protocolNo?: string
|
||||
sampleTypeName?: string
|
||||
motherName?: string
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<!-- 样本状态:标签 + 作废原因 -->
|
||||
<template>
|
||||
<span class="sample-status-tag">
|
||||
<el-tag :type="tagType" size="small">{{ label }}</el-tag>
|
||||
<el-popover placement="top" trigger="click" :width="240">
|
||||
<template #reference>
|
||||
<button type="button" class="sample-status-tag__q" aria-label="作废原因" @click.stop>
|
||||
<el-icon><QuestionFilled /></el-icon>
|
||||
</button>
|
||||
</template>
|
||||
<div class="sample-status-tag__reason">
|
||||
<div class="sample-status-tag__reason-title">作废原因</div>
|
||||
<div>{{ reasonText }}</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { QuestionFilled } from '@element-plus/icons-vue'
|
||||
import { sampleStatusLabel, sampleStatusTagType } from '@/utils/status-tag-registry'
|
||||
|
||||
defineOptions({ name: 'SampleStatusTag' })
|
||||
|
||||
const props = defineProps<{
|
||||
status?: string | null
|
||||
voidDesc?: string | null
|
||||
}>()
|
||||
|
||||
const code = computed(() => String(props.status || '').trim())
|
||||
const label = computed(() => (code.value ? sampleStatusLabel(code.value) : '—'))
|
||||
const tagType = computed(() => (code.value ? sampleStatusTagType(code.value) : 'info'))
|
||||
const reasonText = computed(() => String(props.voidDesc || '').trim() || '暂无作废原因')
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.sample-status-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.sample-status-tag__q {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
cursor: pointer;
|
||||
line-height: 1;
|
||||
font-size: 14px;
|
||||
|
||||
&:hover {
|
||||
color: #059669;
|
||||
}
|
||||
}
|
||||
|
||||
.sample-status-tag__reason-title {
|
||||
margin-bottom: 4px;
|
||||
font-size: 12px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,139 @@
|
||||
<!-- 样本废弃:填写作废原因后提交 -->
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
title="样本废弃"
|
||||
width="560px"
|
||||
class="dialog-form-layout"
|
||||
align-center
|
||||
append-to-body
|
||||
modal-class="protocol-dialog-mask"
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="top"
|
||||
class="biz-dialog-form"
|
||||
>
|
||||
<div class="form-grid-2">
|
||||
<el-form-item v-if="sampleCode" label="样本编码" class="form-col-span-2">
|
||||
<span class="sample-void-dialog__code">{{ sampleCode }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="作废原因" prop="voidDesc" class="form-col-span-2">
|
||||
<el-input
|
||||
v-model="form.voidDesc"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
maxlength="512"
|
||||
show-word-limit
|
||||
placeholder="请填写作废原因"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button class="btn-ghost" @click="handleClose">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" :loading="submitting" @click="handleSubmit">
|
||||
<el-icon><Check /></el-icon>确定
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import { Check, Close } from '@element-plus/icons-vue'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { fetchVoidBusinessSample, type SampleVoidTarget } from '@/api/business-sample'
|
||||
|
||||
defineOptions({ name: 'SampleVoidDialog' })
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
target: SampleVoidTarget | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:visible': [visible: boolean]
|
||||
success: []
|
||||
}>()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const submitting = ref(false)
|
||||
const formRef = ref<FormInstance>()
|
||||
const form = reactive({
|
||||
voidDesc: ''
|
||||
})
|
||||
|
||||
const rules: FormRules = {
|
||||
voidDesc: [
|
||||
{
|
||||
required: true,
|
||||
validator: (_rule, value, callback) => {
|
||||
if (!String(value || '').trim()) callback(new Error('请填写作废原因'))
|
||||
else callback()
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const sampleCode = computed(() => String(props.target?.sampleCode || '').trim())
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
dialogVisible.value = visible
|
||||
if (visible) form.voidDesc = ''
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
watch(dialogVisible, (visible) => {
|
||||
emit('update:visible', visible)
|
||||
})
|
||||
|
||||
function handleClose() {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
const target = props.target
|
||||
if (!target?.receptionSource || (!target.sampleId && !target.sampleCode)) {
|
||||
ElMessage.warning('缺少样本信息,无法废弃')
|
||||
return
|
||||
}
|
||||
const valid = await formRef.value?.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
submitting.value = true
|
||||
try {
|
||||
await fetchVoidBusinessSample({
|
||||
receptionSource: target.receptionSource,
|
||||
sampleId: target.sampleId,
|
||||
sampleCode: target.sampleCode,
|
||||
protocolId: target.protocolId,
|
||||
voidDesc: form.voidDesc.trim()
|
||||
})
|
||||
ElMessage.success('样本已废弃')
|
||||
emit('success')
|
||||
handleClose()
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.sample-void-dialog__code {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
</style>
|
||||
@@ -40,6 +40,7 @@ export const LAB_PROCESS_TABS: Array<{
|
||||
|
||||
const CELL_HSC_COLUMNS: LabColumn[] = [
|
||||
{ prop: 'cellCode', label: '细胞编码', minWidth: 140 },
|
||||
{ prop: 'sampleStatus', label: '样本状态', minWidth: 140 },
|
||||
{ prop: 'motherName', label: '准妈妈姓名', minWidth: 110 },
|
||||
{ prop: 'collectionTime', label: '采集时间', minWidth: 200 },
|
||||
{ prop: 'hospitalName', label: '采集医院', minWidth: 140 },
|
||||
@@ -72,6 +73,7 @@ const CELL_HSC_COLUMNS: LabColumn[] = [
|
||||
|
||||
const DONATION_HSC_COLUMNS: LabColumn[] = [
|
||||
{ prop: 'cellCode', label: '细胞编码', minWidth: 140 },
|
||||
{ prop: 'sampleStatus', label: '样本状态', minWidth: 140 },
|
||||
{ prop: 'motherName', label: '准妈妈姓名', minWidth: 110 },
|
||||
{ prop: 'labMaterialCode', label: '实验室物料编码', minWidth: 130 },
|
||||
{ prop: 'inboundCode', label: '入库编码', minWidth: 140 },
|
||||
@@ -98,6 +100,7 @@ const DONATION_HSC_COLUMNS: LabColumn[] = [
|
||||
|
||||
const MSC_COLUMNS: LabColumn[] = [
|
||||
{ prop: 'labFlowCode', label: '实验室流转编码', minWidth: 140 },
|
||||
{ prop: 'sampleStatus', label: '样本状态', minWidth: 140 },
|
||||
{ prop: 'motherName', label: '母亲姓名', minWidth: 110 },
|
||||
{ prop: 'cordCollectTime', label: '脐带采集时间', minWidth: 200 },
|
||||
{ prop: 'transportTempC', label: '运输温度/℃', minWidth: 110 },
|
||||
|
||||
@@ -14,7 +14,7 @@ import type { ProductionWorkOrderTabKey } from '@/utils/production-work-order-ta
|
||||
import { resolveTabKeyFromWorkOrder } from '@/utils/production-work-order-tabs'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
|
||||
export type CardMetaFieldKind = 'text' | 'tag'
|
||||
export type CardMetaFieldKind = 'text' | 'tag' | 'sample-status'
|
||||
|
||||
export type CardMetaField = {
|
||||
label: string
|
||||
@@ -84,6 +84,11 @@ function buildInboundMetaFields(tabKey: ProductionWorkOrderTabKey): CardMetaFiel
|
||||
return [
|
||||
{ label: '实验室入库编码', getValue: (row) => row.labStorageCode || '—' },
|
||||
{ label: '样本类型', getValue: (row) => row.sampleTypeName || '—' },
|
||||
{
|
||||
label: '样本状态',
|
||||
kind: 'sample-status',
|
||||
getValue: (row) => String(row.sampleStatus || '')
|
||||
},
|
||||
{ label: '接收经手人', getValue: (row) => row.handlerName || '—' },
|
||||
{ label: '接收时间', getValue: (row) => formatDisplayOrDash(row.receptionTime) },
|
||||
{
|
||||
|
||||
@@ -63,6 +63,19 @@ describe('flattenProtocolAuditRows', () => {
|
||||
assert.equal(rows[0].sampleCode, 'ZKZX34000199')
|
||||
})
|
||||
|
||||
it('passes sample status and sample void reason from sample items', () => {
|
||||
const rows = flattenProtocolAuditRows([
|
||||
{
|
||||
id: 'p-status',
|
||||
voidDesc: '协议作废',
|
||||
sampleItems: [{ sampleCode: 'S-VOID', sampleStatus: 'yzf', voidDesc: '样本破损' }]
|
||||
}
|
||||
])
|
||||
assert.equal(rows[0].voidDesc, '协议作废')
|
||||
assert.equal(rows[0].sampleStatus, 'yzf')
|
||||
assert.equal(rows[0].sampleVoidDesc, '样本破损')
|
||||
})
|
||||
|
||||
it('zero samples → one placeholder row, not co-stored', () => {
|
||||
const rows = flattenProtocolAuditRows([{ id: 'p2', protocolNo: 'ZKZX2', sampleItems: [] }])
|
||||
assert.equal(rows.length, 1)
|
||||
|
||||
@@ -34,6 +34,9 @@ export type ProtocolAuditFlatRow = {
|
||||
regionManagerUserName: string
|
||||
sampleTypeName: string
|
||||
sampleCode: string
|
||||
sampleStatus: string
|
||||
/** 样本作废原因;协议作废原因仍用 voidDesc */
|
||||
sampleVoidDesc: string
|
||||
labStorageCode: string
|
||||
transportType: string
|
||||
transportLabel: string
|
||||
@@ -120,6 +123,8 @@ export function flattenProtocolAuditRows(
|
||||
regionManagerUserName: str(protocol.regionManagerUserName),
|
||||
sampleTypeName: str(rec.sampleTypeName),
|
||||
sampleCode: str(rec.sampleCode),
|
||||
sampleStatus: str(rec.sampleStatus),
|
||||
sampleVoidDesc: str(rec.voidDesc),
|
||||
labStorageCode: str(rec.labStorageCode),
|
||||
transportType,
|
||||
transportLabel: '',
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
type QcWorkOrderProtocolGroupModel
|
||||
} from '@/utils/qc-work-order-groups'
|
||||
|
||||
export type CardMetaFieldKind = 'text' | 'tag'
|
||||
export type CardMetaFieldKind = 'text' | 'tag' | 'sample-status'
|
||||
|
||||
export type CardMetaField = {
|
||||
label: string
|
||||
@@ -134,6 +134,12 @@ const inboundGroupedFields: CardMetaField[] = [
|
||||
visible: (row) => (row.triggerSource || 'reception') === 'production'
|
||||
},
|
||||
{ label: '样本编码', getValue: (row) => row.sampleCode || '—', visible: isInboundUserInfoRow },
|
||||
{
|
||||
label: '样本状态',
|
||||
kind: 'sample-status',
|
||||
getValue: (row) => String(row.sampleStatus || ''),
|
||||
visible: isInboundUserInfoRow
|
||||
},
|
||||
{
|
||||
label: '样本类型',
|
||||
getValue: (row) => row.sampleTypeName || '—',
|
||||
|
||||
@@ -21,6 +21,8 @@ export type SampleFreightFlatRow = {
|
||||
motherName?: string
|
||||
newbornName?: string
|
||||
sampleCode?: string
|
||||
sampleStatus?: string
|
||||
voidDesc?: string
|
||||
sampleTypeName?: string
|
||||
sampleId?: string
|
||||
protocolId?: string
|
||||
@@ -53,6 +55,8 @@ export function flattenSampleFreights(list: SampleFreight[]): SampleFreightFlatR
|
||||
motherName: it?.motherName,
|
||||
newbornName: it?.newbornName,
|
||||
sampleCode: it?.sampleCode,
|
||||
sampleStatus: it?.sampleStatus,
|
||||
voidDesc: it?.voidDesc,
|
||||
sampleTypeName: it?.sampleTypeName,
|
||||
sampleId: it?.sampleId,
|
||||
protocolId: it?.protocolId,
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { describe, it } from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { isSampleAlreadyVoided, resolveSampleVoidTarget } from './sample-void'
|
||||
|
||||
describe('resolveSampleVoidTarget', () => {
|
||||
it('uses protocol sample id, code and protocol id', () => {
|
||||
const target = resolveSampleVoidTarget({
|
||||
receptionSource: 'cell_storage',
|
||||
protocolSampleId: 'ps-1',
|
||||
sampleCode: 'S1',
|
||||
collectionProtocolId: 'p-1'
|
||||
})
|
||||
assert.deepEqual(target, {
|
||||
receptionSource: 'cell_storage',
|
||||
sampleId: 'ps-1',
|
||||
sampleCode: 'S1',
|
||||
protocolId: 'p-1'
|
||||
})
|
||||
})
|
||||
|
||||
it('falls back to tab source when row source is empty', () => {
|
||||
const target = resolveSampleVoidTarget({
|
||||
sampleCode: 'S2',
|
||||
fallbackSource: 'research_donation'
|
||||
})
|
||||
assert.equal(target?.receptionSource, 'research_donation')
|
||||
assert.equal(target?.sampleCode, 'S2')
|
||||
})
|
||||
|
||||
it('returns null without a sample identifier', () => {
|
||||
assert.equal(resolveSampleVoidTarget({ receptionSource: 'cell_storage' }), null)
|
||||
})
|
||||
})
|
||||
|
||||
describe('isSampleAlreadyVoided', () => {
|
||||
it('matches yzf only', () => {
|
||||
assert.equal(isSampleAlreadyVoided('yzf'), true)
|
||||
assert.equal(isSampleAlreadyVoided(' yzf '), true)
|
||||
assert.equal(isSampleAlreadyVoided('ycj'), false)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,29 @@
|
||||
import type { SampleVoidTarget } from '../api/business-sample'
|
||||
|
||||
export function isSampleAlreadyVoided(status?: string | null): boolean {
|
||||
return String(status || '').trim() === 'yzf'
|
||||
}
|
||||
|
||||
export function resolveSampleVoidTarget(input: {
|
||||
receptionSource?: string | null
|
||||
protocolSampleId?: string | null
|
||||
sampleCode?: string | null
|
||||
collectionProtocolId?: string | null
|
||||
fallbackSource?: string | null
|
||||
}): SampleVoidTarget | null {
|
||||
let source = String(input.receptionSource || '').trim()
|
||||
if (source !== 'cell_storage' && source !== 'research_donation') {
|
||||
source = String(input.fallbackSource || '').trim()
|
||||
}
|
||||
if (source !== 'cell_storage' && source !== 'research_donation') return null
|
||||
const sampleId = String(input.protocolSampleId || '').trim()
|
||||
const sampleCode = String(input.sampleCode || '').trim()
|
||||
const protocolId = String(input.collectionProtocolId || '').trim()
|
||||
if (!sampleId && !sampleCode) return null
|
||||
return {
|
||||
receptionSource: source,
|
||||
sampleId: sampleId || undefined,
|
||||
sampleCode: sampleCode || undefined,
|
||||
protocolId: protocolId || undefined
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,11 @@
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="样本状态" min-width="140" align="center">
|
||||
<template #default="{ row }">
|
||||
<SampleStatusTag :status="row.sampleStatus" :void-desc="row.voidDesc" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="市场专员" min-width="110" align="center">
|
||||
<template #default="{ row }">{{ row.salesUserName || '—' }}</template>
|
||||
</el-table-column>
|
||||
@@ -265,6 +270,7 @@
|
||||
<script setup lang="ts">
|
||||
import { Search, RefreshLeft, Document, Close } from '@element-plus/icons-vue'
|
||||
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
|
||||
import SampleStatusTag from '@/components/business/sample-status-tag/index.vue'
|
||||
import ProtocolAttachmentReadonly from '../protocol/ProtocolAttachmentReadonly.vue'
|
||||
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
||||
import {
|
||||
|
||||
@@ -90,6 +90,11 @@
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="样本状态" min-width="140" align="center">
|
||||
<template #default="{ row }">
|
||||
<SampleStatusTag :status="row.sampleStatus" :void-desc="row.voidDesc" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="签署日期" min-width="110" align="center">
|
||||
<template #default="{ row }">{{ row.signDate || '—' }}</template>
|
||||
</el-table-column>
|
||||
@@ -295,6 +300,7 @@
|
||||
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
|
||||
import ProtocolAttachmentReadonly from '../protocol/ProtocolAttachmentReadonly.vue'
|
||||
import SamplePaymentDetailDialog from '@/components/business/sample-payment-detail-dialog/index.vue'
|
||||
import SampleStatusTag from '@/components/business/sample-status-tag/index.vue'
|
||||
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
||||
import { fetchSamplePaymentList, fetchSamplePaymentDetail } from '@/api/protocol-sample-payment'
|
||||
import { type CollectionProtocolRow } from '@/api/collection-protocol'
|
||||
|
||||
@@ -175,6 +175,11 @@
|
||||
<span class="mono">{{ row.labStorageCode || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="样本状态" min-width="140" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<SampleStatusTag :status="row.sampleStatus" :void-desc="row.sampleVoidDesc" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="协议状态" min-width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="donationStatusTagType(row.donationStatus)" size="small">
|
||||
@@ -415,6 +420,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import ProjectSelect from '@/components/business/ProjectSelect.vue'
|
||||
import SampleStatusTag from '@/components/business/sample-status-tag/index.vue'
|
||||
const projectFilter = ref('')
|
||||
const teamFilter = ref('')
|
||||
import { formatDisplayOrDash } from '@/utils/datetime-display'
|
||||
|
||||
@@ -197,6 +197,11 @@
|
||||
<span class="mono">{{ row.sampleCode || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="样本状态" min-width="140" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<SampleStatusTag :status="row.sampleStatus" :void-desc="row.sampleVoidDesc" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="sampleTypeName"
|
||||
label="样本类型"
|
||||
@@ -383,6 +388,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import ProjectSelect from '@/components/business/ProjectSelect.vue'
|
||||
import SampleStatusTag from '@/components/business/sample-status-tag/index.vue'
|
||||
const projectFilter = ref('')
|
||||
const teamFilter = ref('')
|
||||
import { formatDisplayOrDash } from '@/utils/datetime-display'
|
||||
|
||||
@@ -206,6 +206,11 @@
|
||||
<span class="cell-wrap-text">{{ row.sampleCode || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="样本状态" min-width="140" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<SampleStatusTag :status="row.sampleStatus" :void-desc="row.voidDesc" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="sampleTypeName"
|
||||
label="样本类型"
|
||||
@@ -320,6 +325,7 @@
|
||||
sampleFreightSpanMethod,
|
||||
type SampleFreightFlatRow
|
||||
} from '@/utils/sample-freight-flatten'
|
||||
import SampleStatusTag from '@/components/business/sample-status-tag/index.vue'
|
||||
import FreightConfigDialog from './FreightConfigDialog.vue'
|
||||
import FreightEditDialog from './FreightEditDialog.vue'
|
||||
|
||||
|
||||
@@ -207,6 +207,11 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="样本状态" min-width="140" align="center">
|
||||
<template #default="{ row }">
|
||||
<SampleStatusTag :status="row.sampleStatus" :void-desc="row.voidDesc" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="motherName" label="母亲姓名" min-width="100" align="center" />
|
||||
<el-table-column prop="motherPhone" label="母亲电话" min-width="120" align="center">
|
||||
<template #default="{ row }">{{ row.motherPhone || '—' }}</template>
|
||||
@@ -368,6 +373,11 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="样本状态" min-width="140" align="center">
|
||||
<template #default="{ row }">
|
||||
<SampleStatusTag :status="row.sampleStatus" :void-desc="row.voidDesc" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="labStorageCode" label="实验室入库编码" min-width="150" align="center">
|
||||
<template #default="{ row }">{{ row.labStorageCode || '—' }}</template>
|
||||
</el-table-column>
|
||||
@@ -503,6 +513,7 @@
|
||||
import ProtocolViewDialog from '@/views/cell-storage/protocol/ProtocolViewDialog.vue'
|
||||
import DonationViewDialog from '@/views/research-donation/list/DonationViewDialog.vue'
|
||||
import SampleCodeWithSpecialDisplay from '@/components/business/sample-code-with-special-display/index.vue'
|
||||
import SampleStatusTag from '@/components/business/sample-status-tag/index.vue'
|
||||
import SampleInfoQuickRegisterDialog from './SampleInfoQuickRegisterDialog.vue'
|
||||
import SampleCodeCorrectionDialog from './SampleCodeCorrectionDialog.vue'
|
||||
import {
|
||||
|
||||
+56
-1
@@ -105,6 +105,13 @@
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>样本接收信息填写
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="showSampleVoidButton(row)"
|
||||
class="btn-op-item"
|
||||
@click="openSampleVoidDialog(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>样本废弃
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="showCardComplete(row) && canComplete(row)"
|
||||
class="btn-op-item"
|
||||
@@ -169,8 +176,13 @@
|
||||
>
|
||||
<dt>{{ field.label }}</dt>
|
||||
<dd>
|
||||
<SampleStatusTag
|
||||
v-if="field.kind === 'sample-status'"
|
||||
:status="row.sampleStatus"
|
||||
:void-desc="row.voidDesc"
|
||||
/>
|
||||
<el-tag
|
||||
v-if="field.kind === 'tag'"
|
||||
v-else-if="field.kind === 'tag'"
|
||||
:type="field.getTagType?.(row) || 'info'"
|
||||
size="small"
|
||||
:class="{
|
||||
@@ -319,6 +331,11 @@
|
||||
:sample-code="storageCertQcSampleCode"
|
||||
:sample-type-name="storageCertQcSampleTypeName"
|
||||
/>
|
||||
<SampleVoidDialog
|
||||
v-model:visible="sampleVoidVisible"
|
||||
:target="sampleVoidTarget"
|
||||
@success="emit('sample-voided')"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -342,7 +359,11 @@
|
||||
import type { OutboundQcDetailProduct } from '@/api/qc-work-order'
|
||||
import type { ProductionWorkOrderCardMetaConfig } from '@/utils/production-work-order-card-meta'
|
||||
import SampleCodeWithSpecialDisplay from '@/components/business/sample-code-with-special-display/index.vue'
|
||||
import SampleStatusTag from '@/components/business/sample-status-tag/index.vue'
|
||||
import SampleVoidDialog from '@/components/business/sample-void-dialog/index.vue'
|
||||
import type { SampleVoidTarget } from '@/api/business-sample'
|
||||
import StorageCertQcDialog from '@/components/business/storage-cert-qc-dialog/index.vue'
|
||||
import { isSampleAlreadyVoided, resolveSampleVoidTarget } from '@/utils/sample-void'
|
||||
import { supportsStorageCertQc } from '@/utils/storage-cert-qc-fields'
|
||||
import {
|
||||
getCardMetaConfigForLegacyTab,
|
||||
@@ -411,6 +432,8 @@
|
||||
const storageCertQcVisible = ref(false)
|
||||
const storageCertQcSampleCode = ref('')
|
||||
const storageCertQcSampleTypeName = ref('')
|
||||
const sampleVoidVisible = ref(false)
|
||||
const sampleVoidTarget = ref<SampleVoidTarget | null>(null)
|
||||
|
||||
function showStorageCertQcButton(row: ProductionWorkOrderItem) {
|
||||
const tabKey = resolveEffectiveRowTabKey(listTabKey.value, row)
|
||||
@@ -463,6 +486,37 @@
|
||||
return INBOUND_SAMPLE_TITLE_TAB_KEYS.has(effectiveTabKey)
|
||||
}
|
||||
|
||||
function productionVoidFallbackSource(row: ProductionWorkOrderItem) {
|
||||
const tabKey = resolveEffectiveRowTabKey(listTabKey.value, row)
|
||||
if (tabKey === 'inbound_research_donation') return 'research_donation'
|
||||
if (tabKey === 'inbound_cell_storage') return 'cell_storage'
|
||||
return ''
|
||||
}
|
||||
|
||||
function showSampleVoidButton(row: ProductionWorkOrderItem) {
|
||||
if (!isInboundSampleTitle(row) || isSampleAlreadyVoided(row.sampleStatus)) return false
|
||||
return !!resolveSampleVoidTarget({
|
||||
receptionSource: row.receptionSource,
|
||||
protocolSampleId: row.protocolSampleId,
|
||||
sampleCode: row.sampleCode,
|
||||
collectionProtocolId: row.collectionProtocolId,
|
||||
fallbackSource: productionVoidFallbackSource(row)
|
||||
})
|
||||
}
|
||||
|
||||
function openSampleVoidDialog(row: ProductionWorkOrderItem) {
|
||||
const target = resolveSampleVoidTarget({
|
||||
receptionSource: row.receptionSource,
|
||||
protocolSampleId: row.protocolSampleId,
|
||||
sampleCode: row.sampleCode,
|
||||
collectionProtocolId: row.collectionProtocolId,
|
||||
fallbackSource: productionVoidFallbackSource(row)
|
||||
})
|
||||
if (!target) return
|
||||
sampleVoidTarget.value = target
|
||||
sampleVoidVisible.value = true
|
||||
}
|
||||
|
||||
function inboundCardTitleLab(row: ProductionWorkOrderItem) {
|
||||
return (row.labStorageCode || '').trim() || '—'
|
||||
}
|
||||
@@ -500,6 +554,7 @@
|
||||
'page-change': [page: number]
|
||||
'page-size-change': [size: number]
|
||||
'open-sample-reception': [row: ProductionWorkOrderItem]
|
||||
'sample-voided': []
|
||||
}>()
|
||||
|
||||
const showCardOpsRow = computed(() => true)
|
||||
|
||||
+6
@@ -198,6 +198,7 @@
|
||||
@tasks-changed="onTasksChanged"
|
||||
@counts-changed="onCountsChanged"
|
||||
@open-sample-reception="handleOpenSampleReception"
|
||||
@sample-voided="handleSampleVoided"
|
||||
@page-change="onWorkOrderPageChange"
|
||||
@page-size-change="onWorkOrderPageSizeChange"
|
||||
/>
|
||||
@@ -371,6 +372,11 @@
|
||||
emit('data-changed')
|
||||
}
|
||||
|
||||
function handleSampleVoided() {
|
||||
loadData()
|
||||
emit('data-changed')
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
reload: loadData,
|
||||
bumpTaskRefresh,
|
||||
|
||||
@@ -93,9 +93,16 @@
|
||||
:min-width="col.minWidth || 120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
:show-overflow-tooltip="col.prop !== 'sampleStatus'"
|
||||
>
|
||||
<template #default="{ row }">{{ displayCell(row[col.prop]) }}</template>
|
||||
<template #default="{ row }">
|
||||
<SampleStatusTag
|
||||
v-if="col.prop === 'sampleStatus'"
|
||||
:status="String(row.sampleStatus || '')"
|
||||
:void-desc="String(row.voidDesc || '')"
|
||||
/>
|
||||
<template v-else>{{ displayCell(row[col.prop]) }}</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
@@ -178,11 +185,13 @@
|
||||
saveLabSampleProcessSupplement,
|
||||
type LabSampleProcessTabKey
|
||||
} from '@/api/lab-sample-process'
|
||||
import SampleStatusTag from '@/components/business/sample-status-tag/index.vue'
|
||||
import {
|
||||
LAB_PROCESS_COLUMNS,
|
||||
LAB_PROCESS_TABS,
|
||||
SUPPLEMENT_FIELD_LABELS
|
||||
} from '@/utils/lab-sample-process-columns'
|
||||
import { sampleStatusLabel } from '@/utils/status-tag-registry'
|
||||
|
||||
defineOptions({ name: 'QualityInspectionLabSampleProcess' })
|
||||
|
||||
@@ -274,9 +283,9 @@
|
||||
supplementForm.receptionSource = meta.source
|
||||
supplementForm.sampleTypeName = meta.sampleTypeName
|
||||
supplementForm.remark = ''
|
||||
const keys = supplementKeys.value.length
|
||||
? supplementKeys.value
|
||||
: currentColumns.value.map((c) => c.prop)
|
||||
const keys = (
|
||||
supplementKeys.value.length ? supplementKeys.value : currentColumns.value.map((c) => c.prop)
|
||||
).filter((k) => k !== 'sampleStatus' && k !== 'voidDesc')
|
||||
const payload: Record<string, string> = {}
|
||||
keys.forEach((k) => {
|
||||
payload[k] = ''
|
||||
@@ -324,6 +333,10 @@
|
||||
}
|
||||
cols.forEach((c) => {
|
||||
const v = row[c.prop]
|
||||
if (c.prop === 'sampleStatus') {
|
||||
line[c.label] = v ? sampleStatusLabel(String(v)) : ''
|
||||
return
|
||||
}
|
||||
line[c.label] = v === null || v === undefined || v === '' ? '' : String(v)
|
||||
})
|
||||
return line
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
@command="(cmd, row) => emit('command', cmd, row)"
|
||||
@tasks-changed="emit('tasks-changed')"
|
||||
@sample-special-changed="emit('sample-special-changed')"
|
||||
@sample-voided="emit('sample-voided')"
|
||||
/>
|
||||
<QcWorkOrderSampleGroup
|
||||
v-for="ins in insertedCardsAfter(allTabInboundAnchorId(item.group))"
|
||||
@@ -49,6 +50,7 @@
|
||||
@command="(cmd, row) => emit('command', cmd, row)"
|
||||
@tasks-changed="emit('tasks-changed')"
|
||||
@sample-special-changed="emit('sample-special-changed')"
|
||||
@sample-voided="emit('sample-voided')"
|
||||
/>
|
||||
</template>
|
||||
<QcWorkOrderSingleCard
|
||||
@@ -69,6 +71,7 @@
|
||||
@command="(cmd, row) => emit('command', cmd, row)"
|
||||
@tasks-changed="emit('tasks-changed')"
|
||||
@sample-special-changed="emit('sample-special-changed')"
|
||||
@sample-voided="emit('sample-voided')"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
@@ -96,6 +99,7 @@
|
||||
@command="(cmd, row) => emit('command', cmd, row)"
|
||||
@tasks-changed="emit('tasks-changed')"
|
||||
@sample-special-changed="emit('sample-special-changed')"
|
||||
@sample-voided="emit('sample-voided')"
|
||||
/>
|
||||
<QcWorkOrderSampleGroup
|
||||
v-for="ins in insertedCardsAfter(item.cardAnchorId)"
|
||||
@@ -120,6 +124,7 @@
|
||||
@command="(cmd, row) => emit('command', cmd, row)"
|
||||
@tasks-changed="emit('tasks-changed')"
|
||||
@sample-special-changed="emit('sample-special-changed')"
|
||||
@sample-voided="emit('sample-voided')"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
@@ -141,6 +146,7 @@
|
||||
@command="(cmd, row) => emit('command', cmd, row)"
|
||||
@tasks-changed="emit('tasks-changed')"
|
||||
@sample-special-changed="emit('sample-special-changed')"
|
||||
@sample-voided="emit('sample-voided')"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
@@ -163,6 +169,7 @@
|
||||
@command="(cmd, row) => emit('command', cmd, row)"
|
||||
@tasks-changed="emit('tasks-changed')"
|
||||
@sample-special-changed="emit('sample-special-changed')"
|
||||
@sample-voided="emit('sample-voided')"
|
||||
/>
|
||||
</template>
|
||||
<el-empty
|
||||
@@ -252,6 +259,7 @@
|
||||
command: [cmd: string, row: QcWorkOrder]
|
||||
'tasks-changed': []
|
||||
'sample-special-changed': []
|
||||
'sample-voided': []
|
||||
'page-change': [page: number]
|
||||
'page-size-change': [size: number]
|
||||
'sibling-navigate': [payload: InboundSiblingNavigatePayload]
|
||||
|
||||
@@ -115,6 +115,7 @@
|
||||
@command="(cmd, row) => emit('command', cmd, row)"
|
||||
@tasks-changed="emit('tasks-changed')"
|
||||
@sample-special-changed="emit('sample-special-changed')"
|
||||
@sample-voided="emit('sample-voided')"
|
||||
/>
|
||||
|
||||
<SampleSpecialMarkDialog
|
||||
@@ -181,6 +182,7 @@
|
||||
command: [cmd: string, row: QcWorkOrder]
|
||||
'tasks-changed': []
|
||||
'sample-special-changed': []
|
||||
'sample-voided': []
|
||||
}>()
|
||||
|
||||
const sampleSpecialDialogVisible = ref(false)
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
@command="(cmd, row) => emit('command', cmd, row)"
|
||||
@tasks-changed="emit('tasks-changed')"
|
||||
@sample-special-changed="emit('sample-special-changed')"
|
||||
@sample-voided="emit('sample-voided')"
|
||||
/>
|
||||
|
||||
<SampleSpecialMarkDialog
|
||||
@@ -201,6 +202,7 @@
|
||||
command: [cmd: string, row: QcWorkOrder]
|
||||
'tasks-changed': []
|
||||
'sample-special-changed': []
|
||||
'sample-voided': []
|
||||
'sibling-navigate': [payload: InboundSiblingNavigatePayload]
|
||||
}>()
|
||||
|
||||
|
||||
@@ -64,8 +64,13 @@
|
||||
>
|
||||
<dt>{{ field.label }}</dt>
|
||||
<dd>
|
||||
<SampleStatusTag
|
||||
v-if="field.kind === 'sample-status'"
|
||||
:status="row.sampleStatus"
|
||||
:void-desc="row.voidDesc"
|
||||
/>
|
||||
<el-tag
|
||||
v-if="field.kind === 'tag'"
|
||||
v-else-if="field.kind === 'tag'"
|
||||
:type="field.getTagType?.(row) || 'info'"
|
||||
size="small"
|
||||
>
|
||||
@@ -162,6 +167,13 @@
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>特殊样本
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="showSampleVoidButton"
|
||||
class="btn-op-item"
|
||||
@click="openSampleVoidDialog"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>样本废弃
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="showStorageCertQcButton"
|
||||
class="btn-op-item"
|
||||
@@ -190,6 +202,13 @@
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>特殊样本
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="showSampleVoidButton"
|
||||
class="btn-op-item"
|
||||
@click="openSampleVoidDialog"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>样本废弃
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="showStorageCertQcButton"
|
||||
class="btn-op-item"
|
||||
@@ -254,6 +273,11 @@
|
||||
:target="sampleSpecialMarkTarget"
|
||||
@success="emit('sample-special-changed')"
|
||||
/>
|
||||
<SampleVoidDialog
|
||||
v-model:visible="sampleVoidDialogVisible"
|
||||
:target="sampleVoidTarget"
|
||||
@success="emit('sample-voided')"
|
||||
/>
|
||||
<StorageCertQcDialog
|
||||
v-model:visible="storageCertQcVisible"
|
||||
mode="edit"
|
||||
@@ -302,7 +326,11 @@
|
||||
import QcWorkOrderProtocolPaymentPanel from './QcWorkOrderProtocolPaymentPanel.vue'
|
||||
import SampleCodeWithSpecialDisplay from '@/components/business/sample-code-with-special-display/index.vue'
|
||||
import SampleSpecialMarkDialog from '@/components/business/sample-special-mark-dialog/index.vue'
|
||||
import SampleStatusTag from '@/components/business/sample-status-tag/index.vue'
|
||||
import SampleVoidDialog from '@/components/business/sample-void-dialog/index.vue'
|
||||
import type { SampleVoidTarget } from '@/api/business-sample'
|
||||
import { resolveInboundSampleSpecialMarkTargetFromRow } from '@/utils/inbound-sample-special-mark'
|
||||
import { isSampleAlreadyVoided, resolveSampleVoidTarget } from '@/utils/sample-void'
|
||||
import QcWorkOrderSelectCheckbox from './QcWorkOrderSelectCheckbox.vue'
|
||||
|
||||
defineOptions({ name: 'QcWorkOrderSingleCard' })
|
||||
@@ -340,9 +368,12 @@
|
||||
command: [cmd: string, row: QcWorkOrder]
|
||||
'tasks-changed': []
|
||||
'sample-special-changed': []
|
||||
'sample-voided': []
|
||||
}>()
|
||||
|
||||
const sampleSpecialDialogVisible = ref(false)
|
||||
const sampleVoidDialogVisible = ref(false)
|
||||
const sampleVoidTarget = ref<SampleVoidTarget | null>(null)
|
||||
const storageCertQcVisible = ref(false)
|
||||
|
||||
const showStorageCertQcButton = computed(() => {
|
||||
@@ -377,6 +408,32 @@
|
||||
resolveEffectiveRowTabKey(props.cardMetaConfig.tabKey, props.row)
|
||||
)
|
||||
|
||||
function inboundVoidFallbackSource() {
|
||||
if (effectiveRowTabKey.value === 'inbound_research_donation') return 'research_donation'
|
||||
if (effectiveRowTabKey.value === 'inbound_cell_storage') return 'cell_storage'
|
||||
return ''
|
||||
}
|
||||
|
||||
const sampleVoidResolved = computed(() =>
|
||||
resolveSampleVoidTarget({
|
||||
receptionSource: props.row.receptionSource,
|
||||
protocolSampleId: props.row.protocolSampleId,
|
||||
sampleCode: props.row.sampleCode,
|
||||
collectionProtocolId: props.row.collectionProtocolId,
|
||||
fallbackSource: inboundVoidFallbackSource()
|
||||
})
|
||||
)
|
||||
|
||||
const showSampleVoidButton = computed(
|
||||
() => !!sampleVoidResolved.value && !isSampleAlreadyVoided(props.row.sampleStatus)
|
||||
)
|
||||
|
||||
function openSampleVoidDialog() {
|
||||
if (!sampleVoidResolved.value) return
|
||||
sampleVoidTarget.value = sampleVoidResolved.value
|
||||
sampleVoidDialogVisible.value = true
|
||||
}
|
||||
|
||||
const visibleMetaFields = computed(() =>
|
||||
effectiveCardMeta.value.metaFields.filter((field) => !field.visible || field.visible(props.row))
|
||||
)
|
||||
|
||||
@@ -362,6 +362,7 @@
|
||||
@command="handleCommand"
|
||||
@tasks-changed="onWorkOrderTasksChanged"
|
||||
@sample-special-changed="onSampleSpecialChanged"
|
||||
@sample-voided="onSampleVoided"
|
||||
@page-change="handleWorkOrderPageChange"
|
||||
@page-size-change="handleWorkOrderPageSizeChange"
|
||||
/>
|
||||
@@ -560,6 +561,11 @@
|
||||
emit('data-changed')
|
||||
}
|
||||
|
||||
async function onSampleVoided() {
|
||||
await loadData()
|
||||
emit('data-changed')
|
||||
}
|
||||
|
||||
function handleCommand(command: string, row: QcWorkOrder) {
|
||||
if (command === 'view') {
|
||||
handleView(row)
|
||||
|
||||
Reference in new issue
Block a user