修改下载文件的文件名称及增加无数据时点击下载文件的提示,及报错提示
This commit is contained in:
		
							parent
							
								
									5b5145b0d6
								
							
						
					
					
						commit
						4c0feddb68
					
				|  | @ -4,7 +4,7 @@ | |||
|       <!-- <search-form :items="formItems" v-model="queryParam" @search="searchQuery"> --> | ||||
|       <search-form :items="formItems" v-model="queryParam" @search="searchQueryData"> | ||||
|         <a-space style="float: right" class="btn-group" slot="additional"> | ||||
|           <a-button @click="handleEdit" type="primary" :disabled="dataSource.length==0"> | ||||
|           <a-button @click="handleEdit" type="primary"> | ||||
|             <img class="icon-edit" src="@/assets/images/global/edit.png" alt="" /> | ||||
|             Excel | ||||
|           </a-button> | ||||
|  | @ -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 | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
|     <a-card v-if="!isDetail" :bordered="false" style="margin-left: 20px"> | ||||
|       <search-form :items="formItems" v-model="queryParam" @search="searchQueryData"> | ||||
|         <a-space style="float: right" class="btn-group" slot="additional"> | ||||
|           <a-button @click="handleExcel" type="primary" :disabled="dataSource.length==0"> | ||||
|           <a-button @click="handleExcel" type="primary"> | ||||
|             <img class="icon-edit" src="@/assets/images/global/edit.png" alt="" /> | ||||
|             Excel | ||||
|           </a-button> | ||||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 orgin
							orgin