Merge branch 'master' into feature/V2-系统多语言

# Conflicts:
#	src/pages/reportTable/index.tsx
feature/V2-系统多语言
黎永顺 2 years ago
commit 295099950f

@ -47,11 +47,67 @@
<li class="dib"><span>Symbol</span></li>
</ul>
<a href="https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=4257468" target="_blank" class="nav-more">查看项目</a>
</div>
<div class="tab-container">
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe603;</span>
<div class="name">全部</div>
<div class="code-name">&amp;#xe603;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe649;</span>
<div class="name">批量导出</div>
<div class="code-name">&amp;#xe649;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe622;</span>
<div class="name">批量删除</div>
<div class="code-name">&amp;#xe622;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe645;</span>
<div class="name">批量操作</div>
<div class="code-name">&amp;#xe645;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe636;</span>
<div class="name">导出</div>
<div class="code-name">&amp;#xe636;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe619;</span>
<div class="name">批量分配</div>
<div class="code-name">&amp;#xe619;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe724;</span>
<div class="name">操作日志</div>
<div class="code-name">&amp;#xe724;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6aa;</span>
<div class="name">警告</div>
<div class="code-name">&amp;#xe6aa;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe70c;</span>
<div class="name">应急处理</div>
<div class="code-name">&amp;#xe70c;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe652;</span>
<div class="name">批量解锁</div>
@ -82,7 +138,9 @@
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.ttf?t=1695032721128') format('truetype');
src: url('iconfont.woff2?t=1698914262517') format('woff2'),
url('iconfont.woff?t=1698914262517') format('woff'),
url('iconfont.ttf?t=1698914262517') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@ -108,6 +166,87 @@
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-quanbu"></span>
<div class="name">
全部
</div>
<div class="code-name">.icon-quanbu
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-piliangdaochu"></span>
<div class="name">
批量导出
</div>
<div class="code-name">.icon-piliangdaochu
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-piliangshanchu"></span>
<div class="name">
批量删除
</div>
<div class="code-name">.icon-piliangshanchu
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-piliangcaozuo"></span>
<div class="name">
批量操作
</div>
<div class="code-name">.icon-piliangcaozuo
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-daochu"></span>
<div class="name">
导出
</div>
<div class="code-name">.icon-daochu
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-piliangfenpei"></span>
<div class="name">
批量分配
</div>
<div class="code-name">.icon-piliangfenpei
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-caozuorizhi32"></span>
<div class="name">
操作日志
</div>
<div class="code-name">.icon-caozuorizhi32
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-jinggao"></span>
<div class="name">
警告
</div>
<div class="code-name">.icon-jinggao
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-yingjichuli"></span>
<div class="name">
应急处理
</div>
<div class="code-name">.icon-yingjichuli
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-piliangjiesuo"></span>
<div class="name">
@ -153,6 +292,78 @@
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-quanbu"></use>
</svg>
<div class="name">全部</div>
<div class="code-name">#icon-quanbu</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-piliangdaochu"></use>
</svg>
<div class="name">批量导出</div>
<div class="code-name">#icon-piliangdaochu</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-piliangshanchu"></use>
</svg>
<div class="name">批量删除</div>
<div class="code-name">#icon-piliangshanchu</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-piliangcaozuo"></use>
</svg>
<div class="name">批量操作</div>
<div class="code-name">#icon-piliangcaozuo</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-daochu"></use>
</svg>
<div class="name">导出</div>
<div class="code-name">#icon-daochu</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-piliangfenpei"></use>
</svg>
<div class="name">批量分配</div>
<div class="code-name">#icon-piliangfenpei</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-caozuorizhi32"></use>
</svg>
<div class="name">操作日志</div>
<div class="code-name">#icon-caozuorizhi32</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-jinggao"></use>
</svg>
<div class="name">警告</div>
<div class="code-name">#icon-jinggao</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-yingjichuli"></use>
</svg>
<div class="name">应急处理</div>
<div class="code-name">#icon-yingjichuli</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-piliangjiesuo"></use>

