feat(production): 临床科研出库细胞改由生产确认

市场出库交接对 basic_experiment 保留细胞只读并不改库存;生产工单新增确认出库细胞 API/弹窗,从细胞产品库勾选并联动已售状态。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-11-20 17:03:45 +08:00
1 parent 4de69c37ff
commit f3672d3cc2
11 files changed
+713 -55

No files matched your search

@@ -316,3 +316,45 @@ export function fetchMineProductionWorkOrderTabStepCountsDeduped() {
}
return mineTabStepCountsInflight
}
/** 临床科研出库工单 — 交付出库细胞 */
export type ProductionDeliveryCellOutbound = {
workOrderId?: string
workOrderNo?: string
infusionScheduleId?: string
scheduleSummary?: {
applicationNo?: string
patientName?: string
infusionTime?: string
projectTitle?: string
customerName?: string
}
cells?: Array<{
cellProductId?: string
productCode?: string
productName?: string
productTypeName?: string
specName?: string
passage?: string
batchNo?: string
storageSlotName?: string
productStatus?: string
remark?: string
}>
}
export function fetchProductionDeliveryCellOutbound(workOrderId: string) {
return request.get<ProductionDeliveryCellOutbound>({
url: `/web/admin/production-work-orders/${workOrderId}/delivery-cell-outbound`
})
}
export function saveProductionDeliveryCellOutbound(
workOrderId: string,
data: { cells: Array<{ cellProductId: string; remark?: string }> }
) {
return request.put<ProductionDeliveryCellOutbound>({
url: `/web/admin/production-work-orders/${workOrderId}/delivery-cell-outbound`,
data
})
}
@@ -4,10 +4,16 @@
<div class="outbound-material-form-sections">
<div class="material-sections">
<!-- 出库细胞 -->
<section class="section-card">
<section v-if="showCells" class="section-card">
<div class="section-head">
<h3 class="section-title section-title--mint-bar">出库细胞</h3>
<el-button type="primary" size="small" class="btn-main" @click="openCellSelect">
<el-button
v-if="!cellsReadonly"
type="primary"
size="small"
class="btn-main"
@click="openCellSelect"
>
<el-icon><Plus /></el-icon>
添加细胞产品
</el-button>
@@ -18,7 +24,7 @@
class="list-table inner-table"
stripe
max-height="280"
empty-text="请从细胞产品库勾选"
:empty-text="cellsReadonly ? '暂无生产确认的出库细胞' : '请从细胞产品库勾选'"
>
<el-table-column type="index" label="序号" min-width="56" align="center" />
<el-table-column
@@ -56,7 +62,13 @@
<span v-else>—</span>
</template>
</el-table-column>
<el-table-column label="操作" min-width="80" align="center" fixed="right">
<el-table-column
v-if="!cellsReadonly"
label="操作"
min-width="80"
align="center"
fixed="right"
>
<template #default="{ $index }">
<el-button type="danger" link size="small" @click="removeCellRow($index)">
<el-icon><Delete /></el-icon>
@@ -69,7 +81,7 @@
</section>
<!-- 使用的物料 -->
<section class="section-card">
<section v-if="showMaterials" class="section-card">
<div class="section-head">
<h3 class="section-title section-title--mint-bar">使用的物料</h3>
<el-button type="primary" size="small" class="btn-main" @click="addMaterialRow">
@@ -145,7 +157,7 @@
</section>
<!-- 纸质材料 -->
<section class="section-card">
<section v-if="showPapers" class="section-card">
<div class="section-head">
<h3 class="section-title section-title--mint-bar">纸质材料</h3>
<el-button type="primary" size="small" class="btn-main" @click="addPaperRow">
@@ -289,7 +301,7 @@
<p v-else class="section-empty-hint">点击「添加纸质材料」逐条填写名称、份数并上传附件;仅作台账留存,不扣库存</p>
</section>
<el-form label-position="top" class="biz-dialog-form">
<el-form v-if="showRemark" label-position="top" class="biz-dialog-form">
<el-form-item label="备注">
<el-input
v-model="formRemark"
@@ -424,9 +436,20 @@
defineProps<{
/** 出库交接等需扣库存场景:仅允许选择已冻存细胞,且已选行保留可选 */
requireFrozenCellProduct?: boolean
/** 临床科研市场交接:细胞由生产确认,仅只读展示 */
cellsReadonly?: boolean
showCells?: boolean
showMaterials?: boolean
showPapers?: boolean
showRemark?: boolean
}>(),
{
requireFrozenCellProduct: false
requireFrozenCellProduct: false,
cellsReadonly: false,
showCells: true,
showMaterials: true,
showPapers: true,
showRemark: true
}
)
@@ -785,34 +808,38 @@
}
function validateMaterial() {
if (paperRows.value.some((r) => r._uploading)) {
if (props.showPapers && paperRows.value.some((r) => r._uploading)) {
ElMessage.warning('纸质材料附件上传中,请稍候')
return false
}
for (const row of materialRows.value) {
if (!row.materialId) {
ElMessage.warning('请为每条物料选择名称')
return false
}
const qty = row.qty
if (qty == null || !Number.isFinite(Number(qty)) || Number(qty) <= 0) {
ElMessage.warning('物料计划用量须大于 0')
return false
if (props.showMaterials) {
for (const row of materialRows.value) {
if (!row.materialId) {
ElMessage.warning('请为每条物料选择名称')
return false
}
const qty = row.qty
if (qty == null || !Number.isFinite(Number(qty)) || Number(qty) <= 0) {
ElMessage.warning('物料计划用量须大于 0')
return false
}
}
}
for (const row of paperRows.value) {
if (!row.paperName?.trim()) {
ElMessage.warning('请填写每条纸质材料的名称')
return false
}
const copies = row.copies
if (copies == null || !Number.isFinite(Number(copies)) || Number(copies) <= 0) {
ElMessage.warning('纸质材料份数须大于 0')
return false
}
if (!row.attachments.length) {
ElMessage.warning('请为每条纸质材料上传附件')
return false
if (props.showPapers) {
for (const row of paperRows.value) {
if (!row.paperName?.trim()) {
ElMessage.warning('请填写每条纸质材料的名称')
return false
}
const copies = row.copies
if (copies == null || !Number.isFinite(Number(copies)) || Number(copies) <= 0) {
ElMessage.warning('纸质材料份数须大于 0')
return false
}
if (!row.attachments.length) {
ElMessage.warning('请为每条纸质材料上传附件')
return false
}
}
}
return true
@@ -31,7 +31,11 @@
</div>
<div v-loading="loading" class="handover-body">
<OutboundMaterialFormSections ref="materialSectionsRef" require-frozen-cell-product />
<OutboundMaterialFormSections
ref="materialSectionsRef"
require-frozen-cell-product
:cells-readonly="isBasicExperiment"
/>
<section class="section-card handover-form-section">
<h3 class="section-title section-title--mint-bar">交接信息</h3>
@@ -264,6 +268,9 @@
const pickupTimeLabel = computed(
() => getPilotBizConfig(resolvePilotBizType(props.bizType)).pickupTimeLabel
)
const isBasicExperiment = computed(
() => resolvePilotBizType(props.bizType) === 'basic_experiment'
)
const emit = defineEmits<{
(e: 'update:modelValue', val: boolean): void
@@ -0,0 +1,185 @@
<!-- 临床科研出库工单 — 确认出库细胞 -->
<!-- eslint-disable vue/no-v-model-argument vue/no-multiple-template-root -->
<template>
<el-dialog
:model-value="modelValue"
title="确认出库细胞"
width="1100px"
class="dialog-form-layout production-delivery-cell-outbound-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="handleClosed"
>
<div v-if="scheduleSummary" class="material-summary">
<div class="material-summary-row">
<span class="material-summary-label">工单号</span>
<span class="material-summary-value">{{ workOrderNo || '—' }}</span>
</div>
<div class="material-summary-row">
<span class="material-summary-label">申请单号</span>
<span class="material-summary-value">{{ scheduleSummary.applicationNo || '—' }}</span>
</div>
<div class="material-summary-row">
<span class="material-summary-label">课题名称</span>
<span class="material-summary-value">{{ scheduleSummary.projectTitle || '—' }}</span>
</div>
<div class="material-summary-row">
<span class="material-summary-label">客户名称</span>
<span class="material-summary-value">{{ scheduleSummary.customerName || '—' }}</span>
</div>
<div class="material-summary-row">
<span class="material-summary-label">交付时间</span>
<span class="material-summary-value">{{ scheduleSummary.infusionTime || '—' }}</span>
</div>
</div>
<div v-loading="loading" class="outbound-body">
<OutboundMaterialFormSections
ref="materialSectionsRef"
require-frozen-cell-product
:show-materials="false"
:show-papers="false"
:show-remark="false"
/>
</div>
<template #footer>
<el-button class="btn-ghost" @click="emit('update:modelValue', false)">
<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 { nextTick, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { Check, Close } from '@element-plus/icons-vue'
import {
fetchProductionDeliveryCellOutbound,
saveProductionDeliveryCellOutbound
} from '@/api/production-work-order'
import OutboundMaterialFormSections from '@/components/business/outbound-material-form-sections/index.vue'
defineOptions({ name: 'ProductionDeliveryCellOutboundDialog' })
const props = defineProps<{
modelValue: boolean
workOrderId: string
}>()
const emit = defineEmits<{
(e: 'update:modelValue', val: boolean): void
(e: 'saved'): void
}>()
const materialSectionsRef = ref<InstanceType<typeof OutboundMaterialFormSections> | null>(null)
const loading = ref(false)
const submitting = ref(false)
const workOrderNo = ref('')
const scheduleSummary = ref<{
applicationNo?: string
patientName?: string
infusionTime?: string
projectTitle?: string
customerName?: string
} | null>(null)
async function loadData() {
if (!props.workOrderId) return
loading.value = true
try {
const data = await fetchProductionDeliveryCellOutbound(props.workOrderId)
workOrderNo.value = data.workOrderNo || ''
scheduleSummary.value = data.scheduleSummary || null
await nextTick()
materialSectionsRef.value?.loadFromApiData({
cells: data.cells as any
})
} catch (e: any) {
ElMessage.error(e?.message || '加载出库细胞失败')
emit('update:modelValue', false)
} finally {
loading.value = false
}
}
async function handleSubmit() {
if (!props.workOrderId) return
if (!materialSectionsRef.value?.validateMaterial()) return
const payload = materialSectionsRef.value.buildSavePayload()
submitting.value = true
try {
await saveProductionDeliveryCellOutbound(props.workOrderId, {
cells: (payload.cells || []).map((c: { cellProductId: string; remark?: string }) => ({
cellProductId: c.cellProductId,
remark: c.remark
}))
})
ElMessage.success('出库细胞已确认')
emit('saved')
emit('update:modelValue', false)
} catch (e: any) {
ElMessage.error(e?.message || '确认出库失败')
} finally {
submitting.value = false
}
}
function handleClosed() {
workOrderNo.value = ''
scheduleSummary.value = null
materialSectionsRef.value?.resetState()
}
watch(
() => props.modelValue,
(visible) => {
if (visible) void loadData()
}
)
</script>
<style scoped lang="scss">
.material-summary {
margin-bottom: 16px;
padding: 12px 16px;
background: var(--el-fill-color-lighter);
border-radius: 8px;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px 24px;
}
.material-summary-row {
display: flex;
gap: 8px;
min-width: 0;
}
.material-summary-label {
flex: 0 0 auto;
color: var(--el-text-color-secondary);
}
.material-summary-value {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.outbound-body {
min-height: 160px;
}
</style>
@@ -75,6 +75,13 @@
<el-button class="btn-op-item" @click="emit('view-qc', row)">
<el-icon><DataLine /></el-icon>查看质检数据
</el-button>
<el-button
v-if="showDeliveryCellOutbound(row)"
class="btn-op-item"
@click="emit('delivery-cell-outbound', row)"
>
<el-icon><Box /></el-icon>确认出库细胞
</el-button>
<el-button
v-if="showStorageCertQcButton(row)"
class="btn-op-item"
@@ -353,7 +360,8 @@
ArrowDown,
ArrowUp,
DataLine,
FolderAdd
FolderAdd,
Box
} from '@element-plus/icons-vue'
import type { ProductionWorkOrderItem } from '@/api/production-work-order'
import type { OutboundQcDetailProduct } from '@/api/qc-work-order'
@@ -545,6 +553,7 @@
const emit = defineEmits<{
view: [row: ProductionWorkOrderItem]
'view-qc': [row: ProductionWorkOrderItem]
'delivery-cell-outbound': [row: ProductionWorkOrderItem]
dispatch: [row: ProductionWorkOrderItem]
'dispatch-qc': [row: ProductionWorkOrderItem]
complete: [row: ProductionWorkOrderItem]
@@ -649,6 +658,14 @@
return row.workOrderStatus === 'dpz' || row.workOrderStatus === 'jxz'
}
function showDeliveryCellOutbound(row: ProductionWorkOrderItem) {
if (isMineMode.value) return false
if (row.workOrderStatus === 'yzf') return false
const tabKey = resolveEffectiveRowTabKey(listTabKey.value, row)
if (tabKey === 'outbound_basic_experiment') return true
return row.bizType === 'basic_experiment' && (row.workOrderType || '') === 'outbound'
}
function canVoidWorkOrder(row: ProductionWorkOrderItem) {
return row.workOrderStatus === 'dpz' || row.workOrderStatus === 'jxz'
}
@@ -189,6 +189,7 @@
:tasks-batch-loading="tasksBatchLoading"
@view="handleView"
@view-qc="handleViewQc"
@delivery-cell-outbound="handleDeliveryCellOutbound"
@dispatch="(row) => emit('dispatch', row)"
@dispatch-qc="(row) => emit('dispatch-qc', row)"
@complete="(row) => emit('complete', row)"
@@ -229,6 +230,12 @@
:tasks="saveSetTasks"
:lab-storage-code="saveSetLabStorageCode"
/>
<ProductionDeliveryCellOutboundDialog
v-model="deliveryCellOutboundVisible"
:work-order-id="deliveryCellOutboundWorkOrderId"
@saved="handleDeliveryCellOutboundSaved"
/>
</div>
</template>
@@ -242,6 +249,7 @@
import { PRODUCTION_WORK_ORDER_STATUS_FILTER_OPTIONS } from '@/utils/status-tag-registry'
import ProductionWorkOrderCardList from '../ProductionWorkOrderCardList.vue'
import ProductionWorkOrderQcViewDialog from '../ProductionWorkOrderQcViewDialog.vue'
import ProductionDeliveryCellOutboundDialog from '../ProductionDeliveryCellOutboundDialog.vue'
import SampleReceptionDialog from '../SampleReceptionDialog.vue'
import SaveProductionTaskSetDialog from '../SaveProductionTaskSetDialog.vue'
import { PRODUCTION_WORK_ORDER_VIEW_DIALOG_COMPONENTS } from '../view-dialogs/view-dialog-registry'
@@ -283,6 +291,8 @@
const saveSetLabStorageCode = computed(() =>
resolveWorkOrderLabStorageCode(saveSetRow.value)
)
const deliveryCellOutboundVisible = ref(false)
const deliveryCellOutboundWorkOrderId = ref('')
const {
cardMetaConfig,
@@ -366,6 +376,16 @@
qcViewVisible.value = true
}
function handleDeliveryCellOutbound(row: ProductionWorkOrderItem) {
deliveryCellOutboundWorkOrderId.value = row.id || ''
deliveryCellOutboundVisible.value = true
}
function handleDeliveryCellOutboundSaved() {
loadData()
emit('data-changed')
}
function handleSampleReceptionSuccess() {
bumpTaskRefresh()
loadData()