Files
FT501-WMS/ruoyi-ui/src/views/job/outJobManagement.vue
2025-07-17 14:21:11 +08:00

402 lines
14 KiB
Vue

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item :label="$t('outJobManagement.status')" prop="status"> <!-- 状态 -->
<el-select v-model="queryParams.status" :placeholder="$t('outJobManagement.selectStatus')" clearable>
<el-option
v-for="dict in dict.type.mydo_job_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('outJobManagement.taskNo')" prop="taskNo"> <!-- 任务号 -->
<el-input
v-model="queryParams.taskNo"
:placeholder="$t('outJobManagement.inputTaskNo')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('outJobManagement.trayCode')" prop="trayCode"> <!-- 托盘条码 -->
<el-input
v-model="queryParams.trayCode"
:placeholder="$t('outJobManagement.inputTrayCode')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('outJobManagement.jobType')" prop="inOrOut"> <!-- 作业类型 -->
<el-select v-model="queryParams.inOrOut" :placeholder="$t('outJobManagement.selectJobType')" clearable>
<el-option
v-for="dict in dict.type.out_job_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('outJobManagement.startTime')" prop="startTime"> <!-- 开始时间 -->
<el-date-picker clearable
v-model="queryParams.startTime"
type="date"
value-format="yyyy-MM-dd"
:placeholder="$t('outJobManagement.selectStartTime')">
</el-date-picker>
</el-form-item>
<el-form-item :label="$t('outJobManagement.finishTime')" prop="finishTime"> <!-- 结束时间 -->
<el-date-picker clearable
v-model="queryParams.finishTime"
type="date"
value-format="yyyy-MM-dd"
:placeholder="$t('outJobManagement.selectFinishTime')">
</el-date-picker>
</el-form-item>
<el-form-item :label="$t('outJobManagement.warehouse')" prop="warehouseId"> <!-- 仓库 -->
<el-select
v-model="queryParams.warehouseId"
:placeholder="$t('outJobManagement.selectWarehouse')"
clearable
>
<el-option
v-for="dict in warehouseOptions"
:key="dict.warehouseId"
:label="dict.warehouseName"
:value="dict.warehouseId"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{$t('outJobManagement.search')}}</el-button> <!-- 搜索 -->
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{$t('outJobManagement.reset')}}</el-button> <!-- 重置 -->
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
@click="OuthandFinish"
v-hasPermi="['job:outmydoJob:OuthandFinish']"
>{{$t('outJobManagement.manualComplete')}}</el-button> <!-- 手动完成 -->
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-download"
size="mini"
@click="OuthandInvalidation"
v-hasPermi="['job:outmydoJob:OuthandInvalidation']"
>{{$t('outJobManagement.manualInvalidate')}}</el-button> <!-- 手动作废 -->
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="mydoJobList" @selection-change="handleSelectionChange" @row-click="handleRowClick" highlight-current-row :current-row="currentRow">
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('outJobManagement.jobId')" align="left" prop="jobId" /> <!-- 任务ID -->
<el-table-column :label="$t('outJobManagement.status')" align="left" prop="status"> <!-- 任务状态 -->
<template slot-scope="scope">
<dict-tag :options="dict.type.mydo_job_status" :value="scope.row.status"/>
</template>
</el-table-column>
<!-- <el-table-column :label="$t('outJobManagement.onLineType')" align="left" prop="onLineType"> &lt;!&ndash; 上线类型 &ndash;&gt;
<template slot-scope="scope">
<dict-tag :options="dict.type.on_line_type" :value="scope.row.onLineType"/>
</template>
</el-table-column>-->
<el-table-column :label="$t('outJobManagement.jobType')" align="left" prop="inOrOut"> <!-- 任务类型 -->
<template slot-scope="scope">
<dict-tag :options="dict.type.out_job_type" :value="scope.row.inOrOut"/>
</template>
</el-table-column>
<el-table-column :label="$t('outJobManagement.taskNo')" align="left" prop="taskNo" /> <!-- 任务号 -->
<!-- <el-table-column :label="$t('outJobManagement.customerId')" align="left" prop="customerId" /> &lt;!&ndash; 客户ID &ndash;&gt;-->
<el-table-column :label="$t('outJobManagement.trayCode')" align="left" prop="trayCode" /> <!-- 托盘码 -->
<!-- <el-table-column :label="$t('outJobManagement.roadwayId')" align="left" prop="roadwayId" /> &lt;!&ndash; 巷道ID &ndash;&gt;-->
<el-table-column :label="$t('outJobManagement.cargoSpaceId')" align="left" prop="cargoSpaceId" /> <!-- 货位ID -->
<el-table-column :label="$t('outJobManagement.priority')" align="right" prop="priority" /> <!-- 优先级 -->
<el-table-column :label="$t('outJobManagement.executionPhase')" align="left" prop="executionPhase"> <!-- 执行阶段 -->
<template slot-scope="scope">
<dict-tag :options="dict.type.execution_phase_type" :value="scope.row.executionPhase"/>
</template>
</el-table-column>
<el-table-column :label="$t('outJobManagement.createTime')" align="left" prop="createTime" width="180"/> <!-- 开始时间 -->
<el-table-column :label="$t('outJobManagement.startTime')" align="left" prop="startTime" width="180"/> <!-- 开始时间 -->
<el-table-column :label="$t('outJobManagement.finishTime')" align="left" prop="finishTime" width="180"/> <!-- 结束时间 -->
<el-table-column :label="$t('outJobManagement.exitId')" align="left" prop="exitId" /> <!-- 出口ID -->
<el-table-column :label="$t('outJobManagement.warehouseId')" align="left" prop="warehouseId" /> <!-- 仓库ID -->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-table v-loading="detailLoading" :data="mydoJobDetailList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('outJobManagement.subTaskId')" align="left" prop="jobDetailId" /> <!-- 子任务ID -->
<el-table-column :label="$t('outJobManagement.stockId')" align="left" prop="stockId" /> <!-- 库存ID -->
<el-table-column :label="$t('outJobManagement.lotNo')" align="left" prop="lotNo" /> <!-- 批次号 -->
<el-table-column :label="$t('outJobManagement.subDocumentId')" align="left" prop="inOrOutDId" /> <!-- 子单据ID -->
<el-table-column :label="$t('outJobManagement.materialCode')" align="left" prop="productId" /> <!-- 物料编码 -->
<el-table-column :label="$t('outJobManagement.outQuantity')" align="right" prop="outQuantity" /> <!-- 出库数量 -->
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize"
@pagination="getDetailList"
/>
</div>
</template>
<script>
import { listMydoJobOut,handFinish,hangInvalidJob } from "@/api/job/OutmydoJob"
import { listMydoJobDetail } from "@/api/job/mydoJobDetail"
import {listWarehouse} from "@/api/bas/warehouse";
export default {
name: "MydoJob",
dicts: ['execution_phase_type', 'in_job_type', 'on_line_type', 'mydo_job_status','out_job_type'],
data() {
return {
// 遮罩层
loading: true,
detailLoading:false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
detailTotal: 0,
// 仓库选项
warehouseOptions: [],
// 任务表表格数据
mydoJobList: [],
// 子任务表表格数据
mydoJobDetailList:[],
// 当前选中行
currentRow:null,
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
// jobId: null,
status: '1',
onLineType: null,
taskNo: null,
supplierId: null,
customerId: null,
departmentId: null,
trayCode: null,
roadwayId: null,
cargoSpaceId: null,
targetRoadwayId: null,
targetCargoSpaceId: null,
lineId: null,
workshopId: null,
priority: null,
executionPhase: null,
inOrOut: null,
createTime: null,
startTime: null,
finishTime: null,
entranceId: null,
exitId: null,
classId: null,
warehouseId: null,
faultFlag: null,
inOut:'2'
},
queryDetailParams:{
pageNum: 1,
pageSize: 10,
jobId: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
jobId: [
{ required: true, message: "任务ID不能为空", trigger: "blur" }
],
status: [
{ required: true, message: "任务状态不能为空", trigger: "change" }
],
taskNo: [
{ required: true, message: "任务号不能为空", trigger: "blur" }
],
}
}
},
created() {
this.getList()
this.getWarehouseOptions();
},
methods: {
/** 获取仓库选项 */
getWarehouseOptions() {
listWarehouse().then(response => {
this.warehouseOptions = response.rows;
});
},
/** 查询任务表列表 */
getList() {
this.loading = true
listMydoJobOut(this.queryParams).then(response => {
this.mydoJobList = response.rows
this.total = response.total
this.loading = false
// 如果有数据,自动选中第一行
if (this.mydoJobList.length > 0) {
this.handleRowClick(this.mydoJobList[0]);
}
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
jobId: null,
status: null,
onLineType: null,
taskNo: null,
supplierId: null,
customerId: null,
departmentId: null,
trayCode: null,
roadwayId: null,
cargoSpaceId: null,
targetRoadwayId: null,
targetCargoSpaceId: null,
lineId: null,
workshopId: null,
priority: null,
executionPhase: null,
inOrOut: null,
createTime: null,
startTime: null,
finishTime: null,
entranceId: null,
exitId: null,
classId: null,
warehouseId: null,
faultFlag: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.jobId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 导出按钮操作 */
handleExport() {
this.download('job/mydoJob/export', {
...this.queryParams
}, `mydoJob_${new Date().getTime()}.xlsx`)
},
/** 行点击事件处理 */
handleRowClick(row) {
// 设置当前选中行
this.currentRow = row;
// 更新子表格查询参数
this.queryDetailParams.jobId = row.jobId;
this.queryDetailParams.status=row.status // 查询子表格数据
this.getDetailList();
},
/** 查询子任务表列表 */
getDetailList() {
// 如果没有选中的主任务,不加载子任务
if (!this.queryDetailParams.jobId) {
this.mydoJobDetailList = [];
this.detailTotal = 0;
this.detailLoading = false;
return;
}
this.detailLoading = true;
listMydoJobDetail(this.queryDetailParams).then(response => {
this.mydoJobDetailList = response.rows;
this.detailTotal = response.total;
this.detailLoading = false;
});
},
//手动完成
OuthandFinish() {
if (this.ids.length === 0) {
this.$modal.msgError("请选择需要手动完成的任务");
return;
}
this.$modal.confirm('是否确认手动完成选中的任务?').then(() => {
return handFinish(this.ids.join(','));
}).then(() => {
this.$modal.msgSuccess("手动完成成功");
this.getList();
}).catch(() => {});
},
//手动作废
OuthandInvalidation() {
if (this.ids.length === 0) {
this.$modal.msgError("请选择需要手动作废的任务");
return;
}
this.$modal.confirm('是否确认手动作废选中的任务?').then(() => {
return hangInvalidJob(this.ids.join(','));
}).then(() => {
this.$modal.msgSuccess("手动作废成功");
this.getList();
}).catch(() => {});
}
}
}
</script>
<style scoped>
.el-table >>> .current-row {
background-color: #f0f9eb;
}
</style>