feature/2.10.1.2402.01-我的薪资福利显示基础配置

This commit is contained in:
黎永顺 2024-02-26 15:29:04 +08:00
parent ac479676e0
commit b42f9c8e13
5 changed files with 343 additions and 36 deletions

View File

@ -10,7 +10,7 @@ import Programme_old from "./pages/socialSecurityBenefits/programme";
// import Archivess from "./pages/socialSecurityBenefits/archives";
import Archives from "./pages/socialSecurityBenefits/welfareArchive"; //社保福利档案重构页面
import StandingBookDemo from "./pages/socialSecurityBenefits/standingBook";
import StandingBook from "./pages/socialSecurityBenefits/standingBook/standingBook";//社保福利台账重构页面
import StandingBook from "./pages/socialSecurityBenefits/standingBook/standingBook"; //社保福利台账重构页面
import StandingBookDetail from "./pages/socialSecurityBenefits/standingBookDetail";
import StandingBookOfflineComparison from "./pages/socialSecurityBenefits/standingBookOfflineComparison";
import SalaryItem from "./pages/salaryItem";
@ -44,7 +44,6 @@ import PayrollTemplatePreview from "./pages/payroll/templatePreview/tmpPreview";
import MobilePayroll from "./pages/mobilePayroll";
import SysConfig from "./pages/sysConfig";
import RuleConfig from "./pages/ruleConfig/ruleConfig";
import RuleConfigs from "./pages/ruleConfig";
import Appconfig from "./pages/appConfig";
import FieldManagement from "./pages/fieldManagement";
import AnalysisOfSalaryStatistics from "./pages/analysisOfSalaryStatistics";
@ -186,7 +185,6 @@ const Routes = (
<Route key="mobilepayroll" path="mobilepayroll" component={MobilePayroll}/>
<Route key="sysconfig" path="sysconfig" component={SysConfig}/>
<Route key="sysconfig-1" path="sysconfig-1" component={RuleConfig}/>
<Route key="ruleConfig" path="ruleConfig" component={RuleConfigs}/>
<Route key="appconfig" path="appconfig" component={Appconfig}/>
<Route key="fieldManagement" path="fieldManagement" component={FieldManagement}/>
<Route key="analysisOfSalaryStatistics" path="analysisOfSalaryStatistics" component={AnalysisOfSalaryStatistics}/>

View File

@ -9,6 +9,8 @@ import { WeaLocaleProvider, WeaReqTop } from "ecCom";
import Payroll from "./components/payrollTable";
import SalaryAdjustmentRecords from "./components/SalaryAdjustmentRecords";
import { MonthRangePicker } from "../reportView/components/statisticalMicroSettingsSlide";
import Authority from "../mySalary/authority";
import * as API from "../../apis/ruleconfig";
import moment from "moment";
import "./index.less";
@ -18,14 +20,32 @@ class Index extends Component {
constructor(props) {
super(props);
this.state = {
selectedKey: "1",
selectedKey: "0", sysinfo: {}, tabs: [], store: { loading: false, hasRight: false },
salaryYearMonth: [
moment().subtract(1, 'year').startOf("year").format("YYYY-MM"),
moment().subtract(1, "year").startOf("year").format("YYYY-MM"),
moment().endOf("year").format("YYYY-MM")
]
};
}
async componentDidMount() {
const { data: sysinfo } = await API.sysinfo();
const { adjustShowStatus, salaryShowStatus } = sysinfo;
let tabs = [
{ key: "1", title: getLabel(111, "工资单") },
{ key: "2", title: getLabel(543150, "调薪记录") }
];
salaryShowStatus === "0" && (tabs = _.filter(tabs, o => o.key !== "1"));
adjustShowStatus === "0" && (tabs = _.filter(tabs, o => o.key !== "2"));
this.setState({ sysinfo, tabs }, () => {
const { tabs, store } = this.state;
this.setState({
selectedKey: !_.isEmpty(tabs) ? _.head(tabs).key : "0",
store: { ...store, hasRight: !_.isEmpty(tabs) }
});
});
}
renderContent = () => {
const { selectedKey, salaryYearMonth } = this.state;
let Dom = null;
@ -43,11 +63,7 @@ class Index extends Component {
};
render() {
const { selectedKey, salaryYearMonth } = this.state;
const tabs = [
{ key: "1", title: getLabel(111, "工资单") },
{ key: "2", title: getLabel(543150, "调薪记录") }
];
const { selectedKey, salaryYearMonth, tabs } = this.state;
const btns = [
<div className="flex-salary">
<div className="mysalary-search-title">{getLabel(542604, "薪资所属月")}</div>
@ -56,14 +72,17 @@ class Index extends Component {
</div>
];
return (
<WeaReqTop
title={getLabel(537998, "我的薪资福利")} icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D" tabDatas={tabs} className="mySalary_wrapper"
buttons={selectedKey === "1" ? btns : []} buttonSpace={10} selectedKey={selectedKey}
onChange={selectedKey => this.setState({ selectedKey })}
>
{this.renderContent()}
</WeaReqTop>
<Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`}
store={{ ...this.state.store }}>
<WeaReqTop
title={getLabel(537998, "我的薪资福利")} icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D" tabDatas={tabs} className="mySalary_wrapper"
buttons={selectedKey === "1" ? btns : []} buttonSpace={10} selectedKey={selectedKey}
onChange={selectedKey => this.setState({ selectedKey })}
>
{this.renderContent()}
</WeaReqTop>
</Authority>
);
}
}

View File

@ -47,7 +47,7 @@ export const conditions = [
items: [
{
conditionType: "SWITCH",
domkey: ["enctry"],
domkey: ["OPEN_APPLICATION_ENCRYPT"],
fieldcol: 10,
label: getLabel(526997, "加密设置"),
labelcol: 8,
@ -61,15 +61,15 @@ export const conditions = [
items: [
{
conditionType: "SWITCH",
domkey: ["operateTaxDeclaration"],
domkey: ["taxDeclarationFunction"],
fieldcol: 10,
label: getLabel(111, "系统算税"),
labelcol: 8,
viewAttr: 2
viewAttr: 1
},
{
conditionType: "SWITCH",
domkey: ["withDrawTaxDeclaration"],
domkey: ["WITHDRAW_TAX_DECLARATION"],
fieldcol: 10,
label: getLabel(111, "撤回申报表"),
labelcol: 8,
@ -83,7 +83,7 @@ export const conditions = [
items: [
{
conditionType: "SWITCH",
domkey: ["confValue"],
domkey: ["salaryArchiveDelete"],
fieldcol: 10,
label: getLabel(111, "允许删除档案"),
labelcol: 8,
@ -119,7 +119,7 @@ export const conditions = [
items: [
{
conditionType: "SELECT",
domkey: ["matchRuleOptions"],
domkey: ["matchRule"],
fieldcol: 10,
label: getLabel(111, "匹配规则"),
options: [],
@ -157,6 +157,36 @@ export const conditions = [
],
title: getLabel(111, "非系统人员"),
defaultshow: true
},
{
items: [
{
conditionType: "SWITCH",
domkey: ["salaryShowStatus"],
fieldcol: 10,
label: getLabel(111, "显示工资单页签"),
labelcol: 8,
viewAttr: 2
},
{
conditionType: "SWITCH",
domkey: ["adjustShowStatus"],
fieldcol: 10,
label: getLabel(111, "显示调薪记录页签"),
labelcol: 8,
viewAttr: 2
},
{
conditionType: "SWITCH",
domkey: ["taxAgentShowStatus"],
fieldcol: 10,
label: getLabel(111, "显示【个税扣缴义务人】信息"),
labelcol: 8,
viewAttr: 2
}
],
title: getLabel(111, "我的薪资福利设置"),
defaultshow: true
}
];
export const payloadList = [

View File

@ -14,8 +14,7 @@ export const renderRuleForm = (form, condition, onChange) => {
<WeaFormItem
label={`${fields.label}`} labelCol={{ span: `${fields.labelcol}` }}
wrapperCol={{ span: `${fields.fieldcol}` }} error={form.getError(fields)}
tipPosition="bottom"
>
tipPosition="bottom">
<WeaSwitch fieldConfig={fields} form={form} formParams={formParams} onChange={onChange}/>
</WeaFormItem>),
colSpan: 1,

View File

@ -6,11 +6,16 @@
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaLocaleProvider, WeaTop } from "ecCom";
import { WeaLocaleProvider, WeaTools, WeaTop } from "ecCom";
import { message, Modal } from "antd";
import * as API from "../../apis/ruleconfig";
import { conditions, payloadList } from "./conditions";
import { renderRuleForm } from "./form";
import { conditions } from "./conditions";
import { getConditionDomkeys } from "../../util";
import "./index.less";
import ProgressModal from "../../components/progressModal";
const getKey = WeaTools.getKey;
const getLabel = WeaLocaleProvider.getLabel;
@inject("baseFormStore")
@ -18,31 +23,287 @@ const getLabel = WeaLocaleProvider.getLabel;
class RuleConfig extends Component {
constructor(props) {
super(props);
this.state = {
conditions: []
};
this.state = { conditions: [], sysinfo: {}, progressVisible: false, progress: 50 };
this.timer = null;
}
componentDidMount() {
const { baseFormStore: { form } } = this.props;
form.initFormFields(conditions);
const promise = this.init();
}
init = async () => {
const { data: sysinfo } = await API.sysinfo();
const [{ data: matchRule }, { data: orderRule }, { data: ascOrDesc }, { data: rule }] =
await Promise.all(_.map(payloadList, it => API.commonEnumList(it)));
const optionsList = { matchRule, orderRule, ascOrDesc, rule };
this.setState({
sysinfo, conditions: _.map(conditions, item => ({
...item, items: _.map(item.items, o => {
if (getKey(o) === "matchRule" || getKey(o) === "orderRule" || getKey(o) === "ascOrDesc" || getKey(o) === "rule") {
return { ...o, options: _.map(optionsList[getKey(o)], g => ({ key: g.value, showname: g.defaultLabel })) };
} else if (getKey(o) === "OPEN_APPLICATION_ENCRYPT") {
return { ...o, viewAttr: sysinfo.showEncryptOperationButton === "true" ? 2 : 1 };
}
return { ...o };
})
}))
}, async () => {
const { baseFormStore: { form } } = this.props;
form.initFormFields(this.state.conditions);
await this.updateFormData();
});
};
handleChange = (value) => {
console.log(value);
updateFormData = async () => {
const { data: sysinfo } = await API.sysinfo();
const { baseFormStore: { form } } = this.props;
_.map(getConditionDomkeys(this.state.conditions), item => {
if (item === "rule") {
form.updateFields({ [item]: { value: sysinfo["matchEmployeeMode"] || "" } });
} else if (item === "matchRule") {
form.updateFields({ [item]: { value: sysinfo["salaryAcctEmployeeRule"] || "" } });
} else if (item === "taxDeclarationFunction") {
form.updateFields({ [item]: { value: sysinfo["taxDeclarationFunction"] === "0" ? "0" : "1" } });
} else if (item === "taxAgentShowStatus" || item === "salaryShowStatus" || item === "adjustShowStatus") {
form.updateFields({ [item]: { value: sysinfo[item] || "1" } });
} else {
form.updateFields({ [item]: { value: sysinfo[item] || "" } });
}
});
};
handleChange = (params) => {
const key = _.keys(params)[0];
const val = params[key].value;
Modal.confirm({
title: getLabel(131329, "信息确认"),
content: (key === "taxDeclarationFunction" && val === "0") ? getLabel(544276, "关闭之后,将无法开启,确认要保存吗?") : getLabel(543854, "确认要保存吗?"),
onOk: () => {
switch (key) {
case "orderRule":
case "ascOrDesc":
this.updateOrderRule();
break;
case "rule":
this.saveMatchEmployeeModeRule();
break;
case "OPEN_APPLICATION_ENCRYPT":
this.saveEncryptSetting();
break;
case "taxDeclarationFunction":
this.operateTaxDeclarationFunction();
break;
case "matchRule":
this.saveSalaryAcctEmployeeRule();
break;
case "WITHDRAW_TAX_DECLARATION":
case "salaryArchiveDelete":
const url = {
WITHDRAW_TAX_DECLARATION: "saveWithDrawTaxDeclaration", salaryArchiveDelete: "saveArchiveDelete"
};
this.ruleSettings(key, url[key]);
break;
case "welBaseDiffByPerAndCom":
case "welBaseAutoAdjust":
case "salaryAcctFixedColumns":
case "extEmpsWitch":
case "taxAgentShowStatus":
case "salaryShowStatus":
case "adjustShowStatus":
const confTitle = {
welBaseDiffByPerAndCom: getLabel(111, "福利档案基数区分个人和公司"),
welBaseAutoAdjust: getLabel(111, "福利档案导入基数不符合要求时自动调整为上限/下限"),
salaryAcctFixedColumns: getLabel(545791, "薪资核算固定列头数"),
extEmpsWitch: getLabel(544097, "开启非系统人员"),
taxAgentShowStatus: getLabel(111, "显示【个税扣缴义务人】信息"),
salaryShowStatus: getLabel(111, "显示工资单页签"),
adjustShowStatus: getLabel(111, "显示调薪记录页签")
};
this.unifiedSettings(key, confTitle[key]);
break;
default:
break;
}
},
onCancel: () => this.updateFormData()
});
};
/*
* Author: 黎永顺
* Description:排序规则-保存
* Params:
* Date: 2024/2/26
*/
updateOrderRule = () => {
const { baseFormStore: { form } } = this.props;
const { orderRule, ascOrDesc } = form.getFormParams();
API.updateOrderRule({ orderRule, ascOrDesc }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(22619, "保存成功!"));
} else {
message.error(errormsg || getLabel(22620, "保存失败!"));
}
});
};
/*
* Author: 黎永顺
* Description: 人员校验规则-人员字段保存
* Params:
* Date: 2024/2/26
*/
saveMatchEmployeeModeRule = () => {
const { baseFormStore: { form } } = this.props;
const { rule } = form.getFormParams();
API.saveMatchEmployeeModeRule({ rule }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(22619, "保存成功!"));
} else {
message.error(errormsg || getLabel(22620, "保存失败!"));
}
});
};
/*
* Author: 黎永顺
* Description: 薪资核算人员匹配规则-匹配规则
* Params:
* Date: 2024/2/26
*/
saveSalaryAcctEmployeeRule = () => {
const { baseFormStore: { form } } = this.props;
const { matchRule: rule } = form.getFormParams();
API.saveSalaryAcctEmployeeRule({ rule }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(22619, "保存成功!"));
} else {
message.error(errormsg || getLabel(22620, "保存失败!"));
}
});
};
/*
* Author: 黎永顺
* Description: 算税规则-系统算税设置
* Params:
* Date: 2024/2/26
*/
operateTaxDeclarationFunction = () => {
const { baseFormStore: { form } } = this.props;
const { taxDeclarationFunction: operateTaxDeclaration } = form.getFormParams();
API.operateTaxDeclarationFunction({ operateTaxDeclaration }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(22619, "保存成功!"));
} else {
message.error(errormsg || getLabel(22620, "保存失败!"));
}
});
};
/*
* Author: 黎永顺
* Description: 加密设置
* Params:
* Date: 2024/2/26
*/
saveEncryptSetting = () => {
const { baseFormStore: { form } } = this.props;
const { OPEN_APPLICATION_ENCRYPT: isOpenEncrypt } = form.getFormParams();
API.saveEncryptSetting({ isOpenEncrypt }).then(({ data, status, errormsg }) => {
if (status) {
const { isSuccess, progressId, msg } = data;
if (!isSuccess) {
message.error(errormsg || msg || getLabel(22620, "保存失败!"));
return;
}
this.setState({ progressVisible: true, progress: 0 }, () => {
let number = 1;
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
API.getEncryptProgress({ progressId }).then(({ status, data, errormsg }) => {
const { progress_statue } = data;
if (progress_statue === "success" && this.timer) {
clearInterval(this.timer);
this.timer = null;
number = 1;
this.setState({
progress: 100
}, () => {
this.setState({
progressVisible: false
});
});
message.success(getLabel(22619, "保存成功!"));
} else if (progress_statue === "in_progress" && this.timer) {
if (this.state.progress >= 90) {
this.setState({
progress: this.state.progress + (0.001 * this.state.progress)
});
} else {
this.setState({
progress: 10 * number
}, () => number++);
}
} else if (!status || (progress_statue === "fail" && this.timer)) {
clearInterval(this.timer);
this.timer = null;
number = 1;
this.setState({
progress: 100
}, () => {
this.setState({
progressVisible: false
});
});
message.error(errormsg || getLabel(22620, "保存失败!"));
}
});
}, 1000);
});
}
});
};
/*
* Author: 黎永顺
* Description: 规则设置
* Params:
* Date: 2024/2/26
*/
ruleSettings = (key, urlName) => {
const { baseFormStore: { form } } = this.props;
const payload = { confValue: form.getFormParams()[key] };
API[urlName](payload).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(22619, "保存成功!"));
} else {
message.error(errormsg || getLabel(22620, "保存失败!"));
}
});
};
unifiedSettings = (confKey, confTitle) => {
const { baseFormStore: { form } } = this.props;
let payload = {
confKey, confValue: form.getFormParams()[confKey],
module: "basic", title: confTitle
};
API.saveSysOperate(payload).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(22619, "保存成功!"));
} else {
message.error(errormsg || getLabel(22620, "保存失败!"));
}
});
};
render() {
const { baseFormStore: { form } } = this.props;
const { conditions, progressVisible, progress } = this.state;
return (
<WeaTop
title={<span>{getLabel(543355, "规则配置")}</span>} icon={<i className="icon-coms-Flow-setting"/>}
iconBgcolor="#F14A2D" buttons={[]} className="ruleWrapper-layout"
>
<div className="ruleWrapper">{renderRuleForm(form, conditions, this.handleChange)}</div>
{/*加解密进度条*/}
{
progressVisible &&
<ProgressModal title={getLabel(543360, "加密/解密中...")} visible={progressVisible} progress={progress}
onCancel={() => this.setState({ progressVisible: false, progress: 0 })}/>
}
</WeaTop>
);
}