@ -4,16 +4,24 @@
< div style = "display: flex;justify-content: space-between;" >
< el -row >
< el -input v -model = " vehicleIdQuery " style = "width: 158px; margin-right: 10px;" placeholder = "箱号"
: suffix - icon = "Search" / >
: suffix - icon = "Search" / >
< el -input v -model = " standQuery " style = "width: 158px; margin-right: 10px;" placeholder = "工站"
: suffix - icon = "Search" / >
: suffix - icon = "Search" / >
< el -select -v2 v -model = " pickStatusQuery " style = "width: 158px; margin-right: 10px;"
placeholder = "请选择状态" : options = "pickStatusOptions" @ change = "search()" > < / e l - s e l e c t - v 2 >
< el -button type = "primary" @click ="search()" > 搜索 < / el -button >
< el -button type = "warning" @click ="reset()" > 重置 < / el -button >
< / e l - r o w >
< 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()" > 导出拣选任务记录
< / e l - b u t t o n >
< / e l - r o w >
< / div >
< br / >
< br / >
< el -table :data ="pickTaskList" stripe border v -loading = " loading " class = "table-class" highlight -current -row
max - height = "650px" @ row - click = "getCurrentRow" : header - cell - style = "{ 'text-align': 'center' }"
: cell - style = "{ 'text-align': 'center' }" >
@ -22,23 +30,23 @@
< el -radio :label ="scope.row.pickTaskId" v-model ="pickTaskId" > & nbsp ; < / el -radio >
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "pickTaskId" label = "id" fixed = "left" min -width = " 120px " show -overflow -tooltip / >
< el -table -column prop = "vehicleId" label = "箱号" fixed = "left" min -width = " 120px " / >
< el -table -column prop = "standId" label = "站台号" fixed = "left" min -width = " 120px " / >
< el -table -column prop = "pickStatus" label = "拣选状态" :formatter ="pickStatusFormat" min -width = " 120px " / >
< el -table -column prop = "pickTaskId" label = "id" fixed = "left" min -width = " 120px " show -overflow -tooltip / >
< el -table -column prop = "vehicleId" label = "箱号" fixed = "left" min -width = " 120px " / >
< el -table -column prop = "standId" label = "站台号" fixed = "left" min -width = " 120px " / >
< el -table -column prop = "pickStatus" label = "拣选状态" :formatter ="pickStatusFormat" min -width = " 120px " / >
< el -table -column prop = "lastUpdateTime" label = "最近更新时间" :formatter ="timeFormat" show -overflow -tooltip
min - width = "120px" / >
min - width = "120px" / >
< el -table -column fixed = "right" label = "操作" width = "120px" >
< template v-slot ="scope" >
< el -button plain type = "primary" @click ="editCurrentRow(scope.row)" > 编辑 < / el -button >
< / template >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e >
< br / >
< 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" / >
@ current - change = "search" / >
< el -dialog v-model ="dialogVisible" title="拣选任务详细信息" width="40%" draggable :show-close="false" >
< div
style = "max-width: 100%; max-height: 500px; overflow: auto; display: flex; justify-content: center;" >
@ -47,19 +55,19 @@
< el -row :gutter ="16" >
< el -col :span ="12" :offset ="0" >
< el -form -item label = "id" prop = "pickTaskId" >
< el -input v -model = " pickTaskFormEntity.pickTaskId " disabled / >
< el -input v -model = " pickTaskFormEntity.pickTaskId " disabled / >
< / e l - f o r m - i t e m >
< / e l - c o l >
< el -col :span ="12" >
< el -form -item label = "工站" prop = "vehicleId" >
< el -input v -model = " pickTaskFormEntity.vehicleId " disabled / >
< el -input v -model = " pickTaskFormEntity.vehicleId " disabled / >
< / e l - f o r m - i t e m >
< / e l - c o l >
< / e l - r o w >
< el -row :gutter ="16" >
< el -col :span ="12" :offset ="0" >
< el -form -item label = "小盒子" prop = "standId" >
< el -input v -model = " pickTaskFormEntity.standId " disabled / >
< el -input v -model = " pickTaskFormEntity.standId " disabled / >
< / e l - f o r m - i t e m >
< / e l - c o l >
< el -col :span ="12" >
@ -86,15 +94,17 @@
< script setup >
import store from '@/store'
import { getPickTasksByPage , updatePickTaskInfo } from '@/api/taskMonitor.js'
import { errorBox } from '@/utils/myMessageBox.js'
import { ElMessage } from 'element-plus'
import { ref , reactive } from 'vue'
import { dateFormatter , timeFormatter } from '@/utils/formatter.js'
import { Search } from '@element-plus/icons-vue'
import { getPickTasksByPage , updatePickTaskInfo } from '@/api/taskMonitor.js'
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 {
/ / l e t b l o b = n e w B l o b ( [ r e s . d a t a ] , { t y p e : ' a p p l i c a t i o n / v n d . m s - e x c e l ' } ) ; / / 如 果 后 台 返 回 的 不 是 b l o b 对 象 类 型 , 先 定 义 成 b l o b 对 象 格 式 , 该 t y p e 导 出 为 x l s 格 式 ,
let blob = res . data / / 如 果 后 台 返 回 的 直 接 是 b l o b 对 象 类 型 , 直 接 获 取 数 据
/ / l e t _ f i l e N a m e = r e s . h e a d e r s [ ' c o n t e n t - d i s p o s i t i o n ' ] . s p l i t ( ' ; ' ) [ 1 ] . s p l i t ( ' = ' ) [ 1 ] ; / / 拆 解 获 取 文 件 名 , 如 果 后 端 有 给 返 回 文 件 名 的 话
let _fileName = "拣选任务记录" + dateFormatter ( this . dateQuery ) + ".xlsx"
link . style . display = 'none' / / 隐 藏
/ / 兼 容 不 同 浏 览 器 的 U R L 对 象
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 ) / / 移 除 u r l 对 象
} catch ( e ) {
console . log ( e )
errorBox ( '下载文件失败' )
}
} ) . catch ( err => {
console . log ( err )
errorBox ( '导出失败' )
} )
} ,
} ,
}
< / script >