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