2024-07-02 08:16:55 +08:00
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<div style="margin-bottom: 15px">
|
|
|
|
|
|
<el-config-provider :locale="zhCn">
|
|
|
|
|
|
<el-row>
|
2024-07-19 13:46:52 +08:00
|
|
|
|
<el-input v-model="goodsIdQuery" style="width: 256px; margin-right: 10px;" placeholder="物料编号" />
|
|
|
|
|
|
<el-input v-model="vehicleIdQuery" style="width: 256px; margin-right: 10px;" placeholder="载具号" />
|
2024-07-02 08:16:55 +08:00
|
|
|
|
<el-button type="primary" @click="search()">搜索</el-button>
|
|
|
|
|
|
<el-button type="warning" @click="reset()">重置</el-button>
|
2024-07-19 13:46:52 +08:00
|
|
|
|
<el-button type="success" @click="exportExcel()">导出记录</el-button>
|
2024-07-02 08:16:55 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
|
<br />
|
|
|
|
|
|
<el-table :data="tasks" stripe border v-loading="loading" style="width: 100%" max-height="684px"
|
|
|
|
|
|
class="table-class" :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }">
|
|
|
|
|
|
<el-table-column prop="taskType" label="任务类型" fixed="left" :formatter="taskTypeFormat" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="goodsType" label="型号" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="specification" label="规格" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="batchNo" label="批次号" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="taskGroup" label="任务单号" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="origin" label="起点" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="destination" label="终点" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="operateNum" label="操作数量" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="totalNum" label="库存数量" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="taskPriority" label="任务优先级" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="preTask" label="前置任务" min-width="120px" show-overflow-tooltip />
|
|
|
|
|
|
<el-table-column prop="createTime" label="创建时间" :formatter="timeFormat" min-width="120px" />
|
|
|
|
|
|
<!-- <el-table-column prop="userName" label="操作人员姓名" min-width="120px" /> -->
|
|
|
|
|
|
<el-table-column prop="taskStatus" label="任务状态" fixed="right" :formatter="taskStatusFormat"
|
|
|
|
|
|
min-width="120px" />
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
<br />
|
|
|
|
|
|
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 25, 50]"
|
|
|
|
|
|
:small="false" :disabled="false" :background="false" :default-page-size="10"
|
|
|
|
|
|
layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="search"
|
|
|
|
|
|
@current-change="search" />
|
|
|
|
|
|
</el-config-provider>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import { getTaskRecords } from '@/api/record.js'
|
|
|
|
|
|
import { dateFormatter, taskStatusFormatter, timeFormatter } from '@/utils/formatter.js'
|
2024-07-19 13:46:52 +08:00
|
|
|
|
import { downloadOutRecordExcel } from '@/api/excel.js'
|
2024-07-02 08:16:55 +08:00
|
|
|
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
|
|
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
|
|
|
import store from '@/store'
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'outTaskRecord',
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
pageInfo: {},
|
|
|
|
|
|
tasks: [],
|
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
|
total: 0,
|
2024-07-19 13:46:52 +08:00
|
|
|
|
goodsIdQuery: '',
|
|
|
|
|
|
vehicleIdQuery: '',
|
2024-07-02 08:16:55 +08:00
|
|
|
|
loading: true
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
this.search()
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
dateFormat: (row, column, cellValue, index) => {
|
|
|
|
|
|
return dateFormatter(cellValue)
|
|
|
|
|
|
},
|
|
|
|
|
|
timeFormat: (row, column, cellValue, index) => {
|
|
|
|
|
|
return timeFormatter(cellValue)
|
|
|
|
|
|
},
|
|
|
|
|
|
taskStatusFormat: (row, column, cellValue, index) => {
|
|
|
|
|
|
return taskStatusFormatter(cellValue)
|
|
|
|
|
|
},
|
|
|
|
|
|
taskTypeFormat: (row, column, cellValue, index) => {
|
|
|
|
|
|
switch (cellValue) {
|
|
|
|
|
|
case 1: return '入库'
|
|
|
|
|
|
case 2: return '出库'
|
|
|
|
|
|
case 3: return '盘点'
|
|
|
|
|
|
case 9: return '移库'
|
|
|
|
|
|
default: return '未知'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
search() {
|
|
|
|
|
|
this.loading = true
|
|
|
|
|
|
const tableRequest = {
|
2024-07-19 13:46:52 +08:00
|
|
|
|
pageNo: this.currentPage,
|
|
|
|
|
|
pageSize: this.pageSize,
|
|
|
|
|
|
taskType: 2,
|
|
|
|
|
|
goodsId: this.goodsIdQuery.trim(),
|
|
|
|
|
|
vehicleId: this.vehicleIdQuery.trim()
|
2024-07-02 08:16:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
getTaskRecords(tableRequest).then(res => {
|
|
|
|
|
|
const tableResponse = res.data
|
|
|
|
|
|
if (tableResponse.code != 0) {
|
|
|
|
|
|
ElMessage.error(tableResponse.message)
|
|
|
|
|
|
}
|
|
|
|
|
|
this.tasks = tableResponse.rows
|
|
|
|
|
|
this.total = tableResponse.total
|
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
|
console.log(err)
|
|
|
|
|
|
ElMessage.error('查询任务记录错误')
|
|
|
|
|
|
})
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
},
|
|
|
|
|
|
reset() {
|
|
|
|
|
|
this.goodsTypeQuery = ''
|
|
|
|
|
|
this.specificationQuery = ''
|
|
|
|
|
|
this.search()
|
|
|
|
|
|
},
|
2024-07-19 13:46:52 +08:00
|
|
|
|
exportExcel() {
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
vehicleId: this.vehicleIdQuery.trim(),
|
|
|
|
|
|
goodsId: this.goodsIdQuery.trim()
|
|
|
|
|
|
}
|
|
|
|
|
|
downloadOutRecordExcel(params).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(new Date) + ".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) {
|
|
|
|
|
|
ElMessage({
|
|
|
|
|
|
message: '下载文件失败:: ' + e,
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
showClose: true
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
|
ElMessage({
|
|
|
|
|
|
message: '导出失败:: ' + err,
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
showClose: true
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2024-07-02 08:16:55 +08:00
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.el-pagination {
|
|
|
|
|
|
padding-left: 5px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-row .el-button {
|
|
|
|
|
|
width: 72px;
|
|
|
|
|
|
margin-left: 0px;
|
|
|
|
|
|
margin-right: 5px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.table-class {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|