|
|
|
@ -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) => {
|
|
|
|
@ -20,12 +21,13 @@ const StandingbookTable: FC = (props) => {
|
|
|
|
|
window.removeEventListener("message", receiveMessageFromIndex, false);
|
|
|
|
|
};
|
|
|
|
|
}, []);
|
|
|
|
|
const receiveMessageFromIndex = (event: any) => {
|
|
|
|
|
const receiveMessageFromIndex = async (event: any) => {
|
|
|
|
|
const data: any = exceptStr(event.data);
|
|
|
|
|
console.log("antd4", data);
|
|
|
|
|
if (!_.isEmpty(data)) {
|
|
|
|
|
const {
|
|
|
|
|
columns, dataSource, pageInfo, showOperates, selectedRowKeys,
|
|
|
|
|
showSum, siaccountSum
|
|
|
|
|
sumpayload, selectedKey
|
|
|
|
|
} = data;
|
|
|
|
|
const { current: pageNum, pageSize: size, total } = pageInfo;
|
|
|
|
|
const conventColumns = _.map(_.filter(columns, it => it.dataIndex !== "id"), item => {
|
|
|
|
@ -61,10 +63,31 @@ const StandingbookTable: FC = (props) => {
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
setSelected(selectedRowKeys);
|
|
|
|
|
setShowSumrow(showSum);
|
|
|
|
|
setSumRow(siaccountSum);
|
|
|
|
|
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() });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const handleEdit = (record: any) => {
|
|
|
|
@ -113,15 +136,16 @@ const StandingbookTable: FC = (props) => {
|
|
|
|
|
<Table.Summary fixed>
|
|
|
|
|
<Table.Summary.Row>
|
|
|
|
|
{
|
|
|
|
|
_.map(columns, (item, index) => {
|
|
|
|
|
if (index === 0) {
|
|
|
|
|
return <Table.Summary.Cell colSpan={2} index={0} key={index}><Text
|
|
|
|
|
type="danger">总计</Text></Table.Summary.Cell>;
|
|
|
|
|
}
|
|
|
|
|
return <Table.Summary.Cell index={index} key={index}>
|
|
|
|
|
<Text type="danger">{!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"}</Text>
|
|
|
|
|
</Table.Summary.Cell>;
|
|
|
|
|
})
|
|
|
|
|
_.isEmpty(sumRow) ? <Spin tip="加载中"/> :
|
|
|
|
|
_.map(columns, (item, index) => {
|
|
|
|
|
if (index === 0) {
|
|
|
|
|
return <Table.Summary.Cell colSpan={2} index={0} key={index}><Text
|
|
|
|
|
type="danger">总计</Text></Table.Summary.Cell>;
|
|
|
|
|
}
|
|
|
|
|
return <Table.Summary.Cell index={index} key={index}>
|
|
|
|
|
<Text type="danger">{!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"}</Text>
|
|
|
|
|
</Table.Summary.Cell>;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</Table.Summary.Row>
|
|
|
|
|
</Table.Summary>
|
|
|
|
|