2022-03-30 20:04:34 +08:00
|
|
|
|
import React from 'react'
|
2022-04-06 14:26:16 +08:00
|
|
|
|
import { Modal, Row, Col, Button, message } from 'antd'
|
2022-03-30 20:04:34 +08:00
|
|
|
|
import { WeaInput } from 'ecCom'
|
|
|
|
|
|
import { inject, observer } from 'mobx-react';
|
2022-04-06 14:26:16 +08:00
|
|
|
|
import RequiredLabelTip from '../../../components/requiredLabelTip';
|
|
|
|
|
|
import { notNull } from '../../../util/validate';
|
2022-03-30 20:04:34 +08:00
|
|
|
|
|
|
|
|
|
|
@inject('ledgerStore')
|
|
|
|
|
|
@observer
|
|
|
|
|
|
export default class ValidRuleEditModal extends React.Component {
|
|
|
|
|
|
constructor(props) {
|
|
|
|
|
|
super(props);
|
|
|
|
|
|
this.state = {
|
|
|
|
|
|
name: "",
|
|
|
|
|
|
formulaId: "",
|
|
|
|
|
|
description: ""
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-04-06 14:26:16 +08:00
|
|
|
|
validateForm() {
|
|
|
|
|
|
const { name, formulaId} = this.state;
|
|
|
|
|
|
if(!notNull(name)) {
|
|
|
|
|
|
message.warning("规则名称不能为空")
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// if(!notNull(formulaId)) {
|
|
|
|
|
|
// message.warning("校验规则不能为空")
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-30 20:04:34 +08:00
|
|
|
|
|
|
|
|
|
|
handleSave() {
|
2022-04-06 14:26:16 +08:00
|
|
|
|
if(!this.validateForm()) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2022-03-30 20:04:34 +08:00
|
|
|
|
const { ledgerStore: {saveLedgerRule}} = this.props;
|
|
|
|
|
|
saveLedgerRule({
|
|
|
|
|
|
name: this.state.name,
|
|
|
|
|
|
formulaId: this.state.formulaId,
|
|
|
|
|
|
description: this.state.description
|
|
|
|
|
|
})
|
|
|
|
|
|
this.props.onCancel();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
|
return (
|
|
|
|
|
|
<Modal visible={this.props.visible} onCancel={() => {this.props.onCancel()}}
|
|
|
|
|
|
width={800} title="添加校验规则"
|
|
|
|
|
|
footer={
|
|
|
|
|
|
<div style={{width: "100%", overflow: "hidden"}}>
|
|
|
|
|
|
<span style={{float: "left"}}>
|
|
|
|
|
|
薪资核算时,不符合校验规则将反馈为异常
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<Button type="primary" style={{float: "right"}} onClick={() => {this.handleSave()}}>保存</Button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
|
|
|
|
|
<div style={{padding: "20px"}}>
|
|
|
|
|
|
<Row style={{lineHeight: "40px"}}>
|
2022-04-06 14:26:16 +08:00
|
|
|
|
<Col span={8}>规则名称<RequiredLabelTip /></Col>
|
2022-03-30 20:04:34 +08:00
|
|
|
|
<Col span={16}>
|
|
|
|
|
|
<WeaInput value={this.state.name} onChange={(value) => {this.setState({name: value})}}/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
<Row style={{lineHeight: "40px"}}>
|
2022-04-06 14:26:16 +08:00
|
|
|
|
<Col span={8}>校验规则<RequiredLabelTip /></Col>
|
2022-03-30 20:04:34 +08:00
|
|
|
|
<Col span={16}>
|
|
|
|
|
|
<WeaInput value={this.state.formulaId} onChange={(value)=> {this.setState({formulaId: value})}}/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
<Row style={{lineHeight: "40px"}}>
|
|
|
|
|
|
<Col span={8}>备注</Col>
|
|
|
|
|
|
<Col span={16}>
|
|
|
|
|
|
<WeaInput value={this.state.description} onChange={(value) => {this.setState({description: value})}}/>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Modal>
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|