Commit c07698bf authored by 张博's avatar 张博

拖动点不显示等bug

parent 0cd8530b
......@@ -11,10 +11,10 @@
objModelURI: '/a3dres',
// 根url
// baseURI: 'http://172.16.11.30:9008/',
baseURI: 'http://172.16.3.122:8083/',
baseURI: 'http://172.16.3.63:8083/',
// convertorURI: 'http://172.16.3.122:8083/',
convertorURI: 'http://172.16.3.122:8083/',
patrolURI: 'http://172.16.3.122:8082/',
convertorURI: 'http://172.16.3.63:8083/',
patrolURI: 'http://172.16.3.63:8082/',
rulesConfigURI: 'http://172.16.10.91:8080/',
// plugin URI
pluginURI: 'http://172.16.11.40:8099/',
......
......@@ -58,40 +58,7 @@ class PointsPool extends Component {
}
onMarkersCreated = (type, { markersCache }) => {
this.markerList[type] = markersCache;
let stagePilot = this.props.stagePilot;
debugger;
// if(markersCache&&stagePilot) {
// // console.log(this.markerList)
// console.log(markersCache)
// // console.log(this.props)
// markersCache.eachValue(item => {
// item.node._userData = { ...item.extData };
// stagePilot.positionCtl.objects.push(item.node); })
// }
(markersCache || []).forEach(mc => {
const extData = mc.getExtData();
if (extData.hasOwnProperty('visible')){
let visible = extData.visible;
if (visible) {
if (extData.type === 'fireCar') {
mc.visible = visible;
mc.object2DPipe.pipeNode.visible = false;
mc.object2DPipe.pipeNode.elementVisible = false;
} else {
mc.show();
}
} else {
if (extData.type === 'fireCar') {
mc.visible = visible;
mc.object2DPipe.pipeNode.visible = false;
mc.object2DPipe.pipeNode.elementVisible = false;
} else {
mc.hide();
}
}
}
});
}
updateMarkers = (data) => {
......@@ -114,8 +81,8 @@ class PointsPool extends Component {
onCreated={(val) => this.onMarkersCreated('riskSource', val)}
isEditMode={this.props.isEditMode}
addMarker={this.addMarker}
stagePilot={this.props.stagePilot}
positionCtl={this.props.positionCtl}
editFlag={this.props.editFlag}
selectPoints={this.props.selectPoints}
/>
{/* <PatrolPoint
{...rest}
......
......@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { utils,UUID } from 'amos-tool';
import { PubSub } from 'ray-eventpool';
import { Connect as UIConnect, Modal,message } from 'amos-framework';
import { Connect as UIConnect, Modal,message,AmosAlert } 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';
......@@ -121,8 +121,9 @@ class View3D extends Component {
sideControlShow: false, //隐藏耳朵
isShowActionBar: true, //显示工具栏
errorAreaId: '' ,//异常区域id
positionxyz:null,
positionxyz:'',
rightHeight:1,
isPointSave:true,
};
getObjFromNet(view3dFile, (objs, asyncModels) => {
......@@ -556,8 +557,13 @@ class View3D extends Component {
})
}
startDrow = (areaItem) => {
// this.a3dRef.addPen();
// this.a3dRef.addPen(m);
console.log('drow--------')
this.setState({
selectArea:areaItem,
rightHeight:10,
showRightPanel: true
});
this.drowItem = areaItem;
this.addPen(areaItem.id)
}
......@@ -604,7 +610,7 @@ class View3D extends Component {
riskSourceId: this.drowItem.id,
routePath: JSON.stringify({
routePath:penPoints,
regionHeigth:1
regionHeigth:10
}),
})
......@@ -758,14 +764,16 @@ class View3D extends Component {
}
//选中点变化
selectPointChange = (selectPoints) => {
if(selectPoints.isRegion){
this.setState({selectArea:selectPoints})
}else{
this.dragItemChange(selectPoints)
this.setState({
selectArea:'',
selectPoints,
positionxyz:selectPoints.position3d && selectPoints.position3d.split(","),
showRightPanel: true
showRightPanel: true,
});
}
......@@ -780,6 +788,7 @@ class View3D extends Component {
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)}} />);
this.getAreas(item.children);
}else{
if (item.children && item.children.length > 0) {
if (dragItem) {
......@@ -818,6 +827,7 @@ class View3D extends Component {
}
renderAreas = () => {
this.areas = [];
console.log(this.state.treeData)
this.getAreas(this.state.treeData);
return this.areas;
}
......@@ -865,7 +875,8 @@ class View3D extends Component {
//保存点绑定
savePointData = () => {
let { markers ,pointTypeArr,pointType} = this.state;
let { markers ,pointTypeArr,pointType,isPointSave} = this.state;
this.setState({isPointSave:true})
console.log(markers)
let paramsArr = [];
for ( let key in markers ){
......@@ -946,6 +957,7 @@ class View3D extends Component {
saveAreaDataAction(areaParams).then(d => {
message.success('删除成功!');
getAreaTreeAction().then(data => {
this.getAreas(data);
this.setState({
treeData: data || []
});
......@@ -982,6 +994,10 @@ class View3D extends Component {
}
}
pointTypeChange = (pointType) => {
let {isPointSave} =this.state
if(!isPointSave){
this.showConfirm()
}
this.setState({
pointType,
treeData:[]
......@@ -993,7 +1009,18 @@ class View3D extends Component {
});
});
}
showConfirm = () => {
AmosAlert.confirm('提示', '有未保存数据,是否保存?', {
callback: (flag) => {
if(flag){
this.savePointData()
} else {
this.setState({isPointSave:true})
}
}
});
};
dragItemChange = (dragItem) => {
let { treeData } = this.state;
if (dragItem.isRegion) {
......@@ -1012,6 +1039,7 @@ class View3D extends Component {
drop = (event) => {
event.preventDefault();
this.setState({isPointSave:false})
let { dragItem,markers } = this.state;
//alert(JSON.stringify(dragItem));
if (dragItem) {
......@@ -1349,6 +1377,7 @@ class View3D extends Component {
}
handleExceptModel =(type,areaId)=>{
let {isPointSave}=this.state
this.clearMarkers();
if (type === 'into_except_model'){//进入耳朵模式
this.props.editModelChange(true);//隐藏全景统计
......@@ -1360,8 +1389,39 @@ class View3D extends Component {
errorAreaId: areaId
});
} else if (type === 'out_except_model'){
this.props.editModelChange(false);//显示全景统计
this.setState({
if(!isPointSave){
AmosAlert.confirm('提示', '有未保存数据,是否保存?', {
callback: (flag) => {
if(flag){
this.savePointData()
this.props.editModelChange(false);//显示全景统计
this.setState({
treeData:[],
sideControlShow: false, //隐藏耳朵
isShowActionBar: true, //显示工具栏
startLoadExceptionArea: true, //显示marker,
headerName: '', //设置头名称
editFlag: false, //推出编辑模式
errorAreaId: ''
});
} else {
this.props.editModelChange(false);//显示全景统计
this.setState({
isPointSave:true,
treeData:[],
sideControlShow: false, //隐藏耳朵
isShowActionBar: true, //显示工具栏
startLoadExceptionArea: true, //显示marker,
headerName: '', //设置头名称
editFlag: false, //推出编辑模式
errorAreaId: ''
});
}
}
});
}else{
this.props.editModelChange(false);//显示全景统计
this.setState({
treeData:[],
sideControlShow: false, //隐藏耳朵
isShowActionBar: true, //显示工具栏
......@@ -1370,6 +1430,8 @@ class View3D extends Component {
editFlag: false, //推出编辑模式
errorAreaId: ''
});
}
}
}
......@@ -1390,24 +1452,35 @@ class View3D extends Component {
return object;
}
addMarker=({extData,position})=>{
let {markers} =this.state
const {markers} =this.state
// let type =extData.type
// let arr =markers[`${extData.type}`].filter(item =>item.id == extData.id)
// let arrLasting =markers[`${extData.type}`].filter(item =>item.id != extData.id)
// let addPointParam = {
// type: arr[0].type,
// position:position,
// uid:arr[0].uid,
// id: arr[0].id,
// key: arr[0].key,
// title: arr[0].name,
// label: arr[0].name,
// level: arr[0].level,
// levelStr: arr[0].levelStr,
// };
// let pointParam =arrLasting.push(addPointParam)
// //markers[`${extData.type}`].push(pointParam)
let paramsArr = [{
pointId: extData.id,
pointType: extData.type,
position3d: `${position.toArray()[0]},${position.toArray()[1]},${position.toArray()[2]}`
position3d: `${position[0]},${position[1]},${position[2]}`
}];
console.log(paramsArr)
savePointListAction(paramsArr).then(data => {
getPointTreeAction(extData.type).then(data => {
this.setState({
treeData: data || [],
pageType: 'point',
showRightPanel: false
});
});
})
this.setState({positionxyz:position.toArray()})
//this.setState({positionxyz:position})
}
render() {
const {
......@@ -1428,7 +1501,7 @@ class View3D extends Component {
headerName,
errorAreaId,
positionxyz,
rightHeight
rightHeight,
} = this.state;
const { dimension, hiddenScreenSaver, editModelChange } = this.props;
const graphicProps = {
......@@ -1513,7 +1586,8 @@ class View3D extends Component {
onCreated={this.onGraphCreated}
>
{startAsyncLoad && <WorkerObjContent objs={asyncModels} onWorkerMessage={this.onWorkerLoading} enableLoading afterInit={this.onAfterWorkerInit} />}
{editFlag && pageType === 'region' ? '' : <PointsPool markers={markers} updateMarker={this.updateMarker} planStarted={alarmStarted} stagePilot={this.stagePilot} positionCtl={this.positionCtl} addMarker={this.addMarker}/>}
{editFlag && pageType === 'region' ? '' :
<PointsPool markers={markers} editFlag={editFlag} selectPoints={selectPoints} updateMarker={this.updateMarker} planStarted={alarmStarted} stagePilot={this.stagePilot} positionCtl={this.positionCtl} addMarker={this.addMarker}/>}
{fireTruckRoute && <FatLine {...lineData.fatLineConf} linePath={JSON.parse(fireTruckRoute)} visible={showFireTruckRoute} />}
<FlameFire position={firePosition} width={10} height={20} depth={8} sliceSpacing={1} visible={planStarted} />
{editFlag && this.renderAreas()}
......
......@@ -190,7 +190,7 @@ class AreaLeftTree extends Component {
<div className="leftTree">
<div className='leftContainer'>
<div className='topForm'>
<Search className='leftSearch' icon="search" value={''} onChange={this.onSearchChange} onIconClick={this.onSearchChange} />
<Search className='leftSearch' icon="search" onChange={this.onSearchChange} onIconClick={this.onSearchChange} />
</div>
<div className='treeBox'>
<Tree
......
......@@ -174,7 +174,7 @@ class RightEditRegionPanel extends Component {
</div> */}
<div className='positionItem'>
<FormItem label="高" field="positionZ" {...formItemLayout}>
<Input value={rightHeight} onChange={(e) => this.onChange('positionZ', e)}/>
<Input placeholder={rightHeight} onChange={(e) => this.onChange('positionZ', e)}/>
{/* <Input value={detailData.ue4Location && detailData.ue4Location[2]} /> */}
</FormItem>
</div>
......
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { utils } from 'amos-tool';
import { utils, deepCopy} from 'amos-tool';
import { Markers } from 'amos-3d/lib/designer';
import { BaseObjHelper } from 'base-r3d/lib/factory';
import { CONSTS } from './../../consts/storageConsts';
......@@ -99,15 +99,22 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
}
componentWillReceiveProps = nextProps => {
// if(nextProps.editFlag){
// this.markersCache.eachValue(obj=>{
// if(nextProps.selectPoints.type == obj.extData.type && nextProps.selectPoints.id ==obj.extData.id ){
// this.setTwinkleConf(obj);
// }
// });
// }
this.setState({ planStarted: nextProps.planStarted });
}
onEditorChangeDone = (evt) => {
if (evt && evt.target && evt.target.object){
const marker = evt.target.object;
//alert(marker.position.toArray());//(marker.extData
this.props.addMarker(marker)
}
}
// onEditorChangeDone = (evt) => {
// if (evt && evt.target && evt.target.object){
// const marker = evt.target.object;
// //alert(marker.position.toArray());//(marker.extData
// this.props.addMarker(marker)
// }
// }
componentWillUnmount() {
this.objAnchorHelper && this.objAnchorHelper.destroy();
}
......@@ -128,6 +135,9 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
onMarkerClick = (marker, e) => {
const { isClick } = this.state;
if(this.props.editFlag){
return false
}
if (this.props.isEditMode) {
return false
}
......@@ -146,21 +156,21 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
that.setState({ isClick: true }); // 将isClick设置为true
}, 1000);
}
markerDragend = (marker, evt) => {
if (marker){
console.log(marker.position);
console.log(marker.extData);
this.props.addMarker(marker)
}
}
markerCreated = ({ markersCache }) => {
let {editFlag,selectKey} =this.props
this.markersCache = markersCache;
this.props.positionCtl && this.props.positionCtl.addListener('changeDone', this.onEditorChangeDone);
// 拖拽过程即刻改变line
this.props.positionCtl &&this.props.positionCtl.addListener('objectChange', this.onEditorChange);
// 绑定 positionCtl
this.props.positionCtl && this.markersCache.eachValue(item => {
this.props.positionCtl.addObjects(item.node);
});
this.stagePilot = this.props.stagePilot;
this.outlineHelper = this.stagePilot ? this.stagePilot.outlineHelper : undefined;
//this.outlineHelper = this.stagePilot ? this.stagePilot.outlineHelper : undefined;
markersCache.eachValue(obj=>{
this.setTopCardConf(obj, obj.extData);
if(obj.extData.type === "riskSource" && markerType != 'impEquipmentMode'){
if(obj.extData.type === "riskSource" && markerType != 'impEquipmentMode' && !editFlag){
this.setTwinkleConf(obj);
}
});
......@@ -215,13 +225,18 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
const { markers, ...rest } = this.props;
const { planStarted } = this.state;
let dialogStyle = { zIndex: 1000 };
const events = {
dragend: this.markerDragend,
};
const result = buildMarkerOptions(markers, markerType, markerParams);
return (
<WrappedComponent>
<Markers
{...rest}
markers={result}
events={this.markerEvents}
draggable
markers={deepCopy(result)}
//events={this.markerEvents}
events={events}
onCreated={this.markerCreated}
/>
{ !planStarted && <PointDialog style={dialogStyle} ref={node => this.pdRef = node} />}
......
......@@ -106,7 +106,7 @@ export default function markerFactory(WrappedComponent = 'div', options){
<WrappedComponent>
<Markers
{...this.props}
markers={deepCopy(markers)}
markers={markers}
events={this.markerEvents}
render={this.renderMarker}
onCreated={this.markerCreated}
......
This diff is collapsed.
This diff is collapsed.
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