merge: fix supplier evaluation saving

bugfix/ai-assessment-evidence-rescore
chenyuan 1 month ago
commit 48d1e00c0f

@ -429,7 +429,7 @@ async function saveStepOne(showMessage = true) {
try { try {
const result = (await validateSupplierEvaluationStepOne(buildStepOnePayload()))?.data || {}; const result = (await validateSupplierEvaluationStepOne(buildStepOnePayload()))?.data || {};
if (!result?.valid) throw new Error(result?.message || "权重校验未通过"); if (!result?.valid) throw new Error(result?.message || "权重校验未通过");
await saveStudentTrainingAnswer({ taskKey: TASK_KEY, currentStep: 1, saveAction: "SAVE", progressStatus: "IN_PROGRESS", step1Answer: JSON.stringify({ items: result.items }) }); await saveStudentTrainingAnswer(TASK_KEY, { currentStep: 1, saveAction: "SAVE", progressStatus: "IN_PROGRESS", step1Answer: JSON.stringify({ items: result.items }) });
stepOneSaved.value = true; stepOneSaved.value = true;
if (showMessage) ElMessage.success("当前步骤已保存"); if (showMessage) ElMessage.success("当前步骤已保存");
return true; return true;
@ -446,7 +446,7 @@ async function saveStepTwo(showMessage = true) {
if (!result?.valid) throw new Error(result?.message || "渠道评分校验未通过"); if (!result?.valid) throw new Error(result?.message || "渠道评分校验未通过");
smallBatchRows.value = createScoreRows(result.smallBatchChannels); smallBatchRows.value = createScoreRows(result.smallBatchChannels);
largeBatchRows.value = createScoreRows(result.largeBatchChannels); largeBatchRows.value = createScoreRows(result.largeBatchChannels);
await saveStudentTrainingAnswer({ taskKey: TASK_KEY, currentStep: 2, saveAction: "SAVE", progressStatus: "IN_PROGRESS", step2Answer: JSON.stringify({ weights: result.weights, smallBatchChannels: result.smallBatchChannels, largeBatchChannels: result.largeBatchChannels }) }); await saveStudentTrainingAnswer(TASK_KEY, { currentStep: 2, saveAction: "SAVE", progressStatus: "IN_PROGRESS", step2Answer: JSON.stringify({ weights: result.weights, smallBatchChannels: result.smallBatchChannels, largeBatchChannels: result.largeBatchChannels }) });
stepTwoSaved.value = true; stepTwoSaved.value = true;
syncChannelNames(); syncChannelNames();
if (showMessage) ElMessage.success("当前步骤已保存"); if (showMessage) ElMessage.success("当前步骤已保存");
@ -462,7 +462,7 @@ async function saveStepThree(showMessage = true) {
const result = (await validateSupplierEvaluationStepThree(buildStepThreePayload()))?.data || {}; const result = (await validateSupplierEvaluationStepThree(buildStepThreePayload()))?.data || {};
if (!result?.valid) throw new Error(result?.message || "第 3 步校验未通过"); if (!result?.valid) throw new Error(result?.message || "第 3 步校验未通过");
const step3Answer = { scenarioAnalyses: result.scenarioAnalyses, procurementRecommendation: result.procurementRecommendation, risks: result.risks }; const step3Answer = { scenarioAnalyses: result.scenarioAnalyses, procurementRecommendation: result.procurementRecommendation, risks: result.risks };
await saveStudentTrainingAnswer({ taskKey: TASK_KEY, currentStep: 3, saveAction: "SAVE", progressStatus: "IN_PROGRESS", step3Answer: JSON.stringify(step3Answer) }); await saveStudentTrainingAnswer(TASK_KEY, { currentStep: 3, saveAction: "SAVE", progressStatus: "IN_PROGRESS", step3Answer: JSON.stringify(step3Answer) });
applyStepThree({ step3Answer }); applyStepThree({ step3Answer });
if (showMessage) ElMessage.success("当前步骤已保存"); if (showMessage) ElMessage.success("当前步骤已保存");
return true; return true;

@ -19,3 +19,8 @@ test("供应渠道评估使用接口 data 中的校验结果和学生答案", ()
assert.match(source, /const result = \(await validateSupplierEvaluationStepThree\(buildStepThreePayload\(\)\)\)\?\.data \|\| \{\};/); assert.match(source, /const result = \(await validateSupplierEvaluationStepThree\(buildStepThreePayload\(\)\)\)\?\.data \|\| \{\};/);
assert.match(source, /const answer = \(await getStudentTrainingAnswer\(TASK_KEY\)\)\?\.data \|\| \{\};/); assert.match(source, /const answer = \(await getStudentTrainingAnswer\(TASK_KEY\)\)\?\.data \|\| \{\};/);
}); });
test("供应渠道评估保存时将任务标识和答案作为两个参数传入", () => {
assert.equal((source.match(/saveStudentTrainingAnswer\(TASK_KEY,\s*\{/g) || []).length, 3);
assert.doesNotMatch(source, /saveStudentTrainingAnswer\(\{\s*taskKey:/);
});

Loading…
Cancel
Save