Commit 66fddfdb authored by 单奇雲's avatar 单奇雲

修改页面展示逻辑

parent 044ada16
...@@ -207,6 +207,8 @@ export const FasSerUrl = { ...@@ -207,6 +207,8 @@ export const FasSerUrl = {
contingencyWaterUrl: completePrefix(baseURI, '/api/risksource/contingency/water'), contingencyWaterUrl: completePrefix(baseURI, '/api/risksource/contingency/water'),
configPointEquipmentUrl: completePrefix(baseURI, 'api/firequment/point/batch/bindToEquipment?deviceId={deviceId}&pointIds={pointIds}'), configPointEquipmentUrl: completePrefix(baseURI, 'api/firequment/point/batch/bindToEquipment?deviceId={deviceId}&pointIds={pointIds}'),
getPlanTreeUrl: completePrefix(baseURI, 'api/visual/plan/tree'),//获取预案树url getPlanTreeUrl: completePrefix(baseURI, 'api/visual/plan/tree'),//获取预案树url
getTextPlanTreeUrl: completePrefix(baseURI, 'api/visual/plan/textPlanTree/{appId}'),//获取预案树url
deleteTextPlanUrl: completePrefix(baseURI, 'api/visual/plan/textPlan/{id}'),//删除预案url
importExcelFireEquipmentUrl: completePrefix(baseURI, 'api/excel/import/fireEquipment'),//导入消防设备 importExcelFireEquipmentUrl: completePrefix(baseURI, 'api/excel/import/fireEquipment'),//导入消防设备
importExcelDataUrl: completePrefix(baseURI, 'api/excel/import/data/excel/{type}'),//导入excel数据type=['fireResource','water'] importExcelDataUrl: completePrefix(baseURI, 'api/excel/import/data/excel/{type}'),//导入excel数据type=['fireResource','water']
importExcelFireEquipmentPointUrl: completePrefix(baseURI, 'api/excel/import/fireEquipmentPoint'), importExcelFireEquipmentPointUrl: completePrefix(baseURI, 'api/excel/import/fireEquipmentPoint'),
...@@ -221,6 +223,7 @@ export const FasSerUrl = { ...@@ -221,6 +223,7 @@ export const FasSerUrl = {
getAllUserUrl: completePrefix(baseURI, 'api/common/user/list'),//获取所有用户 getAllUserUrl: completePrefix(baseURI, 'api/common/user/list'),//获取所有用户
queryFmeaControlObjUrl: completePrefix(baseURI, 'api/riskModel/fmea/{ids}/controlObjCount'),//根据fmea id查询关联对象个数 queryFmeaControlObjUrl: completePrefix(baseURI, 'api/riskModel/fmea/{ids}/controlObjCount'),//根据fmea id查询关联对象个数
queryTopographyUrl: completePrefix(baseURI, 'api/Topography/query/{type}/{appId}'),//获取Topo图数据 queryTopographyUrl: completePrefix(baseURI, 'api/Topography/query/{type}/{appId}'),//获取Topo图数据
queryTopographyByTypeUrl: completePrefix(baseURI, 'api/Topography/query/{type}'),//获取Topo图数据 type
updateTopographyUrl: completePrefix(baseURI, 'api/Topography/updateTopo'),//更新Topo图数据 updateTopographyUrl: completePrefix(baseURI, 'api/Topography/updateTopo'),//更新Topo图数据
queryNodeDetailUrl: completePrefix(baseURI, 'api/Topography/detail/{id}'),//获取node节点详情 queryNodeDetailUrl: completePrefix(baseURI, 'api/Topography/detail/{id}'),//获取node节点详情
saveNodeDetailUrl:completePrefix(baseURI, 'api/Topography/detail'),//保存nodeDetail详情 saveNodeDetailUrl:completePrefix(baseURI, 'api/Topography/detail'),//保存nodeDetail详情
......
...@@ -12,6 +12,7 @@ import PlanDrill from './../view/planMgmt/view/PlanDrill'; ...@@ -12,6 +12,7 @@ import PlanDrill from './../view/planMgmt/view/PlanDrill';
import LeaderStruct from './../view/planMgmt/view/leaderStruct'; import LeaderStruct from './../view/planMgmt/view/leaderStruct';
import PubView from './../view/planMgmt/view/pubview'; import PubView from './../view/planMgmt/view/pubview';
import PublishView from './../view/planMgmt/view';
/** /**
...@@ -27,11 +28,17 @@ export const customRoutes = [ ...@@ -27,11 +28,17 @@ export const customRoutes = [
{ path: 'differentiateDetail', parent: 'biz', component: DifferentiateDetail }, { path: 'differentiateDetail', parent: 'biz', component: DifferentiateDetail },
{ path: 'leaderStruct', parent: 'biz', component: LeaderStruct }, { path: 'leaderStruct', parent: 'biz', component: LeaderStruct },
// { path: 'pubview', parent: 'planDrill', component: PlanDrill }, // { path: 'pubview', parent: 'planDrill', component: PlanDrill },
{ path: 'pubview', parent: 'planDrill', component: PubView }, // { path: 'pubview', parent: 'planDrill', component: PubView },
{ path: 'textview', parent: 'planDrill', component: TextPlan }, // { path: 'textview', parent: 'planDrill', component: TextPlan },
...parseCusotmRoutes() ...parseCusotmRoutes()
]; ];
export const planChildrenRoutes = {
path: 'planDrill', component: PublishView, childRoutes: [
{ path: 'pubview', component: PubView },
{ path: 'textview', component: TextPlan }
]};
/** /**
* path mapping * path mapping
......
...@@ -7,7 +7,7 @@ import routerFilter, { checkLogin } from 'amos-security/lib/routes/validateRoute ...@@ -7,7 +7,7 @@ import routerFilter, { checkLogin } from 'amos-security/lib/routes/validateRoute
import PublishView from './../view/planMgmt/view'; import PublishView from './../view/planMgmt/view';
import AutoLogin from './../view/autoLogin/AutoLogin'; import AutoLogin from './../view/autoLogin/AutoLogin';
import calcRoutes from './calcRoutes'; import calcRoutes from './calcRoutes';
import addCustomRoutes, { customRoutes, customRoutesPubView } from './customRoutes'; import addCustomRoutes, { customRoutes, planChildrenRoutes } from './customRoutes';
import pageCompontent, { import pageCompontent, {
RootView, RootView,
Login, Login,
...@@ -19,7 +19,8 @@ import pageCompontent, { ...@@ -19,7 +19,8 @@ import pageCompontent, {
import Iot3DGraphBiz from './../view/planMgmt/iot3DGraph'; import Iot3DGraphBiz from './../view/planMgmt/iot3DGraph';
import ShareTextPlan from './../view/planMgmt/view/ShareTextPlan'; import ShareTextPlan from './../view/planMgmt/view/ShareTextPlan';
import PubView from './../view/planMgmt/view/pubview';
import TextPlan from './../view/planMgmt/view/TextPlan';
const groups = [ const groups = [
'main', 'biz', 'console', 'ruleConfig' 'main', 'biz', 'console', 'ruleConfig'
...@@ -34,7 +35,12 @@ const injectRoutes = menus => { ...@@ -34,7 +35,12 @@ const injectRoutes = menus => {
{ {
path: 'viz3d/:subjectId', path: 'viz3d/:subjectId',
component: Iot3DGraphBiz component: Iot3DGraphBiz
}, },
// {
// path: 'viz3dpub',
// component: PublishView,
// childRoutes: [...customRoutesPubView]
// },
{ path: 'login', component: Login }, { path: 'login', component: Login },
{ path: 'autologin', component: AutoLogin }, { path: 'autologin', component: AutoLogin },
{ path: 'region', component: RegionList }, // 区域选择 { path: 'region', component: RegionList }, // 区域选择
...@@ -51,7 +57,9 @@ const injectRoutes = menus => { ...@@ -51,7 +57,9 @@ const injectRoutes = menus => {
{ {
path: 'biz', path: 'biz',
component: RootBizView, component: RootBizView,
childRoutes: [...bizChilds, ...customRoutes] childRoutes: [...bizChilds, ...customRoutes,
planChildrenRoutes
]
}, },
{ {
path: 'console', path: 'console',
......
...@@ -55,6 +55,7 @@ import CusVizLib from './../view/planMgmt/cusVizLib'; ...@@ -55,6 +55,7 @@ import CusVizLib from './../view/planMgmt/cusVizLib';
import RealTimeMonitor from './../view/morphic'; import RealTimeMonitor from './../view/morphic';
import PublishView from './../view/planMgmt/view'; import PublishView from './../view/planMgmt/view';
import ModelManage from './../view/planMgmt/modelManage'; import ModelManage from './../view/planMgmt/modelManage';
import LeaderStruct from './../view/planMgmt/view/leaderStruct';
const Routes = { const Routes = {
// 添加 rules 路由 // 添加 rules 路由
...@@ -108,8 +109,9 @@ const Routes = { ...@@ -108,8 +109,9 @@ const Routes = {
alarmVideoMonitor: AlarmVideoMonitor, alarmVideoMonitor: AlarmVideoMonitor,
alarmTest: alarmTestView, alarmTest: alarmTestView,
vizlib: CusVizLib, vizlib: CusVizLib,
planDrill: PublishView, // planDrill: PublishView,
modelManage: ModelManage modelManage: ModelManage,
leaderStruct: LeaderStruct
}; };
const pageCompontent = key => { const pageCompontent = key => {
......
...@@ -202,6 +202,13 @@ export const queryTopographyAction = (type,appId) => { ...@@ -202,6 +202,13 @@ export const queryTopographyAction = (type,appId) => {
}; };
/** /**
* 获取节点by type
*/
export const queryTopographyByTypeAction = (type) => {
return commonGet(formatUrl(FasSerUrl.queryTopographyByTypeUrl,{ type }));
};
/**
* 更新节点 * 更新节点
*/ */
export const updateTopographyAction = (params) => { export const updateTopographyAction = (params) => {
...@@ -227,4 +234,16 @@ export const nodeDetailTopoSaveAction = (nodeDatil) => { ...@@ -227,4 +234,16 @@ export const nodeDetailTopoSaveAction = (nodeDatil) => {
*/ */
export const deleteTopoAction = (id, type) => { export const deleteTopoAction = (id, type) => {
return commonDelete(formatUrl(FasSerUrl.deleteTopoUrl, { id, type })); return commonDelete(formatUrl(FasSerUrl.deleteTopoUrl, { id, type }));
}; };
\ No newline at end of file /**
* 获取指定预案文件
*/
export const getTextPlanTreeAction = (appId) => {
return commonGet(formatUrl(FasSerUrl.getTextPlanTreeUrl, { appId }));
};
/**
* 删除预案文件
*/
export const deleteTextPlanAction = (id) => {
return commonDelete(formatUrl(FasSerUrl.deleteTextPlanUrl, { id }));
};
...@@ -12,25 +12,47 @@ ...@@ -12,25 +12,47 @@
border-width: 1px; border-width: 1px;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.tool-bar-button {
vertical-align: baseline;
}
.header-left { .header-left {
flex-grow: 1;
line-height: 42px; line-height: 42px;
.tool-bar-button {
vertical-align: baseline;
}
.header-name { .header-name {
padding-left: 20px; padding-left: 20px;
font-size: 15px; font-size: 15px;
} }
.header-add-button{
float: right;
padding-right: 15px;
.leader-struct-add-button{
width: 8.5rem;
height: 2.5rem;
color: black;
padding: 0px;
background-color: #f8f8f8;
border-color: #c6c6c6;
border: 1px solid #ccc;
vertical-align: baseline;
}
}
} }
.tool-bar-root { .tool-bar-root {
float: right; width: 300px;
margin-right: 5px;
.amos-button-bar-group{
float: right;
}
} }
} }
.leader-struct-content { .leader-struct-content {
...@@ -50,7 +72,8 @@ ...@@ -50,7 +72,8 @@
} }
.leader-struct-diagram{ .leader-struct-diagram{
height: 90%; // height: 90%;
height: 100%;
} }
.tooltip-content { .tooltip-content {
......
export const headerButton = [ export const headerButton = [
// { key: 'back', text: '返回', icon: 'fanhui' }, { key: 'back', text: '返回', icon: 'fanhui' },
{ key: 'onOff', text: '显示窗', icon: 'yuan1' }, // { key: 'onOff', text: '显示窗', icon: 'yuan1' },
{ key: 'planDrill', text: '预案演练', icon: 'yuan1' }, // { key: 'planDrill', text: '预案演练', icon: 'yuan1' },
{ key: 'textPlan', text: '文字预案', icon: 'jiuyuanjiagou' }, { key: 'textPlan', text: '文字预案', icon: 'jiuyuanjiagou' },
{ key: 'textPlanUpload', text: '预案上传', icon: 'daochu' },
{ key: 'taskList', text: '任务列表', icon: 'renwuliebiao' }, { key: 'taskList', text: '任务列表', icon: 'renwuliebiao' },
]; ];
......
...@@ -20,7 +20,7 @@ const uploadUrl = FasSerUrl.uploadTextPlan; ...@@ -20,7 +20,7 @@ const uploadUrl = FasSerUrl.uploadTextPlan;
const extraMenus = [ const extraMenus = [
{ key: 'preview', text: '预览', icon: 'eye' }, { key: 'preview', text: '预览', icon: 'eye' },
{ key: 'textImport', text: '文字预案', icon: 'totop1' }, { key: 'textImport', text: '文字预案', icon: 'totop1' },
{ key: 'leaderStruct', text: '领导架构', icon: 'user' } // { key: 'leaderStruct', text: '领导架构', icon: 'user' }
]; ];
/** /**
......
...@@ -2,9 +2,12 @@ import React, { Component } from 'react'; ...@@ -2,9 +2,12 @@ import React, { Component } from 'react';
import { Tree, message } from 'amos-framework'; import { Tree, message } from 'amos-framework';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classnames from 'classnames'; import classnames from 'classnames';
import { getPlanTreeAction } from './../../../services/preControlService'; import _amosTool, { fastDeepEqual } from 'amos-tool';
import { getPlanTreeAction, getTextPlanTreeAction } from './../../../services/preControlService';
import BizIcon from './../../common/icon/BizIcon'; import BizIcon from './../../common/icon/BizIcon';
import { eventTopics } from './../../3dview/consts';
const ls = _amosTool.Store.lsTool;
const TreeNode = Tree.TreeNode; const TreeNode = Tree.TreeNode;
class PlanTreeView extends Component { class PlanTreeView extends Component {
...@@ -27,6 +30,9 @@ class PlanTreeView extends Component { ...@@ -27,6 +30,9 @@ class PlanTreeView extends Component {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
console.log('plan tree view~~~~~~~~~~~'); console.log('plan tree view~~~~~~~~~~~');
if (!fastDeepEqual(this.props.selectAppId, nextProps.selectAppId)) {
this.setState({selectedKeys: [`textNode-${nextProps.selectAppId}`]})
}
} }
onTreeItemSelect = (selectedKeys, info) => { onTreeItemSelect = (selectedKeys, info) => {
...@@ -60,10 +66,22 @@ class PlanTreeView extends Component { ...@@ -60,10 +66,22 @@ class PlanTreeView extends Component {
} }
getPlanTree() { getPlanTree() {
getPlanTreeAction().then(data => { // getPlanTreeAction().then(data => {
this.setState({ treeData: data },()=>{ // this.setState({ treeData: data },()=>{
this.defaultOpen(); // this.defaultOpen();
}); // });
// });
const curAppId = ls.read(eventTopics.plan_drill_appId);
getTextPlanTreeAction(curAppId).then(data => {
if(data){
this.setState({ treeData: data },()=>{
if(data.length > 0){
this.defaultOpen();
}else{
message.danger('暂无文本预案!');
}
});
}
}); });
} }
...@@ -71,7 +89,7 @@ class PlanTreeView extends Component { ...@@ -71,7 +89,7 @@ class PlanTreeView extends Component {
let { treeData } = this.state; let { treeData } = this.state;
let { onTreeSelect, selectAppId } = this.props; let { onTreeSelect, selectAppId } = this.props;
let defaultOpenPlan = {}; let defaultOpenPlan = {};
if(selectAppId != ''){ if( selectAppId != '' && selectAppId != undefined ){
this.findTreeNodesById(treeData,selectAppId); this.findTreeNodesById(treeData,selectAppId);
if(this.state.selectData != undefined){ if(this.state.selectData != undefined){
defaultOpenPlan = this.state.selectData; defaultOpenPlan = this.state.selectData;
...@@ -103,7 +121,7 @@ class PlanTreeView extends Component { ...@@ -103,7 +121,7 @@ class PlanTreeView extends Component {
outerloop : outerloop :
for (let i = 0; i < arrData.length; i++) { for (let i = 0; i < arrData.length; i++) {
const e = arrData[i]; const e = arrData[i];
if(e.id == selectAppId){ if(e.parentId == selectAppId || e.id == selectAppId){ //selectAppId 为appId || 文本id
this.state.selectData = e; this.state.selectData = e;
break outerloop; break outerloop;
}else if(e.children && e.children.length > 0){ }else if(e.children && e.children.length > 0){
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { browserHistory } from 'amos-react-router'; import { browserHistory } from 'amos-react-router';
import { SidePane, Button, Modal, message } from 'amos-framework'; import { SidePane, Button, Modal, message, AmosAlert } from 'amos-framework';
import { headerButton, pageUrl } from './../common/conf'; import { headerButton, pageUrl } from './../common/conf';
import PlanTreeView from './../treeView/PlanTreeView'; import PlanTreeView from './../treeView/PlanTreeView';
import TextButton from './../common/TextButton'; import TextButton from './../common/TextButton';
import BizIcon from './../../common/icon/BizIcon'; import BizIcon from './../../common/icon/BizIcon';
import { textPlanDownloadFileAction } from './../../../services/preControlService'; import { textPlanDownloadFileAction, deleteTextPlanAction } from './../../../services/preControlService';
import formatUrl from 'amos-processor/lib/utils/urlFormat'; import formatUrl from 'amos-processor/lib/utils/urlFormat';
import SysConsts from 'amos-processor/lib/config/consts';
import { FasSerUrl } from 'CONSTS/urlConsts'; import { FasSerUrl } from 'CONSTS/urlConsts';
import _amosTool from 'amos-tool'; import _amosTool, { fastDeepEqual } from 'amos-tool';
import { PubSub } from 'ray-eventpool'; import { PubSub } from 'ray-eventpool';
import { eventTopics } from './../../3dview/consts'; import { eventTopics } from './../../3dview/consts';
import Upload from './../common/upload';
const ls = _amosTool.Store.lsTool; const ls = _amosTool.Store.lsTool;
const apiKey = SysConsts.api_key;
const token = SysConsts.token;
const uploadUrl = FasSerUrl.uploadTextPlan;
const sidePaneStyle = { const sidePaneStyle = {
planDrill: { planDrill: {
...@@ -53,18 +58,18 @@ class PublishView extends Component { ...@@ -53,18 +58,18 @@ class PublishView extends Component {
this.state = { this.state = {
activeKey: 'planDrill', activeKey: 'planDrill',
params: {}, params: {},
visible: true, visible: false,
animateDelay: 0, animateDelay: 0,
rightClickNodeTreeItem: null, rightClickNodeTreeItem: null,
node: {}, node: {},
shareVisible: false, shareVisible: false,
taskTabsShow: false,//任务列表 taskTabsShow: true,//任务列表
selectAppId: '', selectAppId: '',
}; };
} }
componentWillMount(){ componentWillMount(){
// this.setState({ params: this.props.location.state }); this.setState({ params: this.props.location.state });
} }
componentDidMount(){ componentDidMount(){
...@@ -72,19 +77,33 @@ class PublishView extends Component { ...@@ -72,19 +77,33 @@ class PublishView extends Component {
viewRootDiv && viewRootDiv.addEventListener('click', this._handleClick);//页面增加鼠标单击监听 viewRootDiv && viewRootDiv.addEventListener('click', this._handleClick);//页面增加鼠标单击监听
window.addEventListener('resize', this._resize); window.addEventListener('resize', this._resize);
//预案树展示 //预案树展示
this.planTreePubsub = PubSub.subscribe(eventTopics.plan_tree_view,function(topic,message){ // this.planTreePubsub = PubSub.subscribe(eventTopics.plan_tree_view,function(topic,message){
this.setState({ visible: message }) // this.setState({ visible: message })
}.bind(this)); // }.bind(this));
//获取选择预案树节点 //获取选择预案树节点
this.setState({ selectAppId: ls.read(eventTopics.plan_drill_appId) }); this.setState({ selectAppId: ls.read(eventTopics.plan_drill_appId) });
console.log(ls.read(eventTopics.plan_drill_appId));
} }
componentWillUnmount(){ componentWillUnmount(){
let viewRootDiv = document.getElementsByClassName('publish-view-content')[0]; let viewRootDiv = document.getElementsByClassName('publish-view-content')[0];
viewRootDiv && viewRootDiv.addEventListener('click', this._handleClick);//页面增加鼠标单击监听 viewRootDiv && viewRootDiv.addEventListener('click', this._handleClick);//页面增加鼠标单击监听
window.addEventListener('resize', this._resize); window.addEventListener('resize', this._resize);
PubSub.unsubscribe(this.planTreePubsub); // PubSub.unsubscribe(this.planTreePubsub);
ls.write(eventTopics.plan_drill_appId,''); // ls.write(eventTopics.plan_drill_appId,'');
}
componentWillReceiveProps(nextProps) {
if (fastDeepEqual('/biz/planDrill/pubview', nextProps.location.pathname)) {
console.log('receive',ls.read(eventTopics.plan_drill_appId))
this.setState({
activeKey: 'planDrill',
visible: false,
selectAppId: ls.read(eventTopics.plan_drill_appId)
})
}else{
this.setState({ selectAppId: nextProps.location.state.appId })
}
} }
_handleClick = (event) => { _handleClick = (event) => {
...@@ -108,11 +127,18 @@ class PublishView extends Component { ...@@ -108,11 +127,18 @@ class PublishView extends Component {
getSidePaneContent = (activeKey) => { getSidePaneContent = (activeKey) => {
const { selectAppId } = this.state; const { selectAppId } = this.state;
return <PlanTreeView activeKey={activeKey} selectAppId={selectAppId} onTreeSelect={this.onTreeSelect} onRightClick={this.onRightClick} onRightCancel={this._handleClick}/>; return <PlanTreeView
activeKey={activeKey}
selectAppId={selectAppId}
onTreeSelect={this.onTreeSelect}
onRightClick={this.onRightClick}
onRightCancel={this._handleClick}
ref={node => this.planTree = node}
/>;
} }
handleChange = (activeKey) => { handleChange = (activeKey) => {
const { params } = this.state; let { params } = this.state;
let $path = {}; let $path = {};
switch (activeKey){ switch (activeKey){
case 'planDrill': case 'planDrill':
...@@ -120,11 +146,11 @@ class PublishView extends Component { ...@@ -120,11 +146,11 @@ class PublishView extends Component {
pathname: pageUrl.planDrill, pathname: pageUrl.planDrill,
state: { ...params } state: { ...params }
}; };
if(this.state.taskTabsShow) { // if(this.state.taskTabsShow) {
this.state.taskTabsShow = false; // this.state.taskTabsShow = false;
PubSub.publish(eventTopics.plan_task_list,this.state.taskTabsShow); // PubSub.publish(eventTopics.plan_task_list,this.state.taskTabsShow);
} // }
this.setState({ activeKey,visible: true, taskTabsShow: this.state.taskTabsShow }); this.setState({ activeKey,visible: false ,taskTabsShow: this.state.taskTabsShow});
browserHistory.push($path); browserHistory.push($path);
break; break;
case 'textPlan': case 'textPlan':
...@@ -132,24 +158,26 @@ class PublishView extends Component { ...@@ -132,24 +158,26 @@ class PublishView extends Component {
pathname: pageUrl.textPlan, pathname: pageUrl.textPlan,
state: { ...params } state: { ...params }
}; };
this.setState({ activeKey,visible: true }); this.setState({ activeKey,visible: true , selectAppId : ls.read(eventTopics.plan_drill_appId)});
browserHistory.push($path); browserHistory.push($path);
break; break;
case 'back': case 'back':
browserHistory.push(pageUrl.back); browserHistory.goBack();
break;
case 'onOff':
if(this.state.taskTabsShow) {
this.state.taskTabsShow = false;
PubSub.publish(eventTopics.plan_task_list,this.state.taskTabsShow);
}
this.setState({ visible: !this.state.visible, taskTabsShow: this.state.taskTabsShow });
break; break;
// case 'onOff':
// if(this.state.taskTabsShow) {
// this.state.taskTabsShow = false;
// PubSub.publish(eventTopics.plan_task_list,this.state.taskTabsShow);
// }
// this.setState({ visible: !this.state.visible, taskTabsShow: this.state.taskTabsShow });
// break;
case 'taskList': //任务列表 case 'taskList': //任务列表
if(this.state.visible) this.state.visible = false; if(this.state.visible) this.state.visible = false;
PubSub.publish(eventTopics.plan_task_list,!this.state.taskTabsShow); PubSub.publish(eventTopics.plan_task_list,!this.state.taskTabsShow);
this.setState({ visible: this.state.visible, taskTabsShow: !this.state.taskTabsShow }); this.setState({ visible: this.state.visible, taskTabsShow: !this.state.taskTabsShow });
break; break;
case 'textPlanUpload':
this.setState({ uploadVisible: true });
default: default:
break; break;
} }
...@@ -166,7 +194,7 @@ class PublishView extends Component { ...@@ -166,7 +194,7 @@ class PublishView extends Component {
return <TextButton key={e.key} {...e} onClick={()=>this.handleChange(e.key)} />; return <TextButton key={e.key} {...e} onClick={()=>this.handleChange(e.key)} />;
}); });
} else { } else {
return headerButton.map(e=>{ return headerButton.filter(item => item.key!== 'textPlanUpload').map(e=>{
return <TextButton key={e.key} {...e} onClick={()=>this.handleChange(e.key)} />; return <TextButton key={e.key} {...e} onClick={()=>this.handleChange(e.key)} />;
}); });
} }
...@@ -188,7 +216,7 @@ class PublishView extends Component { ...@@ -188,7 +216,7 @@ class PublishView extends Component {
onButtonClick = (value) => { onButtonClick = (value) => {
const { id } = this.state.node; const { id } = this.state.node;
console.log(id,"treeId") console.log(id,"treeId")
if (value === '1') { if (value === 'daochu') {
let a = document.createElement('a'); let a = document.createElement('a');
fetch(formatUrl(FasSerUrl.textPlanDownloadFile,{ id }), { fetch(formatUrl(FasSerUrl.textPlanDownloadFile,{ id }), {
method: 'get', method: 'get',
...@@ -200,8 +228,15 @@ class PublishView extends Component { ...@@ -200,8 +228,15 @@ class PublishView extends Component {
message.danger("导出错误,文件不存在!") message.danger("导出错误,文件不存在!")
} }
}); });
} else if (value === '2') { } else if (value === 'fenxiang') {
this.setState({ shareVisible: true }); this.setState({ shareVisible: true });
}else if (value === 'shanchu') {
deleteTextPlanAction(id).then(data => {
message.success('删除成功');
this.planTree.getPlanTree();
}).catch( e=> {
message.danger('删除失败');
})
} }
this.setState({ rightClickNodeTreeItem: null }); this.setState({ rightClickNodeTreeItem: null });
} }
...@@ -217,15 +252,16 @@ class PublishView extends Component { ...@@ -217,15 +252,16 @@ class PublishView extends Component {
top: `${pageY - 45}px`, top: `${pageY - 45}px`,
backgroundColor: '#ffffff', backgroundColor: '#ffffff',
border: 'solid', border: 'solid',
height: '70px', height: '105px',
borderWidth: '1px', borderWidth: '1px',
borderColor: '#c9c9c9', borderColor: '#c9c9c9',
zIndex: '9999' zIndex: '9999'
}; };
const menu = ( const menu = (
<div style={tmpStyle}> <div style={tmpStyle}>
<Button icon={<BizIcon icon="daochu" />} type="button" onClick={()=>this.onButtonClick('1')} className='risk-model-button' transparent>导出</Button> <Button icon={<BizIcon icon="daochu" />} type="button" onClick={()=>this.onButtonClick('daochu')} className='risk-model-button' transparent>导出</Button>
<Button icon={<BizIcon icon="fenxiang" />} onClick={()=>this.onButtonClick('2')} className='risk-model-button' transparent>分享</Button> <Button icon={<BizIcon icon="fenxiang" />} onClick={()=>this.onButtonClick('fenxiang')} className='risk-model-button' transparent>分享</Button>
<Button icon={<BizIcon icon="shanchu" />} onClick={()=>this.onButtonClick('shanchu')} className='risk-model-button' transparent>删除</Button>
</div> </div>
); );
return this.state.rightClickNodeTreeItem ? menu : ''; return this.state.rightClickNodeTreeItem ? menu : '';
...@@ -281,12 +317,47 @@ class PublishView extends Component { ...@@ -281,12 +317,47 @@ class PublishView extends Component {
cancel = () => { cancel = () => {
this.setState({ this.setState({
shareVisible: false shareVisible: false,
uploadVisible: false
}); });
} }
getUploadContent =()=>{
return <Upload onCommit={this.onOk} ref={node => this.upload = node} />;
}
onOk =()=>{
const appId = ls.read(eventTopics.plan_drill_appId);
const { fileList } = this.upload.state;
if (fileList.length > 0) {
let formData = new FormData();
fileList.forEach((file, i) =>{
formData.append('files', file['file']);
});
let url = formatUrl(uploadUrl,{ appId });
fetch(url, {
method: 'post',
headers: {
'Accept': 'application/json;charset=UTF-8',
'X-Api-Key': _amosTool.Store.getCookieByName(apiKey),
'X-Access-Token': ls.read(token)
},
body: formData
}).then(e => {
AmosAlert.success('提示', '保存成功',{
callback: ()=>{
this.cancel();
this.planTree.getPlanTree();
}
});
}).catch(e => {
AmosAlert.error('错误', '保存失败');
});
}
}
render() { render() {
const { activeKey,visible,animateDelay,shareVisible } = this.state; const { activeKey,visible,animateDelay,shareVisible,uploadVisible } = this.state;
const animateProps = { const animateProps = {
transitionAppear: true transitionAppear: true
}; };
...@@ -297,7 +368,6 @@ class PublishView extends Component { ...@@ -297,7 +368,6 @@ class PublishView extends Component {
{this.renderButton(activeKey)} {this.renderButton(activeKey)}
</div> </div>
<SidePane <SidePane
// className={`publish-view-side plan-tree-${activeKey}`}
className={`publish-view-side plan-tree-${activeKey}`} className={`publish-view-side plan-tree-${activeKey}`}
animateName="fade" animateName="fade"
animateProps={animateProps} animateProps={animateProps}
...@@ -320,6 +390,14 @@ class PublishView extends Component { ...@@ -320,6 +390,14 @@ class PublishView extends Component {
content={visible && this.getShareContent()} content={visible && this.getShareContent()}
noDefaultFooter noDefaultFooter
/> />
<Modal
header="预案上传"
visible={uploadVisible}
destroyContent
onOk={this.onOk}
onCancel={this.cancel}
content={uploadVisible && this.getUploadContent()}
/>
</div> </div>
); );
} }
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { browserHistory } from 'amos-react-router'; import { browserHistory } from 'amos-react-router';
import { Modal, Button, message, AmosAlert } from 'amos-framework'; import { Modal, Button, message, AmosAlert } from 'amos-framework';
import BizIcon from './../../../common/icon/BizIcon'; import BizIcon from './../../../common/icon/BizIcon';
import ToolBar from './ToolBar'; import ToolBar from './ToolBar';
import go from 'amos-gojs'; import go from 'amos-gojs';
import { queryTopographyAction, updateTopographyAction, nodeDetailTopoAction, deleteTopoAction } from './../../../../services/preControlService'; import { queryTopographyAction, queryTopographyByTypeAction, updateTopographyAction, nodeDetailTopoAction, deleteTopoAction } from './../../../../services/preControlService';
import LeaderStructModel from './LeaderStructModel'; import LeaderStructModel from './LeaderStructModel';
import LeaderStructRightGrid from './LeaderStructRightGrid'; import LeaderStructRightGrid from './LeaderStructRightGrid';
...@@ -30,6 +29,7 @@ class LeaderStruct extends Component { ...@@ -30,6 +29,7 @@ class LeaderStruct extends Component {
selectNodeType: '', selectNodeType: '',
rightGridData: [], rightGridData: [],
type: '1',//topo 类型 1 领导架构 type: '1',//topo 类型 1 领导架构
addNodeLoc: {x: 0 , y: 0},
}; };
this.diagram = null; //gojs图 this.diagram = null; //gojs图
this.myPalette = null; //工具栏 this.myPalette = null; //工具栏
...@@ -37,12 +37,16 @@ class LeaderStruct extends Component { ...@@ -37,12 +37,16 @@ class LeaderStruct extends Component {
} }
componentDidMount() { componentDidMount() {
let { appId } = this.props.location.state; // let { appId } = this.props.location.state;
this.fetchData(appId); this.fetchData();
} }
fetchData = (appId) => { fetchData = () => {
queryTopographyAction(this.state.type, appId).then(res =>{ // queryTopographyAction(this.state.type, appId).then(res =>{
// this.setState({nodeData: res.nodeData , linkData: res.linkData })
// this.renderCanvas();
// });
queryTopographyByTypeAction(this.state.type).then(res =>{
this.setState({nodeData: res.nodeData , linkData: res.linkData }) this.setState({nodeData: res.nodeData , linkData: res.linkData })
this.renderCanvas(); this.renderCanvas();
}); });
...@@ -154,7 +158,7 @@ class LeaderStruct extends Component { ...@@ -154,7 +158,7 @@ class LeaderStruct extends Component {
}); });
this.diagram = goObj(go.Diagram, this.refs.goJsDiv, { this.diagram = goObj(go.Diagram, this.refs.goJsDiv, {
contentAlignment: go.Spot.Center, initialContentAlignment: go.Spot.TopLeft,
initialPosition: new go.Point(0, 0), initialPosition: new go.Point(0, 0),
'undoManager.isEnabled': true, //// enable undo & redo 是否可撤回 'undoManager.isEnabled': true, //// enable undo & redo 是否可撤回
'animationManager.isEnabled': false, // 过渡动画 'animationManager.isEnabled': false, // 过渡动画
...@@ -225,15 +229,15 @@ class LeaderStruct extends Component { ...@@ -225,15 +229,15 @@ class LeaderStruct extends Component {
linkDataArray: linkData || [] linkDataArray: linkData || []
}); });
this.myPalette = // this.myPalette =
goObj(go.Palette, this.refs.myPaletteDiv, // goObj(go.Palette, this.refs.myPaletteDiv,
{ // {
nodeTemplateMap: this.diagram.nodeTemplateMap, // share the templates used by myDiagram // nodeTemplateMap: this.diagram.nodeTemplateMap, // share the templates used by myDiagram
model: new go.GraphLinksModel([ // specify the contents of the Palette // model: new go.GraphLinksModel([ // specify the contents of the Palette
{ category: "leaderStruct", text: "节点", isPalette: true } // { category: "leaderStruct", text: "节点", isPalette: true }
] // ]
) // )
}); // });
} }
onButtonClick = (key)=>{ onButtonClick = (key)=>{
...@@ -258,16 +262,27 @@ class LeaderStruct extends Component { ...@@ -258,16 +262,27 @@ class LeaderStruct extends Component {
}else{ }else{
message.danger('请选择节点!'); message.danger('请选择节点!');
} }
}else if(key === 'addNode'){
this.addTopoNode();
}else{ }else{
console.log('暂未开发'); console.log('暂未开发');
} }
this.setState({toolBarFlag: key}); this.setState({toolBarFlag: key});
} }
addTopoNode = () => {
let { addNodeLoc } = this.state;
addNodeLoc.x += 15;
addNodeLoc.y += 15;
let node = {category: "leaderStruct", text: "节点", loc: `${addNodeLoc.x} ${addNodeLoc.y}`};
this.diagram.model.addNodeData(node);
this.setState({ addNodeLoc })
}
saveTopography = (nodeDetail) => { saveTopography = (nodeDetail) => {
const { nodeDataArray,linkDataArray } = this.updateTopologyData; const { nodeDataArray,linkDataArray } = this.updateTopologyData;
const params = { const params = {
appId: this.props.location.state.appId, // appId: this.props.location.state.appId,
type: this.state.type, type: this.state.type,
nodeData: nodeDataArray, nodeData: nodeDataArray,
linkData: linkDataArray, linkData: linkDataArray,
...@@ -303,12 +318,12 @@ class LeaderStruct extends Component { ...@@ -303,12 +318,12 @@ class LeaderStruct extends Component {
if (toolBarFlag) { if (toolBarFlag) {
if (toolBarFlag === 'edit') { //编辑 if (toolBarFlag === 'edit') { //编辑
return <LeaderStructModel return <LeaderStructModel
cancel={this.cancel} cancel={this.cancel}
selectNode={selectNode} selectNode={selectNode}
reloadSelectNode={this.reloadSelectNode} reloadSelectNode={this.reloadSelectNode}
saveTopography={this.saveTopography} saveTopography={this.saveTopography}
ref={component => this.model = component} ref={component => this.model = component}
/>; />;
} }
} }
}; };
...@@ -329,12 +344,16 @@ class LeaderStruct extends Component { ...@@ -329,12 +344,16 @@ class LeaderStruct extends Component {
<div className='header-left'> <div className='header-left'>
<Button className='tool-bar-button' transparent icon={<BizIcon icon='fanhui' />} onClick={()=>this.onButtonClick('goback')} /> <Button className='tool-bar-button' transparent icon={<BizIcon icon='fanhui' />} onClick={()=>this.onButtonClick('goback')} />
<span className='header-name' >领导架构</span> <span className='header-name' >领导架构</span>
<div className='header-add-button'>
<Button className='leader-struct-add-button' icon={<BizIcon icon='tianjia' />} onClick={()=>this.onButtonClick('addNode')} >新增节点</Button>
</div>
</div> </div>
<ToolBar onClick={this.onButtonClick} /> <ToolBar onClick={this.onButtonClick} />
</div> </div>
<div className='leader-struct-content'> <div className='leader-struct-content'>
<div className='leader-struct-left'> <div className='leader-struct-left'>
<div ref="myPaletteDiv" className='leader-struct-palette' id = "myPaletteDiv"/> {/* 工具栏 */}
{/* <div ref="myPaletteDiv" className='leader-struct-palette' id = "myPaletteDiv"/> */}
<div ref="goJsDiv" className='leader-struct-diagram'/> <div ref="goJsDiv" className='leader-struct-diagram'/>
{this.renderDetail()} {this.renderDetail()}
</div> </div>
......
...@@ -170,7 +170,7 @@ class StageActuator extends Component { ...@@ -170,7 +170,7 @@ class StageActuator extends Component {
//展开任务列表 //展开任务列表
PubSub.publish(eventTopics.plan_task_list,true); PubSub.publish(eventTopics.plan_task_list,true);
//收起预案树 //收起预案树
PubSub.publish(eventTopics.plan_tree_view,false); // PubSub.publish(eventTopics.plan_tree_view,false);
} }
playTargetAnimate = (anim, e) => { playTargetAnimate = (anim, e) => {
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { LocationParam, utils, fastDeepEqual } from 'amos-tool'; import _amosTool , { LocationParam, utils, fastDeepEqual } from 'amos-tool';
import ActuatorContainer from './ActuatorContainer'; import ActuatorContainer from './ActuatorContainer';
import { eventTopics } from './../../../3dview/consts';
const ls = _amosTool.Store.lsTool;
/** /**
* 三维可视化 发布模式 * 三维可视化 发布模式
...@@ -50,7 +53,10 @@ class Pubview extends Component { ...@@ -50,7 +53,10 @@ class Pubview extends Component {
render() { render() {
const { shouldRender } = this.state; const { shouldRender } = this.state;
const params = this.calcParams(); const params = this.calcParams();
const { appId } = params || {}; let { appId } = params || {};
if(appId == undefined){
appId = ls.read(eventTopics.plan_drill_appId);
}
if (shouldRender){ if (shouldRender){
return ( return (
<div className="publish-view"> <div className="publish-view">
......
...@@ -119,7 +119,7 @@ class PlayMenuBar extends Component { ...@@ -119,7 +119,7 @@ class PlayMenuBar extends Component {
className={`tip-control-panel`} className={`tip-control-panel`}
left={false} left={false}
top={false} top={false}
animateName="slide-down" animateName="slide-up"
visible={tulieActive} visible={tulieActive}
animateProps={animateProps} animateProps={animateProps}
> >
......
...@@ -19,7 +19,7 @@ class taskTabs extends Component { ...@@ -19,7 +19,7 @@ class taskTabs extends Component {
constructor(props){ constructor(props){
super(props); super(props);
this.state = { this.state = {
taskTabsShow: false, taskTabsShow: true,
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:[]}
......
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