| | |
| | | if (sequence !== previewSequence) return |
| | | items.value = result.items |
| | | cycleNos.value = result.cycleNos |
| | | // 可靠识别的充放电工步默认全部纳入曲线;未知类型留给操作员人工指定。 |
| | | const nextSelections: Record<string, FormationStepSelection> = { ...curveStepSelections.value } |
| | | for (const item of items.value) for (const cycle of item.cycleNos) { |
| | | const key = formationCycleKey(item, cycle) |
| | | const choices = item.chargeSteps?.[String(cycle)] ?? [] |
| | | const charge = choices.filter(step => step.direction === 'CHARGE').map(step => step.stepNo) |
| | | const discharge = choices.filter(step => step.direction === 'DISCHARGE').map(step => step.stepNo) |
| | | const existing = nextSelections[key] |
| | | nextSelections[key] = existing |
| | | ? { charge: existing.charge ?? charge, discharge: existing.discharge ?? discharge } |
| | | : { charge, discharge } |
| | | } |
| | | curveStepSelections.value = nextSelections |
| | | fields.value = fields.value.map(field => field.kind === 'battery' && field.fieldDefinitionId == null |
| | | ? { ...field, fieldDefinitionId: items.value.flatMap(item => item.businessFields).find(value => value.fieldName === field.key)?.fieldDefinitionId ?? null } : field) |
| | | pruneValues() |