diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js index 07c4cd0d..e97f89c6 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSlide.js @@ -16,6 +16,7 @@ import LedgerBackCalculatedSalaryItem from "./ledgerBackCalculatedSalaryItem"; import LedgerSalaryItem from "./ledgerSalaryItem"; import LedgerAccountApprRule from "./ledgerAccountApprRule"; import { salaryApprovalSaveForm, saveAdjustmentRule, saveLedgerBasic, saveLedgerItem } from "../../../apis/ledger"; +import { sysConfCodeRule } from "../../../apis/ruleconfig"; import "./index.less"; const Step = WeaSteps.Step; @@ -32,10 +33,18 @@ class LedgerSlide extends Component { baseSettingInfo: {}, adjustRules: [], empFields: [], itemGroups: [], - saveSalarySobId: "" + saveSalarySobId: "", + salaryApprovalStatus: false }; } + async componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + const { data } = await sysConfCodeRule({ code: "SALARY_APPROVAL_STATUS" }); + this.setState({ salaryApprovalStatus: data === "1" }); + } + } + componentWillUnmount() { this.setState({ saveSalarySobId: "" @@ -225,7 +234,7 @@ class LedgerSlide extends Component { }; renderCustomOperate = () => { const { taxAgentStore: { showOperateBtn }, editId } = this.props; - const { current, loading } = this.state; + const { current, loading, salaryApprovalStatus } = this.state; let CurrentDom = []; //管理员操作权限 if (showOperateBtn) { @@ -272,16 +281,25 @@ class LedgerSlide extends Component { ] : []; break; case 4: - CurrentDom = !editId ? - [ - , - , - - ] : [ - - ]; + const btns = salaryApprovalStatus ? [ + , + , + + ] : [ + , + + ]; + CurrentDom = !editId ? btns : [ + + ]; break; default: CurrentDom = !editId ? @@ -304,7 +322,7 @@ class LedgerSlide extends Component { render() { const { title, visible, editId, taxAgentStore: { showOperateBtn } } = this.props; - const { current } = this.state; + const { current, salaryApprovalStatus } = this.state; const tabs = [ { key: 0, title: getLabel(82751, "基础设置") }, { key: 1, title: getLabel(543467, "关联人员") }, @@ -313,6 +331,7 @@ class LedgerSlide extends Component { { key: 4, title: getLabel(543469, "调薪计薪规则") }, { key: 10, title: getLabel(111, "核算审批规则") } ]; + !salaryApprovalStatus && tabs.splice(_.indexOf(tabs, { key: 10 }), 1); return ( ({ - ...item, + ...item, title: getLabel(item.lanId, item.title), 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 })) }; + return { + ...o, label: getLabel(o.lanId, o.label), + 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, label: getLabel(o.lanId, o.label), + viewAttr: sysinfo.showEncryptOperationButton === "true" ? 2 : 1 + }; } else if (getKey(o) === "taxDeclarationFunction") { return { - ...o, + ...o, label: getLabel(o.lanId, o.label), viewAttr: (_.isNil(sysinfo.taxDeclarationFunction) || sysinfo.taxDeclarationFunction !== "0") ? 2 : 1 }; + } else if ( + getKey(o) === "APPROVAL_CAN_MANUAL_FILE_STATUS" || getKey(o) === "APPROVAL_CAN_RE_CALC_STATUS" || getKey(o) === "APPROVAL_CAN_EDIT_RESULT_STATUS" + ) { + return { + ...o, label: getLabel(o.lanId, o.label), + hide: sysinfo["SALARY_APPROVAL_STATUS"] === "0" || _.isNil(sysinfo["SALARY_APPROVAL_STATUS"]) + }; } - return { ...o }; + return { ...o, label: getLabel(o.lanId, o.label) }; }) })) }, async () => { @@ -73,6 +86,10 @@ class RuleConfig extends Component { form.updateFields({ [item]: { value: sysinfo[item] || "1" } }); } else if (item === "OPEN_APPLICATION_ENCRYPT") { form.updateFields({ [item]: { value: _.isNil(sysinfo[item]) ? "1" : (sysinfo[item] || "") } }); + } else if ( + item === "APPROVAL_CAN_MANUAL_FILE_STATUS" || item === "APPROVAL_CAN_RE_CALC_STATUS" || item === "APPROVAL_CAN_EDIT_RESULT_STATUS" + ) { + form.updateFields({ [item]: { value: _.isNil(sysinfo[item]) ? "1" : (sysinfo[item] || "0") } }); } else { form.updateFields({ [item]: { value: sysinfo[item] || "" } }); } @@ -116,6 +133,10 @@ class RuleConfig extends Component { case "taxAgentShowStatus": case "salaryShowStatus": case "adjustShowStatus": + case "SALARY_APPROVAL_STATUS": + case "APPROVAL_CAN_MANUAL_FILE_STATUS": + case "APPROVAL_CAN_RE_CALC_STATUS": + case "APPROVAL_CAN_EDIT_RESULT_STATUS": const confTitle = { welBaseDiffByPerAndCom: getLabel(111, "福利档案基数区分个人和公司"), welBaseAutoAdjust: getLabel(111, "福利档案导入基数不符合要求时自动调整为上限/下限"), @@ -123,7 +144,11 @@ class RuleConfig extends Component { extEmpsWitch: getLabel(544097, "开启非系统人员"), taxAgentShowStatus: getLabel(111, "显示【个税扣缴义务人】信息"), salaryShowStatus: getLabel(111, "显示工资单页签"), - adjustShowStatus: getLabel(111, "显示调薪记录页签") + adjustShowStatus: getLabel(111, "显示调薪记录页签"), + SALARY_APPROVAL_STATUS: getLabel(111, "是否开启薪资审批"), + APPROVAL_CAN_MANUAL_FILE_STATUS: getLabel(111, "开启审批的核算记录允许手动归档"), + APPROVAL_CAN_RE_CALC_STATUS: getLabel(111, "开启审批的核算记录允许重新核算"), + APPROVAL_CAN_EDIT_RESULT_STATUS: getLabel(111, "审批流程发起后允许修改核算数据") }; this.unifiedSettings(key, confTitle[key]); break; @@ -292,6 +317,20 @@ class RuleConfig extends Component { API.saveSysOperate(payload).then(({ status, errormsg }) => { if (status) { message.success(getLabel(22619, "保存成功!")); + if (confKey === "SALARY_APPROVAL_STATUS") { + this.setState({ + conditions: _.map(this.state.conditions, item => ({ + ...item, items: _.map(item.items, o => { + if ( + getKey(o) === "APPROVAL_CAN_MANUAL_FILE_STATUS" || getKey(o) === "APPROVAL_CAN_RE_CALC_STATUS" || getKey(o) === "APPROVAL_CAN_EDIT_RESULT_STATUS" + ) { + return { ...o, hide: form.getFormParams()[confKey] === "0" }; + } + return { ...o }; + }) + })) + }); + } } else { message.error(errormsg || getLabel(22620, "保存失败!")); }