|
|
|
@ -54,6 +54,16 @@
|
|
|
|
|
>关闭
|
|
|
|
|
</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>
|
|
|
|
|
|
|
|
|
@ -86,7 +96,7 @@
|
|
|
|
|
<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" v-if="columns[15].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">
|
|
|
|
@ -98,6 +108,7 @@
|
|
|
|
|
<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;"
|
|
|
|
@ -274,6 +285,7 @@ import {
|
|
|
|
|
} 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",
|
|
|
|
@ -328,6 +340,11 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
// 表单参数
|
|
|
|
|
form: {},
|
|
|
|
|
arrangeType: 1,
|
|
|
|
|
arrangeTypeList: [
|
|
|
|
|
{label: '手动安排', value: 0},
|
|
|
|
|
{label: '自动安排', value: 1}
|
|
|
|
|
],
|
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
|
|
|
|
orderCode: [
|
|
|
|
@ -371,16 +388,26 @@ export default {
|
|
|
|
|
{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){
|
|
|
|
|
if (productOrderId != null) {
|
|
|
|
|
this.queryParams.productOrderId = productOrderId;
|
|
|
|
|
}
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
productOrderList: {
|
|
|
|
|
handler(newVal) {
|
|
|
|
|
this.filteredList = this.extractFields(newVal);
|
|
|
|
|
},
|
|
|
|
|
deep: true,
|
|
|
|
|
immediate: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
/** 查询生产工单;生产工单列表 */
|
|
|
|
|
getList() {
|
|
|
|
@ -488,14 +515,33 @@ export default {
|
|
|
|
|
extractFields(data) {
|
|
|
|
|
let result = [];
|
|
|
|
|
data.forEach(item => {
|
|
|
|
|
const { productOrderId, planBeginTime, planEndTime, children } = item;
|
|
|
|
|
result.push({ productOrderId, planBeginTime, planEndTime });
|
|
|
|
|
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){
|
|
|
|
|
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);
|
|
|
|
|
},
|
|
|
|
|
/** 展开/折叠操作 */
|
|
|
|
|
toggleExpandAll() {
|
|
|
|
|
this.refreshTable = false;
|
|
|
|
|