社保福利台账详情页面添加合计行列表
This commit is contained in:
parent
79ea27233f
commit
6babf486e3
|
|
@ -509,3 +509,14 @@ export const updateLockStatus = (params) => {
|
|||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
// 社保福利台账合计接口
|
||||
export const siaccountDetailCommonListSum = (params) => {
|
||||
return fetch("/api/bs/hrmsalary/siaccount/detail/common/list/sum", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@
|
|||
.tableWrapper {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
|
||||
.ant-spin-nested-loading, .ant-spin-container {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.topContent {
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@
|
|||
import React, { Component } from "react";
|
||||
import { Button, Icon, message, Modal, Spin, Tooltip } from "antd";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { toJS } from "mobx";
|
||||
import { WeaInputSearch, WeaNewScroll, WeaTable } from "ecCom";
|
||||
import { WeaInputSearch } from "ecCom";
|
||||
import { calcPageNo } from "../../../../util";
|
||||
import { getQueryString } from "../../../../util/url";
|
||||
import ProgressModal from "../../../../components/progressModal";
|
||||
import AcctResultImportModal from "../../../calculateDetail/acctResult/importModal/acctResultImportModal";
|
||||
import AdjustmentSlide from "./adjustmentSlide";
|
||||
import { getCalculateProgress } from "../../../../apis/calculate";
|
||||
import { getCalculateProgress, siaccountDetailCommonListSum } from "../../../../apis/calculate";
|
||||
import { sysConfCodeRule } from "../../../../apis/ruleconfig";
|
||||
import RegEditDetial from "./regEditDetial";
|
||||
import SupplementarySlide from "./supplementarySlide";
|
||||
import _ from "lodash";
|
||||
|
|
@ -54,7 +54,9 @@ export default class NormalIndex extends Component {
|
|||
title: "",
|
||||
editId: "",
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
showSum: false,
|
||||
siaccountSum: {}
|
||||
};
|
||||
this.timer = null;
|
||||
this.timerDelete = null;
|
||||
|
|
@ -68,36 +70,85 @@ export default class NormalIndex extends Component {
|
|||
selectedKey === "1"
|
||||
? this.getNormalList({ billMonth, current, paymentOrganization })
|
||||
: this.getSupplementaryList({ billMonth, current, paymentOrganization });
|
||||
window.addEventListener("message", this.handleReceive, false);
|
||||
}
|
||||
|
||||
handleReceive = async ({ data }) => {
|
||||
const { type, payload: { id, params } = {} } = data;
|
||||
if (type === "init") {
|
||||
const { selectedKey } = this.props;
|
||||
const { status, data: sysData } = await this.sysConfCodeRule();
|
||||
const { data: { sumRow: siaccountSum } } = await this.siaccountDetailCommonListSum();
|
||||
this.setState({
|
||||
showSum: selectedKey === "1" && status && sysData === "1",
|
||||
siaccountSum
|
||||
}, () => this.postMessageToChild());
|
||||
} else if (type === "turn") {
|
||||
if (id === "PAGEINFO") {
|
||||
const { pageNum: current, size: pageSize } = params;
|
||||
this.setState({ current, pageSize }, () => {
|
||||
const { billMonth, paymentOrganization, selectedKey } = this.props;
|
||||
const { current, pageSize } = this.state;
|
||||
selectedKey === "1" ?
|
||||
this.getNormalList({
|
||||
billMonth, current, pageSize, paymentOrganization
|
||||
}) :
|
||||
this.getSupplementaryList({
|
||||
billMonth, current, pageSize, paymentOrganization
|
||||
});
|
||||
});
|
||||
} else if (id === "ROWSELECT") {
|
||||
const { selectedRowKeys } = params;
|
||||
this.setState({ selectedRowKeys });
|
||||
} else if (id === "EDIT") {
|
||||
this.handleEditNormalStandingBook(params);
|
||||
}
|
||||
}
|
||||
};
|
||||
sysConfCodeRule = () => {
|
||||
return sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" });
|
||||
};
|
||||
siaccountDetailCommonListSum = () => {
|
||||
const { billMonth, paymentOrganization } = this.props;
|
||||
return siaccountDetailCommonListSum({ billMonth, paymentOrganization });
|
||||
};
|
||||
|
||||
componentWillUnmount() {
|
||||
// 清除轮询
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
}
|
||||
if (this.timerDelete) {
|
||||
clearInterval(this.timerDelete);
|
||||
}
|
||||
window.removeEventListener("message", this.handleReceive, false);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.selectedKey != this.props.selectedKey) {
|
||||
const { billMonth, paymentOrganization } = nextProps;
|
||||
this.setState({
|
||||
current: 1
|
||||
current: 1, selectedRowKeys: []
|
||||
}, () => {
|
||||
const { current } = this.state;
|
||||
nextProps.selectedKey === "1"
|
||||
? this.getNormalList({ billMonth, current, paymentOrganization })
|
||||
: this.getSupplementaryList({
|
||||
billMonth,
|
||||
current,
|
||||
paymentOrganization
|
||||
});
|
||||
: this.getSupplementaryList({ billMonth, current, paymentOrganization });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
postMessageToChild = () => {
|
||||
const childFrameObj = document.getElementById("atdTable");
|
||||
const { current, pageSize, tableData, selectedRowKeys, showSum, siaccountSum } = this.state;
|
||||
const { list: dataSource, total, columns } = tableData;
|
||||
const pageInfo = { current, pageSize, total };
|
||||
childFrameObj.contentWindow.postMessage(JSON.stringify({
|
||||
dataSource, columns, pageInfo,
|
||||
selectedRowKeys, showSum, siaccountSum,
|
||||
showOperates: !getQueryString("type")
|
||||
}), "*");
|
||||
};
|
||||
|
||||
handleSearch(value) {
|
||||
const { billMonth, selectedKey, paymentOrganization } = this.props;
|
||||
const { current } = this.state;
|
||||
|
|
@ -190,77 +241,30 @@ export default class NormalIndex extends Component {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
getNormalList = (payload = {}) => {
|
||||
getNormalList = async (payload = {}) => {
|
||||
const { status, data: sysData } = await this.sysConfCodeRule();
|
||||
const { data: { sumRow: siaccountSum } } = await this.siaccountDetailCommonListSum();
|
||||
const { getNormalList } = this.props.standingBookStore;
|
||||
getNormalList({ ...payload }).then(({ list, columns = [], total }) => {
|
||||
columns = _.map(_.filter(columns, it => it.dataIndex !== "id"), it => {
|
||||
if (it.dataIndex === "employeeId") {
|
||||
it = {
|
||||
...it,
|
||||
width: 150,
|
||||
fixed: "left",
|
||||
render: (text, r) => {
|
||||
const { userName, employeeId } = r;
|
||||
return (
|
||||
<span>
|
||||
{userName}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
};
|
||||
it.title = "姓名";
|
||||
}
|
||||
return {
|
||||
...it,
|
||||
title: <span dangerouslySetInnerHTML={{ __html: it.title }}/>,
|
||||
width: 150
|
||||
};
|
||||
});
|
||||
this.setState({
|
||||
tableData: {
|
||||
list,
|
||||
columns,
|
||||
total
|
||||
}
|
||||
});
|
||||
showSum: this.props.selectedKey === "1" && status && sysData === "1",
|
||||
siaccountSum,
|
||||
tableData: { list, total, columns }
|
||||
}, () => this.postMessageToChild());
|
||||
});
|
||||
};
|
||||
getSupplementaryList = (payload = {}) => {
|
||||
getSupplementaryList = async (payload = {}) => {
|
||||
const { status, data: sysData } = await this.sysConfCodeRule();
|
||||
const { data: { sumRow: siaccountSum } } = await this.siaccountDetailCommonListSum();
|
||||
const { getSupplementaryList } = this.props.standingBookStore;
|
||||
getSupplementaryList({
|
||||
...payload
|
||||
}).then(({ list, columns = [], total }) => {
|
||||
columns = _.map(_.filter(columns, it => it.dataIndex !== "id"), it => {
|
||||
if (it.dataIndex === "employeeId") {
|
||||
it = {
|
||||
...it,
|
||||
width: 150,
|
||||
fixed: "left",
|
||||
render: (text, r) => {
|
||||
const { userName, employeeId } = r;
|
||||
return (
|
||||
<span>
|
||||
{userName}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
};
|
||||
it.title = "姓名";
|
||||
}
|
||||
return {
|
||||
...it,
|
||||
title: <span dangerouslySetInnerHTML={{ __html: it.title }}/>,
|
||||
width: 150
|
||||
};
|
||||
});
|
||||
this.setState({
|
||||
tableData: {
|
||||
list,
|
||||
columns,
|
||||
total
|
||||
}
|
||||
});
|
||||
showSum: this.props.selectedKey === "1" && status && sysData === "1",
|
||||
siaccountSum,
|
||||
tableData: { list, columns, total }
|
||||
}, () => this.postMessageToChild());
|
||||
});
|
||||
};
|
||||
onSelectChange = selectedRowKeys => {
|
||||
|
|
@ -355,7 +359,6 @@ export default class NormalIndex extends Component {
|
|||
});
|
||||
};
|
||||
|
||||
// 核算按钮点击
|
||||
handleCommonAccountClick() {
|
||||
const { billMonth, selectedKey, paymentOrganization } = this.props;
|
||||
const { commonAccount } = this.props.standingBookStore;
|
||||
|
|
@ -426,7 +429,6 @@ export default class NormalIndex extends Component {
|
|||
.origin}${urlObj[selectedKey]}?billMonth=${billMonth}&paymentOrganization=${paymentOrganization}`;
|
||||
window.open(url, "_self");
|
||||
};
|
||||
|
||||
handleEditNormalStandingBook = (record) => {
|
||||
const { userName, id: editId } = record;
|
||||
const { returnEditPersonSlide } = this.state;
|
||||
|
|
@ -459,85 +461,8 @@ export default class NormalIndex extends Component {
|
|||
|
||||
render() {
|
||||
const { remarks, billMonth, selectedKey, paymentOrganization, standingBookStore } = this.props;
|
||||
const { selectedRowKeys, addProps, adjustSlide, importParams, returnEditPersonSlide } = this.state;
|
||||
const { addProps, adjustSlide, importParams, returnEditPersonSlide } = this.state;
|
||||
const { loading } = standingBookStore;
|
||||
let { list, columns, total } = this.state.tableData;
|
||||
const rowSelection = {
|
||||
selectedRowKeys,
|
||||
onChange: this.onSelectChange
|
||||
};
|
||||
const pagination = {
|
||||
total,
|
||||
current: this.state.current,
|
||||
showTotal: total => `共 ${total} 条`,
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
pageSizeOptions: ["10", "20", "50", "100"],
|
||||
onShowSizeChange: (current, pageSize) => {
|
||||
this.setState({ current, pageSize });
|
||||
selectedKey === "1"
|
||||
? this.getNormalList({ billMonth, current, pageSize, paymentOrganization })
|
||||
: this.getSupplementaryList({
|
||||
billMonth,
|
||||
current,
|
||||
pageSize,
|
||||
paymentOrganization
|
||||
});
|
||||
},
|
||||
onChange: current => {
|
||||
this.setState({ current });
|
||||
selectedKey === "1"
|
||||
? this.getNormalList({
|
||||
billMonth, current,
|
||||
pageSize: this.state.pageSize, paymentOrganization
|
||||
})
|
||||
: this.getSupplementaryList({
|
||||
billMonth,
|
||||
current,
|
||||
pageSize: this.state.pageSize,
|
||||
paymentOrganization
|
||||
});
|
||||
}
|
||||
};
|
||||
columns = _.map(toJS(columns), item => {
|
||||
if (item.dataIndex === "employeeId") {
|
||||
return { ...item };
|
||||
} else if (item.dataIndex === "costCenter") {
|
||||
return {
|
||||
...item,
|
||||
render: (text, record) => {
|
||||
const { costCenter } = record;
|
||||
return <a href={costCenter.url} className="tdEllipsis">{costCenter.name || ""}</a>;
|
||||
}
|
||||
};
|
||||
}
|
||||
return {
|
||||
...item,
|
||||
render: (text) => {
|
||||
return <span className="tdEllipsis" title={text}>{text}</span>;
|
||||
}
|
||||
};
|
||||
});
|
||||
!getQueryString("type") && (columns = [
|
||||
...columns,
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "operate",
|
||||
fixed: "right",
|
||||
width: "120px",
|
||||
render: (text, record) => {
|
||||
return (
|
||||
<div className="optWrapper">
|
||||
<a
|
||||
href="javascript:void(0);"
|
||||
className="mr10"
|
||||
onClick={() => this.handleEditNormalStandingBook(record)}
|
||||
>编辑</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
]);
|
||||
return (
|
||||
<div className="normalWapper">
|
||||
{
|
||||
|
|
@ -683,19 +608,14 @@ export default class NormalIndex extends Component {
|
|||
</div>
|
||||
{/* table */}
|
||||
<div className="tableWrapper">
|
||||
<WeaNewScroll height="100%">
|
||||
<Spin spinning={loading}>
|
||||
<WeaTable
|
||||
rowKey="id"
|
||||
columns={columns}
|
||||
dataSource={list}
|
||||
loading={loading}
|
||||
pagination={pagination}
|
||||
rowSelection={rowSelection}
|
||||
scroll={{ x: 1200 }}
|
||||
/>
|
||||
</Spin>
|
||||
</WeaNewScroll>
|
||||
<Spin spinning={loading}>
|
||||
<iframe
|
||||
style={{ border: 0, width: "100%", height: "100%" }}
|
||||
// src="http://localhost:7607/#/standingbookTable"
|
||||
src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/standingbookTable"
|
||||
id="atdTable"
|
||||
/>
|
||||
</Spin>
|
||||
{/*编辑弹框*/}
|
||||
<RegEditDetial {...returnEditPersonSlide} onCancel={this.handleCloseNormalStandingBookModal}/>
|
||||
<AdjustmentSlide
|
||||
|
|
|
|||
Loading…
Reference in New Issue