From 54adc6cc2e2115079fa6ea6977569166e1dc018b Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Tue, 18 Feb 2025 15:42:40 +0800 Subject: [PATCH] =?UTF-8?q?release/3.0.0.2502.01-=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ledgerAdjustRuleAddModal.js | 221 +++++++++++------- pc4mobx/hrmSalary/pages/ledgerPage/config.js | 29 +++ pc4mobx/hrmSalary/stores/ledger.js | 3 +- 3 files changed, 163 insertions(+), 90 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAdjustRuleAddModal.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAdjustRuleAddModal.js index b81b506e..eea87be3 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAdjustRuleAddModal.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerAdjustRuleAddModal.js @@ -5,12 +5,19 @@ * Date: 2022/12/12 */ import React, { Component } from "react"; -import { WeaDialog, WeaFormItem, WeaHelpfulTip, WeaSearchGroup, WeaSelect } from "ecCom"; -import { Button, Modal, Radio } from "antd"; -import { monthDays } from "../config"; +import { inject, observer } from "mobx-react"; +import { WeaDialog, WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaTools } from "ecCom"; +import FormInfo from "../../../components/FormInfo"; +import { WeaSwitch } from "comsMobx"; +import { Button, Modal } from "antd"; import { listSalarySobItem } from "../../../apis/ledger"; -import "./index.less"; +import { monthDays, ruleConditions } from "../config"; +const { getLabel } = WeaLocaleProvider; +const getKey = WeaTools.getKey; + +@inject("ledgerStore") +@observer class LedgerAdjustRuleAddModal extends Component { constructor(props) { super(props); @@ -20,25 +27,39 @@ class LedgerAdjustRuleAddModal extends Component { salaryItemId: "", salaryItemName: "", dayOfMonth: "1", - salaryItemOptions: [] + salaryItemOptions: [], + conditions: [] }; } componentWillReceiveProps(nextProps, nextContext) { - if (nextProps.visible !== this.props.visible && nextProps.salarySobId) this.listSalarySobItem(nextProps.salarySobId); + if (nextProps.visible !== this.props.visible && nextProps.visible) this.listSalarySobItem(nextProps.salarySobId); } listSalarySobItem = (salarySobId) => { const { salaryRuleItemsList } = this.props; const payload = { - excludeSalaryItemIds: _.map(salaryRuleItemsList, item => item.salaryItemId), - salarySobId + excludeSalaryItemIds: _.map(salaryRuleItemsList, item => item.salaryItemId), salarySobId }; listSalarySobItem(payload).then(({ status, data }) => { if (status) { this.setState({ - salaryItemOptions: _.map(data, it => ({ key: it.salaryItemId.toString(), showname: it.salaryItemName })) - }); + conditions: _.map(ruleConditions, item => ({ + ...item, items: _.map(item.items, o => { + if (getKey(o) === "salaryItemId") { + return { + ...o, label: getLabel(o.lanId, o.label), + options: _.map(data, it => ({ key: it.salaryItemId.toString(), showname: it.salaryItemName })) + }; + } else if (getKey(o) === "dayOfMonth") { + return { ...o, label: getLabel(o.lanId, o.label), options: monthDays }; + } + return { + ...o, label: getLabel(o.lanId, o.label), helpfulTip: getLabel(o.helpfulTipLanId, o.helpfulTip) + }; + }) + })) + }, () => this.props.ledgerStore.ruleForm.initFormFields(this.state.conditions)); } }); }; @@ -86,89 +107,111 @@ class LedgerAdjustRuleAddModal extends Component { salaryItemOptions, dayOfMonth, beforeAdjustmentType, - afterAdjustmentType + afterAdjustmentType, + conditions } = this.state; - const { title, visible } = this.props; - const buttons = []; - return ( - - - - this.setState({ salaryItemId, salaryItemName })} - /> - - } labelCol={{ span: 4 }} wrapperCol={{ span: 20 }} colon={false}> -
-
- 如果:调薪生效日期在 - this.setState({ dayOfMonth })} - /> - (含)之前 -
-
- 计薪规则为: - this.setState({ beforeAdjustmentType: e.target.value })} - value={beforeAdjustmentType}> - 取调整后薪资 - 分段计薪 - 取平均 - - -
-
否则:调薪生效日期在{dayOfMonth}号之后
-
- 计薪规则为: - this.setState({ afterAdjustmentType: e.target.value })} - value={afterAdjustmentType}> - 取调整前薪资 - 分段计薪 - 取平均 - - + const { title, visible, ledgerStore: { ruleForm } } = this.props; + const buttons = []; + const itemRender = { + salaryItemId: (field, textAreaProps, form, formParams) => { + return (); + }, + dayOfMonth: () => null + }; + const childrenComponents = { + salaryItemId: () => { + const coms = [], { fieldMap } = ruleForm; + coms.push( + +
+
+
{fieldMap["dayOfMonth"].label}
- + ); + return [ + { + com:
{coms}
, + col: 1 + } + ]; + } + }; + return ( + + + {/**/} + {/* */} + {/* this.setState({ salaryItemId, salaryItemName })}*/} + {/* />*/} + {/* */} + {/* } labelCol={{ span: 4 }} wrapperCol={{ span: 20 }} colon={false}>*/} + {/*
*/} + {/*
*/} + {/* 如果:调薪生效日期在*/} + {/* this.setState({ dayOfMonth })}*/} + {/* />*/} + {/* (含)之前*/} + {/*
*/} + {/*
*/} + {/* 计薪规则为:*/} + {/* this.setState({ beforeAdjustmentType: e.target.value })}*/} + {/* value={beforeAdjustmentType}>*/} + {/* 取调整后薪资*/} + {/* 分段计薪*/} + {/* 取平均*/} + {/* */} + {/* */} + {/*
*/} + {/*
否则:调薪生效日期在{dayOfMonth}号之后
*/} + {/*
*/} + {/* 计薪规则为:*/} + {/* this.setState({ afterAdjustmentType: e.target.value })}*/} + {/* value={afterAdjustmentType}>*/} + {/* 取调整前薪资*/} + {/* 分段计薪*/} + {/* 取平均*/} + {/* */} + {/* */} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/}
); } diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/config.js b/pc4mobx/hrmSalary/pages/ledgerPage/config.js index 214982ed..e6726805 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/config.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/config.js @@ -859,3 +859,32 @@ export const classifyConditions = [ defaultshow: true } ]; +export const ruleConditions = [//调薪计薪规则项表单 + { + items: [ + { + conditionType: "SELECT", + domkey: ["salaryItemId"], + fieldcol: 8, + rules: "required|string", + label: "薪资项目", + lanId: 111, + labelcol: 6, + value: "", + multiple: true, + viewAttr: 3 + }, + { + conditionType: "SELECT", + domkey: ["dayOfMonth"], + fieldcol: 6, + label: "如果:调薪生效日期在", + lanId: 111, + labelcol: 0, + value: "", + viewAttr: 2 + } + ], + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/stores/ledger.js b/pc4mobx/hrmSalary/stores/ledger.js index 0411826d..6aaff1b8 100644 --- a/pc4mobx/hrmSalary/stores/ledger.js +++ b/pc4mobx/hrmSalary/stores/ledger.js @@ -17,7 +17,8 @@ export class LedgerStore { @action initAARForm = (v) => this.AARForm = new WeaForm();//重置核算审批规则form @action initAARClassifyForm = (v) => this.AARClassifyForm = new WeaForm();//重置审批规则分类编辑form - + @observable ruleForm = new WeaForm(); // 调薪计薪规则项form + @action initRuleForm = (v) => this.ruleForm = new WeaForm();//重置调薪计薪规则项form /*******************************************************/ @observable tableStore = new TableStore(); // new table