Compare commits
2 Commits
4452edc517
...
c4a61f5b1e
| Author | SHA1 | Date | |
|---|---|---|---|
| c4a61f5b1e | |||
| 07b5d47a73 |
|
|
@ -208,6 +208,16 @@ const downloadKateOrdersExcel = (data) => {
|
|||
})
|
||||
}
|
||||
|
||||
const downloadPickTaskRecordsExcel = (data) => {
|
||||
return request({
|
||||
url: '/excel/downloadPickTaskRecordsExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
data: data,
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
uploadExcelStock,
|
||||
uploadExcelGoods,
|
||||
|
|
@ -230,5 +240,6 @@ export {
|
|||
uploadWorkFlow,
|
||||
uploadExcelWorkDate,
|
||||
downloadWorkFlowExcel,
|
||||
downloadKateOrdersExcel
|
||||
downloadKateOrdersExcel,
|
||||
downloadPickTaskRecordsExcel
|
||||
}
|
||||
|
|
@ -402,7 +402,7 @@ export default {
|
|||
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
||||
let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
||||
// let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话
|
||||
let _fileName = "工单报表" + dateFormatter(new Date) + ".xlsx"
|
||||
let _fileName = "未做工单报表" + dateFormatter(this.planStartDateQuery) + ".xlsx"
|
||||
link.style.display = 'none'//隐藏
|
||||
|
||||
// 兼容不同浏览器的URL对象
|
||||
|
|
|
|||
|
|
@ -12,6 +12,14 @@
|
|||
<el-button type="primary" @click="search()">搜索</el-button>
|
||||
<el-button type="warning" @click="reset()">重置</el-button>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-date-picker v-model="dateQuery" type="date" placeholder="任务日期" :shortcuts="shortcuts"
|
||||
style="width: 158px; margin-right: 10px;" clearable/>
|
||||
<el-button style="background-color: #00CED1; color: #000; width: 120px"
|
||||
@click="exportPickTaskRecords()">导出拣选任务记录
|
||||
</el-button>
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
<br/>
|
||||
<el-table :data="pickTaskList" stripe border v-loading="loading" class="table-class" highlight-current-row
|
||||
|
|
@ -91,10 +99,12 @@ import { errorBox } from '@/utils/myMessageBox.js'
|
|||
import {ElMessage} from 'element-plus'
|
||||
import {ref, reactive} from 'vue'
|
||||
import {dateFormatter, timeFormatter} from '@/utils/formatter.js'
|
||||
import {downloadPickTaskRecordsExcel} from "@/api/excel";
|
||||
import {Search} from '@element-plus/icons-vue'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
</script>
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'pickTaskMonitor',
|
||||
data() {
|
||||
|
|
@ -106,6 +116,7 @@ export default {
|
|||
vehicleIdQuery: '',
|
||||
standQuery: '',
|
||||
pickStatusQuery: -99,
|
||||
dateQuery: null,
|
||||
loading: true,
|
||||
dialogVisible: false,
|
||||
pickTaskId: '',
|
||||
|
|
@ -153,6 +164,20 @@ export default {
|
|||
label: '已到达'
|
||||
}
|
||||
],
|
||||
shortcuts: [
|
||||
{
|
||||
text: '今天',
|
||||
value: new Date(),
|
||||
},
|
||||
{
|
||||
text: '昨天',
|
||||
value: () => {
|
||||
const date = new Date()
|
||||
date.setTime(date.getTime() - 3600 * 1000 * 24)
|
||||
return date
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
@ -241,6 +266,44 @@ export default {
|
|||
getCurrentRow(row) {
|
||||
this.pickTaskId = row.pickTaskId
|
||||
},
|
||||
// 导出拣选任务记录
|
||||
exportPickTaskRecords() {
|
||||
if (this.dateQuery == null) {
|
||||
errorBox('请选择日期')
|
||||
return
|
||||
}
|
||||
const request = {
|
||||
vehicleId: this.vehicleIdQuery,
|
||||
standId: this.standQuery,
|
||||
workDate: dateFormatter(this.dateQuery),
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
downloadPickTaskRecordsExcel(request).then(res => {
|
||||
const link = document.createElement('a');//创建a标签
|
||||
try {
|
||||
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
||||
let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
||||
// let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话
|
||||
let _fileName = "拣选任务记录" + dateFormatter(this.dateQuery) + ".xlsx"
|
||||
link.style.display = 'none'//隐藏
|
||||
|
||||
// 兼容不同浏览器的URL对象
|
||||
const url = window.URL || window.webkitURL || window.moxURL
|
||||
link.href = url.createObjectURL(blob)
|
||||
link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
url.revokeObjectURL(link.href)//移除url对象
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
errorBox('下载文件失败')
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
errorBox('导出失败')
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user