增加拣选任务记录报表

This commit is contained in:
梁州 2026-02-02 10:43:22 +08:00
parent 06f1b10163
commit 07b5d47a73
3 changed files with 319 additions and 245 deletions

View File

@ -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
}

View File

@ -402,7 +402,7 @@ export default {
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //blobblobtypexls
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

View File

@ -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'}); //blobblobtypexls
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>