Commit e5a8176c authored by zhengjiangtao's avatar zhengjiangtao

fix bug

parent 2df5bea8
...@@ -174,7 +174,9 @@ class View3D extends Component { ...@@ -174,7 +174,9 @@ class View3D extends Component {
onProgress: (item, loaded, total) => { onProgress: (item, loaded, total) => {
this.setState({ this.setState({
loadingResInfo: { loadingResInfo: {
total, current: loaded, url: item total,
current: loaded,
url: item
} }
}); });
} }
...@@ -186,25 +188,18 @@ class View3D extends Component { ...@@ -186,25 +188,18 @@ class View3D extends Component {
componentDidMount() { componentDidMount() {
this._registerEvents(); // 注册事件 this._registerEvents(); // 注册事件
this._bindPubSubEvents(); // 绑定事件 this._bindPubSubEvents(); // 绑定事件
this._bindRulesPubSubEvents();//获取风险点告警 this._bindRulesPubSubEvents(); //获取风险点告警
this.loadAlarmData();//获取告警数据 this.loadAlarmData(); //获取告警数据
// this.props.onRef(this);//传输子组件对象 // this.props.onRef(this);//传输子组件对象
} }
componentWillUnmount() { componentWillUnmount() {
this.objAnchorHelper && this.objAnchorHelper.destroy(); this.objAnchorHelper && this.objAnchorHelper.destroy();
this.infoHelper && this.infoHelper.destroy(); this.infoHelper && this.infoHelper.destroy();
// 定时器销毁 // 定时器销毁
this.interval && clearInterval(this.interval); this.interval && clearInterval(this.interval);
this.timer && clearTimeout(this.timer); this.timer && clearTimeout(this.timer);
} }
/** /**
...@@ -217,7 +212,7 @@ class View3D extends Component { ...@@ -217,7 +212,7 @@ class View3D extends Component {
}); });
// 相机视角改变 // 相机视角改变
this.r3d.on('camera_change', (evt) => { this.r3d.on('camera_change', evt => {
// console.log('main camera_change', evt); // console.log('main camera_change', evt);
}); });
...@@ -323,7 +318,6 @@ class View3D extends Component { ...@@ -323,7 +318,6 @@ class View3D extends Component {
} }
} }
}); });
}; };
/** /**
...@@ -345,7 +339,6 @@ class View3D extends Component { ...@@ -345,7 +339,6 @@ class View3D extends Component {
}); });
}; };
_bindRulesPubSubEvents = () => { _bindRulesPubSubEvents = () => {
this.props.subscribe(eventTopics.fromws, (topic, content) => { this.props.subscribe(eventTopics.fromws, (topic, content) => {
let data = content.data; let data = content.data;
...@@ -355,11 +348,11 @@ class View3D extends Component { ...@@ -355,11 +348,11 @@ class View3D extends Component {
switch (topic) { switch (topic) {
case 'base3d.fromws.riskSituation_flicker': case 'base3d.fromws.riskSituation_flicker':
console.log('风险触发风险点闪烁~~~~~~~~~~~~~~~~~~~~'); console.log('风险触发风险点闪烁~~~~~~~~~~~~~~~~~~~~');
this.flickerTroubleMarkers(this, data);//风险触发风险点闪烁 this.flickerTroubleMarkers(this, data); //风险触发风险点闪烁
break; break;
case 'base3d.fromws.riskSituation_colour': case 'base3d.fromws.riskSituation_colour':
console.log('风险触发风险点颜色改变~~~~~~~~~~~~~~~~~~~~'); console.log('风险触发风险点颜色改变~~~~~~~~~~~~~~~~~~~~');
this.flickerTroubleMarkers(this, data);//风险触发风险点闪烁 this.flickerTroubleMarkers(this, data); //风险触发风险点闪烁
break; break;
default: default:
console.log(topic, ':类型不支持'); console.log(topic, ':类型不支持');
...@@ -423,7 +416,11 @@ class View3D extends Component { ...@@ -423,7 +416,11 @@ class View3D extends Component {
r3d, r3d,
cameraFactory, cameraFactory,
sceneFactory, sceneFactory,
cameraEffect: this.city.isXian ? desigerHelperConfig.cameraEffect : this.city.isXianyang ? desigerHelperConfig.xyCameraEffect : desigerHelperConfig.xdjCameraEffect cameraEffect: this.city.isXian
? desigerHelperConfig.cameraEffect
: this.city.isXianyang
? desigerHelperConfig.xyCameraEffect
: desigerHelperConfig.xdjCameraEffect
}); });
}; };
...@@ -432,13 +429,13 @@ class View3D extends Component { ...@@ -432,13 +429,13 @@ class View3D extends Component {
* *
* @memberof View3D * @memberof View3D
*/ */
createInfowindow = (text) => { createInfowindow = text => {
const div = document.createElement('div'); const div = document.createElement('div');
div.style.position = 'absolute'; div.style.position = 'absolute';
div.className = 'three-ui-infowindow'; div.className = 'three-ui-infowindow';
div.innerText = text; div.innerText = text;
return div; return div;
} };
/** /**
* 创建信息面板 * 创建信息面板
...@@ -452,7 +449,7 @@ class View3D extends Component { ...@@ -452,7 +449,7 @@ class View3D extends Component {
element: createPanel(name), element: createPanel(name),
position: [3.5, 4, 0] position: [3.5, 4, 0]
}); });
} };
/** /**
* 加载完成 * 加载完成
...@@ -486,7 +483,7 @@ class View3D extends Component { ...@@ -486,7 +483,7 @@ class View3D extends Component {
* *
* @memberof View3D * @memberof View3D
*/ */
onAllDone = (objGroup) => { onAllDone = objGroup => {
this.sceneFactory.level.change(objGroup); this.sceneFactory.level.change(objGroup);
// this.cameraFactory.fitView(this.city.isXian ? desigerHelperConfig.cameraEffect : this.city.isXianyang ? desigerHelperConfig.xyCameraEffect : desigerHelperConfig.xdjCameraEffect); // this.cameraFactory.fitView(this.city.isXian ? desigerHelperConfig.cameraEffect : this.city.isXianyang ? desigerHelperConfig.xyCameraEffect : desigerHelperConfig.xdjCameraEffect);
this.setRootFitView(); this.setRootFitView();
...@@ -505,55 +502,40 @@ class View3D extends Component { ...@@ -505,55 +502,40 @@ class View3D extends Component {
let floor = this.props.floor; let floor = this.props.floor;
let pointtype = this.props.pointtype; let pointtype = this.props.pointtype;
if (this.props.city === 'xian') { if (this.props.city === 'xian') {
this.onAlarmClick1(pointtype, 'floor_' + floor, { this.onAlarmClick1(pointtype, 'floor_' + floor, {
authOrg: null,
'authOrg': null, code: '',
'code': "", content: '',
'content': "", id: 0,
'id': 0, isAlarm: 0,
'isAlarm': 0, pointAttrs: `{"position":"` + pointAttrs + `","storey":"` + floor + `"}`,
'pointAttrs': `{"position":"` + pointAttrs + `","storey":"` + floor + `"}`, pointId: pid,
'pointId': pid, pointName: pointName,
'pointName': pointName, pointType: '3',
'pointType': "3", sourceId: null,
'sourceId': null, updateDate: ''
'updateDate': "",
}); });
} else { } else {
this.onAlarmClick1(pointtype, 'xy_floor_' + floor, { this.onAlarmClick1(pointtype, 'xy_floor_' + floor, {
authOrg: null,
'authOrg': null, code: '',
'code': "", content: '',
'content': "", id: 0,
'id': 0, isAlarm: 0,
'isAlarm': 0, pointAttrs: `{"position":"` + pointAttrs + `","storey":"` + floor + `"}`,
'pointAttrs': `{"position":"` + pointAttrs + `","storey":"` + floor + `"}`, pointId: pid,
'pointId': pid, pointName: pointName,
'pointName': pointName, pointType: '3',
'pointType': "3", sourceId: null,
'sourceId': null, updateDate: ''
'updateDate': "",
}); });
} }
} }
}, 1500); }, 1500);
// 设置楼层勾边标记 // 设置楼层勾边标记
this.setToggleOutline(); this.setToggleOutline();
}; };
/** /**
...@@ -565,7 +547,7 @@ class View3D extends Component { ...@@ -565,7 +547,7 @@ class View3D extends Component {
getAlarms().then(data => { getAlarms().then(data => {
this.setState({ alarmData: data }); this.setState({ alarmData: data });
}); });
} };
/** /**
* Worker加载中 * Worker加载中
...@@ -580,14 +562,14 @@ class View3D extends Component { ...@@ -580,14 +562,14 @@ class View3D extends Component {
} = {}) => { } = {}) => {
this.setState({ percent }); this.setState({ percent });
console.log('from worker:', loading, percent, rendering); console.log('from worker:', loading, percent, rendering);
} };
/** /**
* Worker初始化完成 * Worker初始化完成
* *
* @memberof View3D * @memberof View3D
*/ */
onAfterWorkerInit = (workerObjGroup) => { onAfterWorkerInit = workerObjGroup => {
this.setState({ isAllDone: true }); this.setState({ isAllDone: true });
// 处理跳跃 // 处理跳跃
this.lensJumpFactory.process(workerObjGroup); this.lensJumpFactory.process(workerObjGroup);
...@@ -598,7 +580,7 @@ class View3D extends Component { ...@@ -598,7 +580,7 @@ class View3D extends Component {
* *
* @memberof View3D * @memberof View3D
*/ */
onLoadProgress = (xhr) => { onLoadProgress = xhr => {
if (xhr.lengthComputable) { if (xhr.lengthComputable) {
var percentComplete = (xhr.loaded / xhr.total) * 100; var percentComplete = (xhr.loaded / xhr.total) * 100;
const percent = Math.round(percentComplete, 2); const percent = Math.round(percentComplete, 2);
...@@ -609,7 +591,7 @@ class View3D extends Component { ...@@ -609,7 +591,7 @@ class View3D extends Component {
this.setState({ percent }); this.setState({ percent });
} }
} }
} };
/** /**
* 焦点位置设置 * 焦点位置设置
...@@ -636,7 +618,7 @@ class View3D extends Component { ...@@ -636,7 +618,7 @@ class View3D extends Component {
this.clearAlarms(); this.clearAlarms();
if (object && object.foreignKey) { if (object && object.foreignKey) {
this.cameraFactory.flyTo({ this.cameraFactory.flyTo({
position: [269.11, 83.06, 103.80], position: [269.11, 83.06, 103.8],
target: object, target: object,
duration: 1000, duration: 1000,
// 飞行到具体的 obj 之后,执行进入层级操作 // 飞行到具体的 obj 之后,执行进入层级操作
...@@ -663,7 +645,6 @@ class View3D extends Component { ...@@ -663,7 +645,6 @@ class View3D extends Component {
if (isFlyToSun !== undefined && isFlyToSun === true) { if (isFlyToSun !== undefined && isFlyToSun === true) {
_this.flyToCabinet(object); _this.flyToCabinet(object);
} }
} }
} }
}); });
...@@ -720,7 +701,7 @@ class View3D extends Component { ...@@ -720,7 +701,7 @@ class View3D extends Component {
} }
this.setCabinetFitView(userData); this.setCabinetFitView(userData);
} };
/** /**
* 设置楼层勾边标记 * 设置楼层勾边标记
...@@ -736,7 +717,7 @@ class View3D extends Component { ...@@ -736,7 +717,7 @@ class View3D extends Component {
} }
}); });
this.outlineFactory.toggleOutline(_objs); this.outlineFactory.toggleOutline(_objs);
} };
/** /**
* 设置楼层勾边标记为默认颜色 * 设置楼层勾边标记为默认颜色
...@@ -748,7 +729,7 @@ class View3D extends Component { ...@@ -748,7 +729,7 @@ class View3D extends Component {
visibleEdgeColor: '#ffe2ad', visibleEdgeColor: '#ffe2ad',
hiddenEdgeColor: '#ffe2ad' hiddenEdgeColor: '#ffe2ad'
}; };
} };
/** /**
* 设置楼层勾边标记为选中的颜色 * 设置楼层勾边标记为选中的颜色
...@@ -760,23 +741,24 @@ class View3D extends Component { ...@@ -760,23 +741,24 @@ class View3D extends Component {
visibleEdgeColor: '#f8a303', visibleEdgeColor: '#f8a303',
hiddenEdgeColor: '#ffe2ad' hiddenEdgeColor: '#ffe2ad'
}; };
} };
/** /**
* 设置楼层类型 * 设置楼层类型
* *
* @memberof View3D * @memberof View3D
*/ */
setFloorType = (key) => { setFloorType = key => {
// 设置初始视角 // 设置初始视角
if (key === FLOOR.FLOOR_3) { if (key === FLOOR.FLOOR_3) {
this.setFloorThreeFitView(); this.setFloorThreeFitView();
} else if (key === FLOOR.FLOOR_6) { } else if (key === FLOOR.FLOOR_6) {
this.setFloorSixFitView(); this.setFloorSixFitView();
} else { // 咸阳 } else {
// 咸阳
this.setXYFloorThreeFitView(); this.setXYFloorThreeFitView();
} }
} };
/** /**
* 淡出 * 淡出
...@@ -829,7 +811,7 @@ class View3D extends Component { ...@@ -829,7 +811,7 @@ class View3D extends Component {
this.initView3DData(markerType, data); this.initView3DData(markerType, data);
}); });
} }
} };
/** /**
* 重构数据 * 重构数据
...@@ -839,7 +821,8 @@ class View3D extends Component { ...@@ -839,7 +821,8 @@ class View3D extends Component {
initView3DData = (markerType, data) => { initView3DData = (markerType, data) => {
const { markers, floorType, alarmData } = this.state; const { markers, floorType, alarmData } = this.state;
let markerData = []; let markerData = [];
if (data) {// 点数据按楼层显示 if (data) {
// 点数据按楼层显示
if (LENS_LEVEL.SUB === this.lensLevel || LENS_LEVEL.SUN === this.lensLevel) { if (LENS_LEVEL.SUB === this.lensLevel || LENS_LEVEL.SUN === this.lensLevel) {
data.forEach(item => { data.forEach(item => {
if (floorType === item.objKey) { if (floorType === item.objKey) {
...@@ -867,14 +850,14 @@ class View3D extends Component { ...@@ -867,14 +850,14 @@ class View3D extends Component {
markers[markerType] = markerData; markers[markerType] = markerData;
this.setState({ markers, markerData }); this.setState({ markers, markerData });
} }
} };
/** /**
* 风险点闪烁 * 风险点闪烁
* *
* @memberof View3D * @memberof View3D
*/ */
riskAlarmDataTwinkle = (alarmData) => { riskAlarmDataTwinkle = alarmData => {
const { markers, markerData, markerType } = this.state; const { markers, markerData, markerType } = this.state;
if (alarmData.bizobj) { if (alarmData.bizobj) {
markerData.forEach(marker => { markerData.forEach(marker => {
...@@ -889,7 +872,7 @@ class View3D extends Component { ...@@ -889,7 +872,7 @@ class View3D extends Component {
// 点数据分类 // 点数据分类
markers[markerType] = markerData; markers[markerType] = markerData;
this.setState({ markers }); this.setState({ markers });
} };
/** /**
* 设置初始视角 * 设置初始视角
...@@ -897,9 +880,10 @@ class View3D extends Component { ...@@ -897,9 +880,10 @@ class View3D extends Component {
* @memberof View3D * @memberof View3D
*/ */
setRootFitView = () => { setRootFitView = () => {
this.cameraFactory.fitView(this.city.isXian ? desigerHelperConfig.cameraEffect : this.cameraFactory.fitView(
this.city.isXianyang ? desigerHelperConfig.xyCameraEffect : desigerHelperConfig.xdjCameraEffect); this.city.isXian ? desigerHelperConfig.cameraEffect : this.city.isXianyang ? desigerHelperConfig.xyCameraEffect : desigerHelperConfig.xdjCameraEffect
} );
};
/** /**
* 设置西大街初始视角 * 设置西大街初始视角
...@@ -908,7 +892,7 @@ class View3D extends Component { ...@@ -908,7 +892,7 @@ class View3D extends Component {
*/ */
setXidajieFitView = () => { setXidajieFitView = () => {
this.cameraFactory.fitView(desigerHelperConfig.xdjCameraEffect); this.cameraFactory.fitView(desigerHelperConfig.xdjCameraEffect);
} };
/** /**
* 设置三楼初始视角 * 设置三楼初始视角
...@@ -918,7 +902,7 @@ class View3D extends Component { ...@@ -918,7 +902,7 @@ class View3D extends Component {
setFloorThreeFitView = () => { setFloorThreeFitView = () => {
this.cameraFactory.fitView(desigerHelperConfig.thirdFloorCameraEffect); this.cameraFactory.fitView(desigerHelperConfig.thirdFloorCameraEffect);
this.setState({ floorType: FLOOR.FLOOR_3 }); this.setState({ floorType: FLOOR.FLOOR_3 });
} };
/** /**
* 设置三楼初始视角 - 咸阳 * 设置三楼初始视角 - 咸阳
...@@ -928,7 +912,7 @@ class View3D extends Component { ...@@ -928,7 +912,7 @@ class View3D extends Component {
setXYFloorThreeFitView = () => { setXYFloorThreeFitView = () => {
this.cameraFactory.fitView(desigerHelperConfig.xyThirdFloorCameraEffect); this.cameraFactory.fitView(desigerHelperConfig.xyThirdFloorCameraEffect);
this.setState({ floorType: FLOOR.FLOOR_3 }); this.setState({ floorType: FLOOR.FLOOR_3 });
} };
/** /**
* 设置六楼初始视角 * 设置六楼初始视角
...@@ -938,21 +922,21 @@ class View3D extends Component { ...@@ -938,21 +922,21 @@ class View3D extends Component {
setFloorSixFitView = () => { setFloorSixFitView = () => {
this.cameraFactory.fitView(desigerHelperConfig.thirdFloorCameraEffect); this.cameraFactory.fitView(desigerHelperConfig.thirdFloorCameraEffect);
this.setState({ floorType: FLOOR.FLOOR_6 }); this.setState({ floorType: FLOOR.FLOOR_6 });
} };
/** /**
* 设置机柜初始视角 * 设置机柜初始视角
* *
* @memberof View3D * @memberof View3D
*/ */
setCabinetFitView = (userData) => { setCabinetFitView = userData => {
this.cameraFactory.fitView({ this.cameraFactory.fitView({
position: userData.position ? userData.position : desigerHelperConfig.cabinetCameraEffect.position, position: userData.position ? userData.position : desigerHelperConfig.cabinetCameraEffect.position,
target: userData.target ? userData.target : desigerHelperConfig.cabinetCameraEffect.target, target: userData.target ? userData.target : desigerHelperConfig.cabinetCameraEffect.target,
duration: desigerHelperConfig.cabinetCameraEffect.duration duration: desigerHelperConfig.cabinetCameraEffect.duration
}); });
this.setState({ floorType: FLOOR.FLOOR_0 }); this.setState({ floorType: FLOOR.FLOOR_0 });
} };
/** /**
* 设置玻璃透明度 * 设置玻璃透明度
...@@ -1024,7 +1008,7 @@ class View3D extends Component { ...@@ -1024,7 +1008,7 @@ class View3D extends Component {
// 设置楼层标记 // 设置楼层标记
this.setToggleOutline(); this.setToggleOutline();
} };
/** /**
* 返回三维第二层 * 返回三维第二层
...@@ -1040,7 +1024,7 @@ class View3D extends Component { ...@@ -1040,7 +1024,7 @@ class View3D extends Component {
// 设置层级 // 设置层级
this.lensLevel = LENS_LEVEL.SUB; this.lensLevel = LENS_LEVEL.SUB;
// this.clearMarkers(); // this.clearMarkers();
} };
/** /**
* 返回上级 * 返回上级
...@@ -1051,7 +1035,9 @@ class View3D extends Component { ...@@ -1051,7 +1035,9 @@ class View3D extends Component {
if (this.lensLevel === LENS_LEVEL.SUN) { if (this.lensLevel === LENS_LEVEL.SUN) {
this.backSubView(); this.backSubView();
this.lensLevel = LENS_LEVEL.SUB; this.lensLevel = LENS_LEVEL.SUB;
if (this.state.floorType === FLOOR.FLOOR_0) { this.setState({ floorType: FLOOR.FLOOR_3 }); } if (this.state.floorType === FLOOR.FLOOR_0) {
this.setState({ floorType: FLOOR.FLOOR_3 });
}
} else if (this.lensLevel === LENS_LEVEL.SUB && !this.city.isXidajie) { } else if (this.lensLevel === LENS_LEVEL.SUB && !this.city.isXidajie) {
this.backRootView(); this.backRootView();
this.lensLevel = LENS_LEVEL.ROOT; this.lensLevel = LENS_LEVEL.ROOT;
...@@ -1073,7 +1059,7 @@ class View3D extends Component { ...@@ -1073,7 +1059,7 @@ class View3D extends Component {
pickVisable: false, pickVisable: false,
pickDialog: false pickDialog: false
}); });
} };
/** /**
* 执行操作 * 执行操作
...@@ -1163,28 +1149,37 @@ class View3D extends Component { ...@@ -1163,28 +1149,37 @@ class View3D extends Component {
*/ */
updateMarker = data => { updateMarker = data => {
//console.log(data, 'updateMarker'); //console.log(data, 'updateMarker');
const { type, id } = data; if(data !=undefined && data != null){
const { markers } = this.state; const { type, id } = data;
const markersArr = markers[type] || []; if (type !=undefined && type != null) {
if (markersArr.length > 0) { if (type && null !== type) {
let needUpdate = false; const { markers } = this.state;
const newArr = markersArr.map(marker => { const markersArr = markers[type] || [];
if (marker.id === id) { if (markersArr.length > 0) {
needUpdate = true; let needUpdate = false;
return { const newArr = markersArr.map(marker => {
...marker, if (marker.id === id) {
...data needUpdate = true;
}; return {
...marker,
...data
};
}
return marker;
});
if (needUpdate) {
markers[type] = newArr;
this.setState({
markers
});
}
}
} }
return marker;
});
if (needUpdate) {
markers[type] = newArr;
this.setState({
markers
});
} }
} }
}; };
/** /**
...@@ -1213,19 +1208,16 @@ class View3D extends Component { ...@@ -1213,19 +1208,16 @@ class View3D extends Component {
if (code.indexOf('#') !== -1) { if (code.indexOf('#') !== -1) {
let split = code.split('#') || []; let split = code.split('#') || [];
split.map(item => { split.map(item => {
if (item.indexOf('-') !== -1) { if (item.indexOf('-') !== -1) {
let array = item.split('-') || []; let array = item.split('-') || [];
if (array.length > 0 && array[0] === orgCode) { if (array.length > 0 && array[0] === orgCode) {
xianshi = true; xianshi = true;
} }
} else { } else {
if (item === orgCode) { if (item === orgCode) {
xianshi = true; xianshi = true;
} }
} }
}); });
} else { } else {
let arr = code.split('-') || []; let arr = code.split('-') || [];
...@@ -1235,18 +1227,15 @@ class View3D extends Component { ...@@ -1235,18 +1227,15 @@ class View3D extends Component {
} }
} }
return xianshi; return xianshi;
}; };
/** /**
* 加载告警数据 * 加载告警数据
* *
* @memberof View3D * @memberof View3D
*/ */
transferAlarmData = () => { transferAlarmData = () => {
let { alarmData, orgCode } = this.state; let { alarmData, orgCode } = this.state;
//登录人的orgCode //登录人的orgCode
...@@ -1260,7 +1249,8 @@ class View3D extends Component { ...@@ -1260,7 +1249,8 @@ class View3D extends Component {
this.clearAlarms(); this.clearAlarms();
if (!utils.isEmpty(alarmData) && utils.isArray(alarmData)) { if (!utils.isEmpty(alarmData) && utils.isArray(alarmData)) {
alarmData = alarmData.filter(e => { //过滤通道信息 alarmData = alarmData.filter(e => {
//过滤通道信息
return e.pointType !== '4'; return e.pointType !== '4';
}); });
} }
...@@ -1293,7 +1283,6 @@ class View3D extends Component { ...@@ -1293,7 +1283,6 @@ class View3D extends Component {
if (city === 'xian' || city === 'xianyang' || city === '科技处西安' || city === '科技处咸阳') { if (city === 'xian' || city === 'xianyang' || city === '科技处西安' || city === '科技处咸阳') {
if (alarmData && !utils.isEmpty(alarmData) && utils.isArray(alarmData)) { if (alarmData && !utils.isEmpty(alarmData) && utils.isArray(alarmData)) {
//过滤该公司没有权限的设备(有则跑马灯显示,否则不显示) //过滤该公司没有权限的设备(有则跑马灯显示,否则不显示)
let newData = []; let newData = [];
alarmData.map(e => { alarmData.map(e => {
...@@ -1305,20 +1294,31 @@ class View3D extends Component { ...@@ -1305,20 +1294,31 @@ class View3D extends Component {
}); });
newData.forEach(item => { newData.forEach(item => {
const pointAttrs = JSON.parse(item.pointAttrs); const pointAttrs = JSON.parse(item.pointAttrs);
if ((city === 'xian' || city === '科技处西安') && (item.code.startsWith(orgCode) || item.authOrg && item.authOrg.indexOf(orgCode) !== -1) && pointAttrs && pointAttrs !== '' && pointAttrs !== undefined) { if (
if (pointAttrs.storey === '3' || pointAttrs.storey === 'floor_3') {// 三楼数据 (city === 'xian' || city === '科技处西安') &&
(item.code.startsWith(orgCode) || (item.authOrg && item.authOrg.indexOf(orgCode) !== -1)) &&
pointAttrs &&
pointAttrs !== '' &&
pointAttrs !== undefined
) {
if (pointAttrs.storey === '3' || pointAttrs.storey === 'floor_3') {
// 三楼数据
thirdFloorAlarmData.push(item); thirdFloorAlarmData.push(item);
} else if (pointAttrs.storey === '6' || pointAttrs.storey === 'floor_6') {// 六楼数据 } else if (pointAttrs.storey === '6' || pointAttrs.storey === 'floor_6') {
// 六楼数据
sixthFloorAlarmData.push(item); sixthFloorAlarmData.push(item);
} }
} else if ((city === 'xianyang' || city === '科技处咸阳') && (item.code.startsWith(orgCode) || item.authOrg && item.authOrg.indexOf(orgCode) !== -1)) {// 咸阳数据 } else if (
(city === 'xianyang' || city === '科技处咸阳') &&
(item.code.startsWith(orgCode) || (item.authOrg && item.authOrg.indexOf(orgCode) !== -1))
) {
// 咸阳数据
xyFloorAlarmData.push(item); xyFloorAlarmData.push(item);
} }
}); });
} }
} }
// if(city === '科技处西安' || city === '科技处咸阳' ){ // if(city === '科技处西安' || city === '科技处咸阳' ){
// if (alarmData && !utils.isEmpty(alarmData) && utils.isArray(alarmData)) { // if (alarmData && !utils.isEmpty(alarmData) && utils.isArray(alarmData)) {
// alarmData.forEach(item => { // alarmData.forEach(item => {
...@@ -1336,9 +1336,6 @@ class View3D extends Component { ...@@ -1336,9 +1336,6 @@ class View3D extends Component {
// } // }
// } // }
if (this.lensLevel === LENS_LEVEL.ROOT) { if (this.lensLevel === LENS_LEVEL.ROOT) {
// 三楼告警 // 三楼告警
if (thirdFloorAlarmData && thirdFloorAlarmData.length > 0) { if (thirdFloorAlarmData && thirdFloorAlarmData.length > 0) {
...@@ -1388,16 +1385,14 @@ class View3D extends Component { ...@@ -1388,16 +1385,14 @@ class View3D extends Component {
this.setFloorViewEffect(obj, xyFloorAlarmStatus); this.setFloorViewEffect(obj, xyFloorAlarmStatus);
} }
}); });
} else if (this.lensLevel === LENS_LEVEL.SUB) { } else if (this.lensLevel === LENS_LEVEL.SUB) {
let item = { 'type': markerType }; let item = { type: markerType };
this.changeMarkerType(item, false); this.changeMarkerType(item, false);
} else if (this.lensLevel === LENS_LEVEL.SUN && markerType === 'impEquipment') { } else if (this.lensLevel === LENS_LEVEL.SUN && markerType === 'impEquipment') {
let item = { 'type': 'impEquipment' }; let item = { type: 'impEquipment' };
this.changeMarkerType(item, false); this.changeMarkerType(item, false);
} }
} };
/** /**
* 根据城市的orgCode,返回城市名称 * 根据城市的orgCode,返回城市名称
...@@ -1408,9 +1403,9 @@ class View3D extends Component { ...@@ -1408,9 +1403,9 @@ class View3D extends Component {
if (item.dictDataValue === orgCode) { if (item.dictDataValue === orgCode) {
city = item.dictDataKey; city = item.dictDataKey;
} }
}) });
return city; return city;
} };
/** /**
* 根据城市返回字典中配置的组织orgCode * 根据城市返回字典中配置的组织orgCode
...@@ -1423,8 +1418,7 @@ class View3D extends Component { ...@@ -1423,8 +1418,7 @@ class View3D extends Component {
} }
}); });
return orgCode; return orgCode;
} };
/** /**
* 告警信息点击事件 * 告警信息点击事件
...@@ -1450,7 +1444,9 @@ class View3D extends Component { ...@@ -1450,7 +1444,9 @@ class View3D extends Component {
// } // }
_this.focusObject(obj); _this.focusObject(obj);
// 延迟显示告警点 // 延迟显示告警点
setTimeout(() => { _this.renderAlarmMarker(type, item); }, 1100); setTimeout(() => {
_this.renderAlarmMarker(type, item);
}, 1100);
} }
} }
}); });
...@@ -1469,13 +1465,14 @@ class View3D extends Component { ...@@ -1469,13 +1465,14 @@ class View3D extends Component {
// } // }
_this.focusObject(obj); _this.focusObject(obj);
// 延迟显示告警点 // 延迟显示告警点
setTimeout(() => { _this.renderAlarmMarker(type, item); }, 1100); setTimeout(() => {
_this.renderAlarmMarker(type, item);
}, 1100);
} }
} }
}); });
} }
} };
onAlarmClick1 = (pointtype, type, item) => { onAlarmClick1 = (pointtype, type, item) => {
this.clearAlarms(); this.clearAlarms();
...@@ -1490,15 +1487,15 @@ class View3D extends Component { ...@@ -1490,15 +1487,15 @@ class View3D extends Component {
_this.focusObject(obj); _this.focusObject(obj);
// 延迟显示告警点 // 延迟显示告警点
setTimeout(() => { _this.renderAlarmMarker1(pointtype, type, item); }, 1100); setTimeout(() => {
_this.renderAlarmMarker1(pointtype, type, item);
}, 1100);
} }
} }
}); });
} }
if (type === FLOOR.FLOOR_6) { if (type === FLOOR.FLOOR_6) {
_this.objs.forEach(obj => { _this.objs.forEach(obj => {
if (obj.userData && obj.userData.key === FLOOR.FLOOR_6) { if (obj.userData && obj.userData.key === FLOOR.FLOOR_6) {
...@@ -1507,18 +1504,15 @@ class View3D extends Component { ...@@ -1507,18 +1504,15 @@ class View3D extends Component {
_this.focusObject(obj); _this.focusObject(obj);
// 延迟显示告警点 // 延迟显示告警点
setTimeout(() => { _this.renderAlarmMarker1(pointtype, type, item); }, 1100); setTimeout(() => {
_this.renderAlarmMarker1(pointtype, type, item);
}, 1100);
} }
} }
}); });
} }
if (type === FLOOR.XY_FLOOR_3) { if (type === FLOOR.XY_FLOOR_3) {
_this.objs.forEach(obj => { _this.objs.forEach(obj => {
if (obj.userData && obj.userData.key === FLOOR.XY_FLOOR_3) { if (obj.userData && obj.userData.key === FLOOR.XY_FLOOR_3) {
...@@ -1528,20 +1522,21 @@ class View3D extends Component { ...@@ -1528,20 +1522,21 @@ class View3D extends Component {
_this.focusObject(obj); _this.focusObject(obj);
// 延迟显示告警点 // 延迟显示告警点
setTimeout(() => { _this.renderAlarmMarker1(pointtype, type, item); }, 1100); setTimeout(() => {
_this.renderAlarmMarker1(pointtype, type, item);
}, 1100);
} }
} }
}); });
} }
} };
/** /**
* 进入机柜 * 进入机柜
* *
* @memberof View3D * @memberof View3D
*/ */
flyToCabinet = (object) => { flyToCabinet = object => {
const _this = this; const _this = this;
_this.lensLevel = LENS_LEVEL.SUN; _this.lensLevel = LENS_LEVEL.SUN;
object.parent.children.forEach(childrenObj => { object.parent.children.forEach(childrenObj => {
...@@ -1556,10 +1551,7 @@ class View3D extends Component { ...@@ -1556,10 +1551,7 @@ class View3D extends Component {
}); });
} }
}); });
} };
renderAlarmMarker1 = (pointtype, type, item) => { renderAlarmMarker1 = (pointtype, type, item) => {
const { markers } = this.state; const { markers } = this.state;
...@@ -1576,15 +1568,20 @@ class View3D extends Component { ...@@ -1576,15 +1568,20 @@ class View3D extends Component {
alarmPoint.id = item.pointId; alarmPoint.id = item.pointId;
let levelType = ''; let levelType = '';
if (pointType === 3) {//巡检 if (pointType === 3) {
//巡检
levelType = '3'; levelType = '3';
} else if (pointType === 2) {//动环 } else if (pointType === 2) {
//动环
levelType = '01'; levelType = '01';
} else if (pointType === 6) { //火探 } else if (pointType === 6) {
//火探
levelType = '02'; levelType = '02';
} else if (pointType === 1) {//网络设备 } else if (pointType === 1) {
//网络设备
levelType = '01'; levelType = '01';
} else if (pointType === 5) {//虚拟设备(自动巡检设备) } else if (pointType === 5) {
//虚拟设备(自动巡检设备)
levelType = '03'; levelType = '03';
} }
alarmPoint.level = levelType; alarmPoint.level = levelType;
...@@ -1594,7 +1591,7 @@ class View3D extends Component { ...@@ -1594,7 +1591,7 @@ class View3D extends Component {
alarmPoint.title = item.pointName; alarmPoint.title = item.pointName;
alarmPoint.sourceId = item.sourceId; alarmPoint.sourceId = item.sourceId;
alarmPoint.twinkle = pointtype; alarmPoint.twinkle = pointtype;
alarmPoint.type = pointType === 3 ? 'patrol' : ((pointType === 2) || (pointType === 6)) ? 'dynamicRingData' : 'impEquipment'; alarmPoint.type = pointType === 3 ? 'patrol' : pointType === 2 || pointType === 6 ? 'dynamicRingData' : 'impEquipment';
let points = []; let points = [];
points.push(alarmPoint); points.push(alarmPoint);
markers[alarmPoint.type] = points; markers[alarmPoint.type] = points;
...@@ -1607,7 +1604,7 @@ class View3D extends Component { ...@@ -1607,7 +1604,7 @@ class View3D extends Component {
}); });
} }
} }
} };
/** /**
* 生成告警点 * 生成告警点
...@@ -1629,16 +1626,20 @@ class View3D extends Component { ...@@ -1629,16 +1626,20 @@ class View3D extends Component {
alarmPoint.id = item.pointId; alarmPoint.id = item.pointId;
let levelType = ''; let levelType = '';
if (pointType === 3) {//巡检 if (pointType === 3) {
//巡检
levelType = '3'; levelType = '3';
} else if (pointType === 2) {//动环 } else if (pointType === 2) {
//动环
levelType = '01'; levelType = '01';
} else if (pointType === 6) { //火探 } else if (pointType === 6) {
//火探
levelType = '02'; levelType = '02';
} } else if (pointType === 1) {
else if (pointType === 1) {//网络设备 //网络设备
levelType = '01'; levelType = '01';
} else if (pointType === 5) {//虚拟设备(自动巡检设备) } else if (pointType === 5) {
//虚拟设备(自动巡检设备)
levelType = '03'; levelType = '03';
} }
alarmPoint.level = levelType; alarmPoint.level = levelType;
...@@ -1651,13 +1652,12 @@ class View3D extends Component { ...@@ -1651,13 +1652,12 @@ class View3D extends Component {
alarmPoint.levelStr = 'impEqu_04'; alarmPoint.levelStr = 'impEqu_04';
} }
alarmPoint.twinkle = true; alarmPoint.twinkle = true;
alarmPoint.type = pointType === 3 ? 'patrol' : ((pointType === 2) || (pointType === 6)) ? 'dynamicRingData' : 'impEquipment'; alarmPoint.type = pointType === 3 ? 'patrol' : pointType === 2 || pointType === 6 ? 'dynamicRingData' : 'impEquipment';
let points = []; let points = [];
points.push(alarmPoint); points.push(alarmPoint);
markers[alarmPoint.type] = points; markers[alarmPoint.type] = points;
//console.log(markers); //console.log(markers);
if (this.lensLevel === LENS_LEVEL.SUB || this.lensLevel === LENS_LEVEL.SUN) { if (this.lensLevel === LENS_LEVEL.SUB || this.lensLevel === LENS_LEVEL.SUN) {
...@@ -1666,7 +1666,7 @@ class View3D extends Component { ...@@ -1666,7 +1666,7 @@ class View3D extends Component {
}); });
} }
} }
} };
/** /**
* 弹出框关闭事件 * 弹出框关闭事件
...@@ -1678,7 +1678,7 @@ class View3D extends Component { ...@@ -1678,7 +1678,7 @@ class View3D extends Component {
pickDialog: false, pickDialog: false,
pickData: {} pickData: {}
}); });
} };
/** /**
* 渲染控制区 * 渲染控制区
...@@ -1688,19 +1688,21 @@ class View3D extends Component { ...@@ -1688,19 +1688,21 @@ class View3D extends Component {
renderMaskContent = () => { renderMaskContent = () => {
const { showExplain } = this.state; const { showExplain } = this.state;
const { hiddenScreenSaver } = this.props; const { hiddenScreenSaver } = this.props;
return (<MaskContent return (
onItemClick={this.changeMarkerType} <MaskContent
layerConfig={layerConfig} onItemClick={this.changeMarkerType}
showExplain={showExplain} layerConfig={layerConfig}
onExplainClose={this.handleExplainClose} showExplain={showExplain}
hiddenScreenSaver={hiddenScreenSaver} onExplainClose={this.handleExplainClose}
/>); hiddenScreenSaver={hiddenScreenSaver}
} />
);
};
afterRender = () => { afterRender = () => {
this.objAnchorHelper && this.objAnchorHelper.update(); this.objAnchorHelper && this.objAnchorHelper.update();
this.infoHelper && this.infoHelper.update(); this.infoHelper && this.infoHelper.update();
} };
render() { render() {
const { const {
...@@ -1742,7 +1744,7 @@ class View3D extends Component { ...@@ -1742,7 +1744,7 @@ class View3D extends Component {
enableModelParser enableModelParser
disabledEdit disabledEdit
defaultLoading={false} defaultLoading={false}
ref={node => this.a3dRef = node} ref={node => (this.a3dRef = node)}
baseObjs={objs} baseObjs={objs}
options={desigerConf.options} options={desigerConf.options}
maskContent={isAllDone && this.renderMaskContent()} maskContent={isAllDone && this.renderMaskContent()}
...@@ -1753,7 +1755,9 @@ class View3D extends Component { ...@@ -1753,7 +1755,9 @@ class View3D extends Component {
loadingManager={this.loadingManager} loadingManager={this.loadingManager}
customLoading={<LoadingComs percent={percent} tip="正在搭载模型..." />} customLoading={<LoadingComs percent={percent} tip="正在搭载模型..." />}
> >
{startAsyncLoad && <WorkerObjContent objs={asyncModels} onWorkerMessage={this.onWorkerLoading} enableLoading={false} afterInit={this.onAfterWorkerInit} />} {startAsyncLoad && (
<WorkerObjContent objs={asyncModels} onWorkerMessage={this.onWorkerLoading} enableLoading={false} afterInit={this.onAfterWorkerInit} />
)}
<PointsPool markers={markers} orgCode={orgCode} updateMarker={this.updateMarker} /> <PointsPool markers={markers} orgCode={orgCode} updateMarker={this.updateMarker} />
{isAllDone && <PointsAlarm alarms={alarms} onAlarmClick={this.onAlarmClick} visible />} {isAllDone && <PointsAlarm alarms={alarms} onAlarmClick={this.onAlarmClick} visible />}
......
...@@ -861,7 +861,7 @@ class IndexMap extends Component { ...@@ -861,7 +861,7 @@ class IndexMap extends Component {
//过滤告警列表 //过滤告警列表
processingAlarmData = data => { processingAlarmData = data => {
debugger
let { orgCode } = this.state; let { orgCode } = this.state;
if (orgCode !== '') { if (orgCode !== '') {
let dictionaryList = lsTool.read('dictionaryList'); let dictionaryList = lsTool.read('dictionaryList');
......
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