alerts、rmssoh、met 模块增加导出excel功能
This commit is contained in:
		
							parent
							
								
									8089bd3ad7
								
							
						
					
					
						commit
						224ab3c85e
					
				|  | @ -3,7 +3,7 @@ | |||
|     <a-card :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="handleEdit" type="primary"> | ||||
|           <a-button @click="handleExcel" type="primary"> | ||||
|             <img class="icon-edit" src="@/assets/images/global/edit.png" alt="" /> | ||||
|             Excel | ||||
|           </a-button> | ||||
|  | @ -92,7 +92,7 @@ const columns = [ | |||
| ] | ||||
| import { compareDate } from "../../commom" | ||||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | ||||
| import { getAction } from '../../../../api/manage' | ||||
| import { getAction, getFileAction } from '../../../../api/manage' | ||||
| import dateFormat from '../../../../components/jeecg/JEasyCron/format-date' | ||||
| export default { | ||||
|   name: 'menuTree', | ||||
|  | @ -122,6 +122,29 @@ export default { | |||
|     this.findStationList() | ||||
|   }, | ||||
|   methods: { | ||||
|     handleExcel() { | ||||
|       if (this.dataSource.length>0) { | ||||
|         let params = { | ||||
|           ...this.queryParam, | ||||
|         } | ||||
|         getFileAction("/webStatistics/metExport", 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 = "ALERTS" | ||||
|             document.body.appendChild(link) | ||||
|             link.click() | ||||
|             URL.revokeObjectURL(link.href) | ||||
|             document.body.removeChild(link) | ||||
|           } | ||||
|         }) | ||||
|       } else { | ||||
|         this.$message.warning("No downloadable data") | ||||
|       } | ||||
|     }, | ||||
|     searchQueryData() { | ||||
|       let days = compareDate(this.queryParam.startTime, this.queryParam.endTime) | ||||
|       if (days <= 10) {  | ||||
|  |  | |||
|  | @ -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"> | ||||
|           <a-button @click="handleExcel" type="primary"> | ||||
|             <img class="icon-edit" src="@/assets/images/global/edit.png" alt="" /> | ||||
|             Excel | ||||
|           </a-button> | ||||
|  | @ -79,7 +79,7 @@ const columns = [ | |||
|   }, | ||||
| ] | ||||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | ||||
| import { getAction,getFileAction } from '../../../../../api/manage' | ||||
| import { getAction, getFileAction } from '../../../../../api/manage' | ||||
| import dateFormat from '../../../../../components/jeecg/JEasyCron/format-date' | ||||
| import Detail from "../../../detail.vue" | ||||
| export default { | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
|     <a-card :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="handleEdit" type="primary"> | ||||
|           <a-button @click="handleExcel" type="primary"> | ||||
|             <img class="icon-edit" src="@/assets/images/global/edit.png" alt="" /> | ||||
|             Excel | ||||
|           </a-button> | ||||
|  | @ -76,7 +76,7 @@ const columns = [ | |||
| ] | ||||
| import { compareDate } from "../../commom" | ||||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | ||||
| import { getAction } from '../../../../api/manage' | ||||
| import { getAction, getFileAction } from '../../../../api/manage' | ||||
| import dateFormat from '../../../../components/jeecg/JEasyCron/format-date' | ||||
| export default { | ||||
|   name: 'menuTree', | ||||
|  | @ -106,6 +106,34 @@ export default { | |||
|     this.findStationList() | ||||
|   }, | ||||
|   methods: { | ||||
|     handleExcel() { | ||||
|       if (this.dataSource.length>0) { | ||||
|         // this.queryParam = { | ||||
|         //   startTime: "2023-07-17", | ||||
|         //   endTime: "2023-07-17", | ||||
|         //   stationIds: [1] | ||||
|         // } | ||||
|         let params = { | ||||
|           ...this.queryParam, | ||||
|         } | ||||
|         getFileAction("/webStatistics/alertsExport", 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 = "ALERTS" | ||||
|             document.body.appendChild(link) | ||||
|             link.click() | ||||
|             URL.revokeObjectURL(link.href) | ||||
|             document.body.removeChild(link) | ||||
|           } | ||||
|         }) | ||||
|       } else { | ||||
|         this.$message.warning("No downloadable data") | ||||
|       } | ||||
|     }, | ||||
|     searchQueryData() { | ||||
|       let days = compareDate(this.queryParam.startTime, this.queryParam.endTime) | ||||
|       if (days <= 10) { | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
|     <a-card v-if="!isFileDetail" :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="handleEdit" type="primary"> | ||||
|           <a-button @click="handleExcel" type="primary"> | ||||
|             <img class="icon-edit" src="@/assets/images/global/edit.png" alt="" /> | ||||
|             Excel | ||||
|           </a-button> | ||||
|  | @ -74,7 +74,7 @@ const columns = [ | |||
| ] | ||||
| import { compareDate } from "../../commom" | ||||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | ||||
| import { getAction } from '../../../../api/manage' | ||||
| import { getAction, getFileAction } from '../../../../api/manage' | ||||
| import dateFormat from '../../../../components/jeecg/JEasyCron/format-date' | ||||
| import FileDetail from "../../fileDetail.vue" | ||||
| export default { | ||||
|  | @ -110,6 +110,29 @@ export default { | |||
|     this.findStationList() | ||||
|   }, | ||||
|   methods: { | ||||
|     handleExcel() { | ||||
|       if (this.dataSource.length>0) { | ||||
|         let params = { | ||||
|           ...this.queryParam, | ||||
|         } | ||||
|         getFileAction("/webStatistics/sohExport", 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 = "ALERTS" | ||||
|             document.body.appendChild(link) | ||||
|             link.click() | ||||
|             URL.revokeObjectURL(link.href) | ||||
|             document.body.removeChild(link) | ||||
|           } | ||||
|         }) | ||||
|       } else { | ||||
|         this.$message.warning("No downloadable data") | ||||
|       } | ||||
|     }, | ||||
|     handleBack(flag) { | ||||
|       this.isFileDetail = flag | ||||
|     }, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 orgin
							orgin