@ -1,6 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id */
src: url('iconfont.ttf?t=1695032721128') format('truetype');
font-family: "iconfont"; /* Project id 4257468 */
src: url('iconfont.woff2?t=1698914262517') format('woff2'),
url('iconfont.woff?t=1698914262517') format('woff'),
url('iconfont.ttf?t=1698914262517') format('truetype');
}
.iconfont {
@ -11,6 +13,42 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-quanbu:before {
content: "\e603";
}
.icon-piliangdaochu:before {
content: "\e649";
}
.icon-piliangshanchu:before {
content: "\e622";
}
.icon-piliangcaozuo:before {
content: "\e645";
}
.icon-daochu:before {
content: "\e636";
}
.icon-piliangfenpei:before {
content: "\e619";
}
.icon-caozuorizhi32:before {
content: "\e724";
}
.icon-jinggao:before {
content: "\e6aa";
}
.icon-yingjichuli:before {
content: "\e70c";
}
.icon-piliangjiesuo:before {
content: "\e652";
}

File diff suppressed because one or more lines are too long

@ -1,10 +1,73 @@
{
"id": "",
"name": "",
"id": "4257468",
"name": "weaver-salary",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "5925304",
"name": "全部",
"font_class": "quanbu",
"unicode": "e603",
"unicode_decimal": 58883
},
{
"icon_id": "6447192",
"name": "批量导出",
"font_class": "piliangdaochu",
"unicode": "e649",
"unicode_decimal": 58953
},
{
"icon_id": "20422590",
"name": "批量删除",
"font_class": "piliangshanchu",
"unicode": "e622",
"unicode_decimal": 58914
},
{
"icon_id": "22378766",
"name": "批量操作",
"font_class": "piliangcaozuo",
"unicode": "e645",
"unicode_decimal": 58949
},
{
"icon_id": "24848378",
"name": "导出",
"font_class": "daochu",
"unicode": "e636",
"unicode_decimal": 58934
},
{
"icon_id": "35054680",
"name": "批量分配",
"font_class": "piliangfenpei",
"unicode": "e619",
"unicode_decimal": 58905
},
{
"icon_id": "763145",
"name": "操作日志",
"font_class": "caozuorizhi32",
"unicode": "e724",
"unicode_decimal": 59172
},
{
"icon_id": "947139",
"name": "警告",
"font_class": "jinggao",
"unicode": "e6aa",
"unicode_decimal": 59050
},
{
"icon_id": "4551216",
"name": "应急处理",
"font_class": "yingjichuli",
"unicode": "e70c",
"unicode_decimal": 59148
},
{
"icon_id": "16043851",
"name": "批量解锁",

Binary file not shown.

Binary file not shown.

@ -76,6 +76,10 @@ class CalculateService extends BasicService {
getAcctResultsum = async (params: any) => {
return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sum`, params);
};
//社保合计行
getSyMixSum = async (params: any) => {
return this.post(`/api/bs/hrmsalary/siaccount/detail/list/syMixSum`, params);
};
}
const calculateService = new CalculateService();

@ -23,8 +23,9 @@ export default ({ children, style = {} }: any) => {
window.location.hash.indexOf("atdTable") !== -1 ||
window.location.hash.indexOf("standingbookTable") !== -1 ||
window.location.hash.indexOf("previewTable") !== -1 ||
window.location.hash.indexOf("calcTable") !== -1
) ? "#f6f6f6" : "#FFF",
window.location.hash.indexOf("calcTable") !== -1 ||
window.location.hash.indexOf("welfareArchiveTable") !== -1
) ? "rgb(241,241,241)" : "#FFF",
...style
}}
>

@ -13,8 +13,11 @@ module.exports = {
"/reportTable.*": "blank",
"/commonTable.*": "blank",
"/calcTable.*": "blank",
"/welfareLedgerTable.*": "blank",
"/payrollFilesTable.*": "blank",
"/employeeDeclareTable.*": "blank",
"/welfareArchiveTable.*": "blank",
"/OCTable.*": "blank",
"/manage.*": "manage",
"/portal.*": "template",
"/passport/oauth-in": "blank",

@ -13,7 +13,7 @@ const hrmSalaryUrl = "/spa/hrmSalary/hrmSalaryCalculateDetail/";
const Icon = createFromIconfontCN({
scriptUrl: [
// @ts-ignore
`${process.env.NODE_ENV === "dev" ? Util.getPublicPath() : hrmSalaryUrl}css/iconfont/iconfont.js`
`${process.env.NODE_ENV === "development" ? Util.getPublicPath() : hrmSalaryUrl}css/iconfont/iconfont.js`
]
});

@ -0,0 +1,115 @@
/*
* Author:
* name: -线
* Description:
* Date: 2023/11/28
*/
import React, { FC, useEffect, useState } from "react";
import { Table } from "antd";
import { exceptStr, paginationFun } from "@/utils/common";
import styles from "@/pages/atdTable/components/index.less";
import { defaultPage, IPage } from "@/common/types";
import cs from "classnames";
const OCTable: FC = (props) => {
const [columns, setColumns] = useState<Array<any>>([]);
const [pageInfo, setPageInfo] = useState<IPage>(defaultPage);
const [dataSource, setDataSource] = useState<Array<any>>([]);
const [i18n, setI18n] = useState<any>({});
useEffect(() => {
window.parent.postMessage({ type: "init" }, "*");
window.addEventListener("message", receiveMessageFromIndex, false);
return () => {
window.removeEventListener("message", receiveMessageFromIndex, false);
};
}, []);
const receiveMessageFromIndex = (event: any) => {
const data: any = exceptStr(event.data);
if (!_.isEmpty(data)) {
const { columns, dataSource, pageInfo, i18n: i18nRes = {} } = data;
const { current: pageNum, pageSize: size, total } = pageInfo;
setDataSource(dataSource);
setI18n(i18nRes);
setPageInfo({ pageNum, size, total });
setColumns(convertColumns(columns, i18nRes));
}
};
const convertColumns: any = (cols: any[], lanObj: any) => {
return _.map(cols, item => {
if (_.isNaN(parseInt(item.dataIndex))) {
return { ...item };
} else {
return {
...item, children: convertColumns(item.children, lanObj),
render: (__: any, record: any) => {
const formulaDesc = record["customParameters"][`${item["dataIndex"]}`];
const showDifference = record[`${item["dataIndex"]}_type`] === "number";
const { acctResultValue, excelResultValue } = record[item["dataIndex"]] || {};
return <div className={styles["comparison-column-item-container"]}
onClick={() => {
window.parent.postMessage(
{
type: "turn",
payload: { id: "FORMULA", params: { formulaDesc } }
},
"*"
);
}}>
<div className={styles["comparison-single-row"]}>
<span>{lanObj["系统值"]}</span>
<span>{acctResultValue}</span>
</div>
<div className={styles["comparison-single-row"]}>
<span>{lanObj["线下值"]}</span>
<span>{excelResultValue}</span>
</div>
{
showDifference &&
<div className={cs(styles["danger"], styles["comparison-single-row"])}>
<span>{lanObj["差值"]}</span>
<span>{calculateDifference(acctResultValue, excelResultValue)}</span>
</div>
}
</div>;
}
};
}
});
};
// 计算差值
const calculateDifference = (systemValue: string, excelValue: string) => {
if (_.isNil(systemValue) || _.isNil(excelValue)) return "";
const systemNum = Number(systemValue);
const excelNum = Number(excelValue);
return (systemNum - excelNum).toFixed(2);
};
const sizeChange = (pageobj: IPage) => {
};
const onChange = (pageobj: IPage) => {
const { pageNum, size: pageSize } = pageobj;
setPageInfo((prevState) => {
const { size } = prevState;
window.parent.postMessage(
{
type: "turn",
payload: { id: "PAGEINFO", params: { ...pageInfo, pageNum: size === pageSize ? pageNum : 1, size: pageSize } }
},
"*"
);
return { ...pageInfo, current: size === pageSize ? pageNum : 1, size: pageSize };
});
};
return <Table
rowKey="id" className={styles.tableWrapper}
columns={columns} dataSource={dataSource} bordered size="small"
scroll={{ x: 1200, y: `calc(100vh - 137px)` }}
pagination={{
...paginationFun(pageInfo, sizeChange, onChange, i18n),
size: "default"
}}
/>;
};
export default OCTable;

@ -153,7 +153,23 @@
}
}
.comparison-column-item-container {
cursor: pointer;
.comparison-single-row {
margin: 4px 0;
}
.danger {
color: #ff4d4f;
}
}
:global {
.ant-btn-link {
height: inherit !important;
}
.ant-btn-link, .ant-dropdown-trigger {
padding: 0;
font-size: 12px;
@ -288,6 +304,17 @@
}
:global {
.ant-dropdown-placement-bottomRight {
.ant-dropdown-menu {
max-height: inherit !important;
}
}
.ant-dropdown-menu-item {
font-size: 12px;
color: #333;
}
.rankMapWrapper {
.ant-table-thead > tr > th {
background: #ED7D31;

@ -72,7 +72,7 @@ const index: FunctionComponent<Props> = (props) => {
<span className={styles.contentSpan}>
<span title={text} className={styles.contentTitle}>{text}</span>
{
item.lockStatus === "LOCK" ? <LockOutlined title="锁定的项目值"/> : null
item.lockStatus === "LOCK" ? <LockOutlined title={i18n["锁定的项目值"]}/> : null
}
</span>
)

@ -65,7 +65,7 @@ const ReportTable: FC = (props) => {
if (!showSumrow) return;
let totalColumns: any[] = [];
_.forEach(columns, it => {
if (!it.children) {
if (_.isEmpty(it.children)) {
totalColumns.push(it);
} else {
totalColumns = [...totalColumns, ...it.children];
@ -75,11 +75,7 @@ const ReportTable: FC = (props) => {
<Table.Summary fixed>
<Table.Summary.Row>
{
_.map([{}, ...totalColumns], (item, index) => {
if (index === 0) {
return <Table.Summary.Cell index={0} key={index} align="center"><Text
type="danger">{i18n["总计"]}</Text></Table.Summary.Cell>;
}
_.map(totalColumns, (item, index) => {
return <Table.Summary.Cell index={index} key={index} align="center">
<Text type="danger">{!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"}</Text>
</Table.Summary.Cell>;

@ -0,0 +1,191 @@
/*
* Author:
* name:
* Description:
* Date: 2023/11/1
*/
import React, { FunctionComponent, useEffect, useMemo, useState } from "react";
import { ColumnType } from "antd/lib/table";
import { PaginationData } from "rc-pagination";
import styles from "@/pages/atdTable/components/index.less";
import { exceptStr, paginationAction } from "@/utils/common";
import type { MenuProps } from "antd";
import { Button, Dropdown, Space, Table } from "antd";
import { MoreOutlined } from "@ant-design/icons";
interface OwnProps {
}
type Props = OwnProps;
const Index: FunctionComponent<Props> = (props) => {
const [columns, setColumns] = useState<ColumnType<any>[]>([]);
const [dataSource, setDataSource] = useState<any[]>([]);
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
const [pageInfo, setPageInfo] = useState<Partial<PaginationData>>({});
const [i18n, setI18n] = useState<any>({});
const [runStatuses, setRunStatuses] = useState<string>("");
const [showOperateBtn, setShowOperateBtn] = useState<boolean>(false);
useEffect(() => {
window.parent.postMessage({ type: "init" }, "*");
window.addEventListener("message", receiveMessageFromIndex, false);
return () => {
window.removeEventListener("message", receiveMessageFromIndex, false);
};
}, []);
const receiveMessageFromIndex = (event: any) => {
const data: any = exceptStr(event.data);
if (!_.isEmpty(data)) {
const {
columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {},
runStatuses, showOperateBtn
} = data;
setShowOperateBtn(showOperateBtn);
setRunStatuses(runStatuses);
setI18n(i18nRes);
setPageInfo(pageInfo);
setDataSource(dataSource);
setSelectedRowKeys(selectedRowKeys);
setColumns(columns);
}
};
const onChange = (current: number, pageSize: number) => {
setPageInfo((prevState) => {
const { pageSize: size } = prevState;
window.parent.postMessage(
{
type: "turn",
payload: { id: "PAGEINFO", params: { ...pageInfo, current: size === pageSize ? current : 1, pageSize } }
},
"*"
);
return { ...pageInfo, current: size === pageSize ? current : 1, pageSize };
});
};
const rowSelection = {
columnWidth: 60,
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: React.Key[]) => {
setSelectedRowKeys(selectedRowKeys);
window.parent.postMessage(
{
type: "turn",
payload: { id: "CHECKBOX", params: { selectedRowKeys } }
},
"*"
);
}
};
const handleWelfareOperate = (type: string, record: any, interfaceParams?: any) => {
window.parent.postMessage(
{
type: "turn",
payload: { id: type, params: { record, interfaceParams } }
},
"*"
);
};
const cols: any = useMemo(() => {
let opts: any = { title: i18n["操作"], dataIndex: "operate", fixed: "right", width: 185 };
switch (runStatuses) {
case "1":
opts = {
...opts,
render: (__: any, record: any) => {
const items: MenuProps["items"] = [
{
key: "DeleteFiles",
label: i18n["删除档案"],
onClick: () => handleWelfareOperate("DEL-ARCHIVE", record)
},
{
key: "DeleteTodoList",
label: i18n["删除待办"],
onClick: () => handleWelfareOperate("DEL-TO-DO", record, { runStatus: "4" })
}
];
return (<Space>
<Button type="link" onClick={() => handleWelfareOperate("EDIT", record)}>{i18n["编辑"]}</Button>
<Button type="link" onClick={() => handleWelfareOperate("ADD-TO-PAY", record)}>{i18n["增员"]}</Button>
<Dropdown menu={{ items }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
}
};
break;
case "2,3":
case "ext":
opts = {
...opts,
render: (__: any, record: any) => (
<Button type="link" onClick={() => handleWelfareOperate("EDIT", record)}>{i18n["编辑"]}</Button>)
};
break;
case "3":
opts = {
...opts,
render: (__: any, record: any) => {
const downsizingItems: MenuProps["items"] = [
{
key: "DeleteTodoList",
label: i18n["删除待办"],
onClick: () => handleWelfareOperate("DEL-TO-DO-STAY", record, { runStatus: "3" })
}
];
return (<Space>
<Button type="link" onClick={() => handleWelfareOperate("EDIT", record)}>{i18n["编辑"]}</Button>
<Button type="link"
onClick={() => handleWelfareOperate("STAY-DEL-TO-STOP", record)}>{i18n["减员"]}</Button>
<Dropdown menu={{ items: downsizingItems }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
}
};
break;
case "4,5":
opts = {
...opts,
render: (__: any, record: any) => {
const stopItems: MenuProps["items"] = [
{
key: "CancelSuspension",
label: i18n["取消停缴"],
onClick: () => handleWelfareOperate("CANCEL-STOP", record)
}
];
return (<Space>
<Button type="link" onClick={() => handleWelfareOperate("VIEW", record)}>{i18n["查看"]}</Button>
<Button type="link"
onClick={() => handleWelfareOperate("DEL-ARCHIVE", record)}>{i18n["删除档案"]}</Button>
<Dropdown menu={{ items: stopItems }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
}
};
break;
default:
break;
}
return showOperateBtn ? [...columns, opts] : [...columns, {
...opts,
render: (__: any, record: any) => (
<Button type="link" onClick={() => handleWelfareOperate("VIEW", record)}>{i18n["查看"]}</Button>)
}];
}, [columns, runStatuses, i18n, showOperateBtn]);
return (<Table
rowKey="baseInfo" size="small" className={styles.tableWrapper}
columns={cols} dataSource={dataSource} rowSelection={rowSelection}
scroll={{ x: 1200, y: `calc(100vh - 103px)` }}
pagination={{
...paginationAction(pageInfo, i18n, onChange),
size: "default"
}}
/>);
};
export default Index;

@ -0,0 +1,95 @@
/*
* Author:
* name: -穿
* Description:
* Date: 2023/10/17
*/
import React, { FunctionComponent, useEffect, useState } from "react";
import { Table, Typography } from "antd";
import styles from "@/pages/atdTable/components/index.less";
import { exceptStr, paginationFun } from "@/utils/common";
import { IPage } from "@/common/types";
import { ColumnType } from "antd/lib/table";
import type { PaginationData } from "rc-pagination";
import WelfareFixedTotal from "@/pages/welfareLedgerTable/welfareFixedTotal";
interface OwnProps {
}
type Props = OwnProps;
const { Text } = Typography;
const Index: FunctionComponent<Props> = (props) => {
const [columns, setColumns] = useState<ColumnType<any>[]>([]);
const [dataSource, setDataSource] = useState<any[]>([]);
const [pageInfo, setPageInfo] = useState<Partial<PaginationData>>({});
const [sumRowlistUrl, setSumRowlistUrl] = useState<string>("");
const [payload, setPayload] = useState<string>("");
useEffect(() => {
window.parent.postMessage({ type: "init" }, "*");
window.addEventListener("message", receiveMessageFromIndex, false);
return () => {
window.removeEventListener("message", receiveMessageFromIndex, false);
};
}, []);
const receiveMessageFromIndex = (event: any) => {
const data: any = exceptStr(event.data);
if (!_.isEmpty(data)) {
const {
columns, dataSource, pageInfo, sumRowlistUrl = "", payload = {}
} = data;
setSumRowlistUrl(sumRowlistUrl);
setPayload(payload);
setPageInfo(pageInfo);
setDataSource(dataSource);
setColumns(_.map(columns, it => {
if (it.dataIndex === "userName") {
return {
...it, width: 200, title: (
<span dangerouslySetInnerHTML={{ __html: it.title }}></span>
), fixed: "left"
};
}
return {
...it, width: 200, title: (
<span dangerouslySetInnerHTML={{ __html: it.title }}></span>
)
};
}));
}
};
const sizeChange = (pageobj: IPage) => {
};
const onChange = (pageobj: IPage) => {
setPageInfo(() => {
window.parent.postMessage(
{
type: "turn",
payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } }
},
"*"
);
return { ...pageInfo, ...pageobj };
});
};
return (<Table
rowKey="id" size="small" className={styles.tableWrapper}
columns={columns} dataSource={dataSource}
scroll={{ x: 1200, y: `calc(100vh - 120px)` }}
pagination={{
...paginationFun(pageInfo, sizeChange, onChange),
size: "default"
}}
summary={() => (
<Table.Summary fixed>
<Table.Summary.Row>
<Table.Summary.Cell index={0} align="center"><Text type="danger"></Text></Table.Summary.Cell>
<WelfareFixedTotal columns={columns} dataSourceUrl={sumRowlistUrl} payload={payload}/>
</Table.Summary.Row>
</Table.Summary>
)}
/>);
};
export default Index;

@ -0,0 +1,55 @@
/*
* Author:
* name:-
* Description:
* Date: 2023/10/17
*/
import React, { FunctionComponent, useCallback, useEffect, useMemo, useState } from "react";
import { ColumnType } from "antd/lib/table";
import { Spin, Table, Typography } from "antd";
import API from "@/api";
const { Text } = Typography;
interface OwnProps {
columns: ColumnType<any>[];
dataSourceUrl: string;
payload: any;
}
type Props = OwnProps;
const welfareFixedTotal: FunctionComponent<Props> = (props) => {
const [sumRow, setSumRow] = useState<Partial<{}>>({});//薪资核算总计行数据
const [loading, setLoading] = useState<boolean>(false);
const columns = useMemo(() => {
return !_.isEmpty(props.columns) ? props.columns : [];
}, [props.columns]);
const dataSourceUrl = useCallback((payload) => {
return API.CalculateService.getSyMixSum(payload);
}, [props.dataSourceUrl]);
useEffect(() => {
if (!_.isEmpty(props.payload)) {
setLoading(true);
dataSourceUrl(props.payload).then(({ data }) => {
setLoading(false);
const { data: result, status } = data;
if (status) setSumRow(result.sumRow || {});
});
}
}, [props.payload]);
return (<>
{
_.map(columns.slice(1), (item: any, index) => {
return <Table.Summary.Cell index={index + 1} key={index + 1}>
{
loading ? <Spin spinning={loading} size="small"></Spin> :
<Text type="danger">{sumRow[item.dataIndex] || "-"}</Text>
}
</Table.Summary.Cell>;
})
}
</>);
};
export default welfareFixedTotal;

@ -72,14 +72,21 @@ export const exceptStr = (str) => {
export const paginationFun = (tableListPageObj, sizeChange, onChange, i18n = {}) => {
return {
current: tableListPageObj.pageNum,
pageSize: tableListPageObj.size,
current: tableListPageObj.pageNum || tableListPageObj.current,
pageSize: tableListPageObj.size || tableListPageObj.pageSize,
total: tableListPageObj.total,
showTotal: total => `${i18n["共"] ? i18n["共"] : "共"} ${total} ${i18n["条"] ? i18n["条"] : "条"}`,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],
onShowSizeChange: () => sizeChange(),
onShowSizeChange: (page, size) => {
const { total } = tableListPageObj;
sizeChange({
pageNum: page,
size,
total
});
},
onChange: (page, size) => {
const { total } = tableListPageObj;
onChange({
@ -90,3 +97,16 @@ export const paginationFun = (tableListPageObj, sizeChange, onChange, i18n = {})
}
};
};
export const paginationAction = (pageInfo = {}, i18n = {}, onChange, onShowSizeChange) => {
return {
pageSize: pageInfo.pageSize || 10,
current: pageInfo.current || 1,
total: pageInfo.total || 0,
pageSizeOptions: ["10", "20", "50", "100"],
showTotal: total => `${i18n["共"] ? i18n["共"] : "共"} ${total} ${i18n["条"] ? i18n["条"] : "条"}`,
onChange, onShowSizeChange,
showQuickJumper: true,
showSizeChanger: true
};
};

Loading…
Cancel
Save