产品-优化社保福利台账页面的合计行渲染逻辑

This commit is contained in:
黎永顺 2023-04-26 17:27:32 +08:00
parent be3204e8d0
commit 003b3d6144
6 changed files with 32 additions and 106 deletions

View File

@ -162,7 +162,7 @@ class FieldSlide extends Component {
this.setState({
name: "",
useInEmployeeSalary: "1",
useDefault: "0",
useDefault: "1",
sharedType: "0",
taxAgentIds: "",
dataType: "number",

View File

@ -5,8 +5,7 @@ import { Button, Spin } from "antd";
import { getQueryString } from "../../../util/url";
import { removePropertyCondition } from "../../../util/response";
import { getSearchs } from "../../../util";
import { getPayrollDetailList, getPayrollDetailSa, getPayrollInfo, salaryBillSendSum } from "../../../apis/payroll";
import { sysConfCodeRule } from "../../../apis/ruleconfig";
import { getPayrollDetailList, getPayrollDetailSa, getPayrollInfo } from "../../../apis/payroll";
import "./index.less";
@inject("payrollStore")
@ -17,8 +16,7 @@ export default class PayrollDetail extends React.Component {
this.state = {
salarySendDetailBaseInfo: {}, loading: false,
condition: [], dataSource: [], columns: [],
pageInfo: { current: 1, pageSize: 10, total: 0 },
salaryBillSendSum: {}, showSum: false
pageInfo: { current: 1, pageSize: 10, total: 0 }
};
}
@ -54,16 +52,11 @@ export default class PayrollDetail extends React.Component {
}
}
if (type === "init") {
const { status, data: sysData } = await this.sysConfCodeRule();
const { data: { sumRow } } = await this.salaryBillSendSum();
const salaryBillSendSum = _.reduce(_.keys(sumRow), (pre, cur) => (_.assign(pre, { [`${cur}_salaryItem`]: sumRow[cur] })), {});
this.setState({ showSum: status && sysData === "1", salaryBillSendSum });
childFrameObj.contentWindow.postMessage(JSON.stringify({
dataSource,
columns,
pageInfo,
showSum: status && sysData === "1",
salaryBillSendSum
sumpayload: { salarySendId: getQueryString("id") }
}), "*");
this.getPayrollDetailList({ child: type });
}
@ -110,25 +103,18 @@ export default class PayrollDetail extends React.Component {
})),
pageInfo: { ...pageInfo, current, pageSize, total }
}, () => {
const { pageInfo, dataSource, columns, salaryBillSendSum, showSum } = this.state;
const { pageInfo, dataSource, columns } = this.state;
(child === "PAGEINFO" || child === "init") &&
childFrameObj.contentWindow.postMessage(JSON.stringify({
dataSource,
columns,
pageInfo, showSum,
salaryBillSendSum
pageInfo,
sumpayload: { salarySendId: getQueryString("id") }
}), "*");
});
}
}).catch(() => this.setState({ loading: false }));
};
salaryBillSendSum = () => {
const salarySendId = getQueryString("id");
return salaryBillSendSum({ salarySendId });
};
sysConfCodeRule = () => {
return sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" });
};
handleExportAll = () => {
const salarySendId = getQueryString("id");
const url = `${window.location.origin}/api/bs/hrmsalary/salaryBill/send/exportDetailList?salarySendId=${salarySendId}`;

View File

@ -13,12 +13,7 @@ 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 { sysConfCodeRule } from "../../../../apis/ruleconfig";
import { getCalculateProgress } from "../../../../apis/calculate";
import RegEditDetial from "./regEditDetial";
import SupplementarySlide from "./supplementarySlide";
import _ from "lodash";
@ -80,15 +75,7 @@ export default class NormalIndex extends Component {
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 } } = status && sysData === "1" && selectedKey === "1" ?
await this.siaccountDetailCommonListSum() :
status && sysData === "1" ? await this.siaccountDetailSupplementaryListSum() : { data: { sumRow: {} } };
this.setState({
showSum: status && sysData === "1",
siaccountSum: (status && sysData === "1") ? siaccountSum : {}
}, () => this.postMessageToChild());
this.postMessageToChild();
} else if (type === "turn") {
if (id === "PAGEINFO") {
const { pageNum: current, size: pageSize } = params;
@ -111,21 +98,6 @@ export default class NormalIndex extends Component {
}
}
};
sysConfCodeRule = () => {
return sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" });
};
siaccountDetailCommonListSum = () => {
const { searchValue: userName } = this.state;
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
return siaccountDetailCommonListSum({ billMonth, paymentOrganization, userName });
};
siaccountDetailSupplementaryListSum = () => {
const { searchValue: userName } = this.state;
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
return siaccountDetailSupplementaryListSum({ billMonth, paymentOrganization, userName });
};
componentWillUnmount() {
if (this.timer) {
@ -152,20 +124,22 @@ export default class NormalIndex extends Component {
}
postMessageToChild = () => {
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
const childFrameObj = document.getElementById("atdTable");
const { current, pageSize, tableData, selectedRowKeys, showSum, siaccountSum } = this.state;
const { current, pageSize, tableData, selectedRowKeys, showSum, siaccountSum, searchValue: userName } = this.state;
const { list: dataSource, total, columns } = tableData;
const pageInfo = { current, pageSize, total };
childFrameObj.contentWindow.postMessage(JSON.stringify({
dataSource, columns, pageInfo,
selectedRowKeys, showSum, siaccountSum,
selectedRowKeys, selectedKey: this.props.selectedKey,
sumpayload: { billMonth, paymentOrganization, userName },
showOperates: !getQueryString("type")
}), "*");
};
handleSearch(value) {
const { billMonth, selectedKey, paymentOrganization } = this.props;
const { current } = this.state;
selectedKey === "1"
? this.getNormalList({
billMonth,
@ -256,27 +230,19 @@ export default class NormalIndex extends Component {
}
};
getNormalList = async (payload = {}) => {
const { status, data: sysData } = await this.sysConfCodeRule();
const { data: { sumRow: siaccountSum } } = status && sysData === "1" ? await this.siaccountDetailCommonListSum() : { data: { sumRow: {} } };
const { getNormalList } = this.props.standingBookStore;
getNormalList({ ...payload }).then(({ list, columns = [], total }) => {
this.setState({
showSum: status && sysData === "1",
siaccountSum,
tableData: { list, total, columns }
}, () => this.postMessageToChild());
});
};
getSupplementaryList = async (payload = {}) => {
const { status, data: sysData } = await this.sysConfCodeRule();
const { data: { sumRow: siaccountSum } } = status && sysData === "1" ? await this.siaccountDetailSupplementaryListSum() : { data: { sumRow: {} } };
const { getSupplementaryList } = this.props.standingBookStore;
getSupplementaryList({
...payload
}).then(({ list, columns = [], total }) => {
this.setState({
showSum: status && sysData === "1",
siaccountSum,
tableData: { list, columns, total }
}, () => this.postMessageToChild());
});

View File

@ -270,7 +270,7 @@ class RegEditDetial extends Component {
}
</div>
}
onClose={onCancel}
onClose={() => onCancel()}
showMask={true}
/>
);

View File

@ -8,8 +8,6 @@ import React, { Component } from "react";
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 = {
@ -27,8 +25,7 @@ class RegList extends Component {
loading: {
query: false
},
showSum: false,
siaccountSum: {},
datalistPayload: {},
pageInfo: {
current: 1,
pageSize: 10,
@ -43,17 +40,10 @@ class RegList extends Component {
}
handleReceive = async ({ data }) => {
const { type: listType, onEdit, onChangeRowkey } = this.props;
const { onEdit, onChangeRowkey } = this.props;
const { type, payload: { id, params } = {} } = data;
if (type === "init") {
const { status, data: sysData } = await this.sysConfCodeRule();
const { data: { sumRow: siaccountSum } } = status && sysData === "1" && listType === "regression" ?
await this.siaccountDetailRecessionListSum() :
status && sysData === "1" ? await this.siaccountDetailBalanceListSum() : { data: { sumRow: {} } };
this.setState({
showSum: status && sysData === "1",
siaccountSum: (status && sysData === "1") ? siaccountSum : {}
}, () => this.postMessageToChild());
this.postMessageToChild();
} else if (type === "turn") {
if (id === "PAGEINFO") {
const { pageNum: current, size: pageSize } = params;
@ -68,31 +58,19 @@ class RegList extends Component {
}
};
postMessageToChild = () => {
const paymentStatus = "3";
const creator = Number(getQueryString("creator"));
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
const childFrameObj = document.getElementById("atdTable");
const { pageInfo, dataSource, columns, selectedRowKeys, showSum, siaccountSum } = this.state;
const { pageInfo, dataSource, columns, selectedRowKeys, datalistPayload } = this.state;
childFrameObj.contentWindow.postMessage(JSON.stringify({
dataSource, columns, pageInfo,
selectedRowKeys, showSum, siaccountSum,
selectedRowKeys, selectedKey: this.props.type,
sumpayload: { billMonth, paymentOrganization, creator, paymentStatus, ...datalistPayload },
showOperates: !getQueryString("type")
}), "*");
};
sysConfCodeRule = () => {
return sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" });
};
siaccountDetailRecessionListSum = (module = {}) => {
const paymentStatus = "3";
const creator = Number(getQueryString("creator"));
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
return siaccountDetailRecessionListSum({ creator, paymentStatus, billMonth, paymentOrganization, ...module });
};
siaccountDetailBalanceListSum = (module = {}) => {
const paymentStatus = "3";
const creator = Number(getQueryString("creator"));
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
return siaccountDetailBalanceListSum({ creator, paymentStatus, billMonth, paymentOrganization, ...module });
};
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible) {
@ -107,12 +85,8 @@ class RegList extends Component {
handleResetSelectRowKeys = (selectedRowKeys) => {
this.setState({ selectedRowKeys });
};
recessionList = async (module) => {
recessionList = (module) => {
const { type } = this.props;
const { status: sysStatus, data: sysData } = await this.sysConfCodeRule();
const { data: { sumRow: siaccountSum } } = sysStatus && sysData === "1" && type === "regression" ?
await this.siaccountDetailRecessionListSum({ ...module }) :
sysStatus && sysData === "1" ? await this.siaccountDetailBalanceListSum({ ...module }) : { data: { sumRow: {} } };
const { loading, pageInfo } = this.state;
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
@ -134,8 +108,7 @@ class RegList extends Component {
pageInfo: { ...pageInfo, current, pageSize, total },
dataSource,
columns,
showSum: sysStatus && sysData === "1",
siaccountSum
datalistPayload: module
}, () => this.postMessageToChild());
}
}).catch(() => {

View File

@ -1,6 +1,6 @@
import React from "react";
import { inject, observer } from "mobx-react";
import { Button, Col, message, Modal, Row, Switch, Dropdown, Menu } from "antd";
import { Button, Col, Dropdown, Menu, message, Modal, Row, Switch } from "antd";
import { WeaFormItem, WeaInputSearch, WeaSearchGroup, WeaTable, WeaTop } from "ecCom";
import { renderNoright } from "../../util"; // 渲染form数据的方法因为多个页面都会使用所以抽的公共方法在util中
import EditModal from "./editModal";
@ -303,7 +303,8 @@ export default class TaxAgent extends React.Component {
columns,
doInit,
hasRight,
getTaxAgentList
getTaxAgentList,
showOperateBtn
} = taxAgentStore;
if (!hasRight && !loading) {
@ -369,7 +370,7 @@ export default class TaxAgent extends React.Component {
</Menu>
}>
<a className="ant-dropdown-link" href="javaScript:void(0);">
<i className="icon-coms-more" />
<i className="icon-coms-more"/>
</a>
</Dropdown>
</div>
@ -403,7 +404,7 @@ export default class TaxAgent extends React.Component {
title="个税扣缴义务人" // 文字
icon={<i className="icon-coms-fa"/>} // 左侧图标
iconBgcolor="#F14A2D" // 左侧图标背景色
buttons={btns}
buttons={showOperateBtn ? btns : btns.slice(1)}
showDropIcon={true}>
<Row
gutter={16}