|
|
@@ -35,19 +35,23 @@
|
|
|
</template>
|
|
|
|
|
|
|
|
|
- <template v-slot:formingNum="scope" >
|
|
|
- <el-form-item :prop="'surplusUnpack.' + scope.$index + '.formingNum'" :rules="[
|
|
|
+ <template v-slot:formingNum="scope">
|
|
|
+ <el-form-item v-if="formingNum != 0" :prop="'surplusUnpack.' + scope.$index + '.formingNum'" :rules="[
|
|
|
{
|
|
|
- required: true,
|
|
|
- message: '请输入要求成型数量',
|
|
|
- trigger: 'change'
|
|
|
- },
|
|
|
- {
|
|
|
- pattern: /^\d+(\.{0,1}\d+){0,1}$/ , message: '拆单数超过成型数量', trigger: ['blur', 'change']
|
|
|
- }
|
|
|
+ required: true,
|
|
|
+ message: '请输入要求成型数量',
|
|
|
+ trigger: 'change'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ pattern: /^\d+(\.{0,1}\d+){0,1}$/, message: '拆单数超过成型数量', trigger: ['blur', 'change']
|
|
|
+ }
|
|
|
]">
|
|
|
<el-input disabled v-model="formingNum" placeholder="请输入"></el-input>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
+ <el-form-item v-else>
|
|
|
+ 工单已全部拆完
|
|
|
+ </el-form-item>
|
|
|
</template>
|
|
|
|
|
|
|
|
|
@@ -96,7 +100,7 @@
|
|
|
message: '请输入要求成型数量',
|
|
|
trigger: 'change'
|
|
|
}">
|
|
|
- <el-input-number type="number" @change="changeNum(scope.$index)" :min="0" v-model="scope.row.formingNum"
|
|
|
+ <el-input-number type="number" @change="changeNum(scope.$index)" :min="0" v-model="scope.row.formingNum"
|
|
|
placeholder="请输入"></el-input-number>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
@@ -130,6 +134,20 @@
|
|
|
</template>
|
|
|
|
|
|
|
|
|
+ <template v-slot:action="{ $index }">
|
|
|
+ <el-popconfirm class="ele-action" title="确定要删除此子单吗?" @confirm="remove($index)">
|
|
|
+ <template v-slot:reference>
|
|
|
+ <el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
+
|
|
|
+
|
|
|
+ </template>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
</ele-pro-table>
|
|
|
|
|
|
|
|
|
@@ -178,7 +196,7 @@ export default {
|
|
|
|
|
|
columns: [
|
|
|
{
|
|
|
- prop: 'code',
|
|
|
+ prop: 'originalCode',
|
|
|
label: '工单号',
|
|
|
align: 'center',
|
|
|
minWidth: 200
|
|
|
@@ -209,7 +227,7 @@ export default {
|
|
|
|
|
|
columns2: [
|
|
|
{
|
|
|
- prop: 'code',
|
|
|
+ prop: 'originalCode',
|
|
|
label: '工单号',
|
|
|
align: 'center',
|
|
|
minWidth: 200
|
|
|
@@ -266,33 +284,40 @@ export default {
|
|
|
},
|
|
|
|
|
|
setSurplus() {
|
|
|
- this.form.surplusUnpack.push({ code: this.formData.code, formingNum: this.formData.formingNum, planStartTime: '', teamId: '' })
|
|
|
+ this.form.surplusUnpack.push({ originalCode: this.formData.code, formingNum: this.formData.formingNum, planStartTime: '', teamId: '' })
|
|
|
},
|
|
|
|
|
|
openUnpack() {
|
|
|
- this.form.unpackList.push({ code: this.formData.code, formingNum: '', planStartTime: '', teamId: '' })
|
|
|
+ this.form.unpackList.push({ originalCode: this.formData.code, formingNum: '', planStartTime: '', teamId: '' })
|
|
|
},
|
|
|
|
|
|
changeNum(index) {
|
|
|
- console.log(index)
|
|
|
- let num = this.formData.formingNum
|
|
|
+ let num = this.formData.formingNum
|
|
|
this.form.unpackList.forEach((e) => {
|
|
|
- if(e.formingNum != null && e.formingNum != undefined) {
|
|
|
- num = num - Number(e.formingNum)
|
|
|
- if(num >= 0) {
|
|
|
+ if (e.formingNum != null && e.formingNum != undefined) {
|
|
|
+ num = num - Number(e.formingNum)
|
|
|
+ if (num >= 0) {
|
|
|
this.formingNum = num
|
|
|
} else {
|
|
|
-
|
|
|
- this.$set(this.form.unpackList[index], 'formingNum', 0)
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$set(this.form.unpackList[index], 'formingNum', 0)
|
|
|
+ })
|
|
|
this.$message.error('拆单数超过成型数量')
|
|
|
- this.$forceUpdate()
|
|
|
- return
|
|
|
+
|
|
|
+ return
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ remove(index) {
|
|
|
+ this.form.unpackList.splice(index, 1);
|
|
|
+ this.changeNum(index)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
getteampage() {
|
|
|
getteampage().then((res) => {
|
|
|
this.teamList = res.list;
|
|
|
@@ -308,18 +333,38 @@ export default {
|
|
|
this.$refs.form.resetFields();
|
|
|
},
|
|
|
confirm() {
|
|
|
- console.log(this.form)
|
|
|
+
|
|
|
|
|
|
this.$refs.form.validate(async (value) => {
|
|
|
if (value) {
|
|
|
- const params = {
|
|
|
+ if (this.form.unpackList.length == 1 && this.form.unpackList[0].formingNum == this.formData.formingNum) {
|
|
|
+ this.$message.info('拆单数要大于1')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.form.surplusUnpack.length == 1 && this.form.unpackList.length == 0) {
|
|
|
+ this.$message.info('拆单数要大于1')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- originalCode: this.formData.code
|
|
|
+ let params = []
|
|
|
+ if (this.formingNum != 0) {
|
|
|
+ this.form.surplusUnpack[0].formingNum = this.formingNum
|
|
|
+ params = [...this.form.unpackList, ...this.form.surplusUnpack]
|
|
|
+ } else {
|
|
|
+ params = this.form.unpackList
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
const res = await splitWork(params);
|
|
|
- this.$message.success('拆分成功!');
|
|
|
- this.$emit('success');
|
|
|
- this.cancel();
|
|
|
+ if (res) {
|
|
|
+ this.$message.success('拆分成功!');
|
|
|
+ this.$emit('success');
|
|
|
+ this.cancel();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
}
|