发起变更提交-等级判定表分数保存问题修改

This commit is contained in:
2026-10-08 17:23:29 +08:00
parent 167b3de60d
commit 26582cf421
4 changed files with 27 additions and 21 deletions
@@ -29,6 +29,13 @@ watch(() => props.currentForm, (newVal:any) => {
...rest
} = newVal;
form.value = rest;
// 用 Map 建立 question_id -> score 的映射,查找 O(1)
const scoreMap = new Map(form.value?.level_score?.map((item:any) => [item.question_id, item.score]) || []);
questions.value = questions.value.map((item:any) => ({
...item,
score: scoreMap.has(item.question_id) ? scoreMap.get(item.question_id) : item.score
}));
totalScore.value = questions.value.reduce((sum:number, item:any) => sum + (item.score || 0), 0);
})
const aiFail = (e: any) => {
@@ -69,6 +76,7 @@ const form = ref<{
disciplines: string[],
plan_use_date: number | null,
risk_tools: string[],
level_score: any[],
}>({
change_type: null,
change_level: computed(() => totalScore.value >= 20 ? 2 : 1),
@@ -85,6 +93,7 @@ const form = ref<{
disciplines: [],
plan_use_date: null,
risk_tools: [],
level_score: [],
});
// 变更目的选项
const PURPOSE_OPTIONS = [
@@ -811,7 +820,7 @@ defineExpose({form, questions, applyAiResult, generateLevel: useAiLevel})
align-items: center;
}
.scroll {
height: calc(100vh - 395px);
height: calc(100vh - 393px);
overflow-y: auto;
}
</style>