diff --git a/src/views/statistics/imsData/radionuclide/particulate/blankphd.vue b/src/views/statistics/imsData/radionuclide/particulate/blankphd.vue index 5c9ccf7..ce8a712 100644 --- a/src/views/statistics/imsData/radionuclide/particulate/blankphd.vue +++ b/src/views/statistics/imsData/radionuclide/particulate/blankphd.vue @@ -4,7 +4,7 @@ - + Excel @@ -134,27 +134,35 @@ export default { // }, methods: { handleExcel() { - // this.queryParam = { - // dataType: "S", - // startTime: "2023-07-01", - // endTime: "2023-07-14", - // stationIds: [209], - // spectralQualifie:"FULL" - // } - let params = { - ...this.queryParam, - pageType:this.pageType + if (this.dataSource.length>0) { + // this.queryParam = { + // dataType: "S", + // startTime: "2023-07-01", + // endTime: "2023-07-14", + // stationIds: [209], + // spectralQualifie:"FULL" + // } + let params = { + ...this.queryParam, + pageType:this.pageType + } + getFileAction("/webStatistics/radionuclideExport", params).then(res => { + if (res.code && res.code == 500) { + this.$message.warning("This operation fails. Contact your system administrator") + } else { + const blob = new Blob([res], { type: "application/vnd.ms-excel" }) + let link = document.createElement('a') + link.href = window.URL.createObjectURL(blob) + link.download = "BLANKPHD" + document.body.appendChild(link) + link.click() + URL.revokeObjectURL(link.href) + document.body.removeChild(link) + } + }) + } else { + this.$message.warning("No downloadable data") } - getFileAction("/webStatistics/radionuclideExport", params).then(res => { - const blob = new Blob([res], { type: "application/vnd.ms-excel" }) - let link = document.createElement('a') - link.href = window.URL.createObjectURL(blob) - link.download = "asf" - document.body.appendChild(link) - link.click() - URL.revokeObjectURL(link.href) - document.body.removeChild(link) - }) }, searchQueryData() { this.isImmediate = false diff --git a/src/views/statistics/list.vue b/src/views/statistics/list.vue index bdb3b0f..3f20213 100644 --- a/src/views/statistics/list.vue +++ b/src/views/statistics/list.vue @@ -3,7 +3,7 @@ - + Excel @@ -90,28 +90,39 @@ export default { } }, methods: { + + + handleExcel() { - this.queryParam = { - dataType: "S", - startTime: "2023-07-01", - endTime: "2023-07-14", - stationIds: [209], - spectralQualifie:"FULL" + if (this.dataSource.length>0) { + // this.queryParam = { + // dataType: "S", + // startTime: "2023-07-01", + // endTime: "2023-07-14", + // stationIds: [209], + // spectralQualifie:"FULL" + // } + let params = { + ...this.queryParam, + pageType:this.pageType + } + getFileAction("/webStatistics/radionuclideExport", params).then(res => { + if (res.code && res.code == 500) { + this.$message.warning("This operation fails. Contact your system administrator") + } else { + const blob = new Blob([res], { type: "application/vnd.ms-excel" }) + let link = document.createElement('a') + link.href = window.URL.createObjectURL(blob) + link.download = this.fileName + document.body.appendChild(link) + link.click() + URL.revokeObjectURL(link.href) + document.body.removeChild(link) + } + }) + } else { + this.$message.warning("No downloadable data") } - let params = { - ...this.queryParam, - pageType:this.pageType - } - getFileAction("/webStatistics/radionuclideExport", params).then(res => { - const blob = new Blob([res], { type: "application/vnd.ms-excel" }) - let link = document.createElement('a') - link.href = window.URL.createObjectURL(blob) - link.download = "asf" - document.body.appendChild(link) - link.click() - URL.revokeObjectURL(link.href) - document.body.removeChild(link) - }) }, searchQueryData() { this.isImmediate = false