fix: 子表保存改为就地同步,避免整批换 id 打断外键。

协议样本、生产产出和盘点明细按行更新并保留原 id;补齐存储证明质检预填、离职人员显示名,以及样本采集通知模板字段。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-10-28 10:51:53 +08:00
1 parent d66e55af65
commit 5e563a6669
139 files changed
+59986 -49048

No files matched your search

@@ -17,7 +17,7 @@
<div class="val">{{ identity.labFlowCode || '—' }}</div>
</div>
<div class="ctx-item">
<label>样本编码</label>
<label>{{ codeFieldLabel }}</label>
<div class="val">{{ identity.sampleCode || '—' }}</div>
</div>
<div class="ctx-item">
@@ -55,21 +55,39 @@
}"
>
<template v-if="mode === 'view'">
<div class="readonly-box">{{ displayValue(field.key) }}</div>
<div
class="readonly-box"
:class="{ 'is-positive': field.control === 'select_yny' && isPositiveQual(form[field.key]) }"
>
{{ displayValue(field.key) }}
</div>
</template>
<el-select
v-else-if="field.control === 'select_yny'"
v-else-if="field.control === 'select_yny' || field.control === 'select_result'"
v-model="form[field.key]"
clearable
placeholder="请选择"
:class="{
'is-positive': field.control === 'select_yny' && isPositiveQual(form[field.key])
}"
:filterable="field.control === 'select_yny' && !isPerinatalQualField(typeKey, field.control)"
:allow-create="field.control === 'select_yny' && !isPerinatalQualField(typeKey, field.control)"
:placeholder="
field.control === 'select_yny' && !isPerinatalQualField(typeKey, field.control)
? '请选择或输入'
: '请选择'
"
style="width: 100%"
>
<el-option
v-for="opt in YNY_OPTIONS"
v-for="opt in qualOptionsFor(typeKey, field.control)"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
>
<span :class="{ 'qual-option--positive': isPositiveQual(opt.value) }">{{
opt.label
}}</span>
</el-option>
</el-select>
<el-input
v-else-if="field.control === 'textarea'"
@@ -122,7 +140,10 @@
} from '@/api/sample-storage-cert-qc'
import {
STORAGE_CERT_QC_GROUPS,
YNY_OPTIONS,
isPerinatalQualField,
mergeStorageCertPrefill,
normalizeQualValue,
qualOptionsFor,
resolveStorageCertQcTypeKey,
type StorageCertQcTypeKey
} from '@/utils/storage-cert-qc-fields'
@@ -156,6 +177,11 @@
props.mode === 'edit' ? '填写储存证质检信息' : '查看储存证的质检信息'
)
const codeFieldLabel = computed(() => {
const key = typeKey.value || resolveStorageCertQcTypeKey(props.sampleTypeName)
return key === 'perinatal_hsc' || key === 'uc_msc' ? '协议编码' : '样本编码'
})
const groups = computed(() => (typeKey.value ? STORAGE_CERT_QC_GROUPS[typeKey.value] || [] : []))
function displayValue(key: string) {
@@ -164,13 +190,19 @@
return String(v)
}
function isPositiveQual(value: unknown) {
const text = String(value ?? '').trim()
return text === '阳性' || text === '阳'
}
function resetFormKeys(key: StorageCertQcTypeKey | null, payload: Record<string, unknown>) {
Object.keys(form).forEach((k) => delete form[k])
if (!key) return
for (const group of STORAGE_CERT_QC_GROUPS[key] || []) {
for (const field of group.fields) {
const raw = payload[field.key]
form[field.key] = raw == null ? '' : String(raw)
const text = raw == null ? '' : String(raw)
form[field.key] = normalizeQualValue(key, field.control, text)
}
}
}
@@ -185,7 +217,11 @@
(detail.sampleTypeKey as StorageCertQcTypeKey | null) ||
resolveStorageCertQcTypeKey(identity.sampleTypeName)
typeKey.value = resolved
resetFormKeys(resolved, (detail.payload || {}) as Record<string, unknown>)
const payload =
props.mode === 'edit'
? mergeStorageCertPrefill(detail.payload, detail.prefill)
: ((detail.payload || {}) as Record<string, unknown>)
resetFormKeys(resolved, payload)
}
async function loadDetail() {
@@ -330,6 +366,24 @@
background: #f8fafc;
border: 1px solid var(--el-border-color-lighter, #e2e8f0);
border-radius: 8px;
&.is-positive {
color: #dc2626;
font-weight: 600;
}
}
.is-positive {
:deep(.el-select__selected-item) {
color: #dc2626 !important;
-webkit-text-fill-color: #dc2626 !important;
font-weight: 600;
}
}
.qual-option--positive {
color: #dc2626;
font-weight: 600;
}
@media (max-width: 900px) {