arr rrr 模块增加导出excel功能
This commit is contained in:
		
							parent
							
								
									2097ea83ae
								
							
						
					
					
						commit
						f0f468497f
					
				|  | @ -3,7 +3,7 @@ | ||||||
|     <a-card v-if="!isFileDetail" :bordered="false" style="margin-left: 20px"> |     <a-card v-if="!isFileDetail" :bordered="false" style="margin-left: 20px"> | ||||||
|       <search-form :items="formItems" v-model="queryParam" @search="searchQueryData"> |       <search-form :items="formItems" v-model="queryParam" @search="searchQueryData"> | ||||||
|         <a-space style="float: right" class="btn-group" slot="additional"> |         <a-space style="float: right" class="btn-group" slot="additional"> | ||||||
|           <a-button @click="handleEdit" type="primary"> |           <a-button @click="handleExcel" type="primary"> | ||||||
|             <img class="icon-edit" src="@/assets/images/global/edit.png" alt="" /> |             <img class="icon-edit" src="@/assets/images/global/edit.png" alt="" /> | ||||||
|             Excel |             Excel | ||||||
|           </a-button> |           </a-button> | ||||||
|  | @ -110,6 +110,29 @@ export default { | ||||||
|     this.findStationList() |     this.findStationList() | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|  |     handleExcel() { | ||||||
|  |       if (this.dataSource.length>0) { | ||||||
|  |         let params = { | ||||||
|  |           ...this.queryParam, | ||||||
|  |         } | ||||||
|  |         getFileAction("/webStatistics/arrExport", 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 = "ARR" | ||||||
|  |             document.body.appendChild(link) | ||||||
|  |             link.click() | ||||||
|  |             URL.revokeObjectURL(link.href) | ||||||
|  |             document.body.removeChild(link) | ||||||
|  |           } | ||||||
|  |         }) | ||||||
|  |       } else { | ||||||
|  |         this.$message.warning("No downloadable data") | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|     handleBack(flag) { |     handleBack(flag) { | ||||||
|       this.isFileDetail = flag |       this.isFileDetail = flag | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ | ||||||
|     <a-card v-if="!isFileDetail" :bordered="false" style="margin-left: 20px"> |     <a-card v-if="!isFileDetail" :bordered="false" style="margin-left: 20px"> | ||||||
|       <search-form :items="formItems" v-model="queryParam" @search="searchQueryData"> |       <search-form :items="formItems" v-model="queryParam" @search="searchQueryData"> | ||||||
|         <a-space style="float: right" class="btn-group" slot="additional"> |         <a-space style="float: right" class="btn-group" slot="additional"> | ||||||
|           <a-button @click="handleEdit" type="primary"> |           <a-button @click="handleExcel" type="primary"> | ||||||
|             <img class="icon-edit" src="@/assets/images/global/edit.png" alt="" /> |             <img class="icon-edit" src="@/assets/images/global/edit.png" alt="" /> | ||||||
|             Excel |             Excel | ||||||
|           </a-button> |           </a-button> | ||||||
|  | @ -110,6 +110,29 @@ export default { | ||||||
|     this.findStationList() |     this.findStationList() | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|  |     handleExcel() { | ||||||
|  |       if (this.dataSource.length>0) { | ||||||
|  |         let params = { | ||||||
|  |           ...this.queryParam, | ||||||
|  |         } | ||||||
|  |         getFileAction("/webStatistics/rrrExport", 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 = "RRR" | ||||||
|  |             document.body.appendChild(link) | ||||||
|  |             link.click() | ||||||
|  |             URL.revokeObjectURL(link.href) | ||||||
|  |             document.body.removeChild(link) | ||||||
|  |           } | ||||||
|  |         }) | ||||||
|  |       } else { | ||||||
|  |         this.$message.warning("No downloadable data") | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|     handleBack(flag) { |     handleBack(flag) { | ||||||
|       this.isFileDetail = flag |       this.isFileDetail = flag | ||||||
|     }, |     }, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 orgin
							orgin