Commit fb3f65bf authored by 张博's avatar 张博

bug

parents bc8e17ba 876bde88
...@@ -3,6 +3,8 @@ import * as helper from 'base-r3d/lib/utils/helper'; ...@@ -3,6 +3,8 @@ import * as helper from 'base-r3d/lib/utils/helper';
import { FscSerUrl, FasSerUrl } from './../consts/urlConsts'; import { FscSerUrl, FasSerUrl } from './../consts/urlConsts';
import { commonGet, commonPost, singleFetch } from './../utils/request'; import { commonGet, commonPost, singleFetch } from './../utils/request';
import { encodeUrl } from 'amos-tool';
//---------------- 加载模型、解析模型json ----------- //---------------- 加载模型、解析模型json -----------
export const getObjFromNet = (url, callback) => { export const getObjFromNet = (url, callback) => {
return singleFetch(url).then(data => { return singleFetch(url).then(data => {
...@@ -10,10 +12,15 @@ export const getObjFromNet = (url, callback) => { ...@@ -10,10 +12,15 @@ export const getObjFromNet = (url, callback) => {
// 临时将 asyncModels 也放在主线程 // 临时将 asyncModels 也放在主线程
const { basePath, asyncModels = [] } = data; const { basePath, asyncModels = [] } = data;
const _asyncModels = asyncModels.map(m => ({ const _asyncModels = asyncModels.map(m => {
basePath, const { objName, mtlName, ...rest } = m;
...m return {
})); basePath,
...rest,
objName: encodeUrl(objName),
mtlName: encodeUrl(mtlName)
};
});
// const _objs = objs.concat(_asyncModels); // const _objs = objs.concat(_asyncModels);
callback(objs, _asyncModels); callback(objs, _asyncModels);
......
export const chunk = (arr,size) => {
let objArr = [];
let index = 0;
let objArrlen = arr.length / size;
for (let i = 0;i < objArrlen;i++){
let arrTemp = [];
for (let j = 0;j < size;j++){
arrTemp[j] = arr[index++];
if (index === arr.length){
break;
}
}
objArr[i] = arrTemp;
}
return objArr;
};
...@@ -4,7 +4,6 @@ import { Connect } from 'amos-framework'; ...@@ -4,7 +4,6 @@ import { Connect } from 'amos-framework';
import AmosWebSocket from 'amos-websocket'; import AmosWebSocket from 'amos-websocket';
import SysWsURL, { completeToken } from './../consts/wsUrlConsts'; import SysWsURL, { completeToken } from './../consts/wsUrlConsts';
import SideControl from './sideControl'; import SideControl from './sideControl';
import DataPane from './datapane';
import globalMsg from './pagefactory/msgFactory'; import globalMsg from './pagefactory/msgFactory';
import { eventTopics, rulesDataFactory } from './consts'; import { eventTopics, rulesDataFactory } from './consts';
import LayerPool from './LayerPool'; import LayerPool from './LayerPool';
...@@ -17,7 +16,6 @@ const eventConnect = Connect.eventConnect; ...@@ -17,7 +16,6 @@ const eventConnect = Connect.eventConnect;
@eventConnect @eventConnect
class MaskContent extends Component { class MaskContent extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
...@@ -72,7 +70,8 @@ class MaskContent extends Component { ...@@ -72,7 +70,8 @@ class MaskContent extends Component {
} }
initViewModel = ()=>{ initViewModel = ()=>{
this.setState({ activeAction: 'panoramic' }); //选中全景监控、隐藏检索查询框
this.setState({ activeAction: 'panoramic', searchPaneVisible: false });
} }
render() { render() {
...@@ -101,14 +100,6 @@ class MaskContent extends Component { ...@@ -101,14 +100,6 @@ class MaskContent extends Component {
transitionAppear: true transitionAppear: true
} }
}; };
const datapaneAnim = {
animateName: 'zoom-comb-right',
visible: !planStarted && !alarmStarted,
animateProps: {
key: 'animate-datapane', // animate key
transitionAppear: true
}
};
const layerPoolAnimation = { const layerPoolAnimation = {
animateName: 'fade', animateName: 'fade',
visible: alarmStarted, visible: alarmStarted,
...@@ -123,7 +114,11 @@ class MaskContent extends Component { ...@@ -123,7 +114,11 @@ class MaskContent extends Component {
<div className="mask-content"> <div className="mask-content">
<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug /> <AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug />
{ !alarmStarted && sideControlShow && <SideControl multiple={multiple} errorAreaId={errorAreaId} onItemClick={onItemClick} layerConfig={layerConfig} animationProps={controlAnimation} />} { !alarmStarted && sideControlShow && <SideControl multiple={multiple} errorAreaId={errorAreaId} onItemClick={onItemClick} layerConfig={layerConfig} animationProps={controlAnimation} />}
<<<<<<< HEAD
{ !alarmStarted && <SearchPane visible={searchPaneVisible} focusPosition={focusPosition} changeSearchPaneVisible={this.changeSearchPaneVisible} />} { !alarmStarted && <SearchPane visible={searchPaneVisible} focusPosition={focusPosition} changeSearchPaneVisible={this.changeSearchPaneVisible} />}
=======
{ !alarmStarted && isShowActionBar && <SearchPane visible={searchPaneVisible} focusPosition={focusPosition} changeSearchPaneVisible={() => this.changeSearchPaneVisible} />}
>>>>>>> 876bde88e84eb33f87d6e192dd5d0e5e70297f58
<TopMsg alarmStart={alarmStart} /> <TopMsg alarmStart={alarmStart} />
{ !alarmStarted && !isShowActionBar && <ModelHeader animationProps={controlAnimation} headerName={headerName} handleExceptModel={this.handleExceptModel} />} { !alarmStarted && !isShowActionBar && <ModelHeader animationProps={controlAnimation} headerName={headerName} handleExceptModel={this.handleExceptModel} />}
{ !alarmStarted && isShowActionBar && <ActionBar activeAction={activeAction} onActionItemClick={(e) => this.actionBarClick(e)} animationProps={controlAnimation} /> } { !alarmStarted && isShowActionBar && <ActionBar activeAction={activeAction} onActionItemClick={(e) => this.actionBarClick(e)} animationProps={controlAnimation} /> }
...@@ -154,7 +149,9 @@ MaskContent.propTypes = { ...@@ -154,7 +149,9 @@ MaskContent.propTypes = {
headerName: PropTypes.string, headerName: PropTypes.string,
setHeaderName: PropTypes.string, setHeaderName: PropTypes.string,
handleExceptModel: PropTypes.func, handleExceptModel: PropTypes.func,
errorAreaId: PropTypes.number errorAreaId: PropTypes.number,
editModelChange: PropTypes.func,
focusPosition: PropTypes.func
}; };
MaskContent.defaultProps = { MaskContent.defaultProps = {
......
...@@ -15,7 +15,15 @@ import { desigerConf, desigerHelperConfig } from './conf'; ...@@ -15,7 +15,15 @@ import { desigerConf, desigerHelperConfig } from './conf';
import PointsPool from './PointsPool'; import PointsPool from './PointsPool';
import PromptModal from './PromptModal'; import PromptModal from './PromptModal';
import { eventTopics, isControllerEvent, isManualOperate } from './consts'; import { eventTopics, isControllerEvent, isManualOperate } from './consts';
import { executeView3dCMD, parseManual, parseBubbleMarkers, tirggerPlanTopic, tirggerTransTopic } from './dataProcessor'; import {
executeView3dCMD,
parseManual,
parseBubbleMarkers,
tirggerPlanTopic,
tirggerTransTopic,
cacheObjsSave,
flyToSubView
} from './dataProcessor';
import { import {
dealTroubleMarkers, dealTroubleMarkers,
assembleTroubleView, assembleTroubleView,
...@@ -40,6 +48,7 @@ import RightEditRegionPanel from './moduleEditComponent/RightEditRegionPanel'; ...@@ -40,6 +48,7 @@ import RightEditRegionPanel from './moduleEditComponent/RightEditRegionPanel';
import { EVENTS_CONSTS } from '../consts/EventConsts'; import { EVENTS_CONSTS } from '../consts/EventConsts';
import ExceptionArea from './exceptionArea/ExceptionArea'; import ExceptionArea from './exceptionArea/ExceptionArea';
import { exceptionRegionListAction,getPointsByRegionIdAction } from '../services/panoramicService'; import { exceptionRegionListAction,getPointsByRegionIdAction } from '../services/panoramicService';
import { chunk } from '../utils/MathUtils';
const AmosConfig = endConf.AmosConfig; const AmosConfig = endConf.AmosConfig;
...@@ -167,6 +176,8 @@ class View3D extends Component { ...@@ -167,6 +176,8 @@ class View3D extends Component {
onMouseMove: this.onMouseMove onMouseMove: this.onMouseMove
}; };
this._marker = []; this._marker = [];
this._cacheObj = {};//3维模型对象缓存
this.processorLevel = {};//3维模型对应关系缓存
} }
componentDidMount() { componentDidMount() {
...@@ -259,9 +270,8 @@ class View3D extends Component { ...@@ -259,9 +270,8 @@ class View3D extends Component {
this.r3d.on('keydown', evt => { this.r3d.on('keydown', evt => {
// 返回上级 // 返回上级
if (this.lensLevel === LENS_LEVEL.SUB && evt.code === 'Backspace') { if (this.lensLevel === LENS_LEVEL.SUB && evt.code === 'Backspace') {
this.lensJumpFactory.jumpRoot(obj => { this.initModelDisplay();
this.lensJumpFactory.fadeIn(obj); this.outlineFactory.toggleOutline([]);//清除选中
});
this.lensLevel = LENS_LEVEL.ROOT; this.lensLevel = LENS_LEVEL.ROOT;
} }
}); });
...@@ -269,7 +279,7 @@ class View3D extends Component { ...@@ -269,7 +279,7 @@ class View3D extends Component {
_bindPubSubEvents = () => { _bindPubSubEvents = () => {
this.props.subscribe(eventTopics.base3d_view, (topic, data) => { this.props.subscribe(eventTopics.base3d_view, (topic, data) => {
console.log('subscribe base3d_view'); console.log('subscribe base3d_view' + data);
if (isControllerEvent(topic)) { if (isControllerEvent(topic)) {
executeView3dCMD(this, topic, data); executeView3dCMD(this, topic, data);
} else if (isManualOperate(topic)) { } else if (isManualOperate(topic)) {
...@@ -493,7 +503,8 @@ class View3D extends Component { ...@@ -493,7 +503,8 @@ class View3D extends Component {
onAllDone = objGroup => { onAllDone = objGroup => {
this.sceneFactory.level.change(objGroup); this.sceneFactory.level.change(objGroup);
this.stagePilot.rendererFactory.setupUModelSahdow();//接受阴影 // 接受阴影
this.stagePilot.rendererFactory.setupUModelSahdow();
this.setState({ this.setState({
startAsyncLoad: true startAsyncLoad: true
}); });
...@@ -509,15 +520,14 @@ class View3D extends Component { ...@@ -509,15 +520,14 @@ class View3D extends Component {
onComplete = obj => { onComplete = obj => {
const me = this; const me = this;
cacheObjsSave(me,obj,LENS_LEVEL);//缓存对象及对应关系
if (!obj.isForceParent) { if (!obj.isForceParent) {
obj.on('click', evt => { obj.on('click', evt => {
if (this.state.isEditMode === false) { if (this.state.isEditMode === false) {
console.log('obj click:', evt);
// this.focusPosition(evt.pickedPosition); // this.focusPosition(evt.pickedPosition);
me.outlineFactory.toggleOutline(evt.object); me.outlineFactory.toggleOutline(evt.object);
me.focusObject(evt.object); flyToSubView(me,obj,LENS_LEVEL);
} }
}); });
} }
// 处理跳跃 // 处理跳跃
...@@ -542,14 +552,7 @@ class View3D extends Component { ...@@ -542,14 +552,7 @@ class View3D extends Component {
// 飞行到具体的 obj 之后,执行进入层级操作 // 飞行到具体的 obj 之后,执行进入层级操作
onComplete() { onComplete() {
console.log('fly done!', object); console.log('fly done!', object);
// 进入子层级 me.lensLevel = LENS_LEVEL.SUB;
if (object.foreignKey) {
me.lensJumpFactory.jumpInByForeignKey(object.foreignKey, excludeObj => {
// 处理非该层级的物体 (fadeOut)
me.lensJumpFactory.fadeOut(excludeObj);
});
me.lensLevel = LENS_LEVEL.SUB;
}
} }
}); });
} else if (me.state.alarmStarted) { } else if (me.state.alarmStarted) {
...@@ -923,10 +926,8 @@ class View3D extends Component { ...@@ -923,10 +926,8 @@ class View3D extends Component {
//保存点绑定 //保存点绑定
savePointData = () => { savePointData = () => {
let { markers, pointType } = this.state; let { markers, pointType } = this.state;
this.setState({ isPointSave: false }); this.setState({ isPointSave: false });
if (pointType === 'fireEquipment') { if (pointType === 'fireEquipment') {
let typeArr = ['fireEquipment','pool','hydrant','fireChamber','fireCar','fireFoamRoom']; let typeArr = ['fireEquipment','pool','hydrant','fireChamber','fireCar','fireFoamRoom'];
for (let i = 0;i < typeArr.length;i++){ for (let i = 0;i < typeArr.length;i++){
...@@ -956,6 +957,7 @@ class View3D extends Component { ...@@ -956,6 +957,7 @@ class View3D extends Component {
}; };
}); });
this.savePointList(pointType,paramsArr); this.savePointList(pointType,paramsArr);
this.stagePilot.positionCtl.clearDrag();
} }
} }
...@@ -964,6 +966,7 @@ class View3D extends Component { ...@@ -964,6 +966,7 @@ class View3D extends Component {
data => { data => {
getPointTreeAction(pointType).then( getPointTreeAction(pointType).then(
data => { data => {
this.getPointList(pointType,data);
this.setState({ this.setState({
treeData: data || [], treeData: data || [],
pageType: 'point', pageType: 'point',
...@@ -975,9 +978,7 @@ class View3D extends Component { ...@@ -975,9 +978,7 @@ class View3D extends Component {
},error =>{ },error =>{
isfirst && message.error('保存失败'); isfirst && message.error('保存失败');
});
}
);
} }
// 删除点绑定 // 删除点绑定
...@@ -1211,7 +1212,6 @@ class View3D extends Component { ...@@ -1211,7 +1212,6 @@ class View3D extends Component {
message.danger('只能放置未绑定的标记点'); message.danger('只能放置未绑定的标记点');
return false; return false;
} }
} }
const objs = this.a3dRef.pickerCoordinate(event.clientX, event.clientY, null, true); const objs = this.a3dRef.pickerCoordinate(event.clientX, event.clientY, null, true);
let position; let position;
...@@ -1243,14 +1243,15 @@ class View3D extends Component { ...@@ -1243,14 +1243,15 @@ class View3D extends Component {
let selectPoints = { let selectPoints = {
id: dragItem.id, id: dragItem.id,
type: dragItem.type type: dragItem.type,
position: position.toArray()
}; };
markers[`${type}`] = markers[`${type}`] && markers[`${type}`].filter(e => e.id !== dragItem.id ); markers[`${type}`] = markers[`${type}`] && markers[`${type}`].filter(e => e.id !== dragItem.id );
markers[`${type}`].push(addPointParam); markers[`${type}`].push(addPointParam);
this.setState({ this.setState({
markers: deepCopy(markers), markers: deepCopy(markers),
selectPoints selectPoints,
// positionxyz: position.toArray() showRightPanel: true
}); });
} }
} }
...@@ -1559,6 +1560,7 @@ class View3D extends Component { ...@@ -1559,6 +1560,7 @@ class View3D extends Component {
}); });
} else if (type === 'out_except_model'){ } else if (type === 'out_except_model'){
this.stagePilot.positionCtl.clearDrag(); this.stagePilot.positionCtl.clearDrag();
this.initModelDisplay();
if (isAreaSave){ if (isAreaSave){
this.setState({ promptData: this.setState({ promptData:
{ {
...@@ -1588,6 +1590,18 @@ class View3D extends Component { ...@@ -1588,6 +1590,18 @@ class View3D extends Component {
} }
} }
/**
*
*初始化模型显示(显示所有3维模型),清除选中
* @memberof View3D
*/
initModelDisplay =()=>{
this.lensJumpFactory.jumpRoot(obj => {
this.lensJumpFactory.fadeIn(obj);
});
this.outlineFactory.toggleOutline([]);
}
setHeaderName =(name)=>{ setHeaderName =(name)=>{
this.setState({ headerName: name }); this.setState({ headerName: name });
} }
...@@ -1602,6 +1616,24 @@ class View3D extends Component { ...@@ -1602,6 +1616,24 @@ class View3D extends Component {
return object; return object;
} }
/**
*多线程加载子模型
*
* @memberof View3D
*/
multLoadWorkerObjContent =(asyncModels)=>{
const sliceArry = chunk(asyncModels, 5);//每5个一组
return sliceArry.map(objs=>{
return <WorkerObjContent
onComplete={this.onComplete}
objs={objs}
onWorkerMessage={this.onWorkerLoading}
enableLoading
afterInit={this.onAfterWorkerInit}
/>;
});
}
addMarker=({ extData, position })=>{ addMarker=({ extData, position })=>{
const me = this; const me = this;
const { markers } = me.state; const { markers } = me.state;
...@@ -1743,14 +1775,14 @@ class View3D extends Component { ...@@ -1743,14 +1775,14 @@ class View3D extends Component {
positionCtlProps={positionCtlProps} positionCtlProps={positionCtlProps}
onCreated={this.onGraphCreated} onCreated={this.onGraphCreated}
> >
{startAsyncLoad && <WorkerObjContent objs={asyncModels} onWorkerMessage={this.onWorkerLoading} enableLoading afterInit={this.onAfterWorkerInit} />} {startAsyncLoad && this.multLoadWorkerObjContent(asyncModels)}
{isEditMode && pageType === 'region' ? '' : {isEditMode && pageType === 'region' ? '' :
<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} />} <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} />} {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} />
{isEditMode && this.renderAreas()} {isEditMode && this.renderAreas()}
{this.renderPolygonRegion(exceptionAreas)} {this.renderPolygonRegion(exceptionAreas)}
{startLoadExceptionArea && <ExceptionArea markers={exceptionMarkers} handleExceptModel={this.handleExceptModel} focusPosition={this.focusPosition} />} {startLoadExceptionArea && <ExceptionArea markers={exceptionMarkers} handleExceptModel={this.handleExceptModel} focusObject={this.focusObject} />}
</A3DDesigner> </A3DDesigner>
</div> </div>
{ isEditMode && { isEditMode &&
...@@ -1778,6 +1810,7 @@ class View3D extends Component { ...@@ -1778,6 +1810,7 @@ class View3D extends Component {
pageType={pageType} pageType={pageType}
treeDataList={treeDataList} treeDataList={treeDataList}
// pointType={pointType} // pointType={pointType}
markers={markers}
pointTypeArr={pointTypeArr} pointTypeArr={pointTypeArr}
pointTypeChange={this.pointTypeChange} pointTypeChange={this.pointTypeChange}
dragItemChange={this.dragItemChange} dragItemChange={this.dragItemChange}
......
...@@ -311,8 +311,8 @@ export const desigerConf = { ...@@ -311,8 +311,8 @@ export const desigerConf = {
fov: 45, fov: 45,
near: 1, near: 1,
far: 5000, far: 5000,
position: [-12.560443473044181, 234.91788662409795, 325.0800512251056], position: [-66.72828735496893, 239.00238807176638, 340.1218562325041],
target: [2.408441971875859, 1.3271790975878637, 3.918674823963386], target: [-52.608562486768115, -6.882567219297089, 1.984922473879572],
// 是否启用拾取器 // 是否启用拾取器
enablePicker: true, enablePicker: true,
builtInOrbit: { builtInOrbit: {
...@@ -357,8 +357,8 @@ export const curveConf = { ...@@ -357,8 +357,8 @@ export const curveConf = {
export const desigerHelperConfig = { export const desigerHelperConfig = {
cameraEffect: { cameraEffect: {
position: [-12.560443473044181, 234.91788662409795, 325.0800512251056], position: [-66.72828735496893, 239.00238807176638, 340.1218562325041],
target: [2.408441971875859, 1.3271790975878637, 3.918674823963386] target: [-52.608562486768115, -6.882567219297089, 1.984922473879572]
}, },
objAnchor: { objAnchor: {
position: [0, 5, 0] position: [0, 5, 0]
......
...@@ -344,4 +344,56 @@ export const objRunning = (markerObj, routePath, delayTime) => { ...@@ -344,4 +344,56 @@ export const objRunning = (markerObj, routePath, delayTime) => {
}); });
}; };
/**
* 模型对象缓存
* @param {object} instance
* @param {object} obj
*/
export const cacheObjsSave = (instance,obj,LENS_LEVEL)=>{
const { level, parentKey, key } = obj.userData || {};
if (level && key){
instance._cacheObj[key] = obj;
switch (level) {
case LENS_LEVEL.ROOT:// 父节点
if (!instance.processorLevel[key]){
instance.processorLevel[key] = [];
}
break;
case LENS_LEVEL.SUB:// 子节点
if (!instance.processorLevel[parentKey]){
instance.processorLevel[parentKey] = [];
}
instance.processorLevel[parentKey].push(key);// 在对应关系中,添加其子节点
break;
default:
break;
}
}
};
/**
* 进入选择物体内部
* @param {object} instance
* @param {object} obj
*/
export const flyToSubView = (instance,obj,LENS_LEVEL) =>{
const { level, key: objKey, fitView } = obj.userData || {};
if (level && objKey && level === 'root' && (instance.processorLevel[objKey] || []).length > 0){
Object.keys(instance.processorLevel).forEach(key => {
// 隐藏所有一级
instance._cacheObj[key].visible = false;
// 隐藏非目标二级
if (key !== objKey){
instance.processorLevel[key].forEach(sec => {
instance._cacheObj[sec].visible = false;
});
}
});
// 镜头切换
fitView && instance.cameraFactory.fitView(fitView);//视角调整为最近视角
instance.lensLevel = LENS_LEVEL.SUB;
} else {
instance.focusObject(obj);
}
};
...@@ -44,10 +44,9 @@ class ExceptionArea extends Component { ...@@ -44,10 +44,9 @@ class ExceptionArea extends Component {
} }
onMarkerClick = (marker) => { onMarkerClick = (marker) => {
console.log(marker); const { extData, node } = marker;
const { extData } = marker;
this.props.handleExceptModel && this.props.handleExceptModel('into_except_model',extData.id); this.props.handleExceptModel && this.props.handleExceptModel('into_except_model',extData.id);
this.props.focusPosition(this.toCameraPosition(extData.position)); this.props.focusObject && this.props.focusObject(node);
} }
...@@ -111,7 +110,7 @@ class ExceptionArea extends Component { ...@@ -111,7 +110,7 @@ class ExceptionArea extends Component {
ExceptionArea.propTypes = { ExceptionArea.propTypes = {
markers: PropTypes.array, markers: PropTypes.array,
handleExceptModel: PropTypes.func, handleExceptModel: PropTypes.func,
focusPosition: PropTypes.func focusObject: PropTypes.func
}; };
export default ExceptionArea; export default ExceptionArea;
/* eslint-disable react/prop-types */ /* eslint-disable react/prop-types */
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Connect, Tree, Select, Search, Button } from 'amos-framework'; import { Tree, Select, Search, Button } from 'amos-framework';
import imgStatic from '../../consts/imgStatic'; import imgStatic from '../../consts/imgStatic';
const moduleEditIcon = imgStatic.moduleEditIcon; const moduleEditIcon = imgStatic.moduleEditIcon;
const eventConnect = Connect.eventConnect;
const TreeNode = Tree.TreeNode; const TreeNode = Tree.TreeNode;
const Option = Select.Option; const Option = Select.Option;
const getParentKey = (key, tree) => { const getParentKey = (key, tree) => {
...@@ -23,7 +22,7 @@ const getParentKey = (key, tree) => { ...@@ -23,7 +22,7 @@ const getParentKey = (key, tree) => {
return parentKey; return parentKey;
}; };
@eventConnect
class PointLeftTree extends Component { class PointLeftTree extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
...@@ -43,6 +42,27 @@ class PointLeftTree extends Component { ...@@ -43,6 +42,27 @@ class PointLeftTree extends Component {
} }
<<<<<<< HEAD
=======
componentWillMount() {
const { treeData, pointTypeArr, treeDataList } = this.props;
this.setState({
treeData,
treeDataList,
pointTypeArr,
pointType: pointTypeArr[0] ? pointTypeArr[0].code : ''
});
}
componentWillReceiveProps(nextProps) {
console.log(nextProps);
let { treeData,treeDataList } = nextProps;
this.setState({
treeData,
treeDataList
});
}
>>>>>>> 876bde88e84eb33f87d6e192dd5d0e5e70297f58
onSelectChange = (value, item) =>{ onSelectChange = (value, item) =>{
console.log(value, item); console.log(value, item);
...@@ -82,8 +102,7 @@ class PointLeftTree extends Component { ...@@ -82,8 +102,7 @@ class PointLeftTree extends Component {
} }
// eslint-disable-next-line react/sort-comp // eslint-disable-next-line react/sort-comp
renderTreeNodes = (data) => { renderTreeNodes = (data) => {
let { searchValue } = this.state; const { searchValue, pointType } = this.state;
// console.log(data);
if (data.length > 0) { if (data.length > 0) {
return data.map((item) => { return data.map((item) => {
const index = item.name.indexOf(searchValue); const index = item.name.indexOf(searchValue);
...@@ -108,6 +127,7 @@ class PointLeftTree extends Component { ...@@ -108,6 +127,7 @@ class PointLeftTree extends Component {
<span> <span>
{title} {title}
<span className='icon'> <span className='icon'>
<<<<<<< HEAD
{ {
item.isRegion ? item.isBind ? <img src={moduleEditIcon.bindedTip} alt='' /> : item.isRegion ? item.isBind ? <img src={moduleEditIcon.bindedTip} alt='' /> :
<img src={moduleEditIcon.nobindTip} alt='' /> : <img src={moduleEditIcon.nobindTip} alt='' /> :
...@@ -115,6 +135,9 @@ class PointLeftTree extends Component { ...@@ -115,6 +135,9 @@ class PointLeftTree extends Component {
item.position3d ? <img src={moduleEditIcon.noSaveTip} alt='' /> : item.position3d ? <img src={moduleEditIcon.noSaveTip} alt='' /> :
<img src={moduleEditIcon.nobindTip} alt='' /> <img src={moduleEditIcon.nobindTip} alt='' />
} }
=======
{ item.isBind ? <img src={moduleEditIcon.bindedTip} alt='' /> : <img src={moduleEditIcon.nobindTip} alt='' /> }
>>>>>>> 876bde88e84eb33f87d6e192dd5d0e5e70297f58
</span> </span>
</span> : </span> :
<span <span
...@@ -126,6 +149,7 @@ class PointLeftTree extends Component { ...@@ -126,6 +149,7 @@ class PointLeftTree extends Component {
{title} {title}
<span className='icon'> <span className='icon'>
{ {
<<<<<<< HEAD
item.isRegion ? item.isBind ? <img src={moduleEditIcon.bindedTip} alt='' /> : item.isRegion ? item.isBind ? <img src={moduleEditIcon.bindedTip} alt='' /> :
<img src={moduleEditIcon.nobindTip} alt='' /> : <img src={moduleEditIcon.nobindTip} alt='' /> :
item.isBind ? <img src={moduleEditIcon.bindedTip} alt='' /> : item.isBind ? <img src={moduleEditIcon.bindedTip} alt='' /> :
...@@ -136,6 +160,16 @@ class PointLeftTree extends Component { ...@@ -136,6 +160,16 @@ class PointLeftTree extends Component {
</span>} </span>}
</div> </div>
} }
=======
this.checkPointIsNoSave(pointType,item) ? <img src={moduleEditIcon.noSaveTip} alt='' /> :
item.isBind ? <img src={moduleEditIcon.bindedTip} alt='' /> :
<img src={moduleEditIcon.nobindTip} alt='' />
}
</span>
</span>}
</div>
}
>>>>>>> 876bde88e84eb33f87d6e192dd5d0e5e70297f58
key={item.id} key={item.id}
dataRef={item} dataRef={item}
onDragStart={() => { onDragStart={() => {
...@@ -158,6 +192,18 @@ class PointLeftTree extends Component { ...@@ -158,6 +192,18 @@ class PointLeftTree extends Component {
this.setState({ selectedKeys }); this.setState({ selectedKeys });
this.props.selectPointChange(selectItem); this.props.selectPointChange(selectItem);
} }
checkPointIsNoSave =(pointType,{ id })=>{
const { markers } = this.props;
const selectPoints = markers[pointType];
const point = selectPoints.find(point=>point.id === id);
if (point && point.isEdit) {
return true;
} else {
return false;
}
}
render() { render() {
const { treeData,pointTypeArr } = this.props; const { treeData,pointTypeArr } = this.props;
const pointType = pointTypeArr[0] ? pointTypeArr[0].code : ''; const pointType = pointTypeArr[0] ? pointTypeArr[0].code : '';
...@@ -213,8 +259,7 @@ class PointLeftTree extends Component { ...@@ -213,8 +259,7 @@ class PointLeftTree extends Component {
} }
PointLeftTree.propTypes = { PointLeftTree.propTypes = {
subscribe: PropTypes.func, markers: PropTypes.object
trigger: PropTypes.func
}; };
export default PointLeftTree; export default PointLeftTree;
...@@ -10,11 +10,11 @@ import { ...@@ -10,11 +10,11 @@ import {
searchAction, searchAction,
msgAction, msgAction,
exeRecordAction, exeRecordAction,
trajectoryAction,
recordAction recordAction
} from './../../services/3dService'; } from './../../services/3dService';
const { TabList, Tab, TabPanel } = Tabs; const { TabList, Tab, TabPanel } = Tabs;
const MsgType = { protal: '巡检',equiment: '设备', riskAlert: '风险' };
const getColumns = (self,retrieveType) => { const getColumns = (self,retrieveType) => {
switch (retrieveType) { switch (retrieveType) {
...@@ -29,23 +29,23 @@ const getColumns = (self,retrieveType) => { ...@@ -29,23 +29,23 @@ const getColumns = (self,retrieveType) => {
return [ return [
{ title: '编号',dataIndex: 'code',key: 'code',width: '16.5%' }, { title: '编号',dataIndex: 'code',key: 'code',width: '16.5%' },
{ title: '名称',dataIndex: 'label',key: 'label',width: '16.5%' }, { title: '名称',dataIndex: 'label',key: 'label',width: '16.5%' },
{ title: '路线',dataIndex: 'routeName',key: 'level',width: '16.5%' }, { title: '路线',dataIndex: 'routeName',key: 'routeName',width: '16.5%' },
{ title: '状态',dataIndex: 'title',key: 'level',width: '16.5%' }, { title: '状态',dataIndex: 'title',key: 'title',width: '16.5%' },
{ title: '责任人',dataIndex: 'person',key: 'level',width: '16.5%' }, { title: '责任人',dataIndex: 'person',key: 'person',width: '16.5%' },
{ title: '类别',dataIndex: 'typeName',key: 'typeName',width: '16.5%' } { title: '类别',dataIndex: 'typeName',key: 'typeName',width: '16.5%' }
]; ];
case 'monitorEquipment': case 'monitorEquipment':
return [ return [
{ title: '编号',dataIndex: 'code',key: 'code',width: '25%' }, { title: '编号',dataIndex: 'code',key: 'code',width: '25%' },
{ title: '名称',dataIndex: 'label',key: 'label',width: '25%' }, { title: '名称',dataIndex: 'label',key: 'label',width: '25%' },
{ title: '监控对象',dataIndex: 'level',key: 'protectObjName',width: '25%' }, { title: '监控对象',dataIndex: 'protectObjName',key: 'protectObjName',width: '25%' },
{ title: '类别',dataIndex: 'typeName',key: 'typeName',width: '25%' } { title: '类别',dataIndex: 'typeName',key: 'typeName',width: '25%' }
]; ];
case 'video': case 'video':
return [ return [
{ title: '编号',dataIndex: 'code',key: 'code',width: '25%' }, { title: '编号',dataIndex: 'code',key: 'code',width: '25%' },
{ title: '名称',dataIndex: 'label',key: 'label',width: '25%' }, { title: '名称',dataIndex: 'label',key: 'label',width: '25%' },
{ title: '监控对象',dataIndex: 'level',key: 'protectObjName',width: '25%' }, { title: '监控对象',dataIndex: 'protectObjName',key: 'protectObjName',width: '25%' },
{ title: '类别',dataIndex: 'typeName',key: 'typeName',width: '25%' } { title: '类别',dataIndex: 'typeName',key: 'typeName',width: '25%' }
]; ];
default: default:
...@@ -60,7 +60,7 @@ const getColumns = (self,retrieveType) => { ...@@ -60,7 +60,7 @@ const getColumns = (self,retrieveType) => {
const getMsgColumns = () => { const getMsgColumns = () => {
return [ return [
{ title: '标题',dataIndex: 'title',key: 'title',width: '15%' }, { title: '标题',dataIndex: 'title',key: 'title',width: '15%' },
{ title: '类型',dataIndex: 'type',key: 'type',width: '15%' }, { title: '类型',dataIndex: 'type',key: 'type',width: '15%',render: text => MsgType[text] },
{ title: '时间',dataIndex: 'timeStr',key: 'timeStr',width: '15%' }, { title: '时间',dataIndex: 'timeStr',key: 'timeStr',width: '15%' },
{ title: '内容',dataIndex: 'content',key: 'content',width: '55%' } { title: '内容',dataIndex: 'content',key: 'content',width: '55%' }
]; ];
...@@ -113,35 +113,6 @@ class SearchPane extends Component { ...@@ -113,35 +113,6 @@ class SearchPane extends Component {
this.fetchRetrieveData(); this.fetchRetrieveData();
} }
paramsOnChange = (filter) => {
const { activeKey } = this.state;
if (activeKey === 'search'){
this.setState({ filter },this.fetchRetrieveData);
} else if (activeKey === 'message'){
this.setState({ filter },this.fetchMsgData);
} else if (activeKey === 'record'){
this.setState({ filter },this.fetchRecordData);
} else if (activeKey === 'trajectory'){
this.setState({ filter },this.fetchTrajectoryData);
}
}
/**
* 获取表格刷新方法
*/
reload = r => {
this.setState(
{
reload: () => {
r();
this.setState({ selectedRows: [], selectedRowKeys: [] });
}
},
r()
);
};
onTabClick = (value) =>{ onTabClick = (value) =>{
this.pageConfig.current = 0; this.pageConfig.current = 0;
if (value === 'search'){ if (value === 'search'){
...@@ -156,9 +127,35 @@ class SearchPane extends Component { ...@@ -156,9 +127,35 @@ class SearchPane extends Component {
this.setState({ activeKey: value ,filter: [] }); this.setState({ activeKey: value ,filter: [] });
} }
onRetrieveRowDoubleClick = (record) => {
// 更新视图数据
let views = new Array();
if (record.position){
record.id = record.id.replace( `${record.type}-` ,'' );
views.push(record);
let args = {
target: views,
operateType: operateTypes.POINT_SEARCH
};
update3DViewData(args);
this.props.focusPosition(this.toCameraPosition(record.position));
} else {
message.danger('坐标未绑定!!!');
}
}
getPanelHeight = () => { getPanelHeight = () => {
return 700; return 700;
}; };
setPageConfig = ({ pageSize, current }) => {
if (pageSize !== undefined) {
this.pageConfig.pageSize = pageSize;
}
if (current !== undefined) {
this.pageConfig.current = current - 1;
}
};
//轨迹 //轨迹
fetchTrajectoryData = () => { fetchTrajectoryData = () => {
const { filter } = this.state; const { filter } = this.state;
...@@ -225,29 +222,31 @@ class SearchPane extends Component { ...@@ -225,29 +222,31 @@ class SearchPane extends Component {
}); });
} }
setPageConfig = ({ pageSize, current }) => { /**
if (pageSize !== undefined) { * 获取表格刷新方法
this.pageConfig.pageSize = pageSize; */
} reload = r => {
if (current !== undefined) { this.setState(
this.pageConfig.current = current - 1; {
} reload: () => {
r();
this.setState({ selectedRows: [], selectedRowKeys: [] });
}
},
r()
);
}; };
onRetrieveRowDoubleClick = (record) => { paramsOnChange = (filter) => {
// 更新视图数据 const { activeKey } = this.state;
let views = new Array(); if (activeKey === 'search'){
if (record.position){ this.setState({ filter },this.fetchRetrieveData);
record.id = record.id.replace( `${record.type}-` ,'' ); } else if (activeKey === 'message'){
views.push(record); this.setState({ filter },this.fetchMsgData);
let args = { } else if (activeKey === 'record'){
target: views, this.setState({ filter },this.fetchRecordData);
operateType: operateTypes.POINT_SEARCH } else if (activeKey === 'trajectory'){
}; this.setState({ filter },this.fetchTrajectoryData);
update3DViewData(args);
this.props.focusPosition(this.toCameraPosition(record.position));
} else {
message.danger('坐标未绑定!!!');
} }
} }
...@@ -351,6 +350,9 @@ class SearchPane extends Component { ...@@ -351,6 +350,9 @@ class SearchPane extends Component {
} }
SearchPane.propTypes = { SearchPane.propTypes = {
focusPosition: PropTypes.func,
visible: PropTypes.bool,
changeSearchPaneVisible: PropTypes.func
}; };
export default SearchPane; export default SearchPane;
...@@ -14,12 +14,11 @@ import { bizControlsTypes, riskSourceLevel } from './../conf'; ...@@ -14,12 +14,11 @@ import { bizControlsTypes, riskSourceLevel } from './../conf';
const Option = Select.Option; const Option = Select.Option;
const MsgTypeEnum = [{ id: 'protal', name: '巡检' }, { id: 'equiment', name: '设备' }, { id: 'risk', name: '风险' }]; const MsgTypeEnum = [{ id: 'protal', name: '巡检' }, { id: 'equiment', name: '设备' }, { id: 'riskAlert', name: '风险' }];
const groupStyle = { display: 'unset', width: '100%' }; const groupStyle = { display: 'unset', width: '100%' };
const selectStyle = { width: '25%', minWidth: '20%', marginRight: '14px' }; const selectStyle = { width: '25%', minWidth: '20%', marginRight: '14px' };
const inputStyle = { width: '30%', minWidth: '20%', height: '28px', marginRight: '14px' }; const inputStyle = { width: '30%', minWidth: '20%', height: '28px', marginRight: '14px' };
const datePickerStyle = { width: '30%', minWidth: '20%', height: '28px', marginRight: '14px' }; const datePickerStyle = { width: '30%', minWidth: '20%', height: '28px', marginRight: '14px' };
const enterkey = 13;
/** /**
* *
* @class paramsHeader * @class paramsHeader
......
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