87,842
社区成员




// 管理事件
onChange = (record,e) => {
//var devId = record.record.id;//当前设备id
e.preventDefault();
console.log('父组件');
console.log(record.record.id);
console.log('父组件');
this.setState({
currentDevId: record.record.id,
title:record.record.device_name,
visible:true
}, () => {
// this.setState({visible:true})
});
}
<Modal
title={"设备资料管理 - "+this.state.title}
width={850}
style={{ top: 20 }}
visible={this.state.visible}
onOk={this.handleOk}
onCancel={this.handleCancel}
okText="保存"
cancelText="取消"
>
<Tabs>
<TabPane tab="基础信息" key="1" >
<BasicInfo devid={this.state.currentDevId} />
</TabPane>
<TabPane tab="运行参数" key="2"><RunParams devid={this.state.currentDevId} /></TabPane>
<TabPane tab="部件" key="3"><Part /></TabPane>
<TabPane tab="文档" key="4"><Document /></TabPane>
<TabPane tab="巡检" key="5"><Inspection /></TabPane>
<TabPane tab="下级设备" key="6"><DownEquip /></TabPane>
<TabPane tab="权限" key="7"><DeviceAuth /></TabPane>
</Tabs>
</Modal>
// 获取设备信息
componentWillMount(){
console.log('子组件');
console.log(this.props);
console.log('子组件');
this.setState({
devId:this.props.devid,
userId:localStorage.userId,
organizationId:localStorage.organizationId
});
let formData = new FormData;
formData.append('devid',this.props.devid);
let opts = {method:'POST',body:formData};
fetch("http://api.test.net/?s=Device.getDeviceInfo",opts)
.then(response => response.json())
.then(json => {
console.log(json);
this.setState({datas:json.data});
})
}
onRef = (ref) => {
this.child = ref
}
Click = (e) => {
// this.child.myTest()
// this.setState({visible:true});
console.log(this.child);
console.log(this.child.myTest());
}
componentDidMount(){
this.props.onRef(this)
}
myTest= () =>{
console.log('22222');
}