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

feature/V2-系统多语言
黎永顺 1 year ago
commit 205e7dd2b7

@ -54,6 +54,30 @@
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe689;</span>
<div class="name">payment</div>
<div class="code-name">&amp;#xe689;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe78b;</span>
<div class="name">my</div>
<div class="code-name">&amp;#xe78b;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe608;</span>
<div class="name">还款</div>
<div class="code-name">&amp;#xe608;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe600;</span>
<div class="name">编辑</div>
<div class="code-name">&amp;#xe600;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe696;</span>
<div class="name">批量更新</div>
@ -144,9 +168,9 @@
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1701833672416') format('woff2'),
url('iconfont.woff?t=1701833672416') format('woff'),
url('iconfont.ttf?t=1701833672416') format('truetype');
src: url('iconfont.woff2?t=1708504618246') format('woff2'),
url('iconfont.woff?t=1708504618246') format('woff'),
url('iconfont.ttf?t=1708504618246') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@ -172,6 +196,42 @@
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-payment"></span>
<div class="name">
payment
</div>
<div class="code-name">.icon-payment
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-my"></span>
<div class="name">
my
</div>
<div class="code-name">.icon-my
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-reimbursement"></span>
<div class="name">
还款
</div>
<div class="code-name">.icon-reimbursement
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-bianji"></span>
<div class="name">
编辑
</div>
<div class="code-name">.icon-bianji
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-pilianggengxin"></span>
<div class="name">
@ -307,6 +367,38 @@
<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-payment"></use>
</svg>
<div class="name">payment</div>
<div class="code-name">#icon-payment</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-my"></use>
</svg>
<div class="name">my</div>
<div class="code-name">#icon-my</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-reimbursement"></use>
</svg>
<div class="name">还款</div>
<div class="code-name">#icon-reimbursement</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-bianji"></use>
</svg>
<div class="name">编辑</div>
<div class="code-name">#icon-bianji</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-pilianggengxin"></use>

