From b37fbdd96794d1857b0a2f60a30b49a3242e1c02 Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Thu, 16 Jul 2020 13:35:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=A5=BF=E5=AE=89=E7=BA=BF?= =?UTF-8?q?=E8=B7=AF=E5=88=97=E8=BD=A6=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/jmap/training.js | 8 ++ .../menus/childDialog/selectStation.vue | 83 +++++++++++++++++++ .../theme/components/utils/menuOperate.js | 12 +++ src/jmapNew/theme/xian_01/menus/menuTrain.vue | 71 ++++++++++++++-- src/jmapNew/utils/parser.js | 10 ++- src/utils/baseUrl.js | 4 +- 6 files changed, 177 insertions(+), 11 deletions(-) create mode 100644 src/jmapNew/theme/components/menus/childDialog/selectStation.vue diff --git a/src/api/jmap/training.js b/src/api/jmap/training.js index b54d66922..ec7c4584e 100644 --- a/src/api/jmap/training.js +++ b/src/api/jmap/training.js @@ -272,3 +272,11 @@ export function deleteUserTrainingNew(statsId) { method: 'delete' }); } +// 发送列车仿真指令 +export function sendCommandTrain(group, data) { + return request({ + url: `/simulation/${group}/command`, + method: 'post', + data + }); +} diff --git a/src/jmapNew/theme/components/menus/childDialog/selectStation.vue b/src/jmapNew/theme/components/menus/childDialog/selectStation.vue new file mode 100644 index 000000000..f1058c80a --- /dev/null +++ b/src/jmapNew/theme/components/menus/childDialog/selectStation.vue @@ -0,0 +1,83 @@ + + + + diff --git a/src/jmapNew/theme/components/utils/menuOperate.js b/src/jmapNew/theme/components/utils/menuOperate.js index 0d13bd498..54c14ee8f 100644 --- a/src/jmapNew/theme/components/utils/menuOperate.js +++ b/src/jmapNew/theme/components/utils/menuOperate.js @@ -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); + }); + }); +} diff --git a/src/jmapNew/theme/xian_01/menus/menuTrain.vue b/src/jmapNew/theme/xian_01/menus/menuTrain.vue index afd62422a..fb3ed2bff 100644 --- a/src/jmapNew/theme/xian_01/menus/menuTrain.vue +++ b/src/jmapNew/theme/xian_01/menus/menuTrain.vue @@ -9,6 +9,7 @@ + @@ -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); }); diff --git a/src/jmapNew/utils/parser.js b/src/jmapNew/utils/parser.js index 150f053ca..2fe265082 100644 --- a/src/jmapNew/utils/parser.js +++ b/src/jmapNew/utils/parser.js @@ -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); diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index c59924e25..55d352581 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -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'; // 杜康