|
@@ -1159,7 +1159,7 @@
|
|
|
:summary-method="getSum"
|
|
|
@selection-change="handleSelectionChange_s"
|
|
|
>
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column type="selection" width="58" align="center" />
|
|
|
<el-table-column
|
|
|
label="序号"
|
|
|
type="index"
|
|
@@ -2966,9 +2966,9 @@ export default {
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
|
const value = Number(curr);
|
|
|
if (!isNaN(value)) {
|
|
|
- return prev + curr;
|
|
|
+ return (Number(prev) + Number(curr)).toSuperFixed(2);
|
|
|
} else {
|
|
|
- return prev;
|
|
|
+ return Number(prev).toSuperFixed(2);
|
|
|
}
|
|
|
}, 0);
|
|
|
}
|
|
@@ -3631,38 +3631,40 @@ export default {
|
|
|
const { columns, data } = param;
|
|
|
const sums = [];
|
|
|
columns.forEach((column, index) => {
|
|
|
- if (this.selection.length == 0) {
|
|
|
- if (index === 0) {
|
|
|
- sums[index] = "合计";
|
|
|
- } else if (column.label == "金额" || column.label == "本次金额") {
|
|
|
- const values = data.map((item) => Number(item[column.property]));
|
|
|
- if (!values.every((value) => isNaN(value))) {
|
|
|
- sums[index] = values.reduce((prev, curr) => {
|
|
|
- const value = Number(curr);
|
|
|
- if (!isNaN(value)) {
|
|
|
- return (prev + curr).toSuperFixed(2);
|
|
|
- } else {
|
|
|
- return prev.toSuperFixed(2);
|
|
|
- }
|
|
|
- }, 0);
|
|
|
+ if (columns.length > 0) {
|
|
|
+ if (this.selection.length == 0) {
|
|
|
+ if (index === 0) {
|
|
|
+ sums[index] = "合计";
|
|
|
+ } else if (column.label == "金额" || column.label == "本次金额") {
|
|
|
+ const values = data.map((item) => Number(item[column.property]));
|
|
|
+ if (!values.every((value) => isNaN(value))) {
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return (Number(prev) + Number(curr)).toSuperFixed(2);
|
|
|
+ } else {
|
|
|
+ return Number(prev).toSuperFixed(2);
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (index === 0) {
|
|
|
- sums[index] = "合计";
|
|
|
- } else if (column.label == "金额" || column.label == "本次金额") {
|
|
|
- const values = this.selection.map((selection) =>
|
|
|
- Number(selection[column.property])
|
|
|
- );
|
|
|
- if (!values.every((value) => isNaN(value))) {
|
|
|
- sums[index] = values.reduce((prev, curr) => {
|
|
|
- const value = Number(curr);
|
|
|
- if (!isNaN(value)) {
|
|
|
- return (prev + curr).toSuperFixed(2);
|
|
|
- } else {
|
|
|
- return prev.toSuperFixed(2);
|
|
|
- }
|
|
|
- }, 0);
|
|
|
+ } else {
|
|
|
+ if (index === 0) {
|
|
|
+ sums[index] = "合计";
|
|
|
+ } else if (column.label == "金额" || column.label == "本次金额") {
|
|
|
+ const values = this.selection.map((selection) =>
|
|
|
+ Number(selection[column.property])
|
|
|
+ );
|
|
|
+ if (!values.every((value) => isNaN(value))) {
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return (Number(prev) + Number(curr)).toSuperFixed(2);
|
|
|
+ } else {
|
|
|
+ return Number(prev).toSuperFixed(2);
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|