原材料交接复选框

master
guoshuang 3 years ago
parent 22c6bcf2e1
commit ba93fe0939

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

@ -8,11 +8,11 @@
<view class="right"></view>
</view>
<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 class="bottom-bar">
<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-col :span="12">
<u-form-item prop="amount" :label="$t('message.Summary_Number')" label-width="120rpx">
@ -20,7 +20,7 @@
</u-form-item>
</u-col>
</u-row>
</u-form>
</u-form> -->
<u-form ref="submitForm" :model="submitForm" :error-type="['toast']">
<u-row class="bottom-info">
<u-col :span="6">
@ -38,17 +38,17 @@
</view>
<view class="container">
<u-row>
<u-col :span="4">
<u-col :span="6">
<u-button type="warning" @click="onSelectAll">
{{ $t('message.po_SelectAll') }}
</u-button>
</u-col>
<u-col :span="4">
<!-- <u-col :span="4">
<u-button type="primary" @click="onOk">
{{ $t('message.dn_Confirm') }}
</u-button>
</u-col>
<u-col :span="4">
</u-col> -->
<u-col :span="6">
<u-button type="success" @click="onSubmit">
{{ $t('message.po_Submit') }}
</u-button>
@ -137,7 +137,7 @@ export default class AggregatingOrder extends BasePage {
// onReadyonLoad
onReady() {
this.$amountForm.setRules(this.amountFormRules);
//this.$amountForm.setRules(this.amountFormRules);
this.$submitForm.setRules(this.submitFormRules);
this.isHandoverFinished = false;
}
@ -155,9 +155,26 @@ export default class AggregatingOrder extends BasePage {
model.checkAllOrderList(!model.isOrderCheckedAll);
}
clickIndex(e: any) {
this.spliceItem = e.data[0].lineData.orderOutId;
let num:any = parseFloat(e.data[0].lineData.totalMoAmount) - parseFloat(e.data[0].lineData.totalHvAmount)
this.amountForm.amount = num
console.log('ccccc', e.data);
// this.spliceItem = e.data[0].lineData.orderOutId;
// 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) => {
if (!valid) return;
const firstSelection = this.model.orderList.find((_) => _.checked);
@ -197,7 +214,7 @@ export default class AggregatingOrder extends BasePage {
});
}
});
}
}**/
onSubmit() {
this.$submitForm.validate(async (valid) => {
if (valid) {
@ -289,7 +306,7 @@ export default class AggregatingOrder extends BasePage {
// model.proOrderResultList.splice(index, 1);
// }
// });
this.$amountForm.setRules(this.amountFormRules);
//this.$amountForm.setRules(this.amountFormRules);
this.$submitForm.setRules(this.submitFormRules);
}
/**

@ -8,11 +8,11 @@
<view class="right"></view>
</view>
<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 class="bottom-bar">
<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-col :span="12">
<u-form-item prop="amount" :label="$t('message.Summary_Number')" label-width="120rpx">
@ -20,7 +20,7 @@
</u-form-item>
</u-col>
</u-row>
</u-form>
</u-form> -->
<u-form ref="submitForm" :model="submitForm" :error-type="['toast']">
<u-row class="bottom-info">
<u-col :span="6">
@ -38,17 +38,17 @@
</view>
<view class="container">
<u-row>
<u-col :span="4">
<u-col :span="6">
<u-button type="warning" @click="onSelectAll">
{{ $t('message.po_SelectAll') }}
</u-button>
</u-col>
<u-col :span="4">
<!-- <u-col :span="4">
<u-button type="primary" @click="onOk">
{{ $t('message.dn_Confirm') }}
</u-button>
</u-col>
<u-col :span="4">
</u-col> -->
<u-col :span="6">
<u-button type="success" @click="onSubmit">
{{ $t('message.po_Submit') }}
</u-button>
@ -137,12 +137,33 @@ export default class AggregatingSummary extends BasePage {
// onReadyonLoad
onReady() {
this.$amountForm.setRules(this.amountFormRules);
/**this.$amountForm.setRules(this.amountFormRules);**/
this.$submitForm.setRules(this.submitFormRules);
this.isBusinessFinished = false;
}
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() {
if (model.aggregateList.length > 0 && !this.isBusinessFinished) {
@ -171,30 +192,33 @@ export default class AggregatingSummary extends BasePage {
/**
* 确认
*/
onOk() {
this.$amountForm.validate((valid) => {
if (!valid) return;
const firstSelection = this.model.aggregateList.find((_) => _.checked);
if (firstSelection === undefined) {
this.customToast(this.$t('message.Pi_tip7') as string);
} else {
//
const currentPickNum = parseFloat(this.amountForm.amount);
//
const totalHvAmount = parseFloat(firstSelection.totalHvAmount);
//
const totalMoAmount = parseFloat(firstSelection.totalMoAmount);
if (currentPickNum != totalMoAmount) {
this.customToast(this.$t('message.Pi_tip12') as string);
return;
}
model.setAggregateListItemHvAmount({
index: this.model.aggregateList.findIndex((_) => _.checked),
hvAmount: currentPickNum,
});
}
});
}
// onOk() {
// this.$amountForm.validate((valid) => {
// if (!valid) return;
// const firstSelection = this.model.aggregateList.find((_) => _.checked);
// if (firstSelection === undefined) {
// this.customToast(this.$t('message.Pi_tip7') as string);
// } else {
// //
// const currentPickNum = parseFloat(this.amountForm.amount);
// //
// const totalHvAmount = parseFloat(firstSelection.totalHvAmount);
// //
// const totalMoAmount = parseFloat(firstSelection.totalMoAmount);
// //=
// // if (currentPickNum != totalMoAmount) {
// // this.customToast(this.$t('message.Pi_tip12') as string);
// // return;
// // }
// //
// 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);
return;
}
//
//totalMoAmount totalHvAmount hvAmount
List.forEach((item: any) => {
if (parseFloat(item.totalMoAmount) - parseFloat(item.totalHvAmount) != parseFloat(item.hvAmount)) {
isTrue = false;
@ -274,7 +300,7 @@ export default class AggregatingSummary extends BasePage {
});
}
async onAggregate() {
this.amountForm.amount = '';
/**this.amountForm.amount = '';**/
this.submitForm.receiver = '';
this.submitForm.receiverName = '';
this.submitForm.password = '';
@ -292,7 +318,7 @@ export default class AggregatingSummary extends BasePage {
// model.proOrderResultList.splice(index, 1);
// }
// });
this.$amountForm.setRules(this.amountFormRules);
/**this.$amountForm.setRules(this.amountFormRules);**/
this.$submitForm.setRules(this.submitFormRules);
}
/**

Loading…
Cancel
Save