salary-management-front/pc4mobx/hrmSalary/pages/payroll/stepForm/baseInformForm.js

144 lines
4.8 KiB
JavaScript
Raw Normal View History

2022-06-27 10:35:39 +08:00
import React from "react";
import { Row, Col, Switch, Select } from "antd";
import { WeaInput, WeaSelect } from "ecCom";
import { inject, observer } from "mobx-react";
import RequiredLabelTip from "../../../components/requiredLabelTip";
import "./index.less";
const { Option } = Select;
2022-03-18 14:16:52 +08:00
2022-06-27 10:35:39 +08:00
@inject("payrollStore")
2022-04-13 16:56:31 +08:00
@observer
2022-03-18 14:16:52 +08:00
export default class BaseInformForm extends React.Component {
2022-06-27 10:35:39 +08:00
constructor(props) {
super(props);
this.state = {
inited: false,
options: [],
request: {}
};
}
componentWillMount() {
const { payrollStore } = this.props;
const { getPayrollBaseForm } = payrollStore;
getPayrollBaseForm(this.props.id).then(data => {
this.setState(
{
options: data.salarySobOptions,
request: data.templateBaseData
},
() => {
this.setState({
inited: true
});
2022-04-13 16:56:31 +08:00
}
2022-06-27 10:35:39 +08:00
);
});
}
2022-04-13 16:56:31 +08:00
2022-06-27 10:35:39 +08:00
hanldeChange(params) {
let request = { ...this.state.request, ...params };
this.setState({
request
});
this.props.onChange && this.props.onChange(request);
}
2022-05-05 15:53:35 +08:00
2022-06-27 10:35:39 +08:00
render() {
const { request } = this.state;
const {
salarySob,
salarySobOption,
name,
description,
emailStatus,
sendEmail,
sendEmailOptions,
msgStatus
} = request;
return (
<div className="baseInformForm">
<div className="formItemWrapper">
<div className="itemTitle">基础信息</div>
<div className="formWrapper">
<Row className="formItem">
<Col span={8}>
薪资账套<RequiredLabelTip />
</Col>
<Col span={16}>
{this.state.inited &&
<Select
defaultValue={salarySob ? salarySob : ""}
value={salarySob ? salarySob : ""}
style={{ width: "200px" }}
className="wea-select"
notFoundContent="暂无数据"
onChange={value => this.hanldeChange({ salarySob: value })}>
{this.state.options.map(item =>
<Option value={item.key} key={item.key}>
{item.showname}
</Option>
)}
</Select>}
</Col>
</Row>
<Row className="formItem">
<Col span={8}>
工资单模板名称<RequiredLabelTip />
</Col>
<Col span={16}>
<WeaInput
value={name}
onChange={value => this.hanldeChange({ name: value })}
/>
</Col>
</Row>
<Row className="formItem">
<Col span={8}>备注</Col>
<Col span={16}>
<WeaInput
value={description}
onChange={value => this.hanldeChange({ description: value })}
/>
</Col>
</Row>
</div>
</div>
{/* 发送位置先隐藏 */}
{/* <div className="formItemWrapper">
2022-03-18 14:16:52 +08:00
<span className="itemTitle">发送位置</span>
<div className="formWrapper">
<Row className="formItem">
<Col span={12}>
<Row>
<Col span={8}>邮件</Col>
<Col span={16}>
2022-04-13 16:56:31 +08:00
<Switch value={emailStatus} onChange={(value) => {this.hanldeChange({emailStatus: value})}}/>
2022-03-18 14:16:52 +08:00
</Col>
</Row>
</Col>
<Col span={12}>
<Row>
<Col span={8}>发送地址</Col>
<Col span={16}>
2022-04-13 16:56:31 +08:00
<WeaSelect style={{width: '200px'}} value={sendEmail} onChange={(value) => {this.hanldeChange({sendEmail: value})}}/>
2022-03-18 14:16:52 +08:00
</Col>
</Row>
</Col>
</Row>
<Row className="formItem">
<Col span={12}>
<Row>
<Col span={8}>消息中心</Col>
<Col span={16}>
2022-04-13 16:56:31 +08:00
<Switch checked={msgStatus} onChange={(value)=>{this.hanldeChange({msgStatus: value})}}/>
2022-03-18 14:16:52 +08:00
</Col>
</Row>
</Col>
</Row>
</div>
2022-05-10 17:45:03 +08:00
</div> */}
2022-06-27 10:35:39 +08:00
</div>
);
}
}