This commit is contained in:
joylink_cuiweidong 2020-07-16 14:42:07 +08:00
commit ad37c3087d
6 changed files with 177 additions and 11 deletions

View File

@ -272,3 +272,11 @@ export function deleteUserTrainingNew(statsId) {
method: 'delete'
});
}
// 发送列车仿真指令
export function sendCommandTrain(group, data) {
return request({
url: `/simulation/${group}/command`,
method: 'post',
data
});
}

View File

@ -0,0 +1,83 @@
<template>
<el-dialog
v-dialogDrag
class="select_station"
:title="title"
:visible.sync="show"
width="500px"
:before-close="doClose"
:z-index="2000"
:modal="false"
:close-on-click-modal="false"
append-to-body
>
<div style="padding-left: 20px; padding-bottom: 14px;">
<el-radio-group v-model="radio">
<el-radio v-for="item in stationList" :key="item.code" :label="item.code" class="radio_box">{{ item.name }}</el-radio>
</el-radio-group>
</div>
<el-row justify="center" class="button-group">
<el-col :span="4" :offset="8">
<el-button type="primary" @click="confirm">确定</el-button>
</el-col>
<el-col :span="4" :offset="2">
<el-button @click="doClose"> </el-button>
</el-col>
</el-row>
</el-dialog>
</template>
<script>
// import { MapDeviceType, OperationEvent } from '@/scripts/ConstDic';
export default {
name: '',
props: {
},
data() {
return {
dialogShow: false,
message: '',
stationList: [],
radio: ''
};
},
computed: {
show() {
return this.dialogShow && !this.$store.state.menuOperation.break;
},
title() {
return '提示';
}
},
mounted() {
},
methods: {
doShow(data) {
this.dialogShow = true;
this.stationList = data;
},
confirm() {
this.$emit('selectStationCode', this.radio);
this.doClose();
},
doClose() {
this.dialogShow = false;
this.stationList = [];
}
}
};
</script>
<style scoped>
.select_station .context {
padding-bottom: 40px !important;
border: 1px solid lightgray;
}
.radio_box{
width: 33.33%;
margin: 0;
margin-bottom: 5px;
}
</style>

View File

@ -1,6 +1,7 @@
import store from '@/store/index_APP_TARGET';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { sendCommandTrain } from '@/api/jmap/training';
// 操作
export const menuOperate = {
@ -457,3 +458,14 @@ export function commitOperate(operate, paramList, over, val) {
});
});
}
// 列车故障运行操作
export function commitTrainSend(group, data) {
return new Promise(function(resolve, reject) {
sendCommandTrain(group, data).then(res => {
resolve(res);
}).catch(error=>{
reject(error);
});
});
}

View File

