Merge branch 'master' into feature/V2-系统多语言
commit
205e7dd2b7
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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 } }, "*");
|
||||
};
|
Loading…
Reference in New Issue