557 lines
20 KiB
Vue
557 lines
20 KiB
Vue
<template>
|
||
<div style="margin-bottom: 10px; height: 100%; padding-left: 1%; padding-right: 1%;">
|
||
<el-config-provider :locale="zhCn">
|
||
<div style="display: flex;justify-content: space-between;">
|
||
<el-row>
|
||
<el-input v-model="workOrderQuery" style="width: 158px; margin-right: 10px; height: 32px;" placeholder="工单号"
|
||
:suffix-icon="Search"/>
|
||
<el-input v-model="workCenterQuery" style="width: 158px; margin-right: 10px; height: 32px;" placeholder="工位/小盒子"
|
||
:suffix-icon="Search"/>
|
||
<el-input v-model="goodsIdQuery" type="textarea" :rows="1" style="width: 158px; margin-right: 10px; height: 32px;"
|
||
placeholder="请输入料号,多个料号请换行输入" class="goods-id-textarea" />
|
||
<el-input v-model="standIdQuery" style="width: 158px; margin-right: 10px; height: 32px;" placeholder="站台号"
|
||
:suffix-icon="Search"/>
|
||
<el-select-v2 v-model="lightStatusQuery" style="width: 158px; margin-right: 10px;"
|
||
placeholder="请选择灯光状态" :options="lightStatusOptions" @change="search()"></el-select-v2>
|
||
<el-select-v2 v-model="workStatusQuery" style="width: 158px; margin-right: 10px;"
|
||
placeholder="请选择工作状态" :options="workStatusOptions" @change="search()"></el-select-v2>
|
||
<el-select-v2 v-model="machineTypeQuery" style="width: 158px; margin-right: 10px;"
|
||
placeholder="请选择机型" :options="machineTypeOptions" @change="search()"></el-select-v2>
|
||
<el-button type="primary" @click="search()">搜索</el-button>
|
||
<el-button type="warning" @click="reset()">重置</el-button>
|
||
</el-row>
|
||
<el-row>
|
||
<el-button style="background-color: #32CD32; color: #000;" @click="exportExcel()">导出</el-button>
|
||
<el-button style="background-color: #00CED1; color: #000;"
|
||
@click="openUploadDialog()">导入
|
||
</el-button>
|
||
</el-row>
|
||
</div>
|
||
<br/>
|
||
<el-table :data="workFlowList" 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' }">
|
||
<el-table-column width="65px" fixed="left">
|
||
<template v-slot="scope">
|
||
<el-radio :label="scope.row.workFlowId" v-model="workFlowId"> </el-radio>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column prop="workFlowId" label="id" fixed="left" min-width="120px" show-overflow-tooltip/>
|
||
<el-table-column prop="orderId" label="订单号" min-width="120px" show-overflow-tooltip/>
|
||
<el-table-column prop="workStation" label="站台号" min-width="120px" show-overflow-tooltip/>
|
||
<el-table-column prop="workOrder" label="工单号" min-width="120px" show-overflow-tooltip/>
|
||
<el-table-column prop="workCenter" label="工位/小盒子" show-overflow-tooltip min-width="120px"/>
|
||
<el-table-column prop="goodsId" label="料号" min-width="120px" show-overflow-tooltip/>
|
||
<el-table-column prop="needNum" label="需求数量" min-width="120px"/>
|
||
<el-table-column prop="pickedNum" label="已拣数量" min-width="120px"/>
|
||
<el-table-column prop="lightStatus" label="亮灯状态" :formatter="lightStatusFormat" min-width="120px"/>
|
||
<el-table-column prop="workStatus" label="工作状态" :formatter="workStatusFormat" min-width="120px"/>
|
||
<el-table-column prop="machineType" label="机型" :formatter="machineTypeFormat" min-width="120px"/>
|
||
<el-table-column prop="planDate" label="计划日期" :formatter="dateFormat" min-width="120px"/>
|
||
<el-table-column prop="createTime" label="创建时间" :formatter="timeFormat" min-width="120px"
|
||
show-overflow-tooltip/>
|
||
<el-table-column prop="finishTime" label="完成时间" :formatter="timeFormat" min-width="120px"
|
||
show-overflow-tooltip/>
|
||
<el-table-column prop="opUser" label="操作用户" 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>
|
||
</el-table-column>
|
||
</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-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;">
|
||
<el-form ref="workFlowFormRef" :model="workFlowFormEntity" :label-position="labelPosition"
|
||
label-width="100px" style="width: 95%;" :rules="rules" status-icon>
|
||
<el-row :gutter="16">
|
||
<el-col :span="12" :offset="0">
|
||
<el-form-item label="id" prop="workFlowId">
|
||
<el-input v-model="workFlowFormEntity.workFlowId" disabled/>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="12">
|
||
<el-form-item label="订单id" prop="orderId">
|
||
<el-input v-model="workFlowFormEntity.orderId" disabled/>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row :gutter="16">
|
||
<el-col :span="12" :offset="0">
|
||
<el-form-item label="站台号" prop="workStation">
|
||
<el-input v-model="workFlowFormEntity.workStation" disabled/>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="12">
|
||
<el-form-item label="工单" prop="workOrder">
|
||
<el-input v-model="workFlowFormEntity.workOrder" disabled/>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row :gutter="16">
|
||
<el-col :span="12" :offset="0">
|
||
<el-form-item label="工位/小盒子" prop="workCenter">
|
||
<el-input v-model="workFlowFormEntity.workCenter" disabled/>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="12">
|
||
<el-form-item label="料号" prop="goodsId">
|
||
<el-input v-model="workFlowFormEntity.goodsId" disabled/>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row :gutter="16">
|
||
<el-col :span="12" :offset="0">
|
||
<el-form-item label="需求数量" prop="needNum">
|
||
<el-input-number v-model.number="workFlowFormEntity.needNum"
|
||
controls-position="right" disabled/>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="12">
|
||
<el-form-item label="已拣数量" prop="pickedNum">
|
||
<el-input-number v-model.number="workFlowFormEntity.pickedNum"
|
||
controls-position="right" :min="0" :max="workFlowFormEntity.needNum"
|
||
clearable/>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row :gutter="16">
|
||
<el-col :span="12" :offset="0">
|
||
<el-form-item label="亮灯状态" prop="lightStatus">
|
||
<el-select-v2 v-model="workFlowFormEntity.lightStatus" placeholder="请选择亮灯状态"
|
||
:options="lightStatusOptions"></el-select-v2>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="12">
|
||
<el-form-item label="任务状态" prop="workStatus">
|
||
<el-select-v2 v-model="workFlowFormEntity.workStatus" placeholder="请选择任务状态"
|
||
:options="workStatusOptions"></el-select-v2>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row :gutter="16">
|
||
<el-col :span="12" :offset="0">
|
||
<el-form-item label="创建时间" prop="createTime">
|
||
<el-input v-model="workFlowFormEntity.createTime" disabled/>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="12">
|
||
<el-form-item label="完成时间" prop="finishTime">
|
||
<el-input v-model="workFlowFormEntity.finishTime" disabled/>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-row :gutter="16">
|
||
<el-col :span="12" :offset="0">
|
||
<el-form-item label="操作用户" prop="opUser">
|
||
<el-input v-model="workFlowFormEntity.opUser" disabled/>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
</el-form>
|
||
</div>
|
||
<template #footer>
|
||
<span class="dialog-footer">
|
||
<el-button @click="dialogVisible = false">取消</el-button>
|
||
<el-button type="primary" @click="submitInfo(workFlowFormEntity)">
|
||
确定
|
||
</el-button>
|
||
</span>
|
||
</template>
|
||
</el-dialog>
|
||
<el-dialog v-model="uploadDialogVisible" title="工作流" width="40%" draggable :show-close="true">
|
||
<fieldset class="title-area">
|
||
<legend>上次更新</legend>
|
||
<div style="padding: 5px;">
|
||
<div style="display: flex; margin-bottom: 10px;">
|
||
<div style="display: flex; width: 100%;">
|
||
<div style="width: 30%; align-content: center;">时间:</div>
|
||
<el-input v-model="uploadRecord.uploadTime" readonly/>
|
||
</div>
|
||
<div style="display: flex; width: 100%; margin-left: 5px;">
|
||
<div style="width: 30%; align-content: center;">人员:</div>
|
||
<el-input v-model="uploadRecord.uploadUser" readonly/>
|
||
</div>
|
||
</div>
|
||
<div style="display: flex; width: 100%;">
|
||
<div style="width: 13%; align-content: center;">文件名:</div>
|
||
<el-input type="textarea" :rows="1" v-model="uploadRecord.fileName" :maxlength="-1"
|
||
:show-word-limit="false" :autosize="{ minRows: 1, maxRows: 4 }" readonly>
|
||
</el-input>
|
||
</div>
|
||
</div>
|
||
</fieldset>
|
||
<fieldset class="title-area">
|
||
<legend>再次更新</legend>
|
||
<UploadExcelWorkFlow></UploadExcelWorkFlow>
|
||
</fieldset>
|
||
</el-dialog>
|
||
</el-config-provider>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup>
|
||
import store from '@/store'
|
||
import {getWorkFlows, updateWorkFlows} from '@/api/kateWork.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 UploadExcelWorkFlow from '@/excel/UploadExcelWorkFlow.vue'
|
||
import {queryUploadRecord, downloadWorkFlowExcel} from '@/api/excel.js'
|
||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||
</script>
|
||
<script>
|
||
export default {
|
||
name: 'pickTaskMonitor',
|
||
data() {
|
||
return {
|
||
workFlowList: [],
|
||
currentPage: 1,
|
||
pageSize: 10,
|
||
total: 0,
|
||
workOrderQuery: '',
|
||
workCenterQuery: '',
|
||
goodsIdQuery: '',
|
||
standIdQuery: '',
|
||
machineTypeQuery: -99,
|
||
lightStatusQuery: -99,
|
||
workStatusQuery: -99,
|
||
loading: true,
|
||
dialogVisible: false,
|
||
workFlowId: '',
|
||
workFlowFormEntity: reactive({}),
|
||
workFlowFormRef: ref(),
|
||
labelPosition: 'top',
|
||
rules: reactive({}),
|
||
lightStatusOptions: [
|
||
{
|
||
value: -99,
|
||
label: '全部'
|
||
},
|
||
{
|
||
value: 0,
|
||
label: '未亮灯'
|
||
},
|
||
{
|
||
value: 1,
|
||
label: '已亮灯'
|
||
},
|
||
{
|
||
value: 2,
|
||
label: '已拍灯'
|
||
}
|
||
],
|
||
workStatusOptions: [
|
||
{
|
||
value: -99,
|
||
label: '全部'
|
||
},
|
||
{
|
||
value: -1,
|
||
label: '暂存'
|
||
},
|
||
{
|
||
value: 0,
|
||
label: '未开始'
|
||
},
|
||
{
|
||
value: 1,
|
||
label: '正在做'
|
||
},
|
||
{
|
||
value: 2,
|
||
label: '已完成'
|
||
}
|
||
],
|
||
machineTypeOptions: [
|
||
{
|
||
value: -99,
|
||
label: '全部'
|
||
},
|
||
{
|
||
value: 1,
|
||
label: '装载机'
|
||
},
|
||
{
|
||
value: 2,
|
||
label: '平地机'
|
||
}
|
||
],
|
||
uploadDialogVisible: false,
|
||
uploadRecord: reactive({
|
||
fileName: '',
|
||
uploadTime: '',
|
||
uploadUser: ''
|
||
}),
|
||
}
|
||
},
|
||
mounted() {
|
||
this.search()
|
||
},
|
||
methods: {
|
||
search() {
|
||
this.loading = true
|
||
const request = {
|
||
pageNo: this.currentPage,
|
||
pageSize: this.pageSize,
|
||
workStation: this.standIdQuery.trim(),
|
||
workOrder: this.workOrderQuery.trim(),
|
||
workCenter: this.workCenterQuery.trim(),
|
||
goodsId: this.goodsIdQuery.trim().split('\n').filter(id => id.trim() !== '').join(','),
|
||
lightStatus: this.lightStatusQuery == -99 ? null : this.lightStatusQuery,
|
||
workStatus: this.workStatusQuery == -99 ? null : this.workStatusQuery,
|
||
machineType: this.machineTypeQuery == -99 ? null : this.machineTypeQuery,
|
||
userName: store.getters.getUserName
|
||
}
|
||
getWorkFlows(request).then(res => {
|
||
const tableResponse = res.data
|
||
if (tableResponse.code == 0) {
|
||
this.workFlowList = tableResponse.returnData.lists
|
||
this.total = tableResponse.returnData.total
|
||
} else {
|
||
errorBox(tableResponse.message)
|
||
}
|
||
}).catch(err => {
|
||
console.log(err)
|
||
errorBox('查询工作流错误')
|
||
})
|
||
this.loading = false
|
||
},
|
||
dateFormat: (row, column, cellValue, index) => {
|
||
return dateFormatter(cellValue)
|
||
},
|
||
timeFormat: (row, column, cellValue, index) => {
|
||
return timeFormatter(cellValue)
|
||
},
|
||
lightStatusFormat: (row, column, cellValue, index) => {
|
||
switch (cellValue) {
|
||
case 0:
|
||
return '未亮灯'
|
||
case 1:
|
||
return '已亮灯'
|
||
case 2:
|
||
return '已拍灯'
|
||
default:
|
||
return '未知'
|
||
}
|
||
},
|
||
workStatusFormat: (row, column, cellValue, index) => {
|
||
switch (cellValue) {
|
||
case 0:
|
||
return '未开始'
|
||
case 1:
|
||
return '正在做'
|
||
case 2:
|
||
return '已完成'
|
||
default:
|
||
return '未知'
|
||
}
|
||
},
|
||
machineTypeFormat: (row, column, cellValue, index) => {
|
||
switch (cellValue) {
|
||
case 1:
|
||
return '装载机'
|
||
case 2:
|
||
return '平地机'
|
||
default:
|
||
return '异常'
|
||
}
|
||
},
|
||
reset() {
|
||
this.standIdQuery = ''
|
||
this.workOrderQuery = ''
|
||
this.workCenterQuery = ''
|
||
this.goodsIdQuery = ''
|
||
this.search()
|
||
},
|
||
editCurrentRow(row) {
|
||
this.workFlowId = row.workFlowId
|
||
this.workFlowFormEntity = {
|
||
workFlowId: row.workFlowId,
|
||
orderId: row.orderId,
|
||
workStation: row.workStation,
|
||
workOrder: row.workOrder,
|
||
workCenter: row.workCenter,
|
||
goodsId: row.goodsId,
|
||
pickedNum: row.pickedNum,
|
||
needNum: row.needNum,
|
||
lightStatus: row.lightStatus,
|
||
workStatus: row.workStatus,
|
||
createTime: row.createTime,
|
||
finishTime: row.finishTime,
|
||
opUser: row.opUser
|
||
}
|
||
this.dialogVisible = true
|
||
},
|
||
submitInfo(formData) {
|
||
const params = {
|
||
workFlowId: formData.workFlowId,
|
||
pickedNum: formData.pickedNum,
|
||
lightStatus: formData.lightStatus,
|
||
workStatus: formData.workStatus,
|
||
userName: store.getters.getUserName
|
||
}
|
||
updateWorkFlows(params).then(res => {
|
||
if (res.data.code == 0) {
|
||
this.dialogVisible = false
|
||
ElMessage.success('更新工作流信息成功。')
|
||
this.search()
|
||
} else {
|
||
errorBox(res.data.message)
|
||
}
|
||
}).catch(err => {
|
||
console.log(err)
|
||
errorBox('更新工作流信息失败。')
|
||
})
|
||
},
|
||
getCurrentRow(row) {
|
||
this.workFlowId = row.workFlowId
|
||
},
|
||
openUploadDialog() {
|
||
// 请求上传记录
|
||
const param = {
|
||
userName: store.getters.getUserName,
|
||
fileDescription: 'WORKFLOW',
|
||
isAsc: false,
|
||
sortBy: 'upload_time'
|
||
}
|
||
queryUploadRecord(param).then(res => {
|
||
if (res.data.code == 0) {
|
||
if (res.data.returnData.total > 0) {
|
||
this.uploadRecord = res.data.returnData.lists[0]
|
||
} else {
|
||
this.uploadRecord = reactive({
|
||
fileName: '',
|
||
uploadTime: '',
|
||
uploadUser: ''
|
||
})
|
||
}
|
||
} else {
|
||
this.uploadRecord = reactive({
|
||
fileName: '',
|
||
uploadTime: '',
|
||
uploadUser: ''
|
||
})
|
||
}
|
||
}).catch(err => {
|
||
console.log(err)
|
||
errorBox('发生异常')
|
||
})
|
||
this.uploadDialogVisible = true
|
||
},
|
||
exportExcel() {
|
||
const request = {
|
||
workStation: this.standIdQuery.trim(),
|
||
workOrder: this.workOrderQuery.trim(),
|
||
workCenter: this.workCenterQuery.trim(),
|
||
goodsId: this.goodsIdQuery.trim().split('\n').filter(id => id.trim() !== '').join(','),
|
||
lightStatus: this.lightStatusQuery == -99 ? null : this.lightStatusQuery,
|
||
workStatus: this.workStatusQuery == -99 ? null : this.workStatusQuery,
|
||
machineType: this.machineTypeQuery == -99 ? null : this.machineTypeQuery,
|
||
userName: store.getters.getUserName
|
||
}
|
||
downloadWorkFlowExcel(request).then(res => {
|
||
const link = document.createElement('a');//创建a标签
|
||
try {
|
||
let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
||
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) {
|
||
console.log(e)
|
||
errorBox('下载文件失败')
|
||
}
|
||
}).catch(err => {
|
||
console.log(err)
|
||
errorBox('导出失败')
|
||
})
|
||
},
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.el-pagination {
|
||
padding-left: 5px;
|
||
}
|
||
|
||
.el-row .el-button {
|
||
width: 72px;
|
||
margin-left: 0px;
|
||
margin-right: 5px;
|
||
}
|
||
|
||
.table-class {
|
||
width: 100%;
|
||
}
|
||
|
||
.el-row .el-form-item {
|
||
width: 10% inherit;
|
||
justify-content: center;
|
||
}
|
||
|
||
.el-row .el-form-item .el-select-v2 {
|
||
width: 100% !important;
|
||
}
|
||
|
||
.el-row .el-form-item .el-input-number {
|
||
width: 100% !important;
|
||
}
|
||
|
||
.el-row .el-form-item .el-button {
|
||
margin: auto;
|
||
}
|
||
|
||
.title-area {
|
||
display: flex;
|
||
/* min-height: 10%; */
|
||
max-height: max-content;
|
||
margin-bottom: 10px;
|
||
min-width: inherit;
|
||
border: solid 1px;
|
||
border-radius: 10px;
|
||
box-shadow: 0px 15px 10px -15px #000;
|
||
overflow: auto;
|
||
flex-direction: column;
|
||
padding: 10px;
|
||
}
|
||
|
||
/* 专门为料号文本域添加样式 */
|
||
.goods-id-textarea {
|
||
vertical-align: top;
|
||
}
|
||
|
||
.goods-id-textarea :deep(.el-textarea__inner) {
|
||
font-size: 12px;
|
||
line-height: 1.2;
|
||
padding: 5px;
|
||
height: 32px !important;
|
||
min-height: 32px !important;
|
||
resize: none;
|
||
}
|
||
|
||
/* 确保其他输入框保持一致的高度 */
|
||
.el-input {
|
||
height: 32px;
|
||
}
|
||
|
||
.el-input :deep(.el-input__wrapper) {
|
||
height: 32px;
|
||
line-height: 32px;
|
||
}
|
||
</style> |