Commit 28f1cb4b authored by 张博's avatar 张博

bug

parent 7641b3fe
.action-pane-data{ .action-pane-data {
position: absolute; position: absolute;
bottom: 5%; bottom: 5%;
left: 50%; left: 50%;
...@@ -7,46 +7,46 @@ ...@@ -7,46 +7,46 @@
.action-list { .action-list {
height: 40px; height: 40px;
padding: 0 1rem; padding: 0 1rem;
background-color: rgba(216, 216, 216, 0.24);
border: 1px solid rgba(146, 149, 151, 1);
border-radius: 6px; border-radius: 6px;
background:rgba(216,216,216,0.24);
border:1px solid rgba(146,149,151,1);
.action-item{ .action-item {
float: left; float: left;
width: 40px; width: 40px;
height: 38px; height: 38px;
text-align: center; text-align: center;
cursor: pointer ; cursor: pointer;
border:1px solid rgba(146,149,151,1); border: 1px solid rgba(146, 149, 151, 1);
.action-item-title{ .action-item-title {
color: #e0e0e0;
position: absolute; position: absolute;
top: -20px; top: -20px;
white-space: nowrap;
width: 51px; width: 51px;
-webkit-transform-origin-x: 0; color: #e0e0e0;
-webkit-transform: scale(0.80);
text-align: center; text-align: center;
white-space: nowrap;
-webkit-transform-origin-x: 0;
-webkit-transform: scale(0.8);
} }
.action-item-content{ .action-item-content {
text-align: center;
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
text-align: center;
.action-item-icon{ .action-item-icon {
margin: 8px; position: relative;
width: 21px; width: 21px;
height: 21px; height: 21px;
position: relative; margin: 8px;
} }
} }
} }
.action-active{ .action-active {
background: linear-gradient(180deg,rgba(0,96,154,0.8) 0%,rgba(0,54,105,0.5) 100%); background: linear-gradient(180deg, rgba(0, 96, 154, 0.8) 0%, rgba(0, 54, 105, 0.5) 100%);
} }
} }
} }
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { utils,UUID, deepCopy } from 'amos-tool'; import { UUID, deepCopy } from 'amos-tool';
import { PubSub } from 'ray-eventpool'; import { PubSub } from 'ray-eventpool';
import { Connect as UIConnect, message, AmosAlert,Modal } from 'amos-framework'; import { Connect as UIConnect, message } from 'amos-framework';
import { FatLine } from 'amos-3d/lib/advanced'; import { FatLine } from 'amos-3d/lib/advanced';
import A3DDesigner, { Connect, FireObject,DESIGNER_CONSTS,PolygonRegion } from 'amos-3d/lib/designer'; import A3DDesigner, { Connect, FireObject,DESIGNER_CONSTS,PolygonRegion } from 'amos-3d/lib/designer';
import WorkerObjContent from 'amos-3d/lib/worker/WorkerObjContent'; import WorkerObjContent from 'amos-3d/lib/worker/WorkerObjContent';
...@@ -13,7 +13,7 @@ import MaskContent from './MaskContent'; ...@@ -13,7 +13,7 @@ import MaskContent from './MaskContent';
import { getObjFromNet, initView3DAction, query3DStatistics, pointModelistAction } from '../services/3dService'; import { getObjFromNet, initView3DAction, query3DStatistics, pointModelistAction } from '../services/3dService';
import { desigerConf, desigerHelperConfig } from './conf'; import { desigerConf, desigerHelperConfig } from './conf';
import PointsPool from './PointsPool'; import PointsPool from './PointsPool';
import PromptModal from './PromptModal' import PromptModal from './PromptModal';
import { eventTopics, isControllerEvent, isManualOperate } from './consts'; import { eventTopics, isControllerEvent, isManualOperate } from './consts';
import { executeView3dCMD, parseManual, parseBubbleMarkers, tirggerPlanTopic, tirggerTransTopic } from './dataProcessor'; import { executeView3dCMD, parseManual, parseBubbleMarkers, tirggerPlanTopic, tirggerTransTopic } from './dataProcessor';
import { import {
...@@ -32,7 +32,7 @@ import { ...@@ -32,7 +32,7 @@ import {
flickerTroubleMarkers flickerTroubleMarkers
} from './ruleActionView'; } from './ruleActionView';
import { lineData } from './datas'; import { lineData } from './datas';
import { getAreaTreeAction, getPointTypeAction, getPointTreeAction, getPointListAction,saveAreaDataAction,savePointListAction } from '../services/moduleEditServices'; import { getAreaTreeAction, getPointTypeAction, getPointTreeAction,saveAreaDataAction,savePointListAction } from '../services/moduleEditServices';
import AreaLeftTree from './moduleEditComponent/AreaLeftTree'; import AreaLeftTree from './moduleEditComponent/AreaLeftTree';
import PointLeftTree from './moduleEditComponent/PointLeftTree'; import PointLeftTree from './moduleEditComponent/PointLeftTree';
import RightEditPointPanel from './moduleEditComponent/RightEditPointPanel'; import RightEditPointPanel from './moduleEditComponent/RightEditPointPanel';
...@@ -86,27 +86,27 @@ class View3D extends Component { ...@@ -86,27 +86,27 @@ class View3D extends Component {
fireEquipmentPosition: [], fireEquipmentPosition: [],
contingencyPlanId: '', contingencyPlanId: '',
markers: { markers: {
riskSource:[],//风险点 - riskSource; riskSource: [],//风险点 - riskSource;
patrol:[],//巡检点 - patrol: [],//巡检点 -
impEquipment:[],//重点设备 - impEquipment: [],//重点设备 -
monitorEquipment:[],//探测器 - monitorEquipment: [],//探测器 -
video:[],//摄像头 - video: [],//摄像头 -
fireEquipment:[],//消防设备 - fireEquipment: [],//消防设备 -
person:[], person: [],
pool:[], pool: [],
hydrant:[], hydrant: [],
fireChamber:[], fireChamber: [],
fireCar:[], fireCar: [],
fire:[], fire: [],
fireDetection:[] fireDetection: []
}, },
markerType: null, markerType: null,
planStarted: false, planStarted: false,
alarmStarted: false, alarmStarted: false,
//编辑模式 //编辑模式
drawing: false,//画线状态 drawing: false,//画线状态
selectArea: "",//选中区域 selectArea: '',//选中区域
selectPoints: "",//选中点 selectPoints: '',//选中点
treeData: [],//左树 treeData: [],//左树
pointTypeArr: [], pointTypeArr: [],
routePathData: [], //区域线位置 routePathData: [], //区域线位置
...@@ -120,17 +120,17 @@ class View3D extends Component { ...@@ -120,17 +120,17 @@ class View3D extends Component {
sideControlShow: false, //隐藏耳朵 sideControlShow: false, //隐藏耳朵
isShowActionBar: true, //显示工具栏 isShowActionBar: true, //显示工具栏
errorAreaId: '' ,//异常区域id errorAreaId: '' ,//异常区域id
positionxyz:'', positionxyz: '',
rightHeight:10, rightHeight: 10,
isPointSave:false, isPointSave: false,
isAreaSave:false, isAreaSave: false,
treeDataList:[], treeDataList: [],
promptData:{ promptData: {
promptvisible:false, promptvisible: false,
promptContent:'', promptContent: '',
type:'region', type: 'region',
btnType:'isOk', btnType: 'isOk',
isback:false isback: false
} }
}; };
...@@ -155,7 +155,7 @@ class View3D extends Component { ...@@ -155,7 +155,7 @@ class View3D extends Component {
lineColor: '#878787', // 边框颜色 lineColor: '#878787', // 边框颜色
regionOpacity: 0.4 regionOpacity: 0.4
}, },
select:{ select: {
regionColor: '#FD0400', // 区域颜色 regionColor: '#FD0400', // 区域颜色
lineColor: '#FD0400', // 边框颜色 lineColor: '#FD0400', // 边框颜色
regionOpacity: 0.4 regionOpacity: 0.4
...@@ -268,7 +268,7 @@ class View3D extends Component { ...@@ -268,7 +268,7 @@ class View3D extends Component {
_bindPubSubEvents = () => { _bindPubSubEvents = () => {
this.props.subscribe(eventTopics.base3d_view, (topic, data) => { this.props.subscribe(eventTopics.base3d_view, (topic, data) => {
console.log('subscribe base3d_view') console.log('subscribe base3d_view');
if (isControllerEvent(topic)) { if (isControllerEvent(topic)) {
executeView3dCMD(this, topic, data); executeView3dCMD(this, topic, data);
} else if (isManualOperate(topic)) { } else if (isManualOperate(topic)) {
...@@ -284,8 +284,8 @@ class View3D extends Component { ...@@ -284,8 +284,8 @@ 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;
console.log('消息类型--->' + topic); console.log(`消息类型--->${topic}`);
console.log('data==' + JSON.stringify(data)); console.log(`data==${JSON.stringify(data)}`);
switch (topic) { switch (topic) {
case 'base3d.fromws.mapArea_action1-1': //“极I高端8111换流变A相”所在建筑高亮+报警logo+建筑模型上气泡弹出(极I高端8111换流变A相) case 'base3d.fromws.mapArea_action1-1': //“极I高端8111换流变A相”所在建筑高亮+报警logo+建筑模型上气泡弹出(极I高端8111换流变A相)
// this.equipmentId = data.equipmentId; // this.equipmentId = data.equipmentId;
...@@ -323,7 +323,7 @@ class View3D extends Component { ...@@ -323,7 +323,7 @@ class View3D extends Component {
dealTroubleMarkers(this, data); //处理设备报警:切换图层到探测器、显示报警的探测器(闪烁-报警,不闪烁-报警解除)--已完成 dealTroubleMarkers(this, data); //处理设备报警:切换图层到探测器、显示报警的探测器(闪烁-报警,不闪烁-报警解除)--已完成
break; break;
case 'base3d.fromws.topArea_CONTINGENCY': //消防报警 case 'base3d.fromws.topArea_CONTINGENCY': //消防报警
data["contingencyPlanId"]=this.state.contingencyPlanId; data['contingencyPlanId'] = this.state.contingencyPlanId;
this.props.trigger(eventTopics.top_ae_msg, data); this.props.trigger(eventTopics.top_ae_msg, data);
break; break;
case 'base3d.fromws.recordArea_refresh': //记录区刷新 case 'base3d.fromws.recordArea_refresh': //记录区刷新
...@@ -341,7 +341,7 @@ class View3D extends Component { ...@@ -341,7 +341,7 @@ class View3D extends Component {
break; break;
case 'base3d.fromws.optionArea_': //交互区推数据 case 'base3d.fromws.optionArea_': //交互区推数据
this.props.trigger(eventTopics.optionArea_view, data); this.props.trigger(eventTopics.optionArea_view, data);
this.setState({ contingencyPlanId: data.contingencyPlanId }) this.setState({ contingencyPlanId: data.contingencyPlanId });
break; break;
case eventTopics.map_bubble: case eventTopics.map_bubble:
parseBubbleMarkers(this, content); // 监控屏气泡 parseBubbleMarkers(this, content); // 监控屏气泡
...@@ -467,7 +467,7 @@ class View3D extends Component { ...@@ -467,7 +467,7 @@ class View3D extends Component {
}); });
}; };
onGraphCreated = ({ cameraFactory, sceneFactory, outlineFactory, r3d, stagePilot}) => { onGraphCreated = ({ cameraFactory, sceneFactory, outlineFactory, r3d, stagePilot }) => {
this.cameraFactory = cameraFactory; this.cameraFactory = cameraFactory;
this.sceneFactory = sceneFactory; this.sceneFactory = sceneFactory;
this.outlineFactory = outlineFactory; this.outlineFactory = outlineFactory;
...@@ -560,9 +560,9 @@ class View3D extends Component { ...@@ -560,9 +560,9 @@ class View3D extends Component {
getPointLoop = ({ markers }, pointType, treeData) => { getPointLoop = ({ markers }, pointType, treeData) => {
treeData.forEach( t => { treeData.forEach( t => {
if(t.isRegion && t.children && t.children.length > 0){ if (t.isRegion && t.children && t.children.length > 0){
this.getPointLoop( { markers }, pointType, t.children) this.getPointLoop( { markers }, pointType, t.children);
}else if(t.position3d && !t.isRegion){ } else if (t.position3d && !t.isRegion){
t.position = t.position3d; t.position = t.position3d;
t.key = `${t.type}-${t.id}`; t.key = `${t.type}-${t.id}`;
t.label = t.name; t.label = t.name;
...@@ -574,32 +574,32 @@ class View3D extends Component { ...@@ -574,32 +574,32 @@ class View3D extends Component {
//编辑模式获取点 //编辑模式获取点
getPointList = (pointType,treeData) => { getPointList = (pointType,treeData) => {
this.clearMarkers(); this.clearMarkers();
if(treeData){ if (treeData){
let markers = {}; let markers = {};
markers[pointType] = []; markers[pointType] = [];
this.getPointLoop( { markers }, pointType, treeData); this.getPointLoop( { markers }, pointType, treeData);
this.setState({markers}) this.setState({ markers });
} }
} }
startDrow = (areaItem) => { startDrow = (areaItem) => {
// this.a3dRef.addPen(m); // this.a3dRef.addPen(m);
this.setState({ isAreaSave: true }); this.setState({ isAreaSave: true });
console.log('drow--------') console.log('drow--------');
this.setState({ this.setState({
selectArea:areaItem, selectArea: areaItem,
rightHeight:10, rightHeight: 10,
showRightPanel: true showRightPanel: true
}); });
this.drowItem = areaItem; this.drowItem = areaItem;
this.addPen(areaItem.id) this.addPen(areaItem.id);
} }
addPen(areaKey) { addPen(areaKey) {
let params = { "displayName": "进攻线路", "thumb": "/a3dres/images/pathline/line-attack.png", "descr": "", "objParam": null, "type": "pen" } let params = { 'displayName': '进攻线路', 'thumb': '/a3dres/images/pathline/line-attack.png', 'descr': '', 'objParam': null, 'type': 'pen' };
// console.log(this.state.selectArea) // console.log(this.state.selectArea)
const penProps = { const penProps = {
key: this.genPenId(), key: this.genPenId(),
color: 0x00ff00, color: 0x00ff00,
areaKey: areaKey, areaKey,
...params ...params
}; };
this.a3dRef.newPen(penProps); this.a3dRef.newPen(penProps);
...@@ -635,11 +635,11 @@ class View3D extends Component { ...@@ -635,11 +635,11 @@ class View3D extends Component {
this.state.routePathData.push({ this.state.routePathData.push({
riskSourceId: this.drowItem.id, riskSourceId: this.drowItem.id,
routePath: JSON.stringify({ routePath: JSON.stringify({
routePath:penPoints, routePath: penPoints,
regionHeigth:10 regionHeigth: 10
}),
}) })
});
this.setState({ this.setState({
drawing: false, drawing: false,
routePathData: this.state.routePathData routePathData: this.state.routePathData
...@@ -761,7 +761,7 @@ class View3D extends Component { ...@@ -761,7 +761,7 @@ class View3D extends Component {
points: pen.getFmtPoints() points: pen.getFmtPoints()
}); });
console.log(pen); console.log(pen);
console.log(pen.getFmtPoints()) console.log(pen.getFmtPoints());
this.enableDrawPath = false; this.enableDrawPath = false;
} }
} }
...@@ -784,13 +784,14 @@ class View3D extends Component { ...@@ -784,13 +784,14 @@ class View3D extends Component {
}); });
this.setState({ this.setState({
selectArea, selectArea,
rightHeight:JSON.parse(selectArea.routePath).regionHeigth, rightHeight: JSON.parse(selectArea.routePath).regionHeigth,
showRightPanel: true showRightPanel: true
}); });
} }
//选中点变化 //选中点变化
selectPointChange = (selectPoints) => { selectPointChange = (selectPoints) => {
const { markers, pointType } = this.state; const { markers, pointType } = this.state;
this.stagePilot.positionCtl.clearDrag();
if (selectPoints.isRegion){ if (selectPoints.isRegion){
this.setState({ selectArea: selectPoints, selectPoints }); this.setState({ selectArea: selectPoints, selectPoints });
} else { } else {
...@@ -813,32 +814,32 @@ class View3D extends Component { ...@@ -813,32 +814,32 @@ class View3D extends Component {
if (treeData && treeData.length > 0) { if (treeData && treeData.length > 0) {
treeData.map((item) => { treeData.map((item) => {
if (item.isRegion && item.isBind) { if (item.isRegion && item.isBind) {
if(selectArea && selectArea.id == item.id){ if (selectArea && selectArea.id === item.id){
this.areas.push(<PolygonRegion {...this.areaStyles.select} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item)}} />); this.areas.push(<PolygonRegion {...this.areaStyles.select} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item);}} />);
this.getAreas(item.children); this.getAreas(item.children);
}else{ } else {
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
if (dragItem) { if (dragItem) {
if ( dragItem.parentId && dragItem.parentId == item.id) { if ( dragItem.parentId && dragItem.parentId === item.id) {
this.areas.push(<PolygonRegion {...this.areaStyles.normal} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item)}} />); this.areas.push(<PolygonRegion {...this.areaStyles.normal} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item);}} />);
} else { } else {
this.areas.push(<PolygonRegion {...this.areaStyles.noDrop} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item)}} />); this.areas.push(<PolygonRegion {...this.areaStyles.noDrop} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item);}} />);
} }
{this.getAreas(item.children)} {this.getAreas(item.children);}
} else { } else {
this.areas.push(<PolygonRegion {...this.areaStyles.normal} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item)}} />); this.areas.push(<PolygonRegion {...this.areaStyles.normal} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item);}} />);
{this.getAreas(item.children)} {this.getAreas(item.children);}
} }
} else { } else {
if (dragItem) { if (dragItem) {
if ( dragItem && dragItem.parentId && dragItem.parentId === item.id) { if ( dragItem && dragItem.parentId && dragItem.parentId === item.id) {
this.areas.push(<PolygonRegion {...this.areaStyles.normal} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item)}} />); this.areas.push(<PolygonRegion {...this.areaStyles.normal} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item);}} />);
} else { } else {
this.areas.push(<PolygonRegion {...this.areaStyles.noDrop} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item)}} />); this.areas.push(<PolygonRegion {...this.areaStyles.noDrop} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item);}} />);
} }
} else { } else {
this.areas.push(<PolygonRegion {...this.areaStyles.normal} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item)}} />); this.areas.push(<PolygonRegion {...this.areaStyles.normal} points={item.routePath ? JSON.parse(item.routePath).routePath : ''} onCreated={(e) => {this.onRegionCreated(e,item);}} />);
} }
} }
...@@ -854,7 +855,7 @@ class View3D extends Component { ...@@ -854,7 +855,7 @@ class View3D extends Component {
} }
renderAreas = () => { renderAreas = () => {
this.areas = []; this.areas = [];
console.log(this.state.treeData) console.log(this.state.treeData);
this.getAreas(this.state.treeData); this.getAreas(this.state.treeData);
return this.areas; return this.areas;
} }
...@@ -867,10 +868,10 @@ class View3D extends Component { ...@@ -867,10 +868,10 @@ class View3D extends Component {
message.success('保存成功!'); message.success('保存成功!');
getAreaTreeAction().then(data => { getAreaTreeAction().then(data => {
//console.log(data); //console.log(data);
console.log(JSON.stringify(data)) console.log(JSON.stringify(data));
this.setState({ this.setState({
treeData: data || [], treeData: data || [],
routePathData:[] routePathData: []
}); });
}); });
}, eer => { }, eer => {
...@@ -884,7 +885,7 @@ class View3D extends Component { ...@@ -884,7 +885,7 @@ class View3D extends Component {
//保存区域绑定 //保存区域绑定
saveAreaData = () => { saveAreaData = () => {
let { routePathData } = this.state; let { routePathData } = this.state;
this.setState({isAreaSave: false}); this.setState({ isAreaSave: false });
saveAreaDataAction(routePathData).then(d => { saveAreaDataAction(routePathData).then(d => {
message.success('保存成功!'); message.success('保存成功!');
this.a3dRef.changeDrawState(PEN_STATE.CLEARED);//清除当前路径 this.a3dRef.changeDrawState(PEN_STATE.CLEARED);//清除当前路径
...@@ -894,10 +895,10 @@ class View3D extends Component { ...@@ -894,10 +895,10 @@ class View3D extends Component {
}); });
getAreaTreeAction().then(data => { getAreaTreeAction().then(data => {
//console.log(data); //console.log(data);
console.log(JSON.stringify(data)) console.log(JSON.stringify(data));
this.setState({ this.setState({
treeData: data || [], treeData: data || [],
routePathData:[] routePathData: []
}); });
}); });
}, eer => { }, eer => {
...@@ -908,8 +909,8 @@ class View3D extends Component { ...@@ -908,8 +909,8 @@ class View3D extends Component {
//保存点绑定 //保存点绑定
savePointData = () => { savePointData = () => {
let { markers, pointType, isPointSave} = this.state; let { markers, pointType, isPointSave } = this.state;
this.setState({isPointSave: false}); this.setState({ isPointSave: false });
let paramsArr = []; let paramsArr = [];
paramsArr = markers[pointType].filter(e=> e.isEdit).map(item=>{ paramsArr = markers[pointType].filter(e=> e.isEdit).map(item=>{
return { return {
...@@ -940,7 +941,7 @@ class View3D extends Component { ...@@ -940,7 +941,7 @@ class View3D extends Component {
// 删除点绑定 // 删除点绑定
deletePointBind = () => { deletePointBind = () => {
let { selectPoints ,pointTypeArr,pointType,markers} = this.state; let { selectPoints ,pointType } = this.state;
if (selectPoints && !selectPoints.isRegion) { if (selectPoints && !selectPoints.isRegion) {
let pointParams = []; let pointParams = [];
...@@ -950,24 +951,7 @@ class View3D extends Component { ...@@ -950,24 +951,7 @@ class View3D extends Component {
position3d: `` position3d: ``
}); });
this.savePointAndRefreshMarker(pointType,pointParams); this.savePointAndRefreshMarker(pointType,pointParams);
}else if(selectPoints && selectPoints.isRegion && selectPoints.children){ } else if (selectPoints && selectPoints.isRegion && selectPoints.children){
// AmosAlert.confirm('提示', '是否删除该区域下所有点?', {
// callback: (flag) => {
// if (flag){
// let pointParams = [];
// pointParams = selectPoints.children.filter(e => e.position3d && e.position3d.length > 0).map(item=>{
// return {
// pointId: item.id,
// pointType: item.type,
// position3d: ''
// };
// });
// this.savePointAndRefreshMarker(pointType,pointParams);
// } else {
// }
// }
// });
let pointParams = []; let pointParams = [];
pointParams = selectPoints.children.filter(e => e.position3d && e.position3d.length > 0).map(item=>{ pointParams = selectPoints.children.filter(e => e.position3d && e.position3d.length > 0).map(item=>{
return { return {
...@@ -977,14 +961,14 @@ class View3D extends Component { ...@@ -977,14 +961,14 @@ class View3D extends Component {
}; };
}); });
this.savePointAndRefreshMarker(pointType,pointParams); this.savePointAndRefreshMarker(pointType,pointParams);
this.setState({promptData:{ this.setState({ promptData: {
promptvisible:true, promptvisible: true,
promptContent:'是否删除该区域下所有点?', promptContent: '是否删除该区域下所有点?',
type:'point', type: 'point',
btnType:'isOk', btnType: 'isOk',
isback:false, isback: false
} }
}) });
} }
} }
...@@ -1003,10 +987,10 @@ class View3D extends Component { ...@@ -1003,10 +987,10 @@ class View3D extends Component {
//删除区域 //删除区域
deleteAreaBind = () => { deleteAreaBind = () => {
let { selectArea,treeData } = this.state; let { selectArea } = this.state;
if (selectArea) { if (selectArea) {
getPointsByRegionIdAction(selectArea.id).then(d => { getPointsByRegionIdAction(selectArea.id).then(d => {
if (d && d.length == 0){ if (d && d.length === 0){
this.state.routePathData.push({ this.state.routePathData.push({
riskSourceId: selectArea.id, riskSourceId: selectArea.id,
routePath: '' routePath: ''
...@@ -1018,21 +1002,21 @@ class View3D extends Component { ...@@ -1018,21 +1002,21 @@ class View3D extends Component {
this.setState({ this.setState({
routePathData: this.state.routePathData, routePathData: this.state.routePathData,
//treeData: tree.children, //treeData: tree.children,
selectArea: '', selectArea: ''
}); });
this.setState({promptData:{ this.setState({ promptData: {
promptvisible:true, promptvisible: true,
promptContent:'确定将选中删除?', promptContent: '确定将选中删除?',
type:'region', type: 'region',
btnType:'isOk', btnType: 'isOk',
isback:false isback: false
} }
}) });
} else { } else {
message.danger('请先清除点的绑定再进行删除!'); message.danger('请先清除点的绑定再进行删除!');
} }
}); });
}else{ } else {
message.danger('请先选择已绑定的区域再进行删除!'); message.danger('请先选择已绑定的区域再进行删除!');
} }
} }
...@@ -1040,38 +1024,38 @@ class View3D extends Component { ...@@ -1040,38 +1024,38 @@ class View3D extends Component {
* 处理数据 * 处理数据
*/ */
generateList = data => { generateList = data => {
let {treeDataList } =this.state; let { treeDataList } = this.state;
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
const node = data[i]; const node = data[i];
const key = node.id; const key = node.id;
const title = node.name; const title = node.name;
treeDataList.push({ key, title }); treeDataList.push({ key, title });
if (node.children.length>0) { if (node.children.length > 0) {
this.generateList(node.children); this.generateList(node.children);
} }
} }
this.setState({treeDataList}) this.setState({ treeDataList });
} }
removeTreeDataRoutePathByChildId = ( areaId, obj ) => { removeTreeDataRoutePathByChildId = ( areaId, obj ) => {
let oldSize = obj.children.length; let oldSize = obj.children.length;
let flag = false; let flag = false;
if(oldSize > 0){ if (oldSize > 0){
obj.children && obj.children.some( t => { obj.children && obj.children.some( t => {
if(t.id == areaId){ if (t.id === areaId){
t.routePath = ''; t.routePath = '';
t.isBind = false; t.isBind = false;
flag = true flag = true;
} }
}); });
if(flag){//移除 if (flag){//移除
return; return;
}else{ } else {
obj.children && obj.children.some(t => { obj.children && obj.children.some(t => {
this.removeTreeDataRoutePathByChildId( areaId, t ); this.removeTreeDataRoutePathByChildId( areaId, t );
}); });
} }
}else{ } else {
return; return;
} }
} }
...@@ -1081,7 +1065,12 @@ class View3D extends Component { ...@@ -1081,7 +1065,12 @@ class View3D extends Component {
*/ */
changeAreaPoint = (type) => { changeAreaPoint = (type) => {
let { pointTypeArr } = this.state; let { pointTypeArr } = this.state;
this.setState({ treeDataList: [] }); this.setState( {
treeDataList: [],
dragItem: '',
selectArea: '',
selectPoints: ''
} );
this.stagePilot.positionCtl.clearDrag();//清除已有选中 this.stagePilot.positionCtl.clearDrag();//清除已有选中
if (type === 'region') { if (type === 'region') {
getAreaTreeAction().then(data => { getAreaTreeAction().then(data => {
...@@ -1101,7 +1090,8 @@ class View3D extends Component { ...@@ -1101,7 +1090,8 @@ class View3D extends Component {
pointType: pointTypeArr[0].code || '', pointType: pointTypeArr[0].code || '',
treeData: data || [], treeData: data || [],
pageType: 'point', pageType: 'point',
showRightPanel: false showRightPanel: false ,
selectArea: ''
}); });
}); });
this.enableCamera(); this.enableCamera();
...@@ -1112,9 +1102,13 @@ class View3D extends Component { ...@@ -1112,9 +1102,13 @@ class View3D extends Component {
if (isPointSave){ if (isPointSave){
this.showConfirm(); this.showConfirm();
} }
this.stagePilot.positionCtl.clearDrag();
this.setState({ this.setState({
pointType, pointType,
treeData: [] treeData: [],
selectArea: '',
selectPoints: '',
dragItem: ''
}); });
getPointTreeAction(pointType).then(data => { getPointTreeAction(pointType).then(data => {
//alert(JSON.stringify(data)) //alert(JSON.stringify(data))
...@@ -1126,35 +1120,26 @@ class View3D extends Component { ...@@ -1126,35 +1120,26 @@ class View3D extends Component {
}); });
} }
showConfirm = () => { showConfirm = () => {
// AmosAlert.confirm('提示', '有未保存数据,是否保存?', { this.setState({ promptData:
// callback: (flag) => {
// if (flag){
// this.savePointData();
// } else {
// this.setState({ isPointSave: true });
// }
// }
// });
this.setState({promptData:
{ {
promptvisible:true, promptvisible: true,
promptContent:`有未保存数据,是否保存??`, promptContent: `有未保存数据,是否保存?`,
type:'point', type: 'point',
btnType:'isOk', btnType: 'isOk',
isback:false isback: false
} }
}) });
}; };
dragItemChange = (dragItem) => { dragItemChange = (dragItem) => {
let { treeData } = this.state; this.stagePilot.positionCtl.clearDrag();
if (dragItem.isRegion) { if (dragItem.isRegion) {
//是区域 //是区域
} else { } else {
if (dragItem.isBind) { if (dragItem.isBind) {
//已绑定 //已绑定
} else { } else {
let hasRegion = false; //未绑定
} }
} }
this.setState({ this.setState({
...@@ -1179,7 +1164,7 @@ class View3D extends Component { ...@@ -1179,7 +1164,7 @@ class View3D extends Component {
if (objs.length > 0){ if (objs.length > 0){
position = objs[0].point; position = objs[0].point;
} }
const isInside = this.polygonRegion[dragItem.parentId].pointInPolygon([position.x,position.y,position.z]) const isInside = this.polygonRegion[dragItem.parentId].pointInPolygon([position.x,position.y,position.z]);
console.log(isInside); console.log(isInside);
if (dragItem) { if (dragItem) {
if (isInside === false) { if (isInside === false) {
...@@ -1205,7 +1190,7 @@ class View3D extends Component { ...@@ -1205,7 +1190,7 @@ class View3D extends Component {
id: dragItem.id, id: dragItem.id,
type: dragItem.type type: dragItem.type
}; };
markers[`${type}`] = markers[`${type}`].filter(e => e.id != dragItem.id ); markers[`${type}`] = markers[`${type}`].filter(e => e.id !== dragItem.id );
markers[`${type}`].push(addPointParam); markers[`${type}`].push(addPointParam);
this.setState({ this.setState({
markers: deepCopy(markers), markers: deepCopy(markers),
...@@ -1230,7 +1215,7 @@ class View3D extends Component { ...@@ -1230,7 +1215,7 @@ class View3D extends Component {
this.setState({ isEditMode }); this.setState({ isEditMode });
if (isEditMode === true) { if (isEditMode === true) {
getAreaTreeAction().then(treeData => { getAreaTreeAction().then(treeData => {
this.generateList(treeData) this.generateList(treeData);
this.setState({ this.setState({
treeData: treeData || [] treeData: treeData || []
}); });
...@@ -1446,7 +1431,7 @@ class View3D extends Component { ...@@ -1446,7 +1431,7 @@ class View3D extends Component {
// markers[markerType] = d; // markers[markerType] = d;
this.setState({ this.setState({
markers, markers,
markerType: "impEquipmentMode" markerType: 'impEquipmentMode'
}); });
return; return;
}); });
...@@ -1521,8 +1506,10 @@ class View3D extends Component { ...@@ -1521,8 +1506,10 @@ class View3D extends Component {
headerName: '', //设置头名称 headerName: '', //设置头名称
isEditMode: false, //推出编辑模式 isEditMode: false, //推出编辑模式
errorAreaId: '', errorAreaId: '',
selectArea: "",//选中区域 dragItem: '',
selectPoints: "",//选中点 selectArea: '',
selectPoints: '',
showRightPanel: false
}); });
} }
handleExceptModel =(type,areaId)=>{ handleExceptModel =(type,areaId)=>{
...@@ -1539,30 +1526,30 @@ class View3D extends Component { ...@@ -1539,30 +1526,30 @@ class View3D extends Component {
}); });
} else if (type === 'out_except_model'){ } else if (type === 'out_except_model'){
this.stagePilot.positionCtl.clearDrag(); this.stagePilot.positionCtl.clearDrag();
if(isAreaSave){ if (isAreaSave){
this.setState({promptData: this.setState({ promptData:
{ {
promptvisible:true, promptvisible: true,
promptContent:`要在退出之前保存对风险区域的更改吗?`, promptContent: `要在退出之前保存对风险区域的更改吗?`,
type:'region', type: 'region',
btnType:'isSave', btnType: 'isSave',
isback:true isback: true
} }
}) });
return return;
}else{ } else {
if (isPointSave){ if (isPointSave){
this.setState({promptData: this.setState({ promptData:
{ {
promptvisible:true, promptvisible: true,
promptContent:`要在退出之前保存对风险点的更改吗?`, promptContent: `要在退出之前保存对风险点的更改吗?`,
type:'point', type: 'point',
btnType:'isSave', btnType: 'isSave',
isback:true isback: true
} }
}) });
} else { } else {
this.handleOutExceptModel() this.handleOutExceptModel();
} }
} }
} }
...@@ -1606,10 +1593,10 @@ class View3D extends Component { ...@@ -1606,10 +1593,10 @@ class View3D extends Component {
} }
closePromptModal=()=>{ closePromptModal=()=>{
this.setState({ this.setState({
promptData:{promptvisible:false}, promptData: { promptvisible: false },
isPointSave:false, isPointSave: false,
isAreaSave:false,} isAreaSave: false
) });
} }
render() { render() {
const { const {
...@@ -1629,7 +1616,6 @@ class View3D extends Component { ...@@ -1629,7 +1616,6 @@ class View3D extends Component {
isShowActionBar, isShowActionBar,
headerName, headerName,
errorAreaId, errorAreaId,
positionxyz,
rightHeight, rightHeight,
treeDataList, treeDataList,
promptData promptData
...@@ -1676,7 +1662,8 @@ class View3D extends Component { ...@@ -1676,7 +1662,8 @@ class View3D extends Component {
saveAreaData={this.saveAreaData} saveAreaData={this.saveAreaData}
handleOutExceptModel={this.handleOutExceptModel} handleOutExceptModel={this.handleOutExceptModel}
savePointData={this.savePointData} savePointData={this.savePointData}
closePromptModal={this.closePromptModal}/> closePromptModal={this.closePromptModal}
/>
<div <div
className='designerBox' className='designerBox'
...@@ -1769,10 +1756,10 @@ class View3D extends Component { ...@@ -1769,10 +1756,10 @@ class View3D extends Component {
</div> </div>
<div className='rightBox'> <div className='rightBox'>
{ {
showRightPanel && pageType === 'region' ? <RightEditRegionPanel detailData={selectArea} rightHeight={rightHeight} closeRightPanel={()=>this.setState({showRightPanel:false})} changeRoutePath={this.changeRoutePath} routePathData={this.state.routePathData}/> : '' showRightPanel && pageType === 'region' ? <RightEditRegionPanel detailData={selectArea} rightHeight={rightHeight} closeRightPanel={()=>this.setState({ showRightPanel: false })} changeRoutePath={this.changeRoutePath} routePathData={this.state.routePathData} /> : ''
} }
{ {
showRightPanel && pageType === 'point' ? <RightEditPointPanel detailData={selectPoints} showRightPanel={showRightPanel} closeRightPanel={()=>this.setState({showRightPanel:false})} markers={markers} changeMarkersData={this.changeMarkersData}/> : '' showRightPanel && pageType === 'point' ? <RightEditPointPanel detailData={selectPoints} showRightPanel={showRightPanel} closeRightPanel={()=>this.setState({ showRightPanel: false })} markers={markers} changeMarkersData={this.changeMarkersData} /> : ''
} }
</div> </div>
</div> </div>
......
/* eslint-disable react/prop-types */
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Connect, Modal, Tree,Select,Search,Button } from 'amos-framework'; import { Connect,Tree,Select,Search,Button } from 'amos-framework';
import * as endConf from 'amos-processor/lib/config/endconf';
import { getAreaTreeAction,saveAreaDataAction } from '../../services/moduleEditServices'
const eventConnect = Connect.eventConnect; const eventConnect = Connect.eventConnect;
const TreeNode = Tree.TreeNode; const TreeNode = Tree.TreeNode;
const Option = Select.Option; const Option = Select.Option;
...@@ -33,47 +31,41 @@ class PointLeftTree extends Component { ...@@ -33,47 +31,41 @@ class PointLeftTree extends Component {
autoExpandParent: true, autoExpandParent: true,
checkedKeys: [], checkedKeys: [],
selectedKeys: [], selectedKeys: [],
treeData:[], treeData: [],
pointTypeArr:[], pointTypeArr: [],
pointType:'', pointType: '',
treeDataList : [], treeDataList: [],
searchValue:'' searchValue: ''
}; };
} }
componentDidMount() { componentDidMount() {
let {treeData,pointTypeArr,treeDataList} = this.props; let { treeData,pointTypeArr,treeDataList } = this.props;
this.setState({ this.setState({
treeData, treeData,
treeDataList, treeDataList,
pointTypeArr, pointTypeArr,
pointType: pointTypeArr[0]?pointTypeArr[0].code:'' pointType: pointTypeArr[0] ? pointTypeArr[0].code : ''
}) });
// console.log(this.props)
} }
componentWillUnmount() {
}
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
console.log(nextProps) console.log(nextProps);
let {treeData,pointTypeArr,treeDataList} = nextProps; let { treeData,treeDataList } = nextProps;
this.setState({ this.setState({
treeData, treeData,
treeDataList, treeDataList
//pointTypeArr, });
//pointType: pointTypeArr[0]?pointTypeArr[0].code:''
})
} }
onSelectChange = (value, item) =>{ onSelectChange = (value, item) =>{
console.log(value, item); console.log(value, item);
this.setState({pointType:value}) this.setState({ pointType: value });
this.props.pointTypeChange(value); this.props.pointTypeChange(value);
} }
onSearchChange = e => { onSearchChange = e => {
const {treeDataList,treeData} = this.state const { treeDataList,treeData } = this.state;
const value = e.target.value; const value = e.target.value;
const expandedKeys = treeDataList const expandedKeys = treeDataList
.map(item => { .map(item => {
...@@ -91,9 +83,6 @@ class PointLeftTree extends Component { ...@@ -91,9 +83,6 @@ class PointLeftTree extends Component {
} }
onExpand = (expandedKeys) => { onExpand = (expandedKeys) => {
//console.log('onExpand', arguments);
// if not set autoExpandParent to false, if children expanded, parent can not collapse.
// or, you can remove all expanded children keys.
this.setState({ this.setState({
expandedKeys, expandedKeys,
autoExpandParent: false autoExpandParent: false
...@@ -107,10 +96,11 @@ class PointLeftTree extends Component { ...@@ -107,10 +96,11 @@ class PointLeftTree extends Component {
} }
// eslint-disable-next-line react/sort-comp
renderTreeNodes = (data) => { renderTreeNodes = (data) => {
let {searchValue} =this.state let { searchValue } = this.state;
// console.log(data); // console.log(data);
if (data.length>0) { if (data.length > 0) {
return data.map((item) => { return data.map((item) => {
const index = item.name.indexOf(searchValue); const index = item.name.indexOf(searchValue);
const beforeStr = item.name.substr(0, index); const beforeStr = item.name.substr(0, index);
...@@ -130,32 +120,37 @@ class PointLeftTree extends Component { ...@@ -130,32 +120,37 @@ class PointLeftTree extends Component {
<TreeNode <TreeNode
title={ title={
<div> <div>
{item.isRegion? {item.isRegion ?
<span> <span>
{title} {title}
<span className='icon'> <span className='icon'>
{ {
item.isRegion?item.isBind?<img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/bindedTip.png' />: // eslint-disable-next-line jsx-a11y/alt-text
<img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/nobindTip.png' />: item.isRegion ? item.isBind ? <img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/bindedTip.png' /> :
item.isBind?<img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/bindedTip.png' />: // eslint-disable-next-line jsx-a11y/alt-text
item.position3d?<img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/noSaveTip.png' />: <img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/nobindTip.png' /> :
// eslint-disable-next-line jsx-a11y/alt-text
item.isBind ? <img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/bindedTip.png' /> :
// eslint-disable-next-line jsx-a11y/alt-text
item.position3d ? <img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/noSaveTip.png' /> :
// eslint-disable-next-line jsx-a11y/alt-text
<img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/nobindTip.png' /> <img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/nobindTip.png' />
} }
</span> </span>
</span>: </span> :
<span <span
draggable={true} draggable
onDragStart={() => { onDragStart={() => {
this.props.dragItemChange(item) this.props.dragItemChange(item);
}} }}
> >
{title} {title}
<span className='icon'> <span className='icon'>
{ {
item.isRegion?item.isBind?<img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/bindedTip.png' />: item.isRegion ? item.isBind ? <img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/bindedTip.png' /> :
<img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/nobindTip.png' />: <img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/nobindTip.png' /> :
item.isBind?<img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/bindedTip.png' />: item.isBind ? <img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/bindedTip.png' /> :
item.position3d?<img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/noSaveTip.png' />: item.position3d ? <img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/noSaveTip.png' /> :
<img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/nobindTip.png' /> <img src='/mods/components/3dviewConvertor/assets/convertor/moduleEdit/nobindTip.png' />
} }
</span> </span>
...@@ -165,8 +160,9 @@ class PointLeftTree extends Component { ...@@ -165,8 +160,9 @@ class PointLeftTree extends Component {
key={item.id} key={item.id}
dataRef={item} dataRef={item}
onDragStart={() => { onDragStart={() => {
this.props.dragItemChange(item) this.props.dragItemChange(item);
}}> }}
>
{this.renderTreeNodes(item.children)} {this.renderTreeNodes(item.children)}
</TreeNode> </TreeNode>
); );
...@@ -184,18 +180,17 @@ class PointLeftTree extends Component { ...@@ -184,18 +180,17 @@ class PointLeftTree extends Component {
this.props.selectPointChange(selectItem); this.props.selectPointChange(selectItem);
} }
render() { render() {
let { treeData, checkedPointsKeys,pointTypeArr,pointType } = this.state; let { treeData,pointTypeArr,pointType } = this.state;
let { pageType } = this.props;
return ( return (
<div className="leftTree"> <div className="leftTree">
<div className='leftContainer'> <div className='leftContainer'>
<div className='topForm'> <div className='topForm'>
{(pointType!='') && {(pointType !== '') &&
<Select onChange={this.onSelectChange} defaultValue={pointType} value={pointType} className='leftSelect'> <Select onChange={this.onSelectChange} defaultValue={pointType} value={pointType} className='leftSelect'>
{ {
pointTypeArr.map(item => { pointTypeArr.map((item )=> {
return (<Option className='selectOption' value={item.code} >{item.name}</Option>) return (<Option key={item} className='selectOption' value={item.code} >{item.name}</Option>);
}) })
} }
</Select> </Select>
...@@ -205,14 +200,10 @@ class PointLeftTree extends Component { ...@@ -205,14 +200,10 @@ class PointLeftTree extends Component {
</div> </div>
<div className='treeBox'> <div className='treeBox'>
<Tree <Tree
// checkable selectable
// checkStrictly
selectable={true}
onExpand={this.onExpand} onExpand={this.onExpand}
expandedKeys={this.state.expandedKeys} expandedKeys={this.state.expandedKeys}
autoExpandParent={this.state.autoExpandParent} autoExpandParent={this.state.autoExpandParent}
// onCheck={this.onCheck}
// checkedKeys={checkedPointsKeys}
onSelect={this.onTreeSelect} onSelect={this.onTreeSelect}
selectedKeys={this.state.selectedKeys} selectedKeys={this.state.selectedKeys}
blockNode blockNode
...@@ -224,13 +215,15 @@ class PointLeftTree extends Component { ...@@ -224,13 +215,15 @@ class PointLeftTree extends Component {
<Button <Button
className='sureBtn' className='sureBtn'
onClick={() => { onClick={() => {
this.props.savePointData() this.props.savePointData();
}} ></Button> }}
/>
<Button <Button
className='deleteBtn' className='deleteBtn'
onClick={() => { onClick={() => {
this.props.deletePointBind() this.props.deletePointBind();
}} ></Button> }}
/>
</div> </div>
</div> </div>
......
...@@ -87,7 +87,6 @@ class RightEditRegionPanel extends Component { ...@@ -87,7 +87,6 @@ class RightEditRegionPanel extends Component {
this.form.validate((valid, dataValues, errors) => { this.form.validate((valid, dataValues, errors) => {
console.log('返回内容:', dataValues, valid, errors); console.log('返回内容:', dataValues, valid, errors);
if (valid) { if (valid) {
let routePathData=[ { let routePathData=[ {
riskSourceId: detailData.id, riskSourceId: detailData.id,
routePath: JSON.stringify({ routePath: JSON.stringify({
...@@ -104,8 +103,10 @@ class RightEditRegionPanel extends Component { ...@@ -104,8 +103,10 @@ class RightEditRegionPanel extends Component {
}) })
} }
this.props.changeRoutePath(routePathDataNode); this.props.changeRoutePath(routePathDataNode);
this.props.closeRightPanel()
} else { } else {
console.log('error submit!!'); console.log('error submit!!');
this.props.closeRightPanel()
return false; return false;
} }
}); });
......
...@@ -199,7 +199,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){ ...@@ -199,7 +199,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
} }
buildMarkerOptions = (markers, markerType, defaultParams = {}) => { buildMarkerOptions = (markers, markerType, defaultParams = {}) => {
console.log(markers) console.log(markers);
const { isEditMode } = this.props; const { isEditMode } = this.props;
if (!utils.isEmpty(markers)){ if (!utils.isEmpty(markers)){
markers.forEach(m => { markers.forEach(m => {
...@@ -209,17 +209,17 @@ export default function marker3DFactory(WrappedComponent = 'div', options){ ...@@ -209,17 +209,17 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
position = Object.values(m.position); position = Object.values(m.position);
} }
for (let k of Object.keys(defaultParams)) { for (let k of Object.keys(defaultParams)) {
if((markerType === 'riskSource' || markerType === 'patrol' ) && k != 'useModel' && !isEditMode){ if ((markerType === 'riskSource' || markerType === 'patrol' ) && k !== 'useModel' && !isEditMode){
m[k] = formatUrl(defaultParams[k], { url: `${markerType}-${m.level}` }); m[k] = formatUrl(defaultParams[k], { url: `${markerType}-${m.level}` });
}else if((markerType === 'riskSource' || markerType === 'patrol' ) && k != 'useModel' && isEditMode){ } else if ((markerType === 'riskSource' || markerType === 'patrol' ) && k !== 'useModel' && isEditMode){
if(markerType === 'riskSource'){ if (markerType === 'riskSource'){
m[k] = formatUrl(defaultParams[k], { url: `${markerType}-4` }); m[k] = formatUrl(defaultParams[k], { url: `${markerType}-4` });
}else{ } else {
m[k] = formatUrl(defaultParams[k], { url: `${markerType}-1` }); m[k] = formatUrl(defaultParams[k], { url: `${markerType}-1` });
} }
}else if(markerType === 'fireResource' && k != 'useModel' && isEditMode && urlMapper[m.type]){ } else if (markerType === 'fireResource' && k !== 'useModel' && isEditMode && urlMapper[m.type]){
m[k] = formatUrl(defaultParams[k], { url: `${urlMapper[m.type].file}`}); m[k] = formatUrl(defaultParams[k], { url: `${urlMapper[m.type].file}` });
}else{ } else {
m[k] = defaultParams[k]; m[k] = defaultParams[k];
} }
} }
...@@ -236,7 +236,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){ ...@@ -236,7 +236,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
}; };
render() { render() {
const { markers,isEditMode, ...rest } = this.props; const { markers, isEditMode , ...rest } = this.props;
const { planStarted } = this.state; const { planStarted } = this.state;
let dialogStyle = { zIndex: 1000 }; let dialogStyle = { zIndex: 1000 };
......
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