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

# Conflicts:
#	src/api/calculate.service.ts
#	src/pages/calcTable/index.tsx
release/2.19.1.2503.01-业务线个税
黎永顺 11 months ago
commit 52a45f38b3

@ -82,6 +82,14 @@ class CalculateService extends BasicService {
getSalarysobItemTopology = async (params: any) => { getSalarysobItemTopology = async (params: any) => {
return this.post(`/api/bs/hrmsalary/salarysob/item/topology`, params); return this.post(`/api/bs/hrmsalary/salarysob/item/topology`, params);
}; };
//工资发放数据
getAcctresult = async (params: any) => {
return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sjjtReport`, params);
};
//社保合计行
getAcctresultSum = async (params: any) => {
return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sjjtReportSum`, params);
};
} }
const calculateService = new CalculateService(); const calculateService = new CalculateService();

@ -24,6 +24,7 @@ module.exports = {
"/salaryFileTable.*": "blank", "/salaryFileTable.*": "blank",
"/OCTable.*": "blank", "/OCTable.*": "blank",
"/unitTable.*": "blank", "/unitTable.*": "blank",
"/aliTable.*": "blank",
"/custom-project.*": "blank", "/custom-project.*": "blank",
"/manage.*": "manage", "/manage.*": "manage",
"/portal.*": "template", "/portal.*": "template",

@ -0,0 +1,117 @@
import React, { FunctionComponent, useCallback, useEffect, useMemo, useState } from "react";
import { Table, Typography } from "antd";
import moment from "moment";
import styles from "@/pages/atdTable/components/index.less";
import { ColumnType } from "antd/lib/table";
import API from "@/api";
const { Text } = Typography;
interface OwnProps {
location: any;
}
type Props = OwnProps;
const index: FunctionComponent<Props> = (props) => {
const { location: { query } } = props;
const [loading, setLoading] = useState<boolean>(false);
const [report, setReport] = useState<any>({ columns: [], dataSource: [], sumRow: {} });
useEffect(() => {
setLoading(true);
dataSourceUrl({ ...query, isPrintf: true }).then(({ success, data }) => {
setLoading(false);
if (success) {
const { data: result } = data;
setReport({
columns: traverse(result?.column), dataSource: result?.data?.list, sumRow: result?.sumRow
});
}
});
}, []);
useEffect(() => {
if (!_.isEmpty(report?.columns)) {
window.document.body.innerHTML =
window.document.getElementById("print")!.innerHTML;
const styleTag = document.createElement("style");
styleTag.type = "text/css";
styleTag.innerHTML = `
.ant-table {
td, th, .ant-table-title, .ant-table-footer, table {
border-color: #333 !important;
}
}
`;
window.document.head.appendChild(styleTag);
window.print();
// window.location.reload();
}
return () => {
};
}, [report?.columns]);
const dataSourceUrl = useCallback((payload) => {
return API.CalculateService.getAcctresult(payload);
}, []);
const traverse: any = (arr: any[]) => {
return _.map(arr, item => {
if (!_.isEmpty(item.children)) {
return { dataIndex: item.column, title: item.text, children: traverse(item.children), align: "center" };
} else {
return { dataIndex: item.column, title: item.text, align: "center" };
}
});
};
const flattenFn = (source: ColumnType<any>[]) => {
let res: ColumnType<any>[] = [];
source.forEach((el: any) => {
_.isEmpty(el.children) && res.push(el);
el.children && res.push(...flattenFn(el.children));
});
return res;
};
const rowSelection = {
columnWidth: 50, columnTitle: "序号",
renderCell: (value: boolean, record: any, index: number) => (<span>{index + 1}</span>)
};
const columns = useMemo(() => {
return !_.isEmpty(report.columns) ? flattenFn(report.columns) : [];
}, [report.columns]);
return (
<div className={styles.resizeTable} id="print">
<Table
dataSource={report.dataSource} columns={report.columns} pagination={false}
size="small" bordered className={styles.tableWrapper} rowSelection={rowSelection}
title={() => <div
style={{ display: "flex", alignItems: "center", justifyContent: "center", fontSize: 12 }}>
{`${moment(query?.startDate).format("YYYY")}${moment(query?.startDate).format("M")}月份工资清单`}
</div>}
footer={() => <div style={{ display: "flex", alignItems: "center", padding: "0 40px" }}>
<div style={{ flex: "1", fontSize: 12 }}></div>
<div style={{ flex: "1", fontSize: 12 }}></div>
<div style={{ flex: "1", fontSize: 12 }}></div>
</div>}
summary={() => (
<Table.Summary>
<Table.Summary.Row>
<Table.Summary.Cell index={0} align="center"><Text></Text></Table.Summary.Cell>
{
!_.isEmpty(report?.sumRow) &&
_.map(columns, (item: any, index) => {
return <Table.Summary.Cell index={index + 1} key={index + 1} align="center">
<Text>{report?.sumRow[item.dataIndex] || ""}</Text>
</Table.Summary.Cell>;
})
}
</Table.Summary.Row>
</Table.Summary>
)}
/>
</div>
);
};
export default index;

@ -369,3 +369,17 @@
} }
} }
//自适应表格样式
.resizeTable {
width: 1920px;
height: 100%;
//height: 1080px;
//position: absolute;
//top: 50%;
//left: 50%;
////transform: scale(0.5, 0.5) translate(-50%, -50%);
//transform: translate(-50%, -50%);
//transform-origin: left top;
overflow-y: hidden;
}

