| | |
| | | </template> |
| | | |
| | | <script> |
| | | import ValueTable from "@/components/Table/value-table.vue"; |
| | | import file from "@/utils/file"; |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import { delfile, downFile, getFileList } from "@/api/business/rawMaterialOrder"; |
| | | import { delFile, downFile, getFileList } from "@/api/business/rawMaterialOrder"; |
| | | export default { |
| | | name: "filesLookVisible", |
| | | // import 引入的组件需要注入到对象中才能使用 |
| | | components: { limsTable, ValueTable }, |
| | | components: { limsTable }, |
| | | props: { |
| | | filesDialogVisible: { |
| | | type: Boolean, |
| | |
| | | value: 0 |
| | | }, |
| | | { |
| | | label: '季度检验', |
| | | label: '可靠性检验', |
| | | value: 1 |
| | | }, |
| | | ], |
| | |
| | | // 下载 |
| | | handleDown(row) { |
| | | downFile({ id: row.id, }).then(res => { |
| | | if (res.code === 200) { |
| | | let url = ''; |
| | | if (res.data.type == 1) { |
| | | url = this.javaApi + '/img/' + res.data.fileUrl |
| | | file.downloadIamge(url, row.fileName) |
| | | } else { |
| | | url = this.javaApi + '/word/' + res.data.fileUrl |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = row.fileName; |
| | | link.click(); |
| | | } |
| | | } |
| | | this.$download.saveAs(res.data.fileUrl, row.fileName); |
| | | }).catch(error => { |
| | | |
| | | }) |
| | |
| | | if (response.code == 200) { |
| | | this.$message.success('上传成功'); |
| | | this.getFileList() |
| | | } else { |
| | | this.$message.error(response.msg); |
| | | } |
| | | }, |
| | | beforeUpload(file) { |
| | |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | delfile({ id: row.id }).then(res => { |
| | | if (res.code === 500) { |
| | | return |
| | | } |
| | | delFile({ id: row.id }).then(res => { |
| | | this.$message.success('删除成功') |
| | | this.getList() |
| | | }).catch(e => { |
| | | this.$message.error('删除失败') |
| | | this.getFileList() |
| | | }) |
| | | }).catch(() => { }) |
| | | } |