feat: 报告生成-厂界在线增加PDF下载功能

This commit is contained in:
LokerL 2024-10-29 17:06:15 +08:00
parent 31a9707d0a
commit 2346ffc7c1
1 changed files with 60 additions and 104 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="app-container" id="html2canvas1"> <div class="app-container">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="6"> <el-col :span="6">
<dept-tree @deptChange="handleDeptChange" :showQuickGroup="true" /> <dept-tree @deptChange="handleDeptChange" :showQuickGroup="true" />
@ -30,7 +30,7 @@
</el-row> </el-row>
</el-col> </el-col>
</el-row> </el-row>
<div id="html2canvas1">
<!-- 数据标签 --> <!-- 数据标签 -->
<el-row style="padding: 10px"> <el-row style="padding: 10px">
<el-row <el-row
@ -66,83 +66,40 @@
<el-row> <el-row>
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
<el-table-column label="基本信息"> <el-table-column label="基本信息">
<el-table-column <el-table-column prop="p" label="归属企业"> </el-table-column>
prop="p" <el-table-column prop="sn" label="设备编号"> </el-table-column>
label="归属企业"> <el-table-column prop="address" label="安装位置"> </el-table-column>
</el-table-column>
<el-table-column
prop="sn"
label="设备编号">
</el-table-column>
<el-table-column
prop="address"
label="安装位置">
</el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="第一周期"> <el-table-column label="第一周期">
<el-table-column <el-table-column prop="month1" label="一月"> </el-table-column>
prop="month1" <el-table-column prop="month2" label="二月"> </el-table-column>
label="一月"> <el-table-column prop="month3" label="三月"> </el-table-column>
</el-table-column>
<el-table-column
prop="month2"
label="二月">
</el-table-column>
<el-table-column
prop="month3"
label="三月">
</el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="第二周期"> <el-table-column label="第二周期">
<el-table-column <el-table-column prop="month4" label="四月"> </el-table-column>
prop="month4" <el-table-column prop="month5" label="五月"> </el-table-column>
label="四月"> <el-table-column prop="month6" label="六月"> </el-table-column>
</el-table-column>
<el-table-column
prop="month5"
label="五月">
</el-table-column>
<el-table-column
prop="month6"
label="六月">
</el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="第三周期"> <el-table-column label="第三周期">
<el-table-column <el-table-column prop="month7" label="七月"> </el-table-column>
prop="month7" <el-table-column prop="month8" label="八月"> </el-table-column>
label="七月"> <el-table-column prop="month9" label="九月"> </el-table-column>
</el-table-column>
<el-table-column
prop="month8"
label="八月">
</el-table-column>
<el-table-column
prop="month9"
label="九月">
</el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="第四周期"> <el-table-column label="第四周期">
<el-table-column <el-table-column prop="month10" label="十月"> </el-table-column>
prop="month10" <el-table-column prop="month11" label="十一月"> </el-table-column>
label="十月"> <el-table-column prop="month12" label="十二月"> </el-table-column>
</el-table-column>
<el-table-column
prop="month11"
label="十一月">
</el-table-column>
<el-table-column
prop="month12"
label="十二月">
</el-table-column>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-row> </el-row>
</div> </div>
</div>
</template> </template>
<script> <script>
import moment from "moment"; import moment from "moment";
import {getBoundDashboardData, getBoundTableData} from '@/api/report'; import { getBoundDashboardData, getBoundTableData } from "@/api/report";
import { downloadPDF } from "@/utils/pdf.js";
export default { export default {
name: "report-generate-bound", name: "report-generate-bound",
data() { data() {
@ -201,7 +158,7 @@ export default {
month10: 10, month10: 10,
month11: 11, month11: 11,
month12: 12, month12: 12,
} },
], ],
dashboardTag: [ dashboardTag: [
{ {
@ -275,7 +232,6 @@ export default {
}, },
mounted() { mounted() {
this.year = moment().format("YYYY"); this.year = moment().format("YYYY");
}, },
computed: { computed: {
// 3 [[], [], []] // 3 [[], [], []]
@ -299,7 +255,7 @@ export default {
this.dept = dept; this.dept = dept;
}, },
generateReport() { generateReport() {
console.log(this.dept, this.year); downloadPDF(document.querySelector("#html2canvas1"), "LDAR下载");
}, },
async handleSearch() { async handleSearch() {
if (!this.dept) { if (!this.dept) {