Commit a1981f24 authored by zhengjiawei's avatar zhengjiawei

安全态势,mqtt代码恢复

parent 33e7dd87
......@@ -14,8 +14,7 @@
// websocket 地址
wsURI: {
baseURI: 'ws://172.16.10.91:10600/',
ruleURI: 'ws://172.16.10.85:8083/',
mqttURI: 'ws://172.16.10.85:8083/mqtt'
ruleURI: 'ws://172.16.3.63:8083/'
},
// 外部链接地址
outterURI: {
......
......@@ -35,7 +35,6 @@
"amos-dll": "^2.0.2",
"amos-gojs": "^2.0.15",
"amos-icon": "^1.0.3",
"amos-mqtt": "^1.0.1",
"amos-pluggable": "^1.0.6",
"amos-processor": "^2.x",
"amos-richtext": "^1.0.1",
......
......@@ -11,7 +11,6 @@ import TopView from './preControl/topNews/TopView';
import MonitorView from './preControl/monitor/MonitorView';
import Water from './preControl/water/Water';
import { eventTopics } from './consts';
import { withSubscribeMQTT } from 'amos-mqtt';
const eventConnect = Connect.eventConnect;
const AmosConfig = endConf.AmosConfig;
......@@ -30,12 +29,6 @@ const sidepaneStyles = {
}
};
/**
* 订阅主题
*/
@withSubscribeMQTT({
topic: '/data/refresh/layerPool'
})
@eventConnect
class LayerPool extends Component {
constructor(props) {
......@@ -74,18 +67,8 @@ class LayerPool extends Component {
this._bindPubSubEvents();
}
// componentWillReceiveProps(nextProps) {
// this.setState({ planStarted: nextProps.planStarted });
// }
/**
* 获取订阅信息并修改
* @param {*} nextProps
*/
componentWillReceiveProps({ data }) {
if (data) {
const { topic ,dataList } = data;
this.setState({ planStarted: dataList.planStarted });
}
componentWillReceiveProps(nextProps) {
this.setState({ planStarted: nextProps.planStarted });
}
onCancal = () => {
......@@ -115,7 +98,7 @@ class LayerPool extends Component {
let wsURL = AmosConfig.wsURI.baseURI + 'plan';
return (
<div className="layer-pool">
{/**<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug /> */}
<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug />
<SidePane
className={displayDetail ? 'precontrol-sidePlan-detail-display' : 'precontrol-sidePlan-detail'}
left={false}
......@@ -149,7 +132,6 @@ class LayerPool extends Component {
}
}
LayerPool.propTypes = {
data: PropTypes.array,
planStart: PropTypes.func,
animationProps: PropTypes.any,
subscribe: PropTypes.func,
......
......@@ -11,17 +11,10 @@ import globalMsg from './pagefactory/msgFactory';
import { eventTopics, rulesDataFactory } from './consts';
import LayerPool from './LayerPool';
import TopMsg from './sideControl/TopMsg';
import { withSubscribeMQTT } from 'amos-mqtt';
const eventConnect = Connect.eventConnect;
/**
* 订阅主题
*/
@withSubscribeMQTT({
topic: '/data/refresh/maskContent'
})
@eventConnect
class MaskContent extends Component {
......@@ -29,21 +22,10 @@ class MaskContent extends Component {
this.setState({ planStarted: this.props.planStarted });
}
// componentWillReceiveProps = (nextProps) => {
// this.setState({ planStarted: nextProps.planStarted });
// }
/**
* 获取订阅信息并修改
* @param {*} nextProps
*/
componentWillReceiveProps({ data }) {
if (data) {
const { topic ,dataList } = data;
this.setState({ planStarted: dataList.planStarted });
}
componentWillReceiveProps = (nextProps) => {
this.setState({ planStarted: nextProps.planStarted });
}
/**
* 监控视图消息 (规则 ws)
*/
......@@ -91,7 +73,7 @@ class MaskContent extends Component {
};
return (
<div className="mask-content">
{/**<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug /> */}
<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug />
<SideControl multiple={multiple} onItemClick={onItemClick} layerConfig={layerConfig} animationProps={controlAnimation} />
<DataPane animationProps={datapaneAnim} />
<TopMsg alarmStart={alarmStart} />
......@@ -104,7 +86,6 @@ class MaskContent extends Component {
}
MaskContent.propTypes = {
data: PropTypes.array,
layerConfig: PropTypes.object,
onItemClick: PropTypes.func,
// 是否支持多选
......
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Connect, Modal } from 'amos-framework';
// import AmosWebSocket from 'amos-websocket';
import AmosWebSocket from 'amos-websocket';
import * as endConf from 'amos-processor/lib/config/endconf';
import PilotController from 'amos-viz/lib/board/PilotController';
import SysWsURL, { completeToken } from './../../consts/wsUrlConsts';
import ScreenSaverView from './screenSaver/ScreenSaverView';
import { MQTTProvider } from 'amos-mqtt';
// import Three3dView from './Three3dView';
import Three3dView from './View3D';
......@@ -89,15 +88,13 @@ class View3DRoot extends Component {
};
render() {
// const wsURL = completeToken(SysWsURL.view3dws);
const wsURL = completeToken(SysWsURL.view3dws);
return (
<MQTTProvider url={wsurl}>
<div className="sys-view-3d">
{/**<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug /> */}
<Three3dView onLoadCompleted={this.onLoadCompleted} hiddenScreenSaver={this.hiddenScreenSaver} />
{this.getScreenSaver()}
</div>
</MQTTProvider>
<div className="sys-view-3d">
<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug />
<Three3dView onLoadCompleted={this.onLoadCompleted} hiddenScreenSaver={this.hiddenScreenSaver} />
{this.getScreenSaver()}
</div>
);
}
}
......
......@@ -2,16 +2,9 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import AmosEcharts from 'amos-viz/lib/echarts';
import { queryRiskSourceMatrixAction } from './../../../../services/situationService';
import { withSubscribeMQTT } from 'amos-mqtt';
/**
* 订阅主题
*/
@withSubscribeMQTT({
topic: '/data/refresh/incidenceSeverityMatrix'
})
/**
* 发生率/严重度矩阵
* @class IncidenceSeverityMatrix
* @extends {Component}
......@@ -30,26 +23,6 @@ class IncidenceSeverityMatrix extends Component {
componentDidMount() {
this.queryRiskSourceMatrix();
}
/**
* 获取订阅信息并修改
* @param {*} nextProps
*/
componentWillReceiveProps({ data }) {
if (data) {
const { topic ,dataList } = data;
dataList &&
dataList.map(e => {
this.classifyPoints(e);
});
let { dataAll, dangerPoints, safePoints, warnPoints } = this.state;
dataAll.push(dangerPoints);
dataAll.push(warnPoints);
dataAll.push(safePoints);
this.setState({
dataAll
});
}
}
getOptions() {
return {
......@@ -229,7 +202,6 @@ class IncidenceSeverityMatrix extends Component {
}
IncidenceSeverityMatrix.propTypes = {
data: PropTypes.array
};
IncidenceSeverityMatrix.defaultProps = {
......
......@@ -5,7 +5,6 @@ import AmosWebSocket from 'amos-websocket';
import { Connect } from 'amos-framework';
import { queryRiskSourceRpnCountAction } from './../../../../services/situationService';
import SysWsURL, { completeToken } from './../../../../consts/wsUrlConsts';
import { withSubscribeMQTT } from 'amos-mqtt';
const eventConnect = Connect.eventConnect;
const labelOption = {
......@@ -21,12 +20,6 @@ const labelOption = {
/**
* 订阅主题
*/
@withSubscribeMQTT({
topic: '/data/refresh/riskDegreeHistogram'
})
/**
* 风险度(RPN) TOP10
*
* @class RiskDegreeHistogram
......@@ -46,29 +39,9 @@ class RiskDegreeHistogram extends Component {
componentDidMount() {
this.getBarViewContent();
}
/**
* 获取订阅信息并修改
* @param {*} nextProps
*/
componentWillReceiveProps({ data }) {
if (data) {
const { topic ,dataList } = data;
let riskNameList = [];
let rpniData = [];
let rpnrData = [];
dataList && dataList.map(e => {
riskNameList.push(e.name);
rpniData.push(e.rpni);
rpnrData.push(e.rpn);
});
this.setState({
riskNameList: riskNameList.reverse(),
rpniData: rpniData.reverse(),
rpnrData: rpnrData.reverse()
});
}
componentWillReceiveProps() {
}
getBarViewContent() {
queryRiskSourceRpnCountAction().then(
data => {
......@@ -156,10 +129,10 @@ class RiskDegreeHistogram extends Component {
render() {
const option = this.getOptions();
// const wsURL = completeToken(SysWsURL.rulews);
const wsURL = completeToken(SysWsURL.rulews);
return (
<div className="risk-degree-rpn-histogram">
{/**<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug /> */}
<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug />
<AmosEcharts option={option} />
</div>
);
......
......@@ -5,18 +5,11 @@ import AmosWebSocket from 'amos-websocket';
import { Connect } from 'amos-framework';
import { getRiskRiseUprateAction } from './../../../../services/situationService';
import SysWsURL, { completeToken } from './../../../../consts/wsUrlConsts';
import { withSubscribeMQTT } from 'amos-mqtt';
const eventConnect = Connect.eventConnect;
/**
* 订阅主题
*/
@withSubscribeMQTT({
topic: '/data/refresh/riskDegreePie'
})
/**
* 巡检点统计
* @class MonthlyInspection
* @extends {Component}
......@@ -34,25 +27,7 @@ class RiskDegreePie extends Component {
componentWillMount() {
this.getRiskRiseUprate();
}
/**
* 获取订阅信息并修改
* @param {*} nextProps
*/
componentWillReceiveProps({ data }) {
if (data) {
const { topic ,dataList } = data;
let { monthData, seasonData, yearData } = this.state;
monthData = dataList.month;
seasonData = dataList.season;
yearData = dataList.year;
this.setState({
monthData,
seasonData,
yearData
});
}
}
getRiskRiseUprate() {
getRiskRiseUprateAction().then(
data => {
......@@ -279,13 +254,13 @@ class RiskDegreePie extends Component {
render() {
let { monthData, seasonData, yearData } = this.state;
// const wsURL = completeToken(SysWsURL.rulews);
const wsURL = completeToken(SysWsURL.rulews);
let monthOption = this.getMonthOptions('month', monthData);
let seasonOption = this.getSeasonOptions('season', seasonData);
let yearOption = this.getYearOptions('year', yearData);
return (
<div className="risk-degree-pie">
{/**<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug /> */}
<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug />
<div className="risk-degree-pie1">
<AmosEcharts option={monthOption} />
<span>本月风险上升率 | {monthData.type0Rate} {monthData.countOfType0}</span>
......
......@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { Connect } from 'amos-framework';
import SvgToolkit from 'amos-viz/lib/svg/SvgToolkit';
import * as endConf from 'amos-processor/lib/config/endconf';
import { withSubscribeMQTT } from 'amos-mqtt';
import AmosWebSocket from 'amos-websocket';
import ynSitMap from './datas/yn/sit-map';
import ynInfo from './datas/yn/info';
import ynText from './datas/yn/text';
......@@ -41,7 +41,7 @@ import { eventTopics, rulesDataFactory } from './../../../3dview/consts';
import { getRegionAreaRpnAction } from './../../../../services/situationService';
const eventConnect = Connect.eventConnect;
// const genVal = (val) => Math.round((Math.random() * 10 + val));
const genVal = (val) => Math.round((Math.random() * 10 + val));
const colorEnum = { '0': 'initial', '1': 'one', '2': 'two', '3': 'three', '4': 'fourfive', '5': 'fourfive' };
const AmosConfig = endConf.AmosConfig;
const projectName = AmosConfig.riskDynamicChart.projectName;
......@@ -141,13 +141,6 @@ switch (projectName) {
}
/**
* 订阅主题
*/
@withSubscribeMQTT({
topic: '/data/refresh/situationMap'
})
/**
* 态势图
* @desciption created by af sinppets
......@@ -173,35 +166,6 @@ export default class SituationMap extends Component {
this.getRegionAreaRpn();
}
/**
* 获取订阅信息并修改
* @param {*} nextProps
*/
componentWillReceiveProps({ data }) {
if (data) {
const { topic ,dataList } = data;
const riskName = this.state.riskName;
let changeValue = {};
let changeColor = {};
for (let k in riskSourceIdMap) {
changeValue[k] = 0;
changeColor[k] = colorEnum[0];
if (riskSourceIdMap[k] !== -1) {
dataList.forEach(d => {
if (riskSourceIdMap[k] === d.id) {
changeValue[k] = d.rpni;
changeColor[k] = colorEnum[d.level];
riskName[k] = d.name;
}
});
}
}
this.updateData(changeValue);
this.updateLevel(changeColor);
this.setState(riskName);
}
}
onItemClick = (event) => {
console.log(event.target);
}
......@@ -390,7 +354,7 @@ export default class SituationMap extends Component {
const { pointedChildName } = this.state;
return (
<div style={{ position: 'relative' }}>
{/**<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug /> */}
<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug />
<SvgToolkit
ref={node => this.toolkitRef = node}
className="situation-map"
......@@ -410,6 +374,5 @@ export default class SituationMap extends Component {
}
SituationMap.propTypes = {
data: PropTypes.array,
subscribe: PropTypes.func
};
......@@ -4,13 +4,9 @@ import { Layout } from 'amos-framework';
import RiskDegreePie from './RiskDegreePie';
import RiskDegreeHistogram from './RiskDegreeHistogram';
import IncidenceSeverityMatrix from './IncidenceSeverityMatrix';
import { MQTTProvider } from 'amos-mqtt';
import SituationMap from './SituationMap';
import * as endConf from 'amos-processor/lib/config/endconf';
const { Header, Content, Sider } = Layout;
const AmosConfig = endConf.AmosConfig;
const wsurl = AmosConfig.wsURI.mqttURI;
/**
* 风险评估
*/
......@@ -18,7 +14,6 @@ class RiskAssessment extends Component {
render() {
return (
<MQTTProvider url={wsurl}>
<div className="risk-assessment-view" style={{ width: '100%', height: '100%' }}>
<Layout>
<Layout>
......@@ -47,7 +42,6 @@ class RiskAssessment extends Component {
</Sider>
</Layout>
</div>
</MQTTProvider>
);
}
}
......
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