Browse Source

合计

java8
han\hanst 3 months ago
parent
commit
42afc864d2
  1. 38
      src/views/modules/ecss/codelnotifyConfirm.vue
  2. 66
      src/views/modules/ecss/components/PackingDetailTab.vue

38
src/views/modules/ecss/codelnotifyConfirm.vue

@ -113,8 +113,8 @@
<el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="activeName" type="border-card" @tab-click="tabClick" >
<el-tab-pane :label="currentRow.cmcInvoice+'明细'" name="detail">
<el-table
:height="height"
:data="dataList2"
:height="height" ref="cloDetailTable"
:data="dataList2" show-summary :summary-method="getDetailSummaries"
border :cell-style="cellStyleDetail"
style="width: 100%;">
<el-table-column
@ -1864,7 +1864,7 @@
// PN
getPnIncompleteTooltip(row) {
const missingFields = [];
//
if (!(row.rollqty !== null && row.rollqty !== undefined && row.rollqty !== '')) {
missingFields.push('每卷数量');
@ -2670,7 +2670,37 @@
this.$nextTick(() => this.$refs.detailTable.doLayout());// ,
return sums;
},
getDetailSummaries(param) {
const { columns } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计';
return;
}
let sumDataList = this.dataList2.filter(item => item.qty>0);
const values = sumDataList.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
switch(column.property) {
case 'qty':
sums[index] = `${values.reduce((a, b) => a + b, 0)}`;
break;
case 'ttlAmount':
sums[index] = `${values.reduce((a, b) => a + b, 0).toFixed(2)}`;
break;
case 'sumPrice':
sums[index] = `${values.reduce((a, b) => a + b, 0).toFixed(2)}`;
break;
default:
sums[index] = '';
}
} else {
sums[index] = '';
}
});
this.$nextTick(() => this.$refs.cloDetailTable.doLayout());// ,
return sums;
},
/**
* 保存选中行到本地存储
* 使用页面路径和用户名作为存储键的一部分确保不同页面和用户的选择互不影响

66
src/views/modules/ecss/components/PackingDetailTab.vue

@ -2,13 +2,15 @@
<div class="packing-detail-tab">
<el-table
:data="dataListBoxes"
:max-height="height * 1.5"
:height="height"
border
v-loading="dataListLoading"
style="width: 100%;"
:expand-row-keys="expandedBoxRows"
:row-key="getBoxRowKey"
@expand-change="handleBoxExpand">
@expand-change="handleBoxExpand"
show-summary
:summary-method="getSummaries">
<el-table-column type="expand">
<template slot-scope="props">
<!-- 加载状态 -->
@ -724,6 +726,66 @@ export default {
}
})
});
},
//
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
// ""
sums[index] = '合计';
return;
}
const values = data.map(item => Number(item[column.property]));
//
if (column.property === 'box_qty') {
//
const sum = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + value;
} else {
return prev;
}
}, 0);
sums[index] = sum;
} else if (column.property === 'grossWeight') {
//
const sum = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + value;
} else {
return prev;
}
}, 0);
sums[index] = sum.toFixed(3);
} else if (column.property === 'netWeight') {
//
const sum = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + value;
} else {
return prev;
}
}, 0);
sums[index] = sum.toFixed(3);
} else if (column.property === 'item_no') {
//
sums[index] = '';
} else {
//
sums[index] = '';
}
});
return sums;
}
}
}

Loading…
Cancel
Save