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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
| <template>
| <div>
| <el-dialog :visible.sync="filesDialogVisible" title="查看校准证书" width="80%" @closed="closeFilesLook">
| <div>
| <limsTable
| ref="yearTable"
| :column="columnData"
| :height="'calc(100vh - 47em)'"
| :highlightCurrentRow="true"
| :table-data="tableData"
| :table-loading="tableLoading"
| style="margin-top: 0.5em;">
| </limsTable>
| </div>
| </el-dialog>
| <el-dialog
| :visible.sync="lookDialogVisible"
| fullscreen
| title="查看附件" top="5vh" width="800px">
| <filePreview v-if="lookDialogVisible" :currentFile="{}"
| :fileUrl="javaApi+'/img/'+currentInfo.fileUrl" style="max-height: 90vh;overflow-y: auto;"/>
| </el-dialog>
| </div>
| </template>
|
| <script>
| import filePreview from '@/views/tool/file-preview.vue';
| import limsTable from '@/components/Table/lims-table.vue'
| import file from '@/utils/file';
|
| export default {
| name: 'calibrationsFileDia',
| // import 引入的组件需要注入到对象中才能使用
| components: { limsTable, filePreview },
| data() {
| // 这里存放数据
| return {
| filesDialogVisible: false,
| tableLoading: false,
| filesLookInfo: {},
| columnData: [
| {
| label: '文件名称',
| prop: 'fileName',
| minWidth: '150px'
| },
| {
| label: '设备名称',
| prop: 'deviceName',
| minWidth: '150px'
| },
| {
| label: '设备编号',
| prop: 'managementNumber',
| minWidth: '150px'
| },
| {
| dataType: 'action',
| minWidth: '100',
| label: '操作',
| fixed: 'right',
| operation: [
| {
| name: '预览',
| type: 'text',
| clickFun: (row) => {
| this.handleLook(row)
| }
| },
| {
| name: '下载',
| type: 'text',
| clickFun: (row) => {
| this.upload(row)
| }
| },
| ]
| }
| ],
| tableData: [],
| info: {},
| currentInfo:{},
| lookDialogVisible: false,
| };
| },
| mounted() {
|
| },
| // 方法集合
| methods: {
| openDia(row) {
| this.filesDialogVisible = true
| this.info = row
| this.tableData = this.info.calibrationsFileList
| },
| closeFilesLook () {
| this.filesDialogVisible = false
| },
| // 查看文件
| handleLook(row){
| this.currentInfo = row
| this.lookDialogVisible = true
| },
| // 下载
| upload (row) {
| const fileName = row.fileName;
| const fileUrl = row.fileUrl;
| try {
| const response = axios({
| method: 'get',
| url: `${Vue.prototype.javaApi}/common/downloadMinio`,
| params: {
| fileUrl,
| fileName
| },
| responseType: 'blob',
| headers: { Authorization: 'Bearer ' + getToken() }
| });
|
| if (blobValidate(response.data)) {
| saveAs(new Blob([response.data]), fileName);
| Message.success("下载成功");
| } else {
| this.printErrMsg(response.data);
| }
| } catch (error) {
| Message.error("下载失败:" + error.message);
| }
| },
| }
| };
| </script>
|
| <style scoped>
| </style>
|
|