Commit c7104966 authored by 杨硕's avatar 杨硕

添加导出按钮

parent 0e5b576a
...@@ -710,6 +710,14 @@ ...@@ -710,6 +710,14 @@
<el-button class="resetBtn" size="small" @click="resetPosition">重置 Reset</el-button> <el-button class="resetBtn" size="small" @click="resetPosition">重置 Reset</el-button>
</el-form-item> </el-form-item>
</div> </div>
<div style="float: right;position: relative;bottom: 10px">
<el-button
class="redBtn"
type="danger"
size="small"
@click="handleExport1"
>导出 Export</el-button>
</div>
<div style="margin-left: 10px; font-size: 16px;"> <div style="margin-left: 10px; font-size: 16px;">
SN编码信息列表 SN编码信息列表
</div> </div>
...@@ -1259,6 +1267,7 @@ import { formAssembling, getSnsVague, queryBatch, queryTestInfo } from '@/api/as ...@@ -1259,6 +1267,7 @@ import { formAssembling, getSnsVague, queryBatch, queryTestInfo } from '@/api/as
import { listRepairRecordDetails } from '@/api/repairRecord' import { listRepairRecordDetails } from '@/api/repairRecord'
import { getDicts } from '@/api/system/dict/data' import { getDicts } from '@/api/system/dict/data'
import Data from "@/views/system/dict/data"; import Data from "@/views/system/dict/data";
import { homePageExport } from '@/api/system/monitoring'
export default { export default {
name: 'WorkOrder', name: 'WorkOrder',
...@@ -1534,6 +1543,30 @@ export default { ...@@ -1534,6 +1543,30 @@ export default {
}) })
}) })
}, },
/** SN编码信息表单导出按钮 **/
handleExport1() {
const queryParams = this.qtyParams
const newDate = moment(new Date().getTime()).format('YYYYMMDD')
// 弹出提示框
this.$confirm('是否确认导出所有SN编码信息?', '提示', {
confirmButtonText: '确定 Confirm',
cancelButtonText: '取消 Cancel',
cancelButtonClass: 'btn-custom-cancel',
type: 'warning'
}).then(function() {
return homePageExport(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a') // 创建a标签
const href = window.URL.createObjectURL(blob) // 创建下载的链接
downloadElement.href = href // 点击a标签,进行下载
downloadElement.download = 'SN编码信息导出' + newDate + '.xls' // 下载后文件名
document.body.appendChild(downloadElement) // 向body添加a标签
downloadElement.click() // 点击下载
document.body.removeChild(downloadElement) // 下载完成移除a标签
window.URL.revokeObjectURL(href) // 释放掉blob对象
})
})
},
handleSizeChange1(val) { handleSizeChange1(val) {
this.currentPage1 = 1 this.currentPage1 = 1
this.pageSize1 = val this.pageSize1 = val
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<el-button class="resetBtn" size="small" @click="resetPosition">重置 Reset</el-button> <el-button class="resetBtn" size="small" @click="resetPosition">重置 Reset</el-button>
</el-form-item> </el-form-item>
</div> </div>
<div v-if="btnShow" style="float: right;position: relative;bottom: 10px"> <div style="float: right;position: relative;bottom: 10px">
<el-button <el-button
class="redBtn" class="redBtn"
type="danger" type="danger"
......
...@@ -1030,6 +1030,14 @@ ...@@ -1030,6 +1030,14 @@
<el-button class="resetBtn" size="small" @click="resetPosition">重置 Reset</el-button> <el-button class="resetBtn" size="small" @click="resetPosition">重置 Reset</el-button>
</el-form-item> </el-form-item>
</div> </div>
<div style="float: right;position: relative;bottom: 10px">
<el-button
class="redBtn"
type="danger"
size="small"
@click="handleExport1"
>导出 Export</el-button>
</div>
<div style="margin-left: 10px; font-size: 16px;"> <div style="margin-left: 10px; font-size: 16px;">
SN编码信息列表 SN编码信息列表
</div> </div>
...@@ -1167,6 +1175,8 @@ import { formAssembling, queryBatch, queryDeviceAss, queryTestInfo, exportLineNo ...@@ -1167,6 +1175,8 @@ import { formAssembling, queryBatch, queryDeviceAss, queryTestInfo, exportLineNo
import { getOrder, listOrderLine, listOrderMater, listStation } from '@/api/workOrder' import { getOrder, listOrderLine, listOrderMater, listStation } from '@/api/workOrder'
import { listRepairRecordDetails } from '@/api/repairRecord' import { listRepairRecordDetails } from '@/api/repairRecord'
import { getDicts } from '@/api/system/dict/data' import { getDicts } from '@/api/system/dict/data'
import moment from 'moment/moment'
import { homePageExport } from '@/api/system/monitoring'
export default { export default {
name: 'Assembling', name: 'Assembling',
...@@ -1437,6 +1447,30 @@ export default { ...@@ -1437,6 +1447,30 @@ export default {
}) })
}) })
}, },
/** SN编码信息表单导出按钮 **/
handleExport1() {
const queryParams = this.qtyParams
const newDate = moment(new Date().getTime()).format('YYYYMMDD')
// 弹出提示框
this.$confirm('是否确认导出所有SN编码信息?', '提示', {
confirmButtonText: '确定 Confirm',
cancelButtonText: '取消 Cancel',
cancelButtonClass: 'btn-custom-cancel',
type: 'warning'
}).then(function() {
return homePageExport(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a') // 创建a标签
const href = window.URL.createObjectURL(blob) // 创建下载的链接
downloadElement.href = href // 点击a标签,进行下载
downloadElement.download = 'SN编码信息导出' + newDate + '.xls' // 下载后文件名
document.body.appendChild(downloadElement) // 向body添加a标签
downloadElement.click() // 点击下载
document.body.removeChild(downloadElement) // 下载完成移除a标签
window.URL.revokeObjectURL(href) // 释放掉blob对象
})
})
},
/** /**
* 查询按钮方法 * 查询按钮方法
*/ */
......
...@@ -508,6 +508,14 @@ ...@@ -508,6 +508,14 @@
<el-button class="resetBtn" size="small" @click="resetPosition">重置 Reset</el-button> <el-button class="resetBtn" size="small" @click="resetPosition">重置 Reset</el-button>
</el-form-item> </el-form-item>
</div> </div>
<div style="float: right;position: relative;bottom: 10px">
<el-button
class="redBtn"
type="danger"
size="small"
@click="handleExport1"
>导出 Export</el-button>
</div>
<div style="margin-left: 10px; font-size: 16px;"> <div style="margin-left: 10px; font-size: 16px;">
SN编码信息列表 SN编码信息列表
</div> </div>
...@@ -937,9 +945,10 @@ ...@@ -937,9 +945,10 @@
<script> <script>
import moment from 'moment' import moment from 'moment'
import { exportPacking, listPacking, queryDetailDevice } from '@/api/packing' import { exportPacking, listPacking, queryDetailDevice } from '@/api/packing'
import {exportLineNo, formAssembling, getSnsVague, queryBatch, queryDeviceAss, queryTestInfo} from '@/api/assembling' import { exportLineNo, formAssembling, getSnsVague, queryBatch, queryDeviceAss, queryTestInfo } from '@/api/assembling'
import { listRepairRecordDetails } from '@/api/repairRecord' import { listRepairRecordDetails } from '@/api/repairRecord'
import { getDicts } from '@/api/system/dict/data' import { getDicts } from '@/api/system/dict/data'
import { homePageExport } from '@/api/system/monitoring'
export default { export default {
name: 'Packing', name: 'Packing',
/** 路由离开前存储筛选条件*/ /** 路由离开前存储筛选条件*/
...@@ -1007,7 +1016,8 @@ export default { ...@@ -1007,7 +1016,8 @@ export default {
materSn: '', materSn: '',
lineCode: '', lineCode: '',
orderId: '', orderId: '',
type: 'package' type: 'package',
staId: null
}, },
QtyDialog: false, // sn编码模态框 QtyDialog: false, // sn编码模态框
SNTableList: [], SNTableList: [],
...@@ -1263,6 +1273,30 @@ export default { ...@@ -1263,6 +1273,30 @@ export default {
}) })
}) })
}, },
/** SN编码信息表单导出按钮 **/
handleExport1() {
const queryParams = this.qtyParams
const newDate = moment(new Date().getTime()).format('YYYYMMDD')
// 弹出提示框
this.$confirm('是否确认导出所有SN编码信息?', '提示', {
confirmButtonText: '确定 Confirm',
cancelButtonText: '取消 Cancel',
cancelButtonClass: 'btn-custom-cancel',
type: 'warning'
}).then(function() {
return homePageExport(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a') // 创建a标签
const href = window.URL.createObjectURL(blob) // 创建下载的链接
downloadElement.href = href // 点击a标签,进行下载
downloadElement.download = 'SN编码信息导出' + newDate + '.xls' // 下载后文件名
document.body.appendChild(downloadElement) // 向body添加a标签
downloadElement.click() // 点击下载
document.body.removeChild(downloadElement) // 下载完成移除a标签
window.URL.revokeObjectURL(href) // 释放掉blob对象
})
})
},
/** /**
* 包装追溯号信息导出 * 包装追溯号信息导出
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment