From df5f05fdc4acc8b0258d391a495e544bc0991e64 Mon Sep 17 00:00:00 2001 From: 王震 <10952869+daywangzhen@user.noreply.gitee.com> Date: 星期六, 26 八月 2023 17:42:40 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/experiment/checkTheReport/index.vue | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/views/experiment/checkTheReport/index.vue b/src/views/experiment/checkTheReport/index.vue index a127c10..171ca9d 100644 --- a/src/views/experiment/checkTheReport/index.vue +++ b/src/views/experiment/checkTheReport/index.vue @@ -51,6 +51,18 @@ > </div> </div> + <el-dialog + top="10vh" + title="鎶ュ憡棰勮" + :visible.sync="dialogVisible" + width="60%"> + <span slot="footer" class="dialog-footer"> + <el-button type="primary" size="small" @click="printFun()">鎵撳嵃</el-button> + </span> + <div class="printStyle"> + <preview id="printDiv"></preview> + </div> + </el-dialog> <div class="table-box"> <el-table ref="reportTable" @@ -143,10 +155,9 @@ <el-button type="text" size="small" - @click="handleClick(scope.row)" - >棰勮</el-button + @click="previewFun(scope.row)" + >鏌ョ湅鎶ュ憡</el-button > - <el-button type="text" size="small">鎵撳嵃</el-button> </template> </el-table-column> </el-table> @@ -169,6 +180,8 @@ <script> import { selectAllReport } from "@/api/experiment/checkTheReport"; +import Preview from "@/components/experiment/checkTheReport/index.vue"; +import PrintJS from 'print-js' export default { data() { return { @@ -183,12 +196,33 @@ total: 0, pageSize: 10, checked: true, + dialogVisible: false, }; }, created() { this.getData(); }, + mounted(){ + // this.dialogVisible = true; + }, + components:{ + Preview + }, methods: { + //棰勮鎸夐挳 + previewFun(){ + this.dialogVisible = true; + }, + //鎵撳嵃鎸夐挳 + printFun(){ + PrintJS({ + printable: "printDiv", + type: "html", + // header: "鍘熸潗鏂欐娴嬫姤鍛�", + targetStyles: ["*"], + ignoreElements: ["no-ignore"], + }); + }, // 鐘舵�佹寜閽� handleRadioChange() { this.getData(); @@ -227,6 +261,7 @@ }; const { data } = await selectAllReport(params); this.reportTable = data.row; + console.log(data.row); this.total = data.total; }, }, @@ -280,5 +315,14 @@ margin: 10px 0; } } + .printStyle{ + overflow: scroll; + height:600px; + .el-button{ + position: absolute; + top: 10vh; + left: 90%; + } + } } </style> -- Gitblit v1.9.3