Commit ec6e2767 authored by xinglei's avatar xinglei

增加告警页websocket刷新

parent 28c3a66d
...@@ -3,6 +3,8 @@ import { Table, Col, Row, Pagination } from 'amos-antd'; ...@@ -3,6 +3,8 @@ import { Table, Col, Row, Pagination } from 'amos-antd';
import { Search, Icon } from 'amos-framework'; import { Search, Icon } from 'amos-framework';
import './../../../../styles/view/biz/situation/warn.scss'; import './../../../../styles/view/biz/situation/warn.scss';
import { getWarningsData, getWarningsByPageData, getWarningsExcelData } from 'SERVICES/situationService'; import { getWarningsData, getWarningsByPageData, getWarningsExcelData } from 'SERVICES/situationService';
import AmosWebSocket from 'amos-websocket';
import SysWsURL, { completeToken } from 'CONSTS/wsUrlConsts';
//页面列表 //页面列表
const columnss = () => [ const columnss = () => [
...@@ -127,9 +129,12 @@ class Warnings extends Component { ...@@ -127,9 +129,12 @@ class Warnings extends Component {
} }
componentDidMount() { componentDidMount() {
this.initData();
}
initData = () =>{
if (this.props.location.state) { if (this.props.location.state) {
let sourceId = this.props.location.state.sourceId; let sourceId = this.props.location.state.sourceId;
console.log(sourceId);
this.onIconClick(null, sourceId.toString()); this.onIconClick(null, sourceId.toString());
} else { } else {
this.getWarningsByPage(); this.getWarningsByPage();
...@@ -196,6 +201,16 @@ class Warnings extends Component { ...@@ -196,6 +201,16 @@ class Warnings extends Component {
window.open(url); window.open(url);
} }
/**
* webSocket接收数据
*/
handleData = data => {
if (data){
console.log('alarmMarqueeWS');
this.initData();
}
};
render() { render() {
let columns = columnss(); let columns = columnss();
let { selectedRowKeys, warnings, pageItem } = this.state; let { selectedRowKeys, warnings, pageItem } = this.state;
...@@ -203,8 +218,10 @@ class Warnings extends Component { ...@@ -203,8 +218,10 @@ class Warnings extends Component {
selectedRowKeys, selectedRowKeys,
onChange: this.onSelectChange onChange: this.onSelectChange
}; };
const wsURL = completeToken(SysWsURL.view3dws);
return ( return (
<div className="amos-warn" style={{ overflow: 'auto', height: '100%' }}> <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"> <div className="amos-warn-up">
<Row > <Row >
<Col span={24} className="amos-warn-top"> <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