|
|
|
@ -0,0 +1,598 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
|
|
|
|
<el-form-item label="工单编号" prop="orderCode">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.orderCode"
|
|
|
|
|
placeholder="请输入工单编号"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="销售订单编号" prop="saleorderCode">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.saleorderCode"
|
|
|
|
|
placeholder="请输入销售订单编号"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
plain
|
|
|
|
|
icon="el-icon-plus"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleSave"
|
|
|
|
|
>保存
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="info"
|
|
|
|
|
plain
|
|
|
|
|
icon="el-icon-sort"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="toggleExpandAll"
|
|
|
|
|
>展开/折叠
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="warning"
|
|
|
|
|
plain
|
|
|
|
|
icon="el-icon-back"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="close"
|
|
|
|
|
>关闭
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-radio-group v-model="arrangeType">
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for="dict in arrangeTypeList"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.value"
|
|
|
|
|
>{{ dict.label }}
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-table
|
|
|
|
|
v-if="refreshTable"
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
:data="productOrderList"
|
|
|
|
|
row-key="productOrderId"
|
|
|
|
|
:default-expand-all="isExpandAll"
|
|
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column label="工单编号" prop="orderCode" v-if="columns[1].visible" width="250"/>
|
|
|
|
|
<el-table-column label="销售订单ID" align="center" prop="saleOrderId" v-if="columns[2].visible" width="100"/>
|
|
|
|
|
<el-table-column label="销售订单标识" align="center" prop="saleOrderFlag" v-if="columns[3].visible" width="100"/>
|
|
|
|
|
<el-table-column label="销售订单编号" align="center" prop="saleorderCode" v-if="columns[4].visible" width="120"/>
|
|
|
|
|
<el-table-column label="销售订单行号" align="center" prop="saleorderLinenumber" v-if="columns[5].visible" width="100"/>
|
|
|
|
|
<el-table-column label="项目编号" align="center" prop="projectNo" v-if="columns[6].visible" width="100"/>
|
|
|
|
|
<el-table-column label="销售类型" align="center" prop="saleType" v-if="columns[7].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<dict-tag :options="dict.type.mes_sale_type" :value="scope.row.saleType"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="物料ID" align="center" prop="materialId" v-if="columns[8].visible"/>
|
|
|
|
|
<el-table-column label="物料bomID" align="center" prop="materialBomId" v-if="columns[9].visible"/>
|
|
|
|
|
<el-table-column label="派工类型" align="center" prop="dispatchType" v-if="columns[10].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<dict-tag :options="dict.type.dispatch_type" :value="scope.row.dispatchType"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="派工ID" align="center" prop="dispatchId" v-if="columns[11].visible"/>
|
|
|
|
|
<el-table-column label="销售数量" align="center" prop="saleAmount" v-if="columns[12].visible"/>
|
|
|
|
|
<el-table-column label="计划数量" align="center" prop="planAmount" v-if="columns[14].visible"/>
|
|
|
|
|
<el-table-column label="已派工数量" align="center" prop="dispatchAmount" width="90" v-if="columns[15].visible"/>
|
|
|
|
|
<el-table-column label="完成数量" align="center" prop="completeAmount" v-if="columns[16].visible"/>
|
|
|
|
|
<el-table-column label="计划交货日期" align="center" prop="planDeliveryDate" width="180" v-if="columns[13].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.planDeliveryDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="发布时间" align="center" prop="releaseTime" width="180" v-if="columns[17].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.releaseTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="工期(天)" align="center" prop="duration" width="90" v-if="columns[30].visible"/>
|
|
|
|
|
<el-table-column label="计划开始时间" align="center" prop="planBeginTime" width="230" v-if="columns[18].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-date-picker v-model="scope.row.planBeginTime" style="width:200px;"
|
|
|
|
|
placeholder="请选择计划开始时间"
|
|
|
|
|
type="datetime" value-format="yyyy-MM-dd HH:mm:ss" clearable
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="计划结束时间" align="center" prop="planEndTime" width="230" v-if="columns[19].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-date-picker v-model="scope.row.planEndTime" style="width:200px;"
|
|
|
|
|
placeholder="请选择计划完成时间"
|
|
|
|
|
type="datetime" value-format="yyyy-MM-dd HH:mm:ss" clearable
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="开始时间" align="center" prop="realBeginTime" width="180" v-if="columns[20].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.realBeginTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="完成时间" align="center" prop="realEndTime" width="180" v-if="columns[21].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ parseTime(scope.row.realEndTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="工单状态" align="center" prop="orderStatus" v-if="columns[22].visible"/>
|
|
|
|
|
<el-table-column label="库存锁定标识" align="center" prop="stockLockFlag" v-if="columns[23].visible"/>
|
|
|
|
|
<el-table-column label="备注" align="center" prop="remark" v-if="columns[24].visible"/>
|
|
|
|
|
<el-table-column label="前置生产工单ID" align="center" prop="preOrderId" v-if="columns[29].visible"/>
|
|
|
|
|
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">-->
|
|
|
|
|
<!-- <template slot-scope="scope">-->
|
|
|
|
|
<!-- <el-button-->
|
|
|
|
|
<!-- size="mini"-->
|
|
|
|
|
<!-- type="text"-->
|
|
|
|
|
<!-- icon="el-icon-edit"-->
|
|
|
|
|
<!-- @click="handleUpdate(scope.row)"-->
|
|
|
|
|
<!-- v-hasPermi="['mes:productOrder:edit']"-->
|
|
|
|
|
<!-- >修改</el-button>-->
|
|
|
|
|
<!-- <el-button-->
|
|
|
|
|
<!-- size="mini"-->
|
|
|
|
|
<!-- type="text"-->
|
|
|
|
|
<!-- icon="el-icon-plus"-->
|
|
|
|
|
<!-- @click="handleAdd(scope.row)"-->
|
|
|
|
|
<!-- v-hasPermi="['mes:productOrder:add']"-->
|
|
|
|
|
<!-- >新增</el-button>-->
|
|
|
|
|
<!-- <el-button-->
|
|
|
|
|
<!-- size="mini"-->
|
|
|
|
|
<!-- type="text"-->
|
|
|
|
|
<!-- icon="el-icon-delete"-->
|
|
|
|
|
<!-- @click="handleDelete(scope.row)"-->
|
|
|
|
|
<!-- v-hasPermi="['mes:productOrder:remove']"-->
|
|
|
|
|
<!-- >删除</el-button>-->
|
|
|
|
|
<!-- </template>-->
|
|
|
|
|
<!-- </el-table-column>-->
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<!-- 添加或修改生产工单;生产工单对话框 -->
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
|
<el-form-item label="工单编号" prop="orderCode">
|
|
|
|
|
<el-input v-model="form.orderCode" placeholder="请输入工单编号"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="销售订单ID" prop="saleOrderId">
|
|
|
|
|
<el-input v-model="form.saleOrderId" placeholder="请输入销售订单ID"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="销售订单标识" prop="saleOrderFlag">
|
|
|
|
|
<el-input v-model="form.saleOrderFlag" placeholder="请输入销售订单标识"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="销售订单编号" prop="saleorderCode">
|
|
|
|
|
<el-input v-model="form.saleorderCode" placeholder="请输入销售订单编号"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="销售订单行号" prop="saleorderLinenumber">
|
|
|
|
|
<el-input v-model="form.saleorderLinenumber" placeholder="请输入销售订单行号"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="项目编号" prop="projectNo">
|
|
|
|
|
<el-input v-model="form.projectNo" placeholder="请输入项目编号"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="物料ID" prop="materialId">
|
|
|
|
|
<el-input v-model="form.materialId" placeholder="请输入物料ID"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="物料bomID" prop="materialBomId">
|
|
|
|
|
<el-input v-model="form.materialBomId" placeholder="请输入物料bomID"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="派工ID" prop="dispatchId">
|
|
|
|
|
<el-input v-model="form.dispatchId" placeholder="请输入派工ID"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="销售数量" prop="saleAmount">
|
|
|
|
|
<el-input v-model="form.saleAmount" placeholder="请输入销售数量"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="计划交货日期" prop="planDeliveryDate">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="form.planDeliveryDate"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
placeholder="选择计划交货日期">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="计划数量" prop="planAmount">
|
|
|
|
|
<el-input v-model="form.planAmount" placeholder="请输入计划数量"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="已派工数量" prop="dispatchAmount">
|
|
|
|
|
<el-input v-model="form.dispatchAmount" placeholder="请输入已派工数量"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="完成数量" prop="completeAmount">
|
|
|
|
|
<el-input v-model="form.completeAmount" placeholder="请输入完成数量"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="发布时间" prop="releaseTime">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="form.releaseTime"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
placeholder="选择发布时间">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="计划开始时间" prop="planBeginTime">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="form.planBeginTime"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
placeholder="选择计划开始时间">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="计划结束时间" prop="planEndTime">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="form.planEndTime"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
placeholder="选择计划结束时间">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="开始时间" prop="realBeginTime">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="form.realBeginTime"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
placeholder="选择开始时间">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="完成时间" prop="realEndTime">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="form.realEndTime"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
placeholder="选择完成时间">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="库存锁定标识" prop="stockLockFlag">
|
|
|
|
|
<el-input v-model="form.stockLockFlag" placeholder="请输入库存锁定标识"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
|
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="前置生产工单ID" prop="preOrderId">
|
|
|
|
|
<treeselect v-model="form.preOrderId" :options="productOrderOptions" :normalizer="normalizer"
|
|
|
|
|
placeholder="请选择前置生产工单ID"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
allListProductOrder,
|
|
|
|
|
getProductOrder,
|
|
|
|
|
delProductOrder,
|
|
|
|
|
addProductOrder,
|
|
|
|
|
updateProductOrder, batchEditingProductOrder
|
|
|
|
|
} from "@/api/mes/productOrder";
|
|
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
|
import {parseTime} from "@/utils/ruoyi";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "ProductionScheduling",
|
|
|
|
|
dicts: ['active_flag', 'plan_status', 'dispatch_type', 'mes_sale_type'],
|
|
|
|
|
components: {
|
|
|
|
|
Treeselect
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
|
|
|
|
// 显示搜索条件
|
|
|
|
|
showSearch: true,
|
|
|
|
|
// 生产工单;生产工单表格数据
|
|
|
|
|
productOrderList: [],
|
|
|
|
|
// 生产工单;生产工单树选项
|
|
|
|
|
productOrderOptions: [],
|
|
|
|
|
// 弹出层标题
|
|
|
|
|
title: "",
|
|
|
|
|
// 是否显示弹出层
|
|
|
|
|
open: false,
|
|
|
|
|
// 是否展开,默认全部展开
|
|
|
|
|
isExpandAll: true,
|
|
|
|
|
// 重新渲染表格状态
|
|
|
|
|
refreshTable: true,
|
|
|
|
|
// 查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
orderCode: null,
|
|
|
|
|
saleOrderId: null,
|
|
|
|
|
saleOrderFlag: null,
|
|
|
|
|
saleorderCode: null,
|
|
|
|
|
saleorderLinenumber: null,
|
|
|
|
|
projectNo: null,
|
|
|
|
|
saleType: null,
|
|
|
|
|
materialId: null,
|
|
|
|
|
materialBomId: null,
|
|
|
|
|
dispatchType: null,
|
|
|
|
|
dispatchId: null,
|
|
|
|
|
saleAmount: null,
|
|
|
|
|
planDeliveryDate: null,
|
|
|
|
|
planAmount: null,
|
|
|
|
|
dispatchAmount: null,
|
|
|
|
|
completeAmount: null,
|
|
|
|
|
releaseTime: null,
|
|
|
|
|
planBeginTime: null,
|
|
|
|
|
planEndTime: null,
|
|
|
|
|
realBeginTime: null,
|
|
|
|
|
realEndTime: null,
|
|
|
|
|
orderStatus: null,
|
|
|
|
|
stockLockFlag: null,
|
|
|
|
|
preOrderId: null
|
|
|
|
|
},
|
|
|
|
|
// 表单参数
|
|
|
|
|
form: {},
|
|
|
|
|
arrangeType: 1,
|
|
|
|
|
arrangeTypeList: [
|
|
|
|
|
{label: '手动安排', value: 0},
|
|
|
|
|
{label: '自动安排', value: 1}
|
|
|
|
|
],
|
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
|
|
|
|
orderCode: [
|
|
|
|
|
{required: true, message: "工单编号不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
saleOrderFlag: [
|
|
|
|
|
{required: true, message: "销售订单标识不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
saleType: [
|
|
|
|
|
{required: true, message: "销售类型不能为空", trigger: "change"}
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
columns: [
|
|
|
|
|
{key: 0, label: `主键标识`, visible: false},
|
|
|
|
|
{key: 1, label: `工单编号`, visible: true},
|
|
|
|
|
{key: 2, label: `销售订单ID`, visible: false},
|
|
|
|
|
{key: 3, label: `销售订单标识`, visible: false},
|
|
|
|
|
{key: 4, label: `销售订单编号`, visible: true},
|
|
|
|
|
{key: 5, label: `销售订单行号`, visible: false},
|
|
|
|
|
{key: 6, label: `项目编号`, visible: false},
|
|
|
|
|
{key: 7, label: `销售类型`, visible: true},
|
|
|
|
|
{key: 8, label: `物料ID`, visible: false},
|
|
|
|
|
{key: 9, label: `物料bomID`, visible: false},
|
|
|
|
|
{key: 10, label: `派工类型`, visible: false},
|
|
|
|
|
{key: 11, label: `派工ID`, visible: false},
|
|
|
|
|
{key: 12, label: `销售数量`, visible: true},
|
|
|
|
|
{key: 13, label: `计划交货日期`, visible: false},
|
|
|
|
|
{key: 14, label: `计划数量`, visible: true},
|
|
|
|
|
{key: 15, label: `已派工数量`, visible: true},
|
|
|
|
|
{key: 16, label: `完成数量`, visible: true},
|
|
|
|
|
{key: 17, label: `发布时间`, visible: false},
|
|
|
|
|
{key: 18, label: `计划开始时间`, visible: true},
|
|
|
|
|
{key: 19, label: `计划结束时间`, visible: true},
|
|
|
|
|
{key: 20, label: `开始时间`, visible: false},
|
|
|
|
|
{key: 21, label: `完成时间`, visible: false},
|
|
|
|
|
{key: 22, label: `工单状态`, visible: false},
|
|
|
|
|
{key: 23, label: `库存锁定标识`, visible: false},
|
|
|
|
|
{key: 24, label: `备注`, visible: false},
|
|
|
|
|
{key: 25, label: `创建人`, visible: false},
|
|
|
|
|
{key: 26, label: `创建时间`, visible: false},
|
|
|
|
|
{key: 27, label: `更新人`, visible: false},
|
|
|
|
|
{key: 28, label: `更新时间`, visible: false},
|
|
|
|
|
{key: 29, label: `前置生产工单ID`, visible: false},
|
|
|
|
|
{key: 30, label: `工期(天)`, visible: true},
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
const productOrderId = this.$route.params && this.$route.params.productOrderId;
|
|
|
|
|
if (productOrderId != null) {
|
|
|
|
|
this.queryParams.productOrderId = productOrderId;
|
|
|
|
|
}
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
productOrderList: {
|
|
|
|
|
handler(newVal) {
|
|
|
|
|
this.filteredList = this.extractFields(newVal);
|
|
|
|
|
},
|
|
|
|
|
deep: true,
|
|
|
|
|
immediate: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
/** 查询生产工单;生产工单列表 */
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
allListProductOrder(this.queryParams).then(response => {
|
|
|
|
|
this.productOrderList = this.handleTree(response.data, "productOrderId", "preOrderId");
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 转换生产工单;生产工单数据结构 */
|
|
|
|
|
normalizer(node) {
|
|
|
|
|
if (node.children && !node.children.length) {
|
|
|
|
|
delete node.children;
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
id: node.productOrderId,
|
|
|
|
|
label: node.orderCode,
|
|
|
|
|
children: node.children
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
/** 查询生产工单;生产工单下拉树结构 */
|
|
|
|
|
getTreeselect() {
|
|
|
|
|
allListProductOrder().then(response => {
|
|
|
|
|
this.productOrderOptions = [];
|
|
|
|
|
const data = {productOrderId: 0, orderCode: '顶级节点', children: []};
|
|
|
|
|
data.children = this.handleTree(response.data, "productOrderId", "preOrderId");
|
|
|
|
|
this.productOrderOptions.push(data);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 取消按钮
|
|
|
|
|
cancel() {
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.reset();
|
|
|
|
|
},
|
|
|
|
|
/** 关闭按钮 */
|
|
|
|
|
close() {
|
|
|
|
|
const obj = {path: "/mes/plan/productOrder", query: {t: Date.now(), queryParams: this.$route.query.queryParams}};
|
|
|
|
|
this.$tab.closeOpenPage(obj);
|
|
|
|
|
},
|
|
|
|
|
// 表单重置
|
|
|
|
|
reset() {
|
|
|
|
|
this.form = {
|
|
|
|
|
productOrderId: null,
|
|
|
|
|
orderCode: null,
|
|
|
|
|
saleOrderId: null,
|
|
|
|
|
saleOrderFlag: null,
|
|
|
|
|
saleorderCode: null,
|
|
|
|
|
saleorderLinenumber: null,
|
|
|
|
|
projectNo: null,
|
|
|
|
|
saleType: null,
|
|
|
|
|
materialId: null,
|
|
|
|
|
materialBomId: null,
|
|
|
|
|
dispatchType: null,
|
|
|
|
|
dispatchId: null,
|
|
|
|
|
saleAmount: null,
|
|
|
|
|
planDeliveryDate: null,
|
|
|
|
|
planAmount: null,
|
|
|
|
|
dispatchAmount: null,
|
|
|
|
|
completeAmount: null,
|
|
|
|
|
releaseTime: null,
|
|
|
|
|
planBeginTime: null,
|
|
|
|
|
planEndTime: null,
|
|
|
|
|
realBeginTime: null,
|
|
|
|
|
realEndTime: null,
|
|
|
|
|
orderStatus: null,
|
|
|
|
|
stockLockFlag: null,
|
|
|
|
|
remark: null,
|
|
|
|
|
createBy: null,
|
|
|
|
|
createTime: null,
|
|
|
|
|
updateBy: null,
|
|
|
|
|
updateTime: null,
|
|
|
|
|
preOrderId: null
|
|
|
|
|
};
|
|
|
|
|
this.resetForm("form");
|
|
|
|
|
},
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
resetQuery() {
|
|
|
|
|
this.resetForm("queryForm");
|
|
|
|
|
this.handleQuery();
|
|
|
|
|
},
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
handleAdd(row) {
|
|
|
|
|
this.reset();
|
|
|
|
|
this.getTreeselect();
|
|
|
|
|
if (row != null && row.productOrderId) {
|
|
|
|
|
this.form.preOrderId = row.productOrderId;
|
|
|
|
|
} else {
|
|
|
|
|
this.form.preOrderId = 0;
|
|
|
|
|
}
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "添加生产工单";
|
|
|
|
|
},
|
|
|
|
|
/** 保存按钮操作 */
|
|
|
|
|
handleSave() {
|
|
|
|
|
const extractedData = this.extractFields(this.productOrderList);
|
|
|
|
|
batchEditingProductOrder(extractedData).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("批量保存成功");
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
extractFields(data) {
|
|
|
|
|
let result = [];
|
|
|
|
|
data.forEach(item => {
|
|
|
|
|
const {productOrderId, planBeginTime, planEndTime, children} = item;
|
|
|
|
|
result.push({productOrderId, planBeginTime, planEndTime});
|
|
|
|
|
if (planBeginTime != null && planEndTime != null) {
|
|
|
|
|
item.duration = this.calculateDaysDifference(planBeginTime, planEndTime);
|
|
|
|
|
}
|
|
|
|
|
if (this.arrangeType === 1 && planEndTime != null && children != null) {
|
|
|
|
|
const date = new Date(planEndTime);
|
|
|
|
|
date.setDate(date.getDate() + 1);
|
|
|
|
|
children.forEach(item => {
|
|
|
|
|
item.planBeginTime = parseTime(date);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if (children) {
|
|
|
|
|
result = result.concat(this.extractFields(children));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
},
|
|
|
|
|
//计算两个时间相减得出的天数
|
|
|
|
|
calculateDaysDifference(date1, date2) {
|
|
|
|
|
// 将字符串转换为日期对象
|
|
|
|
|
const dateObj1 = new Date(date1);
|
|
|
|
|
const dateObj2 = new Date(date2);
|
|
|
|
|
// 计算时间差,得到毫秒数
|
|
|
|
|
const timeDifference = dateObj2 - dateObj1;
|
|
|
|
|
return (timeDifference / (1000 * 60 * 60 * 24)).toFixed(2);
|
|
|
|
|
},
|
|
|
|
|
/** 展开/折叠操作 */
|
|
|
|
|
toggleExpandAll() {
|
|
|
|
|
this.refreshTable = false;
|
|
|
|
|
this.isExpandAll = !this.isExpandAll;
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.refreshTable = true;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
|
handleUpdate(row) {
|
|
|
|
|
this.reset();
|
|
|
|
|
this.getTreeselect();
|
|
|
|
|
if (row != null) {
|
|
|
|
|
this.form.preOrderId = row.productOrderId;
|
|
|
|
|
}
|
|
|
|
|
getProductOrder(row.productOrderId).then(response => {
|
|
|
|
|
this.form = response.data;
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "修改生产工单";
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (this.form.productOrderId != null) {
|
|
|
|
|
updateProductOrder(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
addProductOrder(this.form).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
|
|
this.open = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
this.$modal.confirm('是否确认删除生产工单;生产工单编号为"' + row.productOrderId + '"的数据项?').then(function () {
|
|
|
|
|
return delProductOrder(row.productOrderId);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|