社保福利台账详情页面替换表格,添加合计行

This commit is contained in:
黎永顺 2023-04-06 11:24:47 +08:00
parent a336a63b73
commit 444857a0d8
5 changed files with 107 additions and 99 deletions

View File

@ -531,6 +531,28 @@ export const siaccountDetailSupplementaryListSum = (params) => {
body: JSON.stringify(params)
}).then(res => res.json());
};
// 社保福利台账退差合计接口
export const siaccountDetailRecessionListSum = (params) => {
return fetch("/api/bs/hrmsalary/siaccount/detail/recession/list/sum", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
// 社保福利台账补差合计接口
export const siaccountDetailBalanceListSum = (params) => {
return fetch("/api/bs/hrmsalary/siaccount/detail/balance/list/sum", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
// 导入薪资核算添加表头字段缓存
export const cacheImportField = (params) => {
return fetch("/api/bs/hrmsalary/salaryacct/acctresult/cacheImportField", {

View File

@ -77,6 +77,9 @@
.tableWrapper {
flex: 1;
overflow: hidden;
.ant-spin-nested-loading, .ant-spin-container {
height: 100%;
}
}
.tdEllipsis {

View File

@ -13,7 +13,11 @@ import { getQueryString } from "../../../../util/url";
import ProgressModal from "../../../../components/progressModal";
import AcctResultImportModal from "../../../calculateDetail/acctResult/importModal/acctResultImportModal";
import AdjustmentSlide from "./adjustmentSlide";
import { getCalculateProgress, siaccountDetailCommonListSum, siaccountDetailSupplementaryListSum } from "../../../../apis/calculate";
import {
getCalculateProgress,
siaccountDetailCommonListSum,
siaccountDetailSupplementaryListSum
} from "../../../../apis/calculate";
import { sysConfCodeRule } from "../../../../apis/ruleconfig";
import RegEditDetial from "./regEditDetial";
import SupplementarySlide from "./supplementarySlide";
@ -78,9 +82,11 @@ export default class NormalIndex extends Component {
if (type === "init") {
const { selectedKey } = this.props;
const { status, data: sysData } = await this.sysConfCodeRule();
const { data: { sumRow: siaccountSum } } = await this.siaccountDetailCommonListSum();
const { data: { sumRow: siaccountSum } } = selectedKey === "1" ?
await this.siaccountDetailCommonListSum() :
await this.siaccountDetailSupplementaryListSum();
this.setState({
showSum: selectedKey === "1" && status && sysData === "1",
showSum: status && sysData === "1",
siaccountSum
}, () => this.postMessageToChild());
} else if (type === "turn") {
@ -251,7 +257,7 @@ export default class NormalIndex extends Component {
const { getNormalList } = this.props.standingBookStore;
getNormalList({ ...payload }).then(({ list, columns = [], total }) => {
this.setState({
showSum: this.props.selectedKey === "1" && status && sysData === "1",
showSum: status && sysData === "1",
siaccountSum,
tableData: { list, total, columns }
}, () => this.postMessageToChild());
@ -265,7 +271,7 @@ export default class NormalIndex extends Component {
...payload
}).then(({ list, columns = [], total }) => {
this.setState({
showSum: this.props.selectedKey === "1" && status && sysData === "1",
showSum: status && sysData === "1",
siaccountSum,
tableData: { list, columns, total }
}, () => this.postMessageToChild());

View File

@ -5,9 +5,11 @@
* Date: 2022/11/23
*/
import React, { Component } from "react";
import { WeaTable } from "ecCom";
import { Spin } from "antd";
import { getQueryString } from "../../../../util/url";
import * as API from "../../../../apis/standingBook";
import { sysConfCodeRule } from "../../../../apis/ruleconfig";
import { siaccountDetailBalanceListSum, siaccountDetailRecessionListSum } from "../../../../apis/calculate";
import "./index.less";
const APIFox = {
@ -25,6 +27,8 @@ class RegList extends Component {
loading: {
query: false
},
showSum: false,
siaccountSum: {},
pageInfo: {
current: 1,
pageSize: 10,
@ -35,14 +39,67 @@ class RegList extends Component {
componentDidMount() {
this.recessionList();
window.addEventListener("message", this.handleReceive, false);
}
handleReceive = async ({ data }) => {
const { type: listType, onEdit, onChangeRowkey } = this.props;
const { type, payload: { id, params } = {} } = data;
if (type === "init") {
const { status, data: sysData } = await this.sysConfCodeRule();
const { data: { sumRow: siaccountSum } } = listType === "regression" ?
await this.siaccountDetailRecessionListSum() :
await this.siaccountDetailBalanceListSum();
this.setState({
showSum: status && sysData === "1",
siaccountSum
}, () => this.postMessageToChild());
} else if (type === "turn") {
if (id === "PAGEINFO") {
const { pageNum: current, size: pageSize } = params;
this.setState({ pageInfo: { ...this.state.pageInfo, current, pageSize } }, () => this.recessionList());
} else if (id === "ROWSELECT") {
const { selectedRowKeys } = params;
this.setState({ selectedRowKeys });
onChangeRowkey(selectedRowKeys);
} else if (id === "EDIT") {
onEdit(params);
}
}
};
postMessageToChild = () => {
const childFrameObj = document.getElementById("atdTable");
const { pageInfo, dataSource, columns, selectedRowKeys, showSum, siaccountSum } = this.state;
childFrameObj.contentWindow.postMessage(JSON.stringify({
dataSource, columns, pageInfo,
selectedRowKeys, showSum, siaccountSum,
showOperates: !getQueryString("type")
}), "*");
};
sysConfCodeRule = () => {
return sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" });
};
siaccountDetailRecessionListSum = () => {
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
return siaccountDetailRecessionListSum({ billMonth, paymentOrganization });
};
siaccountDetailBalanceListSum = () => {
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
return siaccountDetailBalanceListSum({ billMonth, paymentOrganization });
};
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible) {
this.recessionList();
}
}
componentWillUnmount() {
window.removeEventListener("message", this.handleReceive, false);
}
handleResetSelectRowKeys = (selectedRowKeys) => {
this.setState({ selectedRowKeys });
};
@ -68,105 +125,25 @@ class RegList extends Component {
this.setState({
pageInfo: { ...pageInfo, current, pageSize, total },
dataSource,
columns: _.map(_.filter(columns, it => it.dataIndex !== "id"), items => {
if (items.dataIndex === "employeeId") {
return {
...items,
width: 110,
title: "姓名",
render: (text, r) => {
const { userName } = r;
return (
<span>{userName}</span>
);
}
};
} else if (items.dataIndex === "costCenter") {
return {
...items,
width: 110,
render: (text, r) => {
const { costCenter } = r;
return (
<a href={costCenter.url} className="tdEllipsis">{costCenter.name || ""}</a>
);
}
};
}
return {
...items,
title: <span dangerouslySetInnerHTML={{ __html: items.title }}/>,
width: 120,
render: (text) => {
return <span className="tdEllipsis" title={text}>{text}</span>;
}
};
})
});
columns
}, () => this.postMessageToChild());
}
}).catch(() => {
this.setState({ loading: { ...loading, query: false } });
});
};
handleChangeRow = (selectedRowKeys) => {
const { onChangeRowkey } = this.props;
this.setState({ selectedRowKeys });
onChangeRowkey(selectedRowKeys);
};
render() {
const { loading, pageInfo, selectedRowKeys, dataSource, columns } = this.state;
const { onEdit } = this.props;
const pagination = {
...pageInfo,
showTotal: total => `${total}`,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],
onShowSizeChange: (current, pageSize) => {
this.setState({ pageInfo: { ...pageInfo, current, pageSize } }, () => {
this.recessionList();
});
},
onChange: (current) => {
this.setState({ pageInfo: { ...pageInfo, current } }, () => {
this.recessionList();
});
}
};
const rowSelection = {
selectedRowKeys,
onChange: this.handleChangeRow
};
const { loading } = this.state;
return (
<WeaTable
rowKey="id"
columns={!getQueryString("type") ? [
...columns,
{
title: "操作",
dataIndex: "operate",
fixed: "right",
width: "120px",
render: (text, record) => {
return (
<div className="optWrapper">
<a
href="javascript:void(0);"
className="mr10"
onClick={() => onEdit(record)}
>编辑</a>
</div>
);
}
}
] : [...columns]}
dataSource={dataSource}
loading={loading.query}
pagination={pagination}
rowSelection={rowSelection}
scroll={{ x: 900 }}
/>
<Spin spinning={loading.query}>
<iframe
style={{ border: 0, width: "100%", height: "100%" }}
// src="http://localhost:7607/#/standingbookTable"
src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/standingbookTable"
id="atdTable"
/>
</Spin>
);
}
}

View File

@ -134,7 +134,7 @@ class Regression extends Component {
selectKey={selectKey}
/>
<div className="tableWrapper">
<WeaNewScroll height="100%">
{/*<WeaNewScroll height="100%">*/}
<RegList
type="regression"
ref={dom => this.regListRef = dom}
@ -152,7 +152,7 @@ class Regression extends Component {
onCancel={this.handleCloseModal}
onSave={this.handleSave}
/>
</WeaNewScroll>
{/*</WeaNewScroll>*/}
</div>
</div>
);