Commit c07698bf authored by 张博's avatar 张博

拖动点不显示等bug

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