release/3.0.0.2502.01-合并业务线
This commit is contained in:
parent
75d7f97f1d
commit
54adc6cc2e
|
|
@ -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 = [<Button type="primary" onClick={this.handleSave}>保存</Button>];
|
||||
return (
|
||||
<WeaDialog
|
||||
initLoadCss
|
||||
className="adjustRuleModalWrapper"
|
||||
title={title}
|
||||
visible={visible}
|
||||
style={{ width: 750 }}
|
||||
buttons={buttons}
|
||||
onCancel={this.handleReset}
|
||||
>
|
||||
<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>
|
||||
const { title, visible, ledgerStore: { ruleForm } } = this.props;
|
||||
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
|
||||
};
|
||||
const childrenComponents = {
|
||||
salaryItemId: () => {
|
||||
const coms = [], { fieldMap } = ruleForm;
|
||||
coms.push(
|
||||
<WeaFormItem label={getLabel(111, "计薪规则")} labelCol={{ span: 6 }} wrapperCol={{ span: 14 }}>
|
||||
<div className="cust">
|
||||
<div className="child">
|
||||
<div className="lbl">{fieldMap["dayOfMonth"].label}</div>
|
||||
</div>
|
||||
</div>
|
||||
</WeaFormItem>
|
||||
</WeaSearchGroup>
|
||||
);
|
||||
return [
|
||||
{
|
||||
com: <div className="times">{coms}</div>,
|
||||
col: 1
|
||||
}
|
||||
];
|
||||
}
|
||||
};
|
||||
return (
|
||||
<WeaDialog initLoadCss title={title} visible={visible} style={{ width: 750 }} buttons={buttons}
|
||||
onCancel={this.handleReset}>
|
||||
<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>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue