1、安全环保检查导出excel表格的前端页面代码

hyx_2024-11-12_newInspect
fufeifei 2024-11-01 16:29:26 +08:00
parent 9e8fbe60a2
commit 3939ff0487
2 changed files with 39 additions and 0 deletions

View File

@ -182,6 +182,7 @@
<div class="ui-foot">
<el-button v-print="'#printContent'" type="primary" icon="el-icon-printer" size="mini"></el-button>
<el-button plain type="info" @click="goBack"> </el-button>
<el-button type="primary" icon="el-icon-printer" size="mini" @click="goExport"></el-button>
</div>
</div>
@ -351,6 +352,25 @@ export default {
goBack() {
this.$parent.INSPECTION_ID = ''
this.$parent.activeName = 'List'
},
formatDate(dateStr) {
// Date
const date = new Date(dateStr)
//
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0') // 01
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
// const seconds = String(date.getSeconds()).padStart(2, '0')
//
// return `${year}${month}${day}${hours}${minutes}${seconds}`
return `${year}${month}${day}${hours}${minutes}`
},
//
goExport() {
var dataStr = '?INSPECTION_ID=' + encodeURIComponent(this.$parent.INSPECTION_ID)
window.location.href = config.httpurl + 'safetyenvironmental/exportInfo' + dataStr
}
}
}

View File

@ -98,6 +98,9 @@
<el-button v-waves type="success" icon="el-icon-refresh" @click="goKeyReset">
重置
</el-button>
<el-button v-waves plain type="info" icon="el-icon-right" @click="goExportExcel">
导出
</el-button>
</el-form-item>
</el-col>
</el-row>
@ -371,6 +374,22 @@ export default {
this.$refs.deptTree_Select1.clearHandle()
this.$refs.deptTree_Select2.clearHandle()
},
// Excel
goExportExcel() {
var dataStr = '?HIDDENDESCR=' + encodeURIComponent(this.search.HIDDENDESCR)
dataStr += '&INSPECTED_DEPARTMENT_ID=' + encodeURIComponent(this.search.INSPECTED_DEPARTMENT_ID) //
dataStr += '&INSPECTION_DEPARTMENT_ID=' + encodeURIComponent(this.search.INSPECTION_DEPARTMENT_ID) //
dataStr += '&INSPECTION_ORIGINATOR_NAME=' + encodeURIComponent(this.search.INSPECTION_ORIGINATOR_NAME) //
dataStr += '&INSPECTION_TYPE=' + encodeURIComponent(this.search.INSPECTION_TYPE) //
dataStr += '&INSPECTION_USER_NAME=' + encodeURIComponent(this.search.INSPECTION_USER_NAME) //
dataStr += '&INSPECTION_USER_PHONE=' + encodeURIComponent(this.search.INSPECTION_USER_PHONE) //
dataStr += '&INSPECTION_CASE=' + encodeURIComponent(this.search.INSPECTION_CASE) //
dataStr += '&INSPECTION_STATUS=' + encodeURIComponent(this.search.INSPECTION_STATUS) //
dataStr += '&INSPECTION_SUBJECT=' + encodeURIComponent(this.search.INSPECTION_SUBJECT) //
dataStr += '&INSPECTION_TIME_START=' + encodeURIComponent(this.search.INSPECTION_TIME[0]) //
dataStr += '&INSPECTION_TIME_END=' + encodeURIComponent(this.search.INSPECTION_TIME[1]) //
window.location.href = config.httpurl + 'safetyenvironmental/exportexcel' + dataStr
},
//
getList() {
this.listLoading = true