This commit is contained in:
zlwu committed 2026-08-25 16:47:43 +08:00
1 parent d2290eb92c
commit a2d4d3b0d5
320 files changed
+125011 -26951

No files matched your search

@@ -995,6 +995,18 @@
</div>
</section>
<section v-if="selectedStep" class="route-config-step-section step-sop-content-section">
<h3 class="route-config-step-section-title">SOP信息</h3>
<TinyMceEditor
:key="selectedStep.id"
v-model="selectedStep.sopContent"
show-print
:print-title="selectedStep.processName || selectedStep.stepName || 'SOP'"
placeholder="工序 SOP 说明(从工艺库拷贝后可在此调整)"
@update:model-value="onSopContentChange"
/>
</section>
<!-- 数据采集(SHOW_PROCESS_DATA_COLLECTION 控制展示) -->
<section v-if="SHOW_PROCESS_DATA_COLLECTION" class="route-config-step-section">
<h3 class="route-config-step-section-title">数据采集</h3>
@@ -1134,6 +1146,7 @@
Search
} from '@element-plus/icons-vue'
import ProtocolAttachmentReadonly from '@/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue'
import TinyMceEditor from '@/components/TinyMceEditor/index.vue'
import TaskEquipmentPanel from '@/views/production/production-work-order/TaskEquipmentPanel.vue'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import { parseEquipmentIds } from '@/utils/equipment-select'
@@ -1414,6 +1427,7 @@
function normalizeStepSubTables(step: Record<string, any>) {
return {
...step,
sopContent: step.sopContent || '',
reagents: (step.reagents || []).map((r: Record<string, any>) => ({
...r,
isKeyMaterial: fromApiFlag(r.isKeyMaterial)
@@ -1777,6 +1791,15 @@
saveStepBasic()
}
let sopContentSaveTimer: ReturnType<typeof setTimeout> | null = null
function onSopContentChange() {
if (sopContentSaveTimer) clearTimeout(sopContentSaveTimer)
sopContentSaveTimer = setTimeout(() => {
sopContentSaveTimer = null
void saveStepBasic()
}, 800)
}
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
function sopAttachmentFullUrl(url: string) {
@@ -2079,7 +2102,8 @@
categoryId: selectedStep.value.categoryId,
description: selectedStep.value.description,
estimatedDuration: selectedStep.value.estimatedDuration,
sopIds: selectedStep.value.sopIds
sopIds: selectedStep.value.sopIds,
sopContent: selectedStep.value.sopContent
})
} catch {
/* ignore */
@@ -2822,6 +2846,10 @@
grid-column: 1 / -1;
}
.step-sop-content-section {
margin-top: 16px;
}
.step-sop-attachment-row {
margin-top: -4px;
@@ -176,7 +176,7 @@
<div class="section-title">
<div class="section-title-left"><h3>基本信息</h3></div>
</div>
<div class="form-grid">
<div class="form-grid-4 process-basic-info-grid">
<el-form-item label="工序代码" prop="processCode">
<el-input v-model="formData.processCode" placeholder="请输入工序代码" />
</el-form-item>
@@ -199,11 +199,16 @@
/>
</el-select>
</el-form-item>
<el-form-item v-if="SHOW_PROCESS_DURATION_DESC_SOP">
<el-form-item label="备注">
<el-input v-model="formData.remark" placeholder="可选" maxlength="512" />
</el-form-item>
</div>
<div v-if="SHOW_PROCESS_DURATION_DESC_SOP" class="form-grid process-basic-extra-grid">
<el-form-item>
<template #label>预估耗时<span class="form-label-tip">(h)</span></template>
<el-input v-model="formData.estimatedDuration" placeholder="如 0.5" />
</el-form-item>
<el-form-item v-if="SHOW_PROCESS_DURATION_DESC_SOP" label="关联SOP">
<el-form-item label="关联SOP">
<el-select
v-model="formData.sopIds"
placeholder="请选择SOP文档"
@@ -220,7 +225,7 @@
/>
</el-select>
</el-form-item>
<el-form-item v-if="SHOW_PROCESS_DURATION_DESC_SOP" label="描述">
<el-form-item label="描述" class="form-col-span-2">
<el-input
v-model="formData.description"
type="textarea"
@@ -228,14 +233,6 @@
placeholder="请输入描述"
/>
</el-form-item>
<el-form-item label="备注">
<el-input
v-model="formData.remark"
type="textarea"
:rows="2"
placeholder="可选"
/>
</el-form-item>
</div>
</div>
</div>
@@ -559,6 +556,21 @@
</div>
</div>
<div id="form-section-sop" class="form-tab-pane">
<div class="section-card">
<div class="section-title">
<div class="section-title-left"><h3>SOP信息</h3></div>
</div>
<TinyMceEditor
:key="sopEditorKey"
v-model="formData.sopContent"
show-print
:print-title="formData.processName || 'SOP'"
placeholder="请输入工序 SOP 操作说明,支持图文、表格等"
/>
</div>
</div>
<div
v-if="SHOW_PROCESS_DATA_COLLECTION"
id="form-section-data-collections"
@@ -1043,6 +1055,7 @@
import { packTypeLabel, packTypeTagType } from '@/utils/status-tag-registry'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
import DialogFormBody from '@/components/business/dialog-form-body/index.vue'
import TinyMceEditor from '@/components/TinyMceEditor/index.vue'
import ProcessRouteTab from './ProcessRouteTab.vue'
defineOptions({ name: 'ProductionProcess' })
@@ -1066,6 +1079,7 @@
const formRef = ref()
const editingId = ref<string | null>(null)
const activeFormTab = ref('basic')
const sopEditorKey = ref(0)
const formTabs = [
{ key: 'basic', label: '基本信息' },
@@ -1076,6 +1090,7 @@
]
: []),
{ key: 'outputs', label: '产出物' },
{ key: 'sop', label: 'SOP信息' },
...(SHOW_PROCESS_DATA_COLLECTION
? [{ key: 'data-collections', label: '数据采集' }]
: [])
@@ -1116,6 +1131,7 @@
description: '',
estimatedDuration: '',
sopIds: [] as string[],
sopContent: '',
remark: ''
})
@@ -1297,6 +1313,7 @@
formData.description = ''
formData.estimatedDuration = ''
formData.sopIds = []
formData.sopContent = ''
formData.remark = ''
reagentList.value = []
consumableList.value = []
@@ -1386,6 +1403,7 @@
isEdit.value = false
dialogTitle.value = '新增工艺'
resetForm()
sopEditorKey.value += 1
dialogVisible.value = true
dialogLoading.value = true
nextTick(() => formRef.value?.clearValidate?.())
@@ -1399,6 +1417,7 @@
async function handleEdit(row: any) {
resetForm()
sopEditorKey.value += 1
isEdit.value = true
dialogTitle.value = '编辑工艺'
editingId.value = row.id
@@ -1413,6 +1432,7 @@
formData.description = detail.description || ''
formData.estimatedDuration = detail.estimatedDuration || ''
formData.sopIds = parseSopIds(detail.sopIds)
formData.sopContent = detail.sopContent || ''
formData.remark = detail.remark || ''
reagentList.value = (detail.reagents || []).map((r: any) => ({
...r,
@@ -1455,6 +1475,7 @@
description: formData.description?.trim() || undefined,
estimatedDuration: formData.estimatedDuration?.trim() || undefined,
sopIds: serializeSopIds(formData.sopIds),
sopContent: formData.sopContent || undefined,
remark: formData.remark?.trim() || undefined,
reagents: reagentList.value.map((r) => ({
reagentId: r.reagentId || r.id,
@@ -1831,10 +1852,15 @@
gap: 12px;
}
.form-grid {
.process-basic-info-grid {
margin-bottom: 0;
}
.process-basic-extra-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px 20px;
margin-top: 16px;
}
.form-col-span-2 {
@@ -2003,7 +2029,7 @@
}
@media (max-width: 900px) {
.form-grid {
.process-basic-extra-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@@ -705,6 +705,18 @@
</div>
</section>
<section class="route-config-step-section step-sop-content-section">
<h3 class="route-config-step-section-title">SOP信息</h3>
<TinyMceEditor
:key="editor.selectedStep.value.id"
v-model="editor.selectedStep.value.sopContent"
:disabled="stepFormReadonly"
show-print
:print-title="editor.selectedStep.value.processName || editor.selectedStep.value.stepName || 'SOP'"
placeholder="请输入或完善工序 SOP,执行过程中填写的内容将保存并回显"
/>
</section>
<!-- 数据采集(SHOW_PROCESS_DATA_COLLECTION 控制展示) -->
<section v-if="SHOW_PROCESS_DATA_COLLECTION" class="route-config-step-section">
<h3 class="route-config-step-section-title">数据采集</h3>
@@ -862,6 +874,7 @@
} from '@/utils/process-material-ui'
import { formatPlannedStartDate } from '@/utils/production-labels'
import StepDetailActionBar from './StepDetailActionBar.vue'
import TinyMceEditor from '@/components/TinyMceEditor/index.vue'
import { useTaskStepEditor } from './useTaskStepEditor'
const props = defineProps<{
@@ -966,6 +979,10 @@
grid-column: 1 / -1;
}
.step-sop-content-section {
margin-top: 16px;
}
.step-assignee-readonly-tag {
margin-right: 6px;
}
@@ -126,6 +126,7 @@ export function serializeStep(step: Record<string, any>): string {
description: step.description,
estimatedDuration: step.estimatedDuration,
sopIds: step.sopIds,
sopContent: step.sopContent,
assigneeUserIds: [...(step.assigneeUserIds || [])].sort(),
plannedStartTime: step.plannedStartTime || '',
reagents: normalizeReagents(step.reagents),
@@ -94,6 +94,7 @@ function normalizeStepSubTables(step: Record<string, any>) {
assigneeUserIds,
assignees: step.assignees || [],
plannedStartTime,
sopContent: step.sopContent || '',
_snapshotAssigneeUserIds: [...assigneeUserIds],
_snapshotPlannedStartTime: plannedStartTime || '',
reagents: (step.reagents || []).map((r: Record<string, any>) => ({
@@ -1302,7 +1303,8 @@ export function useTaskStepEditor() {
category_id: selectedStep.value.categoryId,
description: selectedStep.value.description,
estimated_duration: selectedStep.value.estimatedDuration,
sop_ids: selectedStep.value.sopIds
sop_ids: selectedStep.value.sopIds,
sop_content: selectedStep.value.sopContent
},
operateScope.value
)
@@ -1992,7 +1994,8 @@ export function useTaskStepEditor() {
category_id: step.categoryId,
description: step.description,
estimated_duration: step.estimatedDuration,
sop_ids: step.sopIds
sop_ids: step.sopIds,
sop_content: step.sopContent
},
operateScope.value
)