Commit b2c4121e authored by zhengjiangtao's avatar zhengjiangtao

告警数据隔离

parent eeff67e2
...@@ -49,18 +49,20 @@ const mapConfig = { ...@@ -49,18 +49,20 @@ const mapConfig = {
features: ['bg', 'road', 'point'] //隐藏默认楼块 features: ['bg', 'road', 'point'] //隐藏默认楼块
}; };
const options = { const options = {
//默认 30 * 1000毫秒,收到 CONNACK 之前等待的时间,即连接超时时间。 //默认 30 * 1000毫秒,收到 CONNACK 之前等待的时间,即连接超时时间。
connectTimeout: 40000, connectTimeout: 40000,
// 客户端 ID,随机生成 // 客户端 ID,随机生成
clientId: 'bank_mqtt' + Math.random().toString(16).substr(2, 8), clientId:
'bank_mqtt' +
Math.random()
.toString(16)
.substr(2, 8),
clean: true, clean: true,
//默认 1000 毫秒,两次重新连接之间的间隔,客户端 ID 重复、认证失败等客户端会重新连接; //默认 1000 毫秒,两次重新连接之间的间隔,客户端 ID 重复、认证失败等客户端会重新连接;
reconnectPeriod: 1000 * 50 reconnectPeriod: 1000 * 50
} };
let client = mqtt.connect(mqttURI, options) let client = mqtt.connect(mqttURI, options);
const layers = [ const layers = [
new AMap.TileLayer({ new AMap.TileLayer({
...@@ -69,7 +71,7 @@ const layers = [ ...@@ -69,7 +71,7 @@ const layers = [
}, },
zIndex: 0 zIndex: 0
}) })
] ];
const twoDimensionalMapConfig = { const twoDimensionalMapConfig = {
zooms: [_showZoom[0], _showZoom[2]], zooms: [_showZoom[0], _showZoom[2]],
...@@ -108,8 +110,9 @@ class IndexMap extends Component { ...@@ -108,8 +110,9 @@ class IndexMap extends Component {
currentCard: 1, currentCard: 1,
currentCss: 1, currentCss: 1,
chartsViewFlag: [], chartsViewFlag: [],
type: 'small',//当前图层展示的末端marker标识 type: 'small', //当前图层展示的末端marker标识
styleCss: {//末端marker样式 styleCss: {
//末端marker样式
background: `url('/src/assets/sy/afterbody.png')`, background: `url('/src/assets/sy/afterbody.png')`,
backgroundSize: 'contain', backgroundSize: 'contain',
backgroundRepeat: 'no-repeat', backgroundRepeat: 'no-repeat',
...@@ -121,15 +124,15 @@ class IndexMap extends Component { ...@@ -121,15 +124,15 @@ class IndexMap extends Component {
lineHeight: '40px' lineHeight: '40px'
}, },
dotTipNum: 0, dotTipNum: 0,
pmdList: [],//跑马灯集合 pmdList: [], //跑马灯集合
xianVisible: false, xianVisible: false,
xianyangVisible: false, xianyangVisible: false,
xianAisleList: [],//西安通道集合 xianAisleList: [], //西安通道集合
xianyangAisleList: [],//咸阳通道集合 xianyangAisleList: [], //咸阳通道集合
centerList: [],//中心点集合 centerList: [], //中心点集合
bankInfoList: [], bankInfoList: [],
isEncircleShow: false,//是否环绕显示 isEncircleShow: false, //是否环绕显示
isOnClickCity: false//是否点击的城市 isOnClickCity: false //是否点击的城市
}; };
} }
...@@ -144,13 +147,13 @@ class IndexMap extends Component { ...@@ -144,13 +147,13 @@ class IndexMap extends Component {
//mqtt接收可删除 //mqtt接收可删除
receivcemqtt = () => { receivcemqtt = () => {
client.on('connect', (e) => { client.on('connect', e => {
console.log("连接成功!!!") console.log('连接成功!!!');
//QoS0,最多一次送达。也就是发出去就fire掉,没有后面的事情了。 //QoS0,最多一次送达。也就是发出去就fire掉,没有后面的事情了。
// QoS1,至少一次送达。发出去之后必须等待ack,没有ack,就要找时机重发 // QoS1,至少一次送达。发出去之后必须等待ack,没有ack,就要找时机重发
// QoS2,准确一次送达。消息id将拥有一个简单的生命周期。 // QoS2,准确一次送达。消息id将拥有一个简单的生命周期。
// client.subscribe('bank/equipment/ping', { qos: 1 }, (res) => { // client.subscribe('bank/equipment/ping', { qos: 1 }, (res) => {
client.subscribe('bank/aisle/alarm', { qos: 1 }, (res) => { client.subscribe('bank/aisle/alarm', { qos: 1 }, res => {
if (!res) { if (!res) {
console.log('订阅成功'); console.log('订阅成功');
// fetchJsonAction('/src/_mock/map/eqp.json', (data) => { // fetchJsonAction('/src/_mock/map/eqp.json', (data) => {
...@@ -176,15 +179,15 @@ class IndexMap extends Component { ...@@ -176,15 +179,15 @@ class IndexMap extends Component {
}); });
// 断开发起重连 // 断开发起重连
client.on('reconnect', (error) => { client.on('reconnect', error => {
console.log('正在重连:', error) console.log('正在重连:', error);
}); });
// 链接异常处理 // 链接异常处理
client.on('error', (error) => { client.on('error', error => {
console.log('连接失败:', error) console.log('连接失败:', error);
}); });
}); });
} };
/** /**
* 初始化登录用户权限 * 初始化登录用户权限
*/ */
...@@ -203,14 +206,14 @@ class IndexMap extends Component { ...@@ -203,14 +206,14 @@ class IndexMap extends Component {
}); });
lsTool.write('orgCode', orgCode); lsTool.write('orgCode', orgCode);
} };
/** /**
* 查询银行经纬度列表 * 查询银行经纬度列表
*/ */
getBankInfoList = () => { getBankInfoList = () => {
let { bankInfoList } = this.state; let { bankInfoList } = this.state;
getBankInfoListData().then((data) => { getBankInfoListData().then(data => {
if (data) { if (data) {
data.centerList.map(e => { data.centerList.map(e => {
bankInfoList.push(e); bankInfoList.push(e);
...@@ -224,7 +227,7 @@ class IndexMap extends Component { ...@@ -224,7 +227,7 @@ class IndexMap extends Component {
}); });
} }
}); });
} };
/** /**
* 初始化数据,判断权限 * 初始化数据,判断权限
...@@ -245,23 +248,23 @@ class IndexMap extends Component { ...@@ -245,23 +248,23 @@ class IndexMap extends Component {
/** /**
* 查询通道信息及状态 * 查询通道信息及状态
*/ */
queryAisleList = (city) => { queryAisleList = city => {
if (city === '西安') { if (city === '西安') {
queryAisleDataByCity(city).then((data) => { queryAisleDataByCity(city).then(data => {
let temp = this.isExist(xaMapData, data); let temp = this.isExist(xaMapData, data);
this.setState({ this.setState({
xianAisleList: temp xianAisleList: temp
}); });
}); });
} else { } else {
queryAisleDataByCity(city).then((data) => { queryAisleDataByCity(city).then(data => {
let temp = this.isExist(xyMapData, data); let temp = this.isExist(xyMapData, data);
this.setState({ this.setState({
xianyangAisleList: temp xianyangAisleList: temp
}); });
}); });
} }
} };
/** /**
* 重构数据,增加alarmState字段,渲染不同曲线颜色 * 重构数据,增加alarmState字段,渲染不同曲线颜色
...@@ -284,7 +287,7 @@ class IndexMap extends Component { ...@@ -284,7 +287,7 @@ class IndexMap extends Component {
} }
}); });
return mapData; return mapData;
} };
/** /**
* 经纬度获取坐标曲线 * 经纬度获取坐标曲线
...@@ -295,7 +298,7 @@ class IndexMap extends Component { ...@@ -295,7 +298,7 @@ class IndexMap extends Component {
*/ */
calcCoorArr = (point_start, point_end, num, key) => { calcCoorArr = (point_start, point_end, num, key) => {
return calcCoorArrUtil(point_start, point_end, num, key); return calcCoorArrUtil(point_start, point_end, num, key);
} };
/** /**
* 监听图层 * 监听图层
...@@ -305,7 +308,7 @@ class IndexMap extends Component { ...@@ -305,7 +308,7 @@ class IndexMap extends Component {
window.map.on('zoomchange', () => { window.map.on('zoomchange', () => {
thisMap.setStyleC(window.map.getZoom()); thisMap.setStyleC(window.map.getZoom());
}); });
} };
/** /**
* 根据传入的名称查询匹配orgCode * 根据传入的名称查询匹配orgCode
...@@ -336,19 +339,19 @@ class IndexMap extends Component { ...@@ -336,19 +339,19 @@ class IndexMap extends Component {
// } // }
// } // }
getCompanyId = (jsonObjDep) => { getCompanyId = jsonObjDep => {
if (jsonObjDep && jsonObjDep !== null) { if (jsonObjDep && jsonObjDep !== null) {
let companyId = jsonObjDep.companySeq; let companyId = jsonObjDep.companySeq;
return companyId; return companyId;
} }
} };
/** /**
* 点 * 点
*/ */
markerEvents = { markerEvents = {
click: (e) => { click: e => {
let map = { 'is3DPage': true, 'city': e.target.F.extData.city }; let map = { is3DPage: true, city: e.target.F.extData.city };
//this.props.indexViewChange(map); //this.props.indexViewChange(map);
} }
}; };
...@@ -356,16 +359,17 @@ class IndexMap extends Component { ...@@ -356,16 +359,17 @@ class IndexMap extends Component {
/** /**
* 圆 * 圆
*/ */
circleEvents = { click: () => { } }; circleEvents = { click: () => {} };
/** /**
* 线 * 线
*/ */
lineEvents = { lineEvents = {
click: (e) => { click: e => {
let line = e.target.F.extData; let line = e.target.F.extData;
let pointData = { citys: line.name }; let pointData = { citys: line.name };
setTimeout(() => {//设置延时判断点击的线还是点 setTimeout(() => {
//设置延时判断点击的线还是点
let { isOnClickCity } = this.state; let { isOnClickCity } = this.state;
if (isOnClickCity === false && line.name[0] === '西安') { if (isOnClickCity === false && line.name[0] === '西安') {
browserHistory.push({ pathname: '/biz/defaultRoute', state: { cityLine: JSON.stringify(pointData) } }); browserHistory.push({ pathname: '/biz/defaultRoute', state: { cityLine: JSON.stringify(pointData) } });
...@@ -385,7 +389,7 @@ class IndexMap extends Component { ...@@ -385,7 +389,7 @@ class IndexMap extends Component {
} }
}); });
return orgCode; return orgCode;
} };
/** /**
* 根据城市的orgCode,返回城市名称 * 根据城市的orgCode,返回城市名称
...@@ -396,11 +400,9 @@ class IndexMap extends Component { ...@@ -396,11 +400,9 @@ class IndexMap extends Component {
if (item.dictDataValue === orgCode) { if (item.dictDataValue === orgCode) {
city = item.dictDataKey; city = item.dictDataKey;
} }
}) });
return city; return city;
} };
/** /**
* 切换城市 * 切换城市
...@@ -479,14 +481,14 @@ class IndexMap extends Component { ...@@ -479,14 +481,14 @@ class IndexMap extends Component {
} else { } else {
message.danger('当前没有巡检计划'); message.danger('当前没有巡检计划');
} }
} };
closePatrol = () => { closePatrol = () => {
this.setState({ this.setState({
patrolView: false patrolView: false
}); });
} };
chartsView = (itemKey) => { chartsView = itemKey => {
if (itemKey.length < 1 || itemKey[0] === 'dangerMsg' || itemKey[0] === 'applyMsg') { if (itemKey.length < 1 || itemKey[0] === 'dangerMsg' || itemKey[0] === 'applyMsg') {
this.setState({ this.setState({
chartsViewFlag: itemKey, chartsViewFlag: itemKey,
...@@ -497,12 +499,12 @@ class IndexMap extends Component { ...@@ -497,12 +499,12 @@ class IndexMap extends Component {
chartsViewFlag: itemKey chartsViewFlag: itemKey
}); });
} }
} };
/** /**
* 不同图层渲染图标大小 * 不同图层渲染图标大小
*/ */
setStyleC = (zoom) => { setStyleC = zoom => {
if (zoom >= 8) { if (zoom >= 8) {
this.setState({ this.setState({
type: 'middle', type: 'middle',
...@@ -527,7 +529,7 @@ class IndexMap extends Component { ...@@ -527,7 +529,7 @@ class IndexMap extends Component {
} }
}); });
} }
} };
/** /**
* 13层以上设置地名环绕 * 13层以上设置地名环绕
...@@ -536,12 +538,12 @@ class IndexMap extends Component { ...@@ -536,12 +538,12 @@ class IndexMap extends Component {
this.setState({ this.setState({
isEncircleShow: true isEncircleShow: true
}); });
} };
/** /**
* 通道末端marker点 * 通道末端marker点
*/ */
setBodyMarker = (bankInfoList) => { setBodyMarker = bankInfoList => {
let { styleCss, type, isEncircleShow } = this.state; let { styleCss, type, isEncircleShow } = this.state;
if (isEncircleShow) { if (isEncircleShow) {
// return xaMapData.map((item, index) => { // return xaMapData.map((item, index) => {
...@@ -555,14 +557,23 @@ class IndexMap extends Component { ...@@ -555,14 +557,23 @@ class IndexMap extends Component {
// } // }
// }); // });
return bankInfoList.map((item, index) => { return bankInfoList.map((item, index) => {
if (item.eName !== 'xian' && item.eName !== 'xianyang' && item.eName !== 'xidajie' && item.eName !== 'bj-bank' && item.eName !== 'wx-bank' && item.eName !== 'sh-bank') { if (
return (<Marker zIndex={19} position={{ longitude: item.lng, latitude: item.lat }} events={this.markerEvents}> item.eName !== 'xian' &&
<div className={`after_line_${type} line${item.id}`} style={styleCss} ></div> item.eName !== 'xianyang' &&
item.eName !== 'xidajie' &&
item.eName !== 'bj-bank' &&
item.eName !== 'wx-bank' &&
item.eName !== 'sh-bank'
) {
return (
<Marker zIndex={19} position={{ longitude: item.lng, latitude: item.lat }} events={this.markerEvents}>
<div className={`after_line_${type} line${item.id}`} style={styleCss}></div>
<div className={`after_circle_title`}> <div className={`after_circle_title`}>
<span>{item.aName}</span> <span>{item.aName}</span>
{item.status === 1 && <div className={`pulse-spread-circle`} />} {item.status === 1 && <div className={`pulse-spread-circle`} />}
</div> </div>
</Marker>) </Marker>
);
} }
}); });
} else { } else {
...@@ -578,93 +589,122 @@ class IndexMap extends Component { ...@@ -578,93 +589,122 @@ class IndexMap extends Component {
// } // }
// }); // });
return bankInfoList.map((item, index) => { return bankInfoList.map((item, index) => {
if (item.eName !== 'xian' && item.eName !== 'xianyang' && item.eName !== 'xidajie' && item.eName !== 'bj-bank' && item.eName !== 'wx-bank' && item.eName !== 'sh-bank') { if (
return (<Marker zIndex={19} position={{ longitude: item.lng, latitude: item.lat }} events={this.markerEvents}> item.eName !== 'xian' &&
<div className={`after_line_${type} line${item.id}`} style={styleCss} ></div> item.eName !== 'xianyang' &&
item.eName !== 'xidajie' &&
item.eName !== 'bj-bank' &&
item.eName !== 'wx-bank' &&
item.eName !== 'sh-bank'
) {
return (
<Marker zIndex={19} position={{ longitude: item.lng, latitude: item.lat }} events={this.markerEvents}>
<div className={`after_line_${type} line${item.id}`} style={styleCss}></div>
{/*<div className={`after_circle_${type} title${item.id}`}> {/*<div className={`after_circle_${type} title${item.id}`}>
<img src={item.imgSrc} ></img> <img src={item.imgSrc} ></img>
<span>{item.alias}</span> <span>{item.alias}</span>
</div>*/} </div>*/}
</Marker>); </Marker>
);
} }
}); });
} }
} };
/** /**
*设置中心点的marker点 *设置中心点的marker点
* *
* @memberof IndexMap * @memberof IndexMap
*/ */
setCenterMarker = (centerList) => { setCenterMarker = centerList => {
let { isEncircleShow, xianVisible, xianyangVisible } = this.state; let { isEncircleShow, xianVisible, xianyangVisible } = this.state;
if (isEncircleShow) { if (isEncircleShow) {
return centerList.map((item, index) => { return centerList.map((item, index) => {
if (item) { if (item) {
return (<Marker key={item} zIndex={20} position={{ longitude: item.lng, latitude: item.lat }} events={this.markerEvents} extData={{ 'city': item.eName }}> return (
<Marker key={item} zIndex={20} position={{ longitude: item.lng, latitude: item.lat }} events={this.markerEvents} extData={{ city: item.eName }}>
<div className={`after_circle_title_center`}> <div className={`after_circle_title_center`}>
<span onClick={() => { this.markerOnClick(item.eName) }}>{item.aName}</span> <span
onClick={() => {
this.markerOnClick(item.eName);
}}
>
{item.aName}
</span>
{item.eName === 'xian' && xianVisible && <div className="pulse-spread-xian" />} {item.eName === 'xian' && xianVisible && <div className="pulse-spread-xian" />}
{item.eName === 'xianyang' && xianyangVisible && <div className="pulse-spread-xianyang" />} {item.eName === 'xianyang' && xianyangVisible && <div className="pulse-spread-xianyang" />}
</div> </div>
<div className={`after_circle_center`}> <div className={`after_circle_center`}>
<img src="/src/assets/sy/center.png" onClick={() => { this.markerOnClick(item.eName) }}></img> <img
src="/src/assets/sy/center.png"
onClick={() => {
this.markerOnClick(item.eName);
}}
></img>
</div> </div>
</Marker>); </Marker>
);
} }
}); });
} else { } else {
return centerList.map((item, index) => { return centerList.map((item, index) => {
if (item) { if (item) {
return (<Marker key={item} zIndex={20} position={{ longitude: item.lng, latitude: item.lat }} events={this.markerEvents} extData={{ 'city': item.eName }}> return (
<Marker key={item} zIndex={20} position={{ longitude: item.lng, latitude: item.lat }} events={this.markerEvents} extData={{ city: item.eName }}>
<div className={`after_circle_small center`}> <div className={`after_circle_small center`}>
<img src="/src/assets/sy/center.png" onClick={() => { this.markerOnClick(item.eName) }}></img> <img
src="/src/assets/sy/center.png"
onClick={() => {
this.markerOnClick(item.eName);
}}
></img>
</div> </div>
</Marker>); </Marker>
);
} }
}); });
} }
} };
/** /**
* 根据状态匹配不同通道颜色 * 根据状态匹配不同通道颜色
* @param {} alarmState * @param {} alarmState
*/ */
setSelectAisleStyle = (alarmState) => { setSelectAisleStyle = alarmState => {
switch (alarmState) { switch (alarmState) {
case '正常': case '正常':
return this.state.selectStyle; return this.state.selectStyle;
case '异常': case '异常':
return this.setSelectColor(4); return this.setSelectColor(4);
} }
} };
setUnSelectAisleStyle = (alarmState) => { setUnSelectAisleStyle = alarmState => {
switch (alarmState) { switch (alarmState) {
case '正常': case '正常':
return this.state.unSelectStyle; return this.state.unSelectStyle;
case '异常': case '异常':
return this.setUnSelectColor(4); return this.setUnSelectColor(4);
} }
} };
setSelectColor = (index) => { setSelectColor = index => {
let colorStyle = { strokeColor: LineColors[index], fillColor: LineColors[index], strokeWeight: '3' }; let colorStyle = { strokeColor: LineColors[index], fillColor: LineColors[index], strokeWeight: '3' };
return colorStyle; return colorStyle;
} };
setUnSelectColor = (index) => { setUnSelectColor = index => {
let colorStyle = { strokeColor: LineColors[index], fillColor: LineColors[index], strokeWeight: '1' }; let colorStyle = { strokeColor: LineColors[index], fillColor: LineColors[index], strokeWeight: '1' };
return colorStyle; return colorStyle;
} };
/** /**
* 点击名称切换三维 * 点击名称切换三维
*/ */
markerOnClick = (city, sourceIdStr) => { markerOnClick = (city, sourceIdStr) => {
//跳转告警页面 //跳转告警页面
if (city !== 'xian' && city !== 'xianyang' && city !== 'xidajie'){ if (city !== 'xian' && city !== 'xianyang' && city !== 'xidajie') {
if (!sourceIdStr){ if (!sourceIdStr) {
message.danger('该银行未绑定设备'); message.danger('该银行未绑定设备');
return; return;
} }
...@@ -683,40 +723,37 @@ class IndexMap extends Component { ...@@ -683,40 +723,37 @@ class IndexMap extends Component {
let companyName = this.getSelectCityByOrgCode(selectedCompanyOrg, dicCodeList); let companyName = this.getSelectCityByOrgCode(selectedCompanyOrg, dicCodeList);
let map = null; let map = null;
if (companyName && companyName.indexOf("清算中心") !== -1) { if (companyName && companyName.indexOf('清算中心') !== -1) {
let orgCode = this.getSelectOrgCode(city, dicCodeList); let orgCode = this.getSelectOrgCode(city, dicCodeList);
if (city === 'xian' || city === 'xianyang' || city === 'xidajie') { if (city === 'xian' || city === 'xianyang' || city === 'xidajie') {
map = { 'is3DPage': true, 'city': city, 'orgCode': orgCode }; map = { is3DPage: true, city: city, orgCode: orgCode };
} else { } else {
map = { 'is3DPage': true, 'city': '', 'orgCode': '' }; map = { is3DPage: true, city: '', orgCode: '' };
} }
} else if (companyName && companyName.indexOf("科技处") !== -1) { } else if (companyName && companyName.indexOf('科技处') !== -1) {
// map = { 'is3DPage': true, 'city': '', 'orgCode': selectedCompanyOrg }; // map = { 'is3DPage': true, 'city': '', 'orgCode': selectedCompanyOrg };
let newOrgCode = null; let newOrgCode = null;
if (city === 'xian') { if (city === 'xian') {
newOrgCode = this.getSelectOrgCode('科技处西安', dicCodeList); newOrgCode = this.getSelectOrgCode('科技处西安', dicCodeList);
}; }
if (city === 'xianyang') { if (city === 'xianyang') {
newOrgCode = this.getSelectOrgCode('科技处咸阳', dicCodeList); newOrgCode = this.getSelectOrgCode('科技处咸阳', dicCodeList);
}; }
if (city === 'xian' || city === 'xianyang' || city === 'xidajie') { if (city === 'xian' || city === 'xianyang' || city === 'xidajie') {
map = { 'is3DPage': true, 'city': city, 'orgCode': newOrgCode }; map = { is3DPage: true, city: city, orgCode: newOrgCode };
} else { } else {
map = { 'is3DPage': true, 'city': '', 'orgCode': '' }; map = { is3DPage: true, city: '', orgCode: '' };
} }
} else { } else {
map = { 'is3DPage': true, 'city': '', 'orgCode': '' }; map = { is3DPage: true, city: '', orgCode: '' };
} }
this.props.indexViewChange(map); this.props.indexViewChange(map);
};
}
markerOnClick1 = (city, flag, id, pointName, pointAttrs, floor, pointtype) => { markerOnClick1 = (city, flag, id, pointName, pointAttrs, floor, pointtype) => {
this.state.isOnClickCity = true; this.state.isOnClickCity = true;
let selectedCompanyOrg = lsTool.read('selectedCompanyOrg'); let selectedCompanyOrg = lsTool.read('selectedCompanyOrg');
let dictionaryList = lsTool.read('dictionaryList'); let dictionaryList = lsTool.read('dictionaryList');
...@@ -724,14 +761,24 @@ class IndexMap extends Component { ...@@ -724,14 +761,24 @@ class IndexMap extends Component {
let companyName = this.getSelectCityByOrgCode(selectedCompanyOrg, dicCodeList); let companyName = this.getSelectCityByOrgCode(selectedCompanyOrg, dicCodeList);
let map = null; let map = null;
if (companyName && companyName.indexOf("清算中心") !== -1) { if (companyName && companyName.indexOf('清算中心') !== -1) {
let orgCode = this.getSelectOrgCode(city, dicCodeList); let orgCode = this.getSelectOrgCode(city, dicCodeList);
if (city === 'xian' || city === 'xianyang' || city === 'xidajie') { if (city === 'xian' || city === 'xianyang' || city === 'xidajie') {
map = { 'is3DPage': true, 'city': city, 'orgCode': orgCode, 'flag': flag, 'pid': id, 'pointName': pointName, 'pointAttrs': pointAttrs, 'floor': floor, 'pointtype': pointtype }; map = {
is3DPage: true,
city: city,
orgCode: orgCode,
flag: flag,
pid: id,
pointName: pointName,
pointAttrs: pointAttrs,
floor: floor,
pointtype: pointtype
};
} else { } else {
map = { 'is3DPage': true, 'city': '', 'orgCode': '', 'flag': flag, 'pid': id, 'pointName': pointName, 'pointAttrs': pointAttrs, 'floor': floor, 'pointtype': pointtype }; map = { is3DPage: true, city: '', orgCode: '', flag: flag, pid: id, pointName: pointName, pointAttrs: pointAttrs, floor: floor, pointtype: pointtype };
} }
} else if (companyName && companyName.indexOf("科技处") !== -1) { } else if (companyName && companyName.indexOf('科技处') !== -1) {
// map = { 'is3DPage': true, 'city': '', 'orgCode': selectedCompanyOrg }; // map = { 'is3DPage': true, 'city': '', 'orgCode': selectedCompanyOrg };
let newOrgCode = null; let newOrgCode = null;
if (city === 'xian') { if (city === 'xian') {
...@@ -743,31 +790,71 @@ class IndexMap extends Component { ...@@ -743,31 +790,71 @@ class IndexMap extends Component {
} }
if (city === 'xian' || city === 'xianyang' || city === 'xidajie') { if (city === 'xian' || city === 'xianyang' || city === 'xidajie') {
map = { 'is3DPage': true, 'city': city, 'orgCode': newOrgCode, 'flag': flag, 'pid': id, 'pointName': pointName, 'pointAttrs': pointAttrs, 'floor': floor, 'pointtype': pointtype }; map = {
is3DPage: true,
city: city,
orgCode: newOrgCode,
flag: flag,
pid: id,
pointName: pointName,
pointAttrs: pointAttrs,
floor: floor,
pointtype: pointtype
};
} else { } else {
map = { 'is3DPage': true, 'city': '', 'orgCode': '', 'flag': flag, 'pid': id, 'pointName': pointName, 'pointAttrs': pointAttrs, 'floor': floor, 'pointtype': pointtype }; map = { is3DPage: true, city: '', orgCode: '', flag: flag, pid: id, pointName: pointName, pointAttrs: pointAttrs, floor: floor, pointtype: pointtype };
} }
} else { } else {
map = { 'is3DPage': true, 'city': '', 'orgCode': '', 'flag': flag, 'pid': id, 'pointName': pointName, 'pointAttrs': pointAttrs, 'floor': floor, 'pointtype': pointtype }; map = { is3DPage: true, city: '', orgCode: '', flag: flag, pid: id, pointName: pointName, pointAttrs: pointAttrs, floor: floor, pointtype: pointtype };
} }
this.props.indexViewChange(map); this.props.indexViewChange(map);
} };
dotTipNumChange = (num) => { dotTipNumChange = num => {
if (num !== this.state.dotTipNum) { if (num !== this.state.dotTipNum) {
this.setState({ this.setState({
dotTipNum: num dotTipNum: num
}); });
} }
};
existData = (code, orgCode) => {
let xianshi = false;
if ( code ){
if (code.indexOf('#') !== -1) {
let split = code.split('#') || [];
split.map(item => {
if (item.indexOf('-') !== -1) {
let array = item.split('-') || [];
if (array.length > 0 && array[0] === orgCode) {
xianshi = true;
}
}else{
if ( item === orgCode){
xianshi = true;
}
} }
});
} else {
let arr = code.split('-') || [];
if (arr.length > 0 && arr[0] === orgCode) {
xianshi = true;
}
}
}
return xianshi;
};
/** /**
* 初始化告警数据 * 初始化告警数据
*/ */
queeryAlarms = () => { queeryAlarms = () => {
let dictionaryList = lsTool.read('dictionaryList'); let dictionaryList = lsTool.read('dictionaryList');
let dicCodeList = JSON.parse(dictionaryList); let dicCodeList = JSON.parse(dictionaryList);
let xianCode = this.getSelectOrgCode('xian', dicCodeList); let xianCode = this.getSelectOrgCode('xian', dicCodeList);
...@@ -783,26 +870,34 @@ class IndexMap extends Component { ...@@ -783,26 +870,34 @@ class IndexMap extends Component {
getAlarms().then(data => { getAlarms().then(data => {
//过滤该公司没有权限的设备(有则跑马灯显示,否则不显示) //过滤该公司没有权限的设备(有则跑马灯显示,否则不显示)
let newData = []; let newData = [];
data.map(e => { data.map(e => {
if ((e.code.indexOf(orgCode) !== -1) || (e.authOrg && e.authOrg.indexOf(orgCode) !== -1)) { let xianshi = this.existData(e.code,orgCode);
let authOrgXianshi = this.existData(e.authOrg,orgCode);
if (xianshi || authOrgXianshi) {
newData.push(e); newData.push(e);
} }
}) });
if (!utils.isEmpty(newData) && utils.isArray(newData)) { if (!utils.isEmpty(newData) && utils.isArray(newData)) {
const xianFlag = newData.some(e => { const xianFlag = newData.some(e => {
// if (e.code === xianCode) { // if (e.code === xianCode) {
if (e.code.startsWith(xianCode) || (e.authOrg && e.authOrg.indexOf(xianCode) !== -1 || (e.authOrg && e.authOrg.indexOf(kejichuxianCode) !== -1))) { if (
e.code.startsWith(xianCode) ||
((e.authOrg && e.authOrg.indexOf(xianCode) !== -1) || (e.authOrg && e.authOrg.indexOf(kejichuxianCode) !== -1))
) {
return true; return true;
} }
}); });
const xianyangFlag = newData.some(e => { const xianyangFlag = newData.some(e => {
if (e.code.startsWith(xianyangCode) || (e.authOrg && e.authOrg.indexOf(xianyangCode) !== -1 || (e.authOrg && e.authOrg.indexOf(kejichuxianyangCode) !== -1))) { if (
e.code.startsWith(xianyangCode) ||
((e.authOrg && e.authOrg.indexOf(xianyangCode) !== -1) || (e.authOrg && e.authOrg.indexOf(kejichuxianyangCode) !== -1))
) {
return true; return true;
} }
}); });
this.setState({ this.setState({
pmdList: newData, pmdList: newData,
xianVisible: xianFlag, xianVisible: xianFlag,
...@@ -814,9 +909,7 @@ class IndexMap extends Component { ...@@ -814,9 +909,7 @@ class IndexMap extends Component {
} }
}); });
} }
};
}
/** /**
* 根据告警city或者eqpId的重构数据 * 根据告警city或者eqpId的重构数据
...@@ -836,12 +929,12 @@ class IndexMap extends Component { ...@@ -836,12 +929,12 @@ class IndexMap extends Component {
this.setState({ this.setState({
bankInfoList bankInfoList
}); });
} };
/** /**
* webSocket接收轨迹数据 * webSocket接收轨迹数据
*/ */
handleData = (data) => { handleData = data => {
let dictionaryList = lsTool.read('dictionaryList'); let dictionaryList = lsTool.read('dictionaryList');
let dicCodeList = JSON.parse(dictionaryList); let dicCodeList = JSON.parse(dictionaryList);
let xianCode = this.getSelectOrgCode('xian', dicCodeList); let xianCode = this.getSelectOrgCode('xian', dicCodeList);
...@@ -872,12 +965,12 @@ class IndexMap extends Component { ...@@ -872,12 +965,12 @@ class IndexMap extends Component {
xianVisible: handleXianFlag, xianVisible: handleXianFlag,
xianyangVisible: handleXianyangFlag xianyangVisible: handleXianyangFlag
}); });
} };
/** /**
* webSocket接收通道状态数据 * webSocket接收通道状态数据
*/ */
aisleIndexHandleData = (data) => { aisleIndexHandleData = data => {
//data = data.index; //data = data.index;
console.log('aisleWS', data); console.log('aisleWS', data);
if (data) { if (data) {
...@@ -901,14 +994,37 @@ class IndexMap extends Component { ...@@ -901,14 +994,37 @@ class IndexMap extends Component {
// }); // });
// } // }
} }
} };
render() { render() {
const events = { const events = {
created: this.setInstanceToGlobal created: this.setInstanceToGlobal
}; };
let { mapCenter, isIndexMap, patrolView, patrolDescData, city, selectStyle, unSelectStyle, orgCode, sequenceNbr, companys, currentCard, currentCss, let {
chartsViewFlag, dotTipNum, pmdList, xianVisible, xianyangVisible, xianAisleList, xianyangAisleList, centerList, isEncircleShow, bankInfoList, styleCss } = this.state; mapCenter,
isIndexMap,
patrolView,
patrolDescData,
city,
selectStyle,
unSelectStyle,
orgCode,
sequenceNbr,
companys,
currentCard,
currentCss,
chartsViewFlag,
dotTipNum,
pmdList,
xianVisible,
xianyangVisible,
xianAisleList,
xianyangAisleList,
centerList,
isEncircleShow,
bankInfoList,
styleCss
} = this.state;
let cardCss1 = 'small-card-css'; let cardCss1 = 'small-card-css';
let cardCss2 = 'small-card-css'; let cardCss2 = 'small-card-css';
// 旧版点击样式,正式上线前需删除 // 旧版点击样式,正式上线前需删除
...@@ -944,10 +1060,10 @@ class IndexMap extends Component { ...@@ -944,10 +1060,10 @@ class IndexMap extends Component {
return ( return (
<div className="content indexPage"> <div className="content indexPage">
<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 />
<AmosWebSocket ref={node => this.aws = node} url={aisleURL} onMessage={this.aisleIndexHandleData} reconnect debug /> <AmosWebSocket ref={node => (this.aws = node)} url={aisleURL} onMessage={this.aisleIndexHandleData} reconnect debug />
<AlarmMarquee pmdList={pmdList} /> <AlarmMarquee pmdList={pmdList} />
<div className='body-left'> <div className="body-left">
{/**<div className='body-left' style={{ display: chartsViewFlag[0] === 'dangerMsg' ? 'block' : 'none' }}>**/} {/**<div className='body-left' style={{ display: chartsViewFlag[0] === 'dangerMsg' ? 'block' : 'none' }}>**/}
{/**<div><img src='/src/assets/sy/indexLeft.png' /></div>*/} {/**<div><img src='/src/assets/sy/indexLeft.png' /></div>*/}
<LeftCharts currentCode={orgCode} dotTipNumChange={this.dotTipNumChange} /> <LeftCharts currentCode={orgCode} dotTipNumChange={this.dotTipNumChange} />
...@@ -965,7 +1081,12 @@ class IndexMap extends Component { ...@@ -965,7 +1081,12 @@ class IndexMap extends Component {
</div> </div>
</Col> </Col>
</div>*/} </div>*/}
<div className="new_track" onClick={() => { currentCss === 1 ? this.show2dMap(2) : this.showIndexMap(1) }}> <div
className="new_track"
onClick={() => {
currentCss === 1 ? this.show2dMap(2) : this.showIndexMap(1);
}}
>
<img src={currentCss === 1 ? newTrackUnSelect : newTrackSelect} /> <img src={currentCss === 1 ? newTrackUnSelect : newTrackSelect} />
</div> </div>
{/* <div className="middle"> {/* <div className="middle">
...@@ -979,7 +1100,7 @@ class IndexMap extends Component { ...@@ -979,7 +1100,7 @@ class IndexMap extends Component {
</div> </div>
{currentCss === 1 && <LeftDown></LeftDown>} {currentCss === 1 && <LeftDown></LeftDown>}
{isIndexMap ? ( {isIndexMap ? (
<div className='body-center'> <div className="body-center">
<BaseMap events={events} center={mapCenter} {...mapConfig}> <BaseMap events={events} center={mapCenter} {...mapConfig}>
{/* 三个可点击的中心点(西安|咸阳|西大街) */} {/* 三个可点击的中心点(西安|咸阳|西大街) */}
{/* {(centerList || []).map((item, index) => ( {/* {(centerList || []).map((item, index) => (
...@@ -1032,16 +1153,23 @@ class IndexMap extends Component { ...@@ -1032,16 +1153,23 @@ class IndexMap extends Component {
} }
</Marker> </Marker>
))}*/} ))}*/}
{(bankInfoList || []).map((item) => ( {(bankInfoList || []).map(item => (
<Marker key={item.id} zIndex={18} position={{ longitude: item.lng, latitude: item.lat }} events={this.markerEvents} extData={{ 'city': item.eName }}> <Marker
key={item.id}
zIndex={18}
position={{ longitude: item.lng, latitude: item.lat }}
events={this.markerEvents}
extData={{ city: item.eName }}
>
{isEncircleShow === false && <TwinkleDiv info={item} markerOnClick={this.markerOnClick} styleCss={styleCss} />} {isEncircleShow === false && <TwinkleDiv info={item} markerOnClick={this.markerOnClick} styleCss={styleCss} />}
</Marker> </Marker>
))} ))}
</BaseMap> </BaseMap>
</div> </div>
) : (<TwoDimensionalMap twoDimensionalMapConfig={twoDimensionalMapConfig}></TwoDimensionalMap>) ) : (
} <TwoDimensionalMap twoDimensionalMapConfig={twoDimensionalMapConfig}></TwoDimensionalMap>
<div className='body-right' > )}
<div className="body-right">
<RightCharts currentCode={orgCode} curCompanyId={sequenceNbr} patrolDetailView={this.patrolDetailView} chartsViewFlag={chartsViewFlag[0]} /> <RightCharts currentCode={orgCode} curCompanyId={sequenceNbr} patrolDetailView={this.patrolDetailView} chartsViewFlag={chartsViewFlag[0]} />
</div> </div>
{/*{ {/*{
...@@ -1053,7 +1181,6 @@ class IndexMap extends Component { ...@@ -1053,7 +1181,6 @@ class IndexMap extends Component {
{patrolView ? <PatrolDetail closePatrol={this.closePatrol} dataList={patrolDescData} markerOnClick1={this.markerOnClick1} /> : ''} {patrolView ? <PatrolDetail closePatrol={this.closePatrol} dataList={patrolDescData} markerOnClick1={this.markerOnClick1} /> : ''}
{/*{patrolView && chartsViewFlag.length > 0 ? <PatrolDetail closePatrol={this.closePatrol} dataList={patrolDescData} /> : ''} {/*{patrolView && chartsViewFlag.length > 0 ? <PatrolDetail closePatrol={this.closePatrol} dataList={patrolDescData} /> : ''}
<IndexSidePane chartsView={this.chartsView} nowKey={chartsViewFlag} dotTipNum={dotTipNum} />*/} <IndexSidePane chartsView={this.chartsView} nowKey={chartsViewFlag} dotTipNum={dotTipNum} />*/}
</div> </div>
); );
} }
......
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