@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 4257468 */
src: url('iconfont.woff2?t=1701833672416') format('woff2'),
url('iconfont.woff?t=1701833672416') format('woff'),
url('iconfont.ttf?t=1701833672416') format('truetype');
src: url('iconfont.woff2?t=1708504618246') format('woff2'),
url('iconfont.woff?t=1708504618246') format('woff'),
url('iconfont.ttf?t=1708504618246') format('truetype');
}
.iconfont {
@ -13,6 +13,22 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-payment:before {
content: "\e689";
}
.icon-my:before {
content: "\e78b";
}
.icon-reimbursement:before {
content: "\e608";
}
.icon-bianji:before {
content: "\e600";
}
.icon-pilianggengxin:before {
content: "\e696";
}

File diff suppressed because one or more lines are too long

@ -5,6 +5,34 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "289230",
"name": "payment",
"font_class": "payment",
"unicode": "e689",
"unicode_decimal": 59017
},
{
"icon_id": "330201",
"name": "my",
"font_class": "my",
"unicode": "e78b",
"unicode_decimal": 59275
},
{
"icon_id": "9492514",
"name": "还款",
"font_class": "reimbursement",
"unicode": "e608",
"unicode_decimal": 58888
},
{
"icon_id": "201638",
"name": "编辑",
"font_class": "bianji",
"unicode": "e600",
"unicode_decimal": 58880
},
{
"icon_id": "2442443",
"name": "批量更新",

Binary file not shown.

Binary file not shown.

@ -73,9 +73,7 @@ class CalculateService extends BasicService {
return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sum`, queryParams);
};
//合计行
getAcctResultsum = async (params: any) => {
return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sum`, params);
};
getAcctResultsum = async (url: string, params: any) => (this.post(url, params));
//社保合计行
getSyMixSum = async (params: any) => {
return this.post(`/api/bs/hrmsalary/siaccount/detail/list/syMixSum`, params);

@ -70,9 +70,9 @@ div,
iframe,
aside,
main {
scrollbar-color: #ccc transparent;
//scrollbar-color: #ccc transparent;
/* 第一个方块颜色,第二个轨道颜色(用于更改火狐浏览器样式) */
scrollbar-width: thin;
//scrollbar-width: thin;
/* 火狐滚动条无法自定义宽度,只能通过此属性使滚动条宽度变细 */
&::-webkit-scrollbar-track {

@ -16,8 +16,11 @@ module.exports = {
"/welfareLedgerTable.*": "blank",
"/payrollFilesTable.*": "blank",
"/employeeDeclareTable.*": "blank",
"/taxDeclareTable.*": "blank",
"/welfareArchiveTable.*": "blank",
"/salaryFileTable.*": "blank",
"/OCTable.*": "blank",
"/unitTable.*": "blank",
"/manage.*": "manage",
"/portal.*": "template",
"/passport/oauth-in": "blank",

@ -86,7 +86,7 @@
.expand-th:hover {
.toogle-lock-tool {
width: 37%;
display: flex;
}
}
@ -102,17 +102,15 @@
height: 100%;
.title-text {
width: 90%;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1 1;
cursor: pointer;
}
.toogle-lock-tool {
display: flex;
width: 0;
display: none;
overflow: hidden;
height: 100%;
justify-content: center;

@ -15,6 +15,7 @@ interface OwnProps {
columns: ColumnType<any>[];
dataSourceUrl: string;
payload: any;
sumRow: Partial<{}>;
}
type Props = OwnProps;
@ -34,22 +35,24 @@ const calcFixedTotal: FunctionComponent<Props> = (props) => {
return !_.isEmpty(props.columns) ? flattenFn(props.columns) : [];
}, [props.columns]);
const dataSourceUrl = useCallback((payload) => {
return API.CalculateService.getAcctResultsum(payload);
return API.CalculateService.getAcctResultsum(props.dataSourceUrl, payload);
}, [props.dataSourceUrl]);
useEffect(() => {
if (!_.isEmpty(props.payload)) {
if (!_.isEmpty(props.payload) && !props.sumRow) {
setLoading(true);
dataSourceUrl(props.payload).then(({ data }) => {
setLoading(false);
const { data: result, status } = data;
if (status) setSumRow(result.sumRow || {});
});
} else {
setSumRow(props.sumRow);
}
}, [props.payload]);
}, [props.payload, props.sumRow]);
return (<>
{
_.map(columns, (item: any, index) => {
return <Table.Summary.Cell index={index + 1} key={index + 1}>
return <Table.Summary.Cell index={index + 1} key={index + 1} align="center">
{
loading ? <Spin spinning={loading} size="small"></Spin> :
<Text type="danger">{sumRow[item.dataIndex] || "-"}</Text>

@ -20,6 +20,7 @@ interface OwnProps {
}
type Props = OwnProps;
type fixedProps = boolean | "top" | "bottom";
const { Text } = Typography;
const index: FunctionComponent<Props> = (props) => {
@ -31,7 +32,10 @@ const index: FunctionComponent<Props> = (props) => {
const [showTotalCell, setShowTotalCell] = useState<boolean>(false);
const [isDetailTable, setIsDetailTable] = useState<boolean>(false);
const [sumRowlistUrl, setSumRowlistUrl] = useState<string>("");
const [tableScrollHeight, setTableScrollHeight] = useState<Number>(0);
const [payload, setPayload] = useState<string>("");
const [fixed, setFixed] = useState<fixedProps>(true);
const [sumRow, setSumRow] = useState<Partial<{}>>({});//总计行数据
useEffect(() => {
window.parent.postMessage({ type: "init" }, "*");
@ -45,16 +49,20 @@ const index: FunctionComponent<Props> = (props) => {
if (!_.isEmpty(data)) {
const {
columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {},
showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail
showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail,
fixed = true, tableScrollHeight, sumRow
} = data;
setSumRowlistUrl(sumRowlistUrl);
setShowTotalCell(showTotalCell);
setIsDetailTable(calcDetail);
setI18n(i18nRes);
setPayload(payload);
setFixed(fixed);
setSumRow(sumRow);
setPageInfo(pageInfo);
setDataSource(dataSource);
setSelectedRowKeys(selectedRowKeys);
setTableScrollHeight(tableScrollHeight);
setColumns([...convertColumns(_.map(columns, o => ({ ...o, i18n: i18nRes }))), {
title: i18nRes["操作"], dataIndex: "operate", fixed: "right", width: 120,
render: (__, record) => (<Button type="link" onClick={() => handleEdit(record?.id)}>{i18nRes["编辑"]}</Button>)
@ -115,7 +123,9 @@ const index: FunctionComponent<Props> = (props) => {
});
};
const rowSelection = {
columnWidth: 60,
columnWidth: 60, columnTitle: (isDetailTable && !showTotalCell) ? "序号" : "",
renderCell: (value: boolean, record: any, index: number, originNode: React.ReactNode) => ((isDetailTable && !showTotalCell) ?
<span>{index + 1}</span> : originNode),
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: React.Key[]) => {
setSelectedRowKeys(selectedRowKeys);
@ -131,19 +141,19 @@ const index: FunctionComponent<Props> = (props) => {
return (<Table
rowKey="id" size="small" bordered className={styles.tableWrapper}
dataSource={dataSource} rowSelection={rowSelection}
scroll={{ x: 1200, y: `calc(100vh - ${!showTotalCell ? 165 : 200}px)` }}
scroll={{ x: 1200, y: `calc(100vh - ${tableScrollHeight || (!showTotalCell ? 165 : 200)}px)` }}
columns={!isDetailTable ? columns : _.filter(columns, o => o.dataIndex !== "operate")}
footer={() => !isDetailTable ? <CalcExplainFooter i18n={i18n}/> : null}
pagination={{
pagination={!_.isNil(pageInfo) ? {
...paginationFun(pageInfo, sizeChange, onChange, i18n),
size: "default"
}}
} : false}
summary={() => (
!showTotalCell ? <></> :
<Table.Summary fixed>
<Table.Summary fixed={fixed}>
<Table.Summary.Row>
<Table.Summary.Cell index={0} align="center"><Text type="danger">{i18n["总计"]}</Text></Table.Summary.Cell>
<CaclFixedTotal columns={columns} dataSourceUrl={sumRowlistUrl} payload={payload}/>
<CaclFixedTotal columns={columns} dataSourceUrl={sumRowlistUrl} payload={payload} sumRow={sumRow}/>
</Table.Summary.Row>
</Table.Summary>
)}

@ -36,6 +36,42 @@ const ReportTable: FC = (props) => {
return {
...child, ellipsis: true,
render: (text: string, record: any) => {
if(child.dataIndex?.endsWith("increase")){
let lowerLimitIndex = child.dataIndex.replace("increase", "lowerLimit");
let upperLimitIndex = child.dataIndex.replace("increase", "upperLimit");
let rowData = record[child.dataIndex].split(",").join("");
if (isNaN(parseFloat(rowData))) {
return record[child.dataIndex]
}
if (!isNaN(parseFloat(record[lowerLimitIndex])) && parseFloat(rowData) < parseFloat(record[lowerLimitIndex])) {
return <Button type="link" block onClick={() => {
window.parent.postMessage(
{
type: "turn",
payload: { id: "PIVOTCHART", params: { record } }
},
"*"
);
}}>
<Text type="success">{rowData}</Text>
</Button>
}
if (!isNaN(parseFloat(record[upperLimitIndex])) && parseFloat(rowData) > parseFloat(record[upperLimitIndex])) {
return <Button type="link" block onClick={() => {
window.parent.postMessage(
{
type: "turn",
payload: { id: "PIVOTCHART", params: { record } }
},
"*"
);
}}>
<Text type="danger">{rowData}</Text>
</Button>
} else {
return `${rowData}`
}
}
return <Button type="link" block onClick={() => {
window.parent.postMessage(
{
@ -77,7 +113,7 @@ const ReportTable: FC = (props) => {
{
_.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>
<Text>{!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"}</Text>
</Table.Summary.Cell>;
})
}

@ -0,0 +1,238 @@
/*
* Author:
* name: -
* Description:
* Date: 2024/1/8
*/
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 { Button, Dropdown, MenuProps, 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);
const [showDelSalaryFileBtn, setShowDelSalaryFileBtn] = 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 = {},
selectedKey, showOperateBtn, showDelSalaryFileBtn
} = data;
setShowOperateBtn(showOperateBtn);
setRunStatuses(selectedKey);
setI18n(i18nRes);
setPageInfo(pageInfo);
setDataSource(dataSource);
setSelectedRowKeys(selectedRowKeys);
setColumns(columns);
setShowDelSalaryFileBtn(showDelSalaryFileBtn);
}
};
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: "ROWSELECTION", params: { selectedRowKeys } }
},
"*"
);
}
};
const handleSalaryFileOperate = (type: string, record: any, interfaceParams?: any) => {
window.parent.postMessage(
{
type: "turn",
payload: { id: type, params: { record, interfaceParams } }
},
"*"
);
};
const cols: any = useMemo(() => {
if (!_.isEmpty(columns)) {
let opts: any = _.find(columns, o => o.dataIndex === "operate");
switch (runStatuses) {
case "pending":
opts = {
...opts,
render: (__: any, record: any) => {
let items: MenuProps["items"] = [
{
key: "DeleteTodoList",
label: i18n["删除待办"],
onClick: () => handleSalaryFileOperate("DEL-PENDITNG-TO-DO", record, [record?.id])
},
{
key: "Log",
label: i18n["操作日志"],
onClick: () => handleSalaryFileOperate("log", record)
},
{
key: "DeleteFiles",
label: i18n["删除档案"],
onClick: () => handleSalaryFileOperate("DEL-SALARY-FILES", record, [record?.id])
}
];
!showDelSalaryFileBtn && (items = _.dropRight(items));
return (<Space>
<Button type="link" onClick={() => handleSalaryFileOperate("EDIT", record)}>{i18n["编辑"]}</Button>
<Button type="link"
onClick={() => handleSalaryFileOperate("ADD-TO-SALARYPAYMENT", record, [record?.id])}>{i18n["设为发薪人员"]}</Button>
<Dropdown menu={{ items }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
}
};
break;
case "fixed":
case "ext":
opts = {
...opts,
render: (__: any, record: any) => {
let items: MenuProps["items"] = [
{
key: "Log",
label: i18n["操作日志"],
onClick: () => handleSalaryFileOperate("log", record)
}
];
return (
<Space>
<Button type="link"
onClick={() => handleSalaryFileOperate("CHANGE-SALARY", record)}>{i18n["调薪"]}</Button>
<Dropdown menu={{ items }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>
);
}
};
break;
case "suspend":
opts = {
...opts,
render: (__: any, record: any) => {
const downsizingItems: MenuProps["items"] = [
{
key: "DeleteTodoList",
label: i18n["删除待办"],
onClick: () => handleSalaryFileOperate("DEL-SUSPEND-TO-DO", record, [record?.id])
},
{
key: "Log",
label: i18n["操作日志"],
onClick: () => handleSalaryFileOperate("log", record)
}
];
return (<Space>
<Button type="link" onClick={() => handleSalaryFileOperate("EDIT", record)}>{i18n["编辑"]}</Button>
<Button type="link"
onClick={() => handleSalaryFileOperate("SALARY-SUSPENSION", record, [record?.id])}>{i18n["停薪"]}</Button>
<Dropdown menu={{ items: downsizingItems }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
}
};
break;
case "stop":
opts = {
...opts,
render: (__: any, record: any) => {
let stopItems: MenuProps["items"] = [
{
key: "Log",
label: i18n["操作日志"],
onClick: () => handleSalaryFileOperate("log", record)
},
{
key: "CancelSuspension",
label: i18n["删除档案"],
onClick: () => handleSalaryFileOperate("DEL-SALARY-FILES", record, [record?.id])
}
];
!showDelSalaryFileBtn && (stopItems = _.dropRight(stopItems));
return (<Space>
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
<Button type="link"
onClick={() => handleSalaryFileOperate("CANCEL-SALARY-SUSPENSION", record, [record?.id])}>{i18n["取消停薪"]}</Button>
{
!_.isEmpty(stopItems) &&
<Dropdown menu={{ items: stopItems }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
}
</Space>);
}
};
break;
default:
break;
}
return showOperateBtn ? [..._.filter(columns, o => o.dataIndex !== "operate"), opts] :
[..._.filter(columns, o => o.dataIndex !== "operate"), {
...opts,
render: (__: any, record: any) => (
<Space>
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
<Button type="link" onClick={() => handleSalaryFileOperate("log", record)}>{i18n["操作日志"]}</Button>
</Space>
)
}];
} else {
return [];
}
}, [columns, runStatuses, i18n, showOperateBtn, showDelSalaryFileBtn]);
return (<Table
rowKey="id" 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,80 @@
/*
* Author:
* name: -
* Description:
* Date: 2023/12/27
*/
import React, { FC, useEffect, useState } from "react";
import { Button, Space, Table } from "antd";
import { exceptStr, paginationAction } from "@/utils/common";
import styles from "@/pages/atdTable/components/index.less";
import { PaginationData } from "rc-pagination";
const TaxDeclareTable: FC = (props) => {
const [pageInfo, setPageInfo] = useState<Partial<PaginationData>>({});
const [columns, setColumns] = useState<Array<any>>([]);
const [dataSource, setDataSource] = useState<Array<any>>([]);
const [i18n, setI18n] = useState<Partial<{}>>({});
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, declareStatus } = data;
setDataSource(dataSource);
setI18n(i18n);
setPageInfo(pageInfo);
setColumns(["NOT_DECLARE", "DECLARE_FAIL"].includes(declareStatus) ? [
...columns,
{
title: i18n["操作"],
dataIndex: "operate",
fixed: "right",
width: 120,
render: (_: any, record: any) => (
<Space>
<Button type="link" onClick={() => handleEdit(record)}>{i18n["编辑"]}</Button>
<Button type="link" onClick={() => handleDelete(record)}>{i18n["删除"]}</Button>
</Space>
)
}
] : columns);
}
};
const handleEdit = (record: any) => {
window.parent.postMessage({ type: "turn", payload: { id: "EDIT", params: { ...record } } }, "*");
};
const handleDelete = (record: any) => {
window.parent.postMessage({ type: "turn", payload: { id: "DELETE", params: { ...record } } }, "*");
};
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 };
});
};
return <Table
rowKey="id" className={styles.tableWrapper} size="small"
columns={columns} dataSource={dataSource} bordered
scroll={{ x: 1200, y: `calc(100vh - 100px)` }}
pagination={{
...paginationAction(pageInfo, i18n, onChange),
size: "default"
}}
/>;
};
export default TaxDeclareTable;

@ -0,0 +1,123 @@
.multi_fun_table {
background: #fff;
:global {
.ant-btn-link {
height: inherit !important;
}
.ant-btn-link, .ant-dropdown-trigger {
padding: 0;
font-size: 12px;
color: #333;
}
.ant-btn-link:hover {
color: #00a9ff;
span {
text-decoration: underline;
}
}
.ant-table-tbody > tr.ant-table-row:hover > td {
background: #e9f7ff;
}
.anticon-more {
font-size: 16px;
cursor: pointer;
}
.ant-spin-container {
.ant-pagination {
font-size: 12px;
align-items: center;
margin-right: 8px;
.ant-pagination-item, .ant-pagination-prev, .ant-pagination-next {
min-width: 28px;
height: 28px;
line-height: 28px;
border-radius: 6px;
& > button {
border-radius: 6px;
}
}
.ant-pagination-item-active {
background: var(--ant-primary-color);
border: none;
& > a {
color: #FFF;
}
}
.ant-pagination-options {
.ant-select {
font-size: 12px;
.ant-select-selector {
height: 28px;
border-radius: 6px;
.ant-select-selection-search-input {
height: 26px;
line-height: 26px;
}
.ant-select-selection-item {
line-height: 26px;
}
}
.ant-select-item {
font-size: 12px;
}
}
.ant-pagination-options-quick-jumper {
height: 28px;
line-height: 28px;
& > input {
border-radius: 6px;
height: 28px;
}
}
}
}
}
.ant-table-thead > tr > th {
background-color: #f7fbfe;
}
th, td {
font-size: 12px;
.ant-form-item {
margin-bottom: 0;
.ant-input-number {
width: 100%;
}
}
}
}
}
:global {
.ant-dropdown-placement-bottomRight {
.ant-dropdown-menu {
max-height: inherit !important;
}
}
.ant-dropdown-menu-item {
font-size: 12px;
color: #333;
}
}

@ -0,0 +1,80 @@
import React, { FC, useEffect, useState } from "react";
import { Table } from "antd";
import { PaginationData } from "rc-pagination";
import { exceptStr, paginationAction } from "@/utils/common";
import { renderCols } from "@/pages/unitTable/renderColsOpts";
import styles from "./index.less";
export type extraType = {
selectedKey: string;
selectedRowKeys: string[] | number[];
permission: boolean;
scrollHeight: number;
rowKey: string
}
const UnitTable: FC = (props) => {
const [unitTableType, setUnitTableType] = useState<string>("");
const [columns, setColumns] = useState<Array<any>>([]);
const [dataSource, setDataSource] = useState<Array<any>>([]);
const [pageInfo, setPageInfo] = useState<Partial<PaginationData>>({});
const [i18n, setI18n] = useState<any>({});
const [extraParams, setExtraParams] = useState<Partial<extraType>>({});//额外参数
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, scrollHeight, i18n, showOperateBtn: permission, unitTableType = "welfareRecord",
selectedRowKeys, selectedKey, rowKey
} = data;
setI18n(i18n);
setColumns(columns);
setDataSource(dataSource);
setPageInfo(pageInfo);
setUnitTableType(unitTableType);
setExtraParams({ selectedKey, selectedRowKeys, scrollHeight, permission, rowKey });
}
};
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: extraParams.selectedRowKeys,
onChange: (selectedRowKeys: React.Key[]) => {
// @ts-ignore
setExtraParams({ ...extraParams, selectedRowKeys: selectedRowKeys });
window.parent.postMessage(
{ type: "turn", payload: { id: "CHECKBOX", params: { selectedRowKeys } } }, "*"
);
}
};
return <Table rowKey={extraParams.rowKey || "id"} className={styles.multi_fun_table} dataSource={dataSource}
size="middle" columns={renderCols(columns, unitTableType, i18n, extraParams)}
scroll={{ x: 1200, y: `calc(100vh - ${extraParams?.scrollHeight || 109}px)` }}
rowSelection={!_.isNil(extraParams?.selectedRowKeys) ? rowSelection : undefined}
pagination={!_.isNil(pageInfo) ? {
...paginationAction(pageInfo, i18n, onChange),
size: "default"
} : false}
/>;
};
export default UnitTable;

@ -0,0 +1,305 @@
import React from "react";
import { Button, Dropdown, MenuProps, Space, Tooltip, Typography } from "antd";
import { MoreOutlined, QuestionCircleFilled } from "@ant-design/icons";
import { extraType } from "@/pages/unitTable/index";
const { Text } = Typography;
/*
* Author:
* Description:
* Params:
* Date: 2024/1/23
*/
export function renderCols(initialState: any[], type: string, i18n?: AnyObject, extraParams?: Partial<extraType>) {
return React.useMemo(() => {
if (type === "welfareRecord") {
return [..._.map(_.filter(initialState, o => o.dataIndex !== "id"), g => {
let col = { ...g, ellipsis: true, fixed: g.dataIndex === "billMonth", width: 180 };
switch (g.dataIndex) {
case "billMonth":
col = {
...col,
width: 120,
render: (text: string, record: any) => {
const { billStatus } = record;
return (<Button type="link"
onClick={() => postMessageToParent(billStatus === "0" ? "CALC" : "VIEW", record)}>{text}</Button>);
}
};
break;
case "billStatus":
col = {
...col, width: 100, render: (text: string) => (
<Text style={{ maxWidth: "100%" }} ellipsis>
{text === "1" ? i18n?.["已归档"] : i18n?.["未归档"]}
</Text>
)
};
break;
case "paymentOrganization":
col = { ...col, width: 200 };
break;
case "socialNum":
case "otherNum":
case "fundNum":
col = { ...col, width: 118 };
break;
case "remarks":
col = { ...col, width: 200 };
break;
default:
col = { ...col };
break;
}
return col;
}), {
dataIndex: "operate", title: i18n?.["操作"], width: 185, fixed: "right",
render: (__: string, record: any) => {
const { billStatus } = record;
const items: MenuProps["items"] = [
{
key: "DeleteList",
label: i18n?.["删除"],
onClick: () => postMessageToParent("DELRC", record)
},
{
key: "Log",
label: i18n?.["操作日志"],
onClick: () => postMessageToParent("log", record)
}
];
return (
<Space>
{
!extraParams?.permission ?
<Space>
<Button type="link" onClick={() => postMessageToParent("VIEW", record)}>{i18n?.["查看"]}</Button>
<Dropdown menu={{
items: [{
key: "Log",
label: i18n?.["操作日志"],
onClick: () => postMessageToParent("log", record)
}]
}} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space> :
<>
{
billStatus === "0" &&
<>
<Button type="link"
onClick={() => postMessageToParent("CALC", record)}>{i18n?.["核算"]}</Button>
<Button type="link"
onClick={() => postMessageToParent("FILE", record)}>{i18n?.["归档"]}</Button>
<Dropdown menu={{ items }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</>
}
{
billStatus === "1" &&
<>
<Button type="link"
onClick={() => postMessageToParent("VIEW", record)}>{i18n?.["查看"]}</Button>
<Button type="link"
onClick={() => postMessageToParent("RECALC", record)}>{i18n?.["重新核算"]}</Button>
<Dropdown menu={{
items: [
{
key: "Log",
label: i18n?.["操作日志"],
onClick: () => postMessageToParent("log", record)
}
]
}} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</>
}
</>
}
</Space>
);
}
}];
} else if (type === "bonusplan") {
return [..._.map(initialState, g => {
let col = { ...g, ellipsis: true, fixed: false, width: 150 };
switch (g.dataIndex) {
case "taxYear":
case "fileStatusDesc":
col = { ...col, width: 80 };
break;
case "billStatus":
col = {
...col, width: 100, render: (text: string) => (
<Text style={{ maxWidth: "100%" }} ellipsis>
{text === "1" ? i18n?.["已归档"] : i18n?.["未归档"]}
</Text>
)
};
break;
case "optimizedBonusSum":
col = { ...col, width: 220 };
break;
case "employeeCount":
col = {
...col, title: <Space>
<Text>{g.title}</Text>
<Tooltip placement="top"
title={i18n?.["若同一个人 在两个个税扣缴义务人下 同一纳税年度 同时发年终奖,统计为两个人"]}>
<QuestionCircleFilled/>
</Tooltip>
</Space>
};
break;
default:
col = { ...col };
break;
}
return col;
}), {
dataIndex: "operate", title: i18n?.["操作"], width: 185, fixed: "right",
render: (__: string, record: any) => {
const { fileStatus } = record;
const items: MenuProps["items"] = [
{
key: "FileList",
label: fileStatus === 0 ? i18n?.["归档"] : i18n?.["取消归档"],
onClick: () => postMessageToParent("FILE", record)
},
{
key: "DeleteList",
label: i18n?.["删除"],
onClick: () => postMessageToParent("DEL", record)
},
{
key: "Log",
label: i18n?.["操作日志"],
onClick: () => postMessageToParent("log", record)
}
];
return (
<Space>
{
!extraParams?.permission ?
<Space>
<Button type="link"
onClick={() => postMessageToParent("VIEW", record)}>{i18n?.["查看详情"]}</Button>
<Dropdown menu={{ items: items.slice(-1) }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space> :
<>
<Button type="link"
onClick={() => postMessageToParent("VIEW", record)}>{i18n?.["查看详情"]}</Button>
<Button type="link"
onClick={() => postMessageToParent("EDIT", record)}>{i18n?.["编辑"]}</Button>
<Dropdown menu={{ items }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</>
}
</Space>
);
}
}];
} else if (type === "bonusStrategy") {
const { selectedKey } = extraParams as { selectedKey: string };
return [..._.map(initialState, g => {
let col = { ...g, ellipsis: true, fixed: false, width: 120 };
switch (g.dataIndex) {
case "username":
col = { ...col, fixed: "left" };
break;
case "taxAgentName":
col = { ...col, width: 200, fixed: "left" };
break;
case "idNo":
col = { ...col, width: 150 };
break;
case "originalTaxTypeDesc":
case "originalBonus":
case "originalTax":
case "originalIncome":
col = {
...col,
render: (text: string) => (<div style={{ color: "rgb(93, 156, 236)" }}>{text}</div>)
};
break;
case "optimizedTaxTypeDesc":
case "optimizedBonus":
case "optimizedTax":
case "optimizedIncome":
col = { ...col, render: (text: string) => (<Text type="success">{text}</Text>) };
break;
case "companySave":
case "employeeGain":
col = { ...col, render: (text: string) => (<Text type="warning">{text}</Text>) };
break;
default:
col = { ...col };
break;
}
return col;
}), {
dataIndex: "operate", title: i18n?.["操作"], width: 185, fixed: "right",
render: (__: string, record: any) => {
let items: MenuProps["items"] = [
{
key: "DeleteList",
label: i18n?.["删除"],
onClick: () => postMessageToParent("DEL", record)
},
{
key: "Log",
label: i18n?.["操作日志"],
onClick: () => postMessageToParent("log", record)
}
];
selectedKey === "getAnnualbonusaddupList" && items.shift();
return (
<Space>
{
!extraParams?.permission ?
<Space>
{
selectedKey === "getAnnualbonusstrategyList" &&
<Button type="link"
onClick={() => postMessageToParent("VIEW", record)}>{i18n?.["查看详情"]}</Button>
}
<Button type="link"
onClick={() => postMessageToParent("log", record)}>{i18n?.["操作日志"]}</Button>
</Space> :
<>
<Button type="link"
onClick={() => postMessageToParent("EDIT", record)}>{i18n?.["编辑"]}</Button>
{
selectedKey === "getAnnualbonusstrategyList" &&
<Button type="link"
onClick={() => postMessageToParent("VIEW", record)}>{i18n?.["查看详情"]}</Button>
}
{
selectedKey === "getAnnualbonusaddupList" &&
<Button type="link"
onClick={() => postMessageToParent("DEL", record)}>{i18n?.["删除"]}</Button>
}
<Dropdown menu={{ items }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</>
}
</Space>
);
}
}];
}
return [];
}, [initialState, type, i18n, extraParams]);
}
const postMessageToParent = (type: string, params: any) => {
window.parent.postMessage({ type: "turn", payload: { id: type, params } }, "*");
};

@ -104,6 +104,11 @@ const Index: FunctionComponent<Props> = (props) => {
key: "DeleteTodoList",
label: i18n["删除待办"],
onClick: () => handleWelfareOperate("DEL-TO-DO", record, { runStatus: "4" })
},
{
key: "Log",
label: i18n["操作日志"],
onClick: () => handleWelfareOperate("log", record)
}
];
return (<Space>
@ -120,8 +125,22 @@ const Index: FunctionComponent<Props> = (props) => {
case "ext":
opts = {
...opts,
render: (__: any, record: any) => (
<Button type="link" onClick={() => handleWelfareOperate("EDIT", record)}>{i18n["编辑"]}</Button>)
render: (__: any, record: any) => {
const items: MenuProps["items"] = [
{
key: "Log",
label: i18n["操作日志"],
onClick: () => handleWelfareOperate("log", record)
}
];
return (
<Space>
<Button type="link" onClick={() => handleWelfareOperate("EDIT", record)}>{i18n["编辑"]}</Button>
<Dropdown menu={{ items }} placement="bottomRight">
<Button type="link" icon={<MoreOutlined/>}/>
</Dropdown>
</Space>);
}
};
break;
case "3":
@ -133,6 +152,11 @@ const Index: FunctionComponent<Props> = (props) => {
key: "DeleteTodoList",
label: i18n["删除待办"],
onClick: () => handleWelfareOperate("DEL-TO-DO-STAY", record, { runStatus: "3" })
},
{
key: "Log",
label: i18n["操作日志"],
onClick: () => handleWelfareOperate("log", record)
}
];
return (<Space>
@ -155,6 +179,11 @@ const Index: FunctionComponent<Props> = (props) => {
key: "CancelSuspension",
label: i18n["取消停缴"],
onClick: () => handleWelfareOperate("CANCEL-STOP", record)
},
{
key: "Log",
label: i18n["操作日志"],
onClick: () => handleWelfareOperate("log", record)
}
];
return (<Space>
@ -174,7 +203,11 @@ const Index: FunctionComponent<Props> = (props) => {
return showOperateBtn ? [...columns, opts] : [...columns, {
...opts,
render: (__: any, record: any) => (
<Button type="link" onClick={() => handleWelfareOperate("VIEW", record)}>{i18n["查看"]}</Button>)
<Space>
<Button type="link" onClick={() => handleWelfareOperate("VIEW", record)}>{i18n["查看"]}</Button>
<Button type="link" onClick={() => handleWelfareOperate("log", record)}>{i18n["操作日志"]}</Button>
</Space>
)
}];
}, [columns, runStatuses, i18n, showOperateBtn]);
return (<Table

Loading…
Cancel
Save