From c8dabd2918a99cbe7ba0d18bcb1bd41d240bad68 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Tue, 25 Feb 2025 15:22:10 +0800 Subject: [PATCH 1/3] master --- src/pages/calcTable/calcFixedTotal.tsx | 2 +- src/pages/calcTable/index.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/calcTable/calcFixedTotal.tsx b/src/pages/calcTable/calcFixedTotal.tsx index 6e61bbd..b450542 100644 --- a/src/pages/calcTable/calcFixedTotal.tsx +++ b/src/pages/calcTable/calcFixedTotal.tsx @@ -61,7 +61,7 @@ const calcFixedTotal: FunctionComponent = (props) => { return { loading ? : - {!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"} + {(sumRow && !_.isNil(sumRow[item.dataIndex])) ? sumRow[item.dataIndex] : "-"} } ; }) diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index c2d96ac..0e74e6d 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -239,9 +239,9 @@ const index: FunctionComponent = (props) => { }); }; const rowSelection = { - columnWidth: 60, - columnTitle: isDetailTable && !showTotalCell ? "序号" : "", - renderCell: (value: boolean, record: any, index: number, originNode: React.ReactNode) => (isDetailTable && !showTotalCell ? {index + 1} : originNode), + columnWidth: 50, + columnTitle: isDetailTable ? "序号" : "", + renderCell: (value: boolean, record: any, index: number, originNode: React.ReactNode) => (isDetailTable ? {index + 1} : originNode), selectedRowKeys, preserveSelectedRowKeys: true, onChange: (rowKeys: React.Key[]) => { From ccdd0b881814b5c3c93ece9d0701fd09336c515a Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Thu, 13 Mar 2025 15:12:03 +0800 Subject: [PATCH 2/3] master --- public/css/iconfont/demo_index.html | 75 ++++++++++- public/css/iconfont/iconfont.css | 18 ++- public/css/iconfont/iconfont.js | 2 +- public/css/iconfont/iconfont.json | 21 +++ public/css/iconfont/iconfont.ttf | Bin 7020 -> 7496 bytes public/css/iconfont/iconfont.woff | Bin 4340 -> 4620 bytes public/css/iconfont/iconfont.woff2 | Bin 3576 -> 3796 bytes src/pages/standingbookTable/index.tsx | 184 +++++++++++--------------- 8 files changed, 187 insertions(+), 113 deletions(-) diff --git a/public/css/iconfont/demo_index.html b/public/css/iconfont/demo_index.html index 290bfca..ce27f9e 100644 --- a/public/css/iconfont/demo_index.html +++ b/public/css/iconfont/demo_index.html @@ -54,6 +54,24 @@
    +
  • + +
    export
    +
    &#xe61e;
    +
  • + +
  • + +
    对比
    +
    &#xe617;
    +
  • + +
  • + +
    import
    +
    &#xe73a;
    +
  • +
  • error
    @@ -186,9 +204,9 @@
    @font-face {
       font-family: 'iconfont';
    -  src: url('iconfont.woff2?t=1723796605504') format('woff2'),
    -       url('iconfont.woff?t=1723796605504') format('woff'),
    -       url('iconfont.ttf?t=1723796605504') format('truetype');
    +  src: url('iconfont.woff2?t=1741245710478') format('woff2'),
    +       url('iconfont.woff?t=1741245710478') format('woff'),
    +       url('iconfont.ttf?t=1741245710478') format('truetype');
     }
     

    第二步:定义使用 iconfont 的样式

    @@ -214,6 +232,33 @@
      +
    • + +
      + export +
      +
      .icon-export +
      +
    • + +
    • + +
      + 对比 +
      +
      .icon-duibi +
      +
    • + +
    • + +
      + import +
      +
      .icon-import +
      +
    • +
    • @@ -412,6 +457,30 @@
        +
      • + +
        export
        +
        #icon-export
        +
      • + +
      • + +
        对比
        +
        #icon-duibi
        +
      • + +
      • + +
        import
        +
        #icon-import
        +
      • +
      • {record?.userName} + }; + } return { - title: "姓名", dataIndex, fixed: "left", width: 150, - render: (_: any, record: Partial) => ( - {record?.userName} - ) + dataIndex, + width: 150, + title: }; } - return { - dataIndex, width: 150, - title: - }; - }); + ); setDataSource(dataSource); setColumns( - !showOperates ? conventColumns : - [ - ...conventColumns, - { - title: "操作", - dataIndex: "operate", - fixed: "right", - width: 120, - render: (_: any, record: any) => { - return ( - - ); + !showOperates + ? conventColumns + : [ + ...conventColumns, + { + title: "操作", + dataIndex: "operate", + fixed: "right", + width: 120, + render: (_: any, record: any) => { + return ( + + ); + } } - } - ] + ] ); setPageInfo({ pageNum, size, total }); setSelected(selectedRowKeys); - const confCode: any = await API.CalculateService.getSysconfcode({ code: "OPEN_ACCT_RESULT_SUM" }); - setShowSumrow(confCode.data.status && confCode.data.data === "1"); - if (confCode.data.status && confCode.data.data === "1") { - const sumRowlist: any = selectedKey === "1" ? await API.CalculateService.siaccountDetailCommonListSum(sumpayload) : - selectedKey === "3" ? await API.CalculateService.siaccountDetailSupplementaryListSum(sumpayload) : - selectedKey === "regression" ? await API.CalculateService.siaccountDetailRecessionListSum(sumpayload) : - selectedKey === "difference" ? await API.CalculateService.siaccountDetailBalanceListSum(sumpayload) : { - data: { - status: false, - data: { sumRow: {} } - } - }; - if (sumRowlist.data.status) { - if (!_.isEmpty(sumRowlist.data.data.sumRow)) { - setSumRow(sumRowlist.data.data.sumRow); - } else { - setSumRow({ [new Date().getTime()]: new Date().getTime() }); - } - } - if (sumRowlist.data.status && _.isNil(sumRowlist.data.data.sumRow)) { - setSumRow({ [new Date().getTime()]: new Date().getTime() }); - } - } + setSumRow(sumRow); } }; const handleEdit = (record: any) => { window.parent.postMessage({ type: "turn", payload: { id: "EDIT", params: { ...record } } }, "*"); }; - const sizeChange = (pageobj: IPage) => { - }; + const sizeChange = (pageobj: IPage) => {}; const onChange = (pageobj: IPage) => { setPageInfo({ ...pageInfo, ...pageobj }); - window.parent.postMessage( - { - type: "turn", - payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } } - }, - "*" - ); + window.parent.postMessage({ type: "turn", payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } } }, "*"); }; const rowSelection = { selectedRowKeys: selected, - columnWidth: 80, + columnWidth: 60, onChange: (selectedRowKeys: Array) => { setSelected(selectedRowKeys); - window.parent.postMessage( - { - type: "turn", - payload: { id: "ROWSELECT", params: { selectedRowKeys } } - }, - "*" - ); + window.parent.postMessage({ type: "turn", payload: { id: "ROWSELECT", params: { selectedRowKeys } } }, "*"); } }; - return { - if (_.isEmpty(columns) || !showSumrow) return; - return ( - - - { - _.isEmpty(sumRow) ? : - _.map([{}, ...columns], (item, index) => { - if (index === 0) { - return 总计; - } - return + return ( +
        { + if (_.isEmpty(sumRow)) return; + return ( + + + {_.map([{}, ...columns], (item, index) => { + if (index === 0) { + return ( + + 总计 + + ); + } + return ( + {!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"} - ; - }) - } - - - ); - }} - />; + + ); + })} + + + ); + }} + /> + ); }; export default StandingbookTable; From ed8f9a056b9a14cb2e02101e3b949078789d0671 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Thu, 13 Mar 2025 17:58:12 +0800 Subject: [PATCH 3/3] master --- src/pages/standingbookTable/index.tsx | 184 +++++++++++++++----------- 1 file changed, 106 insertions(+), 78 deletions(-) diff --git a/src/pages/standingbookTable/index.tsx b/src/pages/standingbookTable/index.tsx index 24474ad..f2ba017 100644 --- a/src/pages/standingbookTable/index.tsx +++ b/src/pages/standingbookTable/index.tsx @@ -1,8 +1,9 @@ import React, { FC, useEffect, useState } from "react"; -import { Button, Table, Typography } from "antd"; +import { Button, Spin, Table, Typography } from "antd"; import { exceptStr, paginationFun } from "@/utils/common"; import { defaultPage, IPage } from "@/common/types"; import styles from "@/pages/atdTable/components/index.less"; +import API from "@/api"; const { Text } = Typography; const StandingbookTable: FC = (props) => { @@ -11,6 +12,7 @@ const StandingbookTable: FC = (props) => { const [dataSource, setDataSource] = useState>([]); const [pageInfo, setPageInfo] = useState(defaultPage); const [sumRow, setSumRow] = useState>({}); + const [showSumrow, setShowSumrow] = useState(false); useEffect(() => { window.parent.postMessage({ type: "init" }, "*"); @@ -22,108 +24,134 @@ const StandingbookTable: FC = (props) => { const receiveMessageFromIndex = async (event: any) => { const data: any = exceptStr(event.data); if (!_.isEmpty(data)) { - const { columns, dataSource, pageInfo, showOperates, selectedRowKeys, sumRow } = data; + const { + columns, dataSource, pageInfo, showOperates, selectedRowKeys, + sumpayload, selectedKey + } = data; const { current: pageNum, pageSize: size, total } = pageInfo; - const conventColumns = _.map( - _.filter(columns, (it) => it.dataIndex !== "id"), - (item) => { - const { dataIndex } = item; - if (dataIndex === "employeeId") { - return { - title: "姓名", - dataIndex, - fixed: "left", - width: 150, - render: (_: any, record: Partial) => {record?.userName} - }; - } + const conventColumns = _.map(_.filter(columns, it => it.dataIndex !== "id"), item => { + const { dataIndex } = item; + if (dataIndex === "employeeId") { return { - dataIndex, - width: 150, - title: + title: "姓名", dataIndex, fixed: "left", width: 150, + render: (_: any, record: Partial) => ( + {record?.userName} + ) }; } - ); + return { + dataIndex, width: 150, + title: + }; + }); setDataSource(dataSource); setColumns( - !showOperates - ? conventColumns - : [ - ...conventColumns, - { - title: "操作", - dataIndex: "operate", - fixed: "right", - width: 120, - render: (_: any, record: any) => { - return ( - - ); - } + !showOperates ? conventColumns : + [ + ...conventColumns, + { + title: "操作", + dataIndex: "operate", + fixed: "right", + width: 120, + render: (_: any, record: any) => { + return ( + + ); } - ] + } + ] ); setPageInfo({ pageNum, size, total }); setSelected(selectedRowKeys); - setSumRow(sumRow); + const confCode: any = await API.CalculateService.getSysconfcode({ code: "OPEN_ACCT_RESULT_SUM" }); + setShowSumrow(confCode.data.status && confCode.data.data === "1"); + if (confCode.data.status && confCode.data.data === "1") { + const sumRowlist: any = selectedKey === "1" ? await API.CalculateService.siaccountDetailCommonListSum(sumpayload) : + selectedKey === "3" ? await API.CalculateService.siaccountDetailSupplementaryListSum(sumpayload) : + selectedKey === "regression" ? await API.CalculateService.siaccountDetailRecessionListSum(sumpayload) : + selectedKey === "difference" ? await API.CalculateService.siaccountDetailBalanceListSum(sumpayload) : { + data: { + status: false, + data: { sumRow: {} } + } + }; + if (sumRowlist.data.status) { + if (!_.isEmpty(sumRowlist.data.data.sumRow)) { + setSumRow(sumRowlist.data.data.sumRow); + } else { + setSumRow({ [new Date().getTime()]: new Date().getTime() }); + } + } + if (sumRowlist.data.status && _.isNil(sumRowlist.data.data.sumRow)) { + setSumRow({ [new Date().getTime()]: new Date().getTime() }); + } + } } }; const handleEdit = (record: any) => { window.parent.postMessage({ type: "turn", payload: { id: "EDIT", params: { ...record } } }, "*"); }; - const sizeChange = (pageobj: IPage) => {}; + const sizeChange = (pageobj: IPage) => { + }; const onChange = (pageobj: IPage) => { setPageInfo({ ...pageInfo, ...pageobj }); - window.parent.postMessage({ type: "turn", payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } } }, "*"); + window.parent.postMessage( + { + type: "turn", + payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } } + }, + "*" + ); }; const rowSelection = { selectedRowKeys: selected, - columnWidth: 60, + columnWidth: 80, onChange: (selectedRowKeys: Array) => { setSelected(selectedRowKeys); - window.parent.postMessage({ type: "turn", payload: { id: "ROWSELECT", params: { selectedRowKeys } } }, "*"); + window.parent.postMessage( + { + type: "turn", + payload: { id: "ROWSELECT", params: { selectedRowKeys } } + }, + "*" + ); } }; - return ( -
        { - if (_.isEmpty(sumRow)) return; - return ( - - - {_.map([{}, ...columns], (item, index) => { - if (index === 0) { - return ( - - 总计 - - ); - } - return ( - + return
        { + if (_.isEmpty(columns) || !showSumrow) return; + return ( + + + { + _.isEmpty(sumRow) ? : + _.map([{}, ...columns], (item, index) => { + if (index === 0) { + return 总计; + } + return {!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"} - - ); - })} - - - ); - }} - /> - ); + ; + }) + } + + + ); + }} + />; }; export default StandingbookTable;