98 lines
3.4 KiB
JavaScript
98 lines
3.4 KiB
JavaScript
/*
|
||
* Author: 黎永顺
|
||
* name: 薪资核算
|
||
* Description:
|
||
* Date: 2023/9/14
|
||
*/
|
||
import React, { Component } from "react";
|
||
import { WeaHelpfulTip, WeaLocaleProvider } from "ecCom";
|
||
import { Alert } from "antd";
|
||
import { getColumnDesc, getSalarySobCycle } from "../../../../../apis/calculate";
|
||
import { sysConfCodeRule } from "../../../../../apis/ruleconfig";
|
||
import EditCalcAdvanceSearchPannel from "./editCalcAdvanceSearchPannel";
|
||
import EditCalcTable from "./editCalcTable";
|
||
import SalaryMonthTip from "../salaryMonthTip";
|
||
import cs from "classnames";
|
||
import "./index.less";
|
||
|
||
const getLabel = WeaLocaleProvider.getLabel;
|
||
|
||
class Index extends Component {
|
||
constructor(props) {
|
||
super(props);
|
||
this.state = {
|
||
salarySobCycle: {}, showSearchAd: false,
|
||
columnDesc: {}, formulaTd: "", showTotalCell: false
|
||
};
|
||
}
|
||
|
||
componentDidMount() {
|
||
const promise = this.init();
|
||
}
|
||
|
||
openAdvanceSearch = () => this.setState({ showSearchAd: !this.state.showSearchAd });
|
||
onAdSearch = (bool = true) => {
|
||
this.calcTableRef.wrappedInstance.queryCalcResultList();
|
||
bool && this.openAdvanceSearch();
|
||
};
|
||
init = async () => {
|
||
const { routeParams: { salaryAcctRecordId } } = this.props;
|
||
const [salarySobCycle, columnDesc, confCode] = await Promise.all([
|
||
getSalarySobCycle({ salaryAcctRecordId }), getColumnDesc({ salaryAcctRecordId }),
|
||
sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" })
|
||
]);
|
||
if (salarySobCycle.status && columnDesc.status && confCode.status) {
|
||
this.setState({
|
||
salarySobCycle: salarySobCycle.data,
|
||
columnDesc: columnDesc.data, showTotalCell: confCode.data === "1"
|
||
});
|
||
}
|
||
};
|
||
handleShowFormulaTa = (dataIndex) => this.setState({ formulaTd: dataIndex });
|
||
|
||
render() {
|
||
const { salarySobCycle, showSearchAd, formulaTd, columnDesc, showTotalCell } = this.state;
|
||
const { accountExceptInfo, routeParams: { salaryAcctRecordId } } = this.props;
|
||
const formulaObj = _.get(columnDesc, [formulaTd]) || {};
|
||
return (
|
||
<div className="salary-edit-calc-content">
|
||
{
|
||
accountExceptInfo &&
|
||
<Alert message="" description={accountExceptInfo} type="error" closable/>
|
||
}
|
||
<div className="salary-flex-between weapp-salary-tb-tip">
|
||
<div>
|
||
<span>{getLabel(542604, "薪资所属月")}:</span>
|
||
<span>{salarySobCycle.salaryMonth}</span>
|
||
<WeaHelpfulTip
|
||
width={200} placement="topLeft"
|
||
title={<SalaryMonthTip {...salarySobCycle}/>}
|
||
style={{ marginLeft: 10 }}
|
||
/>
|
||
</div>
|
||
<div></div>
|
||
</div>
|
||
<div className="salary-flex-between formula-detail-area">
|
||
<div className="formula-detail">
|
||
<span>{getLabel(18125, "公式")}=</span>
|
||
<span>{formulaObj.formulaContent}</span>
|
||
</div>
|
||
<div></div>
|
||
</div>
|
||
<div className={cs("searchAdvanced-condition-container", { "searchAdvanced-condition-hide": !showSearchAd })}>
|
||
<EditCalcAdvanceSearchPannel
|
||
salaryAcctRecordId={salaryAcctRecordId}
|
||
onToggleSwitch={this.openAdvanceSearch}
|
||
onAdSearch={this.onAdSearch}
|
||
/>
|
||
</div>
|
||
<EditCalcTable ref={dom => this.calcTableRef = dom}
|
||
{...this.props} showTotalCell={showTotalCell}
|
||
onShowFormulaTd={this.handleShowFormulaTa}/>
|
||
</div>
|
||
);
|
||
}
|
||
}
|
||
|
||
export default Index;
|