From 5dfcbe1af96e0dbe0bb342f43e3f3365aa6098c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 19 Oct 2023 13:50:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=9B=E5=BE=AE=E8=96=AA=E8=B5=84=E6=A0=B8?= =?UTF-8?q?=E7=AE=97iframe=E8=A1=A8=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/calculate.service.ts | 4 + src/layouts/config.js | 1 + src/pages/welfareLedgerTable/index.tsx | 95 +++++++++++++++++++ .../welfareLedgerTable/welfareFixedTotal.tsx | 55 +++++++++++ 4 files changed, 155 insertions(+) create mode 100644 src/pages/welfareLedgerTable/index.tsx create mode 100644 src/pages/welfareLedgerTable/welfareFixedTotal.tsx diff --git a/src/api/calculate.service.ts b/src/api/calculate.service.ts index e3cf9dd..27ec01a 100644 --- a/src/api/calculate.service.ts +++ b/src/api/calculate.service.ts @@ -76,6 +76,10 @@ class CalculateService extends BasicService { getAcctResultsum = async (params: any) => { return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sum`, params); }; + //社保合计行 + getSyMixSum = async (params: any) => { + return this.post(`/api/bs/hrmsalary/siaccount/detail/list/syMixSum`, params); + }; } const calculateService = new CalculateService(); diff --git a/src/layouts/config.js b/src/layouts/config.js index 1f2bb09..ed0463e 100644 --- a/src/layouts/config.js +++ b/src/layouts/config.js @@ -13,6 +13,7 @@ module.exports = { "/reportTable.*": "blank", "/commonTable.*": "blank", "/calcTable.*": "blank", + "/welfareLedgerTable.*": "blank", "/payrollFilesTable.*": "blank", "/employeeDeclareTable.*": "blank", "/manage.*": "manage", diff --git a/src/pages/welfareLedgerTable/index.tsx b/src/pages/welfareLedgerTable/index.tsx new file mode 100644 index 0000000..8c6dec9 --- /dev/null +++ b/src/pages/welfareLedgerTable/index.tsx @@ -0,0 +1,95 @@ +/* + * Author: 黎永顺 + * name: 社保福利台账总览-穿透列表 + * Description: + * Date: 2023/10/17 + */ +import React, { FunctionComponent, useEffect, useState } from "react"; +import { Table, Typography } from "antd"; +import styles from "@/pages/atdTable/components/index.less"; +import { exceptStr, paginationFun } from "@/utils/common"; +import { IPage } from "@/common/types"; +import { ColumnType } from "antd/lib/table"; +import type { PaginationData } from "rc-pagination"; +import WelfareFixedTotal from "@/pages/welfareLedgerTable/welfareFixedTotal"; + +interface OwnProps { +} + +type Props = OwnProps; +const { Text } = Typography; + +const Index: FunctionComponent = (props) => { + const [columns, setColumns] = useState[]>([]); + const [dataSource, setDataSource] = useState([]); + const [pageInfo, setPageInfo] = useState>({}); + const [sumRowlistUrl, setSumRowlistUrl] = useState(""); + const [payload, setPayload] = useState(""); + + 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, sumRowlistUrl = "", payload = {} + } = data; + setSumRowlistUrl(sumRowlistUrl); + setPayload(payload); + setPageInfo(pageInfo); + setDataSource(dataSource); + setColumns(_.map(columns, it => { + if (it.dataIndex === "userName") { + return { + ...it, width: 200, title: ( + + ), fixed: "left" + }; + } + return { + ...it, width: 200, title: ( + + ) + }; + })); + } + }; + const sizeChange = (pageobj: IPage) => { + }; + const onChange = (pageobj: IPage) => { + setPageInfo(() => { + window.parent.postMessage( + { + type: "turn", + payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } } + }, + "*" + ); + return { ...pageInfo, ...pageobj }; + }); + }; + return ( ( + + + 总计 + + + + )} + />); +}; + +export default Index; diff --git a/src/pages/welfareLedgerTable/welfareFixedTotal.tsx b/src/pages/welfareLedgerTable/welfareFixedTotal.tsx new file mode 100644 index 0000000..6d5678b --- /dev/null +++ b/src/pages/welfareLedgerTable/welfareFixedTotal.tsx @@ -0,0 +1,55 @@ +/* + * Author: 黎永顺 + * name:社保福利台账总览-总计行 + * Description: + * Date: 2023/10/17 + */ +import React, { FunctionComponent, useCallback, useEffect, useMemo, useState } from "react"; +import { ColumnType } from "antd/lib/table"; +import { Spin, Table, Typography } from "antd"; +import API from "@/api"; + +const { Text } = Typography; + +interface OwnProps { + columns: ColumnType[]; + dataSourceUrl: string; + payload: any; +} + +type Props = OwnProps; + +const welfareFixedTotal: FunctionComponent = (props) => { + const [sumRow, setSumRow] = useState>({});//薪资核算总计行数据 + const [loading, setLoading] = useState(false); + const columns = useMemo(() => { + return !_.isEmpty(props.columns) ? props.columns : []; + }, [props.columns]); + const dataSourceUrl = useCallback((payload) => { + return API.CalculateService.getSyMixSum(payload); + }, [props.dataSourceUrl]); + useEffect(() => { + if (!_.isEmpty(props.payload)) { + setLoading(true); + dataSourceUrl(props.payload).then(({ data }) => { + setLoading(false); + const { data: result, status } = data; + if (status) setSumRow(result.sumRow || {}); + }); + } + }, [props.payload]); + return (<> + { + _.map(columns.slice(1), (item: any, index) => { + return + { + loading ? : + {sumRow[item.dataIndex] || "-"} + } + ; + }) + } + ); +}; + +export default welfareFixedTotal;