实验报告且或

master
yujialong 6 months ago
parent 480e5f35fe
commit 1174a60114
  1. 56
      src/views/report/Index.vue

@ -87,38 +87,37 @@
</h6> </h6>
<el-table class="mb-4" :data="expData" border header-align="center"> <el-table class="mb-4" :data="expData" border header-align="center">
<el-table-column type="index" label="序号" align="center" width="60"> <el-table-column type="index" label="序号" align="center" width="60">
<template #default="{ row, $index }"> <template #default="{ $index }">
{{ $index + 1 }} {{ $index + 1 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="judgmentName" label="判分点" width="200" align="center"></el-table-column> <el-table-column prop="judgmentName" label="判分点" width="200" align="center"></el-table-column>
<el-table-column prop="judgmentName" label="考核点" align="center" width="150"> <el-table-column prop="judgmentName" label="考核点" align="center" width="150">
<template #default="{ row }"> <template #default="{ row }">
<div v-for="(item, i) in row.lcRuleRecords" :key="i"> <div v-for="(item, i) in row.lcRuleRecords" :key="i" class="rule-line">
<span> <span>{{ item.index }}. </span>{{ item.name }}
<span>{{ i + 1 }}. </span>{{ item.name }} <p v-if="item.ruleOperation === '或'" class="my-1">
</span> {{ item.ruleOperation === '或' ? '或' : '' }}
</p>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="ruleAnswer" label="参考答案" style="word-wrap: break-word"> <el-table-column prop="ruleAnswer" label="参考答案" style="word-wrap: break-word">
<template #default="{ row }"> <template #default="{ row }">
<div v-for="(item, i) in row?.lcRuleRecords" :key="i"> <div v-if="row.lcRuleRecords">
<span> <div v-for="(item, i) in row.lcRuleRecords" :key="i" class="rule-line">
<span>{{ i + 1 }}. </span>{{ item.ruleAnswer }} <span>{{ item.index }}. </span>{{ item.ruleAnswer }}
</span> <p v-if="item.ruleOperation === '或'" class="pl-1 my-1">
{{ item.ruleOperation === '或' ? '或' : '' }}
</p>
</div>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="userAnswer" label="学生答案"> <el-table-column prop="userAnswer" label="学生答案">
<template #default="{ row }"> <template #default="{ row }">
<div v-for="(item, i) in row?.lcRuleRecords" :key="i"> <div v-if="row.lcStudentAnswer">
<span v-if="item.userAnswer"> <div v-for="(item, i) in row.lcStudentAnswer" :key="i" class="rule-line">{{ i + 1 }}. {{ item.userAnswer || '未填写' }}</div>
<span>{{ i + 1 }}. </span>{{ item.userAnswer }}
</span>
<span v-else>
<span>{{ i + 1 }}. </span>未填写
</span>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -162,11 +161,22 @@ const handleList = (list: Record<string, any>[]) => {
e.assessmentPoint = ''; e.assessmentPoint = '';
e.referenceAnswer = ''; e.referenceAnswer = '';
e.answer = ''; e.answer = '';
e?.lcRuleRecords?.map((n, i) => { let index = 1;
e.assessmentPoint += `${i + 1}.${n.name}`; e.lcRuleRecords.map((n, i) => {
// e.referenceAnswer += `${i + 1}.${n.ruleAnswer}`; n.index = index;
e.referenceAnswer += `${i + 1}.${n.ruleAnswer}`; //
e.answer += `${i + 1}.${n.userAnswer || '未填写'}`; e.assessmentPoint += `${index}.${n.name};${n.ruleOperation === '或' ? '\n或\n' : ''}`;
e.referenceAnswer += `${index}.${n.ruleAnswer};${n.ruleOperation === '或' ? '\n或\n' : ''}`;
if (!n.userAnswer) n.userAnswer = '未填写';
if (n.ruleOperation === '或') {
index = 1;
} else {
index++;
}
});
e.lcStudentAnswer.map((n, i) => {
e.answer += `${i + 1}.${n.userAnswer || '未填写'};`
}); });
}); });
console.log('🚀 ~ file: Index.vue:235 ~ handleList ~ list:', list); console.log('🚀 ~ file: Index.vue:235 ~ handleList ~ list:', list);
@ -233,9 +243,7 @@ const toLevel = () => {
router.push('/'); router.push('/');
}; };
onMounted(() => { onMounted(getData);
getData();
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

Loading…
Cancel
Save