diff --git a/config/config.dev.ts b/config/config.dev.ts index bb4d66e..436ada0 100644 --- a/config/config.dev.ts +++ b/config/config.dev.ts @@ -13,7 +13,7 @@ export default defineConfig({ // changeOrigin: true, // }, '/api': { - target: 'http://192.168.10.11:7602/api', + target: 'http://192.168.0.114:7603/api', changeOrigin: true, pathRewrite: { '^/api': '', diff --git a/config/config.ts b/config/config.ts index 8f20d00..f863087 100644 --- a/config/config.ts +++ b/config/config.ts @@ -37,7 +37,7 @@ export default defineConfig({ }, }, dynamicImport: { - loading: '@/lib/PageLoading', + // loading: '@/lib/PageLoading', }, extraBabelPlugins: [], cssLoader: { diff --git a/src/layouts/config.js b/src/layouts/config.js index db15a54..f964fa8 100644 --- a/src/layouts/config.js +++ b/src/layouts/config.js @@ -6,6 +6,7 @@ module.exports = { '/manage/editor': 'blank', '/calculateDetail.*': 'blank', '/atdTable.*': 'blank', + '/previewTable.*': 'blank', '/manage.*': 'manage', '/portal.*': 'template', '/passport/oauth-in': 'blank', diff --git a/src/pages/previewTable/index.tsx b/src/pages/previewTable/index.tsx new file mode 100644 index 0000000..3bc9bbb --- /dev/null +++ b/src/pages/previewTable/index.tsx @@ -0,0 +1,77 @@ +import React, { FC, useEffect, useState } from "react"; +import { Table, Typography } from "antd"; +import styles from "@/pages/atdTable/components/index.less"; +import { exceptStr, paginationFun } from "@/utils/common"; +import { defaultPage, IPage } from "@/common/types"; + +const { Text } = Typography; +const PreviewTable: FC = (props) => { + const [columns, setColumns] = useState>([]); + const [dataSource, setDataSource] = useState>([]); + const [pageInfo, setPageInfo] = useState(defaultPage); + const [sumRow, setSumRow] = 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, salaryBillSendSum } = data; + const { current: pageNum, pageSize: size, total } = pageInfo; + setDataSource(dataSource); + setColumns(columns); + setSumRow(salaryBillSendSum); + setPageInfo({ pageNum, size, total }); + } + }; + const sizeChange = (pageobj: IPage) => { + }; + const onChange = (pageobj: IPage) => { + setPageInfo({ ...pageInfo, ...pageobj }); + window.parent.postMessage( + { + type: "turn", + payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } } + }, + "*" + ); + }; + return { + if (_.isEmpty(columns)) return; + return ( + + + { + _.map(columns, (item, index) => { + if (index === 0) { + return 总计; + } + return + {sumRow[item.dataIndex] || "-"} + ; + }) + } + + + ); + }} + />; +}; + +export default PreviewTable;