DN单号去除逻辑重写

master
zhoulei 4 years ago
parent 9886807e5b
commit 64a2f1bf24

@ -3,7 +3,7 @@
<!-- 头部 --> <!-- 头部 -->
<view class="header" :style="{ backgroundColor: `rgba(23, 83, 234, ${scrollTop / 100})` }"> <view class="header" :style="{ backgroundColor: `rgba(23, 83, 234, ${scrollTop / 100})` }">
<view class="left"> <view class="left">
<u-icon class="icon" name="arrow-left" @click="uni.navigateBack()" /> <u-icon class="icon" name="arrow-left" @click="uni.navigateBack({})" />
</view> </view>
<view class="title">{{ $t('message.dn_ReceivingGoods') }}</view> <view class="title">{{ $t('message.dn_ReceivingGoods') }}</view>
<view class="right"></view> <view class="right"></view>
@ -23,7 +23,7 @@
<view class="Purchase-title"> <view class="Purchase-title">
<view class="Purchase"> <view class="Purchase">
<view>{{ $t('message.Purchase') }}</view> <view>{{ $t('message.Purchase') }}</view>
<jPicker sureColor="#ff0000" style="width: 260rpx" @bindpicker="poListChoice" showKey="value" valKey="value" :val="wlCode" class="search" :options="poList" /> <jPicker sureColor="#ff0000" style="width: 260rpx" @bindpicker="poListChoice" showKey="value" valKey="value" :val="poNo" class="search" :options="poList" />
</view> </view>
</view> </view>
<!-- 物料 --> <!-- 物料 -->
@ -74,9 +74,7 @@
<u-td class="u-td">{{ item.wlCode }}</u-td> <u-td class="u-td">{{ item.wlCode }}</u-td>
<u-td class="u-td">{{ item.receiptAmount }}</u-td> <u-td class="u-td">{{ item.receiptAmount }}</u-td>
<u-td class="u-td"> <u-td class="u-td">
<div class="u-td" @click="deleteItem(index)"> <div class="u-td" @click="deleteItem(index)">{{ $t('message.product_Delete') }}</div>
{{ $t('message.product_Delete') }}
</div>
</u-td> </u-td>
</u-tr> </u-tr>
</u-table> </u-table>
@ -98,11 +96,10 @@
</view> </view>
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Ref } from 'vue-property-decorator'; import { Component } from 'vue-property-decorator';
import { BasePage } from '@/components/base/page'; import { BasePage } from '@/components/base/page';
import jPicker from '@/components/J-Picker/jPicker.vue'; import jPicker from '@/components/J-Picker/jPicker.vue';
import { session } from '@/store/modules/session'; import { session } from '@/store/modules/session';
import { VForm, VFormRules } from 'vue/types/form';
import model from './model'; import model from './model';
@Component({ @Component({
components: { components: {
@ -133,6 +130,8 @@ export default class dnReceiptDom extends BasePage {
LocationList: any = []; LocationList: any = [];
// //
wlCode: any = ''; wlCode: any = '';
//
poNo: any = '';
// //
upload: any = []; upload: any = [];
// //
@ -171,40 +170,41 @@ export default class dnReceiptDom extends BasePage {
let list: any = localStorage.getItem('list'); let list: any = localStorage.getItem('list');
localStorage.removeItem('list'); localStorage.removeItem('list');
this.material = JSON.parse(list); this.material = JSON.parse(list);
this.poList = [...this.material]; this.poList = [...this.material]; //
let temp = {}; let arr = this.removeDuplicates(this.poList);
let arr = []; //
arr = this.poList.reduce(function (item, next) {
temp[next.poNo] ? '' : (temp[next.poNo] = true && item.push(next));
return item;
}, []);
console.log('arr>>>', arr);
arr.forEach((item: any) => { arr.forEach((item: any) => {
item.label = item.poNo; item.label = item.poNo;
item.value = item.poNo; item.value = item.poNo;
}); });
this.poList = arr; this.poList = arr;
} }
//
removeDuplicates(list) {
let temp = {};
let arr = [];
arr = list.reduce(function (item, next) {
temp[next.poNo] ? '' : (temp[next.poNo] = true && item.push(next));
return item;
}, []);
return arr;
}
// //
poListChoice(e: any) { poListChoice(e: any) {
console.log('选择采购单后触发的回调事件::', 'poListChoice:::', e); console.log('选择采购单后触发的回调事件::', 'poListChoice:::', e);
this.material.forEach((item: any) => { //
this.poNo = e.pickerName.value;
this.materialList = this.removeDuplicates(this.material);
this.materialList.forEach((item: any) => {
if (item.poNo == e.pickerName.value) { if (item.poNo == e.pickerName.value) {
let pickerName: any = {}; item.label = item.materialCode;
pickerName.label = item.materialCode; item.value = item.materialCode;
pickerName.value = item.materialCode;
this.materialList.push(pickerName);
} }
}); });
} }
// receiptAmount requestAmount // receiptAmount requestAmount
materialChoice(e: any) { materialChoice(e: any) {
this.material.forEach((item: any) => { this.every = e.pickerName;
if (item.materialCode == e.pickerName.value) {
this.every = item;
return;
}
});
} }
// //
LocationChoice(e: any) { LocationChoice(e: any) {
@ -234,7 +234,7 @@ export default class dnReceiptDom extends BasePage {
}); });
return; return;
} }
let isTrue: boolean = true; let isTrue = true;
if (this.sendSpotList.length != 0) { if (this.sendSpotList.length != 0) {
this.sendSpotList.forEach((item: any) => { this.sendSpotList.forEach((item: any) => {
if (this.wlCode.sendSpot != item) { if (this.wlCode.sendSpot != item) {
@ -306,7 +306,7 @@ export default class dnReceiptDom extends BasePage {
} }
// //
business() { business() {
let num: number = 0; let num = 0;
this.LocationList.forEach((item: any) => { this.LocationList.forEach((item: any) => {
num += parseFloat(item.receiptAmount); num += parseFloat(item.receiptAmount);
}); });

Loading…
Cancel
Save