diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.js index f9a10027..97fe5c49 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.js @@ -1,15 +1,22 @@ import React, { Component } from "react"; -import { WeaInputSearch, WeaLocaleProvider } from "ecCom"; +import { inject, observer } from "mobx-react"; import { Button } from "antd"; +import { WeaInputSearch, WeaLocaleProvider } from "ecCom"; import "./index.less"; const getLabel = WeaLocaleProvider.getLabel; +@inject("calculateStore") +@observer class Index extends Component { render() { + const { calculateStore: { ECSearchForm } } = this.props; return (
- + ECSearchForm.updateFields({ employeeName: v })} + onSearch={this.props.onAdvanceSearch} + />
diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js index 31fbfe42..6c544e8f 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js @@ -249,7 +249,7 @@ class Index extends Component { onSearchChange={(v) => PCSearchForm.updateFields({ employeeName: v })} searchsBaseValue={PCSearchForm.getFormParams().employeeName} onSearch={this.queryPCList} onAdSearch={this.queryPCList} - onAdReset={() => PCSearchForm.resetForm()} + onAdReset={() => PCSearchForm.resetForm()} autoCalculateWidth /> { + const i18n= { + "操作": getLabel(30585, "操作"),"编辑": getLabel(501169, "编辑"), + "点击锁定所有解锁的项目值": getLabel(543649, "点击锁定所有解锁的项目值"), + "点击解锁所有锁定的项目值": getLabel(543648, "点击解锁所有锁定的项目值"), + "锁定的项目值": getLabel(543647, "锁定的项目值"), + "当前状态锁定,点击解锁": getLabel(111, "当前状态锁定,点击解锁"), + "当前状态未锁定,点击锁定": getLabel(111, "当前状态未锁定,点击锁定"), + "共": getLabel(18609, "共"),"条": getLabel(18256, "条"), + } const childFrameObj = document.getElementById("atdTable"); - childFrameObj.contentWindow.postMessage(JSON.stringify(payload), "*"); + childFrameObj.contentWindow.postMessage(JSON.stringify({...payload, i18n}), "*"); }; queryCalcResultList = () => { const { pageInfo } = this.state; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.js index 3d7e518c..cd76d60c 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.js @@ -29,9 +29,9 @@ class Index extends Component { } openAdvanceSearch = () => this.setState({ showSearchAd: !this.state.showSearchAd }); - onAdSearch = () => { + onAdSearch = (bool = true) => { this.calcTableRef.wrappedInstance.queryCalcResultList(); - this.openAdvanceSearch(); + bool && this.openAdvanceSearch(); }; init = async () => { const { routeParams: { salaryAcctRecordId } } = this.props; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js index c42f5d7f..3e2cee5f 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js @@ -6,35 +6,99 @@ */ import React, { Component } from "react"; import { WeaLocaleProvider, WeaReqTop } from "ecCom"; -import { Button, Dropdown, Menu } from "antd"; +import { Button, Dropdown, Menu, message, Modal } from "antd"; +import { inject, observer } from "mobx-react"; import Layout from "./layout"; +import { acctresultAccounting, getCalculateProgress } from "../../../apis/calculate"; import AdvanceInputBtn from "./components/advanceInputBtn"; import SalaryCalcPersonConfirm from "./components/salaryCalcPersonConfirm"; import SalaryEditCalc from "./components/salaryEditCalc"; +import { convertToUrlString } from "../../../util/url"; +import ProgressModal from "../../../components/progressModal"; import "./index.less"; const getLabel = WeaLocaleProvider.getLabel; +@inject("calculateStore") +@observer class Index extends Component { constructor(props) { super(props); this.state = { - selectedKey: "person" + selectedKey: "person", progressVisible: false, progress: 0, + accountExceptInfo: "" //核算报错信息, }; this.calc = null; + this.timer = null; } componentDidMount() { console.log(this.props); } - handleButtonClick = () => { - console.log("核算所有人", this.calc); - }; handleMenuClick = ({ key }) => { - console.log(key); + switch (key) { + case "calc_selected": + console.log(this.calc); + // this.doCacl(key); + break; + default: + break; + } }; + doCacl = (key) => { + Modal.confirm({ + title: getLabel(131329, "信息确认"), + content: getLabel(543544, "点击核算,公式项将按照公式逻辑核算,核算结果将覆盖原数据"), + onOk: () => { + const { routeParams: { salaryAcctRecordId } } = this.props; + this.setState({ progress: 0 }); + let payload = { salaryAcctRecordId }; + if (key === "calc_selected") payload = _.assign(payload, { ids: this.state.accountIds }); + acctresultAccounting(payload).then(() => { + this.setState({ progressVisible: true }); + if (this.timer) clearInterval(this.timer); + this.timer = setInterval(() => { + getCalculateProgress(this.id).then(data => { + let progress = data.progress; + if (progress === 1 && this.timer) { + clearInterval(this.timer); + this.timer = null; + this.setState({ + progressVisible: false, + accountExceptInfo: data.message + }); + message.success(getLabel(542321, "核算完成")); + this.calc.onAdSearch(false); + } else if (!data.status) { + clearInterval(this.timer); + this.timer = null; + this.setState({ + progressVisible: false, + accountExceptInfo: data.message + }); + message.error(data.message); + } + this.setState({ progress: Number(progress) * 100 }); + }); + }, 800); + }); + } + }); + }; + handleMoreMenuClick = ({ key }) => { + switch (key) { + case "exportAll": + const { calculateStore: { ECSearchForm }, routeParams: { salaryAcctRecordId } } = this.props; + const { consolidatedTaxation, ...extra } = ECSearchForm.getFormParams(); + const payload = { ...extra, consolidatedTaxation: consolidatedTaxation === "0" ? "" : consolidatedTaxation }; + const url = `/api/bs/hrmsalary/salaryacct/acctresult/export?salaryAcctRecordId=${salaryAcctRecordId}&ids=&${convertToUrlString(payload)}`; + window.open(`${window.ecologyContentPath || ""}${url}`, "_blank"); + break; + default: + break; + } console.log(key); }; renderReqBtns = () => { @@ -56,11 +120,12 @@ class Index extends Component { ); reqBtns = [ - + this.doCacl("ALL")} overlay={menu} type="primary"> {getLabel(543545, "核算所有人")} , , - this.calc.openAdvanceSearch()}/> + this.calc.openAdvanceSearch()} + onAdvanceSearch={() => this.calc.onAdSearch(false)}/> ]; break; default: @@ -89,7 +154,7 @@ class Index extends Component { { key: "person", title: getLabel(543547, "人员确认") }, { key: "calc", title: getLabel(538011, "薪资核算") } ]; - const { selectedKey } = this.state; + const { selectedKey, progressVisible, progress } = this.state; return (
@@ -100,6 +165,16 @@ class Index extends Component { buttons={this.renderReqBtns()} >
{this.renderContent()}
+ { + progressVisible && + { + this.setState({ progressVisible: false, progress: 0 }, () => this.timer = null); + }} + progress={parseFloat(progress).toFixed(2)} + /> + }