From 81c648f5ab126383a39dff1e42617ed2b569124c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 20 Jun 2023 16:47:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=9B=E5=BE=AE=E8=96=AA=E8=B5=84=E6=A0=B8?= =?UTF-8?q?=E7=AE=97iframe=E8=A1=A8=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/payrollFilesTable/index.tsx | 9 +++++---- src/utils/common.js | 13 +++++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) 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 }); - }, + } }; };