feature/2.9.42309.01-薪资核算详情页面列表改造(页面编辑)

This commit is contained in:
黎永顺 2023-09-18 10:40:30 +08:00
parent f29d985e64
commit e2be082a54
5 changed files with 106 additions and 15 deletions

View File

@ -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 (
<div className="advance-search">
<WeaInputSearch/>
<WeaInputSearch value={ECSearchForm.getFormParams().employeeName}
onChange={v => ECSearchForm.updateFields({ employeeName: v })}
onSearch={this.props.onAdvanceSearch}
/>
<Button type="ghost" className="wea-advanced-search text-elli"
onClick={this.props.onOpenAdvanceSearch}>{getLabel(111, "高级搜索")}</Button>
</div>

View File

@ -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
/>
<WeaTable
dataSource={dataSource} loading={loading} rowSelection={rowSelection} pagination={pagination}

View File

@ -56,8 +56,17 @@ class EditCalcTable extends Component {
}
postMessageToChild = (payload = {}) => {
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;

View File

@ -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;

View File

@ -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 {
</Menu>
);
reqBtns = [
<Dropdown.Button onClick={this.handleButtonClick} overlay={menu} type="primary">
<Dropdown.Button onClick={() => this.doCacl("ALL")} overlay={menu} type="primary">
{getLabel(543545, "核算所有人")}
</Dropdown.Button>,
<Dropdown overlay={moreMenu}><Button type="ghost">{getLabel(17499, "更多")}</Button></Dropdown>,
<AdvanceInputBtn onOpenAdvanceSearch={() => this.calc.openAdvanceSearch()}/>
<AdvanceInputBtn onOpenAdvanceSearch={() => 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 (
<Layout {...this.props}>
<div className="salary-calculate-do-calc">
@ -100,6 +165,16 @@ class Index extends Component {
buttons={this.renderReqBtns()}
>
<div className="salary-calculate-do-calc-content">{this.renderContent()}</div>
{
progressVisible &&
<ProgressModal
visible={progressVisible}
onCancel={() => {
this.setState({ progressVisible: false, progress: 0 }, () => this.timer = null);
}}
progress={parseFloat(progress).toFixed(2)}
/>
}
</WeaReqTop>
</div>
</Layout>