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

@@ -1158,6 +1158,7 @@
<script setup lang="ts">
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { createStableRowId } from '@/utils/production-step-output'
import { computed } from 'vue'
import {
Plus,
@@ -2179,6 +2180,7 @@
if (!selectedStep.value) return
if (!selectedStep.value.reagents) selectedStep.value.reagents = []
selectedStep.value.reagents.push({
id: createStableRowId(),
reagentId: '',
reagentCode: '',
reagentName: '',
@@ -2215,6 +2217,7 @@
await fetchUpdateStepReagents({
stepId: selectedStep.value.id,
items: reagents.map((r: Record<string, any>, idx: number) => ({
id: r.id || '',
reagentCode: r.reagentCode,
reagentName: r.reagentName,
spec: r.spec,
@@ -2235,6 +2238,7 @@
if (!selectedStep.value) return
if (!selectedStep.value.consumables) selectedStep.value.consumables = []
selectedStep.value.consumables.push({
id: createStableRowId(),
consumableId: '',
consumableCode: '',
consumableName: '',
@@ -2271,6 +2275,7 @@
await fetchUpdateStepConsumables({
stepId: selectedStep.value.id,
items: consumables.map((c: Record<string, any>, idx: number) => ({
id: c.id || '',
consumableCode: c.consumableCode,
consumableName: c.consumableName,
specModel: c.specModel,
@@ -2291,6 +2296,7 @@
if (!selectedStep.value) return
if (!selectedStep.value.outputs) selectedStep.value.outputs = []
selectedStep.value.outputs.push({
id: createStableRowId(),
outputTypeId: '',
outputName: '',
outputBarcode: '',
@@ -2310,6 +2316,7 @@
await fetchUpdateStepOutputs({
stepId: selectedStep.value.id,
items: (selectedStep.value.outputs || []).map((o: Record<string, any>, idx: number) => ({
id: o.id || '',
outputTypeId: o.outputTypeId,
outputName: o.outputName,
outputBarcode: o.outputBarcode,
@@ -2333,6 +2340,7 @@
if (!selectedStep.value) return
if (!selectedStep.value.dataCollections) selectedStep.value.dataCollections = []
selectedStep.value.dataCollections.push({
id: createStableRowId(),
collectionName: '',
unit: '',
orderNum: 0,
@@ -2353,6 +2361,7 @@
stepId: selectedStep.value.id,
items: (selectedStep.value.dataCollections || []).map(
(d: Record<string, any>, idx: number) => ({
id: d.id || '',
collectionName: d.collectionName,
unit: d.unit,
orderNum: idx,
@@ -1033,6 +1033,7 @@
<script setup lang="ts">
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { createStableRowId } from '@/utils/production-step-output'
import { Plus, Close, Check, Rank, RefreshLeft, Search, Delete, Edit, Upload } from '@element-plus/icons-vue'
import Sortable from 'sortablejs'
import type { SortableEvent } from 'sortablejs'
@@ -1373,6 +1374,7 @@
function appendReagentFromMaster(r: any) {
if (isReagentDuplicate(r.id, r.reagentCode)) return false
reagentList.value.push({
id: createStableRowId(),
reagentId: r.id,
reagentCode: r.reagentCode || '',
reagentName: r.reagentName || '',
@@ -1391,6 +1393,7 @@
) {
if (isConsumableDuplicate(c.id || c.consumableId, c.consumableCode)) return false
consumableList.value.push({
id: createStableRowId(),
consumableId: c.consumableId || c.id,
consumableCode: c.consumableCode || '',
consumableName: c.consumableName || '',
@@ -1482,7 +1485,7 @@
sopContent: formData.sopContent || undefined,
remark: formData.remark?.trim() || undefined,
reagents: reagentList.value.map((r) => ({
reagentId: r.reagentId || r.id,
id: r.id || '',
reagentCode: r.reagentCode,
reagentName: r.reagentName,
spec: r.spec,
@@ -1492,7 +1495,7 @@
remark: r.remark || ''
})),
consumables: consumableList.value.map((c) => ({
consumableId: c.consumableId || c.id,
id: c.id || '',
consumableCode: c.consumableCode,
consumableName: c.consumableName,
specModel: c.specModel,
@@ -1502,12 +1505,14 @@
remark: c.remark || ''
})),
outputs: outputList.value.map((o) => ({
id: o.id || '',
outputTypeId: o.outputTypeId,
outputName: o.outputName,
outputBarcode: o.outputBarcode,
remark: o.remark || ''
})),
dataCollections: dataCollectionList.value.map((d) => ({
id: d.id || '',
collectionName: d.collectionName,
unit: d.unit || undefined,
orderNum: d.orderNum ?? 0,
@@ -1721,6 +1726,7 @@
// =============== 产出物 ===============
function addOutputRow() {
outputList.value.push({
id: createStableRowId(),
outputTypeId: '',
outputName: '',
outputBarcode: '',
@@ -1731,6 +1737,7 @@
function addDataCollectionRow() {
dataCollectionList.value.push(
withDataCollectionClientKey({
id: createStableRowId(),
collectionName: '',
unit: '',
orderNum: dataCollectionList.value.length + 1,