release/3.0.0.2502.01-合并业务线

This commit is contained in:
lys 2025-02-18 17:30:21 +08:00
parent 7c85cbae4f
commit b6a0678f1a
3 changed files with 111 additions and 179 deletions

View File

@ -91,39 +91,14 @@
//调薪计薪规则弹框
.adjustRuleModalWrapper {
.titleTipWrapper {
display: flex;
align-items: center;
.calcRules .cust {
line-height: 30px;
.title {
margin-right: 4px;
}
}
.adjustRuleDetailWrapper {
display: flex;
flex-direction: column;
.adjustSalaryFlex {
.child {
display: flex;
align-items: center;
margin-bottom: 10px;
}
}
.wea-select, .ant-select-selection, .ant-select {
width: 100%;
}
.wea-select {
display: inline-block;
position: relative;
}
.ant-select-selection {
height: 30px;
border-radius: 0;
}
}
// 回算薪资项目
@ -249,7 +224,7 @@
padding: 0;
background: transparent;
border: none;
font-size: 20px!important;
font-size: 20px !important;
line-height: 20px;
}

View File

@ -9,9 +9,10 @@ import { inject, observer } from "mobx-react";
import { WeaDialog, WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSelect, WeaTools } from "ecCom";
import FormInfo from "../../../components/FormInfo";
import { WeaSwitch } from "comsMobx";
import { Button, Modal } from "antd";
import { Button } from "antd";
import { listSalarySobItem } from "../../../apis/ledger";
import { monthDays, ruleConditions } from "../config";
import "./index.less";
const { getLabel } = WeaLocaleProvider;
const getKey = WeaTools.getKey;
@ -21,19 +22,12 @@ const getKey = WeaTools.getKey;
class LedgerAdjustRuleAddModal extends Component {
constructor(props) {
super(props);
this.state = {
beforeAdjustmentType: 2,
afterAdjustmentType: 1,
salaryItemId: "",
salaryItemName: "",
dayOfMonth: "1",
salaryItemOptions: [],
conditions: []
};
this.state = { conditions: [] };
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.listSalarySobItem(nextProps.salarySobId);
if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.ledgerStore.initRuleForm();
}
listSalarySobItem = (salarySobId) => {
@ -46,17 +40,26 @@ class LedgerAdjustRuleAddModal extends Component {
this.setState({
conditions: _.map(ruleConditions, item => ({
...item, items: _.map(item.items, o => {
o = { ...o, label: getLabel(o.lanId, o.label) };
if (getKey(o) === "salaryItemId") {
return {
...o, label: getLabel(o.lanId, o.label),
options: _.map(data, it => ({ key: it.salaryItemId.toString(), showname: it.salaryItemName }))
...o, 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, options: monthDays };
} else if (getKey(o) === "beforeAdjustmentType" || getKey(o) === "afterAdjustmentType") {
return {
...o,
options: _.map(o.options, k => ({
...k,
showname: !k.helpfultip ? getLabel(k.lanId, k.showname) : <span>
<span style={{ marginRight: 4 }}>{getLabel(k.lanId, k.showname)}</span>
<WeaHelpfulTip title={getLabel(k.helpfultiplanId, k.helpfultip)}/>
</span>
}))
};
}
return {
...o, label: getLabel(o.lanId, o.label), helpfulTip: getLabel(o.helpfulTipLanId, o.helpfulTip)
};
return o;
})
}))
}, () => this.props.ledgerStore.ruleForm.initFormFields(this.state.conditions));
@ -64,156 +67,77 @@ class LedgerAdjustRuleAddModal extends Component {
});
};
handleSave = () => {
const { salaryRuleItemsList, onSave } = this.props;
const { salaryItemOptions, ...extraItems } = this.state;
if (_.isEmpty(extraItems.salaryItemId)) {
Modal.warning({
title: "信息确认",
content: "必要信息不完整,红色*为必填项!"
});
return;
}
const items = { ...extraItems, salaryItemName: this.state.salaryItemName };
const { salaryItemName, salaryItemId, ...extraFileds } = items;
const salaryItemNameFiled = salaryItemName.split(","), salaryItemIdFiled = salaryItemId.split(",");
const fields = _.map(salaryItemNameFiled, (item, index) => {
return {
...extraFileds,
salaryItemName: item,
salaryItemId: salaryItemIdFiled[index]
};
});
this.handleReset();
onSave([...salaryRuleItemsList, ...fields]);
};
handleReset = () => {
this.setState({
beforeAdjustmentType: 2,
afterAdjustmentType: 1,
salaryItemId: "",
salaryItemName: "",
dayOfMonth: "1",
salaryItemOptions: []
}, () => {
const { onCancel } = this.props;
onCancel();
const { salaryRuleItemsList, onSave, ledgerStore: { ruleForm } } = this.props;
ruleForm.validateForm().then(f => {
if (f.isValid) {
const { salaryItemId } = ruleForm.getFormParams(), { fieldMap } = ruleForm;
const fields = _.map(salaryItemId.split(","), o => ({
...ruleForm.getFormParams(),
salaryItemId: o,
salaryItemName: _.find(fieldMap["salaryItemId"]["options"], k => k.key === o).showname
}));
this.props.onCancel(onSave([...salaryRuleItemsList, ...fields]));
} else {
f.showErrors();
}
});
};
render() {
const {
salaryItemId,
salaryItemOptions,
dayOfMonth,
beforeAdjustmentType,
afterAdjustmentType,
conditions
} = this.state;
const { title, visible, ledgerStore: { ruleForm } } = this.props;
const { title, visible, ledgerStore: { ruleForm } } = this.props, { conditions } = this.state;
const buttons = [<Button type="primary" onClick={this.handleSave}>{getLabel(111, "保存")}</Button>];
const itemRender = {
salaryItemId: (field, textAreaProps, form, formParams) => {
return (<WeaSwitch fieldConfig={{ ...field, ...textAreaProps }} form={form} formParams={formParams}/>);
},
dayOfMonth: () => null
dayOfMonth: () => null,
beforeAdjustmentType: () => null,
afterAdjustmentType: () => null
};
const childrenComponents = {
salaryItemId: () => {
const { dayOfMonth, beforeAdjustmentType, afterAdjustmentType } = ruleForm.getFormParams();
const coms = [], { fieldMap } = ruleForm;
coms.push(
<WeaFormItem label={getLabel(111, "计薪规则")} labelCol={{ span: 6 }} wrapperCol={{ span: 14 }}>
<WeaFormItem label={<span>
<span className="title">{getLabel(111, "计薪规则")}</span>
<WeaHelpfulTip
title={getLabel(111, "该规则适用于一个薪资核算周期内只调整一次薪资或个税扣缴义务人的情况,其他情况默认按照分段计薪规则核算")}/>
</span>} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
<div className="cust">
<div className="child">
<div className="lbl">{fieldMap["dayOfMonth"].label}</div>
<WeaSelect value={dayOfMonth} options={monthDays}/>
<WeaSelect value={dayOfMonth} options={monthDays} style={{ width: 100 }}
onChange={v => ruleForm.updateFields({ dayOfMonth: { value: v } })}/>
<div className="rbl">{getLabel(111, "(含)之前")}</div>
</div>
<div className="child">
<div className="lbl">{fieldMap["beforeAdjustmentType"].label}</div>
<WeaSelect value={beforeAdjustmentType} detailtype={fieldMap["beforeAdjustmentType"]["detailtype"]}
options={fieldMap["beforeAdjustmentType"]["options"]} style={{ flex: 1 }}
onChange={v => ruleForm.updateFields({ beforeAdjustmentType: { value: v } })}/>
</div>
<div className="child">
<div className="lbl">{getLabel(111, "否则调薪生效日期在10号之后")}</div>
</div>
<div className="child">
<div className="lbl">{fieldMap["afterAdjustmentType"].label}</div>
<WeaSelect value={afterAdjustmentType} detailtype={fieldMap["afterAdjustmentType"]["detailtype"]}
options={fieldMap["afterAdjustmentType"]["options"]} style={{ flex: 1 }}
onChange={v => ruleForm.updateFields({ afterAdjustmentType: { value: v } })}/>
</div>
</div>
</WeaFormItem>
);
return [
{
com: <div className="times">{coms}</div>,
col: 1
}
];
return [{ com: <div className="calcRules">{coms}</div>, col: 1 }];
}
};
return (
<WeaDialog initLoadCss title={title} visible={visible} style={{ width: 750 }} buttons={buttons}
onCancel={this.handleReset}>
<WeaDialog {...this.props} initLoadCss style={{ width: 750, height: 236 }} buttons={buttons}
className="adjustRuleModalWrapper">
<FormInfo className="form-dialog-layout" center={false} itemRender={itemRender}
childrenComponents={childrenComponents} form={ruleForm} formFields={conditions}/>
{/*<WeaSearchGroup col={1} needTigger title="" showGroup center>*/}
{/* <WeaFormItem label="薪资项目" labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}*/}
{/* style={{ tableLayout: "fixed" }}>*/}
{/* <WeaSelect*/}
{/* multiple*/}
{/* viewAttr={3}*/}
{/* style={{ width: "350px" }}*/}
{/* options={salaryItemOptions}*/}
{/* value={salaryItemId}*/}
{/* onChange={(salaryItemId, salaryItemName) => this.setState({ salaryItemId, salaryItemName })}*/}
{/* />*/}
{/* </WeaFormItem>*/}
{/* <WeaFormItem label={<AdjustTitle/>} labelCol={{ span: 4 }} wrapperCol={{ span: 20 }} colon={false}>*/}
{/* <div className="adjustRuleDetailWrapper">*/}
{/* <div className="adjustSalaryFlex">*/}
{/* <span>如果:调薪生效日期在</span>*/}
{/* <WeaSelect*/}
{/* viewAttr={3}*/}
{/* style={{ width: 60, margin: "0 6px" }}*/}
{/* value={dayOfMonth}*/}
{/* options={monthDays}*/}
{/* onChange={(dayOfMonth) => this.setState({ dayOfMonth })}*/}
{/* />*/}
{/* <span>(含)之前</span>*/}
{/* </div>*/}
{/* <div className="adjustSalaryFlex">*/}
{/* <span>计薪规则为:</span>*/}
{/* <Radio.Group onChange={(e) => this.setState({ beforeAdjustmentType: e.target.value })}*/}
{/* value={beforeAdjustmentType}>*/}
{/* <Radio value={2}>取调整后薪资</Radio>*/}
{/* <Radio value={4}>分段计薪<WeaHelpfulTip*/}
{/* style={{ marginLeft: "10px" }}*/}
{/* width={200}*/}
{/* title="=调整前薪资/当月自然日天数*调整前自然日天数+调整后薪资/当月自然日天数*调整后自然日天数"*/}
{/* placement="topLeft"*/}
{/* /></Radio>*/}
{/* <Radio value={3}>取平均<WeaHelpfulTip*/}
{/* style={{ marginLeft: "10px" }}*/}
{/* width={200}*/}
{/* title="=(调整前薪资+调整后薪资)/2"*/}
{/* placement="topLeft"*/}
{/* />*/}
{/* </Radio>*/}
{/* </Radio.Group>*/}
{/* </div>*/}
{/* <div style={{ marginBottom: 10 }}>否则:调薪生效日期在{dayOfMonth}号之后</div>*/}
{/* <div className="adjustSalaryFlex">*/}
{/* <span>计薪规则为:</span>*/}
{/* <Radio.Group onChange={(e) => this.setState({ afterAdjustmentType: e.target.value })}*/}
{/* value={afterAdjustmentType}>*/}
{/* <Radio value={1}>取调整前薪资</Radio>*/}
{/* <Radio value={4}>分段计薪<WeaHelpfulTip*/}
{/* style={{ marginLeft: "10px" }}*/}
{/* width={200}*/}
{/* title="=调整前薪资/当月自然日天数*调整前自然日天数+调整后薪资/当月自然日天数*调整后自然日天数"*/}
{/* placement="topLeft"*/}
{/* /></Radio>*/}
{/* <Radio value={3}>取平均<WeaHelpfulTip*/}
{/* style={{ marginLeft: "10px" }}*/}
{/* width={200}*/}
{/* title="=(调整前薪资+调整后薪资)/2"*/}
{/* placement="topLeft"*/}
{/* />*/}
{/* </Radio>*/}
{/* </Radio.Group>*/}
{/* </div>*/}
{/* </div>*/}
{/* </WeaFormItem>*/}
{/*</WeaSearchGroup>*/}
</WeaDialog>
);
}
@ -221,14 +145,3 @@ class LedgerAdjustRuleAddModal extends Component {
export default LedgerAdjustRuleAddModal;
const AdjustTitle = () => {
return <div className="titleTipWrapper">
<span className="title">计薪规则</span>
<WeaHelpfulTip
width={200}
title="该规则适用于一个薪资核算周期内只调整一次薪资或个税扣缴义务人的情况,其他情况默认按照分段计薪规则核算"
placement="topLeft"
/>
<span className="title">:</span>
</div>;
};

View File

@ -881,7 +881,51 @@ export const ruleConditions = [//调薪计薪规则项表单
label: "如果:调薪生效日期在",
lanId: 111,
labelcol: 0,
value: "",
value: "1",
viewAttr: 2
},
{
conditionType: "SELECT",
domkey: ["beforeAdjustmentType"],
fieldcol: 6,
label: "计薪规则为:",
lanId: 111,
labelcol: 0,
value: "2",
options: [
{ key: "2", showname: "取调整后薪资", lanId: 111 },
{
key: "4", showname: "分段计薪", lanId: 111, helpfultiplanId: 111,
helpfultip: "调整前薪资/当月自然日天数*调整前自然日天数+调整后薪资/当月自然日天数*调整后自然日天数"
},
{
key: "3", showname: "取平均", lanId: 111,
helpfultip: "(调整前薪资+调整后薪资)/2", helpfultiplanId: 111
}
],
detailtype: 3,
viewAttr: 2
},
{
conditionType: "SELECT",
domkey: ["afterAdjustmentType"],
fieldcol: 6,
label: "计薪规则为:",
lanId: 111,
labelcol: 0,
value: "1",
options: [
{ key: "1", showname: "取调整前薪资", lanId: 111 },
{
key: "4", showname: "分段计薪", lanId: 111, helpfultiplanId: 111,
helpfultip: "调整前薪资/当月自然日天数*调整前自然日天数+调整后薪资/当月自然日天数*调整后自然日天数"
},
{
key: "3", showname: "取平均", lanId: 111,
helpfultip: "(调整前薪资+调整后薪资)/2", helpfultiplanId: 111
}
],
detailtype: 3,
viewAttr: 2
}
],