Commit ec6e2767 authored by xinglei's avatar xinglei

增加告警页websocket刷新

parent 28c3a66d
......@@ -3,6 +3,8 @@ import { Table, Col, Row, Pagination } from 'amos-antd';
import { Search, Icon } from 'amos-framework';
import './../../../../styles/view/biz/situation/warn.scss';
import { getWarningsData, getWarningsByPageData, getWarningsExcelData } from 'SERVICES/situationService';
import AmosWebSocket from 'amos-websocket';
import SysWsURL, { completeToken } from 'CONSTS/wsUrlConsts';
//页面列表
const columnss = () => [
......@@ -127,9 +129,12 @@ class Warnings extends Component {
}
componentDidMount() {
this.initData();
}
initData = () =>{
if (this.props.location.state) {
let sourceId = this.props.location.state.sourceId;
console.log(sourceId);
this.onIconClick(null, sourceId.toString());
} else {
this.getWarningsByPage();
......@@ -196,6 +201,16 @@ class Warnings extends Component {
window.open(url);
}
/**
* webSocket接收数据
*/
handleData = data => {
if (data){
console.log('alarmMarqueeWS');
this.initData();
}
};
render() {
let columns = columnss();
let { selectedRowKeys, warnings, pageItem } = this.state;
......@@ -203,8 +218,10 @@ class Warnings extends Component {
selectedRowKeys,
onChange: this.onSelectChange
};
const wsURL = completeToken(SysWsURL.view3dws);
return (
<div className="amos-warn" style={{ overflow: 'auto', height: '100%' }}>
<AmosWebSocket ref={node => (this.aws = node)} url={wsURL} onMessage={this.handleData} reconnect debug />
<div className="amos-warn-up">
<Row >
<Col span={24} className="amos-warn-top">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment