Commit 623a983e authored by shanqiyun's avatar shanqiyun

优化任务列表,整理代码

parent 00e537df
...@@ -4,12 +4,11 @@ import { browserHistory } from 'amos-react-router'; ...@@ -4,12 +4,11 @@ import { browserHistory } from 'amos-react-router';
import _amosTool from 'amos-tool'; import _amosTool from 'amos-tool';
import SysConsts from 'amos-processor/lib/config/consts'; import SysConsts from 'amos-processor/lib/config/consts';
import formatUrl from 'amos-processor/lib/utils/urlFormat'; import formatUrl from 'amos-processor/lib/utils/urlFormat';
import { Modal,AmosAlert } from 'amos-framework'; import { Modal,AmosAlert,message } from 'amos-framework';
import 'amos-iot-webstudio/lib/styles';// 独立使用,需要引入样式 import 'amos-iot-webstudio/lib/styles';// 独立使用,需要引入样式
import { pageUrl } from './../common/conf'; import { pageUrl } from './../common/conf';
import Upload from './../common/upload'; import Upload from './../common/upload';
import { FasSerUrl } from '../../../consts/urlConsts'; import { FasSerUrl } from '../../../consts/urlConsts';
import { PubSub } from 'ray-eventpool';
import { eventTopics } from './../../3dview/consts'; import { eventTopics } from './../../3dview/consts';
const ls = _amosTool.Store.lsTool; const ls = _amosTool.Store.lsTool;
...@@ -20,7 +19,7 @@ const uploadUrl = FasSerUrl.uploadTextPlan; ...@@ -20,7 +19,7 @@ const uploadUrl = FasSerUrl.uploadTextPlan;
// 额外的操作,系统默认的操作有 edit、publish、cancelpub、see、copy、delete,禁止重复 // 额外的操作,系统默认的操作有 edit、publish、cancelpub、see、copy、delete,禁止重复
const extraMenus = [ const extraMenus = [
{ key: 'preview', text: '预览', icon: 'eye' }, { key: 'preview', text: '预览', icon: 'eye' },
{ key: 'textImport', text: '文字预案', icon: 'user' }, { key: 'textImport', text: '文字预案', icon: 'totop1' },
{ key: 'leaderStruct', text: '领导架构', icon: 'user' } { key: 'leaderStruct', text: '领导架构', icon: 'user' }
]; ];
...@@ -40,13 +39,18 @@ class CusVizLib extends Component { ...@@ -40,13 +39,18 @@ class CusVizLib extends Component {
} }
onItemClick = (itemKey, data) => { onItemClick = (itemKey, data) => {
if (itemKey === 'preview') { if (itemKey === 'preview') {
let path = { // if(data.publishState == 1){
pathname: pageUrl.planDrill, let path = {
state: { appId: data.id,isPublish: !!data.publishState } pathname: pageUrl.planDrill,
}; state: { appId: data.id,isPublish: !!data.publishState }
ls.write(eventTopics.plan_drill_appId,data.id) };
browserHistory.push(path); ls.write(eventTopics.plan_drill_appId,data.id)
browserHistory.push(path);
// }else{
// message.danger('预案未发布!!!');
// }
} }
if (itemKey === 'textImport') { if (itemKey === 'textImport') {
this.setState({ appId: data.id, visible: true }); this.setState({ appId: data.id, visible: true });
......
...@@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; ...@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import { deepCopy } from 'amos-tool'; import { deepCopy } from 'amos-tool';
import A3DDesigner, { r3d, Connect, DESIGNER_CONSTS } from 'amos-3d/lib/designer'; import A3DDesigner, { r3d, Connect, DESIGNER_CONSTS } from 'amos-3d/lib/designer';
import { A3DUtil } from 'amos-3d/lib/threeTools'; import { A3DUtil } from 'amos-3d/lib/threeTools';
import { ObjAnchorHelper } from 'base-r3d/lib/plugins';
import { BaseObjHelper } from 'base-r3d/lib/factory'; import { BaseObjHelper } from 'base-r3d/lib/factory';
import { ELEMENT_TYPE } from 'amos-iot-3dgraph/lib/view/pubview/../design/conf'; import { ELEMENT_TYPE } from 'amos-iot-3dgraph/lib/view/pubview/../design/conf';
import { Button, Modal, Row, Col } from 'amos-framework'; import { Button, Modal, Row, Col } from 'amos-framework';
...@@ -62,7 +61,6 @@ class StageActuator extends Component { ...@@ -62,7 +61,6 @@ class StageActuator extends Component {
componentWillUnmount() { componentWillUnmount() {
r3d.off(ANIMATION_CONSTS.ANIMATION_FRAME_CHANGE, this.onAnimationChange); r3d.off(ANIMATION_CONSTS.ANIMATION_FRAME_CHANGE, this.onAnimationChange);
this.objAnchorHelper && this.objAnchorHelper.destroy();
} }
onAnimationChange = (animate) => { onAnimationChange = (animate) => {
...@@ -73,7 +71,6 @@ class StageActuator extends Component { ...@@ -73,7 +71,6 @@ class StageActuator extends Component {
if(animate.showPopup){ if(animate.showPopup){
this.a3dRef && this.a3dRef.changePlayState('pause'); this.a3dRef && this.a3dRef.changePlayState('pause');
// setTimeout( e => {
this.setState({ this.setState({
modal: true, modal: true,
modalContent: animate.popupContent, modalContent: animate.popupContent,
...@@ -81,7 +78,6 @@ class StageActuator extends Component { ...@@ -81,7 +78,6 @@ class StageActuator extends Component {
ativeAnimate: animate.animateKey, ativeAnimate: animate.animateKey,
playing: false playing: false
}); });
// }, animate.animateParams.duration );
}else{ }else{
if(animate.showVoiceBroadcast){ if(animate.showVoiceBroadcast){
this.text2Speech(animate.description); this.text2Speech(animate.description);
...@@ -172,13 +168,11 @@ class StageActuator extends Component { ...@@ -172,13 +168,11 @@ class StageActuator extends Component {
const { animations } = this.props; const { animations } = this.props;
let anim = animations[animateIndex]; let anim = animations[animateIndex];
if(anim.showPopup){ if(anim.showPopup){
// setTimeout(e => { this.setState({
this.setState({ modal: true,
modal: true, modalContent: animations[animateIndex].popupContent,
modalContent: animations[animateIndex].popupContent, currentIndex: animateIndex
currentIndex: animateIndex });
})
// }, anim.animateParams.duration );
} }
this.a3dRef && this.a3dRef.playAnimation(animateIndex); this.a3dRef && this.a3dRef.playAnimation(animateIndex);
} }
...@@ -202,7 +196,6 @@ class StageActuator extends Component { ...@@ -202,7 +196,6 @@ class StageActuator extends Component {
/**停止动画 */ /**停止动画 */
playStop = () => { playStop = () => {
// this.a3dRef.changePlayState('stop');
this.a3dRef && this.a3dRef.changePlayState('pause'); this.a3dRef && this.a3dRef.changePlayState('pause');
this.setState({ playing: false }) this.setState({ playing: false })
} }
...@@ -233,17 +226,9 @@ class StageActuator extends Component { ...@@ -233,17 +226,9 @@ class StageActuator extends Component {
this.rendererFactory = stagePilot.rendererFactory; this.rendererFactory = stagePilot.rendererFactory;
this.r3d = r3d; this.r3d = r3d;
// 设置 UI
this.objAnchorHelper = new ObjAnchorHelper({
r3d,
cameraFactory,
sceneFactory
});
//单击 //单击
this.r3d.on('click', (evt) => { this.r3d.on('click', (evt) => {
console.log('click'); console.log('click');
let obj = evt.object;
if (evt.object && evt.object.type === 'Mesh') { if (evt.object && evt.object.type === 'Mesh') {
const realObj = evt.object.parent; const realObj = evt.object.parent;
const userData = realObj.userData; const userData = realObj.userData;
...@@ -273,8 +258,6 @@ class StageActuator extends Component { ...@@ -273,8 +258,6 @@ class StageActuator extends Component {
// 鼠标移入事件 // 鼠标移入事件
this.r3d.on('mouseover', (evt) => { this.r3d.on('mouseover', (evt) => {
let obj = evt.object;
// console.log('mouseover');
if (evt.object && evt.object.type === 'Mesh') { if (evt.object && evt.object.type === 'Mesh') {
const realObj = evt.object.parent; const realObj = evt.object.parent;
const userData = realObj.userData; const userData = realObj.userData;
...@@ -305,25 +288,7 @@ class StageActuator extends Component { ...@@ -305,25 +288,7 @@ class StageActuator extends Component {
}; };
createInfowindow = (text) => {
const div = document.createElement('div');
div.style.position = 'absolute';
div.className = 'three-ui-infowindow';
div.innerText = text;
return div;
}
createPanel = (id, text, type) => {
const div = document.createElement('div');
div.id = id;
div.style.position = 'absolute';
div.className = 'three-ui-anchor ' + type;
div.innerText = text;
return div;
}
afterRender = () => { afterRender = () => {
this.objAnchorHelper && this.objAnchorHelper.update();
} }
handleModelParserData = (parser, fmtData) => { handleModelParserData = (parser, fmtData) => {
...@@ -332,6 +297,7 @@ class StageActuator extends Component { ...@@ -332,6 +297,7 @@ class StageActuator extends Component {
// or // or
parser.bindUserData(deepCopy(fmtData)); parser.bindUserData(deepCopy(fmtData));
//为模型添加顶牌属性
let obj = parser.obj; let obj = parser.obj;
const boh = new BaseObjHelper({ obj }); const boh = new BaseObjHelper({ obj });
obj.baseObjHelper = boh; obj.baseObjHelper = boh;
...@@ -378,8 +344,6 @@ class StageActuator extends Component { ...@@ -378,8 +344,6 @@ class StageActuator extends Component {
} }
playAnimation = () => { playAnimation = () => {
// const { currentIndex } = this.state;
// this.a3dRef && this.a3dRef.playAnimation(currentIndex);
this.a3dRef && this.a3dRef.changePlayState('start'); this.a3dRef && this.a3dRef.changePlayState('start');
this.setState({ modal: false, playing: true }); this.setState({ modal: false, playing: true });
}; };
...@@ -440,7 +404,6 @@ class StageActuator extends Component { ...@@ -440,7 +404,6 @@ class StageActuator extends Component {
enableParticles enableParticles
particlesProps={particlesProps} particlesProps={particlesProps}
onCreated={this.onGraphCreated} onCreated={this.onGraphCreated}
afterRender={this.afterRender}
handleModelParserData={this.handleModelParserData} handleModelParserData={this.handleModelParserData}
/> />
} }
......
...@@ -23,7 +23,8 @@ class taskTabs extends Component { ...@@ -23,7 +23,8 @@ class taskTabs extends Component {
tabs:[ tabs:[
{key:1, type:'person', icon:'person', models:[]}, {key:1, type:'person', icon:'person', models:[]},
{key:2, type:'car', icon:'car', models:[]} {key:2, type:'car', icon:'car', models:[]}
] ],
activeKey: '',
}; };
} }
...@@ -55,8 +56,8 @@ class taskTabs extends Component { ...@@ -55,8 +56,8 @@ class taskTabs extends Component {
} }
addTask = (animate) => { addTask = (animate) => {
let { tabs } = this.state; let { tabs,activeKey } = this.state;
activeKey = animate.target;
outerloop : outerloop :
for (let i = 0; i < tabs.length; i++) { for (let i = 0; i < tabs.length; i++) {
for (let j = 0; j < tabs[i].models.length; j++) { for (let j = 0; j < tabs[i].models.length; j++) {
...@@ -70,7 +71,7 @@ class taskTabs extends Component { ...@@ -70,7 +71,7 @@ class taskTabs extends Component {
} }
} }
} }
this.setState({ tabs }); this.setState({ tabs, activeKey});
} }
resetTaskTabs = () => { resetTaskTabs = () => {
...@@ -84,8 +85,8 @@ class taskTabs extends Component { ...@@ -84,8 +85,8 @@ class taskTabs extends Component {
} }
getTaskContent = () => { getTaskContent = () => {
const { tabs } = this.state; const { tabs, activeKey } = this.state;
return <Tabs defaultActiveKey="1" tabPosition="left"> return <Tabs defaultActiveKey={["1"]} tabPosition="left">
<TabList> <TabList>
{tabs.map(e => ( {tabs.map(e => (
<Tab tab={`Tab-${e.key}`} key={e.key}> <Tab tab={`Tab-${e.key}`} key={e.key}>
...@@ -98,9 +99,9 @@ class taskTabs extends Component { ...@@ -98,9 +99,9 @@ class taskTabs extends Component {
<TabPanel tab={`Tab-${tab.key}`} key={tab.key}> <TabPanel tab={`Tab-${tab.key}`} key={tab.key}>
<Collapse className='board-tasktab-all' activeKey={['1']}> <Collapse className='board-tasktab-all' activeKey={['1']}>
<Panel header='全部' key={'1'}> <Panel header='全部' key={'1'}>
<Collapse className='board-tasktab-part' accordion> <Collapse className='board-tasktab-part' activeKey={[activeKey]} accordion>
{tab.models && tab.models.map(model => { {tab.models && tab.models.map(model => {
return <Panel header={model.displayName} key={model.key}> return <Panel header={model.displayName} key={model.eid}>
<Timeline className='board-tasktab-timeLine'> <Timeline className='board-tasktab-timeLine'>
{model.tasks && model.tasks.map(task => { {model.tasks && model.tasks.map(task => {
return <Timeline.Item> return <Timeline.Item>
...@@ -125,10 +126,8 @@ class taskTabs extends Component { ...@@ -125,10 +126,8 @@ class taskTabs extends Component {
transitionAppear: true transitionAppear: true
}; };
const animateDelay = 0; const animateDelay = 0;
// if(taskTabsShow){
return ( return (
<SidePane
<SidePane
className='board-actuator-tasktab' className='board-actuator-tasktab'
animateName="fade" animateName="fade"
animateProps={animateProps} animateProps={animateProps}
......
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