mh_jy_safe_web/src/components/CustomPages/EM/EMProposalFlowCardPage.js
2025-08-25 10:08:30 +08:00

125 lines
3.3 KiB
JavaScript

import React from 'react';
import { connect } from 'dva';
import { Button, Row, Col, Form, Input,Select,Checkbox,Modal,Popconfirm,Spin ,Table,Tabs,message,InputNumber} from 'antd';
import { extend, extendRule, initFilter, initQueryFilter, getOnlyPropertyData, extendInclude} from "../../../utils/common";
import ProcessPrintPage from '../WO/ProcessPrintPage';
import ReactToPrint from "react-to-print";
const Option = Select.Option;
class EMProposalFlowCardPage extends React.Component {
constructor(props) {
super(props);
this.state = {
data: {},
maxQty:0,
emType:0,
};
};
componentDidMount() {
this.loadData();
}
componentWillReceiveProps(NextProps) {
const {data}=this.props;
let {id}=data?data:{};
if(!id)
id='';
if (NextProps.custom['emProposalFlowCardClick'+id] ) {
this.loadData();
this.props.dispatch({
type: 'custom/save',
payload: {
['emProposalFlowCardClick'+id]:false
},
});
}
}
loadData=()=> {
// const {data}=this.props;
// const {id}=data?data:{};
this.handleGetFlowCard();
};
handleGetFlowCard=()=>{
const {data}=this.props;
let {getIds}=data?data:{};
const ids= getIds();
if(ids) {
const json = initFilter(this.props.login.OrgId, ids,'',0,1,this.state.maxQty,this.state.confirmUserId, this.state.emType);
this.props.dispatch({
type: 'EMemProposalEdit/getFlowCardPrint',
payload: json,
onComplete: (ret) => {
if (ret) {
if(this.componentRef) {
this.componentRef.updateData(ret);
}
}
}
});
this.setState({
ids,
});
}
};
render() {
const {data}=this.props;
let {id}=data?data:{};
if(!id)
id='';
// const onAfterPrint=()=>{
// const {ids}=this.state;
// if(ids){
// const json = initFilter(this.props.login.OrgId,ids);
// this.props.dispatch({
// type: 'EMemOrder/updatePrintStatus',
// payload: json,
// onComplete: (ret) => {
// if (ret) {
// if(data.close){
// data.close();
// }
// }
// }
// });
// }
// }
// const changeMaxQty=(e)=>{
// if(e===null||e===undefined)return;
// const value=e.target&&e.target.value?e.target.value:(typeof e ==='object'?null:e);
// this.setState({
// maxQty:value,
// });
// };
//const enums=this.props.app.enums;
//const disabled=!this.state.data.ID||
// this.state.data.EM_CONFIRM_STATUS==1||this.state.data.EM_CANCEL_STATUS==1||this.state.data.ORDER_STATUS==3;
return (
<div>
<div style={{marginTop:'25px'}}>
<ReactToPrint
trigger={() => <Button type={'primary'} icon={'printer'} >打印</Button>}
content={() => this.componentRef}
/>
</div>
<div style={{marginTop:'25px'}}>
<ProcessPrintPage ref={el => (this.componentRef = el)} id={id} qccodeKey={'emOrder'} />
</div>
</div>
);
}
}
export default connect(({ login, loading,app,custom }) => ({ login, loading,app,custom }))(Form.create()(EMProposalFlowCardPage));