原材料交接复选框

master
guoshuang 3 years ago
parent 22c6bcf2e1
commit ba93fe0939

@ -94,6 +94,11 @@ export class AggregatingModule extends VuexModule {
checkAllAggregateList(checked: boolean) { checkAllAggregateList(checked: boolean) {
this.aggregateList = this.aggregateList.map((item: any) => { this.aggregateList = this.aggregateList.map((item: any) => {
item.checked = checked; item.checked = checked;
if (item.checked) {
item.hvAmount = item.totalMoAmount - item.totalHvAmount;
} else {
item.hvAmount = 0;
}
return item; return item;
}); });
} }
@ -115,8 +120,13 @@ export class AggregatingModule extends VuexModule {
setAggregateListItemHvAmount({ index, hvAmount }: { index: number; hvAmount: number }) { setAggregateListItemHvAmount({ index, hvAmount }: { index: number; hvAmount: number }) {
const original = this.aggregateList[index]; const original = this.aggregateList[index];
const newItem = { ...original, hvAmount }; const newItem = { ...original, hvAmount };
// this.aggregateList.splice(index, 1, newItem);
this.aggregateList[index].hvAmount = hvAmount; this.aggregateList[index].hvAmount = hvAmount;
// this.aggregateList.splice(index, 1, newItem);
// if (this.aggregateList[index].checked) {
// this.aggregateList[index].hvAmount = this.aggregateList[index].totalMoAmount - this.aggregateList[index].totalHvAmount;
// } else {
// this.aggregateList[index].hvAmount = 0;
// }
} }
/** /**
@ -130,13 +140,14 @@ export class AggregatingModule extends VuexModule {
// this.orderList.splice(index, 1, newItem); // this.orderList.splice(index, 1, newItem);
this.orderList[index].hvAmount = hvAmount; this.orderList[index].hvAmount = hvAmount;
} }
// setOrderListItemHvAmount(params: { hvAmount: number }) { // setOrderListItemHvAmount() {
// this.orderList // this.orderList
// .filter((_: any) => _.checked) // .filter((_: any) => _.checked)
// .forEach((item: any) => { // .forEach((item: any) => {
// if (params.hvAmount) { // item.hvAmount = item.totalMoAmount - item.totalHvAmount;
// item.currentAmount = params.hvAmount; // // if (params.hvAmount) {
// } // // item.currentAmount = params.hvAmount;
// // }
// }); // });
// } // }
@ -176,6 +187,11 @@ export class AggregatingModule extends VuexModule {
checkAllOrderList(checked: boolean) { checkAllOrderList(checked: boolean) {
this.orderList = this.orderList.map((item: any) => { this.orderList = this.orderList.map((item: any) => {
item.checked = checked; item.checked = checked;
if (item.checked) {
item.hvAmount = item.totalMoAmount - item.totalHvAmount;
} else {
item.hvAmount = 0;
}
return item; return item;
}); });
} }

@ -8,11 +8,11 @@
<view class="right"></view> <view class="right"></view>
</view> </view>
<view class="table-wrapper"> <view class="table-wrapper">
<wyb-table class="table" ref="table" width="100%" show-left-and-right-border enable-check="single" :headers="headers" @onCheck="clickIndex" :contents="model.orderList" :show-vert-border="false"></wyb-table> <wyb-table class="table" ref="table" width="100%" show-left-and-right-border enable-check="multiple" :headers="headers" @onCheck="clickIndex" :contents="model.orderList" :show-vert-border="false"></wyb-table>
</view> </view>
<view class="bottom-bar"> <view class="bottom-bar">
<view class="extra"> <view class="extra">
<u-form ref="amountForm" :model="amountForm" :error-type="['toast']"> <!-- <u-form ref="amountForm" :model="amountForm" :error-type="['toast']">
<u-row class="bottom-info"> <u-row class="bottom-info">
<u-col :span="12"> <u-col :span="12">
<u-form-item prop="amount" :label="$t('message.Summary_Number')" label-width="120rpx"> <u-form-item prop="amount" :label="$t('message.Summary_Number')" label-width="120rpx">
@ -20,7 +20,7 @@
</u-form-item> </u-form-item>
</u-col> </u-col>
</u-row> </u-row>
</u-form> </u-form> -->
<u-form ref="submitForm" :model="submitForm" :error-type="['toast']"> <u-form ref="submitForm" :model="submitForm" :error-type="['toast']">
<u-row class="bottom-info"> <u-row class="bottom-info">
<u-col :span="6"> <u-col :span="6">
@ -38,17 +38,17 @@
</view> </view>
<view class="container"> <view class="container">
<u-row> <u-row>
<u-col :span="4"> <u-col :span="6">
<u-button type="warning" @click="onSelectAll"> <u-button type="warning" @click="onSelectAll">
{{ $t('message.po_SelectAll') }} {{ $t('message.po_SelectAll') }}
</u-button> </u-button>
</u-col> </u-col>
<u-col :span="4"> <!-- <u-col :span="4">
<u-button type="primary" @click="onOk"> <u-button type="primary" @click="onOk">
{{ $t('message.dn_Confirm') }} {{ $t('message.dn_Confirm') }}
</u-button> </u-button>
</u-col> </u-col> -->
<u-col :span="4"> <u-col :span="6">
<u-button type="success" @click="onSubmit"> <u-button type="success" @click="onSubmit">
{{ $t('message.po_Submit') }} {{ $t('message.po_Submit') }}
</u-button> </u-button>
@ -137,7 +137,7 @@ export default class AggregatingOrder extends BasePage {
// onReadyonLoad // onReadyonLoad
onReady() { onReady() {
this.$amountForm.setRules(this.amountFormRules); //this.$amountForm.setRules(this.amountFormRules);
this.$submitForm.setRules(this.submitFormRules); this.$submitForm.setRules(this.submitFormRules);
this.isHandoverFinished = false; this.isHandoverFinished = false;
} }
@ -155,9 +155,26 @@ export default class AggregatingOrder extends BasePage {
model.checkAllOrderList(!model.isOrderCheckedAll); model.checkAllOrderList(!model.isOrderCheckedAll);
} }
clickIndex(e: any) { clickIndex(e: any) {
this.spliceItem = e.data[0].lineData.orderOutId; console.log('ccccc', e.data);
let num:any = parseFloat(e.data[0].lineData.totalMoAmount) - parseFloat(e.data[0].lineData.totalHvAmount) // this.spliceItem = e.data[0].lineData.orderOutId;
this.amountForm.amount = num // let num:any = parseFloat(e.data[0].lineData.totalMoAmount) - parseFloat(e.data[0].lineData.totalHvAmount)
// this.amountForm.amount = num
//
e.data.forEach((item, index) => {
//debugger;
console.log('xuanzedeindex', e.data);
console.log('hvmount', item.lineData.totalMoAmount - item.lineData.totalHvAmount);
model.setOrderListItemHvAmount({
index: e.data[index].index,
hvAmount: item.lineData.totalMoAmount - item.lineData.totalHvAmount,
});
});
this.model.orderList.forEach((item) => {
if (item.checked == false) {
item.hvAmount = 0;
}
});
console.log('/////////', this.model.orderList);
} }
/** /**
* 接收人确认 * 接收人确认
@ -174,7 +191,7 @@ export default class AggregatingOrder extends BasePage {
/** /**
* 确认 * 确认
*/ */
onOk() { /**onOk() {
this.$amountForm.validate((valid) => { this.$amountForm.validate((valid) => {
if (!valid) return; if (!valid) return;
const firstSelection = this.model.orderList.find((_) => _.checked); const firstSelection = this.model.orderList.find((_) => _.checked);
@ -197,7 +214,7 @@ export default class AggregatingOrder extends BasePage {
}); });
} }
}); });
} }**/
onSubmit() { onSubmit() {
this.$submitForm.validate(async (valid) => { this.$submitForm.validate(async (valid) => {
if (valid) { if (valid) {
@ -289,7 +306,7 @@ export default class AggregatingOrder extends BasePage {
// model.proOrderResultList.splice(index, 1); // model.proOrderResultList.splice(index, 1);
// } // }
// }); // });
this.$amountForm.setRules(this.amountFormRules); //this.$amountForm.setRules(this.amountFormRules);
this.$submitForm.setRules(this.submitFormRules); this.$submitForm.setRules(this.submitFormRules);
} }
/** /**

@ -8,11 +8,11 @@
<view class="right"></view> <view class="right"></view>
</view> </view>
<view class="table-wrapper"> <view class="table-wrapper">
<wyb-table class="table" ref="table" width="100%" show-left-and-right-border enable-check="single" :headers="headers" @onCheck="clickIndex" :contents="model.aggregateList" :show-vert-border="false"></wyb-table> <wyb-table class="table" ref="table" width="100%" show-left-and-right-border enable-check="multiple" :headers="headers" @onCheck="clickIndex" :contents="model.aggregateList" :show-vert-border="false"></wyb-table>
</view> </view>
<view class="bottom-bar"> <view class="bottom-bar">
<view class="extra"> <view class="extra">
<u-form ref="amountForm" :model="amountForm" :error-type="['toast']"> <!-- <u-form ref="amountForm" :model="amountForm" :error-type="['toast']">
<u-row class="bottom-info"> <u-row class="bottom-info">
<u-col :span="12"> <u-col :span="12">
<u-form-item prop="amount" :label="$t('message.Summary_Number')" label-width="120rpx"> <u-form-item prop="amount" :label="$t('message.Summary_Number')" label-width="120rpx">
@ -20,7 +20,7 @@
</u-form-item> </u-form-item>
</u-col> </u-col>
</u-row> </u-row>
</u-form> </u-form> -->
<u-form ref="submitForm" :model="submitForm" :error-type="['toast']"> <u-form ref="submitForm" :model="submitForm" :error-type="['toast']">
<u-row class="bottom-info"> <u-row class="bottom-info">
<u-col :span="6"> <u-col :span="6">
@ -38,17 +38,17 @@
</view> </view>
<view class="container"> <view class="container">
<u-row> <u-row>
<u-col :span="4"> <u-col :span="6">
<u-button type="warning" @click="onSelectAll"> <u-button type="warning" @click="onSelectAll">
{{ $t('message.po_SelectAll') }} {{ $t('message.po_SelectAll') }}
</u-button> </u-button>
</u-col> </u-col>
<u-col :span="4"> <!-- <u-col :span="4">
<u-button type="primary" @click="onOk"> <u-button type="primary" @click="onOk">
{{ $t('message.dn_Confirm') }} {{ $t('message.dn_Confirm') }}
</u-button> </u-button>
</u-col> </u-col> -->
<u-col :span="4"> <u-col :span="6">
<u-button type="success" @click="onSubmit"> <u-button type="success" @click="onSubmit">
{{ $t('message.po_Submit') }} {{ $t('message.po_Submit') }}
</u-button> </u-button>
@ -137,12 +137,33 @@ export default class AggregatingSummary extends BasePage {
// onReadyonLoad // onReadyonLoad
onReady() { onReady() {
this.$amountForm.setRules(this.amountFormRules); /**this.$amountForm.setRules(this.amountFormRules);**/
this.$submitForm.setRules(this.submitFormRules); this.$submitForm.setRules(this.submitFormRules);
this.isBusinessFinished = false; this.isBusinessFinished = false;
} }
clickIndex(e: any) { clickIndex(e: any) {
this.spliceItem = e.data[0].lineData.materialCode; console.log('ccccc', e);
//this.spliceItem = e.data[0].lineData.materialCode;
//
// model.setAggregateListItemHvAmount({
// index: this.model.aggregateList.findIndex((_) => _.checked),
// hvAmount: 0,
// });
e.data.forEach((item, index) => {
//debugger;
console.log('xuanzedeindex', e.data);
console.log('hvmount', item.lineData.totalMoAmount - item.lineData.totalHvAmount);
model.setAggregateListItemHvAmount({
index: e.data[index].index,
hvAmount: item.lineData.totalMoAmount - item.lineData.totalHvAmount,
});
});
this.model.aggregateList.forEach((item) => {
if (item.checked == false) {
item.hvAmount = 0;
}
});
console.log('/////////', this.model.aggregateList);
} }
beforeDestroy() { beforeDestroy() {
if (model.aggregateList.length > 0 && !this.isBusinessFinished) { if (model.aggregateList.length > 0 && !this.isBusinessFinished) {
@ -171,30 +192,33 @@ export default class AggregatingSummary extends BasePage {
/** /**
* 确认 * 确认
*/ */
onOk() { // onOk() {
this.$amountForm.validate((valid) => { // this.$amountForm.validate((valid) => {
if (!valid) return; // if (!valid) return;
const firstSelection = this.model.aggregateList.find((_) => _.checked); // const firstSelection = this.model.aggregateList.find((_) => _.checked);
if (firstSelection === undefined) { // if (firstSelection === undefined) {
this.customToast(this.$t('message.Pi_tip7') as string); // this.customToast(this.$t('message.Pi_tip7') as string);
} else { // } else {
// // //
const currentPickNum = parseFloat(this.amountForm.amount); // const currentPickNum = parseFloat(this.amountForm.amount);
// // //
const totalHvAmount = parseFloat(firstSelection.totalHvAmount); // const totalHvAmount = parseFloat(firstSelection.totalHvAmount);
// // //
const totalMoAmount = parseFloat(firstSelection.totalMoAmount); // const totalMoAmount = parseFloat(firstSelection.totalMoAmount);
if (currentPickNum != totalMoAmount) { // //=
this.customToast(this.$t('message.Pi_tip12') as string); // // if (currentPickNum != totalMoAmount) {
return; // // this.customToast(this.$t('message.Pi_tip12') as string);
} // // return;
model.setAggregateListItemHvAmount({ // // }
index: this.model.aggregateList.findIndex((_) => _.checked), // //
hvAmount: currentPickNum, // model.setAggregateListItemHvAmount({
}); // index: this.model.aggregateList.findIndex((_) => _.checked),
} // //hvAmount: currentPickNum,
}); // hvAmount: totalMoAmount - totalHvAmount,
} // });
// }
// });
// }
/** /**
* 上传 * 上传
@ -241,6 +265,8 @@ export default class AggregatingSummary extends BasePage {
this.customToast(this.$t('message.Pi_tip13') as string); this.customToast(this.$t('message.Pi_tip13') as string);
return; return;
} }
//
//totalMoAmount totalHvAmount hvAmount
List.forEach((item: any) => { List.forEach((item: any) => {
if (parseFloat(item.totalMoAmount) - parseFloat(item.totalHvAmount) != parseFloat(item.hvAmount)) { if (parseFloat(item.totalMoAmount) - parseFloat(item.totalHvAmount) != parseFloat(item.hvAmount)) {
isTrue = false; isTrue = false;
@ -274,7 +300,7 @@ export default class AggregatingSummary extends BasePage {
}); });
} }
async onAggregate() { async onAggregate() {
this.amountForm.amount = ''; /**this.amountForm.amount = '';**/
this.submitForm.receiver = ''; this.submitForm.receiver = '';
this.submitForm.receiverName = ''; this.submitForm.receiverName = '';
this.submitForm.password = ''; this.submitForm.password = '';
@ -292,7 +318,7 @@ export default class AggregatingSummary extends BasePage {
// model.proOrderResultList.splice(index, 1); // model.proOrderResultList.splice(index, 1);
// } // }
// }); // });
this.$amountForm.setRules(this.amountFormRules); /**this.$amountForm.setRules(this.amountFormRules);**/
this.$submitForm.setRules(this.submitFormRules); this.$submitForm.setRules(this.submitFormRules);
} }
/** /**

Loading…
Cancel
Save