Merge branch 'master' into feature/2.9.42310.01-薪资项目拓扑图

release/2.19.1.2503.01-业务线个税
黎永顺 1 year ago
commit 992c85acf5

@ -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);

@ -21,6 +21,7 @@ module.exports = {
"/employeeDeclareTable.*": "blank",
"/taxDeclareTable.*": "blank",
"/welfareArchiveTable.*": "blank",
"/salaryFileTable.*": "blank",
"/OCTable.*": "blank",
"/manage.*": "manage",
"/portal.*": "template",

@ -15,6 +15,7 @@ interface OwnProps {
columns: ColumnType<any>[];
dataSourceUrl: string;
payload: any;
sumRow: Partial<{}>;
}
type Props = OwnProps;
@ -34,18 +35,20 @@ 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) => {

@ -33,8 +33,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" }, "*");
@ -49,7 +51,7 @@ const index: FunctionComponent<Props> = (props) => {
const {
columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {},
showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail,
fixed = true
fixed = true, tableScrollHeight, sumRow
} = data;
setSumRowlistUrl(sumRowlistUrl);
setShowTotalCell(showTotalCell);
@ -57,9 +59,11 @@ const index: FunctionComponent<Props> = (props) => {
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>)
@ -148,19 +152,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={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>
)}

@ -0,0 +1,204 @@
/*
* 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: "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) => (
<Button type="link"
onClick={() => handleSalaryFileOperate("CHANGE-SALARY", record)}>{i18n["调薪"]}</Button>)
};
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])
}
];
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: "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) => (
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>)
}];
} 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;
Loading…
Cancel
Save