diff --git a/src/api/simulation.js b/src/api/simulation.js index 43ecc026c..be1d41e60 100644 --- a/src/api/simulation.js +++ b/src/api/simulation.js @@ -385,6 +385,15 @@ export function modifyScriptAction(group, actionId, data) { }); } +/** 修改剧本动作(新版) */ +export function modifyScriptActionNew(group, data) { + return request({ + url: `/api/scriptSimulation/${group}/action/update`, + method: 'put', + data + }); +} + /** 分页查询存在的仿真 */ export function getExistingSimulation(params) { return request({ @@ -709,3 +718,4 @@ export function getMemberInfo(group, memberId) { method: 'get' }); } + diff --git a/src/scripts/ConstConfig.js b/src/scripts/ConstConfig.js index a462dc7b9..73f6f7ee7 100644 --- a/src/scripts/ConstConfig.js +++ b/src/scripts/ConstConfig.js @@ -90,11 +90,13 @@ export default { roleTypeNew:[ {label: '管理员', value: 'ADMIN', enLabel: 'Admin '}, {label: '教员', value: 'Instructor', enLabel: 'Instructor '}, - {label: '行调', value: 'DISPATCHER', enLabel: 'Dispatcher '}, {label: '行值', value: 'STATION_SUPERVISOR', enLabel: 'Attendant '}, {label: '观众', value: 'AUDIENCE', enLabel: 'Audience '}, {label: '司机', value: 'DRIVER', enLabel: 'Driver '}, - {label: '通号', value: 'MAINTAINER', enLabel: 'Repairman '} + {label: '通号', value: 'MAINTAINER', enLabel: 'Repairman '}, + {label: '车辆段调度', value: 'DEPOT_DISPATCHER', enLabel: 'Depot dispatcher '}, + {label: '工电调度', value: 'ELECTRIC_DISPATCHER', enLabel: 'Electric dispatcher'}, + {label: '行调', value: 'DISPATCHER', enLabel: 'Dispatcher '} ], SimulationType: [ { label: '实训', value: 'Training'}, diff --git a/src/views/jsxt/apply/index.vue b/src/views/jsxt/apply/index.vue index 8333e0aed..0a0bffba8 100644 --- a/src/views/jsxt/apply/index.vue +++ b/src/views/jsxt/apply/index.vue @@ -58,7 +58,7 @@
-
报名成功!:
您的赛事信息如下: +
报名成功!
您的赛事信息如下:
竞赛名称:{{ compition.name }}
竞赛时间:{{ compition.startDate }}
姓名:{{ formModel.name }} @@ -85,7 +85,7 @@
- + diff --git a/src/views/jsxt/refereeList/display.vue b/src/views/jsxt/refereeList/display.vue index f60c7f7f3..8195c8eb1 100644 --- a/src/views/jsxt/refereeList/display.vue +++ b/src/views/jsxt/refereeList/display.vue @@ -16,7 +16,9 @@ import { mapGetters } from 'vuex'; import { checkLoginLine } from '@/api/login'; import { EventBus } from '@/scripts/event-bus'; import MenuReplay from './menuReplay'; +import { getToken } from '@/utils/auth'; import { DeviceMenu, getDeviceMenuByDeviceType } from '@/scripts/ConstDic'; +import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp'; export default { name:'RefereeDisplay', components: { @@ -52,25 +54,49 @@ export default { }, height() { return this.$store.state.app.height; + }, + group() { + return this.$route.query.group; } }, watch: { '$store.state.map.mapViewLoadedCount': function (val) { // 地图视图加载完成标识 开始加载默认状态 + this.subscribe(); this.mapBoxP = document.getElementById(this.canvasId).children[0]; this.mapBoxP.style.cursor = ''; }, - // 'size.width': function(val) { - // this.setWindowSize(); + '$store.state.socket.equipmentStatus': function (val) { + if (val.length) { + this.statusMessage(val); + } + }, + '$store.state.socket.trainStationList': function (val) { + if (val.length) { + this.runFactMessage(val); + } + }, + // '$store.state.socket.simulationError': function (val) { + // if (val) { + // this.simulationError(val); + // } // }, + '$store.state.socket.simulationReset': function (val) { + if (val) { + this.simulationReset(val); + } + }, '$store.state.app.windowSizeCount': function() { this.setWindowSize(); } }, + async mounted() { + window.onbeforeunload = this.clearSubscribe; await this.setWindowSize(); await this.initLoadData(); }, async beforeDestroy() { + this.clearSubscribe(); await this.clearAllTimer(); await this.quit(); await this.$store.dispatch('training/reset'); @@ -81,6 +107,47 @@ export default { async back() { // await this.$refs.menuScript.back(); }, + clearSubscribe() { + clearSubscribe(`${displayTopic}\/${this.group}`); + }, + async subscribe() { + this.clearSubscribe(); + const header = { group: this.group || '', 'X-Token': getToken() }; + creatSubscribe(`${displayTopic}\/${this.group}`, header); + + await this.$store.dispatch('training/setHasSubscribed'); + }, + async statusMessage(list) { + await this.$store.dispatch('training/updateMapState', list); + await this.$store.dispatch('socket/setEquipmentStatus'); + }, + async runFactMessage(list) { + await this.$store.dispatch('runPlan/updateRunPlanData', list); + await this.$store.dispatch('socket/setTrainStationList'); + }, + async simulationReset() { + await this.$store.dispatch('map/clearJlmapTrainView'); + await this.$store.dispatch('map/setTrainWindowShow', false); + await this.$store.dispatch('training/over'); + await this.$store.dispatch('socket/setSimulationReset'); + await this.$store.dispatch('socket/setSimulationStart'); + await this.$store.dispatch('training/setMapDefaultState'); + }, + // async simulationError() { + // await this.$store.dispatch('map/clearJlmapTrainView'); + // await this.$store.dispatch('map/setTrainWindowShow', false); + // await this.$store.dispatch('socket/setSimulationError'); + // await this.$store.dispatch('training/setMapDefaultState'); + // this.clearSubscribe(); + // this.$confirm(this.$t('tip.getMapStateDataException'), this.$t('tip.hint'), { + // confirmButtonText: this.$t('global.confirm'), + // showCancelButton: false, + // type: 'warning' + // }).then(() => { + // this.$emit('back'); + // }).catch(() => { + // }); + // }, // 加载数据 async initLoadData() { this.$store.dispatch('training/reset'); diff --git a/src/views/jsxt/refereeList/index.vue b/src/views/jsxt/refereeList/index.vue index 8f7c52e78..94c1b04fe 100644 --- a/src/views/jsxt/refereeList/index.vue +++ b/src/views/jsxt/refereeList/index.vue @@ -82,7 +82,7 @@ export default { prop: 'theoryScore', width:100, type: 'tag', - columnValue: (row) => { return row.artificialTheoryScore ? `${row.theoryScore}(${row.artificialTheoryScore})` : row.theoryScore || '0'; }, + columnValue: (row) => { return row.artificialTheoryScore ? `${row.theoryScore}(${row.artificialTheoryScore})` : this.covert(row.theoryScore); }, tagType: (row) => { return 'success'; } }, { @@ -90,7 +90,7 @@ export default { prop: 'practiceScore', width:100, type: 'tag', - columnValue: (row) => { return row.artificialPracticeScore ? `${row.practiceScore}(${row.artificialPracticeScore})` : row.practiceScore || '0'; }, + columnValue: (row) => { return row.artificialPracticeScore ? `${row.practiceScore}(${row.artificialPracticeScore})` : this.covert(row.practiceScore); }, tagType: (row) => { return 'success'; } }, { @@ -119,13 +119,13 @@ export default { name: '理论结果', handleClick: this.handleTheoryResult, type: '', - showControl: (row) => { return row.status == '5' || row.status == '4'; } + showControl: (row) => { return row.status == '5' || row.status == '4' || row.theoryScore != undefined; } }, { name: '实操回放', handleClick: this.playBack, type: '', - showControl: (row) => { return row.status == '4'; } + showControl: (row) => { return row.status == '4' || row.status == '6' || row.practiceScore != undefined; } }, { name: '修改', @@ -183,6 +183,17 @@ export default { this.$refs.theoryResult.doShow({row:row, raceId:this.$route.query.raceId}); // this.$router.replace({ path: `/jsxt/theory/result?raceId=${this.$route.query.raceId}&result=true` }); }, + covert(data) { + if (data != undefined) { + if (data > 0) { + return data; + } else { + return '0'; + } + } else { + return ''; + } + }, handleAdd() { const loading = this.$loading({ lock: true, diff --git a/src/views/jsxt/refereeList/theoryResult.vue b/src/views/jsxt/refereeList/theoryResult.vue index 9f545408d..e9f9e6630 100644 --- a/src/views/jsxt/refereeList/theoryResult.vue +++ b/src/views/jsxt/refereeList/theoryResult.vue @@ -1,10 +1,12 @@ + diff --git a/src/views/scriptManage/scriptRecord/addAction.vue b/src/views/scriptManage/scriptRecord/addAction.vue index 66bb76afc..46d315955 100644 --- a/src/views/scriptManage/scriptRecord/addAction.vue +++ b/src/views/scriptManage/scriptRecord/addAction.vue @@ -75,7 +75,7 @@ import Vue from 'vue'; import Cookies from 'js-cookie'; import ConstConfig from '@/scripts/ConstConfig'; import CommandOperation from './command'; -import {addScriptAction, addScriptActionNew, modifyScriptAction, getAvailableDeviceCommand, getScriptPlayMember, getScriptPlayMemberNew} from '@/api/simulation'; +import {addScriptAction, addScriptActionNew, modifyScriptAction, modifyScriptActionNew, getAvailableDeviceCommand, getScriptPlayMember, getScriptPlayMemberNew} from '@/api/simulation'; export default { name: 'AddAction', components:{ @@ -451,20 +451,39 @@ export default { } else { const actionId = this.modalData.actionVO.id; - modifyScriptAction(group, actionId, data).then(response=>{ - this.modifying = false; - this.isNotModify = true; - this.$emit('setDisabled', this.isNotModify); - this.buttonName = this.$t('scriptRecord.addConversitionButton'); - this.operateType = 'add'; - this.$message.success(this.$t('scriptRecord.modifyConversitionSuccess')); - this.$emit('create'); - // this.$parent.$parent.$refs['addRole'].resetData([this.modalData.action.memberId,this.modalData.action.targetId]); - this.initActionData(); - }).catch(error => { - this.modifying = false; - this.$messageBox(`${this.$t('scriptRecord.modifyConversitionFail')}: ${error.message}`); - }); + if (this.drawWay) { + data.id = actionId; + modifyScriptActionNew(group, data).then(response=>{ + this.modifying = false; + this.isNotModify = true; + this.$emit('setDisabled', this.isNotModify); + this.buttonName = this.$t('scriptRecord.addConversitionButton'); + this.operateType = 'add'; + this.$message.success(this.$t('scriptRecord.modifyConversitionSuccess')); + this.$emit('create'); + // this.$parent.$parent.$refs['addRole'].resetData([this.modalData.action.memberId,this.modalData.action.targetId]); + this.initActionData(); + }).catch(error => { + this.modifying = false; + this.$messageBox(`${this.$t('scriptRecord.modifyConversitionFail')}: ${error.message}`); + }); + } else { + modifyScriptAction(group, actionId, data).then(response=>{ + this.modifying = false; + this.isNotModify = true; + this.$emit('setDisabled', this.isNotModify); + this.buttonName = this.$t('scriptRecord.addConversitionButton'); + this.operateType = 'add'; + this.$message.success(this.$t('scriptRecord.modifyConversitionSuccess')); + this.$emit('create'); + // this.$parent.$parent.$refs['addRole'].resetData([this.modalData.action.memberId,this.modalData.action.targetId]); + this.initActionData(); + }).catch(error => { + this.modifying = false; + this.$messageBox(`${this.$t('scriptRecord.modifyConversitionFail')}: ${error.message}`); + }); + } + } } else { console.log('error submit!!'); diff --git a/src/views/scriptManage/scriptRecord/getAction.vue b/src/views/scriptManage/scriptRecord/getAction.vue index 3de960ade..0d78946cd 100644 --- a/src/views/scriptManage/scriptRecord/getAction.vue +++ b/src/views/scriptManage/scriptRecord/getAction.vue @@ -20,7 +20,7 @@
- {{ $t('scriptRecord.modifyConversitionButton') }} + {{ $t('scriptRecord.modifyConversitionButton') }}
@@ -158,8 +158,8 @@ export default { // memberVOList = memberVOList.replace(new RegExp(rolename, 'g'), element.label); // }); // memberVOList = JSON.parse(memberVOList); - const lastData = JSON.stringify(response.data); - const memberVOList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew); + const lastData = JSON.stringify(response.data.memberVOList); + const memberVOList = this.covert(lastData, ConstConfig.ConstSelect.roleType); const actionList = response.data.actionVOList; @@ -218,9 +218,7 @@ export default { this.loadInitData(); }, modifyAction(row) { - if (!this.drawWay) { - this.$emit('setAction', row); - } + this.$emit('setAction', row); } } };