|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
@ -10,7 +11,7 @@ const { Text } = Typography;
|
|
|
|
|
* Params:
|
|
|
|
|
* Date: 2024/1/23
|
|
|
|
|
*/
|
|
|
|
|
export function renderCols(initialState: any[], type: string, i18n?: AnyObject, permission?: boolean) {
|
|
|
|
|
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 => {
|
|
|
|
@ -61,13 +62,29 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|
|
|
|
key: "DeleteList",
|
|
|
|
|
label: i18n?.["删除"],
|
|
|
|
|
onClick: () => postMessageToParent("DELRC", record)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "Log",
|
|
|
|
|
label: i18n?.["操作日志"],
|
|
|
|
|
onClick: () => postMessageToParent("log", record)
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
return (
|
|
|
|
|
<Space>
|
|
|
|
|
{
|
|
|
|
|
!permission ?
|
|
|
|
|
<Button type="link" onClick={() => postMessageToParent("VIEW", record)}>{i18n?.["查看"]}</Button> :
|
|
|
|
|
!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" &&
|
|
|
|
@ -88,6 +105,17 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|
|
|
|
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>
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
</>
|
|
|
|
@ -146,14 +174,24 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|
|
|
|
key: "DeleteList",
|
|
|
|
|
label: i18n?.["删除"],
|
|
|
|
|
onClick: () => postMessageToParent("DEL", record)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "Log",
|
|
|
|
|
label: i18n?.["操作日志"],
|
|
|
|
|
onClick: () => postMessageToParent("log", record)
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
return (
|
|
|
|
|
<Space>
|
|
|
|
|
{
|
|
|
|
|
!permission ?
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => postMessageToParent("VIEW", record)}>{i18n?.["查看详情"]}</Button> :
|
|
|
|
|
!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>
|
|
|
|
@ -168,9 +206,98 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
} 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, permission]);
|
|
|
|
|
}, [initialState, type, i18n, extraParams]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const postMessageToParent = (type: string, params: any) => {
|
|
|
|
|