Commit c1b39834 authored by 单奇雲's avatar 单奇雲

区域交互修改

parent 8ec1bf36
......@@ -114,7 +114,6 @@ class PointsPool extends Component {
onCreated={(val) => this.onMarkersCreated('riskSource', val)}
isEditMode={this.props.isEditMode}
addMarker={this.addMarker}
editFlag={this.props.editFlag}
selectPoints={this.props.selectPoints}
/>
{/* <PatrolPoint
......
......@@ -40,7 +40,7 @@ class AreaLeftTree extends Component {
}
componentWillReceiveProps(nextProps) {
console.log(nextProps)
console.log(nextProps,'nextProps')
let {treeData,pointTypeArr} = nextProps;
this.setState({
treeData,
......
......@@ -45,14 +45,14 @@ class PointLeftTree extends Component {
let {treeData,pointTypeArr} = nextProps;
this.setState({
treeData,
pointTypeArr,
pointType: pointTypeArr[0]?pointTypeArr[0].code:''
// pointTypeArr,
// pointType: pointTypeArr[0]?pointTypeArr[0].code:''
})
}
onSelectChange = (value, item) =>{
console.log(value, item);
this.state.pointType = value;
this.setState({pointType:value})
this.props.pointTypeChange(value);
}
onSearchChange = (e, value) => {
......@@ -194,7 +194,7 @@ class PointLeftTree extends Component {
<div className="leftTree">
<div className='leftContainer'>
<div className='topForm'>
<Select onChange={this.onSelectChange} defaultValue={pointType} className='leftSelect'>
<Select onChange={this.onSelectChange} defaultValue={pointType} value={pointType} className='leftSelect'>
{
pointTypeArr.map(item => {
return (<Option value={item.code} >{item.name}</Option>)
......
......@@ -15,43 +15,50 @@ const RadioGroup = Radio.Group;
class RightEditRegionPanel extends Component {
constructor(props) {
super(props);
this.state = {
form: {
},
rules:{},
treeDetailData:[]
form: {},
rules: {},
treeDetailData:[],
detailData: {},
heightInput: 0
};
}
componentDidMount() {
console.log(JSON.stringify(this.props.detailData))
// getAreaTreeDetailAction().then(data => {
// console.log(data);
// this.setState({
// treeDetailData:data || []
// })
// this.props.getAreaData(data || [])
// })
console.log(JSON.stringify(this.props.detailData))
const { detailData,routePathData } = this.props;
this.mergeDetailData(detailData,routePathData);
}
componentWillUnmount() {
}
componentWillReceiveProps(nextProps) {
console.log(nextProps)
let {treeData,pointTypeArr} = nextProps;
// this.setState({
console.log(nextProps)
// if(this.props.detailData != nextProps.detailData || this.props.routePathData != nextProps.routePathData){
let { detailData,routePathData } = nextProps;
this.mergeDetailData(detailData,routePathData);
// }
}
// })
mergeDetailData = (detailData,routePathData) => {
let { heightInput } = this.state;
const { rightHeight } = this.props;
routePathData && routePathData.forEach(r => {
if(r.riskSourceId === detailData.id){
detailData.routePath = r.routePath;
}
});
heightInput = detailData && detailData.routePath && detailData.routePath != '' && JSON.parse(detailData.routePath).regionHeigth || rightHeight;
this.setState({ detailData, heightInput });
}
onChange = (key, e) => {
const value = e.target.value;
const newForm = Object.assign({}, this.state.form, { [key]: value });
this.setState({
form: newForm
form: newForm,
heightInput: value
});
}
onRadioChange = (value) => {
......@@ -67,15 +74,9 @@ class RightEditRegionPanel extends Component {
});
}
handleSubmit = (e) => {
// e.preventDefault();
const {detailData} = this.props
const {detailData} = this.state;
this.form.validate((valid, dataValues, errors) => {
console.log('返回内容:', dataValues, valid, errors);
if (valid) {
......@@ -83,10 +84,19 @@ class RightEditRegionPanel extends Component {
let routePathData=[ {
riskSourceId: detailData.id,
routePath: JSON.stringify({
routePath:detailData.routePath,
routePath:JSON.parse(detailData.routePath).routePath,
regionHeigth:parseFloat(dataValues.positionZ)
})}]
this.props.saveRoutePath(routePathData)
// this.props.saveRoutePath(routePathData)
let routePathDataNode={
riskSourceId: detailData.id,
routePath: JSON.stringify({
routePath:JSON.parse(detailData.routePath).routePath,
regionHeigth:parseFloat(dataValues.positionZ)
})
}
this.props.changeRoutePath(routePathDataNode);
} else {
console.log('error submit!!');
return false;
......@@ -95,8 +105,8 @@ class RightEditRegionPanel extends Component {
}
render() {
let { rules, form,pointTypeArr,pointType, } = this.state;
let { pageType,detailData,rightHeight } = this.props;
let { rules, form,pointTypeArr,pointType,detailData,heightInput } = this.state;
let { pageType,rightHeight } = this.props;
const formItemLayout = {
labelCol: {
xs: { span: 28 },
......@@ -174,7 +184,10 @@ class RightEditRegionPanel extends Component {
</div> */}
<div className='positionItem'>
<FormItem label="高" field="positionZ" {...formItemLayout}>
<Input placeholder={rightHeight} onChange={(e) => this.onChange('positionZ', e)}/>
<Input
placeholder={detailData.routePath && JSON.parse(detailData.routePath).regionHeigth || rightHeight}
value={heightInput}
onChange={(e) => this.onChange('positionZ', e)}/>
{/* <Input value={detailData.ue4Location && detailData.ue4Location[2]} /> */}
</FormItem>
</div>
......
......@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { utils } from 'amos-tool';
import { Markers } from 'amos-3d/lib/designer';
import { BaseObjHelper } from 'base-r3d/lib/factory';
import formatUrl from 'amos-processor/lib/utils/urlFormat';
import { CONSTS } from './../../consts/storageConsts';
import PointDialog from './PointDialog';
import { tirggerPlanTopic } from './../dataProcessor';
......@@ -17,29 +18,6 @@ const getIcon = (markerType, level) => {
return marker3DIoncMapper[`${markerType}`]
};
const buildMarkerOptions = (markers, markerType, defaultParams = {}) => {
if (!utils.isEmpty(markers)){
markers.forEach(m => {
const url = getIcon(markerType, m.level);
let position;
if (!utils.isArray(m.position)){
position = Object.values(m.position);
}
for (let k of Object.keys(defaultParams)) {
m[k] = defaultParams[k];
}
m.key = m.key || m.id;
m.url = url;
m.position = utils.isArray(m.position) ? m.position : position;
m.size = 10;
m.name = m.name ? m.name : m.label;
m.label = null;
// m.label = createMarkerLabel(m.name);
});
}
return markers;
};
const createMarkerLabel = (text) => {
const div = document.createElement('div');
div.style.position = 'absolute';
......@@ -100,7 +78,7 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
}
componentWillReceiveProps = nextProps => {
// if(nextProps.editFlag){
// if(nextProps.isEditMode){
// this.markersCache.eachValue(obj=>{
// if(nextProps.selectPoints.type == obj.extData.type && nextProps.selectPoints.id ==obj.extData.id ){
// this.setTwinkleConf(obj);
......@@ -136,9 +114,6 @@ 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
}
......@@ -165,13 +140,13 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
}
}
markerCreated = ({ markersCache }) => {
let {editFlag,selectKey} =this.props
let {isEditMode,selectKey} =this.props
this.markersCache = markersCache;
//this.outlineHelper = this.stagePilot ? this.stagePilot.outlineHelper : undefined;
this.stagePilot = this.props.stagePilot;
this.outlineHelper = this.stagePilot ? this.stagePilot.outlineHelper : undefined;
markersCache.eachValue(obj=>{
this.setTopCardConf(obj, obj.extData);
if(obj.extData.type === "riskSource" && markerType != 'impEquipmentMode' && !editFlag){
if(obj.extData.type === "riskSource" && markerType != 'impEquipmentMode' && !isEditMode){
this.setTwinkleConf(obj);
}
});
......@@ -222,12 +197,46 @@ export default function marker3DFactory(WrappedComponent = 'div', options){
obj.baseObjHelper.title = cardTitle;
}
buildMarkerOptions = (markers, markerType, defaultParams = {}) => {
const { isEditMode } = this.props;
if (!utils.isEmpty(markers)){
markers.forEach(m => {
const url = getIcon(markerType, m.level);
let position;
if (!utils.isArray(m.position)){
position = Object.values(m.position);
}
for (let k of Object.keys(defaultParams)) {
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'){
m[k] = formatUrl(defaultParams[k], { url: `${markerType}-4` });
}else{
m[k] = formatUrl(defaultParams[k], { url: `${markerType}-1` });
}
}else{
m[k] = defaultParams[k];
}
}
m.key = m.key || m.id;
m.url = url;
m.position = utils.isArray(m.position) ? m.position : position;
m.size = 10;
m.name = m.name ? m.name : m.label;
m.label = null;
// m.label = createMarkerLabel(m.name);
});
}
return markers;
};
render() {
const { markers, ...rest } = this.props;
const { planStarted } = this.state;
let dialogStyle = { zIndex: 1000 };
const result = buildMarkerOptions(markers, markerType, markerParams);
const result = this.buildMarkerOptions(markers, markerType, markerParams);
return (
<WrappedComponent>
<Markers
......
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