import React from "react"; import { Button, Col, Row } from "antd"; import { WeaBrowser, WeaDialog, WeaSelect } from "ecCom"; import { inject, observer } from "mobx-react"; import "./index.less"; const objectOptions = [ { key: "EMPLOYEE", showname: "人员", selected: false }, { key: "SUBCOMPANY", showname: "分部", selected: false }, { key: "DEPT", showname: "部门", selected: false }, { key: "POSITION", showname: "岗位", selected: false } ]; @inject("ledgerStore") @observer export default class AddUserModal extends React.Component { constructor(props) { super(props); this.state = { selectedKey: "EMPLOYEE", radioValue: "", ids: "" }; } onRadioChange(radioValue) { this.setState({ radioValue }); } // 保存 handleSave() { const { ledgerStore: { saveLedgerPersonRange, salarySobId, includeType } } = this.props; saveLedgerPersonRange({ salarySobId: salarySobId, includeType: includeType, employeeStatus: this.state.radioValue.split(','), targetParams: this.state.ids .split(",") .map((id) => ({ targetType: this.state.selectedKey, targetId: id })) }); } // 重置 handleReset() { this.setState({ selectedKey: "EMPLOYEE", radioValue: "", ids: "" }); } render() { return ( { this.props.onCancel(); }} initLoadCss className="associatesWrapper" style={{ width: 600 }} title="关联人员" buttons={[ , ]}>
对象类型:
{ this.setState({ selectedKey: value, ids: "" }); }} />
{this.state.selectedKey == "EMPLOYEE" && ( { this.setState({ ids }); }} /> )} {this.state.selectedKey == "DEPT" && ( { this.setState({ ids }); }} /> )} {this.state.selectedKey == "SUBCOMPANY" && ( { this.setState({ ids }); }} /> )} {this.state.selectedKey == "POSITION" && ( { this.setState({ ids }); }} /> )}
选择员工状态: this.onRadioChange(e)} value={this.state.radioValue} options={ [ { key: "", showname: "" }, { key: "TRIAL", showname: "试用" }, { key: "FORMAL", showname: "正式" }, { key: "TEMPORARY", showname: "临时" }, { key: "DELAY", showname: "试用延期" }, { key: "FIRE", showname: "解雇" }, { key: "DEPARTURE", showname: "离职" }, { key: "RETIRED", showname: "退休" }, ] } />
); } }