|
|
@ -10,13 +10,13 @@ |
|
|
|
</el-tooltip> |
|
|
|
</el-tooltip> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="py-5 px-[300px]"> |
|
|
|
<div class="py-5 px-[300px]" v-loading="loading"> |
|
|
|
<div class="content" :class="{ loading }" id="pdfDom"> |
|
|
|
<div class="content" id="pdfDom"> |
|
|
|
<div class="text-right" v-if="!loading"> |
|
|
|
<div class="text-right" v-if="!loading"> |
|
|
|
<el-button @click="editReport"> |
|
|
|
<el-button @click="editReport"> |
|
|
|
{{ editing ? '保存' : '编辑' }} |
|
|
|
{{ editing ? '保存' : '编辑' }} |
|
|
|
</el-button> |
|
|
|
</el-button> |
|
|
|
<el-button type="primary" @click="exportPage">导出报告</el-button> |
|
|
|
<el-button type="primary" :loading="exporting" @click="exportPage">导出报告</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<h6 class="mb-8 text-[24px] text-center text-[#333]">标准实验报告</h6> |
|
|
|
<h6 class="mb-8 text-[24px] text-center text-[#333]">标准实验报告</h6> |
|
|
|
<div class="max-h-[calc(100vh-204px)] overflow-auto p-4 border border-solid border-[#e1e6f2]"> |
|
|
|
<div class="max-h-[calc(100vh-204px)] overflow-auto p-4 border border-solid border-[#e1e6f2]"> |
|
|
@ -154,6 +154,8 @@ const form = ref<Record<string, any>>({}); |
|
|
|
const expData = ref<Record<string, any>[]>([]); |
|
|
|
const expData = ref<Record<string, any>[]>([]); |
|
|
|
const editing = ref<boolean>(false); |
|
|
|
const editing = ref<boolean>(false); |
|
|
|
const userScores = ref<Record<string, any>[]>([]); |
|
|
|
const userScores = ref<Record<string, any>[]>([]); |
|
|
|
|
|
|
|
const loading = ref<boolean>(false); |
|
|
|
|
|
|
|
const exporting = ref<boolean>(false); |
|
|
|
|
|
|
|
|
|
|
|
// 处理实验数据 |
|
|
|
// 处理实验数据 |
|
|
|
const handleList = (list: Record<string, any>[]) => { |
|
|
|
const handleList = (list: Record<string, any>[]) => { |
|
|
@ -176,7 +178,7 @@ const handleList = (list: Record<string, any>[]) => { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
e.lcStudentAnswer.map((n, i) => { |
|
|
|
e.lcStudentAnswer.map((n, i) => { |
|
|
|
e.answer += `${i + 1}.${n.userAnswer || '未填写'};` |
|
|
|
e.answer += `${i + 1}.${n.userAnswer || '未填写'};`; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
console.log('🚀 ~ file: Index.vue:235 ~ handleList ~ list:', list); |
|
|
|
console.log('🚀 ~ file: Index.vue:235 ~ handleList ~ list:', list); |
|
|
@ -184,49 +186,59 @@ const handleList = (list: Record<string, any>[]) => { |
|
|
|
}; |
|
|
|
}; |
|
|
|
// 查询详情 |
|
|
|
// 查询详情 |
|
|
|
const getData = async () => { |
|
|
|
const getData = async () => { |
|
|
|
const res = await reportDetail(reportId.value); |
|
|
|
try { |
|
|
|
form.value = res.report; |
|
|
|
loading.value = true; |
|
|
|
userScores.value = res.userScores; |
|
|
|
const res = await reportDetail(reportId.value); |
|
|
|
const { data } = res.report; |
|
|
|
form.value = res.report; |
|
|
|
// 如果没有data,则添加,否则,直接使用 |
|
|
|
userScores.value = res.userScores; |
|
|
|
if (!data) { |
|
|
|
const { data } = res.report; |
|
|
|
handleList(res.userScores); |
|
|
|
// 如果没有data,则添加,否则,直接使用 |
|
|
|
await editExperimentalData({ |
|
|
|
if (!data) { |
|
|
|
reportId: reportId.value, |
|
|
|
handleList(res.userScores); |
|
|
|
data: JSON.stringify(res.userScores), |
|
|
|
await editExperimentalData({ |
|
|
|
}); |
|
|
|
reportId: reportId.value, |
|
|
|
} else { |
|
|
|
data: JSON.stringify(res.userScores), |
|
|
|
handleList(res.userScores); |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
handleList(res.userScores); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
loading.value = false; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
// 导出 |
|
|
|
// 导出 |
|
|
|
const exportPage = async () => { |
|
|
|
const exportPage = async () => { |
|
|
|
const param = JSON.parse(JSON.stringify(form.value)); |
|
|
|
try { |
|
|
|
const list = JSON.parse(JSON.stringify(expData.value)); |
|
|
|
exporting.value = true; |
|
|
|
list.forEach((e, i) => { |
|
|
|
const param = JSON.parse(JSON.stringify(form.value)); |
|
|
|
e.id = i + 1; |
|
|
|
const list = JSON.parse(JSON.stringify(expData.value)); |
|
|
|
if (e.referenceAnswer && typeof e.referenceAnswer === 'string') |
|
|
|
list.forEach((e, i) => { |
|
|
|
e.referenceAnswer = e.referenceAnswer |
|
|
|
e.id = i + 1; |
|
|
|
.replace(/<[^>]+>/g, '') |
|
|
|
if (e.referenceAnswer && typeof e.referenceAnswer === 'string') |
|
|
|
.replace(/( |&|%s)/g, '') |
|
|
|
e.referenceAnswer = e.referenceAnswer |
|
|
|
.replace(/>/g, '>') |
|
|
|
.replace(/<[^>]+>/g, '') |
|
|
|
.replace(/</g, '<'); |
|
|
|
.replace(/( |&|%s)/g, '') |
|
|
|
if (e.answer && typeof e.answer === 'string') { |
|
|
|
.replace(/>/g, '>') |
|
|
|
e.answer = e.answer.replace(/<[^>]+>/g, ''); |
|
|
|
.replace(/</g, '<'); |
|
|
|
e.answer = e.answer.replace(/( |&|%s)/g, ''); |
|
|
|
if (e.answer && typeof e.answer === 'string') { |
|
|
|
e.answer = e.answer.replace(/>/g, '>'); |
|
|
|
e.answer = e.answer.replace(/<[^>]+>/g, ''); |
|
|
|
e.answer = e.answer.replace(/</g, '<'); |
|
|
|
e.answer = e.answer.replace(/( |&|%s)/g, ''); |
|
|
|
|
|
|
|
e.answer = e.answer.replace(/>/g, '>'); |
|
|
|
|
|
|
|
e.answer = e.answer.replace(/</g, '<'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
for (const i in param) { |
|
|
|
|
|
|
|
if (param[i] && typeof param[i] === 'string') param[i] = param[i].replace(/<[^>]+>/g, ''); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
param.purpose = param.purpose.replace(/<[^>]+>/g, ''); |
|
|
|
for (const i in param) { |
|
|
|
const res = await exportBankExperimentReport({ |
|
|
|
if (param[i] && typeof param[i] === 'string') param[i] = param[i].replace(/<[^>]+>/g, ''); |
|
|
|
...param, |
|
|
|
|
|
|
|
experimentalData: list, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
downloadFileDirect(`实验报告.docx`, new Blob([res])); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
exporting.value = false; |
|
|
|
} |
|
|
|
} |
|
|
|
param.purpose = param.purpose.replace(/<[^>]+>/g, ''); |
|
|
|
|
|
|
|
const res = await exportBankExperimentReport({ |
|
|
|
|
|
|
|
...param, |
|
|
|
|
|
|
|
experimentalData: list, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
downloadFileDirect(`实验报告.docx`, new Blob([res])); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
// 编辑实验报告 |
|
|
|
// 编辑实验报告 |
|
|
|
const editReport = async () => { |
|
|
|
const editReport = async () => { |
|
|
@ -267,9 +279,6 @@ samp { |
|
|
|
font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, 'microsoft yahei', arial, STHeiTi, sans-serif; |
|
|
|
font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, 'microsoft yahei', arial, STHeiTi, sans-serif; |
|
|
|
} |
|
|
|
} |
|
|
|
.content { |
|
|
|
.content { |
|
|
|
&.loading { |
|
|
|
|
|
|
|
padding-top: 30px; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.l-title { |
|
|
|
.l-title { |
|
|
|
@apply flex items-center px-2 py-1 mb-3 bg-[#f7f9fc]; |
|
|
|
@apply flex items-center px-2 py-1 mb-3 bg-[#f7f9fc]; |
|
|
|
img { |
|
|
|
img { |
|
|
|