From 77a041c5e9a31ad96fce404f06fe0c03f4031b1d Mon Sep 17 00:00:00 2001 From: Fixiaobai <fixiaobai@163.com> Date: 星期一, 28 八月 2023 09:19:13 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.110.209:9001/r/lims-before --- src/views/experiment/checkTheReport/index.vue | 63 ++++++++++++++++++++++++++++--- 1 files changed, 57 insertions(+), 6 deletions(-) diff --git a/src/views/experiment/checkTheReport/index.vue b/src/views/experiment/checkTheReport/index.vue index a127c10..ab2d6ee 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" @click="printFun()">鎵撳嵃</el-button> + </span> + <div class="printStyle"> + <preview id="printDiv" :reportData="reportData"></preview> + </div> + </el-dialog> <div class="table-box"> <el-table ref="reportTable" @@ -81,14 +93,14 @@ </template></el-table-column > <el-table-column - prop="materialCode" + prop="reportCode" label="鎶ュ憡鍗曞彿" sortable min-width="10%" > <template slot-scope="scope"> <span style="color: #409eff;"> - {{ scope.row.materialCode }} + {{ scope.row.reportCode }} </span> </template></el-table-column > @@ -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> @@ -168,10 +179,13 @@ </template> <script> -import { selectAllReport } from "@/api/experiment/checkTheReport"; +import { selectAllReport,getReportData } from "@/api/experiment/checkTheReport"; +import Preview from "@/components/experiment/checkTheReport/index.vue"; +import PrintJS from 'print-js' export default { data() { return { + reportData: [], searchData:{ sample_code:'', reportCode:'', @@ -183,12 +197,39 @@ total: 0, pageSize: 10, checked: true, + dialogVisible: false, }; }, created() { this.getData(); }, + mounted(){ + }, + components:{ + Preview + }, methods: { + async queryReportByRCode(code){ + const resp = await getReportData({code:code}); + this.reportData = resp.data; + console.log(this.reportData); + }, + //鏌ョ湅鎶ュ憡鎸夐挳 + previewFun(row){ + this.dialogVisible = true; + this.queryReportByRCode(row.reportCode); + }, + //鎵撳嵃鎸夐挳 + printFun(){ + this.dialogVisible = false; + PrintJS({ + printable: "printDiv", + type: "html", + // header: "鍘熸潗鏂欐娴嬫姤鍛�", + targetStyles: ["*"], + ignoreElements: ["no-ignore"], + }); + }, // 鐘舵�佹寜閽� handleRadioChange() { this.getData(); @@ -227,6 +268,7 @@ }; const { data } = await selectAllReport(params); this.reportTable = data.row; + console.log(data.row); this.total = data.total; }, }, @@ -280,5 +322,14 @@ margin: 10px 0; } } + .printStyle{ + overflow: scroll; + height:600px; + .el-button{ + position: absolute; + top: 10vh; + left: 90%; + } + } } </style> -- Gitblit v1.9.3