update code

main
lijun 2024-09-16 11:11:45 +08:00
parent 3c24f82b78
commit 2826f4189e
2 changed files with 29 additions and 19 deletions

View File

@ -59,12 +59,12 @@
<el-table-column label="系统延迟时间" align="left" prop="system_delay" />
</el-table>
<div class="print-page"></div>
<el-row class="report-chart1" style="margin-top:20px;">
<el-col :span="12">
<el-row class="report-chart1" style="margin-top:20px;" :key="info.elPrint" :style="info.isPrint?'width:18cm;':''">
<el-col :span="info.isPrint ? 24 : 12">
<charts :id="'reportChart1-' + idx" width="100%" height="400px"
:render="opt => renderChart1(it, 'roc')"></charts>
</el-col>
<el-col :span="12">
<el-col :span="info.isPrint ? 24 : 12">
<charts :id="'reportChart2-' + idx" width="100%" height="400px"
:render="opt => renderChart1(it, 'rp')"></charts>
</el-col>
@ -129,33 +129,42 @@ const info = reactive({
extra_evaluation_type: '',
tasks: [],
reportType: '',
robustness: []
robustness: [],
isPrint: false,
elPrint: 0,
})
const doExport=async () => {
try{
let dom=document.querySelector("#print_simulation_report_desc");
const canvas = await html2canvas(dom,{
allowTaint: true,
useCORS: true,
});
const doExport = async () => {
try {
let dom = document.querySelector("#print_simulation_report_desc");
const canvas = await html2canvas(dom, {
allowTaint: true,
useCORS: true,
});
const img = canvas.toDataURL('image/png');
const link = document.createElement('a');
link.href = img;
link.setAttribute('download', info.report.report_name+ useDateFormat(new Date(),"YYYYMMDDHHmmss").value+'.png');
link.setAttribute('download', info.report.report_name + useDateFormat(new Date(), "YYYYMMDDHHmmss").value + '.png');
link.click();
}catch(e){
} catch (e) {
ElMessage.error("导出图片失败!");
console.error("导出图片失败!",e);
console.error("导出图片失败!", e);
}
}
function goBack() {
router.push({ path: "/simulationEvaluation/reportList" });
}
function doPrint() {
function doPrint() {
document.querySelector("html").classList.add("report-print");
window.print();
document.querySelector("html").classList.remove("report-print");
info.isPrint = true;
info.elPrint++;
setTimeout(() => {
window.print();
document.querySelector("html").classList.remove("report-print");
info.isPrint = false;
info.elPrint++;
}, 800);
}
const doDelete = () => {
let id = route.query.id;
ElMessageBox.confirm("确认删除?", "警告", {
@ -331,10 +340,11 @@ html.report-print {
height: unset !important;
.simulation-report-desc {
.el-scrollbar__view{
.el-scrollbar__view {
vertical-align: unset !important;
}
.el-table {
table {
width: unset !important;