From da25fe83849ac40d8e337f27ce8dc84d4be272b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 1 Jul 2024 11:17:33 +0800 Subject: [PATCH 1/4] master --- src/api/calculate.service.ts | 8 ++ src/layouts/config.js | 1 + src/pages/aliTable/dragColsTable/index.tsx | 107 +++++++++++++++++++++ src/pages/atdTable/components/index.less | 14 +++ src/pages/calcTable/index.tsx | 3 +- 5 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 src/pages/aliTable/dragColsTable/index.tsx diff --git a/src/api/calculate.service.ts b/src/api/calculate.service.ts index d7d843b..5e91725 100644 --- a/src/api/calculate.service.ts +++ b/src/api/calculate.service.ts @@ -78,6 +78,14 @@ class CalculateService extends BasicService { getSyMixSum = async (params: any) => { return this.post(`/api/bs/hrmsalary/siaccount/detail/list/syMixSum`, 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(); diff --git a/src/layouts/config.js b/src/layouts/config.js index 10d2a2a..9bcc20f 100644 --- a/src/layouts/config.js +++ b/src/layouts/config.js @@ -21,6 +21,7 @@ module.exports = { "/salaryFileTable.*": "blank", "/OCTable.*": "blank", "/unitTable.*": "blank", + "/aliTable.*": "blank", "/custom-project.*": "blank", "/manage.*": "manage", "/portal.*": "template", diff --git a/src/pages/aliTable/dragColsTable/index.tsx b/src/pages/aliTable/dragColsTable/index.tsx new file mode 100644 index 0000000..d9132de --- /dev/null +++ b/src/pages/aliTable/dragColsTable/index.tsx @@ -0,0 +1,107 @@ +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) => { + const { location: { query } } = props; + const [loading, setLoading] = useState(false); + const [report, setReport] = useState({ 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; + 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[]) => { + let res: ColumnType[] = []; + 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) => ({index + 1}) + }; + const columns = useMemo(() => { + return !_.isEmpty(report.columns) ? flattenFn(report.columns) : []; + }, [report.columns]); + return ( +
+
+ {`${moment(query?.startDate).format("YYYY")}年${moment(query?.startDate).format("M")}月份工资清单`} +
} + footer={() =>
+
制表:
+
审批:
+
批准:
+
} + summary={() => ( + + + 小计 + { + !_.isEmpty(report?.sumRow) && + _.map(columns, (item: any, index) => { + return + {report?.sumRow[item.dataIndex] || ""} + ; + }) + } + + + )} + /> + + ); +}; + +export default index; diff --git a/src/pages/atdTable/components/index.less b/src/pages/atdTable/components/index.less index 8beb07d..c1fece5 100644 --- a/src/pages/atdTable/components/index.less +++ b/src/pages/atdTable/components/index.less @@ -352,3 +352,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; +} + diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index 785a4c5..ef3714d 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -84,7 +84,8 @@ const index: FunctionComponent = (props) => { className: styles["td_odd"], i18n: item.i18n, render: (text: string, record: any) => ( - {text} + {text} { (item.lockStatus === "LOCK" || record.lockStatus === "LOCK") ? : null From 699d3323c4be2c376cfb3b71beedd72e173864ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 19 Jul 2024 11:06:46 +0800 Subject: [PATCH 2/4] master --- src/pages/reportTable/index.tsx | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/pages/reportTable/index.tsx b/src/pages/reportTable/index.tsx index 40d9066..25efc36 100644 --- a/src/pages/reportTable/index.tsx +++ b/src/pages/reportTable/index.tsx @@ -1,7 +1,8 @@ import React, { FC, useEffect, useState } from "react"; 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 { PaginationData } from "rc-pagination"; const { Text, Paragraph } = Typography; const ReportTable: FC = (props) => { @@ -10,6 +11,8 @@ const ReportTable: FC = (props) => { const [dataSource, setDataSource] = useState>([]); const [showSumrow, setShowSumrow] = useState(false); const [SSHeaderInfo, setSSHeaderInfo] = useState(""); + const [pageInfo, setPageInfo] = useState>({}); + const [i18n, setI18n] = useState({}); useEffect(() => { window.parent.postMessage({ type: "init" }, "*"); @@ -21,11 +24,13 @@ const ReportTable: FC = (props) => { const receiveMessageFromIndex = (event: any) => { const data: any = exceptStr(event.data); if (!_.isEmpty(data)) { - const { columns, dataSource, countResult, showSum, SSHeaderInfo = "" } = data; + const { i18n, columns, dataSource, countResult, showSum, SSHeaderInfo = "", pageInfo } = data; + setI18n(i18n); setDataSource(dataSource); setShowSumrow(showSum); setSumRow(countResult); setSSHeaderInfo(SSHeaderInfo); + setPageInfo(pageInfo); setColumns(_.map(columns, (item, index: number) => { if (index === 0) { 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
{SSHeaderInfo}} + pagination={!_.isNil(pageInfo) ? { + ...paginationAction(pageInfo, i18n, onChange), + size: "default" + } : false} summary={() => { if (!showSumrow) return; let totalColumns: any[] = []; From fe86dd2cd6bddc37a7f0aa32f7ed8721e15005fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 22 Jul 2024 09:42:20 +0800 Subject: [PATCH 3/4] master --- src/pages/aliTable/dragColsTable/index.tsx | 10 ++++++++++ src/pages/calcTable/index.tsx | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pages/aliTable/dragColsTable/index.tsx b/src/pages/aliTable/dragColsTable/index.tsx index d9132de..7bee10c 100644 --- a/src/pages/aliTable/dragColsTable/index.tsx +++ b/src/pages/aliTable/dragColsTable/index.tsx @@ -34,6 +34,16 @@ const index: FunctionComponent = (props) => { 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(); } diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index ef3714d..34f839c 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -64,11 +64,12 @@ const index: FunctionComponent = (props) => { setSelectedRowKeys(selectedRowKeys); setTableScrollHeight(tableScrollHeight); setColumns([...convertColumns(_.map(columns, o => ({ ...o, i18n: i18nRes }))), { - title: i18nRes["操作"], dataIndex: "operate", fixed: "right", width: 120, + title: i18nRes["操作"], dataIndex: "operate", fixed: "right", width: 220, render: (__, record) => ( + {record?.lockStatus === "LOCK" && {record?.lockTime}} ) }]); } From f9f95f25dfee79b4792b5860dae34498e9bd953e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 13 Aug 2024 17:59:55 +0800 Subject: [PATCH 4/4] master --- src/pages/calcTable/calcFixedTotal.tsx | 2 +- src/pages/calcTable/index.tsx | 4 ++-- src/pages/unitTable/renderColsOpts.tsx | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/pages/calcTable/calcFixedTotal.tsx b/src/pages/calcTable/calcFixedTotal.tsx index 09ca74f..6e61bbd 100644 --- a/src/pages/calcTable/calcFixedTotal.tsx +++ b/src/pages/calcTable/calcFixedTotal.tsx @@ -61,7 +61,7 @@ const calcFixedTotal: FunctionComponent = (props) => { return { loading ? : - {sumRow[item.dataIndex] || "-"} + {!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"} } ; }) diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index 34f839c..7d2db9c 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -50,7 +50,7 @@ const index: FunctionComponent = (props) => { const { columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail, - fixed = true, tableScrollHeight, sumRow + fixed = true, tableScrollHeight, sumRow, optWidth } = data; setSumRowlistUrl(sumRowlistUrl); setShowTotalCell(showTotalCell); @@ -64,7 +64,7 @@ const index: FunctionComponent = (props) => { setSelectedRowKeys(selectedRowKeys); setTableScrollHeight(tableScrollHeight); setColumns([...convertColumns(_.map(columns, o => ({ ...o, i18n: i18nRes }))), { - title: i18nRes["操作"], dataIndex: "operate", fixed: "right", width: 220, + title: i18nRes["操作"], dataIndex: "operate", fixed: "right", width: optWidth || 120, render: (__, record) => ( + + + ); + } + }]; } return initialState; }, [initialState, type, i18n, extraParams]);