北交大客流项目 大客流策略

This commit is contained in:
joylink_cuiweidong 2021-02-04 17:17:45 +08:00
parent 2de373dd24
commit 61fb768bdc
6 changed files with 455 additions and 135 deletions

View File

@ -29,6 +29,7 @@ const Jlmap3dOtherVR = () => import('@/views/jlmap3d/maintainer/jl3dothervr');
const DisplayNew = () => import('@/views/newMap/displayNew/index');
const DesignDisplayNew = () => import('@/views/newMap/displayNew/scriptDisplay/scriptPreview/index');
const PracticeDisplay = () => import('@/views/newMap/displayNew/practiceDisplay');
const BigLPFStrategy = () => import('@/views/newMap/displayNew/bigLPFStrategy');
const JointTrainingNew = () => import('@/views/newMap/jointTrainingNew/index');
@ -431,6 +432,12 @@ export const publicAsyncRoute = [
component: PracticeDisplay,
hidden: true
},
{
// 北京交大使用 大客流策略
path: '/bigLPFStrategy',
component: BigLPFStrategy,
hidden: true
},
{
path: '/messageBoard',
component: MessageBoard,

View File

@ -5,7 +5,7 @@ function handle(state, data) {
// console.log(data, 'socket订阅');
const msg = data.body;
const path = window.location.href;
if (path.includes('/practiceDisplay') && !state.isFirst) { state.isFirst = true; }
if ((path.includes('/practiceDisplay') || path.includes('/planSchedule/window')) && !state.isFirst) { state.isFirst = true; }
switch (data.type) {
case 'Order_Pay_Result': // 订单支付结果消息
state.payOrder = msg;

View File

@ -3,9 +3,11 @@ import StompClient from '@/utils/sock';
import store from '@/store/index';
export const displayTopic = '/user/queue/simulation'; // 其他仿真topic
export const perpetualTopic = '/user/topic/message'; // 公用topic
export const roomTopic = '/user/queue/room'; // 房间topic
export const jl3dTopic = '/user/queue/simulation/jl3d'; // 三维topic
export const LPFTopic = '/user/queue/simulation/passenger'; // 客流topic
// 建立连接并订阅地址
export function creatSubscribe(topic, header) {

View File

@ -0,0 +1,413 @@
<template>
<div class="bigLPFStrategy">
<div class="bigLPFStrategyL">
<div class="bigLPFStrategyLTitle">大客流站台直方图</div>
<div :id="bigLPFStrategyId" class="bigLPFStrategyLChart" />
</div>
<div class="bigLPFStrategyR">
<div class="LPFstrategyTop">
<div class="LPFstrategyTitle">客流策略</div>
<!-- <div class="LPFstrategyClose" @click="closeLPFstrategy"><span class="el-icon-close" /></div> -->
</div>
<div class="LPFstrategyListOut">
<div v-if="LPFstrategyList.length<=0" class="noLPFstrategy">暂无策略</div>
<div v-for="(eachLPFstrategy,index) in LPFstrategyList" v-else :key="index" class="eachLPFstrategy">
<div class="eachLPFstrategyData1">策略{{ index+1 }}{{ eachLPFstrategy.description }}</div>
<div class="eachLPFstrategyData">指标数据</div>
<div class="eachLPFstrategyData">
<span>时刻表偏移指标: {{ eachLPFstrategy.target1 }}</span>
<span class="eachLPFstrategySpan">乘客等待指标: {{ eachLPFstrategy.target2 }}</span>
</div>
<div class="eachLPFstrategyData">综合指标: {{ eachLPFstrategy.coTarget }}</div>
</div>
</div>
</div>
<div class="quitLPFstrategy"><el-button type="primary" class="quitLPFButton" @click="quitLPFstrategy">退出</el-button></div>
</div>
</template>
<script>
import echarts from 'echarts';
import { mapGetters } from 'vuex';
import { clearSimulation } from '@/api/simulation';
import { creatSubscribe, clearSubscribe, LPFTopic} from '@/utils/stomp';
import { getToken } from '@/utils/auth';
import { loadMapDataById } from '@/utils/loaddata';
export default {
name:'BigLPFStrategy',
data() {
return {
group:'',
myChart: null,
LPFstrategyList:[],
bigLPFStrategyId:'bigLPFStrategyId',
upStandList:[],
downStandList:[],
stationNameList:[]
};
},
computed: {
...mapGetters('map', [
'stationList',
'stationStandList',
'mapConfig'
])
// maxWidth() {
// return this.$store.state.app.width > 1920 ? 1920 * 0.66 : this.$store.state.app.width * 0.66;
// },
// maxHeight() {
// return this.$store.state.app.height > 1080 ? 1080 - 40 : this.$store.state.app.height - 40;
// }
},
watch: {
'$store.state.socket.LPFstrategy':function(val) {
if (val && val.recommendList && val.recommendList.length > 0) {
this.LPFstrategyList = [];
val.recommendList.forEach(strategy=>{
const eachStrategy = {};
switch (strategy.type) {
case 'JUMP': {
const stand = this.$store.getters['map/getDeviceByCode'](strategy.standCode);
const station = this.$store.getters['map/getDeviceByCode'](stand.stationCode);
eachStrategy.description = '为列车[' + strategy.groupNumber +
'-' + strategy.serviceNumber + '|' + strategy.tripNumber +
'],设置站台' + station.name + '-' + (stand.right ? '右行' : '左行') +
stand.name + ' (' + stand.code + ') 跳停';
eachStrategy.target1 = strategy.target1;
eachStrategy.target2 = strategy.target2;
eachStrategy.coTarget = strategy.coTarget;
// [005-02|2057],--PF42(PF44165)",
// eachStrategy.description = strategy.description;
break;
}
case 'PARK_TIME': {
const stand = this.$store.getters['map/getDeviceByCode'](strategy.standCode);
const station = this.$store.getters['map/getDeviceByCode'](stand.stationCode);
// eachStrategy.description = strategy.description;
eachStrategy.target1 = strategy.target1;
eachStrategy.target2 = strategy.target2;
eachStrategy.coTarget = strategy.coTarget;
eachStrategy.description = '为站台[' + station.name + '-' + (stand.right ? '右行' : '左行') +
stand.name + '(' + stand.code + ') 设置停站时间,' + strategy.time + '秒';
break;
}
}
this.LPFstrategyList.push(eachStrategy);
});
}
},
'$store.state.socket.simulationOver':function(val) {
this.quitLPFstrategy();
},
'$store.state.app.windowSizeCount': function() { //
this.setWindowSize();
},
'$store.state.map.mapDataLoadedCount': function (val) {
const upRight = this.mapConfig.upRight;
this.stationList.sort((a, b) => {
return parseInt(a.kmRange) - parseInt(b.kmRange);
});
this.stationList.forEach((station)=>{
this.stationNameList.push(station.name);
});
this.stationStandList.forEach((stand)=>{
const station = this.$store.getters['map/getDeviceByCode'](stand.stationCode);
if ((stand.right && upRight) || (!stand.right && !upRight)) {
this.upStandList[station.name] = 0;
} else {
this.downStandList[station.name] = 0;
}
});
this.loadInitData();
this.subscribe();
},
'$store.state.socket.standPfiNum':function(val) {
if (val) {
// console.log(val, 'standPfiNum');
val.forEach(stationNum=>{
const upRight = this.mapConfig.upRight;
const stand = this.$store.getters['map/getDeviceByCode'](stationNum.standCode);
const station = this.$store.getters['map/getDeviceByCode'](stand.stationCode);
if ((stand.right && upRight) || (!stand.right && !upRight)) {
this.upStandList[station.name] = stationNum.num;
} else {
this.downStandList[station.name] = stationNum.num;
}
});
this.updateData();
}
}
},
beforeDestroy() {
if (this.group) {
clearSimulation(this.group);
this.clearSubscribe();
this.$store.dispatch('socket/resetTrainPassagerNum');
this.$store.dispatch('socket/setIsFirst', false);
}
},
mounted() {
this.group = this.$route.query.group;
loadMapDataById(this.$route.query.mapId, 'parse');
},
methods:{
async subscribe() {
this.clearSubscribe();
const header = { group: this.group || '', 'X-Token': getToken() };
creatSubscribe(`${LPFTopic}\/${this.$route.query.group}`, header);
},
clearSubscribe() {
clearSubscribe(`${LPFTopic}\/${this.group}`);
},
quitLPFstrategy() {
window.close();
},
updateData() {
const result = this.covertData();
const upStandNumList = result.upStandNumList;
const downStandNumList = result.downStandNumList;
const series = [{
name: '上行',
type: 'bar',
data:upStandNumList
},
{
name: '下行',
type: 'bar',
data:downStandNumList
}];
this.myChart && this.myChart.setOption({series: series});
},
covertData() {
const upStandNumList = [];
const downStandNumList = [];
this.stationNameList.forEach(station=>{
upStandNumList.push(this.upStandList[station]);
downStandNumList.push(this.downStandList[station]);
});
return {upStandNumList:upStandNumList, downStandNumList:downStandNumList};
},
async loadInitData() {
const result = this.covertData();
const upStandNumList = result.upStandNumList;
const downStandNumList = result.downStandNumList;
this.myChart && this.myChart.showLoading();
const option = {
tooltip: {
trigger: 'axis'
},
grid: [
{
right: '80px',
left: '80px',
height: '85%',
top:'40px'
}
],
xAxis: [
{
type: 'category',
data: this.stationNameList,
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
}
}
],
yAxis: [
{
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
}
}
],
dataZoom: [{
type: 'inside'
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
bottom: '20px'
}],
series: [
{
name: '上行',
type: 'bar',
data:upStandNumList
},
{
name: '下行',
type: 'bar',
data:downStandNumList
}
]
};
await this.loadInitChart(option);
this.myChart && this.myChart.hideLoading();
},
loadInitChart(option) {
return new Promise((resolve, reject) => {
try {
this.myChart = echarts.init(document.getElementById(this.bigLPFStrategyId));
if (this.myChart) {
this.myChart.setOption(option);
this.reSize({ width: this.$store.state.app.width * 0.66, height: this.$store.state.app.height - 40 });
}
resolve(true);
} catch (error) {
reject(error);
}
});
},
setWindowSize() {
this.reSize({ width: this.$store.state.app.width * 0.66, height: this.$store.state.app.height - 40 });
},
reSize(opt) {
if (this.myChart) {
this.myChart.resize({
width: opt.width,
height: opt.height,
silent: false
});
}
}
}
};
</script>
<style lang="scss" scoped>
.LPFstrategyList{
position: absolute;
width: 360px;
left: 10px;
height: 500px;
top: 80px;
background: #f1f1f1;
border-radius: 6px;
z-index: 2;
}
.eachLPFstrategy{
width: 96%;
box-shadow: 0px 5px 5px #ccc;
border-top: 1px #dedede solid;
margin-top: 10px;
padding:10px;
background: #fff;
font-size: 14px;
margin-left: 2%;
}
.LPFstrategyTop,.bigLPFStrategyLTitle{
background:#fff;
height: 40px;
border-bottom: 1px #d4d4d4 solid;
width: 100%;
position: absolute;
top: 0;
left:0;
}
.bigLPFStrategyLTitle{
padding: 10px;
font-size: 15px;
}
.LPFstrategyTitle{
float: left;
padding-top: 10px;
padding-left: 10px;
font-size: 15px;
}
.LPFstrategyClose{
float: right;
margin-right: 5px;
padding: 5px;
margin-top: 5px;
}
.LPFstrategyListOut{
height: 100%;
overflow: auto;
background: #f1f1f1;
padding-bottom: 10px;
border-bottom: 1px #d4d4d4 solid;
&::-webkit-scrollbar {
width: 5px;
}
&::-webkit-scrollbar-thumb {
border-radius: 10px;
background: #c3c3c3;
}
&::-webkit-scrollbar-track {
border-radius: 0;
background: #f0f0f0;
}
}
.eachLPFstrategyData1{
line-height:145%;
font-weight:600;
}
.eachLPFstrategyData{
margin-top:5px;
}
.eachLPFstrategySpan{
margin-left:50px;
}
.bigLPFStrategyL{
width: 66%;
float: left;
height: 100%;
padding: 40px 0px 0px 0px;
}
.bigLPFStrategyR{
width: 34%;
float: right;
border-left: 1px #eee solid;
height: 100%;
padding: 40px 0px;
position: relative;
}
.bigLPFStrategy{
width:100%;
height:100%;
position: relative;
}
.noLPFstrategy{
padding:50px 0px;
text-align: center;
}
.quitLPFstrategy{
position: absolute;
right: 10px;
bottom: 5px;
}
.quitLPFButton{
height: 30px;
padding-top: 5px;
padding-bottom: 5px;
}
.bigLPFStrategyLChart{}
#bigLPFStrategyId{
width:100%;
height:100%;
}
</style>

View File

@ -34,7 +34,7 @@ import { deepAssign } from '@/utils/index';
import { EventBus } from '@/scripts/event-bus';
import { getByGroupStationList, getPassengerHistoryList } from '@/api/jmap/map';
import { loadRunPlanData } from '@/utils/loaddata';
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
import { creatSubscribe, clearSubscribe, displayTopic, LPFTopic} from '@/utils/stomp';
import { getSimulationInfoNew } from '@/api/simulation';
import { getToken } from '@/utils/auth';
export default {
@ -157,6 +157,12 @@ export default {
this.loadInitData();
this.inter && clearInterval(this.inter);
this.subscribe();
},
'$store.state.socket.isFirst':function(val) {
if (val) {
const header = { group: this.group || '', 'X-Token': getToken() };
creatSubscribe(`${LPFTopic}\/${this.$route.query.group}`, header);
}
}
},
created() {
@ -172,17 +178,20 @@ export default {
this.destroy();
this.clearSubscribe();
this.$store.dispatch('runPlan/setPlanData', []);
this.$store.dispatch('socket/setIsFirst', false);
},
methods: {
async subscribe() {
this.clearSubscribe();
const header = { group: this.$route.query.group || '', 'X-Token': getToken() };
creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header);
// creatSubscribe(`${LPFTopic}\/${this.$route.query.group}`, header);
// await this.$store.dispatch('training/setHasSubscribed');
this.$store.dispatch('app/animationsClose');
},
clearSubscribe() {
clearSubscribe(`${displayTopic}\/${this.$route.query.group}`);
clearSubscribe(`${LPFTopic}\/${this.$route.query.group}`);
},
loadRunData() {
this.$store.dispatch('runPlan/clear').then(() => {

View File

@ -13,6 +13,7 @@
<!-- {{ $t('joinTraining.runGraphPreview') }} -->
<el-button v-if="running" size="small" @click="changeFlowData">切换客流数据</el-button>
<el-button v-if="running" size="small" @click="viewRunPlan">运行图视图</el-button>
<el-button v-if="running" size="small" @click="bigLPFStrategy">大客流策略</el-button>
<!-- 运行图加载 -->
<el-button size="small" @click="dispatcherWorkStation">ATS行调工作站</el-button>
<!-- <el-button v-if="!running" size="small" type="warning" @click="loadRunPlan">{{ $t('joinTraining.runGraphLoading') }}</el-button> -->
@ -20,23 +21,6 @@
<el-button v-if="messageBoard" size="small" @click="messageBoardShow">留言板</el-button>
<el-button size="small" @click="contectUs">联系方式</el-button>
</el-button-group>
<div v-if="isShowStrategy" class="LPFstrategyList">
<div class="LPFstrategyTop">
<div class="LPFstrategyTitle">客流策略</div>
<div class="LPFstrategyClose" @click="closeLPFstrategy"><span class="el-icon-close" /></div>
</div>
<div class="LPFstrategyListOut">
<div v-for="(eachLPFstrategy,index) in LPFstrategyList" :key="index" class="eachLPFstrategy">
<div class="eachLPFstrategyData1">策略{{ index+1 }}{{ eachLPFstrategy.description }}</div>
<div class="eachLPFstrategyData">指标数据</div>
<div class="eachLPFstrategyData">
<span>时刻表偏移指标: {{ eachLPFstrategy.target1 }}</span>
<span class="eachLPFstrategySpan">乘客等待指标: {{ eachLPFstrategy.target2 }}</span>
</div>
<div class="eachLPFstrategyData">综合指标: {{ eachLPFstrategy.coTarget }}</div>
</div>
</div>
</div>
<div class="trainExample">
<div class="currentFlowDataName">{{ currentFlowDataName }}</div>
<div class="trainExampleL">
@ -116,7 +100,7 @@ import SetTime from './demon/setTime';
import { PermissionType } from '@/scripts/ConstDic';
import { loadMapDataById } from '@/utils/loaddata';
import { clearSimulation, getSimulationInfoNew, ranAsPlan, exitRunPlan, getPassengerFlowData, changePassengerFlowData } from '@/api/simulation';
import { creatSubscribe, clearSubscribe, displayTopic, jl3dTopic} from '@/utils/stomp';
import { creatSubscribe, clearSubscribe, displayTopic, LPFTopic} from '@/utils/stomp';
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import { getToken } from '@/utils/auth';
import { mapGetters } from 'vuex';
@ -141,14 +125,13 @@ export default {
maskWidth: '100%',
group:'',
openWindow:null,
openBigLPF:null,
flowDataList:[],
currentFlowDataName:'',
currentFlowDataId:'',
isDisabled:false,
loading:false,
messageBoard: false,
LPFstrategyList:[],
isShowStrategy:false
messageBoard: false
};
},
computed:{
@ -236,46 +219,7 @@ export default {
'$store.state.socket.isFirst':function(val) {
if (val) {
const header = { group: this.group || '', 'X-Token': getToken() };
creatSubscribe(`${jl3dTopic}\/${this.$route.query.group}`, header);
}
},
'$store.state.socket.LPFstrategy':function(val) {
if (val && val.length > 0) {
this.LPFstrategyList = [];
val.forEach(strategy=>{
const eachStrategy = {};
switch (strategy.type) {
case 'JUMP': {
const stand = this.$store.getters['map/getDeviceByCode'](strategy.standCode);
const station = this.$store.getters['map/getDeviceByCode'](stand.stationCode);
eachStrategy.description = '为列车[' + strategy.groupNumber +
'-' + strategy.serviceNumber + '|' + strategy.tripNumber +
'],设置站台' + station.name + '-' + (stand.right ? '右行' : '左行') +
stand.name + ' (' + stand.code + ') 跳停';
eachStrategy.target1 = strategy.target1;
eachStrategy.target2 = strategy.target2;
eachStrategy.coTarget = strategy.coTarget;
// [005-02|2057],--PF42(PF44165)",
// strategy.description;
break;
}
case 'PARK_TIME': {
const stand = this.$store.getters['map/getDeviceByCode'](strategy.standCode);
const station = this.$store.getters['map/getDeviceByCode'](stand.stationCode);
// eachStrategy.description = strategy.description;
eachStrategy.target1 = strategy.target1;
eachStrategy.target2 = strategy.target2;
eachStrategy.coTarget = strategy.coTarget;
eachStrategy.description = '为站台[' + station.name + '-' + (stand.right ? '右行' : '左行') +
stand.name + '(' + stand.code + ') 设置停站时间,' + strategy.time + '秒';
break;
}
}
this.LPFstrategyList.push(eachStrategy);
});
if (!this.isShowStrategy) {
this.isShowStrategy = true;
}
creatSubscribe(`${LPFTopic}\/${this.$route.query.group}`, header);
}
}
},
@ -336,7 +280,7 @@ export default {
// await this.$store.dispatch('training/setHasSubscribed');
},
clearSubscribe() {
clearSubscribe(`${jl3dTopic}\/${this.group}`);
clearSubscribe(`${LPFTopic}\/${this.group}`);
clearSubscribe(`${displayTopic}\/${this.group}`);
},
async loadSimulationInfo() {
@ -436,6 +380,22 @@ export default {
});
this.openWindow = window.open(routeData.href);
},
/** 大客流策略 */
bigLPFStrategy() {
if (this.openBigLPF) {
this.openBigLPF.close();
}
const routeData = this.$router.resolve({
path:'/bigLPFStrategy',
query:{
mapId:this.$route.query.mapId,
group:this.$route.query.group,
project: this.$route.query.project,
noPreLogout: true
}
});
this.openBigLPF = window.open(routeData.href);
},
loadRunPlan() {
this.$refs.runPlanLoad.doShow();
},
@ -469,9 +429,6 @@ export default {
this.$messageBox(this.$t('display.demon.endSimulationFail'));
});
},
closeLPFstrategy() {
this.isShowStrategy = false;
},
start(model) { // 仿
const data = {
time: model.initTime
@ -581,72 +538,4 @@ export default {
left: 10px;
top: 15px;
}
.LPFstrategyList{
position: absolute;
width: 360px;
left: 10px;
height: 500px;
top: 80px;
background: #f1f1f1;
border-radius: 6px;
z-index: 2;
}
.eachLPFstrategy{
width: 100%;
box-shadow: 0px 5px 5px #ccc;
border-top: 1px #dedede solid;
margin-top: 10px;
padding:10px;
background: #fff;
font-size: 14px;
}
.LPFstrategyTop{
background:#fff;
height: 35px;
border-bottom: 1px #d4d4d4 solid;
width: 100%;
border-radius: 5px 5px 0px 0px;
}
.LPFstrategyTitle{
float: left;
padding-top: 10px;
padding-left: 10px;
font-size: 15px;
}
.LPFstrategyClose{
float: right;
margin-right: 5px;
padding: 5px;
margin-top: 5px;
}
.LPFstrategyListOut{
height: 460px;
overflow: auto;
background: #f1f1f1;
padding-bottom: 10px;
&::-webkit-scrollbar {
width: 5px;
}
&::-webkit-scrollbar-thumb {
border-radius: 10px;
background: #c3c3c3;
}
&::-webkit-scrollbar-track {
border-radius: 0;
background: #f0f0f0;
}
}
.eachLPFstrategyData1{
line-height:145%;
font-weight:600;
}
.eachLPFstrategyData{
margin-top:5px;
}
.eachLPFstrategySpan{
margin-left:50px;
}
</style>