diff --git a/src/pages/payrollFilesTable/index.tsx b/src/pages/payrollFilesTable/index.tsx index d47ac2c..dd02c76 100644 --- a/src/pages/payrollFilesTable/index.tsx +++ b/src/pages/payrollFilesTable/index.tsx @@ -1,7 +1,7 @@ import React, { FC, useEffect, useState } from "react"; import { Button, Dropdown, Menu, Space, Spin, Table, Typography } from "antd"; import { DownOutlined } from "@ant-design/icons"; -import { exceptStr, paginationFun } from "@/utils/common"; +import { convertColumns, exceptStr, paginationFun } from "@/utils/common"; import styles from "@/pages/atdTable/components/index.less"; import { defaultPage, IPage } from "@/common/types"; import cs from "classnames"; @@ -158,7 +158,7 @@ const payrollFilesTable: FC = (props) => { } }; } - return { ...item }; + return _.omitBy({ ...item }, item => !item); })); setShowSumrow(showSum); setSumRow(_.isEmpty(countResult) ? { [new Date().getTime()]: new Date().getTime() } : countResult); @@ -202,13 +202,14 @@ const payrollFilesTable: FC = (props) => { ); } }; + return { { sumRow.loading ? : - _.map([{},...totalColumns], (item, index) => { + _.map([{}, ...totalColumns], (item, index) => { if (index === 0) { return 总计; diff --git a/src/utils/common.js b/src/utils/common.js index 13c0b0e..be7dc7c 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -49,6 +49,15 @@ export const getPicSuffix = () => { return config.get("picSuffix"); }; +/** + * 数组中某项移至数组末尾 + * @returns {array} + */ +export const convertColumns = (array, fromIndex, toIndex) => { + array.splice(toIndex, 1, array.splice(fromIndex, 1)[0]); + return array; +}; + /** * 判断是否为JSON字符串 * @returns {string} @@ -76,8 +85,8 @@ export const paginationFun = (tableListPageObj, sizeChange, onChange) => { onChange({ pageNum: page, size, - total, + total }); - }, + } }; };