1feature/2.9.9.2312.01-社保核算以及薪资账套查询优化

This commit is contained in:
黎永顺 2023-11-28 13:44:53 +08:00
parent 23f15bd423
commit 7cc9e422b1
8 changed files with 126 additions and 121 deletions

View File

@ -5,8 +5,8 @@
* Date: 2023/9/26
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTable } from "ecCom";
import { Alert } from "antd";
import { WeaLocaleProvider } from "ecCom";
import { Alert, Spin } from "antd";
import { comparisonResultList } from "../../../../apis/calculate";
const getLabel = WeaLocaleProvider.getLabel;
@ -21,9 +21,35 @@ class SalaryCalcOcList extends Component {
}
componentDidMount() {
this.comparisonResultList(this.props);
window.addEventListener("message", this.handleReceive, false);
}
componentWillUnmount() {
window.removeEventListener("message", this.handleReceive, false);
}
handleReceive = async ({ data }) => {
const { type, payload: { id, params } = {} } = data;
if (type === "init") {
this.comparisonResultList(this.props);
} else if (type === "turn") {
switch (id) {
case "PAGEINFO":
const { size: pageSize, pageNum: current } = params;
this.setState({
pageInfo: { ...this.state.pageInfo, current, pageSize }
}, () => this.comparisonResultList(this.props));
break;
case "FORMULA":
const { formulaDesc } = params;
this.setState({ formulaDesc });
break;
default:
break;
}
}
};
componentWillReceiveProps(nextProps, nextContext) {
if (
(nextProps.form.onlyDiffEmployee !== this.props.form.onlyDiffEmployee) ||
@ -34,6 +60,15 @@ class SalaryCalcOcList extends Component {
}
}
postMessageToChild = (payload = {}) => {
const i18n = {
"共": getLabel(18609, "共"), "条": getLabel(18256, "条"),
"总计": getLabel(523, "总计"), "系统值": getLabel(543280, "系统值"),
"线下值": getLabel(543281, "线下值"), "差值": getLabel(543282, "差值")
};
const childFrameObj = document.getElementById("atdTable");
childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*");
};
comparisonResultList = (props) => {
const { form, routeParams: { salaryAcctRecordId } } = props;
const { pageInfo } = this.state;
@ -42,85 +77,47 @@ class SalaryCalcOcList extends Component {
comparisonResultList(payload).then(({ status, data }) => {
this.setState({ loading: false });
if (status) {
const { list: dataSource, columns, pageNum: current, pageSize, total } = data;
const { columns, pageInfo: { pageNum: current, pageSize, total, list: dataSource } } = data;
this.setState({
dataSource, columns,
dataSource, columns: this.convertColumns(columns),
pageInfo: { ...pageInfo, current, pageSize, total }
}, () => {
const { pageInfo, dataSource, columns } = this.state;
this.postMessageToChild({ dataSource, pageInfo, columns });
});
}
}).catch(() => this.setState({ loading: false }));
};
render() {
const { dataSource, loading, columns, pageInfo, formulaDesc } = this.state;
const pagination = {
...pageInfo,
showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],
onShowSizeChange: (current, pageSize) => {
this.setState({
pageInfo: { ...pageInfo, current, pageSize }
}, () => this.comparisonResultList(this.props));
},
onChange: current => {
this.setState({
pageInfo: { ...pageInfo, current }
}, () => this.comparisonResultList(this.props));
convertColumns = (cols) => {
return _.map(cols, (item, index) => {
const col = { title: item.text, dataIndex: item.column };
if (_.isNaN(parseInt(item.column))) {
return item.fixed ? { ...col, width: 150, fixed: item.fixed } : index < 2 ? {
...col, width: 150, fixed: "left"
} : { ...col, width: 150 };
} else {
return { ...col, width: 180, children: this.convertColumns(item.children) };
}
};
});
};
render() {
const { loading, formulaDesc } = this.state;
return (
<React.Fragment>
<div className="wea-new-table ">
<Alert message={`${getLabel(18125, "公式")}${formulaDesc}`} type="info"/>
<WeaTable
rowKey="id" pagination={pagination} loading={loading} dataSource={dataSource}
scroll={{ x: 840, y: "calc(100vh - 246px)" }}
columns={_.map(columns, (o, i) => {
if (i > 1) {
if (i > 2) {
return {
...o, width: 180,
render: (__, record) => {
const formulaDesc = record["customParameters"][`${o["dataIndex"]}`];
const showDifference = record[`${o["dataIndex"]}_type`] === "number";
const { acctResultValue, excelResultValue } = record[o["dataIndex"]];
return <div className="comparison-column-item-container"
onClick={() => this.setState({ formulaDesc })}>
<div className="comparison-single-row">
<span>{getLabel(543280, "系统值")}</span>
<span>{acctResultValue}</span>
</div>
<div className="comparison-single-row">
<span>{getLabel(543281, "线下值")}</span>
<span>{excelResultValue}</span>
</div>
{
showDifference &&
<div className="comparison-single-row danger">
<span>{getLabel(543282, "差值")}</span>
<span>{calculateDifference(acctResultValue, excelResultValue)}</span>
</div>
}
</div>;
}
};
}
return { ...o, width: 180 };
}
return { ...o, width: 150, fixed: "left" };
})}
/>
</React.Fragment>
<Spin spinning={loading}>
<iframe
style={{ border: 0, width: "100%", height: "100%" }}
src="http://localhost:7607/#/OCTable"
// src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/OCTable"
id="atdTable"
/>
</Spin>
</div>
);
}
}
export default SalaryCalcOcList;
// 计算差值
const calculateDifference = (systemValue, excelValue) => {
if (_.isNil(systemValue) || _.isNil(excelValue)) return "";
const systemNum = Number(systemValue);
const excelNum = Number(excelValue);
return (systemNum - excelNum).toFixed(2);
};

View File

@ -55,29 +55,12 @@
overflow-y: hidden;
.wea-new-table {
background: #FFF;
height: calc(100% - 44px);
.ant-table-tbody {
td {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ant-spin-nested-loading, .ant-spin-container {
height: 100% !important;
}
.comparison-column-item-container {
cursor: pointer;
.comparison-single-row {
margin: 4px 0;
}
.danger {
color: #ff4d4f;
}
}
}
}
}

View File

@ -6,11 +6,13 @@
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaSwitch } from "comsMobx";
import { WeaFormItem, WeaLocaleProvider, WeaSearchGroup } from "ecCom";
import { Button } from "antd";
import { WeaSwitch } from "comsMobx";
import { WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";
import { searchConditions } from "../config";
import { getTaxAgentSelectList } from "../../../apis/taxAgent";
const getKey = WeaTools.getKey;
const getLabel = WeaLocaleProvider.getLabel;
@inject("ledgerStore")
@ -24,10 +26,32 @@ class LedgerSearchComp extends Component {
}
componentDidMount() {
const { ledgerStore: { searchForm } } = this.props;
searchForm.initFormFields(searchConditions);
this.getTaxAgentSelectList();
}
getTaxAgentSelectList = () => {
const { ledgerStore: { searchForm } } = this.props;
getTaxAgentSelectList().then(({ status, data }) => {
if (status) {
this.setState({
conditions: _.map(searchConditions, o => {
return {
...o,
items: _.map(o.items, j => {
if (getKey(j) === "taxAgentId") {
return {
...j,
options: _.map(data, g => ({ key: g.id, showname: g.content }))
};
}
return { ...j };
})
};
})
}, () => searchForm.initFormFields(this.state.conditions));
}
});
};
formRender = (form, condition) => {
const { isFormInit } = form, formParams = form.getFormParams();
let group = [];
@ -53,11 +77,12 @@ class LedgerSearchComp extends Component {
};
render() {
const { conditions } = this.state;
const { ledgerStore: { searchForm } } = this.props;
return (
<div className="ledgerSearch-Wrapper">
{this.formRender(searchForm, searchConditions)}
<Button type="primary">{getLabel(388113, "搜索")}</Button>
{this.formRender(searchForm, conditions)}
<Button type="primary" onClick={this.props.onSearch}>{getLabel(388113, "搜索")}</Button>
</div>
);
}

View File

@ -12,7 +12,7 @@ import { changeLedgerStatus, deleteLedger, getLedgerList } from "../../../apis/l
import CopyLedgerModal from "./copyLedgerModal";
import "./index.less";
@inject("taxAgentStore")
@inject("taxAgentStore", "ledgerStore")
@observer
class LedgerTable extends Component {
constructor(props) {
@ -42,9 +42,9 @@ class LedgerTable extends Component {
}
getLedgerList = (extra = {}) => {
const { name } = this.props;
const { ledgerStore: { searchForm } } = this.props;
const { pageInfo } = this.state;
const payload = { name, ...pageInfo, ...extra };
const payload = { ...searchForm.getFormParams(), ...pageInfo, ...extra };
this.setState({ loading: true });
getLedgerList(payload).then(({ status, data }) => {
this.setState({ loading: false });
@ -195,6 +195,7 @@ class LedgerTable extends Component {
pagination={pagination}
loading={loading}
columns={this.getColumns()}
scroll={{ y: "calc(100vh - 152px)" }}
/>
<CopyLedgerModal
{...copyLedgerModal}

View File

@ -6,7 +6,7 @@
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaInputSearch, WeaTop } from "ecCom";
import { WeaTop } from "ecCom";
import { Button } from "antd";
import LedgerTable from "./components/ledgerTable";
import LedgerSlide from "./components/ledgerSlide";
@ -61,12 +61,7 @@ class Index extends Component {
type="primary"
onClick={() => this.setState({ slideparams: { ...slideparams, visible: true } })}
>新建</Button>,
<LedgerSearchComp />
// <WeaInputSearch
// value={searchVal} placeholder="请输入薪资账套名称"
// onChange={searchVal => this.setState({ searchVal })}
// onSearch={() => this.setState({ doSearch: !doSearch })}
// />
<LedgerSearchComp onSearch={() => this.setState({ doSearch: !doSearch })}/>
];
return (
<WeaTop
@ -77,7 +72,7 @@ class Index extends Component {
buttons={showOperateBtn ? btns : btns.slice(-1)}
>
<div className="ledgerWrapper">
<LedgerTable name={searchVal} doSearch={doSearch} onEditLedger={this.handleEditLedger}/>
<LedgerTable doSearch={doSearch} onEditLedger={this.handleEditLedger}/>
<LedgerSlide
{...slideparams}
onCancel={this.handleResetLedger}

View File

@ -42,6 +42,10 @@
.wea-form-item {
padding: 0;
.ant-select-selection-selected-value {
width: 150px !important;
}
}
}

View File

@ -5,19 +5,19 @@ const { getLabel } = WeaLocaleProvider;
export const condition = [
{
items: [
{
colSpan: 2,
checkbox: false,
checkboxValue: false,
conditionType: "SELECT",
domkey: ["taxAgent"],
fieldcol: 18,
label: getLabel(111, "个税扣缴义务人"),
labelcol: 6,
options: [],
multiple: true,
viewAttr: 2
},
// {
// colSpan: 2,
// checkbox: false,
// checkboxValue: false,
// conditionType: "SELECT",
// domkey: ["taxAgent"],
// fieldcol: 18,
// label: getLabel(111, "个税扣缴义务人"),
// labelcol: 6,
// options: [],
// multiple: true,
// viewAttr: 2
// },
{
browserConditionParam: {
completeParams: {},

View File

@ -125,7 +125,7 @@ class StatisticalMicroSettingsSlide extends Component {
const { form, id, dimension, onClose } = this.props;
const [salaryStartMonth, salaryEndMonth] = salaryMonth;
const { department, employee, position, subCompany, taxAgent, ...extra } = form.getFormDatas();
const { value, valueSpan } = taxAgent;
// const { value, valueSpan } = taxAgent;
if (!salaryEndMonth || !salaryStartMonth) {
this.refs.weaError.showError();
return;
@ -137,7 +137,7 @@ class StatisticalMicroSettingsSlide extends Component {
employee: _.map(employee.valueObj, it => ({ id: it.id, name: it.name })),
// position: _.map(position.valueObj, it => ({ id: it.id, name: it.name })),
subCompany: _.map(subCompany.valueObj, it => ({ id: it.id, name: it.name })),
taxAgent: value ? _.map(value.split(","), (it, idx) => ({ id: it, name: valueSpan.split(",")[idx] })) : [],
// taxAgent: value ? _.map(value.split(","), (it, idx) => ({ id: it, name: valueSpan.split(",")[idx] })) : [],
items: dataSource,
salaryEndMonth: salaryEndMonth + "-01",
salaryStartMonth: salaryStartMonth + "-01"