@ -9,6 +9,7 @@
<train-edit-number ref="trainEditNumber" />
<train-detail ref="trainDetail" />
<set-fault ref="setFault" pop-class="xian-01__systerm" />
<select-station ref="selectStation" @selectStationCode="selectStationCode" />
</div>
</template>
@ -16,6 +17,7 @@
import PopMenu from '@/components/PopMenu';
import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo';
import SetFault from '@/jmapNew/theme/components/menus/dialog/setFault';
import SelectStation from '@/jmapNew/theme/components/menus/childDialog/selectStation';
import { mapGetters } from 'vuex';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
import { DeviceMenu, OperateMode } from '@/scripts/ConstDic';
@ -27,7 +29,7 @@ import TrainSwitch from './dialog/trainSwitch';
import TrainEditNumber from './dialog/trainEditNumber';
import TrainDetail from './dialog/trainDetail';
import MenuContextHandler from '@/scripts/cmdPlugin/MenuContextHandler';
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
import { menuOperate, commitOperate, commitTrainSend } from '@/jmapNew/theme/components/utils/menuOperate';
export default {
name: 'MenuTrain',
@ -40,7 +42,8 @@ export default {
TrainSwitch,
TrainEditNumber,
TrainDetail,
SetFault
SetFault,
SelectStation
},
props: {
selected: {
@ -132,9 +135,13 @@ export default {
};
},
computed: {
...mapGetters('map', [
'stationList'
]),
...mapGetters('training', [
'mode',
'operatemode'
'operatemode',
'memberList'
]),
...mapGetters('menuOperation', [
'buttonOperation'
@ -299,13 +306,67 @@ export default {
});
},
nextStation() {
commitOperate(menuOperate.Train.nextStation, { groupNumber: this.selected.code }, 3).then(({valid, operate})=>{
// commitOperate(menuOperate.Train.nextStation, { groupNumber: this.selected.code }, 3).then(({valid, operate})=>{
// }).catch((error) => {
// this.$refs.noticeInfo.doShow(error.message);
// });
const group = this.$route.query.group;
const param = {
commandType: 'Drive_Ahead',
targetMemberId: this.memberList.find(ele => ele.deviceCode == this.selected.code).id,
params: {}
};
commitTrainSend(group, param).then(({valid, operate})=>{
}).catch((error) => {
this.$refs.noticeInfo.doShow(error.message);
});
},
routeBlockRun() {
commitOperate(menuOperate.Train.routeBlockRun, { groupNumber: this.selected.code }, 3).then(({valid, operate})=>{
// commitOperate(menuOperate.Train.routeBlockRun, { groupNumber: this.selected.code }, 3).then(({valid, operate})=>{
// }).catch((error) => {
// this.$refs.noticeInfo.doShow(error.message);
// });
//
// const list = [];
// let direction = this.selected.right == 1;
// if (this.$store.state.map.mapConfig.upDirection == 'left') {
// direction = this.selected.right != 1;
// }
// let parentModel = this.selected.sectionModel;
// if (this.selected.sectionModel.parentCode) {
// parentModel = this.$store.getters['map/getDeviceByCode'](this.selected.sectionModel.parentCode);
// }
// this.stationList.forEach((item, index) => {
// const data = this.$store.getters['map/getDeviceByCode'](item.code);
// if (data.sectionCode) {
// const model = this.$store.getters['map/getDeviceByCode'](data.sectionCode);
// if (!direction && model.points[model.points.length - 1].x < parentModel.points[parentModel.points.length - 1].x) {
// list.push(item);
// } else if (direction && model.points[model.points.length - 1].x > parentModel.points[parentModel.points.length - 1].x) {
// list.push(item);
// }
// } else {
// if (!direction && index == 0) {
// list.push(item);
// } else if (direction && index == this.stationList.length - 1) {
// list.push(item);
// }
// }
// });
// console.log(list);
this.$refs.selectStation.doShow(this.stationList);
},
selectStationCode(code) {
const group = this.$route.query.group;
const param = {
commandType: 'Route_Block_Drive',
targetMemberId: this.memberList.find(ele => ele.deviceCode == this.selected.code).id,
params: {
stationCode: code
}
};
commitTrainSend(group, param).then(({valid, operate})=>{
}).catch((error) => {
this.$refs.noticeInfo.doShow(error.message);
});

View File

@ -50,6 +50,10 @@ export function parser(data, skinCode, showConfig) {
var mapDevice = {};
var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null;
if (data) {
zrUtil.each(data.stationList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert, showConfig);
}, this);
zrUtil.each(data.sectionList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Section, elem, propConvert, showConfig);
elem = propConvert.initPrivateProps(elem);
@ -58,6 +62,8 @@ export function parser(data, skinCode, showConfig) {
zrUtil.each(data.sectionList || [], elem => {
if (elem.type == '02' || elem.type == '03') {
mapDevice[elem.code].parentName = mapDevice[elem.parentCode] ? mapDevice[elem.parentCode].name : '';
} else if (elem.type == '01' && (elem.standTrack || elem.reentryTrack)) {
mapDevice[elem.belongStation].sectionCode = elem.code;
}
}, this);
@ -66,10 +72,6 @@ export function parser(data, skinCode, showConfig) {
elem = propConvert.initPrivateProps(elem);
}, this);
zrUtil.each(data.stationList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert, showConfig);
}, this);
zrUtil.each(data.stationStandList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationStand, elem, propConvert, showConfig);
}, this);

View File

@ -4,8 +4,8 @@ export function getBaseUrl() {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康