feature/2.9.42310.01-薪资项目拓扑图

release/2.19.1.2503.01-业务线个税
lys 6 months ago
parent 6431c32e78
commit 2c13ef67e7

@ -5,6 +5,7 @@
* Date: 2023/12/27 * Date: 2023/12/27
*/ */
import React, { FC, useEffect, useState } from "react"; import React, { FC, useEffect, useState } from "react";
import { FolderViewOutlined } from "@ant-design/icons";
import { Button, Space, Table } from "antd"; import { Button, Space, Table } from "antd";
import { exceptStr, paginationAction } from "@/utils/common"; import { exceptStr, paginationAction } from "@/utils/common";
import styles from "@/pages/atdTable/components/index.less"; import styles from "@/pages/atdTable/components/index.less";
@ -26,12 +27,32 @@ const TaxDeclareTable: FC = (props) => {
const receiveMessageFromIndex = (event: any) => { const receiveMessageFromIndex = (event: any) => {
const data: any = exceptStr(event.data); const data: any = exceptStr(event.data);
if (!_.isEmpty(data)) { if (!_.isEmpty(data)) {
const { columns, dataSource, pageInfo, i18n, declareStatus, azOperate=true } = data; const { columns, dataSource, pageInfo, i18n, declareStatus, azOperate = true } = data;
setDataSource(dataSource); setDataSource(dataSource);
setI18n(i18n); setI18n(i18n);
setPageInfo(pageInfo); setPageInfo(pageInfo);
setColumns((["NOT_DECLARE", "DECLARE_FAIL"].includes(declareStatus) && azOperate) ? [ setColumns(
...columns, ["NOT_DECLARE", "DECLARE_FAIL"].includes(declareStatus) && azOperate
? [
..._.map(columns, (o) => {
// 查看附表字段
if (o.isAppendix) {
return {
...o,
render: (text: string, record: any) => (
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
<span>{text}</span>
<FolderViewOutlined
title={i18n["查看附表"]}
style={{ color: "#2db7f5", fontSize: 16, cursor: "pointer" }}
onClick={() => handleViewAppendix({ ...record, dataIndex: o.dataIndex, title: o.title })}
/>
</div>
)
};
}
return { ...o };
}),
{ {
title: i18n["操作"], title: i18n["操作"],
dataIndex: "operate", dataIndex: "operate",
@ -39,12 +60,36 @@ const TaxDeclareTable: FC = (props) => {
width: 120, width: 120,
render: (_: any, record: any) => ( render: (_: any, record: any) => (
<Space> <Space>
<Button type="link" onClick={() => handleEdit(record)}>{i18n["编辑"]}</Button> <Button type="link" onClick={() => handleEdit(record)}>
<Button type="link" onClick={() => handleDelete(record)}>{i18n["删除"]}</Button> {i18n["编辑"]}
</Button>
<Button type="link" onClick={() => handleDelete(record)}>
{i18n["删除"]}
</Button>
</Space> </Space>
) )
} }
] : columns); ]
: _.map(columns, (o) => {
// 查看附表字段
if (o.isAppendix) {
return {
...o,
render: (text: string, record: any) => (
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
<span>{text}</span>
<FolderViewOutlined
title={i18n["查看附表"]}
style={{ color: "#2db7f5", fontSize: 16, cursor: "pointer" }}
onClick={() => handleViewAppendix({ ...record, dataIndex: o.dataIndex, title: o.title })}
/>
</div>
)
};
}
return { ...o };
})
);
} }
}; };
const handleEdit = (record: any) => { const handleEdit = (record: any) => {
@ -53,6 +98,9 @@ const TaxDeclareTable: FC = (props) => {
const handleDelete = (record: any) => { const handleDelete = (record: any) => {
window.parent.postMessage({ type: "turn", payload: { id: "DELETE", params: { ...record } } }, "*"); window.parent.postMessage({ type: "turn", payload: { id: "DELETE", params: { ...record } } }, "*");
}; };
const handleViewAppendix = (record: any) => {
window.parent.postMessage({ type: "turn", payload: { id: "APPENDIX", params: { ...record } } }, "*");
};
const onChange = (current: number, pageSize: number) => { const onChange = (current: number, pageSize: number) => {
setPageInfo((prevState) => { setPageInfo((prevState) => {
const { pageSize: size } = prevState; const { pageSize: size } = prevState;
@ -66,15 +114,21 @@ const TaxDeclareTable: FC = (props) => {
return { ...pageInfo, current: size === pageSize ? current : 1, pageSize }; return { ...pageInfo, current: size === pageSize ? current : 1, pageSize };
}); });
}; };
return <Table return (
rowKey="id" className={styles.tableWrapper} size="small" <Table
columns={columns} dataSource={dataSource} bordered rowKey="id"
className={styles.tableWrapper}
size="small"
columns={columns}
dataSource={dataSource}
bordered
scroll={{ x: 1200, y: `calc(100vh - 100px)` }} scroll={{ x: 1200, y: `calc(100vh - 100px)` }}
pagination={{ pagination={{
...paginationAction(pageInfo, i18n, onChange), ...paginationAction(pageInfo, i18n, onChange),
size: "default" size: "default"
}} }}
/>; />
);
}; };
export default TaxDeclareTable; export default TaxDeclareTable;

Loading…
Cancel
Save