From ad51d995bd3fb835415cb21493b5182659cb8aba Mon Sep 17 00:00:00 2001 From: hou <1601990943@qq.com> Date: Sat, 22 Jan 2022 17:54:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A7=94=E5=A4=96=E5=87=BA=E5=BA=93=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/raw/commission/entrant/index.vue | 14 ++- src/pages/raw/commission/goOut/config.ts | 18 ++++ src/pages/raw/commission/goOut/index.vue | 104 ++++++++++----------- 3 files changed, 80 insertions(+), 56 deletions(-) diff --git a/src/pages/raw/commission/entrant/index.vue b/src/pages/raw/commission/entrant/index.vue index 70c9321..c80a24d 100644 --- a/src/pages/raw/commission/entrant/index.vue +++ b/src/pages/raw/commission/entrant/index.vue @@ -36,11 +36,11 @@ {{ $t('message.CommissionedDemandData') }} - + - {{ $t('message.CommissionedCumulativeData') }} - + {{ $t('message.Cumulative') }} + @@ -312,6 +312,9 @@ export default class dnReceiptDom extends BasePage { width: 100rpx; line-height: 100rpx; } + .search{ + padding-left: 19px; + } } } .material { @@ -364,6 +367,7 @@ export default class dnReceiptDom extends BasePage { width: 120rpx; height: 100%; line-height: 100rpx; + text-align: center; } .input { width: 100rpx; @@ -386,7 +390,8 @@ export default class dnReceiptDom extends BasePage { line-height: 100rpx; } .search { - text-align: center; + padding-left: 19px; + text-align: left; } } .library-right { @@ -397,6 +402,7 @@ export default class dnReceiptDom extends BasePage { width: 120rpx; height: 100%; line-height: 100rpx; + text-align: center; } .input { width: 200rpx; diff --git a/src/pages/raw/commission/goOut/config.ts b/src/pages/raw/commission/goOut/config.ts index 6bc67c2..00022da 100644 --- a/src/pages/raw/commission/goOut/config.ts +++ b/src/pages/raw/commission/goOut/config.ts @@ -38,3 +38,21 @@ export const headers = [ width: 200, }, ]; + +export const detailHeader = [ + { + label: vm.$t('message.po_MaterielNo'), + key: 'materialCode', + width: 301, + }, + { + label: vm.$t('message.CommissionedLocation'), + key: 'wlCode', + width: 186, + }, + { + label: vm.$t('message.product_Number'), + key: 'nowAmount', + width: 186, + }, +]; diff --git a/src/pages/raw/commission/goOut/index.vue b/src/pages/raw/commission/goOut/index.vue index 5d27540..3e99fcc 100644 --- a/src/pages/raw/commission/goOut/index.vue +++ b/src/pages/raw/commission/goOut/index.vue @@ -36,11 +36,11 @@ {{ $t('message.CommissionedDemandData') }} - + - {{ $t('message.CommissionedCumulativeData') }} - + {{ $t('message.Cumulative') }} + @@ -59,20 +59,7 @@ {{ $t('message.product_add') }} - - - {{ $t('message.product_Location') }} - {{ $t('message.product_Number') }} - {{ $t('message.operation') }} - - - {{ item.wlCode }} - {{ item.nowAmount }} - - {{ $t('message.product_Delete') }} - - - + @@ -95,7 +82,7 @@ import { Component, Ref } from 'vue-property-decorator'; import { BasePage } from '@/components/base/page'; import jPicker from '@/components/J-Picker/jPicker.vue'; import { session } from '@/store/modules/session'; -import { VForm, VFormRules } from 'vue/types/form'; +import { detailHeader } from './config'; import model from './model'; @Component({ components: { @@ -104,6 +91,7 @@ import model from './model'; }) export default class dnReceiptDom extends BasePage { model = model; + detailHeader = detailHeader form: any = { documentNo: '', }; @@ -119,6 +107,7 @@ export default class dnReceiptDom extends BasePage { Location: any = []; //所选择的库位 wlCode: any = ''; + materialIndex:any = null //页面初始化 async onReady() { //页面初始化 获取可选库位 @@ -171,13 +160,15 @@ export default class dnReceiptDom extends BasePage { this.materialList.push(pickerName); }); this.every = this.material[0]; - console.log('materialList????', this.materialList); + this.materialIndex = 0 } //选择物料后触发的回调事件 本次数量:receiptAmount 需求数量:requestAmount materialChoice(e: any) { - this.material.forEach((item: any) => { + this.nowAmount = '' + this.material.forEach((item: any,index:any) => { if (item.materialCode == e.pickerName.value) { this.every = item; + this.materialIndex = index return; } }); @@ -200,9 +191,11 @@ export default class dnReceiptDom extends BasePage { this.customToast(this.$t('message.Commission_tips3') as any); return; } - let num: number = parseFloat(this.nowAmount); + let num: number = parseFloat(this.nowAmount) + parseFloat(this.every.outAmount); this.list.forEach((item: any) => { - num += parseFloat(item.nowAmount); + if(item.materialCode == this.every.materialCode){ + num += parseFloat(item.nowAmount); + } }); if (num > parseFloat(this.every.orderAmount)) { uni.showModal({ @@ -221,8 +214,8 @@ export default class dnReceiptDom extends BasePage { nowAmount: this.nowAmount, }; this.list.push(arr); - console.log('this.list', this.list); - this.business(); + this.material[this.materialIndex].outAmount += parseFloat(this.list[this.list.length - 1].nowAmount) + this.nowAmount = '' } else if (res.cancel) { return; } @@ -230,34 +223,43 @@ export default class dnReceiptDom extends BasePage { }); } else { let arr = { - poNo: this.form.documentNo, - materialCode: this.every.materialCode, - loginName: this.session.loginName, - factoryCode: this.session.factoryCode, - wlCode: this.wlCode.label, - nowAmount: this.nowAmount, + poNo: this.form.documentNo, + materialCode: this.every.materialCode, + loginName: this.session.loginName, + factoryCode: this.session.factoryCode, + wlCode: this.wlCode.label, + nowAmount: this.nowAmount, }; this.list.push(arr); - console.log('this.list', this.list); - this.business(); + this.material[this.materialIndex].outAmount += parseFloat(this.list[this.list.length - 1].nowAmount) + this.nowAmount = '' } } - deleteItem(index: any) { - this.list.splice(index, 1); - console.log('this.list', this.list); - this.business(); + deleteItem(e: any) { + uni.showModal({ + content:this.$t('message.product_Delete') as any, + cancelText:this.$t('message.Cancel') as any, + confirmText:this.$t('message.workArea_Confirm') as any, + success:(res) =>{ + if(res.confirm){ + this.list.splice(e.contentIndex,1) + let i:any + this.material.forEach((item:any,index:any) =>{ + if(item.materialCode == e.lineData.materialCode){ + i = index + } + }) + this.material[i].outAmount -= parseFloat(e.lineData.nowAmount) + }else if(res.cancel){ + return + } + } + }) } async onSubmit() { if (this.list == null || this.list.length == 0) { this.customToast(this.$t('message.Commission_tips5') as any); } - // let upload = { - // poNo: this.form.documentNo, - // materialCode: this.every.materialCode, - // loginName: session.loginName, - // factoryCode: session.factoryCode, - // list: this.list, - // }; await this.model.submitOutsourcing(this.list); this.empty(); } @@ -275,14 +277,6 @@ export default class dnReceiptDom extends BasePage { await this.model.querydetaildlist(content); this.redirectTo(this.page.raw.commission.goOut.detail); } - //添加和删除操作的时候 计算累计收货数量 - business() { - let num = 0; - this.list.forEach((item: any) => { - num += parseFloat(item.nowAmount); - }); - this.every.outAmount += num; - } }