| | |
| | | > |
| | | <template slot-scope="scope"> |
| | | <span size="medium">{{ scope.row.content }}</span> |
| | | <a v-for="item in scope.row.realFileName" |
| | | :href="scope.row.url+'/'+item"> |
| | | {{ item.split("fileName=")[1] }} |
| | | </a> |
| | | <span v-for="item in scope.row.realFileName"> |
| | | <el-link type="primary" @click="downloadFile(subFile(item))"> |
| | | {{subFile(item)}} |
| | | </el-link> |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | <script> |
| | | import Titlename from "../../components/Titlename/index.vue"; |
| | | import {sendDangerNext, getDangerDetails, getWfRecordList} from "@/api/sgyhpczl/recheckCancellationNumber"; |
| | | import {downloadFile} from "@/api/sgyhpczl/fileUtils"; |
| | | |
| | | export default { |
| | | components: {Titlename}, |
| | |
| | | path:"/hiddenDangerRectification" |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | subFile(fileName){ |
| | | return fileName.substring(fileName.indexOf("fileName=")+9) |
| | | }, |
| | | downloadFile(path){ |
| | | let params = { |
| | | type: 0, |
| | | fileName: path, |
| | | }; |
| | | downloadFile(params).then((res) => { |
| | | if(res.data.type=='text/json'){ |
| | | const reader = new FileReader(); |
| | | reader.readAsText(res.data, 'utf-8'); |
| | | reader.onload = e => { |
| | | this.$message({ |
| | | type: "error", |
| | | message: JSON.parse(reader.result).msg, |
| | | duration: 3000, |
| | | }); |
| | | } |
| | | } else { |
| | | let blob = new Blob([res.data], {type: 'application/octet-stream'}) |
| | | console.log(blob) |
| | | let blobUrl = window.URL.createObjectURL(blob) |
| | | let downloadElement = document.createElement('a') |
| | | downloadElement.href = blobUrl |
| | | downloadElement.download = path |
| | | document.body.appendChild(downloadElement) |
| | | downloadElement.click() |
| | | document.body.removeChild(downloadElement) |
| | | window.URL.revokeObjectURL(blobUrl) |
| | | } |
| | | }); |
| | | }, |
| | | } |
| | | } |
| | | </script> |