Commit b91a0f24 authored by xinglei's avatar xinglei

修改语音播报逻辑

parent f01b6856
......@@ -2,7 +2,6 @@ import React, { Component } from 'react';
import { UUID } from 'amos-tool';
import message from 'amos-framework/lib/message';
import { utils } from 'amos-tool';
import { text2Speech } from './../../../utils/CalcCoorArrUtil';
/**
* 首页告警跑马灯
......@@ -49,9 +48,6 @@ class AlarmMarquee extends Component {
*/
resetMessage = (message) => {
if (!utils.isEmpty(message) && utils.isArray(message)) {
message.forEach((e, index) => {
text2Speech('异常' + (index + 1) + e.content);
});
return (<div>
{
message.map(e => {
......@@ -78,7 +74,7 @@ class AlarmMarquee extends Component {
const { pmdList } = this.props;
return (
<div className="AlarmMarquee-top-news">
<div className="news-marquee" >
<div className="news-marquee">
<marquee
id="marquee"
direction="left"
......
......@@ -25,7 +25,7 @@ import { getAlarms } from 'SERVICES/alarmService';
import { Store, utils } from 'amos-tool';
import * as endConf from 'amos-processor/lib/config/endconf';
import { isArray } from 'amos-pluggable/lib/_utils';
import { calcCoorArrUtil } from 'UTILS/CalcCoorArrUtil';
import { calcCoorArrUtil, text2Speech } from 'UTILS/CalcCoorArrUtil';
import { insertDistrict } from './common/mapUtils';
import { getDictionaryList } from './../../../services/securityService';
import { fetchJsonAction } from './../../../services/3dService';
......@@ -126,6 +126,8 @@ class IndexMap extends Component {
},
dotTipNum: 0,
pmdList: [], //跑马灯集合
isVoice: false, //控制语音播报渲染刷新页面不触发,仅接收消息触发
voiceList: [], //语音播报集合
xianVisible: false,
xianyangVisible: false,
xianAisleList: [], //西安通道集合
......@@ -857,7 +859,7 @@ class IndexMap extends Component {
//过滤告警列表
processingAlarmData = data => {
let { orgCode } = this.state;
let { orgCode, pmdList } = this.state;
if (orgCode !== '') {
let dictionaryList = lsTool.read('dictionaryList');
let dicCodeList = JSON.parse(dictionaryList);
......@@ -893,6 +895,8 @@ class IndexMap extends Component {
}
});
this.compareAlarms(pmdList, newData);
this.setState({
pmdList: newData,
xianVisible: xianFlag,
......@@ -911,6 +915,7 @@ class IndexMap extends Component {
this.initBankInfoList('xianyang', null, false);
}
}
this.setState({ isVoice: false });
};
......@@ -922,6 +927,23 @@ class IndexMap extends Component {
};
/**
* 对比数据判断语音播报内容
*/
compareAlarms = (pmdList, newPmdList) => {
const { isVoice } = this.state;
if (isVoice) {
let voiceList = newPmdList && newPmdList.filter(a => !pmdList.some(b => b.id === a.id));
this.setState({
voiceList
});
voiceList.forEach(e => {
text2Speech(e.content);
});
console.log('新增告警', voiceList);
}
}
/**
* 根据告警city或者eqpId的重构数据
*
* @memberof IndexMap
......@@ -945,6 +967,7 @@ class IndexMap extends Component {
* webSocket接收数据
*/
handleData = data => {
this.setState({ isVoice: true });
this.handleAlarmData();
};
......
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