Commit 623a983e authored by shanqiyun's avatar shanqiyun

优化任务列表,整理代码

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