提交
This commit is contained in:
1 parent
19de2040d0
commit
3779de12ce
78 files changed
+23068
-13824
No files matched your search
@@ -31,6 +31,7 @@
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option label="已冻存" value="frozen" />
|
||||
<el-option label="生产中" value="in_production" />
|
||||
<el-option label="已售卖" value="sold" />
|
||||
<el-option label="已使用" value="used" />
|
||||
<el-option label="已作废" value="voided" />
|
||||
@@ -680,9 +681,11 @@
|
||||
function productStatusTag(status: string) {
|
||||
const map: Record<string, { label: string; type: string }> = {
|
||||
frozen: { label: '已冻存', type: 'success' },
|
||||
in_production: { label: '生产中', type: 'warning' },
|
||||
sold: { label: '已售卖', type: 'warning' },
|
||||
used: { label: '已使用', type: 'info' },
|
||||
voided: { label: '已作废', type: 'danger' },
|
||||
thawed: { label: '已复苏', type: 'info' },
|
||||
}
|
||||
return map[status] || { label: status, type: 'info' }
|
||||
}
|
||||
@@ -724,6 +727,8 @@
|
||||
/* ---- 编辑时状态选项 ---- */
|
||||
const editStatusOptions = [
|
||||
{ label: '已冻存', value: 'frozen' },
|
||||
{ label: '生产中', value: 'in_production' },
|
||||
{ label: '已复苏', value: 'thawed' },
|
||||
{ label: '已售卖', value: 'sold' },
|
||||
{ label: '已使用', value: 'used' },
|
||||
{ label: '已作废', value: 'voided' },
|
||||
@@ -1190,7 +1195,7 @@
|
||||
submitLoading.value = true
|
||||
try {
|
||||
syncImagesToForm()
|
||||
const shared = {
|
||||
const shared: Record<string, any> = {
|
||||
productName: formData.productName.trim(),
|
||||
productTypeId: formData.productTypeId || undefined,
|
||||
specId: formData.specId || undefined,
|
||||
@@ -1201,10 +1206,14 @@
|
||||
freezeDate: formData.freezeDate || undefined,
|
||||
unit: formData.unit?.trim() || undefined,
|
||||
expiryDate: formData.expiryDate || undefined,
|
||||
productStatus: formData.productStatus || undefined,
|
||||
productImages: formData.productImages?.trim() || undefined,
|
||||
remark: formData.remark?.trim() || undefined,
|
||||
}
|
||||
// 仅「已冻存」可变更状态;生产中/已复苏等系统态勿提交,避免后端校验失败
|
||||
const editableStatuses = ['frozen', 'sold', 'used', 'voided']
|
||||
if (!isEdit.value || editableStatuses.includes(formData.productStatus)) {
|
||||
shared.productStatus = formData.productStatus || undefined
|
||||
}
|
||||
if (isEdit.value && editingId.value) {
|
||||
await fetchUpdateCellProduct(editingId.value, {
|
||||
...shared,
|
||||
|
||||
@@ -50,13 +50,14 @@
|
||||
<el-form label-position="top" class="route-config-step-form">
|
||||
<div class="form-grid-4">
|
||||
<el-form-item label="工序名称">
|
||||
<el-input v-model="editor.selectedStep.value.processName" />
|
||||
<el-input v-model="editor.selectedStep.value.processName" :disabled="readonly" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工序分类">
|
||||
<el-select
|
||||
v-model="editor.selectedStep.value.categoryId"
|
||||
placeholder="选择分类"
|
||||
clearable
|
||||
:disabled="readonly"
|
||||
>
|
||||
<el-option
|
||||
v-for="cat in editor.categoryOptions.value"
|
||||
@@ -67,10 +68,14 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称">
|
||||
<el-input v-model="editor.selectedStep.value.equipmentName" />
|
||||
<el-input v-model="editor.selectedStep.value.equipmentName" :disabled="readonly" />
|
||||
</el-form-item>
|
||||
<el-form-item label="预计时长(min)">
|
||||
<el-input v-model="editor.selectedStep.value.estimatedDuration" placeholder="如 2h" />
|
||||
<el-input
|
||||
v-model="editor.selectedStep.value.estimatedDuration"
|
||||
placeholder="如 2h"
|
||||
:disabled="readonly"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" class="step-form-col-half">
|
||||
<el-input
|
||||
@@ -78,6 +83,7 @@
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
placeholder="工序描述"
|
||||
:disabled="readonly"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联SOP" class="step-form-col-half">
|
||||
@@ -86,6 +92,7 @@
|
||||
multiple
|
||||
placeholder="选择SOP文档"
|
||||
filterable
|
||||
:disabled="readonly"
|
||||
@change="editor.onSopIdsChange"
|
||||
>
|
||||
<el-option
|
||||
@@ -111,7 +118,7 @@
|
||||
|
||||
<el-tabs v-model="editor.activeSubTab.value" class="route-config-tabs">
|
||||
<el-tab-pane label="试剂" name="reagent">
|
||||
<div class="route-config-tab-toolbar">
|
||||
<div v-if="!readonly" class="route-config-tab-toolbar">
|
||||
<el-button class="btn-main" type="primary" size="small" @click="editor.addReagentRow">
|
||||
<el-icon><Plus /></el-icon>添加试剂
|
||||
</el-button>
|
||||
@@ -119,8 +126,8 @@
|
||||
<el-table
|
||||
:data="editor.selectedStep.value.reagents"
|
||||
stripe
|
||||
class="inner-table"
|
||||
max-height="300"
|
||||
class="list-table inner-table"
|
||||
max-height="400"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
@@ -129,14 +136,21 @@
|
||||
align="center"
|
||||
:index="(i: number) => i + 1"
|
||||
/>
|
||||
<el-table-column label="试剂编码" min-width="110" align="center">
|
||||
<el-table-column label="试剂编码" min-width="110" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.reagentCode" placeholder="编码" class="inner-cell-input" />
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.reagentCode"
|
||||
placeholder="编码"
|
||||
class="inner-cell-input"
|
||||
/>
|
||||
<span v-else>{{ row.reagentCode || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="试剂名称" min-width="160" align="center">
|
||||
<el-table-column label="试剂名称" min-width="160" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-if="!readonly"
|
||||
v-model="row.reagentId"
|
||||
placeholder="请选择试剂"
|
||||
clearable
|
||||
@@ -156,20 +170,29 @@
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
<span v-else>{{ row.reagentName || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格" min-width="100" align="center">
|
||||
<el-table-column label="规格" min-width="100" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.spec" placeholder="规格" class="inner-cell-input" />
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.spec"
|
||||
placeholder="规格"
|
||||
class="inner-cell-input"
|
||||
/>
|
||||
<span v-else>{{ row.spec || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标准用量" min-width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.standardUsage"
|
||||
placeholder="用量"
|
||||
class="inner-cell-input"
|
||||
/>
|
||||
<span v-else>{{ row.standardUsage ?? '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@@ -180,16 +203,19 @@
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.actualUsage"
|
||||
placeholder="实际用量"
|
||||
class="inner-cell-input"
|
||||
@change="editor.saveReagents"
|
||||
/>
|
||||
<span v-else>{{ row.actualUsage ?? '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" min-width="120" align="center">
|
||||
<el-table-column label="单位" min-width="120" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-if="!readonly"
|
||||
v-model="row.unit"
|
||||
placeholder="请选择单位"
|
||||
clearable
|
||||
@@ -208,19 +234,29 @@
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<span v-else>{{ row.unit || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="关键物料" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-switch v-model="row.isKeyMaterial" />
|
||||
<el-switch v-if="!readonly" v-model="row.isKeyMaterial" />
|
||||
<el-tag v-else :type="row.isKeyMaterial ? 'success' : 'info'" size="small">
|
||||
{{ row.isKeyMaterial ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" min-width="120" align="center">
|
||||
<el-table-column label="备注" min-width="120" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.remark" placeholder="备注" class="inner-cell-input" />
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.remark"
|
||||
placeholder="备注"
|
||||
class="inner-cell-input"
|
||||
/>
|
||||
<span v-else>{{ row.remark || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80" align="center">
|
||||
<el-table-column v-if="!readonly" label="操作" width="80" align="center">
|
||||
<template #default="{ $index }">
|
||||
<el-button
|
||||
link
|
||||
@@ -240,7 +276,7 @@
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="耗材" name="consumable">
|
||||
<div class="route-config-tab-toolbar">
|
||||
<div v-if="!readonly" class="route-config-tab-toolbar">
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@@ -253,8 +289,8 @@
|
||||
<el-table
|
||||
:data="editor.selectedStep.value.consumables"
|
||||
stripe
|
||||
class="inner-table"
|
||||
max-height="300"
|
||||
class="list-table inner-table"
|
||||
max-height="400"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
@@ -263,18 +299,21 @@
|
||||
align="center"
|
||||
:index="(i: number) => i + 1"
|
||||
/>
|
||||
<el-table-column label="耗材编码" min-width="110" align="center">
|
||||
<el-table-column label="耗材编码" min-width="110" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.consumableCode"
|
||||
placeholder="编码"
|
||||
class="inner-cell-input"
|
||||
/>
|
||||
<span v-else>{{ row.consumableCode || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="耗材名称" min-width="160" align="center">
|
||||
<el-table-column label="耗材名称" min-width="160" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-if="!readonly"
|
||||
v-model="row.consumableId"
|
||||
placeholder="请选择耗材"
|
||||
clearable
|
||||
@@ -294,24 +333,29 @@
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
<span v-else>{{ row.consumableName || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格型号" min-width="110" align="center">
|
||||
<el-table-column label="规格型号" min-width="110" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.specModel"
|
||||
placeholder="规格型号"
|
||||
class="inner-cell-input"
|
||||
/>
|
||||
<span v-else>{{ row.specModel || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标准用量" min-width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.standardUsage"
|
||||
placeholder="用量"
|
||||
class="inner-cell-input"
|
||||
/>
|
||||
<span v-else>{{ row.standardUsage ?? '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@@ -322,16 +366,19 @@
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.actualUsage"
|
||||
placeholder="实际用量"
|
||||
class="inner-cell-input"
|
||||
@change="editor.saveConsumables"
|
||||
/>
|
||||
<span v-else>{{ row.actualUsage ?? '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" min-width="120" align="center">
|
||||
<el-table-column label="单位" min-width="120" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-if="!readonly"
|
||||
v-model="row.unit"
|
||||
placeholder="请选择单位"
|
||||
clearable
|
||||
@@ -350,19 +397,29 @@
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<span v-else>{{ row.unit || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="必需" width="80" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-switch v-model="row.isRequired" />
|
||||
<el-switch v-if="!readonly" v-model="row.isRequired" />
|
||||
<el-tag v-else :type="row.isRequired ? 'success' : 'info'" size="small">
|
||||
{{ row.isRequired ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" min-width="120" align="center">
|
||||
<el-table-column label="备注" min-width="120" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.remark" placeholder="备注" class="inner-cell-input" />
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.remark"
|
||||
placeholder="备注"
|
||||
class="inner-cell-input"
|
||||
/>
|
||||
<span v-else>{{ row.remark || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80" align="center">
|
||||
<el-table-column v-if="!readonly" label="操作" width="80" align="center">
|
||||
<template #default="{ $index }">
|
||||
<el-button
|
||||
link
|
||||
@@ -382,7 +439,7 @@
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="产出物" name="output">
|
||||
<div class="route-config-tab-toolbar">
|
||||
<div v-if="!readonly" class="route-config-tab-toolbar">
|
||||
<el-button class="btn-main" type="primary" size="small" @click="editor.addOutputRow">
|
||||
<el-icon><Plus /></el-icon>添加产出物
|
||||
</el-button>
|
||||
@@ -390,8 +447,8 @@
|
||||
<el-table
|
||||
:data="editor.selectedStep.value.outputs"
|
||||
stripe
|
||||
class="inner-table"
|
||||
max-height="300"
|
||||
class="list-table inner-table"
|
||||
max-height="400"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
@@ -400,9 +457,10 @@
|
||||
align="center"
|
||||
:index="(i: number) => i + 1"
|
||||
/>
|
||||
<el-table-column label="产出类型" min-width="150" align="center">
|
||||
<el-table-column label="产出类型" min-width="150" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-if="!readonly"
|
||||
v-model="row.outputTypeId"
|
||||
placeholder="选择类型"
|
||||
filterable
|
||||
@@ -416,39 +474,46 @@
|
||||
:value="ot.id"
|
||||
/>
|
||||
</el-select>
|
||||
<span v-else>{{ outputTypeLabel(row.outputTypeId) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="名称" min-width="150" align="center">
|
||||
<el-table-column label="名称" min-width="150" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.outputName"
|
||||
placeholder="名称"
|
||||
class="inner-cell-input"
|
||||
@change="editor.saveOutputs"
|
||||
/>
|
||||
<span v-else>{{ row.outputName || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="条码" min-width="150" align="center">
|
||||
<el-table-column label="条码" min-width="150" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.outputBarcode"
|
||||
placeholder="条码"
|
||||
class="inner-cell-input"
|
||||
@change="editor.saveOutputs"
|
||||
/>
|
||||
<span v-else>{{ row.outputBarcode || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" min-width="120" align="center">
|
||||
<el-table-column label="备注" min-width="120" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.remark"
|
||||
placeholder="备注"
|
||||
class="inner-cell-input"
|
||||
@change="editor.saveOutputs"
|
||||
/>
|
||||
<span v-else>{{ row.remark || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80" align="center">
|
||||
<el-table-column v-if="!readonly" label="操作" width="80" align="center">
|
||||
<template #default="{ $index }">
|
||||
<el-button link type="danger" size="small" @click="editor.removeOutputRow($index)"
|
||||
>删除</el-button
|
||||
@@ -464,7 +529,7 @@
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="数据采集" name="dataCollection">
|
||||
<div class="route-config-tab-toolbar">
|
||||
<div v-if="!readonly" class="route-config-tab-toolbar">
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@@ -477,8 +542,8 @@
|
||||
<el-table
|
||||
:data="editor.selectedStep.value.dataCollections"
|
||||
stripe
|
||||
class="inner-table"
|
||||
max-height="300"
|
||||
class="list-table inner-table"
|
||||
max-height="400"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
@@ -487,19 +552,22 @@
|
||||
align="center"
|
||||
:index="(i: number) => i + 1"
|
||||
/>
|
||||
<el-table-column label="采集名称" min-width="180" align="center">
|
||||
<el-table-column label="采集名称" min-width="180" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.collectionName"
|
||||
placeholder="采集项名称"
|
||||
class="inner-cell-input"
|
||||
@change="editor.saveDataCollections"
|
||||
/>
|
||||
<span v-else>{{ row.collectionName || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" min-width="120" align="center">
|
||||
<el-table-column label="单位" min-width="120" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-if="!readonly"
|
||||
v-model="row.unit"
|
||||
placeholder="请选择单位"
|
||||
clearable
|
||||
@@ -519,6 +587,7 @@
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<span v-else>{{ row.unit || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@@ -529,24 +598,28 @@
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.collectionValue"
|
||||
placeholder="输入采集值"
|
||||
class="inner-cell-input"
|
||||
@change="editor.saveDataCollections"
|
||||
/>
|
||||
<span v-else>{{ row.collectionValue ?? '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" min-width="120" align="center">
|
||||
<el-table-column label="备注" min-width="120" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!readonly"
|
||||
v-model="row.remark"
|
||||
placeholder="备注"
|
||||
class="inner-cell-input"
|
||||
@change="editor.saveDataCollections"
|
||||
/>
|
||||
<span v-else>{{ row.remark || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80" align="center">
|
||||
<el-table-column v-if="!readonly" label="操作" width="80" align="center">
|
||||
<template #default="{ $index }">
|
||||
<el-button
|
||||
link
|
||||
@@ -588,6 +661,11 @@
|
||||
readonly?: boolean
|
||||
}>()
|
||||
|
||||
function outputTypeLabel(outputTypeId: string) {
|
||||
const item = props.editor.outputTypeOptions.value.find((ot) => ot.id === outputTypeId)
|
||||
return item?.typeName || item?.name || outputTypeId || '—'
|
||||
}
|
||||
|
||||
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
|
||||
|
||||
function sopAttachmentFullUrl(url: string) {
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
<el-tag v-if="editor.virtualOutputStatus.value === 'filled'" type="success" size="small"
|
||||
>已填写 {{ editor.taskOutputs.value.length }} 项</el-tag
|
||||
>
|
||||
<el-tag v-else type="danger" size="small">未填写</el-tag>
|
||||
<el-tag v-else type="info" size="small">暂无</el-tag>
|
||||
</div>
|
||||
|
||||
<!-- 分割线 -->
|
||||
@@ -266,7 +266,7 @@
|
||||
<!-- 任务输出详情 -->
|
||||
<template v-else-if="editor.selectedVirtualStep.value === 'output'">
|
||||
<div class="execution-detail-header">
|
||||
<h3>📤 产出(细胞产品)<span class="virtual-step-required">必填</span></h3>
|
||||
<h3>📤 产出(细胞产品)</h3>
|
||||
<div v-if="!readonly" class="execution-detail-actions">
|
||||
<el-button
|
||||
class="btn-main"
|
||||
|
||||
@@ -16,7 +16,15 @@
|
||||
</div>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table :data="items" size="small" stripe border v-loading="loading" empty-text="暂无原材料">
|
||||
<el-table
|
||||
:data="items"
|
||||
class="list-table"
|
||||
stripe
|
||||
border
|
||||
height="420"
|
||||
v-loading="loading"
|
||||
empty-text="暂无原材料"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="56" align="center" />
|
||||
<el-table-column label="类型" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
@@ -88,7 +96,7 @@
|
||||
<el-dialog
|
||||
v-model="selectDialogVisible"
|
||||
title="选择细胞产品"
|
||||
width="1160px"
|
||||
width="1400px"
|
||||
class="dialog-form-layout"
|
||||
align-center
|
||||
destroy-on-close
|
||||
@@ -157,6 +165,28 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="批次号"
|
||||
prop="batchNo"
|
||||
min-width="120"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="规格" prop="specName" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column
|
||||
label="预计细胞数量(亿)"
|
||||
prop="expectedCellCount"
|
||||
min-width="140"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ row.expectedCellCount ?? '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活性" prop="viability" width="80" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ row.viability != null ? row.viability : '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -192,6 +222,10 @@
|
||||
passage?: string
|
||||
storageSlotName?: string
|
||||
productStatus?: string
|
||||
batchNo?: string
|
||||
specName?: string
|
||||
expectedCellCount?: number
|
||||
viability?: number
|
||||
}[]
|
||||
cellProductOptionsLoading: boolean
|
||||
}>(),
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
<!-- 列表 -->
|
||||
<el-table
|
||||
:data="items"
|
||||
size="small"
|
||||
class="list-table"
|
||||
stripe
|
||||
border
|
||||
height="420"
|
||||
v-loading="loading"
|
||||
empty-text="暂无产出产品"
|
||||
>
|
||||
@@ -38,6 +39,26 @@
|
||||
{{ row.storageSlotName || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="预计细胞数量(亿)" min-width="130" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ row.expectedCellCount ?? '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="活性" width="80" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ row.viability != null ? row.viability : '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="冻存日期" min-width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ formatDateOnly(row.freezeDate) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="有效期" min-width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ formatDateOnly(row.expiryDate) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" width="80" align="center">
|
||||
<template #default="{ row }">
|
||||
{{ row.quantity ?? '—' }}
|
||||
@@ -149,17 +170,42 @@
|
||||
emit('update:items', newItems)
|
||||
}
|
||||
|
||||
function handleDialogConfirm(data: Record<string, any>) {
|
||||
function formatDateOnly(val: unknown) {
|
||||
if (!val) return '—'
|
||||
const s = String(val)
|
||||
return s.length >= 10 ? s.slice(0, 10) : s
|
||||
}
|
||||
|
||||
function enrichOutputRow(row: Record<string, any>) {
|
||||
const productType = props.productTypeOptions.find((o) => o.id === row.productTypeId)
|
||||
const spec = props.specOptions.find((o) => o.id === row.specId)
|
||||
const slot = props.storageSlotOptions.find((o) => o.id === row.storageSlotId)
|
||||
const productCode = row.productCode || row.outputBarcode || ''
|
||||
const productName = row.productName || row.outputName || ''
|
||||
return {
|
||||
...row,
|
||||
productCode,
|
||||
productName,
|
||||
outputBarcode: productCode,
|
||||
outputName: productName,
|
||||
productTypeName: row.productTypeName || productType?.productTypeName || '',
|
||||
specName: row.specName || spec?.specName || '',
|
||||
storageSlotName: row.storageSlotName || slot?.name || ''
|
||||
}
|
||||
}
|
||||
|
||||
function handleDialogConfirm(data: Record<string, any> | Record<string, any>[]) {
|
||||
const rows = (Array.isArray(data) ? data : [data]).map(enrichOutputRow)
|
||||
const newItems = [...props.items]
|
||||
if (editingIndex.value >= 0) {
|
||||
// 编辑:替换原有项,保留 cellProductId
|
||||
const row = rows[0]
|
||||
if (!row) return
|
||||
newItems[editingIndex.value] = {
|
||||
...newItems[editingIndex.value],
|
||||
...data
|
||||
...row
|
||||
}
|
||||
} else {
|
||||
// 新增:添加到列表
|
||||
newItems.push(data)
|
||||
newItems.push(...rows)
|
||||
}
|
||||
emit('update:items', newItems)
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
<el-dialog
|
||||
:model-value="modelValue"
|
||||
:title="isEdit ? '编辑产出产品' : '新增产出产品'"
|
||||
width="1000px"
|
||||
width="1080px"
|
||||
class="dialog-form-layout task-output-product-dialog"
|
||||
align-center
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
@update:model-value="emit('update:modelValue', $event)"
|
||||
@opened="onDialogOpened"
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
@@ -21,7 +22,12 @@
|
||||
<div class="form-grid-3">
|
||||
<!-- 产品编码 -->
|
||||
<el-form-item label="产品编码" prop="productCode">
|
||||
<el-input v-model="formData.productCode" placeholder="请输入产品编码" />
|
||||
<el-input
|
||||
v-model="formData.productCode"
|
||||
placeholder="请输入产品编码"
|
||||
:readonly="isEdit"
|
||||
@input="onBaseProductCodeInput"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 产品名称 -->
|
||||
<el-form-item label="产品名称" prop="productName">
|
||||
@@ -74,8 +80,8 @@
|
||||
<el-form-item label="批次号" prop="batchNo">
|
||||
<el-input v-model="formData.batchNo" placeholder="请输入批次号" />
|
||||
</el-form-item>
|
||||
<!-- 储物格位置 -->
|
||||
<el-form-item label="储物格位置">
|
||||
<!-- 储物格位置(编辑单条) -->
|
||||
<el-form-item v-if="isEdit" label="储物格位置">
|
||||
<el-select
|
||||
v-model="formData.storageSlotId"
|
||||
placeholder="请选择储物格"
|
||||
@@ -122,14 +128,16 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 数量 -->
|
||||
<el-form-item label="数量">
|
||||
<!-- 入库份数 / 数量 -->
|
||||
<el-form-item :label="isEdit ? '数量' : '入库份数'" prop="quantity">
|
||||
<el-input-number
|
||||
v-model="formData.quantity"
|
||||
:min="0"
|
||||
:min="isEdit ? 0 : 1"
|
||||
:max="isEdit ? undefined : 50"
|
||||
:precision="0"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
@change="onCreateCountChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 单位 -->
|
||||
@@ -164,6 +172,21 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 状态(编辑单条,对齐细胞产品库) -->
|
||||
<el-form-item v-if="isEdit" label="状态">
|
||||
<el-select
|
||||
v-model="formData.productStatus"
|
||||
style="width: 100%"
|
||||
:disabled="formData.productStatus !== 'frozen'"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in editStatusOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- 产品图片 (full width) -->
|
||||
<el-form-item label="产品图片" class="form-col-span-2">
|
||||
<div class="attachment-upload">
|
||||
@@ -228,6 +251,45 @@
|
||||
<el-form-item label="备注" class="form-col-span-2">
|
||||
<el-input v-model="formData.remark" type="textarea" :rows="3" placeholder="可选" />
|
||||
</el-form-item>
|
||||
<!-- 入库明细(新增多份) -->
|
||||
<div v-if="!isEdit" class="product-lines-section">
|
||||
<div class="product-lines-head">
|
||||
<span class="product-lines-title">入库明细</span>
|
||||
<span class="form-label-tip"
|
||||
>每份填写编码与储物格;多份时编码为「产品编码-01、-02…」</span
|
||||
>
|
||||
</div>
|
||||
<el-table :data="productLines" size="small" class="product-lines-table">
|
||||
<el-table-column type="index" label="序号" width="64" align="center" />
|
||||
<el-table-column label="产品编码" min-width="200">
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-model="row.productCode"
|
||||
placeholder="产品编码"
|
||||
@input="onLineProductCodeInput"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="储物格位置" min-width="280">
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-model="row.storageSlotId"
|
||||
placeholder="请选择储物格"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storageSlotOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -258,10 +320,13 @@
|
||||
import { Plus, Close, Check, Delete, Download, Loading } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { fetchUploadAttachment } from '@/api/business'
|
||||
import { fetchNextCellProductCode } from '@/api/cell-product'
|
||||
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
||||
|
||||
defineOptions({ name: 'TaskOutputProductDialog' })
|
||||
|
||||
type ProductLine = { productCode: string; storageSlotId: string }
|
||||
|
||||
type ProductImageFile = {
|
||||
id?: string
|
||||
fileName: string
|
||||
@@ -282,12 +347,21 @@
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: boolean]
|
||||
confirm: [data: Record<string, any>]
|
||||
confirm: [data: Record<string, any> | Record<string, any>[]]
|
||||
searchUnit: [query: string]
|
||||
}>()
|
||||
|
||||
const passageOptions = ['P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7', 'P8']
|
||||
|
||||
const editStatusOptions = [
|
||||
{ label: '已冻存', value: 'frozen' },
|
||||
{ label: '生产中', value: 'in_production' },
|
||||
{ label: '已售卖', value: 'sold' },
|
||||
{ label: '已使用', value: 'used' },
|
||||
{ label: '已作废', value: 'voided' },
|
||||
{ label: '已复苏', value: 'thawed' }
|
||||
]
|
||||
|
||||
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
|
||||
function fullFileUrl(suffix: string) {
|
||||
if (!suffix) return ''
|
||||
@@ -296,13 +370,14 @@
|
||||
return `${minioBaseUrl}/${suffix}`
|
||||
}
|
||||
|
||||
const isEdit = computed(() => !!props.editItem?.cellProductId)
|
||||
const isEdit = computed(() => !!props.editItem)
|
||||
const formRef = ref()
|
||||
const submitLoading = ref(false)
|
||||
const productImageUploadRef = ref()
|
||||
const previewVisible = ref(false)
|
||||
const previewUrl = ref('')
|
||||
const productImageFiles = ref<ProductImageFile[]>([])
|
||||
const productLines = ref<ProductLine[]>([{ productCode: '', storageSlotId: '' }])
|
||||
|
||||
const formData = reactive({
|
||||
cellProductId: '',
|
||||
@@ -319,44 +394,181 @@
|
||||
quantity: 1 as number,
|
||||
unit: '',
|
||||
expiryDate: '',
|
||||
productStatus: 'frozen',
|
||||
productImages: '',
|
||||
remark: ''
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
productCode: [{ required: true, message: '请输入产品编码', trigger: 'blur' }],
|
||||
productName: [{ required: true, message: '请输入产品名称', trigger: 'blur' }]
|
||||
productName: [{ required: true, message: '请输入产品名称', trigger: 'blur' }],
|
||||
batchNo: [{ required: true, message: '请输入批次号', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
// Watch editItem to populate form
|
||||
watch(
|
||||
() => props.editItem,
|
||||
(item) => {
|
||||
if (item) {
|
||||
formData.cellProductId = item.cellProductId || ''
|
||||
formData.productCode = item.productCode || ''
|
||||
formData.productName = item.productName || ''
|
||||
formData.productTypeId = item.productTypeId || ''
|
||||
formData.specId = item.specId || ''
|
||||
formData.passage = item.passage || ''
|
||||
formData.batchNo = item.batchNo || ''
|
||||
formData.storageSlotId = item.storageSlotId || ''
|
||||
formData.expectedCellCount = item.expectedCellCount ?? undefined
|
||||
formData.viability = item.viability ?? undefined
|
||||
formData.freezeDate = item.freezeDate || ''
|
||||
formData.quantity = item.quantity ?? 1
|
||||
formData.unit = item.unit || ''
|
||||
formData.expiryDate = item.expiryDate || ''
|
||||
formData.productImages = item.productImages || ''
|
||||
formData.remark = item.remark || ''
|
||||
syncFormToImages(item.productImages || '')
|
||||
} else {
|
||||
resetForm()
|
||||
function normalizeDateValue(val: unknown): string {
|
||||
if (!val) return ''
|
||||
const s = String(val)
|
||||
return s.length >= 10 ? s.slice(0, 10) : s
|
||||
}
|
||||
|
||||
function populateFormFromEditItem(item: Record<string, any>) {
|
||||
formData.cellProductId = item.cellProductId || ''
|
||||
formData.productCode = item.productCode || item.outputBarcode || ''
|
||||
formData.productName = item.productName || item.outputName || ''
|
||||
formData.productTypeId = item.productTypeId || ''
|
||||
formData.specId = item.specId || ''
|
||||
formData.passage = item.passage || ''
|
||||
formData.batchNo = item.batchNo || ''
|
||||
formData.storageSlotId = item.storageSlotId || ''
|
||||
formData.expectedCellCount = item.expectedCellCount ?? undefined
|
||||
formData.viability = item.viability ?? undefined
|
||||
formData.freezeDate = normalizeDateValue(item.freezeDate)
|
||||
formData.quantity = item.quantity ?? 1
|
||||
formData.unit = item.unit || ''
|
||||
formData.expiryDate = normalizeDateValue(item.expiryDate)
|
||||
formData.productStatus = item.productStatus || 'frozen'
|
||||
formData.productImages = item.productImages || ''
|
||||
formData.remark = item.remark || ''
|
||||
syncFormToImages(item.productImages || '')
|
||||
}
|
||||
|
||||
async function initAddForm() {
|
||||
resetForm()
|
||||
formData.quantity = 1
|
||||
emit('searchUnit', '')
|
||||
await nextTick()
|
||||
formRef.value?.clearValidate?.()
|
||||
try {
|
||||
const res = await fetchNextCellProductCode()
|
||||
if (res?.code) {
|
||||
formData.productCode = res.code
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
} catch {
|
||||
/* 自动生成失败时用户可手动输入 */
|
||||
}
|
||||
applyProductCodeToLines()
|
||||
}
|
||||
|
||||
/** 按入库份数将主表单产品编码同步到入库明细(每份均带 -01、-02…,单份时为 -01) */
|
||||
function applyProductCodeToLines() {
|
||||
syncProductLines()
|
||||
syncLineCodesFromBase()
|
||||
}
|
||||
|
||||
function onDialogOpened() {
|
||||
if (props.editItem) {
|
||||
populateFormFromEditItem(props.editItem)
|
||||
emit('searchUnit', props.editItem.unit || '')
|
||||
nextTick(() => formRef.value?.clearValidate?.())
|
||||
} else {
|
||||
void initAddForm()
|
||||
}
|
||||
}
|
||||
|
||||
function createQuantityValue() {
|
||||
const n = Math.floor(Number(formData.quantity) || 0)
|
||||
if (n < 1) return 1
|
||||
return Math.min(n, 50)
|
||||
}
|
||||
|
||||
function stripProductCodeSuffix(code: string) {
|
||||
const c = (code || '').trim()
|
||||
const m = c.match(/^(.+)-(\d{2})$/)
|
||||
return m ? m[1].trim() : c
|
||||
}
|
||||
|
||||
function buildLineProductCode(base: string, index: number) {
|
||||
const b = stripProductCodeSuffix(base)
|
||||
if (!b) return ''
|
||||
return `${b}-${String(index + 1).padStart(2, '0')}`
|
||||
}
|
||||
|
||||
function syncLineCodesFromBase() {
|
||||
const base = formData.productCode
|
||||
productLines.value.forEach((line, index) => {
|
||||
line.productCode = buildLineProductCode(base, index)
|
||||
})
|
||||
}
|
||||
|
||||
function syncProductLines() {
|
||||
const count = createQuantityValue()
|
||||
const prev = productLines.value.map((l) => ({ ...l }))
|
||||
const lines: ProductLine[] = []
|
||||
for (let i = 0; i < count; i++) {
|
||||
lines.push({
|
||||
productCode: buildLineProductCode(formData.productCode, i),
|
||||
storageSlotId: prev[i]?.storageSlotId || ''
|
||||
})
|
||||
}
|
||||
productLines.value = lines.length ? lines : [{ productCode: '', storageSlotId: '' }]
|
||||
}
|
||||
|
||||
function onCreateCountChange() {
|
||||
if (!isEdit.value) {
|
||||
applyProductCodeToLines()
|
||||
}
|
||||
}
|
||||
|
||||
function onBaseProductCodeInput() {
|
||||
if (!isEdit.value) {
|
||||
applyProductCodeToLines()
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formData.quantity,
|
||||
() => {
|
||||
if (!isEdit.value && props.modelValue) {
|
||||
applyProductCodeToLines()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
function onLineProductCodeInput() {
|
||||
if (!isEdit.value && createQuantityValue() <= 1) {
|
||||
formData.productCode = stripProductCodeSuffix(productLines.value[0]?.productCode || '')
|
||||
}
|
||||
}
|
||||
|
||||
async function validateProductLines(): Promise<boolean> {
|
||||
if (isEdit.value) return true
|
||||
const count = createQuantityValue()
|
||||
for (let i = 0; i < productLines.value.length; i++) {
|
||||
const line = productLines.value[i]
|
||||
if (!line.productCode?.trim()) {
|
||||
ElMessage.warning(`请填写第 ${i + 1} 份产品编码`)
|
||||
return false
|
||||
}
|
||||
if (!line.storageSlotId) {
|
||||
ElMessage.warning(`请选择第 ${i + 1} 份产品的储物格位置`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (productLines.value.length !== count) {
|
||||
ElMessage.warning('入库明细行数与入库份数不一致,请调整入库份数')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function buildSharedResult(): Record<string, any> {
|
||||
return {
|
||||
productName: formData.productName.trim(),
|
||||
productTypeId: formData.productTypeId || undefined,
|
||||
specId: formData.specId || undefined,
|
||||
passage: formData.passage || undefined,
|
||||
batchNo: formData.batchNo.trim(),
|
||||
expectedCellCount: formData.expectedCellCount ?? undefined,
|
||||
viability: formData.viability ?? undefined,
|
||||
freezeDate: formData.freezeDate || undefined,
|
||||
unit: formData.unit?.trim() || undefined,
|
||||
expiryDate: formData.expiryDate || undefined,
|
||||
productImages: formData.productImages?.trim() || undefined,
|
||||
productStatus: formData.productStatus || 'frozen',
|
||||
remark: formData.remark?.trim() || undefined
|
||||
}
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
formData.cellProductId = ''
|
||||
formData.productCode = ''
|
||||
@@ -372,9 +584,11 @@
|
||||
formData.quantity = 1
|
||||
formData.unit = ''
|
||||
formData.expiryDate = ''
|
||||
formData.productStatus = 'frozen'
|
||||
formData.productImages = ''
|
||||
formData.remark = ''
|
||||
productImageFiles.value = []
|
||||
productLines.value = [{ productCode: '', storageSlotId: '' }]
|
||||
}
|
||||
|
||||
function fileNameFromUrl(url: string, index: number) {
|
||||
@@ -464,30 +678,29 @@
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
if (!(await validateProductLines())) return
|
||||
await formRef.value?.validate?.()
|
||||
syncImagesToForm()
|
||||
submitLoading.value = true
|
||||
try {
|
||||
const result: Record<string, any> = {
|
||||
cellProductId: formData.cellProductId || undefined,
|
||||
productCode: formData.productCode.trim(),
|
||||
productName: formData.productName.trim(),
|
||||
productTypeId: formData.productTypeId || undefined,
|
||||
specId: formData.specId || undefined,
|
||||
passage: formData.passage || undefined,
|
||||
batchNo: formData.batchNo.trim() || undefined,
|
||||
storageSlotId: formData.storageSlotId || undefined,
|
||||
expectedCellCount: formData.expectedCellCount ?? undefined,
|
||||
viability: formData.viability ?? undefined,
|
||||
freezeDate: formData.freezeDate || undefined,
|
||||
quantity: formData.quantity,
|
||||
unit: formData.unit?.trim() || undefined,
|
||||
expiryDate: formData.expiryDate || undefined,
|
||||
productImages: formData.productImages?.trim() || undefined,
|
||||
productStatus: 'frozen',
|
||||
remark: formData.remark?.trim() || undefined
|
||||
const shared = buildSharedResult()
|
||||
if (isEdit.value) {
|
||||
emit('confirm', {
|
||||
...shared,
|
||||
cellProductId: formData.cellProductId || undefined,
|
||||
productCode: formData.productCode.trim(),
|
||||
storageSlotId: formData.storageSlotId || undefined,
|
||||
quantity: formData.quantity
|
||||
})
|
||||
} else {
|
||||
const results = productLines.value.map((line) => ({
|
||||
...shared,
|
||||
productCode: line.productCode.trim(),
|
||||
storageSlotId: line.storageSlotId,
|
||||
quantity: 1
|
||||
}))
|
||||
emit('confirm', results)
|
||||
}
|
||||
emit('confirm', result)
|
||||
emit('update:modelValue', false)
|
||||
} finally {
|
||||
submitLoading.value = false
|
||||
@@ -651,4 +864,27 @@
|
||||
.preview-container {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.product-lines-section {
|
||||
grid-column: 1 / -1;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.product-lines-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.product-lines-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--mint-text, #334155);
|
||||
}
|
||||
|
||||
.product-lines-table {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -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">
|
||||
@@ -102,7 +102,7 @@
|
||||
><el-icon><EditPen /></el-icon>编辑任务</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="row.workOrderStatus === 'dpz'"
|
||||
v-if="row.workOrderStatus === 'dpz' || row.workOrderStatus === 'jxz'"
|
||||
class="btn-op-item primary"
|
||||
@click="handleOpenDispatch(row)"
|
||||
>
|
||||
|
||||
@@ -107,6 +107,10 @@ export function useTaskStepEditor() {
|
||||
passage?: string
|
||||
storageSlotName?: string
|
||||
productStatus?: string
|
||||
batchNo?: string
|
||||
specName?: string
|
||||
expectedCellCount?: number
|
||||
viability?: number
|
||||
}>
|
||||
>([])
|
||||
const cellProductOptionsLoading = ref(false)
|
||||
@@ -391,7 +395,11 @@ export function useTaskStepEditor() {
|
||||
productTypeName: p.productTypeName || '',
|
||||
passage: p.passage || '',
|
||||
storageSlotName: p.storageSlotName || '',
|
||||
productStatus: p.productStatus || ''
|
||||
productStatus: p.productStatus || '',
|
||||
batchNo: p.batchNo || '',
|
||||
specName: p.specName || '',
|
||||
expectedCellCount: p.expectedCellCount ?? undefined,
|
||||
viability: p.viability ?? undefined
|
||||
}))
|
||||
for (const row of taskInputs.value) {
|
||||
if (
|
||||
@@ -570,6 +578,25 @@ export function useTaskStepEditor() {
|
||||
loadStorageSlotOptions()
|
||||
])
|
||||
}
|
||||
|
||||
function enrichTaskOutputRow(row: Record<string, any>) {
|
||||
const productType = productTypeOptions.value.find((o) => o.id === row.productTypeId)
|
||||
const spec = specOptions.value.find((o) => o.id === row.specId)
|
||||
const slot = storageSlotOptions.value.find((o) => o.id === row.storageSlotId)
|
||||
const productCode = row.productCode || row.outputBarcode || ''
|
||||
const productName = row.productName || row.outputName || ''
|
||||
return {
|
||||
...row,
|
||||
productCode,
|
||||
productName,
|
||||
outputBarcode: productCode,
|
||||
outputName: productName,
|
||||
productTypeName: row.productTypeName || productType?.productTypeName || '',
|
||||
specName: row.specName || spec?.specName || '',
|
||||
storageSlotName: row.storageSlotName || slot?.name || ''
|
||||
}
|
||||
}
|
||||
|
||||
async function loadTaskDetail(overrideId?: string) {
|
||||
const id = overrideId || taskId.value
|
||||
if (!id) return
|
||||
@@ -586,7 +613,9 @@ export function useTaskStepEditor() {
|
||||
if (mode.value === 'execution') {
|
||||
taskDetail.value = detail
|
||||
taskInputs.value = (detail.inputs || []).map((i: Record<string, any>) => ({ ...i }))
|
||||
taskOutputs.value = (detail.outputs || []).map((o: Record<string, any>) => ({ ...o }))
|
||||
taskOutputs.value = (detail.outputs || []).map((o: Record<string, any>) =>
|
||||
enrichTaskOutputRow(o)
|
||||
)
|
||||
for (const row of taskInputs.value) {
|
||||
if (
|
||||
row.inputType === 'cell_product' &&
|
||||
@@ -1007,10 +1036,6 @@ export function useTaskStepEditor() {
|
||||
}
|
||||
async function saveTaskOutputs() {
|
||||
if (!taskDetail.value?.id) return
|
||||
if (!taskOutputs.value.length) {
|
||||
ElMessage.warning('请至少添加一项产出(细胞产品)')
|
||||
return
|
||||
}
|
||||
outputSaving.value = true
|
||||
try {
|
||||
await fetchSetTaskOutputs(taskDetail.value.id, taskOutputs.value)
|
||||
|
||||
Reference in new issue
Block a user