feature/2.9.42310.02-社保福利档案页面重构

This commit is contained in:
黎永顺 2023-11-02 18:17:30 +08:00
parent a617c40c1f
commit b0500cf8f9
4 changed files with 242 additions and 82 deletions

View File

@ -5,15 +5,15 @@
* Date: 2023/10/31
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { Spin } from "antd";
import { WeaLoadingGlobal, WeaLocaleProvider } from "ecCom";
import { message, Spin } from "antd";
import { inject, observer } from "mobx-react";
import { getExtTable, queryList } from "../../../../../apis/welfareArchive";
import * as API from "../../../../../apis/welfareArchive";
const getLabel = WeaLocaleProvider.getLabel;
const APILIST = {
runStatuses: queryList,
ext: getExtTable
runStatuses: API.queryList,
ext: API.getExtTable
};
@inject("archivesStore")
@ -47,6 +47,11 @@ class Index extends Component {
pageInfo: { ...this.state.pageInfo, current: 1, pageSize: 10, total: 0 }
}, () => this.getWelfareList(nextProps));
}
if ((nextProps.runStatuses !== this.props.runStatuses)) {
this.setState({
dataSource: [], columns: [], loading: false, selectedRowKeys: []
});
}
}
handleReceive = async ({ data }) => {
@ -54,6 +59,7 @@ class Index extends Component {
if (type === "init") {
this.getWelfareList(this.props);
} else if (type === "turn") {
const { record: { baseInfo } = {} } = params;
switch (id) {
case "PAGEINFO":
this.setState({
@ -64,6 +70,9 @@ class Index extends Component {
const { selectedRowKeys } = params;
this.setState({ selectedRowKeys });
break;
case "INCREASE":
this.welfareStayAddToPay([baseInfo]);
break;
default:
break;
}
@ -106,6 +115,31 @@ class Index extends Component {
}
}).catch(() => this.setState({ loading: false }));
};
stayAddToPay = () => {
const { selectedRowKeys } = this.state;
if (_.isEmpty(selectedRowKeys)) {
message.warning(getLabel(543303, "请选择表格数据"));
return;
}
this.welfareStayAddToPay(selectedRowKeys);
};
welfareStayAddToPay = (payload) => {
WeaLoadingGlobal.start();
API.stayAddToPay(payload).then(({ status, data, errormsg }) => {
WeaLoadingGlobal.destroy();
if (status) {
const { msg, type } = data;
if (type === "fail") {
message.error(msg);
} else if (type === "success") {
message.success(msg);
this.getWelfareList(this.props);
}
} else {
message.error(errormsg);
}
});
};
postMessageToChild = (payload = {}) => {
const i18n = {
"操作": getLabel(30585, "操作"), "编辑": getLabel(501169, "编辑"),

View File

@ -26,3 +26,19 @@ class Index extends Component {
}
export default Index;
export const HelpfulDiv = () => {
return <div className="helpWrapper">
<span>{getLabel(544362, "1、缴纳月份区间包含起始缴纳月不包含最后缴纳月;")}</span>
<span>{getLabel(544365, "2、维护的所有的最后缴纳月都大于当前月则该待办数据自动清除不显示在待减员列表")}</span>
<span>{getLabel(544366, "3、减员失败情况①有起始缴纳月却未维护最后缴纳月②员工存在未归档的核算数据")}</span>
</div>;
};
export const CancelHelpfulDiv = () => {
return <div className="helpWrapper">
<span>{getLabel(544362, "1、缴纳月份区间包含起始缴纳月不包含最后缴纳月;")}</span>
<span>{getLabel(544363, "2、若员工当前不在停缴档案的个税扣缴义务人下则不可取消停缴")}</span>
<span>{getLabel(544364, "3、若员工当前在其他个税扣缴义务人下正在缴纳也不可取消停缴")}</span>
</div>;
};

View File

@ -1,3 +1,9 @@
import React from "react";
import { WeaHelpfulTip } from "ecCom";
import { Button } from "antd";
import AdvanceInputBtn from "./components/advanceInputBtn";
import { CancelHelpfulDiv, HelpfulDiv } from "./components/welfareTip";
export const tabList = [
{ viewcondition: "1", lanId: 542711, title: "待增员", showcount: true, groupid: "stayAdd" },
{ viewcondition: "2,3", lanId: 542504, title: "在缴员工", showcount: true, groupid: "paying" },
@ -83,3 +89,145 @@ export const welfareTipList = [
list: []
}
];
export const renderDropMenuDatas = (selectedKey, getLabel) => {
let menus = [{
key: "log",
icon: <i className="iconfont icon-caozuorizhi32"/>,
content: getLabel(111, "操作日志")
}];
switch (selectedKey) {
case "1":
menus = [
{
key: "fullStaffIncrease",
icon: <i className="iconfont icon-quanbu"/>,
content: getLabel(543185, "全量增员")
},
{
key: "batchStaffIncrease",
icon: <i className="iconfont icon-piliangcaozuo"/>,
content: getLabel(543187, "批量增员")
},
{
key: "batchDeleteTodolist",
icon: <i className="iconfont icon-piliangshanchu"/>,
content: getLabel(543186, "批量删除待办")
},
{
key: "exportAll",
icon: <i className="iconfont icon-daochu"/>,
content: getLabel(81272, "导出全部")
},
{
key: "exportSelected",
icon: <i className="iconfont icon-piliangdaochu"/>,
content: getLabel(512938, "导出选中")
},
...menus
];
break;
case "2,3":
menus = [
{
key: "exportAll",
icon: <i className="iconfont icon-daochu"/>,
content: getLabel(81272, "导出全部")
},
{
key: "exportSelected",
icon: <i className="iconfont icon-piliangdaochu"/>,
content: getLabel(512938, "导出选中")
},
...menus
];
break;
case "3":
menus = [
{
key: "fullReduction",
icon: <i className="iconfont icon-quanbu"/>,
content: getLabel(543189, "全量减员")
},
{
key: "batchReduction",
icon: <i className="iconfont icon-piliangcaozuo"/>,
content: getLabel(543188, "批量减员")
},
{
key: "batchDeleteTodolist",
icon: <i className="iconfont icon-piliangshanchu"/>,
content: getLabel(543186, "批量删除待办")
},
{
key: "exportAll",
icon: <i className="iconfont icon-daochu"/>,
content: getLabel(81272, "导出全部")
},
{
key: "exportSelected",
icon: <i className="iconfont icon-piliangdaochu"/>,
content: getLabel(512938, "导出选中")
},
...menus
];
break;
case "4,5":
menus = [
{
key: "batchCancellationOfSuspended",
icon: <i className="iconfont icon-piliangcaozuo"/>,
content: getLabel(543190, "批量取消停缴")
},
{
key: "exportAll",
icon: <i className="iconfont icon-daochu"/>,
content: getLabel(81272, "导出全部")
},
{
key: "exportSelected",
icon: <i className="iconfont icon-piliangdaochu"/>,
content: getLabel(512938, "导出选中")
},
...menus
];
break;
default:
break;
}
return menus;
};
export const renderReqBtns = (selectedKey, getLabel, onOpenAdvanceSearch, onAdvanceSearch) => {
let reqBtns = [
<Button type="primary">{getLabel(32935, "导入")}</Button>,
<AdvanceInputBtn onOpenAdvanceSearch={onOpenAdvanceSearch} onAdvanceSearch={onAdvanceSearch}/>
];
switch (selectedKey) {
case "1":
reqBtns.unshift(<WeaHelpfulTip
width={300} placement="topLeft"
title={
<span>
{getLabel(544348, "提示:缴纳月份区间包含起始缴纳月,不包含最后缴纳月; 若员工离职时还未增员进入在缴员工,则数据会自动清除,因此若确认缴纳,请及时维护档案数据并增员操作。若清除后还需缴纳,需先在个税扣缴义务人菜单将员工按离职状态添加回来,会重新出现在待增员。")}
</span>
}
/>);
break;
case "3":
reqBtns.shift();
reqBtns.unshift(<WeaHelpfulTip
width={300} placement="topLeft"
title={HelpfulDiv}
/>);
break;
case "4,5":
reqBtns.shift();
reqBtns.unshift(<WeaHelpfulTip
width={300} placement="topLeft"
title={CancelHelpfulDiv}
/>);
break;
default:
break;
}
return reqBtns;
};

View File

@ -5,15 +5,14 @@
* Date: 2023/10/31
*/
import React, { Component } from "react";
import { WeaHelpfulTip, WeaLocaleProvider, WeaReqTop, WeaTab } from "ecCom";
import { WeaLoadingGlobal, WeaLocaleProvider, WeaReqTop, WeaTab } from "ecCom";
import { message } from "antd";
import { inject, observer } from "mobx-react";
import AdvanceInputBtn from "./components/advanceInputBtn";
import WelfareAdvanceSearchPannel from "./components/welfareAdvanceSearchPannel";
import WelfareTableList from "./components/welfareTableList";
import WelfareTip from "./components/welfareTip";
import { queryInsuranceTabTotal } from "../../../apis/welfareArchive";
import { tabList, welfareTipList } from "./config";
import { Button } from "antd";
import * as API from "../../../apis/welfareArchive";
import { renderDropMenuDatas, renderReqBtns, tabList, welfareTipList } from "./config";
import cs from "classnames";
import "./index.less";
@ -31,7 +30,7 @@ class Index extends Component {
}
queryInsuranceTabTotal = (active, total) => {
queryInsuranceTabTotal().then(({ status, data }) => {
API.queryInsuranceTabTotal().then(({ status, data }) => {
if (status) {
const key = _.find(tabList, o => o.viewcondition === active).groupid;
this.setState({
@ -40,77 +39,39 @@ class Index extends Component {
}
});
};
renderReqBtns = () => {
const { selectedKey } = this.state;
let reqBtns = [
<Button type="primary">{getLabel(32935, "导入")}</Button>,
<AdvanceInputBtn onOpenAdvanceSearch={() => this.setState({ showSearchAd: true })}
onAdvanceSearch={() => this.setState({ isQuery: !this.state.isQuery })}
/>
];
switch (selectedKey) {
case "1":
reqBtns.unshift(<WeaHelpfulTip
width={300} placement="topLeft"
title={
<span>
{getLabel(544348, "提示:缴纳月份区间包含起始缴纳月,不包含最后缴纳月; 若员工离职时还未增员进入在缴员工,则数据会自动清除,因此若确认缴纳,请及时维护档案数据并增员操作。若清除后还需缴纳,需先在个税扣缴义务人菜单将员工按离职状态添加回来,会重新出现在待增员。")}
</span>
}
/>);
break;
default:
break;
}
return reqBtns;
};
renderDropMenuDatas = () => {
const { selectedKey } = this.state;
let menus = [{
key: "log",
icon: <i className="iconfont icon-caozuorizhi32"/>,
content: getLabel(111, "操作日志")
}];
switch (selectedKey) {
case "1":
menus = [
{
key: "fullStaffIncrease",
icon: <i className="iconfont icon-caozuorizhi32"/>,
content: getLabel(543185, "全量增员")
},
{
key: "batchStaffIncrease",
icon: <i className="iconfont icon-caozuorizhi32"/>,
content: getLabel(543187, "批量增员")
},
{
key: "batchDeleteTodolist",
icon: <i className="iconfont icon-caozuorizhi32"/>,
content: getLabel(543186, "批量删除待办")
},
{
key: "exportAll",
icon: <i className="iconfont icon-caozuorizhi32"/>,
content: getLabel(81272, "导出全部")
},
{
key: "exportSelected",
icon: <i className="iconfont icon-caozuorizhi32"/>,
content: getLabel(512938, "导出选中")
},
...menus
];
break;
default:
break;
}
return menus;
};
handleOpenAdvanceSearch = () => this.setState({ showSearchAd: true });
handleAdvanceSearch = () => this.setState({ isQuery: !this.state.isQuery });
onDropMenuClick = (key) => {
console.log(key);
switch (key) {
case "fullStaffIncrease":
this.allStayAddToPay();
break;
case "batchStaffIncrease":
this.welfareListRef.wrappedInstance.stayAddToPay();
break;
default:
break;
}
};
onAdSearch = () => this.setState({ showSearchAd: false, isQuery: !this.state.isQuery });
allStayAddToPay = () => {
WeaLoadingGlobal.start();
API.allStayAddToPay().then(({ status, data, errormsg }) => {
WeaLoadingGlobal.destroy();
if (status) {
const { type, msg } = data;
if (type === "fail") {
message.error(msg);
} else {
message.success(msg);
this.onAdSearch();
}
} else {
message.error(errormsg);
}
}).catch(() => WeaLoadingGlobal.destroy());
};
render() {
const { selectedKey, topTabCount, showSearchAd, isQuery } = this.state;
@ -120,8 +81,9 @@ class Index extends Component {
<div className="salary-welfare-archive">
<WeaReqTop
title={getLabel(538001, "社保福利档案")} buttonSpace={10} icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D" buttons={this.renderReqBtns()} showDropIcon dropMenuDatas={this.renderDropMenuDatas()}
onDropMenuClick={this.onDropMenuClick}
iconBgcolor="#F14A2D" showDropIcon onDropMenuClick={this.onDropMenuClick}
dropMenuDatas={renderDropMenuDatas(selectedKey, getLabel)}
buttons={renderReqBtns(selectedKey, getLabel, this.handleOpenAdvanceSearch, this.handleAdvanceSearch)}
replaceTab={
<WeaTab
datas={_.map(tabList, o => ({ ...o, title: getLabel(o.lanId, o.title) }))} autoCalculateWidth
@ -139,8 +101,8 @@ class Index extends Component {
/>
</div>
{/*列表*/}
<WelfareTableList isQuery={isQuery} showOperateBtn={showOperateBtn}
runStatuses={selectedKey}
<WelfareTableList isQuery={isQuery} ref={dom => this.welfareListRef = dom}
runStatuses={selectedKey} showOperateBtn={showOperateBtn}
onChangeTopTabCount={this.queryInsuranceTabTotal}
/>
{/*提示*/}