Merge branch 'feature/2.10.1.2402.01-我的薪资福利显示基础配置' into release/2.10.1.2402.01

# Conflicts:
#	pc4mobx/hrmSalary/index.js
This commit is contained in:
黎永顺 2024-03-05 14:25:33 +08:00
commit 3f23bc29e5
7 changed files with 636 additions and 42 deletions

View File

@ -40,7 +40,7 @@ import TemplatePreview from "./pages/payroll/templatePreview";
import PayrollTemplatePreview from "./pages/payroll/templatePreview/tmpPreview"; //重构的工资单模板预览页面
import MobilePayroll from "./pages/mobilePayroll";
import SysConfig from "./pages/sysConfig";
import RuleConfig from "./pages/ruleConfig";
import RuleConfig from "./pages/ruleConfig/ruleConfig";
import Appconfig from "./pages/appConfig";
import FieldManagement from "./pages/fieldManagement";
import AnalysisOfSalaryStatistics from "./pages/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

@ -0,0 +1,197 @@
import React from "react";
import { WeaLocaleProvider } from "ecCom";
const getLabel = WeaLocaleProvider.getLabel;
export const conditions = [
{
items: [
{
conditionType: "SELECT",
domkey: ["orderRule"],
fieldcol: 10,
label: getLabel(15512, "排序字段"),
labelcol: 8,
options: [],
viewAttr: 2
},
{
conditionType: "SELECT",
domkey: ["ascOrDesc"],
fieldcol: 10,
label: getLabel(543351, "正序/倒序"),
labelcol: 8,
options: [],
viewAttr: 2
}
],
title: getLabel(543356, "排序规则"),
defaultshow: true
},
{
items: [
{
conditionType: "SELECT",
domkey: ["rule"],
fieldcol: 10,
label: getLabel(543352, "人员字段"),
labelcol: 8,
options: [],
viewAttr: 2
}
],
title: getLabel(543357, "人员校验规则"),
defaultshow: true
},
{
items: [
{
conditionType: "SWITCH",
domkey: ["OPEN_APPLICATION_ENCRYPT"],
fieldcol: 10,
label: getLabel(526997, "加密设置"),
labelcol: 8,
viewAttr: 2
}
],
title: getLabel(543358, "加密规则"),
defaultshow: true
},
{
items: [
{
conditionType: "SWITCH",
domkey: ["taxDeclarationFunction"],
fieldcol: 10,
label: getLabel(111, "系统算税"),
labelcol: 8,
viewAttr: 1
},
{
conditionType: "SWITCH",
domkey: ["WITHDRAW_TAX_DECLARATION"],
fieldcol: 10,
label: getLabel(111, "撤回申报表"),
labelcol: 8,
viewAttr: 2
}
],
title: getLabel(111, "算税规则"),
defaultshow: true
},
{
items: [
{
conditionType: "SWITCH",
domkey: ["salaryArchiveDelete"],
fieldcol: 10,
label: getLabel(111, "允许删除档案"),
labelcol: 8,
viewAttr: 2
}
],
title: getLabel(538004, "薪资档案"),
defaultshow: true
},
{
items: [
{
conditionType: "SWITCH",
domkey: ["welBaseDiffByPerAndCom"],
fieldcol: 10,
label: getLabel(111, "区分个人和公司"),
labelcol: 8,
viewAttr: 2
},
{
conditionType: "SWITCH",
domkey: ["welBaseAutoAdjust"],
fieldcol: 10,
label: getLabel(111, "导入基数自动调整上/下限"),
labelcol: 8,
viewAttr: 2
}
],
title: getLabel(111, "福利档案基数"),
defaultshow: true
},
{
items: [
{
conditionType: "SELECT",
domkey: ["matchRule"],
fieldcol: 10,
label: getLabel(111, "匹配规则"),
options: [],
labelcol: 8,
viewAttr: 2
}
],
title: getLabel(111, "薪资核算人员匹配规则"),
defaultshow: true
},
{
items: [
{
conditionType: "INPUTNUMBER",
domkey: ["salaryAcctFixedColumns"],
fieldcol: 10,
label: getLabel(111, "固定数"),
labelcol: 8,
viewAttr: 2
}
],
title: getLabel(111, "薪资核算固定列头数"),
defaultshow: true
},
{
items: [
{
conditionType: "SWITCH",
domkey: ["extEmpsWitch"],
fieldcol: 10,
label: getLabel(111, "开启非系统人员"),
labelcol: 8,
viewAttr: 2
}
],
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 = [
{ enumClass: "com.engine.salary.sys.enums.SalaryAcctEmployeeRuleEnum" },
{ enumClass: "com.engine.salary.sys.enums.OrderRuleEnum" },
{ enumClass: "com.engine.salary.sys.enums.AscOrDescEnum" },
{ enumClass: "com.engine.salary.sys.enums.MatchEmployeeModeEnum" }
];

View File

@ -0,0 +1,30 @@
import React from "react";
import { WeaFormItem, WeaSearchGroup } from "ecCom";
import { WeaSwitch } from "comsMobx";
export const renderRuleForm = (form, condition, onChange) => {
const { isFormInit } = form;
const formParams = form.getFormParams();
let group = [];
isFormInit && condition && condition.map(c => {
let items = [];
c.items.map(fields => {
items.push({
com: (
<WeaFormItem
label={`${fields.label}`} labelCol={{ span: `${fields.labelcol}` }}
wrapperCol={{ span: `${fields.fieldcol}` }} error={form.getError(fields)}
tipPosition="bottom">
<WeaSwitch fieldConfig={fields} form={form} formParams={formParams} onChange={onChange}/>
</WeaFormItem>),
colSpan: 1,
hide: fields.hide
});
});
!_.isEmpty(items) && group.push(
<WeaSearchGroup col={1} needTigger={true} showGroup={c.defaultshow} items={items} center={false}
title={c.title}
/>);
});
return group;
};

View File

@ -1,9 +1,44 @@
.ruleWrapper {
height: 100%;
.ruleWrapper-layout {
.wea-new-top-content {
overflow: hidden !important;
.titleWrapper {
display: flex;
justify-content: space-between;
align-items: center;
.ruleWrapper {
padding: 16px;
background: #e5e5e5;
height: 100%;
overflow: hidden auto;
.wea-search-group {
background: #fff;
margin-bottom: 16px;
.wea-content {
padding: 8px !important;
.wea-form-cell:not(:last-child) {
.wea-form-item {
border-bottom: 1px solid #e5e5e5;
}
}
}
}
.wea-search-group, .wea-form-cell {
padding: 0;
.wea-form-item {
padding: 5px 16px;
.wea-form-item-label {
color: #666;
}
}
}
.wea-form-cell-wrapper {
background: #FFF;
border: 1px solid #e5e5e5;
}
}
}
}

View File

@ -0,0 +1,312 @@
/*
* Author: 黎永顺
* name: 规则配置
* Description:
* Date: 2024/2/23
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
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 { getConditionDomkeys } from "../../util";
import "./index.less";
import ProgressModal from "../../components/progressModal";
const getKey = WeaTools.getKey;
const getLabel = WeaLocaleProvider.getLabel;
@inject("baseFormStore")
@observer
class RuleConfig extends Component {
constructor(props) {
super(props);
this.state = { conditions: [], sysinfo: {}, progressVisible: false, progress: 50 };
this.timer = null;
}
componentDidMount() {
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();
});
};
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>
);
}
}
export default RuleConfig;

View File

@ -1,15 +1,16 @@
import { observable, action, toJS } from 'mobx';
import { message } from 'antd';
import { WeaForm, WeaLogView } from 'comsMobx';
import { WeaLocaleProvider } from 'ecCom';
import { action, observable } from "mobx";
import { message } from "antd";
import { WeaForm, WeaLogView } from "comsMobx";
import { WeaLocaleProvider } from "ecCom";
import * as API from '../apis'; // 引入API接口文件
import * as API from "../apis"; // 引入API接口文件
const {LogStore} = WeaLogView;
const { LogStore } = WeaLogView;
const getLabel = WeaLocaleProvider.getLabel;
export class BaseFormStore {
@observable form = new WeaForm(); // nrew 一个form
@observable form = new WeaForm(); // 规则渲染form
@observable logStore = new LogStore();
@observable condition = []; // 存储后台得到的form数据
@observable saveLoading = false; // 保存状态处理:保证保存的时候接口只走一次
@ -18,9 +19,9 @@ export class BaseFormStore {
@observable logVisible = false; // 控制日志弹框的显影
@action // 初始化操作: 一般用来初始化获取后台数据
doInit = () =>{
doInit = () => {
this.getBaseForm();
}
};
@action // 获得form配置数据
getBaseForm = () => {
@ -32,22 +33,22 @@ export class BaseFormStore {
this.form.initFormFields(result.condition);
}
}));
}
};
@action // 保存
saveForm = () => {
this.form.validateForm().then(action(f=>{ // 表单的校验: 直接使用form的validateForm方法即可
this.form.validateForm().then(action(f => { // 表单的校验: 直接使用form的validateForm方法即可
if (f.isValid) { // 校验听过: 走保存接口
this.saveLoading = true;
const params = this.form.getFormParams();
API.saveForm(params).then(action(
result => {
this.saveLoading = false
if(result.api_status){ // 保存成功: 1、给出提示 2、刷新form数据
message.success(`${getLabel(18758,'保存成功')}`);
this.saveLoading = false;
if (result.api_status) { // 保存成功: 1、给出提示 2、刷新form数据
message.success(`${getLabel(18758, "保存成功")}`);
this.getBaseForm();
}else {
message.error(`${getLabel(22620,'保存失败')}`);
} else {
message.error(`${getLabel(22620, "保存失败")}`);
}
}
));
@ -55,9 +56,9 @@ export class BaseFormStore {
f.showErrors();
}
}));
}
};
@action
setLogVisible = bool => this.logVisible = bool
}
setLogVisible = bool => this.logVisible = bool;
}