feature/2.10.1.2401.01-社保福利台账列表页面重构

This commit is contained in:
黎永顺 2024-01-24 15:37:09 +08:00
parent c6ad730e1e
commit 687de497ae
3 changed files with 81 additions and 13 deletions

View File

@ -150,8 +150,8 @@ class WelfareRecordList extends Component {
<Spin spinning={loading}>
<iframe
style={{ border: 0, width: "100%", height: "100%" }}
src="http://localhost:7607/#/unitTable"
// src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/unitTable"
// src="http://localhost:7607/#/unitTable"
src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/unitTable"
id="unitTable"
/>
</Spin>

View File

@ -46,8 +46,9 @@ class WelfareRecordQuery extends Component {
};
})
}, () => {
const { standingBookStore: { welfareRQForm } } = this.props;
const { standingBookStore: { welfareRQForm }, onPutAccountOptions } = this.props;
welfareRQForm.initFormFields(this.state.conditions);
onPutAccountOptions(_.map(data, g => ({ key: g.id.toString(), showname: g.name })));
});
}
});

View File

@ -8,10 +8,14 @@
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaLocaleProvider, WeaTop } from "ecCom";
import { Button } from "antd";
import { Button, message } from "antd";
import * as API from "../../../apis/standingBook";
import { getCalculateProgress } from "../../../apis/calculate";
import WelfareRecordQuery from "./components/welfareRecordQuery";
import WelfareRecordList from "./components/welfareRecordList";
import Accountdialog from "./components/accountDialog";
import ProgressModal from "../../../components/progressModal";
import { convertToUrlString } from "../../../util/url";
import moment from "moment";
import "./index.less";
@ -27,10 +31,11 @@ class StandingBook extends Component {
startTime: moment(new Date()).subtract(1, "year").startOf("year").format("YYYY-MM"),
endTime: moment(new Date()).endOf("year").format("YYYY-MM"),
taxAgents: ""
},
}, progressVisible: false, progress: 0,
accountDialog: { visible: false, title: "", loading: false, options: [] }
};
this.wfListRef = null;
this.timer = null;
}
/*
@ -39,13 +44,63 @@ class StandingBook extends Component {
* Params:
* Date: 2024/1/23
*/
handleAccount = (formVal) => {
handleAccount = async (formVal) => {
const { billMonth, ...extra } = formVal;
const payload = {
billMonth: moment(billMonth).format("YYYY-MM"),
...extra
};
console.log(formVal, payload);
this.setState({ accountDialog: { ...this.state.accountDialog, loading: true } });
const { data: creator, status, errormsg } = await API.save(payload);
if (status) {
this.setState({
accountDialog: { ...this.state.accountDialog, loading: false },
progressVisible: true
}, () => {
this.timer = setInterval(() => {
getCalculateProgress(moment(billMonth).format("YYYY-MM")).then(({ status, data }) => {
if (status) {
if (!data.status) {
clearInterval(this.timer);
this.setState({ progressVisible: false, progress: 0 });
message.error(data.message);
return;
}
if (this.state.progress !== 100) {
this.setState({
progress: (Number(data.progress).toFixed(2)) * 100
});
} else {
clearInterval(this.timer);
this.setState({ progressVisible: false, progress: 0 }, () => {
message.success(getLabel(543232, "核算成功"));
this.setState({
accountDialog: { ...this.state.accountDialog, visible: false }
}, () => {
this.wfListRef.wrappedInstance.getWelfareRecordList();
const calcPayload = { ...payload, creator };
window.open(`/spa/hrmSalary/static/index.html#/main/hrmSalary/socialSecurityBenefits/standingBookDetail?${convertToUrlString(calcPayload)}`);
});
});
}
} else {
clearInterval(this.timer);
this.setState({ progressVisible: false, progress: 0 });
}
}).catch(() => {
clearInterval(this.timer);
this.setState({ progressVisible: false, progress: 0 });
});
}, 600);
});
} else {
message.error(errormsg);
clearInterval(this.timer);
this.setState({
accountDialog: { ...this.state.accountDialog, loading: false },
progressVisible: false, progress: 0
});
}
};
render() {
@ -59,18 +114,30 @@ class StandingBook extends Component {
<WeaTop title={getLabel(538002, "社保福利台账")} icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D" buttons={showOperateBtn ? rightBtns : []}>
<div className="salary-welfare-record-content">
<WelfareRecordQuery onSearch={(payload) => {
this.setState({
queryForm: { ...queryForm, ...payload }
}, () => this.wfListRef.wrappedInstance.getWelfareRecordList());
}}/>
<WelfareRecordQuery
onSearch={(payload) => {
this.setState({
queryForm: { ...queryForm, ...payload }
}, () => this.wfListRef.wrappedInstance.getWelfareRecordList());
}}
onPutAccountOptions={options => this.setState({ accountDialog: { ...accountDialog, options } })}
/>
<WelfareRecordList ref={dom => this.wfListRef = dom} queryForm={queryForm}/>
</div>
<Accountdialog {...accountDialog}
onCancel={() => this.setState({
accountDialog: { visible: false, title: "", loading: false }
accountDialog: { ...accountDialog, visible: false, title: "", loading: false }
})} onOk={this.handleAccount}
/>
{/*核算进度条*/}
{
this.state.progressVisible &&
<ProgressModal visible={this.state.progressVisible} progress={this.state.progress}
onCancel={() => {
this.setState({ progressVisible: false, progress: 0 }, () => clearInterval(this.timer));
}}
/>
}
</WeaTop>
</div>
);