Commit b9b7506e authored by suhuiguang's avatar suhuiguang

1.修改

parent 16ff3558
......@@ -59,16 +59,6 @@ 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')){
......
......@@ -780,18 +780,22 @@ class View3D extends Component {
}
//选中点变化
selectPointChange = (selectPoints) => {
if(selectPoints.isRegion){
this.setState({selectArea:selectPoints})
}else{
this.dragItemChange(selectPoints)
const { markers, pointType } = this.state;
if (selectPoints.isRegion){
this.setState({ selectArea: selectPoints });
} else {
this.dragItemChange(selectPoints);
markers[pointType].map(e => {
if (e.id === selectPoints.id){
selectPoints.position = e.position;
}
});
this.setState({
selectArea:'',
selectArea: '',
selectPoints,
showRightPanel: true,
selectPoints
showRightPanel: true
});
}
}
getAreas = (treeData) => {
......@@ -1259,29 +1263,22 @@ class View3D extends Component {
});
};
/**
* 更新 markers data
* 批量更新
* @params {Object} markersData {markerType<String>: markers<Array>}
*/
changeMarkersData = markersData => {
if (!utils.isEmpty(markersData)) {
const { markers } = this.state;
const newMarkers = Object.assign({}, markers, markersData);
this.setState({
markers: newMarkers
changeMarkersData = (position,type,id) => {
const me = this;
const { markers, selectPoints } = me.state;
const index = markers[type].findIndex(e=>e.id === id);
if (index >= 0){
markers[type][index].position = position;
markers[type][index].isEdit = true;
selectPoints.position = position;
me.setState({
markers,
selectPoints
});
}
};
createInfowindow = text => {
const div = document.createElement('div');
div.style.position = 'absolute';
div.className = 'three-ui-infowindow';
div.innerText = text;
return div;
};
afterRender = () => {
// this.infoHelper && this.infoHelper.update();
};
......@@ -1670,7 +1667,7 @@ class View3D extends Component {
>
{startAsyncLoad && <WorkerObjContent objs={asyncModels} onWorkerMessage={this.onWorkerLoading} enableLoading afterInit={this.onAfterWorkerInit} />}
{isEditMode && pageType === 'region' ? '' :
<PointsPool markers={markers} isEditMode={isEditMode} selectPoints={selectPoints} updateMarker={this.updateMarker} planStarted={alarmStarted} stagePilot={this.stagePilot} positionCtl={this.positionCtl} addMarker={this.addMarker}/>}
<PointsPool markers={markers} isEditMode={isEditMode} selectPoints={selectPoints} updateMarker={this.updateMarker} planStarted={alarmStarted} stagePilot={this.stagePilot} positionCtl={this.positionCtl} addMarker={this.addMarker} ref={node => this.pointsPool = node} />}
{fireTruckRoute && <FatLine {...lineData.fatLineConf} linePath={JSON.parse(fireTruckRoute)} visible={showFireTruckRoute} />}
<FlameFire position={firePosition} width={10} height={20} depth={8} sliceSpacing={1} visible={planStarted} />
{isEditMode && this.renderAreas()}
......
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Connect, Modal, Tree, Select, Search, Button, Input,InputNumber, Form, Radio } from 'amos-framework';
import * as endConf from 'amos-processor/lib/config/endconf';
import { getAreaTreeAction,saveAreaDataAction,getPointTreeDetailAction } from '../../services/moduleEditServices'
import { Connect, Button, Input, Form, Radio } from 'amos-framework';
import { getPointTreeDetailAction } from '../../services/moduleEditServices';
const eventConnect = Connect.eventConnect;
const TreeNode = Tree.TreeNode;
const Option = Select.Option;
const FormItem = Form.Item;
const RadioGroup = Radio.Group;
......@@ -15,7 +12,6 @@ const RadioGroup = Radio.Group;
class RightEditPointPanel extends Component {
constructor(props) {
super(props);
this.state = {
form: {},
rules: {},
......@@ -23,56 +19,36 @@ class RightEditPointPanel extends Component {
positionxyz: [],
positionX: '',
positionY: '',
positionZ: '',
positionZ: ''
};
}
componentDidMount() {
let { detailData, markers }=this.props
getPointTreeDetailAction(detailData.id,detailData.type).then(data => {
console.log(data);
// this.mreageDetailData( data,markers );
const { detailData } = this.props;
getPointTreeDetailAction(detailData.id, detailData.type).then(data => {
this.setState({
detailData: data || [],
positionX: detailData.position.length > 0 ? detailData.position[0] : '',
positionY: detailData.position.length > 1 ? detailData.position[1] : '',
positionZ: detailData.position.length > 2 ? detailData.position[2] : ''
});
});
}
componentWillUnmount() {
}
componentWillReceiveProps(nextProps) {
let { detailData, markers, showRightPanel } = nextProps;
console.log('componentWillReceivePropscomponentWillReceiveProps');
// positionxyz && this.setState({ positionxyz, positionX: positionxyz[0], positionY: positionxyz[1], positionZ: positionxyz[2] });
getPointTreeDetailAction(detailData.id,detailData.type).then(data => {
if(detailData.position){
const { detailData } = nextProps;
getPointTreeDetailAction(detailData.id, detailData.type).then(data => {
if (detailData.position){
data.position = detailData.position;
}else if(!data.position){
const curTypeMaker = markers[data.type];
for (let i = 0; i < curTypeMaker.length; i++) {
if(data.id == curTypeMaker[i].id){
data.position = curTypeMaker[i].position;
}
}
}
this.setState({detailData: data,positionX: data.position[0], positionY: data.position[1], positionZ: data.position[2]});
this.setState({
detailData: data,
positionX: detailData.position.length > 0 ? detailData.position[0] : '',
positionY: detailData.position.length > 1 ? detailData.position[1] : '',
positionZ: detailData.position.length > 2 ? detailData.position[2] : ''
});
});
}
mreageDetailData = (detailData,markers) => {
const curTypeMaker = markers[detailData.type];
for (let i = 0; i < curTypeMaker.length; i++) {
if(detailData.id == curTypeMaker[i].id){
const position = curTypeMaker[i].position;
// detailData.position3d =
position && this.setState({ positionX: position[0], positionY: position[1], positionZ: position[2] });
}
}
this.setState({detailData});
}
onChange = (key, e) => {
......@@ -82,6 +58,7 @@ class RightEditPointPanel extends Component {
form: newForm
});
}
onRadioChange = (value) => {
const newForm = Object.assign({}, this.state.form, { 'isIndoor': value });
this.setState({
......@@ -96,53 +73,27 @@ class RightEditPointPanel extends Component {
});
}
handleSubmit = (e) => {
// e.preventDefault();
this.form.validate((valid, dataValues, errors) => {
console.log('返回内容:', dataValues, valid, errors);
if (valid) {
// AmosAlert.success('结果', JSON.stringify(dataValues));
} else {
console.log('error submit!!');
return false;
}
});
}
onChangePosition = ( inputType , value ) => {
let { positionX, positionY, positionZ } = this.state;
if(inputType === 'positionX'){
this.state.positionX = Number(value);
}else if(inputType === 'positionY'){
this.state.positionY = Number(value);
}else{
this.state.positionZ = Number(value);
if (inputType === 'positionX'){
positionX = value;
} else if (inputType === 'positionY'){
positionY = value;
} else {
positionZ = value;
}
let position = [positionX,positionY,positionZ];
const position = [positionX,positionY,positionZ];
this.mreageMarkerPosition(position);
}
mreageMarkerPosition = ( position ) => {
let { markers } = this.props;
const { detailData } = this.state;
const curTypeMaker = markers[detailData.type] || [];
for (let index = 0; index < curTypeMaker.length; index++) {
const marker = curTypeMaker[index];
if(marker.id === detailData.id){
marker.position = position;
marker.isChange = true;
this.props.changeMarkersData(markers);
}
}
this.props.changeMarkersData(position,detailData.type,detailData.id);
}
render() {
let { rules,form,pointTypeArr,pointType ,detailData,positionxyz,positionX,positionY,positionZ } = this.state;
let { pageType } = this.props;
let radio = detailData.isIndoor ? "prop1":"prop2"
let position = (detailData.position3d) && detailData.position3d.split(",")
let { rules,form,detailData } = this.state;
let radio = detailData.isIndoor ? 'prop1' : 'prop2';
const formItemLayout = {
labelCol: {
xs: { span: 28 },
......@@ -170,7 +121,6 @@ class RightEditPointPanel extends Component {
<FormItem field="name" >
<Input value={detailData.name} disabled/>
</FormItem>
</div>
<div className='msgItem'>
<div className='itemLabel'>参考编号</div>
......@@ -186,14 +136,7 @@ class RightEditPointPanel extends Component {
<div className='msgItem'>
<div className='itemLabel'>风险等级</div>
<FormItem field="level" >
{/* <Select value={form.level} onChange={this.onHobbyChange}>
<Option value="1">一级</Option>
<Option value="2">二级</Option>
<Option value="3">三级</Option>
<Option value="4">四级</Option>
<Option value="5">五级</Option>
</Select> */}
<Input value={detailData.level} disabled/>
<Input value={detailData.level} disabled />
</FormItem>
</div>
......@@ -237,7 +180,7 @@ class RightEditPointPanel extends Component {
<div className='msgItem'>
<div className='itemLabel'>楼层位置</div>
<FormItem field="floorNum" >
<Input value={detailData.floor3d} disabled/>
<Input value={detailData.floor3d} disabled />
</FormItem>
</div>
......@@ -260,7 +203,7 @@ class RightEditPointPanel extends Component {
<Button
className='sureBtn'
onClick={() => {
this.handleSubmit()
this.props.closeRightPanel()
}} ></Button>
<Button
className='cancelBtn'
......@@ -276,8 +219,9 @@ class RightEditPointPanel extends Component {
}
RightEditPointPanel.propTypes = {
subscribe: PropTypes.func,
trigger: PropTypes.func
closeRightPanel: PropTypes.func,
detailData: PropTypes.object,
changeMarkersData: PropTypes.func
};
export default RightEditPointPanel;
......@@ -134,7 +134,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
}
}
markerCreated = ({ markersCache }) => {
let {isEditMode,selectKey} =this.props
let { isEditMode,selectKey } =this.props;
this.markersCache = markersCache;
this.stagePilot = this.props.stagePilot;
this.outlineHelper = this.stagePilot ? this.stagePilot.outlineHelper : undefined;
......
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