fix(hardware-cost): separate step-4 save from submit with distinct toasts

saveStepFour hardcoded saveAction SUBMIT, so the step-4 save button also
submitted the task and both paths toasted '成本优化决策已保存', leaving
students unsure whether they had submitted (实训4.1). The toolbar submit
now goes through submitTask() -> SUBMIT + '任务提交成功', while the step
save keeps a SAVE draft + the original toast.
dev-QQq
chenyuan 1 month ago
parent c515164653
commit 1b23ee0332

@ -22,7 +22,7 @@
</section> </section>
<section class="task-action-strip"> <section class="task-action-strip">
<TrainingTaskToolbar :task-key="TASK_KEY" :on-submit="saveStepFour" /> <TrainingTaskToolbar :task-key="TASK_KEY" :on-submit="submitTask" />
</section> </section>
<section class="hardware-workbench"> <section class="hardware-workbench">
@ -743,7 +743,9 @@ async function handleCostChartUpload(event, type) {
uploadingChart.value = "" uploadingChart.value = ""
} }
} }
async function saveStepFour() { function submitTask() { return saveStepFour(true) }
async function saveStepFour(submit = false) {
savingStepFour.value = true savingStepFour.value = true
try { try {
const payload = stepFourPayload() const payload = stepFourPayload()
@ -753,15 +755,15 @@ async function saveStepFour() {
if (!validated.valid) { notifyError(validated.message || "请完善成本结构图和优化方案"); return } if (!validated.valid) { notifyError(validated.message || "请完善成本结构图和优化方案"); return }
await saveStudentTrainingAnswer(TASK_KEY, { await saveStudentTrainingAnswer(TASK_KEY, {
currentStep: 4, currentStep: 4,
saveAction: "SUBMIT", saveAction: submit ? "SUBMIT" : "SAVE",
submitted: true, submitted: submit,
step4Answer: JSON.stringify({ step4Answer: JSON.stringify({
smallBatchChart: { ...stepFour.smallBatchChart }, smallBatchChart: { ...stepFour.smallBatchChart },
largeBatchChart: { ...stepFour.largeBatchChart }, largeBatchChart: { ...stepFour.largeBatchChart },
optimizationPlan: payload.optimizationPlan, optimizationPlan: payload.optimizationPlan,
}), }),
}) })
notifySuccess("成本优化决策已保存") notifySuccess(submit ? "任务提交成功" : "成本优化决策已保存")
} catch (error) { } catch (error) {
notifyError(error?.message || "成本优化决策保存失败,请检查填写内容") notifyError(error?.message || "成本优化决策保存失败,请检查填写内容")
} finally { } finally {

Loading…
Cancel
Save