泛微薪资核算iframe表格

custom-新弘农业/V2-薪资核算表格添加序号列
黎永顺 2 years ago
parent d1135f1be0
commit 81c648f5ab

@ -1,7 +1,7 @@
import React, { FC, useEffect, useState } from "react"; import React, { FC, useEffect, useState } from "react";
import { Button, Dropdown, Menu, Space, Spin, Table, Typography } from "antd"; import { Button, Dropdown, Menu, Space, Spin, Table, Typography } from "antd";
import { DownOutlined } from "@ant-design/icons"; 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 styles from "@/pages/atdTable/components/index.less";
import { defaultPage, IPage } from "@/common/types"; import { defaultPage, IPage } from "@/common/types";
import cs from "classnames"; import cs from "classnames";
@ -158,7 +158,7 @@ const payrollFilesTable: FC = (props) => {
} }
}; };
} }
return { ...item }; return _.omitBy({ ...item }, item => !item);
})); }));
setShowSumrow(showSum); setShowSumrow(showSum);
setSumRow(_.isEmpty(countResult) ? { [new Date().getTime()]: new Date().getTime() } : countResult); setSumRow(_.isEmpty(countResult) ? { [new Date().getTime()]: new Date().getTime() } : countResult);
@ -202,13 +202,14 @@ const payrollFilesTable: FC = (props) => {
); );
} }
}; };
return <Table return <Table
rowKey="id" rowKey="id"
className={cs({ className={cs({
[styles.tableWrapper]: true, [styles.tableWrapper]: true,
[styles.tableTotalWrapper]: true [styles.tableTotalWrapper]: true
})} })}
columns={columns} columns={!_.isEmpty(columns) && convertColumns(columns, _.findIndex(columns, ["dataIndex", "operate"]), Object.keys(columns).length)}
dataSource={dataSource} dataSource={dataSource}
size="small" size="small"
rowSelection={rowSelection} rowSelection={rowSelection}
@ -232,7 +233,7 @@ const payrollFilesTable: FC = (props) => {
<Table.Summary.Row> <Table.Summary.Row>
{ {
sumRow.loading ? <Spin tip="加载中"/> : sumRow.loading ? <Spin tip="加载中"/> :
_.map([{},...totalColumns], (item, index) => { _.map([{}, ...totalColumns], (item, index) => {
if (index === 0) { if (index === 0) {
return <Table.Summary.Cell index={0} key={index} align="center"><Text return <Table.Summary.Cell index={0} key={index} align="center"><Text
type="danger"></Text></Table.Summary.Cell>; type="danger"></Text></Table.Summary.Cell>;

@ -49,6 +49,15 @@ export const getPicSuffix = () => {
return config.get("picSuffix"); return config.get("picSuffix");
}; };
/**
* 数组中某项移至数组末尾
* @returns {array}
*/
export const convertColumns = (array, fromIndex, toIndex) => {
array.splice(toIndex, 1, array.splice(fromIndex, 1)[0]);
return array;
};
/** /**
* 判断是否为JSON字符串 * 判断是否为JSON字符串
* @returns {string} * @returns {string}
@ -76,8 +85,8 @@ export const paginationFun = (tableListPageObj, sizeChange, onChange) => {
onChange({ onChange({
pageNum: page, pageNum: page,
size, size,
total, total
}); });
}, }
}; };
}; };

Loading…
Cancel
Save