diff --git a/src/pages/OCTable/index.tsx b/src/pages/OCTable/index.tsx
index 87ca8bf..133c470 100644
--- a/src/pages/OCTable/index.tsx
+++ b/src/pages/OCTable/index.tsx
@@ -65,10 +65,10 @@ const OCTable: FC = (props) => {
{excelResultValue}
{
- showDifference &&
+ showDifference && !!parseInt(calculateDifference(acctResultValue, excelResultValue || 0)) &&
{lanObj["差值"]}:
- {calculateDifference(acctResultValue, excelResultValue)}
+ {calculateDifference(acctResultValue, excelResultValue || 0)}
}
;
@@ -104,7 +104,7 @@ const OCTable: FC = (props) => {
return {
@@ -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;