|
@@ -1,19 +1,11 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <ele-modal
|
|
|
|
|
- width="60vw"
|
|
|
|
|
- :visible.sync="visible"
|
|
|
|
|
- :close-on-click-modal="false"
|
|
|
|
|
- row-key="code"
|
|
|
|
|
- custom-class="ele-dialog-form"
|
|
|
|
|
- :title="'拆分计划'"
|
|
|
|
|
- :maxable="true"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <ele-modal width="60vw" :visible.sync="visible" :close-on-click-modal="false" row-key="code"
|
|
|
|
|
+ custom-class="ele-dialog-form" :title="'拆分计划'" :maxable="true">
|
|
|
<div class="form-wrapper">
|
|
<div class="form-wrapper">
|
|
|
<el-form :model="requestData" label-width="0" :show-message="false">
|
|
<el-form :model="requestData" label-width="0" :show-message="false">
|
|
|
<el-descriptions title="" :column="2" border>
|
|
<el-descriptions title="" :column="2" border>
|
|
|
<el-descriptions-item label="计划编号">
|
|
<el-descriptions-item label="计划编号">
|
|
|
- {{ formData.code }}</el-descriptions-item
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ {{ formData.code }}</el-descriptions-item>
|
|
|
|
|
|
|
|
<el-descriptions-item label="产品编码">{{
|
|
<el-descriptions-item label="产品编码">{{
|
|
|
formData.productCode
|
|
formData.productCode
|
|
@@ -24,8 +16,7 @@
|
|
|
}}</el-descriptions-item>
|
|
}}</el-descriptions-item>
|
|
|
|
|
|
|
|
<el-descriptions-item label="牌号|型号">
|
|
<el-descriptions-item label="牌号|型号">
|
|
|
- {{ formData.brandNo }}|{{ formData.model }}</el-descriptions-item
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ {{ formData.brandNo }}|{{ formData.model }}</el-descriptions-item>
|
|
|
|
|
|
|
|
<el-descriptions-item label="批次号">{{
|
|
<el-descriptions-item label="批次号">{{
|
|
|
formData.batchNo
|
|
formData.batchNo
|
|
@@ -46,29 +37,16 @@
|
|
|
|
|
|
|
|
<headerTitle title="剩余拆批" class="mt20"> </headerTitle>
|
|
<headerTitle title="剩余拆批" class="mt20"> </headerTitle>
|
|
|
<el-form ref="form" :model="form" :rules="rules">
|
|
<el-form ref="form" :model="form" :rules="rules">
|
|
|
- <ele-pro-table
|
|
|
|
|
- ref="table"
|
|
|
|
|
- :needPage="false"
|
|
|
|
|
- :columns="columns"
|
|
|
|
|
- :datasource="form.surplusUnpack"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <ele-pro-table ref="table" :needPage="false" :columns="columns" :datasource="form.surplusUnpack">
|
|
|
<template v-slot:toolbar>
|
|
<template v-slot:toolbar>
|
|
|
- <el-button
|
|
|
|
|
- size="small"
|
|
|
|
|
- type="primary"
|
|
|
|
|
- icon="el-icon-plus"
|
|
|
|
|
- class="ele-btn-icon"
|
|
|
|
|
- :disabled="requiredFormingNum == 0 ? true : false"
|
|
|
|
|
- @click="openUnpack"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon"
|
|
|
|
|
+ :disabled="requiredFormingNum == 0 ? true : false" @click="openUnpack">
|
|
|
拆批
|
|
拆批
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template v-slot:requiredFormingNum="scope">
|
|
<template v-slot:requiredFormingNum="scope">
|
|
|
- <el-form-item
|
|
|
|
|
- v-if="requiredFormingNum != 0"
|
|
|
|
|
- :prop="'surplusUnpack.' + scope.$index + '.requiredFormingNum'"
|
|
|
|
|
|
|
+ <el-form-item v-if="requiredFormingNum != 0" :prop="'surplusUnpack.' + scope.$index + '.requiredFormingNum'"
|
|
|
:rules="[
|
|
:rules="[
|
|
|
{
|
|
{
|
|
|
required: true,
|
|
required: true,
|
|
@@ -80,13 +58,8 @@
|
|
|
message: '拆批数超过生产数量',
|
|
message: '拆批数超过生产数量',
|
|
|
trigger: ['blur', 'change']
|
|
trigger: ['blur', 'change']
|
|
|
}
|
|
}
|
|
|
- ]"
|
|
|
|
|
- >
|
|
|
|
|
- <el-input
|
|
|
|
|
- disabled
|
|
|
|
|
- v-model="requiredFormingNum"
|
|
|
|
|
- placeholder="请输入"
|
|
|
|
|
- ></el-input>
|
|
|
|
|
|
|
+ ]">
|
|
|
|
|
+ <el-input disabled v-model="requiredFormingNum" placeholder="请输入"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item v-else> 工单已全部拆完 </el-form-item>
|
|
<el-form-item v-else> 工单已全部拆完 </el-form-item>
|
|
@@ -100,55 +73,36 @@
|
|
|
|
|
|
|
|
<headerTitle title="拆批" class="mt20"> </headerTitle>
|
|
<headerTitle title="拆批" class="mt20"> </headerTitle>
|
|
|
|
|
|
|
|
- <ele-pro-table
|
|
|
|
|
- ref="table"
|
|
|
|
|
- :needPage="false"
|
|
|
|
|
- :columns="columns2"
|
|
|
|
|
- :datasource="form.unpackList"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <ele-pro-table ref="table" :needPage="false" :columns="columns2" :datasource="form.unpackList">
|
|
|
<template v-slot:requiredFormingNum="scope">
|
|
<template v-slot:requiredFormingNum="scope">
|
|
|
- <el-form-item
|
|
|
|
|
- :prop="'unpackList.' + scope.$index + '.requiredFormingNum'"
|
|
|
|
|
- :rules="{
|
|
|
|
|
- required: true,
|
|
|
|
|
- message: '请输入要求生产数量',
|
|
|
|
|
- trigger: 'change'
|
|
|
|
|
- }"
|
|
|
|
|
- >
|
|
|
|
|
- <el-input-number
|
|
|
|
|
- type="number"
|
|
|
|
|
- @change="changeNum(scope.$index)"
|
|
|
|
|
- :min="0"
|
|
|
|
|
- v-model="scope.row.requiredFormingNum"
|
|
|
|
|
- placeholder="请输入"
|
|
|
|
|
- ></el-input-number>
|
|
|
|
|
|
|
+ <el-form-item :prop="'unpackList.' + scope.$index + '.requiredFormingNum'" :rules="{
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请输入要求生产数量',
|
|
|
|
|
+ trigger: 'change'
|
|
|
|
|
+ }">
|
|
|
|
|
+ <!-- @change="changeNum(scope.$index)" @input="(scope.$index)"-->
|
|
|
|
|
+ <!-- <el-input-number type="number" @input="inputNum" :min="0" :max="maxNum"
|
|
|
|
|
+ v-model="scope.row.requiredFormingNum" placeholder="请输入"></el-input-number> -->
|
|
|
|
|
+ <el-input v-model="scope.row.requiredFormingNum" type="number" @input="changeNum(scope.$index)" :min="0" placeholder="请输入内容"></el-input>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template v-slot:reqMoldTime="scope">
|
|
<template v-slot:reqMoldTime="scope">
|
|
|
- <el-form-item
|
|
|
|
|
- :prop="'unpackList.' + scope.$index + '.reqMoldTime'"
|
|
|
|
|
- :rules="{
|
|
|
|
|
- required: true,
|
|
|
|
|
- message: '请选择开始计划时间',
|
|
|
|
|
- trigger: 'change'
|
|
|
|
|
- }"
|
|
|
|
|
- >
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- class="w100"
|
|
|
|
|
- v-model="scope.row.reqMoldTime"
|
|
|
|
|
- type="date"
|
|
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
|
|
- ></el-date-picker>
|
|
|
|
|
|
|
+ <el-form-item :prop="'unpackList.' + scope.$index + '.reqMoldTime'" :rules="{
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请选择开始计划时间',
|
|
|
|
|
+ trigger: 'change'
|
|
|
|
|
+ }">
|
|
|
|
|
+ <!-- formData.reqMoldTime -->
|
|
|
|
|
+ <el-date-picker class="w100" v-model="scope.row.reqMoldTime" type="date" :picker-options="pickerOptions"
|
|
|
|
|
+ value-format="yyyy-MM-dd"></el-date-picker>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template v-slot:action="{ $index }">
|
|
<template v-slot:action="{ $index }">
|
|
|
- <el-popconfirm
|
|
|
|
|
- class="ele-action"
|
|
|
|
|
- title="确定要删除此子单吗?"
|
|
|
|
|
- @confirm="remove($index)"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <el-popconfirm class="ele-action" title="确定要删除此子单吗?" @confirm="remove($index)">
|
|
|
<template v-slot:reference>
|
|
<template v-slot:reference>
|
|
|
<el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
<el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
删除
|
|
删除
|
|
@@ -167,225 +121,240 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
- import { deepClone } from '@/utils';
|
|
|
|
|
- import { splitWork } from '@/api/productionPlan/index.js';
|
|
|
|
|
- export default {
|
|
|
|
|
- components: {},
|
|
|
|
|
- data() {
|
|
|
|
|
- return {
|
|
|
|
|
- visible: false,
|
|
|
|
|
-
|
|
|
|
|
- formData: {},
|
|
|
|
|
- requestData: {
|
|
|
|
|
- deviceCode: '',
|
|
|
|
|
- deviceName: '',
|
|
|
|
|
- deviceId: ''
|
|
|
|
|
|
|
+import { deepClone } from '@/utils';
|
|
|
|
|
+import { splitWork } from '@/api/productionPlan/index.js';
|
|
|
|
|
+export default {
|
|
|
|
|
+ components: {},
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+
|
|
|
|
|
+ formData: {},
|
|
|
|
|
+ requestData: {
|
|
|
|
|
+ deviceCode: '',
|
|
|
|
|
+ deviceName: '',
|
|
|
|
|
+ deviceId: ''
|
|
|
|
|
+ },
|
|
|
|
|
+ requiredFormingNum: 0,
|
|
|
|
|
+
|
|
|
|
|
+ pickerOptions: {
|
|
|
|
|
+ disabledDate: (time) => {
|
|
|
|
|
+ // 根据某个条件动态设置最大日期
|
|
|
|
|
+ if(this.formData.reqMoldTime){
|
|
|
|
|
+ const maxDate = new Date(this.formData.reqMoldTime); // 您的逻辑方法
|
|
|
|
|
+ return time.getTime() > maxDate.getTime();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ form: {
|
|
|
|
|
+ surplusUnpack: [],
|
|
|
|
|
+ unpackList: []
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ rules: {},
|
|
|
|
|
+
|
|
|
|
|
+ columns: [
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'batchNo',
|
|
|
|
|
+ label: '批次号',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ minWidth: 100,
|
|
|
|
|
+ showOverflowTooltip: true
|
|
|
},
|
|
},
|
|
|
- requiredFormingNum: 0,
|
|
|
|
|
|
|
|
|
|
- form: {
|
|
|
|
|
- surplusUnpack: [],
|
|
|
|
|
- unpackList: []
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'joinPlanCode',
|
|
|
|
|
+ label: '计划编号',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ minWidth: 200
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- rules: {},
|
|
|
|
|
-
|
|
|
|
|
- columns: [
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'batchNo',
|
|
|
|
|
- label: '批次号',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- minWidth: 100,
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'joinPlanCode',
|
|
|
|
|
- label: '计划编号',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- minWidth: 200
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'requiredFormingNum',
|
|
|
|
|
- label: '要求生产数量',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- slot: 'requiredFormingNum',
|
|
|
|
|
- minWidth: 200
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- ],
|
|
|
|
|
-
|
|
|
|
|
- columns2: [
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'batchNo',
|
|
|
|
|
- label: '批次号',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- minWidth: 100,
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'joinPlanCode',
|
|
|
|
|
- label: '计划编号',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- minWidth: 200
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'requiredFormingNum',
|
|
|
|
|
- label: '要求生产数量',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- slot: 'requiredFormingNum',
|
|
|
|
|
- minWidth: 200
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'reqMoldTime',
|
|
|
|
|
- label: '要求完成日期',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- slot: 'reqMoldTime',
|
|
|
|
|
- minWidth: 200
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- {
|
|
|
|
|
- columnKey: 'action',
|
|
|
|
|
- label: '操作',
|
|
|
|
|
- width: 160,
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- resizable: false,
|
|
|
|
|
- fixed: 'right',
|
|
|
|
|
- slot: 'action',
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- }
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'requiredFormingNum',
|
|
|
|
|
+ label: '要求生产数量',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ slot: 'requiredFormingNum',
|
|
|
|
|
+ minWidth: 200
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
|
|
+ ],
|
|
|
|
|
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
- methods: {
|
|
|
|
|
- open(row) {
|
|
|
|
|
- this.visible = true;
|
|
|
|
|
- this.formData = deepClone(row);
|
|
|
|
|
|
|
+ columns2: [
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'batchNo',
|
|
|
|
|
+ label: '批次号',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ minWidth: 100,
|
|
|
|
|
+ showOverflowTooltip: true
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'joinPlanCode',
|
|
|
|
|
+ label: '计划编号',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ minWidth: 200
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'requiredFormingNum',
|
|
|
|
|
+ label: '要求生产数量',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ slot: 'requiredFormingNum',
|
|
|
|
|
+ minWidth: 200
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'reqMoldTime',
|
|
|
|
|
+ label: '要求完成日期',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ slot: 'reqMoldTime',
|
|
|
|
|
+ minWidth: 200
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
- console.log(this.formData);
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ columnKey: 'action',
|
|
|
|
|
+ label: '操作',
|
|
|
|
|
+ width: 160,
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ resizable: false,
|
|
|
|
|
+ fixed: 'right',
|
|
|
|
|
+ slot: 'action',
|
|
|
|
|
+ showOverflowTooltip: true
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
|
|
|
- if (this.formData.splitBatch == 1) {
|
|
|
|
|
- this.columns[2].label = '剩余数量'
|
|
|
|
|
- this.requiredFormingNum = this.formData.splitResidue;
|
|
|
|
|
- } else {
|
|
|
|
|
- this.requiredFormingNum = this.formData.requiredFormingNum;
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ open(row) {
|
|
|
|
|
+ this.visible = true;
|
|
|
|
|
+ this.formData = deepClone(row);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ console.log(this.formData);
|
|
|
|
|
|
|
|
- this.form.surplusUnpack = [];
|
|
|
|
|
- this.form.unpackList = [];
|
|
|
|
|
- this.setSurplus();
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ if (this.formData.splitBatch == 1) {
|
|
|
|
|
+ this.columns[2].label = '剩余数量'
|
|
|
|
|
+ this.requiredFormingNum = this.formData.splitResidue;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.requiredFormingNum = this.formData.requiredFormingNum;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- setSurplus() {
|
|
|
|
|
- this.form.surplusUnpack.push({
|
|
|
|
|
- joinPlanCode: this.formData.code ,
|
|
|
|
|
- requiredFormingNum: this.formData.splitBatch == 1 ? this.formData.splitResidue : this.formData.requiredFormingNum,
|
|
|
|
|
- batchNo: this.formData.batchNo,
|
|
|
|
|
- isCopy: 1
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
|
|
|
|
|
- openUnpack() {
|
|
|
|
|
- this.form.unpackList.push({
|
|
|
|
|
- joinPlanCode: this.formData.code,
|
|
|
|
|
- batchNo: this.formData.batchNo,
|
|
|
|
|
- requiredFormingNum: '',
|
|
|
|
|
- reqMoldTime: ''
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
|
|
|
|
|
- changeNum(index) {
|
|
|
|
|
- let num = this.formData.splitBatch == 1 ? this.formData.splitResidue : this.formData.requiredFormingNum
|
|
|
|
|
- this.form.unpackList.forEach((e) => {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ this.form.surplusUnpack = [];
|
|
|
|
|
+ this.form.unpackList = [];
|
|
|
|
|
+ this.setSurplus();
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ setSurplus() {
|
|
|
|
|
+ this.form.surplusUnpack.push({
|
|
|
|
|
+ joinPlanCode: this.formData.code,
|
|
|
|
|
+ requiredFormingNum: this.formData.splitBatch == 1 ? this.formData.splitResidue : this.formData.requiredFormingNum,
|
|
|
|
|
+ batchNo: this.formData.batchNo,
|
|
|
|
|
+ isCopy: 1
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ openUnpack() {
|
|
|
|
|
+ this.form.unpackList.push({
|
|
|
|
|
+ joinPlanCode: this.formData.code,
|
|
|
|
|
+ batchNo: this.formData.batchNo,
|
|
|
|
|
+ requiredFormingNum: '',
|
|
|
|
|
+ reqMoldTime: ''
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ changeNum(index) {
|
|
|
|
|
+ console.log(index,'111111111111');
|
|
|
|
|
+
|
|
|
|
|
+ let num = this.formData.splitBatch == 1 ? this.formData.splitResidue : this.formData.requiredFormingNum
|
|
|
|
|
+ this.form.unpackList.forEach((e) => {
|
|
|
|
|
+ if (
|
|
|
|
|
+ e.requiredFormingNum != null &&
|
|
|
|
|
+ e.requiredFormingNum != undefined
|
|
|
|
|
+ ) {
|
|
|
|
|
+ num = num - Number(e.requiredFormingNum);
|
|
|
|
|
+ if (num >= 0) {
|
|
|
|
|
+ this.requiredFormingNum = num;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.$set(this.form.unpackList[index], 'requiredFormingNum', 0);
|
|
|
|
|
+ });
|
|
|
|
|
+ this.$message.error('拆批数超过生产数量');
|
|
|
|
|
+
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ remove(index) {
|
|
|
|
|
+ this.form.unpackList.splice(index, 1);
|
|
|
|
|
+ if (this.form.unpackList.length == 0) {
|
|
|
|
|
+ this.requiredFormingNum = this.formData.splitBatch == 1 ? this.formData.splitResidue : this.formData.requiredFormingNum
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.changeNum(index);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ cancel() {
|
|
|
|
|
+ this.formData = {};
|
|
|
|
|
+ this.visible = false;
|
|
|
|
|
+ this.$refs.form.resetFields();
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ confirm() {
|
|
|
|
|
+ this.$refs.form.validate(async (value) => {
|
|
|
|
|
+ if (value) {
|
|
|
if (
|
|
if (
|
|
|
- e.requiredFormingNum != null &&
|
|
|
|
|
- e.requiredFormingNum != undefined
|
|
|
|
|
|
|
+ this.form.unpackList.length == 1 &&
|
|
|
|
|
+ this.form.unpackList[0].requiredFormingNum ==
|
|
|
|
|
+ this.formData.requiredFormingNum
|
|
|
) {
|
|
) {
|
|
|
- num = num - Number(e.requiredFormingNum);
|
|
|
|
|
- if (num >= 0) {
|
|
|
|
|
- this.requiredFormingNum = num;
|
|
|
|
|
- } else {
|
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
|
- this.$set(this.form.unpackList[index], 'requiredFormingNum', 0);
|
|
|
|
|
- });
|
|
|
|
|
- this.$message.error('拆批数超过生产数量');
|
|
|
|
|
-
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.$message.info('拆批数要大于1');
|
|
|
|
|
+ return false;
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
|
|
|
|
|
- remove(index) {
|
|
|
|
|
- this.form.unpackList.splice(index, 1);
|
|
|
|
|
- if (this.form.unpackList.length == 0) {
|
|
|
|
|
- this.requiredFormingNum = this.formData.splitBatch == 1 ? this.formData.splitResidue : this.formData.requiredFormingNum
|
|
|
|
|
- } else {
|
|
|
|
|
- this.changeNum(index);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ if (
|
|
|
|
|
+ this.form.surplusUnpack.length == 1 &&
|
|
|
|
|
+ this.form.unpackList.length == 0
|
|
|
|
|
+ ) {
|
|
|
|
|
+ this.$message.info('拆批数要大于1');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- cancel() {
|
|
|
|
|
- this.formData = {};
|
|
|
|
|
- this.visible = false;
|
|
|
|
|
- this.$refs.form.resetFields();
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ let params = [];
|
|
|
|
|
+ if (this.requiredFormingNum != 0) {
|
|
|
|
|
+ this.form.surplusUnpack[0].requiredFormingNum =
|
|
|
|
|
+ this.requiredFormingNum;
|
|
|
|
|
+ params = [...this.form.unpackList, ...this.form.surplusUnpack];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ params = this.form.unpackList;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- confirm() {
|
|
|
|
|
- this.$refs.form.validate(async (value) => {
|
|
|
|
|
- if (value) {
|
|
|
|
|
- if (
|
|
|
|
|
- this.form.unpackList.length == 1 &&
|
|
|
|
|
- this.form.unpackList[0].requiredFormingNum ==
|
|
|
|
|
- this.formData.requiredFormingNum
|
|
|
|
|
- ) {
|
|
|
|
|
- this.$message.info('拆批数要大于1');
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (
|
|
|
|
|
- this.form.surplusUnpack.length == 1 &&
|
|
|
|
|
- this.form.unpackList.length == 0
|
|
|
|
|
- ) {
|
|
|
|
|
- this.$message.info('拆批数要大于1');
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- let params = [];
|
|
|
|
|
- if (this.requiredFormingNum != 0) {
|
|
|
|
|
- this.form.surplusUnpack[0].requiredFormingNum =
|
|
|
|
|
- this.requiredFormingNum;
|
|
|
|
|
- params = [...this.form.unpackList, ...this.form.surplusUnpack];
|
|
|
|
|
- } else {
|
|
|
|
|
- params = this.form.unpackList;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const res = await splitWork(params);
|
|
|
|
|
-
|
|
|
|
|
- if (res) {
|
|
|
|
|
- this.$message.success('拆分成功!');
|
|
|
|
|
- this.$emit('success');
|
|
|
|
|
- this.cancel();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const res = await splitWork(params);
|
|
|
|
|
+
|
|
|
|
|
+ if (res) {
|
|
|
|
|
+ this.$message.success('拆分成功!');
|
|
|
|
|
+ this.$emit('success');
|
|
|
|
|
+ this.cancel();
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
- .mt20 {
|
|
|
|
|
- margin-top: 20px;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+.mt20 {
|
|
|
|
|
+ margin-top: 20px;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- .el-form-item {
|
|
|
|
|
- margin-bottom: 0 !important;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+.el-form-item {
|
|
|
|
|
+ margin-bottom: 0 !important;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|