diff --git a/src/views/statistics/detail.vue b/src/views/statistics/detail.vue index 4b9caf7..e855756 100644 --- a/src/views/statistics/detail.vue +++ b/src/views/statistics/detail.vue @@ -6,29 +6,29 @@ return
-
- + - @@ -545,7 +545,8 @@ export default { zipSrc:"" } }, - mounted () { + mounted() { + this.getFildBlob() this.commentText = this.allData.commentBlock && this.allData.commentBlock.text?this.allData.commentBlock.text.replace(/\n/g, "
"):"" this.dataSourceEnergy_G=this.allData.genergyBlock this.dataSourceEnergy_B=this.allData.benergyBlock @@ -555,12 +556,12 @@ export default { this.dataSourceEfficiency_BG = this.allData.bgEfficiencyBlock this.dataSourceRoiLimits = this.allData.roiLimitsBlock this.dataSourceRatios = this.allData.ratiosBlock - this.dataSourceSpectrum_G = this.allData.gspectrumBlock.gspectrumSubBlock - this.dataSourceSpectrumX_G = this.allData.gspectrumBlock.gspectrumSubBlock.map((item, index) => { + this.dataSourceSpectrum_G = this.allData.gspectrumBlock&&this.allData.gspectrumBlock.gspectrumSubBlock + this.dataSourceSpectrumX_G = this.allData.gspectrumBlock&&this.allData.gspectrumBlock.gspectrumSubBlock.map((item, index) => { return index }) - this.dataSourceSpectrum_B = this.allData.bspectrumBlock.bspectrumSubBlock - this.dataSourceSpectrumX_B = this.allData.bspectrumBlock.bspectrumSubBlock.map((item, index) => { + this.dataSourceSpectrum_B = this.allData.bspectrumBlock&&this.allData.bspectrumBlock.bspectrumSubBlock + this.dataSourceSpectrumX_B = this.allData.bspectrumBlock&&this.allData.bspectrumBlock.bspectrumSubBlock.map((item, index) => { return index }) this.allData.histogramBlock.histogramSubBlock.forEach(item => { @@ -579,14 +580,15 @@ export default { } }); this.dataSourceCertificate = this.allData.certificateBlock ? this.allData.certificateBlock.certificateSubBlock : [] - this.getFildBlob() + // this.getFildBlob() }, methods: { getFildBlob() { + console.log("afsdfasdfasdfasdfasdf"); let _this = this let params = { - // sampleId: this.sampleId, - sampleId:"1523651" + sampleId: this.sampleId, + // sampleId:"1523651" } let url = "/webStatistics/radionuclideFile" getAction(url, params).then((res) => { @@ -596,6 +598,31 @@ export default { _this.zipSrc = window.URL.createObjectURL(blobZip) }) }, + downloadFile(src) { + if (src) { + let link = document.createElement('a') + link.href = src + link.target = '_blank' + link.download = this.type + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } else { + this.$message.info("File download failed") + } + }, + viewFile() { + if (this.fileSrc) { + let link = document.createElement('a') + link.href = this.fileSrc + link.target = '_blank' + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } else { + this.$message.info("File preview failed") + } + }, getUid() { return (Math.random()+new Date().getTime()).toString(32).slice(0,8) }, diff --git a/src/views/statistics/fileDetail.vue b/src/views/statistics/fileDetail.vue index 11139f7..deb8101 100644 --- a/src/views/statistics/fileDetail.vue +++ b/src/views/statistics/fileDetail.vue @@ -6,21 +6,21 @@ return
- @@ -80,7 +80,32 @@ export default { _this.fileText = reader.result } }) - } + }, + downloadFile() { + if (this.fileSrc) { + let link = document.createElement('a') + link.href = this.fileSrc + link.target = '_blank' + link.download = this.type + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } else { + this.$message.info("File download failed") + } + }, + viewFile() { + if (this.fileSrc) { + let link = document.createElement('a') + link.href = this.fileSrc + link.target = '_blank' + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + } else { + this.$message.info("File preview failed") + } + }, }, }