import React from 'react' import { connect } from 'dva' import { Modal, Form, Transfer, message} from 'antd' class WriteOffNetworkModal extends React.Component { constructor(props) { super(props) this.state = { visible: false, loading: false, mainData: [], mainTargetKeys: [], assistData: [], assistTargetKeys: [] } } componentDidMount() { if (this.props.onRef) { this.props.onRef(this) } } showModal = (value) => { this.setState({ visible: true }, () => { this.loadModalData() }) } handleCancel = e => { this.setState({ visible: false, }) } handleOk = e => { this.SettingSave(); }; loadModalData = () => { const json = { OrgId: this.props.login.OrgId }; this.props.dispatch({ type: 'app/getDataByPost', url: 'EA/AdjustAccounts/GetWriteOffTransferData', payload: json, onlyData: false, onComplete: (re) => { if (re && re.IsSuccessful && re.Data) { const { assistData, assistTargetKeys ,mainData, mainTargetKeys} = re.Data this.setState({ assistData, assistTargetKeys, mainData, mainTargetKeys }); } } }) } SettingSave = () => { const json = { OrgId:this.props.login.OrgId, AssistTargetKeys: this.state.assistTargetKeys, MainTargetKeys:this.state.mainTargetKeys }; this.props.dispatch({ type: 'app/getDataByPost', url: 'EA/AdjustAccounts/WriteOffSettingSave', payload: json, onlyData: false, onComplete: (re) => { if (re && re.IsSuccessful && re.Data) { if (re.Data.IsSucceed) { message.success(re.Data.Msg); this.setState({ visible: false, }, () => { this.props.onLoadData() }); } else message.error(re.Data.Msg); } } }) }; filterOption = (inputValue, option) => option.title.indexOf(inputValue) > -1; assistHandleChange = targetKeys => { this.setState({ assistTargetKeys:targetKeys }); }; mainHandleChange = targetKeys => { this.setState({ mainTargetKeys:targetKeys }); }; render() { const { assistData, assistTargetKeys ,mainData, mainTargetKeys} = this.state return (
辅助生产节点
item.title} />
核销(主要生产)节点
item.title} />
) } } export default connect(({ app, editPage, loading, login }) => ({ app, editPage, loading, login }))(Form.create()(WriteOffNetworkModal))