diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index 072f856a..b116155e 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -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 = ( - diff --git a/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js b/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js index 89d25e4d..7f8a1678 100644 --- a/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js +++ b/pc4mobx/hrmSalary/pages/mySalaryBenefits/index.js @@ -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 = [
{getLabel(542604, "薪资所属月")}
@@ -56,14 +72,17 @@ class Index extends Component {
]; return ( - } - iconBgcolor="#F14A2D" tabDatas={tabs} className="mySalary_wrapper" - buttons={selectedKey === "1" ? btns : []} buttonSpace={10} selectedKey={selectedKey} - onChange={selectedKey => this.setState({ selectedKey })} - > - {this.renderContent()} - + + } + iconBgcolor="#F14A2D" tabDatas={tabs} className="mySalary_wrapper" + buttons={selectedKey === "1" ? btns : []} buttonSpace={10} selectedKey={selectedKey} + onChange={selectedKey => this.setState({ selectedKey })} + > + {this.renderContent()} + + ); } } diff --git a/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js b/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js index 90dbfd6c..c04384b0 100644 --- a/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js +++ b/pc4mobx/hrmSalary/pages/ruleConfig/conditions.js @@ -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 = [ diff --git a/pc4mobx/hrmSalary/pages/ruleConfig/form.js b/pc4mobx/hrmSalary/pages/ruleConfig/form.js index 770ebc7b..c1308ec4 100644 --- a/pc4mobx/hrmSalary/pages/ruleConfig/form.js +++ b/pc4mobx/hrmSalary/pages/ruleConfig/form.js @@ -14,8 +14,7 @@ export const renderRuleForm = (form, condition, onChange) => { + tipPosition="bottom"> ), colSpan: 1, diff --git a/pc4mobx/hrmSalary/pages/ruleConfig/ruleConfig.js b/pc4mobx/hrmSalary/pages/ruleConfig/ruleConfig.js index bbaa3bec..45049a14 100644 --- a/pc4mobx/hrmSalary/pages/ruleConfig/ruleConfig.js +++ b/pc4mobx/hrmSalary/pages/ruleConfig/ruleConfig.js @@ -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 ( {getLabel(543355, "规则配置")}} icon={} iconBgcolor="#F14A2D" buttons={[]} className="ruleWrapper-layout" >
{renderRuleForm(form, conditions, this.handleChange)}
+ {/*加解密进度条*/} + { + progressVisible && + this.setState({ progressVisible: false, progress: 0 })}/> + }
); }