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

bug

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