You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
402 lines
15 KiB
402 lines
15 KiB
<template> |
|
<div class="box"> |
|
<el-row :gutter="24"> |
|
<el-col :span="24"> |
|
<el-card shadow="hover" class="mgb20"> |
|
<div class="flex-between"> |
|
<div class="per_title" v-preventReClick @click="goback()"> |
|
<i class="el-icon-arrow-left"></i> |
|
<span class="per_back">返回</span> |
|
<span class="per_school">查看报告</span> |
|
</div> |
|
</div> |
|
</el-card> |
|
|
|
<div id="pdfDom"> |
|
<h6 style="text-align: center;font-size: 20px">标准实验报告</h6> |
|
<div class="flex-center mgb20 user_header"> |
|
<p class="addhr_tag"></p> |
|
<span style="font-size: 18px">基本信息</span> |
|
</div> |
|
|
|
<div> |
|
<el-table :data="infoData" class="info-table" stripe header-align="center"> |
|
<el-table-column prop="userName" label="学生姓名" align="center"> |
|
</el-table-column> |
|
<el-table-column prop="workNumber" label="学生学号" align="center"> |
|
</el-table-column> |
|
<el-table-column v-if="!type" prop="experimentalClassName" label="学生班级" align="center"> |
|
</el-table-column> |
|
<el-table-column prop="instructor" label="指导老师" align="center"> |
|
</el-table-column> |
|
<el-table-column prop="period" label="实验学时" align="center"> |
|
</el-table-column> |
|
<el-table-column prop="submitTime" label="实验时间" align="center"> |
|
</el-table-column> |
|
<el-table-column prop="score" label="实验成绩" align="center"> |
|
</el-table-column> |
|
</el-table> |
|
</div> |
|
|
|
<div class="mgb20"> |
|
<div class="meta-title-wrap"> |
|
<p class="meta-title"><img src="../../assets/img/cup.png" alt=""> 实验项目名称</p> |
|
</div> |
|
<el-input v-model="form.proName" type="textarea" :disabled="true" rows="5"></el-input> |
|
</div> |
|
|
|
<div class="mgb20"> |
|
<div class="meta-title-wrap"> |
|
<p class="meta-title">实验目的</p> |
|
</div> |
|
<el-input v-model="form.purpose" type="textarea" :disabled="true" rows="5"></el-input> |
|
</div> |
|
|
|
<div class="mgb20"> |
|
<div class="meta-title-wrap"> |
|
<p class="meta-title">实验数据</p> |
|
</div> |
|
<el-table :data="expData" class="table" stripe header-align="center"> |
|
<el-table-column type="index" width="100" label="序号" align="center"> |
|
<template slot-scope="scope"> |
|
{{scope.$index + 1}} |
|
</template> |
|
</el-table-column> |
|
<el-table-column prop="judgmentPointsName" label="任务名称" align="center"> |
|
</el-table-column> |
|
<el-table-column prop="userAnswer" label="学生答案" align="center"> |
|
<template slot-scope="scope"> |
|
<pre v-html="scope.row.userAnswer"></pre> |
|
</template> |
|
</el-table-column> |
|
<el-table-column prop="answer" label="参考答案" align="center"> |
|
<template slot-scope="scope"> |
|
<div v-html="scope.row.answer"></div> |
|
</template> |
|
</el-table-column> |
|
<el-table-column prop="codeScore" label="得分" align="center"> |
|
</el-table-column> |
|
</el-table> |
|
</div> |
|
|
|
<div class="mgb20"> |
|
<div class="meta-title-wrap"> |
|
<p class="meta-title">实验总结与体会</p> |
|
</div> |
|
<el-input type="textarea" v-model="form.summarize" rows="5" disabled></el-input> |
|
</div> |
|
</div> |
|
</el-col> |
|
</el-row> |
|
</div> |
|
</template> |
|
|
|
<script> |
|
export default { |
|
data (){ |
|
return { |
|
title: '实验报告', |
|
userId: this.$store.state.userId, |
|
form: { |
|
analysis: '', |
|
conclusion: '', |
|
content: ``, |
|
data: '', |
|
purpose: ``, |
|
experimentId: '', |
|
experimentalClassName: '', |
|
improvement: '', |
|
laboratory: '', |
|
period: '', |
|
principle: '', |
|
proName: '', |
|
score: 0, |
|
step: ``, |
|
submitTime: '', |
|
summarize: '', |
|
instructor: '', |
|
userId: this.userId, |
|
userName: '', |
|
workNumber: '', |
|
}, |
|
type: this.$route.query.type, |
|
id: this.$route.query.id, |
|
recordId: this.$route.query.recordId, |
|
reportId: this.$route.query.reportId, |
|
projectId: this.$route.query.projectId, |
|
studentId: this.$route.query.studentId, |
|
infoData: [], |
|
expData: [], |
|
accountData: [], |
|
showData: '1', |
|
autograph: '1', |
|
pages: 1, |
|
ipVisible: false, |
|
fileList: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}], |
|
conclusionOptions: [ |
|
{ |
|
value: 1, |
|
label: '结论符合预期' |
|
} |
|
], |
|
} |
|
}, |
|
mounted(){ |
|
this.getData() |
|
}, |
|
methods: { |
|
getData(){ |
|
if(this.type){ |
|
let data = { |
|
recordId: this.id, |
|
} |
|
this.$get(this.api.queryVirtualReport,data).then(res => { |
|
this.form = res.data.report |
|
let expData = res.data.data |
|
let form = this.form |
|
let score = form.score |
|
if(score){ |
|
expData.map(n => { |
|
if(n.isError){ |
|
score -= n.codeScore |
|
n.codeScore = 0 |
|
} |
|
}) |
|
form.score = score |
|
} |
|
|
|
this.expData = expData |
|
this.infoData.push({ |
|
workNumber: form.workNumber, |
|
experimentalClassName: form.experimentalClassName, |
|
instructor: form.instructor, |
|
period: form.period, |
|
laboratory: form.laboratory, |
|
submitTime: form.submitTime, |
|
score: form.score, |
|
userName: form.userName |
|
}) |
|
}).catch(res => {}); |
|
}else{ |
|
let data = { |
|
studentId: this.studentId, |
|
projectId: this.projectId, |
|
recordId: this.id, |
|
reportId: this.reportId |
|
} |
|
this.$get(this.api.queryArchievement,data).then(res => { |
|
this.form = res.data.report ? res.data.report : {} |
|
let expData = res.data.data |
|
let form = this.form |
|
let score = form.score |
|
if(score){ |
|
expData.map(n => { |
|
if(n.isError){ |
|
score -= n.codeScore |
|
n.codeScore = 0 |
|
} |
|
}) |
|
form.score = score |
|
} |
|
|
|
this.expData = expData |
|
this.infoData.push({ |
|
workNumber: form.workNumber, |
|
experimentalClassName: form.experimentalClassName, |
|
instructor: form.instructor, |
|
period: form.period, |
|
laboratory: form.laboratory, |
|
submitTime: form.submitTime, |
|
score: form.score, |
|
userName: form.userName |
|
}) |
|
}).catch(res => {}); |
|
} |
|
}, |
|
handleRemove(file, fileList) { |
|
console.log(file, fileList); |
|
}, |
|
handlePreview(file) { |
|
console.log(file); |
|
}, |
|
saveAdd(){ |
|
let data = { |
|
systemId: this.configId, |
|
systemName: this.form.systemName, |
|
systemType: this.form.systemType, |
|
systemAttribution: this.form.systemAttribution, |
|
} |
|
if(this.configId){ |
|
this.$post(this.api.updateServiceConfig,data).then((res) => { |
|
this.$message.success('编辑成功'); |
|
this.goback() |
|
}).catch((res) => { |
|
}) |
|
}else{ |
|
this.$post(this.api.updateServiceConfig,data).then((res) => { |
|
this.$message.success('添加成功'); |
|
this.goback() |
|
}).catch((res) => { |
|
}) |
|
} |
|
}, |
|
handleRemove(file, fileList) { |
|
console.log(file, fileList); |
|
}, |
|
handlePictureCardPreview(file) { |
|
this.dialogImageUrl = file.url; |
|
this.dialogVisible = true; |
|
}, |
|
SpanMethod({ row, column, rowIndex, columnIndex }) { |
|
if (rowIndex % 2 === 0) { |
|
if (columnIndex === 6) { |
|
if(!row.Intranet){ |
|
return [1, 2]; |
|
} |
|
} |
|
// else if (columnIndex === 1) { |
|
// return [0, 0]; |
|
// } |
|
} |
|
}, |
|
goback(){ |
|
this.$router.go(-1) |
|
}, |
|
exportPage(){ |
|
var title = this.title; |
|
html2Canvas(document.querySelector('#pdfDom'), { |
|
allowTaint: true |
|
}).then(function (canvas) { |
|
let contentWidth = canvas.width |
|
let contentHeight = canvas.height |
|
let pageHeight = contentWidth / 592.28 * 841.89 |
|
let leftHeight = contentHeight |
|
let position = 0 |
|
let imgWidth = 595.28 |
|
let imgHeight = 592.28 / contentWidth * contentHeight |
|
let pageData = canvas.toDataURL('image/jpeg', 1.0) |
|
let PDF = new JsPDF('', 'pt', 'a4') |
|
if (leftHeight < pageHeight) { |
|
PDF.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight) |
|
} else { |
|
while (leftHeight > 0) { |
|
PDF.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight) |
|
leftHeight -= pageHeight |
|
position -= 841.89 |
|
if (leftHeight > 0) { |
|
PDF.addPage() |
|
} |
|
} |
|
} |
|
PDF.save(title + '.pdf') |
|
} |
|
) |
|
} |
|
} |
|
} |
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
.box{ |
|
padding: 0 50px; |
|
background-color: #fff; |
|
} |
|
/deep/.el-textarea.is-disabled .el-textarea__inner{ |
|
color: #777; |
|
background-color: #e5dfff; |
|
} |
|
#pdfDom{ |
|
padding: 50px; |
|
/deep/.info-table{ |
|
margin-bottom: 40px; |
|
border: 0; |
|
th{ |
|
background-color: #fff !important; |
|
.cell{ |
|
color: #444; |
|
} |
|
} |
|
tr{ |
|
border: 0; |
|
} |
|
tr:hover,tr:hover>td{ |
|
background-color: #e5dfff !important; |
|
} |
|
td{ |
|
border: { |
|
left: 4px solid #fff; |
|
right: 4px solid #fff; |
|
} |
|
&:first-child{ |
|
border-left: 0; |
|
} |
|
&:last-child{ |
|
border-right: 0; |
|
} |
|
background-color: #e5dfff; |
|
border-bottom: 0; |
|
} |
|
} |
|
/deep/.table th{ |
|
background-color: #e1eaff !important; |
|
.cell{ |
|
color: #555555; |
|
} |
|
} |
|
} |
|
|
|
/deep/.cell{ |
|
font-size: 12px; |
|
} |
|
/deep/.el-row{ |
|
padding-top: 20px; |
|
margin: 0 !important; |
|
} |
|
.form-item{ |
|
display: flex; |
|
align-items: center; |
|
} |
|
.form-item .el-input{ |
|
width: auto; |
|
} |
|
.form-item span{ |
|
margin-right: 10px; |
|
} |
|
.meta-title-wrap{ |
|
display: flex; |
|
justify-content: space-between; |
|
align-items: center; |
|
span{ |
|
font-size: 13px; |
|
color: #444; |
|
} |
|
} |
|
.flex-between{ |
|
span{ |
|
font-size: 13px; |
|
color: #444; |
|
} |
|
} |
|
.meta-title{ |
|
display: flex; |
|
align-items: center; |
|
padding: 10px 20px; |
|
margin-bottom: 10px; |
|
font-size: 16px; |
|
color: #fff; |
|
background-color: #9278ff; |
|
img{ |
|
width: 20px; |
|
margin-right: 10px; |
|
} |
|
} |
|
.step-title{ |
|
margin-bottom: 10px; |
|
font-size: 16px; |
|
color: #9278ff; |
|
} |
|
.bd-title{ |
|
padding-top: 20px; |
|
border-top: 1px dashed #ccc; |
|
} |
|
</style> |