1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
| <template>
| <div>
| <div>
| <el-table v-if="fList.length >= 1" v-loading="loading" :data="fList" border style="margin-top: 30px;">
| <el-table-column prop="createTime" label="检测时间">
| </el-table-column>
| <el-table-column label="操作" align="center" width="130px">
| <template slot-scope="scope">
| <el-button type="primary" icon="el-icon-share" size="mini" @click="viewReport(scope.row)"
| title="查看"></el-button>
| </template>
| </el-table-column>
| </el-table>
| <div v-else>暂无历史报告</div>
| </div>
|
|
| <el-dialog class="dia" title="PDF 预览" :visible.sync="dialogVisible" :before-close="handleClose" :modal="false">
| <div class="main">
| <iframe id="printIframe" :src="url" frameborder="0" style="width: 100%; height: 100%"></iframe>
| </div>
| </el-dialog>
| </div>
| </template>
|
| <script>
| import { getPdf } from "@/api/hosp/order";
| export default {
| name: 'Historicalreport',
|
| props: {
| reportHistorydata: {
| type: Array,//数组类型
| default: () => []
| }
|
| },
| data() {
| return {
| loading: true,
| url: "",
| fList: [],
| dialogVisible: false,
| };
| },
| watch: {
| 'reportHistorydata'(val, newVla) {
| if (val) {
| this.loading = false
| this.fList = val
| }
|
| // if (this.fList) {
| // this.getList()
| // }
| }
| },
| mounted() {
|
| },
|
| created() {
|
| },
| methods: {
| handleClose() {
|
|
| this.dialogVisible = false;
| },
| viewReport(row) {
| const tjNumber = row.tjNumber;
| const flag = true;
| getPdf(tjNumber, flag).then((response) => {
| if (response.size === 0) {
| const loading = this.$loading({
| lock: true,
| text: 'Loading',
| spinner: 'el-icon-loading',
| background: 'rgba(0, 0, 0, 0.7)'
| });
| setTimeout(() => {
| loading.close();
| }, 3000);
| this.$message.msgSuccess("报告正在生成,请两分钟后预览!");
|
| } else {
| this.dialogVisible = true;
|
| this.url = window.webkitURL.createObjectURL(response); //将后端返回的blob文件读取出url
| }
| });
| },
| handleOk() {
| if (this.form.desc) {
| this.$emit('add', this.form.desc, this.list);
| }
| }
| }
| }
| </script>
|
| <style scoped>
| .main {
| height: 700px;
| overflow: hidden;
| }
| </style>
|
|
|