127 lines
3.4 KiB
JavaScript
127 lines
3.4 KiB
JavaScript
import React from 'react';
|
|
import { connect } from 'dva';
|
|
import { Modal, Form } from 'antd';
|
|
import CombinationPage from '../Combination/CombinationPage';
|
|
|
|
class CombinationModal extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
visible: false,
|
|
loading: false
|
|
}
|
|
};
|
|
showModal = () => { // 显示弹窗
|
|
this.setState({
|
|
visible: true
|
|
},()=>{
|
|
const {data}=this.props;
|
|
this.props.dispatch({
|
|
type: 'editPage/save',
|
|
payload: {
|
|
[data?data.reloadKey:'']: true
|
|
},
|
|
});
|
|
});
|
|
const click = this.props.click;
|
|
if (typeof click === 'function') {
|
|
click(true);
|
|
}
|
|
};
|
|
handleCancel = () => { // 退出弹窗
|
|
this.props.form.resetFields();
|
|
this.setState({
|
|
visible: false
|
|
});
|
|
if(typeof this.destroyCacheDataFunc==='function'){
|
|
this.destroyCacheDataFunc();
|
|
}
|
|
const click = this.props.click;
|
|
if (typeof click === 'function') {
|
|
click(false);
|
|
}
|
|
};
|
|
onRegDestroyCacheDataFunc=(destroyCacheDataFunc)=>{
|
|
this.destroyCacheDataFunc=destroyCacheDataFunc;
|
|
};
|
|
handleLoadParam=()=>{
|
|
//this.searchFormRef.handleSearch();
|
|
let rule = [
|
|
{
|
|
field: this.props.customParams,
|
|
operator: 1,
|
|
value: this.props.id
|
|
}
|
|
];
|
|
return {
|
|
data:{
|
|
rules:[...rule],
|
|
}
|
|
};
|
|
};
|
|
|
|
render() {
|
|
const tmpData={
|
|
id:this.props.id,
|
|
onSave:this.props.onSave,
|
|
formCode:this.props.formCode,
|
|
parentId: this.props.parentId,
|
|
data:this.props.data,
|
|
copySrcId:this.props.copySrcId,
|
|
onCancel:this.handleCancel,
|
|
isAddH: this.props.isAddH,
|
|
onRegDestroyCacheDataFunc:this.onRegDestroyCacheDataFunc,
|
|
};
|
|
let rule = [
|
|
{
|
|
field: this.props.customParams,
|
|
operator: 1,
|
|
value: this.props.id,
|
|
isCustom:true,
|
|
|
|
}
|
|
];
|
|
let params= {
|
|
rules:[...rule],
|
|
}
|
|
;
|
|
//const isEdit=tmpData.data?!tmpData.data.isBatchEdit:true;
|
|
return (
|
|
<div style={{ display: 'inline-block' }}>
|
|
<span onClick={this.showModal}>{this.props.children}</span>
|
|
<Modal
|
|
visible={this.state.visible}
|
|
title={this.props.title ? (this.props.title+'['+tmpData.formCode+']') : ("自定义"+'['+tmpData.formCode+']')}
|
|
maskClosable={false}
|
|
onCancel={this.handleCancel}
|
|
wrapClassName="custom-modal-wrap"
|
|
style={{ top: "10vh", maxHeight: '80vh', overflow: "hidden" }}
|
|
width={"80%"}
|
|
footer={null}
|
|
>
|
|
{
|
|
//isEdit ? <Edit {...tmpData} /> : <BatchEdit {...tmpData}/>
|
|
|
|
// <ListTablePageBase
|
|
// key="ID"
|
|
// tableId={tmpData.id}
|
|
// //formData={tmpData.data}
|
|
// formCode={tmpData.formCode}
|
|
// //onRegLoadDataFunc={this.handleLoadDataFunc}
|
|
// onLoadParam={this.handleLoadParam}
|
|
// //formId={this.props.formId}
|
|
// //SetRowClass={this.setRowClass}
|
|
// //onClickRow={this.handleOrderRowClick}
|
|
// isQuery={true}
|
|
// //onTableData={this.onOrderTableData}
|
|
// />
|
|
<CombinationPage formCode={tmpData.formCode} data={params}/>
|
|
}
|
|
|
|
</Modal>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
export default connect(({ app, editPage, loading, login }) => ({ app, editPage, loading, login }))(Form.create()(CombinationModal));
|