diff --git a/pc4mobx/hrmSalary/apis/calculate.js b/pc4mobx/hrmSalary/apis/calculate.js index 371a8763..44b57717 100644 --- a/pc4mobx/hrmSalary/apis/calculate.js +++ b/pc4mobx/hrmSalary/apis/calculate.js @@ -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()); +}; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/index.less b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/index.less index 9a76c465..1373bb3d 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/index.less +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/index.less @@ -12,6 +12,10 @@ .tableWrapper { flex: 1; overflow: hidden; + + .ant-spin-nested-loading, .ant-spin-container { + height: 100%; + } } .topContent { diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js index 4ba30018..b3b61565 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js @@ -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 ( - - {userName} - - ); - } - }; - it.title = "姓名"; - } - return { - ...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 ( - - {userName} - - ); - } - }; - it.title = "姓名"; - } - return { - ...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 {costCenter.name || ""}; - } - }; - } - return { - ...item, - render: (text) => { - return {text}; - } - }; - }); - !getQueryString("type") && (columns = [ - ...columns, - { - title: "操作", - dataIndex: "operate", - fixed: "right", - width: "120px", - render: (text, record) => { - return ( -
- ); - } - } - ]); return (