Merge branch 'feature/V2-工资单发放详情页添加发放进度条' into release-2023-06-08
This commit is contained in:
commit
61dacb90e2
|
|
@ -12,6 +12,10 @@ export const getPayrollList = params => {
|
|||
body: JSON.stringify(params)
|
||||
}).then(res => res.json());
|
||||
};
|
||||
// 工资单发放进度条
|
||||
export const getPayrollIssuanceProgressBar = (id) => {
|
||||
return WeaTools.callApi("/api/bs/hrmsalary/progress/getRate?cacheKey=SALARY_GRANT_PROGRESS_" + id, "get", {});
|
||||
};
|
||||
|
||||
//工资单-获取table提示信息
|
||||
export const getPayrollInfo = params => {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,17 @@
|
|||
import React from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { toJS } from "mobx";
|
||||
import { WeaDropdown, WeaHelpfulTip, WeaTab, WeaTop } from "ecCom";
|
||||
import { WeaDropdown, WeaHelpfulTip, WeaLocaleProvider, WeaTab, WeaTop } from "ecCom";
|
||||
import { Button, Dropdown, Menu, message } from "antd";
|
||||
import "./index.less";
|
||||
import { getQueryString } from "../../../util/url";
|
||||
import { getSearchs, renderLoading } from "../../../util";
|
||||
import CustomPaginationTable from "../../../components/customPaginationTable";
|
||||
import PayrollPartTable from "./payrollPartTable";
|
||||
import { getPayrollIssuanceProgressBar } from "../../../apis/payroll";
|
||||
import ProgressModal from "../../../components/progressModal";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
const { ButtonSelect } = WeaDropdown;
|
||||
|
||||
@inject("payrollStore")
|
||||
|
|
@ -20,6 +23,8 @@ export default class PayrollGrant extends React.Component {
|
|||
selectedRowKeys: [],
|
||||
currentId: "",
|
||||
selectedKey: "0",
|
||||
progressVisible: false,
|
||||
progress: 0,
|
||||
payrollPartModalParams: {
|
||||
visible: false,
|
||||
title: "工资单发放",
|
||||
|
|
@ -28,6 +33,7 @@ export default class PayrollGrant extends React.Component {
|
|||
}
|
||||
};
|
||||
this.pageInfo = { current: 1, pageSize: 10 };
|
||||
this.timer = null;
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
|
|
@ -66,6 +72,7 @@ export default class PayrollGrant extends React.Component {
|
|||
|
||||
// 发放
|
||||
handleGrant = (record) => {
|
||||
this.setState({ progress: 0 });
|
||||
const { payrollStore } = this.props;
|
||||
const { currentId, selectedKey } = this.state;
|
||||
const { grantPayroll, getInfoList } = payrollStore;
|
||||
|
|
@ -73,14 +80,39 @@ export default class PayrollGrant extends React.Component {
|
|||
...record,
|
||||
salarySendId: currentId
|
||||
}).then(() => {
|
||||
getInfoList({
|
||||
salarySendId: currentId,
|
||||
isGranted: selectedKey !== "0",
|
||||
current: this.pageInfo.current,
|
||||
pageSize: this.pageInfo.pageSize
|
||||
this.setState({ progressVisible: true });
|
||||
if (this.timer) clearInterval(this.timer);
|
||||
this.timer = setInterval(() => {
|
||||
getPayrollIssuanceProgressBar(currentId).then(({ data, status }) => {
|
||||
let progress = data.progress;
|
||||
if (progress === 1 && this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
this.setState({
|
||||
progressVisible: false,
|
||||
progress: 0
|
||||
});
|
||||
message.success(data.message);
|
||||
getInfoList({
|
||||
salarySendId: currentId,
|
||||
isGranted: selectedKey !== "0",
|
||||
current: this.pageInfo.current,
|
||||
pageSize: this.pageInfo.pageSize
|
||||
|
||||
});
|
||||
this.handleClose();
|
||||
});
|
||||
this.handleClose();
|
||||
} else if (!data.status) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
this.setState({
|
||||
progressVisible: false,
|
||||
progress: 0
|
||||
});
|
||||
message.error(data.message);
|
||||
}
|
||||
this.setState({ progress: Number(progress) * 100 });
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -159,6 +191,7 @@ export default class PayrollGrant extends React.Component {
|
|||
};
|
||||
// 全部发送
|
||||
handleGrantAll = () => {
|
||||
this.setState({ progress: 0 });
|
||||
const { payrollStore } = this.props;
|
||||
const { currentId, selectedKey } = this.state;
|
||||
const { grantPayroll, getInfoList } = payrollStore;
|
||||
|
|
@ -166,22 +199,73 @@ export default class PayrollGrant extends React.Component {
|
|||
ids: [],
|
||||
salarySendId: currentId
|
||||
}).then(() => {
|
||||
getInfoList({
|
||||
salarySendId: currentId,
|
||||
isGranted: selectedKey !== "0"
|
||||
});
|
||||
this.setState({ progressVisible: true });
|
||||
if (this.timer) clearInterval(this.timer);
|
||||
this.timer = setInterval(() => {
|
||||
getPayrollIssuanceProgressBar(currentId).then(({ data, status }) => {
|
||||
let progress = data.progress;
|
||||
if (progress === 1 && this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
this.setState({
|
||||
progressVisible: false,
|
||||
progress: 0
|
||||
});
|
||||
message.success(data.message);
|
||||
getInfoList({
|
||||
salarySendId: currentId,
|
||||
isGranted: selectedKey !== "0"
|
||||
});
|
||||
} else if (!data.status) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
this.setState({
|
||||
progressVisible: false,
|
||||
progress: 0
|
||||
});
|
||||
message.error(data.message);
|
||||
}
|
||||
this.setState({ progress: Number(progress) * 100 });
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
};
|
||||
// 发放所选
|
||||
fetchGrantPayRoll = (payload) => {
|
||||
this.setState({ progress: 0 });
|
||||
const { selectedKey, currentId } = this.state;
|
||||
const { payrollStore: { grantPayroll, getInfoList } } = this.props;
|
||||
grantPayroll(payload).then(() => {
|
||||
getInfoList({
|
||||
salarySendId: currentId,
|
||||
isGranted: selectedKey !== "0"
|
||||
});
|
||||
this.setState({ selectedRowKeys: [] });
|
||||
this.setState({ progressVisible: true });
|
||||
if (this.timer) clearInterval(this.timer);
|
||||
this.timer = setInterval(() => {
|
||||
getPayrollIssuanceProgressBar(currentId).then(({ data, status }) => {
|
||||
let progress = data.progress;
|
||||
if (progress === 1 && this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
this.setState({
|
||||
progressVisible: false,
|
||||
progress: 0
|
||||
});
|
||||
message.success(data.message);
|
||||
getInfoList({
|
||||
salarySendId: currentId,
|
||||
isGranted: selectedKey !== "0"
|
||||
});
|
||||
this.setState({ selectedRowKeys: [] });
|
||||
} else if (!data.status) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
this.setState({
|
||||
progressVisible: false,
|
||||
progress: 0
|
||||
});
|
||||
message.error(data.message);
|
||||
}
|
||||
this.setState({ progress: Number(progress) * 100 });
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -218,7 +302,7 @@ export default class PayrollGrant extends React.Component {
|
|||
const { payrollStore } = this.props;
|
||||
const { salaryGrantTableStore: columns, salarySendDetailBaseInfo } = payrollStore;
|
||||
const notShowGrantOrWithdraw = salarySendDetailBaseInfo.haveBackCalc === 1 && salarySendDetailBaseInfo.salaryAcctType === "0";
|
||||
return [
|
||||
return _.map([
|
||||
...toJS(columns),
|
||||
{
|
||||
title: "操作",
|
||||
|
|
@ -226,7 +310,7 @@ export default class PayrollGrant extends React.Component {
|
|||
dataIndex: "",
|
||||
display: true,
|
||||
render: (text, record) => {
|
||||
if (record.sendStatus === "已发放" && !notShowGrantOrWithdraw) {
|
||||
if (record.sendStatus === "1" && !notShowGrantOrWithdraw) {
|
||||
return (
|
||||
<a
|
||||
href="javascript:void(0);"
|
||||
|
|
@ -245,7 +329,17 @@ export default class PayrollGrant extends React.Component {
|
|||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
], item => {
|
||||
if (item.dataIndex === "sendStatus") {
|
||||
return {
|
||||
...item,
|
||||
render: (text, record) => {
|
||||
return <span>{record.sendStatus === "0" ? getLabel(111, "未发放") : record.sendStatus === "1" ? getLabel(111, "已发放") : getLabel(111, "已撤回")}</span>;
|
||||
}
|
||||
};
|
||||
}
|
||||
return { ...item };
|
||||
});
|
||||
};
|
||||
|
||||
getSearchsAdQuick() {
|
||||
|
|
@ -284,7 +378,7 @@ export default class PayrollGrant extends React.Component {
|
|||
{ key: "SELECT", show: "发放所选", selected: false },
|
||||
{ key: "PART", show: "部分发放", selected: false }
|
||||
]}
|
||||
btnProps={{loading: btnLoading}}
|
||||
btnProps={{ loading: btnLoading }}
|
||||
btnOnClick={this.sendPayroll}
|
||||
menuOnClick={(key) => this.sendPayroll(key)}
|
||||
/>,
|
||||
|
|
@ -298,7 +392,7 @@ export default class PayrollGrant extends React.Component {
|
|||
{ key: "recallSelected", show: "撤回所选", selected: false },
|
||||
{ key: "partialWithdrawal", show: "部分撤回", selected: false }
|
||||
]}
|
||||
btnProps={{loading: btnLoading}}
|
||||
btnProps={{ loading: btnLoading }}
|
||||
btnOnClick={this.withdrawalPayroll}
|
||||
menuOnClick={(key) => this.withdrawalPayroll(key)}
|
||||
/>,
|
||||
|
|
@ -505,6 +599,18 @@ export default class PayrollGrant extends React.Component {
|
|||
onWithdraw={this.handleWithdraw}
|
||||
onGrant={this.handleGrant}
|
||||
/>
|
||||
{
|
||||
this.state.progressVisible &&
|
||||
<ProgressModal
|
||||
visible={this.state.progressVisible}
|
||||
onCancel={() => {
|
||||
this.setState({ progressVisible: false, progress: 0 });
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
}}
|
||||
progress={this.state.progress}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ export default class BaseInformForm extends React.Component {
|
|||
}, ...toJS(data.salarySobOptions)],
|
||||
request: {
|
||||
...data.templateBaseData,
|
||||
msgStatus: !this.props.id ? "1" : data.templateBaseData.msgStatus,
|
||||
reissueRule: data.templateBaseData.replenishRule ? "1" : "0",
|
||||
...JSON.parse(templateBaseData)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -508,17 +508,17 @@ export class payrollStore {
|
|||
@action
|
||||
grantPayroll = (params = {}) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
message.destroy();
|
||||
message.loading("正在发放中...", 0);
|
||||
// message.destroy();
|
||||
// message.loading("正在发放中...", 0);
|
||||
this.btnLoading = true;
|
||||
WeaLoadingGlobal.start();
|
||||
// WeaLoadingGlobal.start();
|
||||
API.grantPayroll(params).then(res => {
|
||||
this.btnLoading = false;
|
||||
WeaLoadingGlobal.end();
|
||||
WeaLoadingGlobal.destroy();
|
||||
message.destroy();
|
||||
// WeaLoadingGlobal.end();
|
||||
// WeaLoadingGlobal.destroy();
|
||||
// message.destroy();
|
||||
if (res.status) {
|
||||
message.success("发送成功");
|
||||
// message.success("发送成功");
|
||||
resolve();
|
||||
} else {
|
||||
message.error(res.errormsg || "发送失败");
|
||||
|
|
@ -526,8 +526,8 @@ export class payrollStore {
|
|||
}
|
||||
}).catch(() => {
|
||||
this.btnLoading = false
|
||||
WeaLoadingGlobal.end();
|
||||
WeaLoadingGlobal.destroy();
|
||||
// WeaLoadingGlobal.end();
|
||||
// WeaLoadingGlobal.destroy();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue