|
@@ -21,6 +21,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button @click="search()">查询</el-button>
|
|
|
+ <el-button type="primary" @click="exportData()" style="margin-left: 8px;">导出</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<!-- 数据表格 -->
|
|
@@ -131,6 +132,31 @@ export default {
|
|
|
this.pageIndex = 1
|
|
|
this.getDataList()
|
|
|
},
|
|
|
+ // 导出
|
|
|
+ exportData () {
|
|
|
+ const params = this.$http.adornParams({
|
|
|
+ 'dateStart': this.dataForm.date ? this.dataForm.date[0] : null,
|
|
|
+ 'dateEnd': this.dataForm.date ? this.dataForm.date[1] : null,
|
|
|
+ 'equipmentId': this.dataForm.equipmentId,
|
|
|
+ 'operatorId': this.dataForm.operatorId
|
|
|
+ })
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl('/biz-service/prodEquipmentRecord/count/exportExcel'),
|
|
|
+ method: 'get',
|
|
|
+ params,
|
|
|
+ responseType: 'blob'
|
|
|
+ }).then(response => {
|
|
|
+ const blob = new Blob([response.data], { type: 'application/vnd.ms-excel' })
|
|
|
+ const url = window.URL.createObjectURL(blob)
|
|
|
+ const link = document.createElement('a')
|
|
|
+ link.href = url
|
|
|
+ link.setAttribute('download', '生产记录导出.xlsx')
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ document.body.removeChild(link)
|
|
|
+ window.URL.revokeObjectURL(url)
|
|
|
+ })
|
|
|
+ },
|
|
|
// 获取数据列表
|
|
|
getDataList () {
|
|
|
this.dataListLoading = true
|