Merge branch 'feature/业务线管理' into release/2.19.1.2503.01-业务线个税
This commit is contained in:
commit
5812022207
|
|
@ -24,9 +24,7 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
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);//待定薪、停薪员工 是否允许删除薪资档案
|
||||
const [DCChiefPermission, setDCChiefPermission] = useState<undefined>(undefined);//二开权限(大成)
|
||||
|
||||
useEffect(() => {
|
||||
window.parent.postMessage({ type: "init" }, "*");
|
||||
|
|
@ -40,10 +38,8 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
const data: any = exceptStr(event.data);
|
||||
if (!_.isEmpty(data)) {
|
||||
const {
|
||||
columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {},
|
||||
selectedKey, showOperateBtn, showDelSalaryFileBtn, DCChiefPermission
|
||||
columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {}, selectedKey, showDelSalaryFileBtn
|
||||
} = data;
|
||||
setShowOperateBtn(showOperateBtn);
|
||||
setRunStatuses(selectedKey);
|
||||
setI18n(i18nRes);
|
||||
setPageInfo(pageInfo);
|
||||
|
|
@ -51,7 +47,6 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
setSelectedRowKeys([...rowKeys, ...selectedRowKeys]);
|
||||
setColumns(columns);
|
||||
setShowDelSalaryFileBtn(showDelSalaryFileBtn);
|
||||
setDCChiefPermission(DCChiefPermission);
|
||||
}
|
||||
};
|
||||
const onChange = (current: number, pageSize: number) => {
|
||||
|
|
@ -113,19 +108,30 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
}
|
||||
];
|
||||
!showDelSalaryFileBtn && (items = _.dropRight(items));
|
||||
return (<Space>
|
||||
{
|
||||
(_.isNil(DCChiefPermission) || DCChiefPermission) ?
|
||||
return (
|
||||
record?.opts.includes("admin") ?
|
||||
<Space>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("EDIT", record)}>{i18n["编辑"]}</Button> :
|
||||
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
}
|
||||
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>);
|
||||
</Space> : <Space>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
<Dropdown menu={{
|
||||
items: [
|
||||
{
|
||||
key: "Log", label: i18n["操作日志"], onClick: () => handleSalaryFileOperate("log", record)
|
||||
}
|
||||
]
|
||||
}} placement="bottomRight">
|
||||
<Button type="link" icon={<MoreOutlined/>}/>
|
||||
</Dropdown>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
|
@ -142,15 +148,24 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
}
|
||||
];
|
||||
return (
|
||||
record?.opts.includes("admin") ?
|
||||
<Space>
|
||||
{
|
||||
(((_.isNil(DCChiefPermission) || DCChiefPermission) && runStatuses === "fixed") || runStatuses === "ext") ?
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("CHANGE-SALARY", record)}>{i18n["调薪"]}</Button> :
|
||||
onClick={() => handleSalaryFileOperate("CHANGE-SALARY", record)}>{i18n["调薪"]}</Button>
|
||||
<Dropdown menu={{ items }} placement="bottomRight">
|
||||
<Button type="link" icon={<MoreOutlined/>}/>
|
||||
</Dropdown>
|
||||
</Space> :
|
||||
<Space>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
<Dropdown menu={{
|
||||
items: [
|
||||
{
|
||||
key: "Log", label: i18n["操作日志"], onClick: () => handleSalaryFileOperate("log", record)
|
||||
}
|
||||
<Dropdown menu={{ items }} placement="bottomRight">
|
||||
]
|
||||
}} placement="bottomRight">
|
||||
<Button type="link" icon={<MoreOutlined/>}/>
|
||||
</Dropdown>
|
||||
</Space>
|
||||
|
|
@ -174,14 +189,30 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
onClick: () => handleSalaryFileOperate("log", record)
|
||||
}
|
||||
];
|
||||
return (<Space>
|
||||
return (
|
||||
record?.opts.includes("admin") ?
|
||||
<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>);
|
||||
</Space> :
|
||||
<Space>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
<Dropdown menu={{
|
||||
items: [
|
||||
{
|
||||
key: "Log", label: i18n["操作日志"], onClick: () => handleSalaryFileOperate("log", record)
|
||||
}
|
||||
]
|
||||
}} placement="bottomRight">
|
||||
<Button type="link" icon={<MoreOutlined/>}/>
|
||||
</Dropdown>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
|
@ -190,19 +221,21 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
...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])
|
||||
},
|
||||
{
|
||||
key: "Log",
|
||||
label: i18n["操作日志"],
|
||||
onClick: () => handleSalaryFileOperate("log", record)
|
||||
}
|
||||
];
|
||||
!showDelSalaryFileBtn && (stopItems = _.dropRight(stopItems));
|
||||
return (<Space>
|
||||
return (
|
||||
record?.opts.includes("admin") ?
|
||||
<Space>
|
||||
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("CANCEL-SALARY-SUSPENSION", record, [record?.id])}>{i18n["取消停薪"]}</Button>
|
||||
|
|
@ -212,32 +245,32 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
<Button type="link" icon={<MoreOutlined/>}/>
|
||||
</Dropdown>
|
||||
}
|
||||
</Space>);
|
||||
</Space> :
|
||||
<Space>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
<Dropdown menu={{
|
||||
items: [
|
||||
{
|
||||
key: "Log", label: i18n["操作日志"], onClick: () => handleSalaryFileOperate("log", record)
|
||||
}
|
||||
]
|
||||
}} 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>
|
||||
{
|
||||
(DCChiefPermission && (runStatuses === "pending" || runStatuses === "fixed")) ?
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate(runStatuses === "fixed" ? "CHANGE-SALARY" : "EDIT", record)}>{runStatuses === "fixed" ? i18n["调薪"] : i18n["编辑"]}</Button> :
|
||||
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
}
|
||||
<Button type="link" onClick={() => handleSalaryFileOperate("log", record)}>{i18n["操作日志"]}</Button>
|
||||
</Space>
|
||||
)
|
||||
}];
|
||||
return [..._.filter(columns, o => o.dataIndex !== "operate"), opts];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}, [columns, runStatuses, i18n, showOperateBtn, showDelSalaryFileBtn, DCChiefPermission]);
|
||||
}, [columns, runStatuses, i18n, showDelSalaryFileBtn]);
|
||||
return (<Table
|
||||
rowKey="id" size="small" className={styles.tableWrapper}
|
||||
columns={cols} dataSource={dataSource} rowSelection={rowSelection}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|||
render: (text: string, record: any) => {
|
||||
const { billStatus } = record;
|
||||
return (
|
||||
<Button type="link" onClick={() => postMessageToParent(billStatus === "0" && extraParams?.permission ? "CALC" : "VIEW", record)}>
|
||||
<Button type="link" onClick={() => postMessageToParent(billStatus === "0" && record?.opts.includes("admin") ? "CALC" : "VIEW", record)}>
|
||||
{text}
|
||||
</Button>
|
||||
);
|
||||
|
|
@ -84,7 +84,7 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|||
];
|
||||
return (
|
||||
<Space>
|
||||
{!extraParams?.permission ? (
|
||||
{!record?.opts.includes("admin") ? (
|
||||
<Space>
|
||||
<Button type="link" onClick={() => postMessageToParent("VIEW", record)}>
|
||||
{i18n?.["查看"]}
|
||||
|
|
@ -358,6 +358,8 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|||
fixed: "right",
|
||||
render: (__: string, record: any) => {
|
||||
return (
|
||||
<Space>
|
||||
{record?.opts.includes("admin") ? (
|
||||
<Space>
|
||||
<Button type="link" onClick={() => postMessageToParent("EDIT", record)}>
|
||||
{i18n?.["编辑"]}
|
||||
|
|
@ -366,6 +368,12 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|||
{i18n?.["删除"]}
|
||||
</Button>
|
||||
</Space>
|
||||
) : (
|
||||
<Button type="link" onClick={() => postMessageToParent("VIEW", record)}>
|
||||
{i18n?.["查看"]}
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -404,13 +412,15 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
|
|||
onClick: () => postMessageToParent("log", record)
|
||||
}
|
||||
];
|
||||
isSpecial && items.shift();
|
||||
(isSpecial || !record?.opts.includes("admin")) && items.shift();
|
||||
return (
|
||||
<Space>
|
||||
{record?.opts.includes("admin") && (
|
||||
<Button type="link" onClick={() => postMessageToParent("EDIT", record)}>
|
||||
{i18n?.["编辑"]}
|
||||
</Button>
|
||||
{isSpecial ? (
|
||||
)}
|
||||
{isSpecial && record?.opts.includes("admin") ? (
|
||||
<Button type="link" onClick={() => postMessageToParent("DEL", record)}>
|
||||
{i18n?.["删除"]}
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
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" }, "*");
|
||||
|
|
@ -38,11 +37,7 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
const receiveMessageFromIndex = (event: any) => {
|
||||
const data: any = exceptStr(event.data);
|
||||
if (!_.isEmpty(data)) {
|
||||
const {
|
||||
columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {},
|
||||
runStatuses, showOperateBtn
|
||||
} = data;
|
||||
setShowOperateBtn(showOperateBtn);
|
||||
const { columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {}, runStatuses } = data;
|
||||
setRunStatuses(runStatuses);
|
||||
setI18n(i18nRes);
|
||||
setPageInfo(pageInfo);
|
||||
|
|
@ -87,6 +82,14 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
};
|
||||
const cols: any = useMemo(() => {
|
||||
let opts: any = { title: i18n["操作"], dataIndex: "operate", fixed: "right", width: 185 };
|
||||
const UnAuthOpts = (record: any) => (<Space>
|
||||
<Button type="link" onClick={() => handleWelfareOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
<Dropdown menu={{
|
||||
items: [{ key: "Log", label: i18n["操作日志"], onClick: () => handleWelfareOperate("log", record) }]
|
||||
}} placement="bottomRight">
|
||||
<Button type="link" icon={<MoreOutlined/>}/>
|
||||
</Dropdown>
|
||||
</Space>);
|
||||
switch (runStatuses) {
|
||||
case "1":
|
||||
opts = {
|
||||
|
|
@ -109,13 +112,13 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
onClick: () => handleWelfareOperate("log", record)
|
||||
}
|
||||
];
|
||||
return (<Space>
|
||||
return (record?.opts.includes("admin") ? <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>);
|
||||
</Space> : UnAuthOpts(record));
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
|
@ -131,13 +134,12 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
onClick: () => handleWelfareOperate("log", record)
|
||||
}
|
||||
];
|
||||
return (
|
||||
<Space>
|
||||
return (record?.opts.includes("admin") ? <Space>
|
||||
<Button type="link" onClick={() => handleWelfareOperate("EDIT", record)}>{i18n["编辑"]}</Button>
|
||||
<Dropdown menu={{ items }} placement="bottomRight">
|
||||
<Button type="link" icon={<MoreOutlined/>}/>
|
||||
</Dropdown>
|
||||
</Space>);
|
||||
</Space> : UnAuthOpts(record));
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
|
@ -157,14 +159,14 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
onClick: () => handleWelfareOperate("log", record)
|
||||
}
|
||||
];
|
||||
return (<Space>
|
||||
return (record?.opts.includes("admin") ? <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>);
|
||||
</Space> : UnAuthOpts(record));
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
|
@ -184,38 +186,27 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
onClick: () => handleWelfareOperate("log", record)
|
||||
}
|
||||
];
|
||||
return (<Space>
|
||||
return (record?.opts.includes("admin") ? <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>);
|
||||
</Space> : UnAuthOpts(record));
|
||||
}
|
||||
};
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return showOperateBtn ? [...columns, opts] : [...columns, {
|
||||
...opts,
|
||||
render: (__: any, record: any) => (
|
||||
<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 [...columns, opts];
|
||||
}, [columns, runStatuses, i18n]);
|
||||
return (<Table
|
||||
rowKey="baseInfo" size="small" className={styles.tableWrapper}
|
||||
rowKey="baseInfoId" 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"
|
||||
}}
|
||||
pagination={{ ...paginationAction(pageInfo, i18n, onChange), size: "default" }}
|
||||
/>);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue