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

修改页面展示逻辑

parent 044ada16
......@@ -207,6 +207,8 @@ export const FasSerUrl = {
contingencyWaterUrl: completePrefix(baseURI, '/api/risksource/contingency/water'),
configPointEquipmentUrl: completePrefix(baseURI, 'api/firequment/point/batch/bindToEquipment?deviceId={deviceId}&pointIds={pointIds}'),
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'),//导入消防设备
importExcelDataUrl: completePrefix(baseURI, 'api/excel/import/data/excel/{type}'),//导入excel数据type=['fireResource','water']
importExcelFireEquipmentPointUrl: completePrefix(baseURI, 'api/excel/import/fireEquipmentPoint'),
......@@ -221,6 +223,7 @@ export const FasSerUrl = {
getAllUserUrl: completePrefix(baseURI, 'api/common/user/list'),//获取所有用户
queryFmeaControlObjUrl: completePrefix(baseURI, 'api/riskModel/fmea/{ids}/controlObjCount'),//根据fmea id查询关联对象个数
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图数据
queryNodeDetailUrl: completePrefix(baseURI, 'api/Topography/detail/{id}'),//获取node节点详情
saveNodeDetailUrl:completePrefix(baseURI, 'api/Topography/detail'),//保存nodeDetail详情
......
......@@ -12,6 +12,7 @@ import PlanDrill from './../view/planMgmt/view/PlanDrill';
import LeaderStruct from './../view/planMgmt/view/leaderStruct';
import PubView from './../view/planMgmt/view/pubview';
import PublishView from './../view/planMgmt/view';
/**
......@@ -27,11 +28,17 @@ export const customRoutes = [
{ path: 'differentiateDetail', parent: 'biz', component: DifferentiateDetail },
{ path: 'leaderStruct', parent: 'biz', component: LeaderStruct },
// { path: 'pubview', parent: 'planDrill', component: PlanDrill },
{ path: 'pubview', parent: 'planDrill', component: PubView },
{ path: 'textview', parent: 'planDrill', component: TextPlan },
// { path: 'pubview', parent: 'planDrill', component: PubView },
// { path: 'textview', parent: 'planDrill', component: TextPlan },
...parseCusotmRoutes()
];
export const planChildrenRoutes = {
path: 'planDrill', component: PublishView, childRoutes: [
{ path: 'pubview', component: PubView },
{ path: 'textview', component: TextPlan }
]};
/**
* path mapping
......
......@@ -7,7 +7,7 @@ import routerFilter, { checkLogin } from 'amos-security/lib/routes/validateRoute
import PublishView from './../view/planMgmt/view';
import AutoLogin from './../view/autoLogin/AutoLogin';
import calcRoutes from './calcRoutes';
import addCustomRoutes, { customRoutes, customRoutesPubView } from './customRoutes';
import addCustomRoutes, { customRoutes, planChildrenRoutes } from './customRoutes';
import pageCompontent, {
RootView,
Login,
......@@ -19,7 +19,8 @@ import pageCompontent, {
import Iot3DGraphBiz from './../view/planMgmt/iot3DGraph';
import ShareTextPlan from './../view/planMgmt/view/ShareTextPlan';
import PubView from './../view/planMgmt/view/pubview';
import TextPlan from './../view/planMgmt/view/TextPlan';
const groups = [
'main', 'biz', 'console', 'ruleConfig'
......@@ -35,6 +36,11 @@ const injectRoutes = menus => {
path: 'viz3d/:subjectId',
component: Iot3DGraphBiz
},
// {
// path: 'viz3dpub',
// component: PublishView,
// childRoutes: [...customRoutesPubView]
// },
{ path: 'login', component: Login },
{ path: 'autologin', component: AutoLogin },
{ path: 'region', component: RegionList }, // 区域选择
......@@ -51,7 +57,9 @@ const injectRoutes = menus => {
{
path: 'biz',
component: RootBizView,
childRoutes: [...bizChilds, ...customRoutes]
childRoutes: [...bizChilds, ...customRoutes,
planChildrenRoutes
]
},
{
path: 'console',
......
......@@ -55,6 +55,7 @@ import CusVizLib from './../view/planMgmt/cusVizLib';
import RealTimeMonitor from './../view/morphic';
import PublishView from './../view/planMgmt/view';
import ModelManage from './../view/planMgmt/modelManage';
import LeaderStruct from './../view/planMgmt/view/leaderStruct';
const Routes = {
// 添加 rules 路由
......@@ -108,8 +109,9 @@ const Routes = {
alarmVideoMonitor: AlarmVideoMonitor,
alarmTest: alarmTestView,
vizlib: CusVizLib,
planDrill: PublishView,
modelManage: ModelManage
// planDrill: PublishView,
modelManage: ModelManage,
leaderStruct: LeaderStruct
};
const pageCompontent = key => {
......
......@@ -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) => {
......@@ -228,3 +235,15 @@ export const nodeDetailTopoSaveAction = (nodeDatil) => {
export const deleteTopoAction = (id, type) => {
return commonDelete(formatUrl(FasSerUrl.deleteTopoUrl, { id, type }));
};
/**
* 获取指定预案文件
*/
export const getTextPlanTreeAction = (appId) => {
return commonGet(formatUrl(FasSerUrl.getTextPlanTreeUrl, { appId }));
};
/**
* 删除预案文件
*/
export const deleteTextPlanAction = (id) => {
return commonDelete(formatUrl(FasSerUrl.deleteTextPlanUrl, { id }));
};
......@@ -13,26 +13,48 @@
justify-content: space-between;
align-items: center;
.header-left {
line-height: 42px;
.tool-bar-button {
vertical-align: baseline;
}
.header-left {
flex-grow: 1;
line-height: 42px;
.header-name {
padding-left: 20px;
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 {
width: 300px;
.amos-button-bar-group{
float: right;
margin-right: 5px;
}
}
}
.leader-struct-content {
display: flex;
width: 100%;
......@@ -50,7 +72,8 @@
}
.leader-struct-diagram{
height: 90%;
// height: 90%;
height: 100%;
}
.tooltip-content {
......
export const headerButton = [
// { key: 'back', text: '返回', icon: 'fanhui' },
{ key: 'onOff', text: '显示窗', icon: 'yuan1' },
{ key: 'planDrill', text: '预案演练', icon: 'yuan1' },
{ key: 'back', text: '返回', icon: 'fanhui' },
// { key: 'onOff', text: '显示窗', icon: 'yuan1' },
// { key: 'planDrill', text: '预案演练', icon: 'yuan1' },
{ key: 'textPlan', text: '文字预案', icon: 'jiuyuanjiagou' },
{ key: 'textPlanUpload', text: '预案上传', icon: 'daochu' },
{ key: 'taskList', text: '任务列表', icon: 'renwuliebiao' },
];
......
......@@ -20,7 +20,7 @@ const uploadUrl = FasSerUrl.uploadTextPlan;
const extraMenus = [
{ key: 'preview', text: '预览', icon: 'eye' },
{ key: 'textImport', text: '文字预案', icon: 'totop1' },
{ key: 'leaderStruct', text: '领导架构', icon: 'user' }
// { key: 'leaderStruct', text: '领导架构', icon: 'user' }
];
/**
......
......@@ -2,9 +2,12 @@ import React, { Component } from 'react';
import { Tree, message } from 'amos-framework';
import PropTypes from 'prop-types';
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 { eventTopics } from './../../3dview/consts';
const ls = _amosTool.Store.lsTool;
const TreeNode = Tree.TreeNode;
class PlanTreeView extends Component {
......@@ -27,6 +30,9 @@ class PlanTreeView extends Component {
componentWillReceiveProps(nextProps) {
console.log('plan tree view~~~~~~~~~~~');
if (!fastDeepEqual(this.props.selectAppId, nextProps.selectAppId)) {
this.setState({selectedKeys: [`textNode-${nextProps.selectAppId}`]})
}
}
onTreeItemSelect = (selectedKeys, info) => {
......@@ -60,10 +66,22 @@ class PlanTreeView extends Component {
}
getPlanTree() {
getPlanTreeAction().then(data => {
// getPlanTreeAction().then(data => {
// this.setState({ treeData: data },()=>{
// 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 {
let { treeData } = this.state;
let { onTreeSelect, selectAppId } = this.props;
let defaultOpenPlan = {};
if(selectAppId != ''){
if( selectAppId != '' && selectAppId != undefined ){
this.findTreeNodesById(treeData,selectAppId);
if(this.state.selectData != undefined){
defaultOpenPlan = this.state.selectData;
......@@ -103,7 +121,7 @@ class PlanTreeView extends Component {
outerloop :
for (let i = 0; i < arrData.length; i++) {
const e = arrData[i];
if(e.id == selectAppId){
if(e.parentId == selectAppId || e.id == selectAppId){ //selectAppId 为appId || 文本id
this.state.selectData = e;
break outerloop;
}else if(e.children && e.children.length > 0){
......
This diff is collapsed.
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { browserHistory } from 'amos-react-router';
import { Modal, Button, message, AmosAlert } from 'amos-framework';
import BizIcon from './../../../common/icon/BizIcon';
import ToolBar from './ToolBar';
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 LeaderStructRightGrid from './LeaderStructRightGrid';
......@@ -30,6 +29,7 @@ class LeaderStruct extends Component {
selectNodeType: '',
rightGridData: [],
type: '1',//topo 类型 1 领导架构
addNodeLoc: {x: 0 , y: 0},
};
this.diagram = null; //gojs图
this.myPalette = null; //工具栏
......@@ -37,12 +37,16 @@ class LeaderStruct extends Component {
}
componentDidMount() {
let { appId } = this.props.location.state;
this.fetchData(appId);
// let { appId } = this.props.location.state;
this.fetchData();
}
fetchData = (appId) => {
queryTopographyAction(this.state.type, appId).then(res =>{
fetchData = () => {
// 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.renderCanvas();
});
......@@ -154,7 +158,7 @@ class LeaderStruct extends Component {
});
this.diagram = goObj(go.Diagram, this.refs.goJsDiv, {
contentAlignment: go.Spot.Center,
initialContentAlignment: go.Spot.TopLeft,
initialPosition: new go.Point(0, 0),
'undoManager.isEnabled': true, //// enable undo & redo 是否可撤回
'animationManager.isEnabled': false, // 过渡动画
......@@ -225,15 +229,15 @@ class LeaderStruct extends Component {
linkDataArray: linkData || []
});
this.myPalette =
goObj(go.Palette, this.refs.myPaletteDiv,
{
nodeTemplateMap: this.diagram.nodeTemplateMap, // share the templates used by myDiagram
model: new go.GraphLinksModel([ // specify the contents of the Palette
{ category: "leaderStruct", text: "节点", isPalette: true }
]
)
});
// this.myPalette =
// goObj(go.Palette, this.refs.myPaletteDiv,
// {
// nodeTemplateMap: this.diagram.nodeTemplateMap, // share the templates used by myDiagram
// model: new go.GraphLinksModel([ // specify the contents of the Palette
// { category: "leaderStruct", text: "节点", isPalette: true }
// ]
// )
// });
}
onButtonClick = (key)=>{
......@@ -258,16 +262,27 @@ class LeaderStruct extends Component {
}else{
message.danger('请选择节点!');
}
}else if(key === 'addNode'){
this.addTopoNode();
}else{
console.log('暂未开发');
}
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) => {
const { nodeDataArray,linkDataArray } = this.updateTopologyData;
const params = {
appId: this.props.location.state.appId,
// appId: this.props.location.state.appId,
type: this.state.type,
nodeData: nodeDataArray,
linkData: linkDataArray,
......@@ -329,12 +344,16 @@ class LeaderStruct extends Component {
<div className='header-left'>
<Button className='tool-bar-button' transparent icon={<BizIcon icon='fanhui' />} onClick={()=>this.onButtonClick('goback')} />
<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>
<ToolBar onClick={this.onButtonClick} />
</div>
<div className='leader-struct-content'>
<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'/>
{this.renderDetail()}
</div>
......
......@@ -170,7 +170,7 @@ class StageActuator extends Component {
//展开任务列表
PubSub.publish(eventTopics.plan_task_list,true);
//收起预案树
PubSub.publish(eventTopics.plan_tree_view,false);
// PubSub.publish(eventTopics.plan_tree_view,false);
}
playTargetAnimate = (anim, e) => {
......
import React, { Component } from 'react';
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 { eventTopics } from './../../../3dview/consts';
const ls = _amosTool.Store.lsTool;
/**
* 三维可视化 发布模式
......@@ -50,7 +53,10 @@ class Pubview extends Component {
render() {
const { shouldRender } = this.state;
const params = this.calcParams();
const { appId } = params || {};
let { appId } = params || {};
if(appId == undefined){
appId = ls.read(eventTopics.plan_drill_appId);
}
if (shouldRender){
return (
<div className="publish-view">
......
......@@ -119,7 +119,7 @@ class PlayMenuBar extends Component {
className={`tip-control-panel`}
left={false}
top={false}
animateName="slide-down"
animateName="slide-up"
visible={tulieActive}
animateProps={animateProps}
>
......
......@@ -19,7 +19,7 @@ class taskTabs extends Component {
constructor(props){
super(props);
this.state = {
taskTabsShow: false,
taskTabsShow: true,
tabs:[
{key:1, type:'person', icon:'person', 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