| | |
| | | > |
| | | </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" |
| | |
| | | <el-button |
| | | type="text" |
| | | size="small" |
| | | @click="handleClick(scope.row)" |
| | | @click="previewFun(scope.row)" |
| | | >预览</el-button |
| | | > |
| | | <el-button type="text" size="small">打印</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | |
| | | <script> |
| | | import { selectAllReport } from "@/api/experiment/checkTheReport"; |
| | | import Preview from "@/components/experiment/checkTheReport/index.vue"; |
| | | import PrintJS from 'print-js' |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | 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(); |
| | |
| | | }; |
| | | const { data } = await selectAllReport(params); |
| | | this.reportTable = data.row; |
| | | console.log(data.row); |
| | | this.total = data.total; |
| | | }, |
| | | }, |
| | |
| | | margin: 10px 0; |
| | | } |
| | | } |
| | | .printStyle{ |
| | | overflow: scroll; |
| | | height:600px; |
| | | .el-button{ |
| | | position: absolute; |
| | | top: 10vh; |
| | | left: 90%; |
| | | } |
| | | } |
| | | } |
| | | </style> |