@ -61,7 +61,7 @@ const calcFixedTotal: FunctionComponent<Props> = (props) => {
return <Table.Summary.Cell index={index + 1} key={index + 1} align={_.head(columns)?.align || "left"}> return <Table.Summary.Cell index={index + 1} key={index + 1} align={_.head(columns)?.align || "left"}>
{ {
loading ? <Spin spinning={loading} size="small"></Spin> : loading ? <Spin spinning={loading} size="small"></Spin> :
<Text type="danger">{sumRow[item.dataIndex] || "-"}</Text> <Text type="danger">{!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"}</Text>
} }
</Table.Summary.Cell>; </Table.Summary.Cell>;
}) })

@ -51,7 +51,7 @@ const index: FunctionComponent<Props> = (props) => {
const { const {
columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {},
showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail, showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail,
fixed = true, tableScrollHeight, sumRow fixed = true, tableScrollHeight, sumRow, optWidth
} = data; } = data;
setSumRowlistUrl(sumRowlistUrl); setSumRowlistUrl(sumRowlistUrl);
setShowTotalCell(showTotalCell); setShowTotalCell(showTotalCell);
@ -65,11 +65,12 @@ const index: FunctionComponent<Props> = (props) => {
setSelectedRowKeys(selectedRowKeys); setSelectedRowKeys(selectedRowKeys);
setTableScrollHeight(tableScrollHeight); setTableScrollHeight(tableScrollHeight);
setColumns([...convertColumns(_.map(columns, o => ({ ...o, i18n: i18nRes }))), { setColumns([...convertColumns(_.map(columns, o => ({ ...o, i18n: i18nRes }))), {
title: i18nRes["操作"], dataIndex: "operate", fixed: "right", width: 120, title: i18nRes["操作"], dataIndex: "operate", fixed: "right", width: optWidth || 120,
render: (__, record) => (<Space> render: (__, record) => (<Space>
<Button type="link" onClick={() => handleEdit(record?.id)}>{i18nRes["编辑"]}</Button> <Button type="link" onClick={() => handleEdit(record?.id)}>{i18nRes["编辑"]}</Button>
<Button type="link" <Button type="link"
onClick={() => handleLockEmp(record)}>{record.lockStatus === "LOCK" ? i18nRes["解锁"] : i18nRes["锁定"]}</Button> onClick={() => handleLockEmp(record)}>{record.lockStatus === "LOCK" ? i18nRes["解锁"] : i18nRes["锁定"]}</Button>
{record?.lockStatus === "LOCK" && <Text>{record?.lockTime}</Text>}
</Space>) </Space>)
}]); }]);
} }
@ -85,7 +86,8 @@ const index: FunctionComponent<Props> = (props) => {
className: styles["td_odd"], i18n: item.i18n, className: styles["td_odd"], i18n: item.i18n,
render: (text: string, record: any) => ( render: (text: string, record: any) => (
<span className={styles.contentSpan}> <span className={styles.contentSpan}>
<span title={text} className={styles.contentTitle}>{text}</span> <span title={text} className={styles.contentTitle}
style={{ color: `${record?.[item.dataIndex + "_color"]}` }}>{text}</span>
<Icon type="icon-piliangfenpei" title={i18n["查看拓扑图"]} <Icon type="icon-piliangfenpei" title={i18n["查看拓扑图"]}
className={styles.diagramIcon} className={styles.diagramIcon}
onClick={() => handleDiagramTd(item?.dataIndex, record?.id)} onClick={() => handleDiagramTd(item?.dataIndex, record?.id)}

@ -1,7 +1,8 @@
import React, { FC, useEffect, useState } from "react"; import React, { FC, useEffect, useState } from "react";
import { Button, Table, Typography } from "antd"; import { Button, Table, Typography } from "antd";
import { exceptStr } 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";
import { PaginationData } from "rc-pagination";
const { Text, Paragraph } = Typography; const { Text, Paragraph } = Typography;
const ReportTable: FC = (props) => { const ReportTable: FC = (props) => {
@ -10,6 +11,8 @@ const ReportTable: FC = (props) => {
const [dataSource, setDataSource] = useState<Array<any>>([]); const [dataSource, setDataSource] = useState<Array<any>>([]);
const [showSumrow, setShowSumrow] = useState<boolean>(false); const [showSumrow, setShowSumrow] = useState<boolean>(false);
const [SSHeaderInfo, setSSHeaderInfo] = useState<string>(""); const [SSHeaderInfo, setSSHeaderInfo] = useState<string>("");
const [pageInfo, setPageInfo] = useState<Partial<PaginationData>>({});
const [i18n, setI18n] = useState<any>({});
useEffect(() => { useEffect(() => {
window.parent.postMessage({ type: "init" }, "*"); window.parent.postMessage({ type: "init" }, "*");
@ -21,11 +24,13 @@ const ReportTable: 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, countResult, showSum, SSHeaderInfo = "" } = data; const { i18n, columns, dataSource, countResult, showSum, SSHeaderInfo = "", pageInfo } = data;
setI18n(i18n);
setDataSource(dataSource); setDataSource(dataSource);
setShowSumrow(showSum); setShowSumrow(showSum);
setSumRow(countResult); setSumRow(countResult);
setSSHeaderInfo(SSHeaderInfo); setSSHeaderInfo(SSHeaderInfo);
setPageInfo(pageInfo);
setColumns(_.map(columns, (item, index: number) => { setColumns(_.map(columns, (item, index: number) => {
if (index === 0) { if (index === 0) {
return { ...item, fixed: "left", ellipsis: true }; return { ...item, fixed: "left", ellipsis: true };
@ -88,16 +93,33 @@ const ReportTable: FC = (props) => {
})); }));
} }
}; };
const onChange = (current: number, pageSize: number) => {
setPageInfo((prevState) => {
const { pageSize: size } = prevState;
window.parent.postMessage(
{
type: "turn",
payload: { id: "PAGEINFO_REPORT", params: { ...pageInfo, current: size === pageSize ? current : 1, pageSize } }
},
"*"
);
return { ...pageInfo, current: size === pageSize ? current : 1, pageSize };
});
};
return <Table return <Table
rowKey="id" rowKey="id"
className={styles.tableWrapper} className={styles.tableWrapper}
columns={columns} columns={columns}
dataSource={dataSource} dataSource={dataSource}
pagination={false}
bordered bordered
size="small" size="small"
scroll={{ x: 1200, y: `calc(100vh - 148px)` }} scroll={{ x: 1200, y: `calc(100vh - 174px)` }}
title={() => <Paragraph ellipsis={true}>{SSHeaderInfo}</Paragraph>} title={() => <Paragraph ellipsis={true}>{SSHeaderInfo}</Paragraph>}
pagination={!_.isNil(pageInfo) ? {
...paginationAction(pageInfo, i18n, onChange),
size: "default"
} : false}
summary={() => { summary={() => {
if (!showSumrow) return; if (!showSumrow) return;
let totalColumns: any[] = []; let totalColumns: any[] = [];

@ -295,6 +295,22 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject,
); );
} }
}]; }];
} else if (type === "variableSalary") {
return [..._.map(initialState, g => {
return { ...g, ellipsis: true, fixed: false, width: 150 };
}), {
dataIndex: "operate", title: i18n?.["操作"], width: 185, fixed: "right",
render: (__: string, record: any) => {
return (
<Space>
<Button type="link"
onClick={() => postMessageToParent("VIEW", record)}>{i18n?.["查看详情"]}</Button>
<Button type="link"
onClick={() => postMessageToParent("DEL", record)}>{i18n?.["删除"]}</Button>
</Space>
);
}
}];
} }
return initialState; return initialState;
}, [initialState, type, i18n, extraParams]); }, [initialState, type, i18n, extraParams]);

Loading…
Cancel
Save