From 344e94814141fc9da75af350f777ede7f3c132cd Mon Sep 17 00:00:00 2001 From: liushaozhen <804199994@qq.com> Date: Wed, 8 Jul 2020 14:52:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8E=92=E5=BA=8F=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E6=96=B0=E5=A2=9Edata=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/lib/sort.js | 4 ++-- build/lib/sum.js | 4 +++- src/lib/sort.js | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build/lib/sort.js b/build/lib/sort.js index e4b53d3..991c36d 100644 --- a/build/lib/sort.js +++ b/build/lib/sort.js @@ -292,7 +292,7 @@ function sort(Table, Icon) { } else { data = oldData.concat(); } - typeof sort.sortFun === "function" && sort.sortFun(sortCol, data); + typeof sort.sortFun === "function" && sort.sortFun(sortCol, data, oldData); } } else { seleObj = flatColumns.find(function (da) { @@ -310,7 +310,7 @@ function sort(Table, Icon) { sort.sortFun(sortCol); } else { data = _this3.multiSort(flatColumns); - typeof sort.sortFun === "function" && sort.sortFun(sortCol, data); + typeof sort.sortFun === "function" && sort.sortFun(sortCol, data, oldData); } } _this3.setState({ data: data, oldData: oldData, flatColumns: flatColumns }); diff --git a/build/lib/sum.js b/build/lib/sum.js index 713364e..5351612 100644 --- a/build/lib/sum.js +++ b/build/lib/sum.js @@ -25,6 +25,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } function sum(Table) { + var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; + return function (_React$Component) { _inherits(SumTable, _React$Component); @@ -91,7 +93,7 @@ function sum(Table) { count += _num; } }); - sumdata[column.dataIndex] = (0, _utils.DicimalFormater)(count, 2); + sumdata[column.dataIndex] = (0, _utils.DicimalFormater)(count, precision); } if (index == 0) { sumdata[column.dataIndex] = "合计 " + sumdata[column.dataIndex]; diff --git a/src/lib/sort.js b/src/lib/sort.js index 6979d2f..4b2b3ad 100644 --- a/src/lib/sort.js +++ b/src/lib/sort.js @@ -195,7 +195,7 @@ export default function sort(Table, Icon) { } else { data = oldData.concat(); } - typeof sort.sortFun === "function" && sort.sortFun(sortCol,data); + typeof sort.sortFun === "function" && sort.sortFun(sortCol,data,oldData); } } else { seleObj = flatColumns.find(da => da.key == column.key); @@ -211,7 +211,7 @@ export default function sort(Table, Icon) { sort.sortFun(sortCol); } else { data = this.multiSort(flatColumns); - typeof sort.sortFun === "function" && sort.sortFun(sortCol,data); + typeof sort.sortFun === "function" && sort.sortFun(sortCol,data,oldData); } } this.setState({ data, oldData, flatColumns });