feat(wms/coil): 优化钢卷生命周期追踪的步骤插槽数据传递
1. 给CoilTraceResult的stepBody插槽新增allSteps参数传递标准化后的全量步骤列表 2. 在LifecycleTrace中新增getCreationCoils方法,实现创建步骤钢卷列表的兜底获取逻辑: - 优先使用步骤自身的newCoilInfoList - 若为空则通过全量步骤匹配获取前序步骤的旧钢卷信息 - 最后兜底使用当前钢卷信息 3. 修复入库步骤空钢卷判断和列表渲染的逻辑
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
<div class="section-body">
|
||||
<coil-trace-result :trace-result="traceResult">
|
||||
<template #stepBody="{ step, compact }">
|
||||
<template #stepBody="{ step, compact, allSteps }">
|
||||
<div class="step-item">
|
||||
<template v-if="step.action === '创建'">
|
||||
<div v-if="compact" class="step-content step-content-compact step-content-inbound">
|
||||
@@ -14,9 +14,9 @@
|
||||
<div class="coil-card-header inbound-header">
|
||||
<span class="card-label">📦 入库</span>
|
||||
</div>
|
||||
<CoilCardCompact v-for="(coil, idx) in step.newCoilInfoList" :key="idx" :coil="coil"
|
||||
<CoilCardCompact v-for="(coil, idx) in getCreationCoils(step, allSteps)" :key="idx" :coil="coil"
|
||||
v-if="coil && coil.currentCoilNo !== '-'" variant="inbound" />
|
||||
<div v-if="isEmpty(step.newCoilInfoList)" class="empty-coil">
|
||||
<div v-if="isEmpty(getCreationCoils(step, allSteps))" class="empty-coil">
|
||||
<span>无钢卷信息</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -37,9 +37,9 @@
|
||||
<div class="coil-card-header inbound-header">
|
||||
<span class="card-label">📦 入库</span>
|
||||
</div>
|
||||
<CoilCardFuturistic v-for="(coil, idx) in step.newCoilInfoList" :key="idx" :coil="coil" type="inbound"
|
||||
<CoilCardFuturistic v-for="(coil, idx) in getCreationCoils(step, allSteps)" :key="idx" :coil="coil" type="inbound"
|
||||
v-if="coil && coil.currentCoilNo !== '-'" />
|
||||
<div v-if="isEmpty(step.newCoilInfoList)" class="empty-coil">
|
||||
<div v-if="isEmpty(getCreationCoils(step, allSteps))" class="empty-coil">
|
||||
<span>无钢卷信息</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -152,6 +152,31 @@ export default {
|
||||
methods: {
|
||||
isEmpty(list) {
|
||||
return !list || list.length === 0 || list.every(c => !c || c.currentCoilNo === '-')
|
||||
},
|
||||
// 获取创建步骤的钢卷列表(含兜底逻辑)
|
||||
getCreationCoils(step, allSteps) {
|
||||
// 如果已有有效钢卷信息,直接返回
|
||||
if (!this.isEmpty(step.newCoilInfoList)) return step.newCoilInfoList
|
||||
|
||||
// 兜底1:从后续步骤的"变更前"获取(加工前的钢卷)
|
||||
// 使用 display_step 或 storage_index 匹配步骤(避免 traceLayout 下对象引用不一致)
|
||||
if (allSteps && allSteps.length > 1) {
|
||||
const stepId = step.original?.display_step ?? step.original?.storage_index
|
||||
const idx = stepId != null
|
||||
? allSteps.findIndex(s => (s.original?.display_step ?? s.original?.storage_index) === stepId)
|
||||
: -1
|
||||
if (idx >= 0 && idx < allSteps.length - 1) {
|
||||
const nextStep = allSteps[idx + 1]
|
||||
if (!this.isEmpty(nextStep.oldCoilInfoList)) return nextStep.oldCoilInfoList
|
||||
}
|
||||
}
|
||||
|
||||
// 兜底2:使用当前钢卷信息作为创建的卷
|
||||
if (this.coilInfo && this.coilInfo.currentCoilNo && this.coilInfo.currentCoilNo !== '-') {
|
||||
return [this.coilInfo]
|
||||
}
|
||||
|
||||
return step.newCoilInfoList
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div v-if="panel.type === 'linear'" :key="'lin-' + pIdx" class="trace-panel-block">
|
||||
<el-card shadow="hover" v-for="(rawStep, idx) in panel.steps">
|
||||
<template v-if="$scopedSlots.stepBody">
|
||||
<slot name="stepBody" :step="formatStep(rawStep)" :compact="false" />
|
||||
<slot name="stepBody" :step="formatStep(rawStep)" :compact="false" :all-steps="standardSteps" />
|
||||
</template>
|
||||
<trace-step-body v-else :standard-step="formatStep(rawStep)" :get-step-tag-type="getStepTagType"
|
||||
:parse-changed-fields="parseChangedFields" />
|
||||
@@ -23,7 +23,7 @@
|
||||
<div class="lane-steps-stack">
|
||||
<el-card v-for="(rawStep, si) in lane" :key="si" shadow="hover" class="lane-step-card mb10">
|
||||
<template v-if="$scopedSlots.stepBody">
|
||||
<slot name="stepBody" :step="formatStep(rawStep)" :compact="true" />
|
||||
<slot name="stepBody" :step="formatStep(rawStep)" :compact="true" :all-steps="standardSteps" />
|
||||
</template>
|
||||
<trace-step-body v-else :standard-step="formatStep(rawStep)" :get-step-tag-type="getStepTagType"
|
||||
:parse-changed-fields="parseChangedFields" compact />
|
||||
@@ -35,7 +35,7 @@
|
||||
<el-divider content-position="center">合卷汇聚</el-divider>
|
||||
<el-card shadow="hover">
|
||||
<template v-if="$scopedSlots.stepBody">
|
||||
<slot name="stepBody" :step="formatStep(panel.mergeStep)" :compact="false" />
|
||||
<slot name="stepBody" :step="formatStep(panel.mergeStep)" :compact="false" :all-steps="standardSteps" />
|
||||
</template>
|
||||
<trace-step-body v-else :standard-step="formatStep(panel.mergeStep)" :get-step-tag-type="getStepTagType"
|
||||
:parse-changed-fields="parseChangedFields" />
|
||||
|
||||
Reference in New Issue
Block a user