/* * Author: 黎永顺 * name: 薪酬报表查看 * Description: * Date: 2023/4/20 */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaLeftRightLayout, WeaLoadingGlobal, WeaLocaleProvider, WeaSelect, WeaTop } from "ecCom"; import { message, Modal } from "antd"; import LeftTab from "./components/leftTab"; import ReportContent from "./components/reportContent"; import StatisticalMicroSettingsSlide, { getSalaryMonthValue } from "./components/statisticalMicroSettingsSlide"; import { exportDataReport, reportGetForm, reportStatisticsReportSave } from "../../apis/ruleconfig"; import TopBtns from "./components/topBtns"; import "./index.less"; const { getLabel } = WeaLocaleProvider; @inject("taxAgentStore", "attendanceStore") @observer class Index extends Component { constructor(props) { super(props); this.state = { report: {}, dimensionList: [], statisticalPayload: { visible: false, id: "", dimension: "" } }; } componentDidMount() { this.reportGetForm(); } reportGetForm = () => { reportGetForm().then(({ status, data }) => { if (status) { const { statsDimOptions } = data; this.setState({ dimensionList: _.map(statsDimOptions, it => ({ key: it.id, showname: it.content })) }); } }); }; /* * Author: 黎永顺 * Description: 统计维度切换 * Params: * Date: 2023/4/20 */ handleChangeDimension = (dimensionId, dimension) => { const { report } = this.state; Modal.confirm({ title: getLabel(111, "信息确认"), content: getLabel(111, "确认要更改统计维度吗?"), onOk: () => { const payload = { id: report.id, reportName: report.reportName, dimensionIds: dimensionId.split(",") }; reportStatisticsReportSave(payload).then(({ status, errormsg }) => { this.setState({ loading: false }); if (status) { message.success(getLabel(111, "切换成功")); this.setState({ report: { ...report, dimensionId, dimension } }, () => this.leftTabRef.updateReportList(this.state.report)); } else { message.error(errormsg || getLabel(111, "切换失败")); this.setState({ report: { ...report } }); } }); }, onCancel: () => { this.setState({ report: { ...report } }); } }); }; /* * Author: 黎永顺 * Description: 导出报表数据 * Params: * Date: 2023/4/24 */ exportData = () => { if (this.reportRef.state.loading) { message.info(getLabel(111, "列表正在加载中,请稍后")); return; } const { report } = this.state; const { id, dimensionId, isShare, timeType, salaryEndMonth: end, salaryStartMonth: start } = report; const [salaryStartMonth, salaryEndMonth] = getSalaryMonthValue(timeType); const payload = { id, dimensionId, isShare, salaryStartMonth: (salaryStartMonth || start) + "-01", salaryEndMonth: (salaryEndMonth || end) + "-01" }; WeaLoadingGlobal.start(); const promise = exportDataReport(payload); }; render() { const { report, dimensionList, statisticalPayload } = this.state; const { isShare } = report; const { attendanceStore: { settingForm }, taxAgentStore: { taxAgentOption, showOperateBtn } } = this.props; return ( } iconBgcolor="#F14A2D" className="reportViewWrapper" buttons={(showOperateBtn && !isShare) ? [] : []} > this.leftTabRef = dom} onChangeTab={report => this.setState({ report: !_.isNil(report) ? report : this.state.report, statisticalPayload: { visible: false, id: "", dimension: "" } })} /> } >
{report.reportName}
{getLabel(111, "统计维度")}: this.handleChangeDimension(key, showname)}/>
{ if (this.reportRef.state.loading) { message.info(getLabel(111, "列表正在加载中,请稍后")); } else { this.setState({ statisticalPayload: { visible: true, id: report.id, dimension: report.dimensionId } }); } }} />
{/*统计数据范围及规则设置弹框*/} this.setState({ statisticalPayload: { visible: false, id: "", dimension: "" } }, () => isRefresh && this.leftTabRef.reportStatisticsReportList())} />
{/* 内容区 */} this.reportRef = dom} report={report}/>
); } } export default Index;