|
|
|
@ -112,6 +112,12 @@
|
|
|
|
<div class="task-actions"><button type="button" class="btn-nav btn-submit" :disabled="saving" @click="saveAndGoToStepFour">保存并进入第 4 步</button><button type="button" class="btn-nav" :disabled="saving" @click="resetTraining"><el-icon><RefreshLeft /></el-icon>清空填写</button></div>
|
|
|
|
<div class="task-actions"><button type="button" class="btn-nav btn-submit" :disabled="saving" @click="saveAndGoToStepFour">保存并进入第 4 步</button><button type="button" class="btn-nav" :disabled="saving" @click="resetTraining"><el-icon><RefreshLeft /></el-icon>清空填写</button></div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<template v-else-if="currentStep === 3">
|
|
|
|
|
|
|
|
<p class="factor-intro">结合案例信息及前述步骤,分析案例资料中产品一成功的关键因素是什么,产品二失败的关键因素是什么。</p>
|
|
|
|
|
|
|
|
<label class="factor-intro">产品成功的关键因素:</label><textarea v-model="stepFourForm.successFactors" class="table-textarea summary-textarea" />
|
|
|
|
|
|
|
|
<label class="factor-intro">产品失败的关键因素:</label><textarea v-model="stepFourForm.failedFactors" class="table-textarea summary-textarea" />
|
|
|
|
|
|
|
|
<div class="task-actions"><button type="button" class="btn-nav btn-submit" :disabled="saving" @click="submitTraining">提交任务</button><button type="button" class="btn-nav" :disabled="saving" @click="resetTraining">清空填写</button></div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
<div v-else class="step-placeholder">
|
|
|
|
<div v-else class="step-placeholder">
|
|
|
|
<p>第 {{ currentStep + 1 }} 步内容待配置</p>
|
|
|
|
<p>第 {{ currentStep + 1 }} 步内容待配置</p>
|
|
|
|
<span>已保存的分析可从上方步骤栏返回查看。</span>
|
|
|
|
<span>已保存的分析可从上方步骤栏返回查看。</span>
|
|
|
|
@ -133,7 +139,7 @@
|
|
|
|
<script setup>
|
|
|
|
<script setup>
|
|
|
|
import { Download, Operation, RefreshLeft } from "@element-plus/icons-vue";
|
|
|
|
import { Download, Operation, RefreshLeft } from "@element-plus/icons-vue";
|
|
|
|
import { getTrainingTaskByKey } from "@/api/trainingTask";
|
|
|
|
import { getTrainingTaskByKey } from "@/api/trainingTask";
|
|
|
|
import { checkProductDevelopmentFactorsStepOne, checkProductDevelopmentFactorsStepTwo, checkProductDevelopmentFactorsStepThree, getStudentTrainingAnswer, saveStudentTrainingAnswer } from "@/api/studentTrainingAnswer";
|
|
|
|
import { checkProductDevelopmentFactorsStepOne, checkProductDevelopmentFactorsStepTwo, checkProductDevelopmentFactorsStepThree, checkProductDevelopmentFactorsStepFour, getStudentTrainingAnswer, saveStudentTrainingAnswer } from "@/api/studentTrainingAnswer";
|
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
|
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
|
|
|
|
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
|
|
|
|
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
|
|
|
|
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
|
|
|
|
@ -206,6 +212,7 @@ const createStepThreeRows = () => STEP_THREE_FACTOR_ROWS.map((row) => ({ ...row,
|
|
|
|
const stepOneRows = ref(createStepOneRows());
|
|
|
|
const stepOneRows = ref(createStepOneRows());
|
|
|
|
const stepTwoRows = ref(createStepTwoRows());
|
|
|
|
const stepTwoRows = ref(createStepTwoRows());
|
|
|
|
const stepThreeRows = ref(createStepThreeRows());
|
|
|
|
const stepThreeRows = ref(createStepThreeRows());
|
|
|
|
|
|
|
|
const stepFourForm = ref({ successFactors: "", failedFactors: "" });
|
|
|
|
|
|
|
|
|
|
|
|
const progressItems = [
|
|
|
|
const progressItems = [
|
|
|
|
{ text: "进行中:成功/失败产品对比", status: "doing" },
|
|
|
|
{ text: "进行中:成功/失败产品对比", status: "doing" },
|
|
|
|
@ -246,6 +253,7 @@ async function loadSavedAnswer() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (answer?.step2Answer) stepTwoRows.value = restoreRows(answer.step2Answer, createStepTwoRows);
|
|
|
|
if (answer?.step2Answer) stepTwoRows.value = restoreRows(answer.step2Answer, createStepTwoRows);
|
|
|
|
if (answer?.step3Answer) stepThreeRows.value = restoreRows(answer.step3Answer, createStepThreeRows);
|
|
|
|
if (answer?.step3Answer) stepThreeRows.value = restoreRows(answer.step3Answer, createStepThreeRows);
|
|
|
|
|
|
|
|
if (answer?.step4Answer) stepFourForm.value = { ...stepFourForm.value, ...parseSavedAnswer(answer.step4Answer) };
|
|
|
|
restoreCurrentStep(answer?.currentStep);
|
|
|
|
restoreCurrentStep(answer?.currentStep);
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
// Keep local draft when the backend answer cannot be loaded.
|
|
|
|
// Keep local draft when the backend answer cannot be loaded.
|
|
|
|
@ -327,6 +335,7 @@ function loadDraft() {
|
|
|
|
else stepOneRows.value = restoreRows(raw, createStepOneRows);
|
|
|
|
else stepOneRows.value = restoreRows(raw, createStepOneRows);
|
|
|
|
if (draft?.stepTwo) stepTwoRows.value = restoreRows(draft.stepTwo, createStepTwoRows);
|
|
|
|
if (draft?.stepTwo) stepTwoRows.value = restoreRows(draft.stepTwo, createStepTwoRows);
|
|
|
|
if (draft?.stepThree) stepThreeRows.value = restoreRows(draft.stepThree, createStepThreeRows);
|
|
|
|
if (draft?.stepThree) stepThreeRows.value = restoreRows(draft.stepThree, createStepThreeRows);
|
|
|
|
|
|
|
|
if (draft?.stepFour) stepFourForm.value = { ...stepFourForm.value, ...draft.stepFour };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
clearDraft();
|
|
|
|
clearDraft();
|
|
|
|
@ -354,7 +363,8 @@ function buildStepOneOutcome() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function buildStepTwoOutcome() { return { title: taskTitle.value, factors: stepTwoRows.value.map((row) => ({ dimension: row.dimension, criteria: row.criteria, successAnalysis: row.successAnalysis, failedAnalysis: row.failedAnalysis })) }; }
|
|
|
|
function buildStepTwoOutcome() { return { title: taskTitle.value, factors: stepTwoRows.value.map((row) => ({ dimension: row.dimension, criteria: row.criteria, successAnalysis: row.successAnalysis, failedAnalysis: row.failedAnalysis })) }; }
|
|
|
|
function buildStepThreeOutcome() { return { title: taskTitle.value, factors: stepThreeRows.value.map((row) => ({ dimension: row.dimension, criteria: row.criteria, successAnalysis: row.successAnalysis, failedAnalysis: row.failedAnalysis })) }; }
|
|
|
|
function buildStepThreeOutcome() { return { title: taskTitle.value, factors: stepThreeRows.value.map((row) => ({ dimension: row.dimension, criteria: row.criteria, successAnalysis: row.successAnalysis, failedAnalysis: row.failedAnalysis })) }; }
|
|
|
|
function buildDraft() { return { stepOne: buildStepOneOutcome(), stepTwo: buildStepTwoOutcome(), stepThree: buildStepThreeOutcome(), currentStep: currentStep.value + 1 }; }
|
|
|
|
function buildStepFourOutcome() { return { successFactors: stepFourForm.value.successFactors, failedFactors: stepFourForm.value.failedFactors }; }
|
|
|
|
|
|
|
|
function buildDraft() { return { stepOne: buildStepOneOutcome(), stepTwo: buildStepTwoOutcome(), stepThree: buildStepThreeOutcome(), stepFour: buildStepFourOutcome(), currentStep: currentStep.value + 1 }; }
|
|
|
|
|
|
|
|
|
|
|
|
function buildStepOneValidationPayload() {
|
|
|
|
function buildStepOneValidationPayload() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
@ -378,6 +388,8 @@ function buildStepTwoValidationPayload() { return { factors: stepTwoRows.value.m
|
|
|
|
function buildStepTwoAnswerPayload(saveAction = "SAVE", persistedStep = currentStep.value + 1) { return { step2Answer: JSON.stringify(buildStepTwoOutcome()), currentStep: persistedStep, submitted: false, saveAction }; }
|
|
|
|
function buildStepTwoAnswerPayload(saveAction = "SAVE", persistedStep = currentStep.value + 1) { return { step2Answer: JSON.stringify(buildStepTwoOutcome()), currentStep: persistedStep, submitted: false, saveAction }; }
|
|
|
|
function buildStepThreeValidationPayload() { return { factors: stepThreeRows.value.map(({ dimension, successAnalysis, failedAnalysis }) => ({ dimension, successAnalysis, failedAnalysis })) }; }
|
|
|
|
function buildStepThreeValidationPayload() { return { factors: stepThreeRows.value.map(({ dimension, successAnalysis, failedAnalysis }) => ({ dimension, successAnalysis, failedAnalysis })) }; }
|
|
|
|
function buildStepThreeAnswerPayload(saveAction = "SAVE", persistedStep = currentStep.value + 1) { return { step3Answer: JSON.stringify(buildStepThreeOutcome()), currentStep: persistedStep, submitted: false, saveAction }; }
|
|
|
|
function buildStepThreeAnswerPayload(saveAction = "SAVE", persistedStep = currentStep.value + 1) { return { step3Answer: JSON.stringify(buildStepThreeOutcome()), currentStep: persistedStep, submitted: false, saveAction }; }
|
|
|
|
|
|
|
|
function buildStepFourValidationPayload() { return buildStepFourOutcome(); }
|
|
|
|
|
|
|
|
function buildStepFourAnswerPayload(saveAction = "SUBMIT", persistedStep = 4) { return { step4Answer: JSON.stringify(buildStepFourOutcome()), currentStep: persistedStep, submitted: true, saveAction }; }
|
|
|
|
|
|
|
|
|
|
|
|
async function saveAndGoToStepTwo() {
|
|
|
|
async function saveAndGoToStepTwo() {
|
|
|
|
if (saving.value) return;
|
|
|
|
if (saving.value) return;
|
|
|
|
@ -424,11 +436,13 @@ async function saveAndGoToStepFour() {
|
|
|
|
proxy?.$modal?.msgSuccess("已保存,已进入第 4 步");
|
|
|
|
proxy?.$modal?.msgSuccess("已保存,已进入第 4 步");
|
|
|
|
} catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成供应链与成本控制、商业模式和市场反馈分析"); } finally { saving.value = false; }
|
|
|
|
} catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成供应链与成本控制、商业模式和市场反馈分析"); } finally { saving.value = false; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function submitTraining() { if (saving.value) return; saving.value = true; try { await checkProductDevelopmentFactorsStepFour(buildStepFourValidationPayload()); await saveStudentTrainingAnswer(TASK_KEY, buildStepFourAnswerPayload("SUBMIT", 4)); clearDraft(); proxy?.$modal?.msgSuccess("任务提交成功"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成关键因素分析"); } finally { saving.value = false; } }
|
|
|
|
|
|
|
|
|
|
|
|
async function resetTraining() {
|
|
|
|
async function resetTraining() {
|
|
|
|
stepOneRows.value = createStepOneRows();
|
|
|
|
stepOneRows.value = createStepOneRows();
|
|
|
|
stepTwoRows.value = createStepTwoRows();
|
|
|
|
stepTwoRows.value = createStepTwoRows();
|
|
|
|
stepThreeRows.value = createStepThreeRows();
|
|
|
|
stepThreeRows.value = createStepThreeRows();
|
|
|
|
|
|
|
|
stepFourForm.value = { successFactors: "", failedFactors: "" };
|
|
|
|
currentStep.value = 0;
|
|
|
|
currentStep.value = 0;
|
|
|
|
clearDraft();
|
|
|
|
clearDraft();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|