From 4c0feddb683f9e904c9fbe459a64d8d271de499f Mon Sep 17 00:00:00 2001 From: renpy Date: Mon, 17 Jul 2023 11:45:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=BD=BD=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E6=96=87=E4=BB=B6=E5=90=8D=E7=A7=B0=E5=8F=8A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A0=E6=95=B0=E6=8D=AE=E6=97=B6=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6=E7=9A=84=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E5=8F=8A=E6=8A=A5=E9=94=99=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../radionuclide/particulate/blankphd.vue | 50 +++++++++-------- src/views/statistics/list.vue | 53 +++++++++++-------- 2 files changed, 61 insertions(+), 42 deletions(-) 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