From c243303e74d9d0f4e8686df2a39cf774f056f54f Mon Sep 17 00:00:00 2001 From: sunzhenyu Date: Fri, 27 Nov 2020 18:20:06 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=89=E7=BB=B4?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E8=8E=B7=E5=8F=96=E7=AB=99=E5=9C=BA=E5=9B=BE?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/jlmap3d/load3ddata.js | 2 +- src/jlmap3d/jl3dsimulation/jlmap3d.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/jlmap3d/load3ddata.js b/src/api/jlmap3d/load3ddata.js index a84b6959d..17e8b8ae0 100644 --- a/src/api/jlmap3d/load3ddata.js +++ b/src/api/jlmap3d/load3ddata.js @@ -11,7 +11,7 @@ export function getPublishMapVersion(id) { /** 根据皮肤获取发布地图详细内容*/ export function getPublishMapDetail(id) { const datad = request({ - url: `/api/map/${id}/details`, + url: `/api/map/${id}/graphData`, method: 'get' }); return datad.then(); diff --git a/src/jlmap3d/jl3dsimulation/jlmap3d.js b/src/jlmap3d/jl3dsimulation/jlmap3d.js index 596e6f7d4..fa03569e0 100644 --- a/src/jlmap3d/jl3dsimulation/jlmap3d.js +++ b/src/jlmap3d/jl3dsimulation/jlmap3d.js @@ -247,7 +247,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { linklist = loadlinklist; signallist = loadsignallist; stationstandlist = loadstationstandlist; - + trainlisttest = loadtrainlisttest; realsectionlist = loadrealsectionlist; rails = loadrails; From 6fadd63dfd668d1af694ca12833faa01d9af5267 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Fri, 27 Nov 2020 18:37:07 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/jmap/map.js | 14 +++++++------- src/utils/loaddata.js | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/api/jmap/map.js b/src/api/jmap/map.js index 3ce4c0795..b988690d8 100644 --- a/src/api/jmap/map.js +++ b/src/api/jmap/map.js @@ -229,13 +229,13 @@ export function publisMapCityList(data) { }); } -/** 新版地图根据仿真mapId获取仿真地图数据 */ -export function getNewMapDataByMapId(mapId) { - return request({ - url: `/api/map/${mapId}/mapData`, - method: 'get' - }); -} +// /** 新版地图根据仿真mapId获取仿真地图数据 */ +// export function getNewMapDataByMapId(mapId) { +// return request({ +// url: `/api/map/${mapId}/mapData`, +// method: 'get' +// }); +// } /** 发布地图根据id生成子系统及权限 */ export function generateAncillaryData(mapId) { return request({ diff --git a/src/utils/loaddata.js b/src/utils/loaddata.js index 2c4b550bc..ca7b282e8 100644 --- a/src/utils/loaddata.js +++ b/src/utils/loaddata.js @@ -1,5 +1,6 @@ import store from '@/store/index_APP_TARGET'; -import { getPublishMapVersionById, getPublishMapDetailById, getNewMapDataByMapId} from '@/api/jmap/map'; +import { getPublishMapVersionById, getPublishMapDetailById} from '@/api/jmap/map'; +// getNewMapDataByMapId // import { getNewMapDataByGroup } from '@/api/simulation'; // 获取地图版本数据,和store里面的map版本做比较,如果不同 @@ -48,7 +49,7 @@ export function loadMapDataById(mapId, type = 'mapPreview') { export function loadNewMapDataByMapId(mapId) { return new Promise((resolve, reject) => { - getNewMapDataByMapId(mapId).then(resp => { + getPublishMapDetailById(mapId).then(resp => { covertData(resp.data, 'mapId', resolve); }).catch(error => { reject(error); From bf1377fc277991b8de4cd9976f7fc1c4630211b4 Mon Sep 17 00:00:00 2001 From: sunleking Date: Fri, 27 Nov 2020 21:39:06 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=89=E7=BB=B4?= =?UTF-8?q?=E5=AE=A2=E6=B5=81=E5=88=97=E8=BD=A6=E4=B9=98=E5=91=98=E6=9B=B4?= =?UTF-8?q?=E6=96=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jl3dtrafficplan/connect/trainconnect.js | 8 ++++--- .../jl3dtrafficplan/jl3dtraffictrain.js | 24 ++++++++++++------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js b/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js index c06250299..cdfbf9ada 100644 --- a/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js +++ b/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js @@ -31,12 +31,13 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe const data = JSON.parse(Response.body); if(data.type == "PFV"){ - console.log(data); - console.log(trafficTrain.trainList); + // console.log(data); + // console.log(trafficTrain.trainList); for(let k in trafficTrain.trainList){ if(trafficTrain.trainList[k].code == data.body){ updateValue(data.body); trafficTrain.updateNowTrainCode(data.body); + trafficTrain.updateNowTrunk(0+''); break; } } @@ -55,8 +56,9 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe } } - if(data.type == "TRAIN_PFI_BL"){ + if(data.type == "TRAIN_PFI_BL"){ + // console.log(data); trafficTrain.updateTrainData(data.body); diff --git a/src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js b/src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js index 4ac6ca28a..7b1d10be7 100644 --- a/src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js +++ b/src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js @@ -244,7 +244,9 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap,initCode) { window.onresize = function () { passerRender.reSize(scope.dom.offsetWidth,scope.dom.offsetHeight); } - + this.updateNowTrunk = function(newTrunkNum){ + passerHuman.nowTrunk = newTrunkNum; + }; this.switchcamera = function(trunkNum){ passerHuman.nowTrunk = trunkNum; @@ -316,10 +318,14 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap,initCode) { this.updateTrainData = function(newData){ - if(scope.trainList.length > 0){ - for(let i=0;i 0){ + // for(let k in scope.trainList.length){ + let k = newData.code; + if(scope.trainList[k]){ + // console.log(newData); + // console.log(scope.trainList[k].num); + scope.trainList[k].num = scope.trainList[k].num + newData.in - newData.out; if(passerTrain.toptrain.nowcode == newData.code){ scope.humanWaitIn = getnum(newData.in,6); @@ -330,15 +336,15 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap,initCode) { // console.log("------------------"); passerHuman.initTrainRail(humanlist,scope.humanWaitIn,scope.humanWaitOut,nowLeaveDoor); - let trainDataList = getnum(scope.trainList[i].num,6); + let trainDataList = getnum(scope.trainList[k].num,6); // nowTrunk.code = newCode; scope.nowTrunk.numList = trainDataList; updateTrainNum(trainDataList); } - i = scope.trainList.length; + // i = scope.trainList.length; } - } - } + // } + // } } this.updateNowTrainCode = function(newCode){ From f9bac6886a33752749a884cbad7add3d55d20528 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 30 Nov 2020 10:23:32 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9A=82=E6=97=B6?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/designPlatform/bigScreen.vue | 9 +-------- src/views/designPlatform/bigSplitScreen.vue | 5 +---- src/views/designPlatform/testRunplan.vue | 3 +-- src/views/ibp/ibpsystem/index.vue | 3 +-- src/views/iscs/iscsSystem/groupNav.vue | 3 +-- src/views/iscs/iscsSystem/stationNav.vue | 2 +- .../newMap/displayNew/demon/planSchedule.vue | 2 +- .../newMap/displayNew/practiceDisplay.vue | 19 +------------------ src/views/newMap/mapsystemNew/index.vue | 1 - 9 files changed, 8 insertions(+), 39 deletions(-) diff --git a/src/views/designPlatform/bigScreen.vue b/src/views/designPlatform/bigScreen.vue index b9afbb2eb..240894dc2 100644 --- a/src/views/designPlatform/bigScreen.vue +++ b/src/views/designPlatform/bigScreen.vue @@ -31,10 +31,6 @@ export default { }, data() { return { - // size: { - // width: document.documentElement.clientWidth - 400, - // height: document.documentElement.clientHeight - 80 - // }, maskOpen: false, maskWidth: 'calc(100% - 450px)', disPlay: false @@ -173,8 +169,6 @@ export default { this.clearSubscribe(); } this.$store.dispatch('training/over').then(() => { - EventBus.$emit('runPlanStop'); - EventBus.$emit('chatSubscribeStop'); history.go(-1); }); }, @@ -189,8 +183,7 @@ export default { this.clearSubscribe(); const header = { group: this.$route.query.group || '', 'X-Token': getToken() }; creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header); - - await this.$store.dispatch('training/setHasSubscribed'); + // await this.$store.dispatch('training/setHasSubscribed'); }, clearSubscribe() { clearSubscribe(`${displayTopic}\/${this.$route.query.group}`); diff --git a/src/views/designPlatform/bigSplitScreen.vue b/src/views/designPlatform/bigSplitScreen.vue index 83958d0ca..18c4579a2 100644 --- a/src/views/designPlatform/bigSplitScreen.vue +++ b/src/views/designPlatform/bigSplitScreen.vue @@ -180,8 +180,6 @@ export default { this.clearSubscribe(); } this.$store.dispatch('training/over').then(() => { - EventBus.$emit('runPlanStop'); - EventBus.$emit('chatSubscribeStop'); history.go(-1); }); }, @@ -196,8 +194,7 @@ export default { this.clearSubscribe(); const header = { group: this.$route.query.group || '', 'X-Token': getToken() }; creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header); - - await this.$store.dispatch('training/setHasSubscribed'); + // await this.$store.dispatch('training/setHasSubscribed'); }, clearSubscribe() { clearSubscribe(`${displayTopic}\/${this.$route.query.group}`); diff --git a/src/views/designPlatform/testRunplan.vue b/src/views/designPlatform/testRunplan.vue index 382ca440f..d37d294f7 100644 --- a/src/views/designPlatform/testRunplan.vue +++ b/src/views/designPlatform/testRunplan.vue @@ -133,8 +133,7 @@ export default { this.clearSubscribe(); const header = { group: this.group || '', 'X-Token': getToken() }; creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header); - - await this.$store.dispatch('training/setHasSubscribed'); + // await this.$store.dispatch('training/setHasSubscribed'); }, clearSubscribe() { clearSubscribe(`${displayTopic}\/${this.group}`); diff --git a/src/views/ibp/ibpsystem/index.vue b/src/views/ibp/ibpsystem/index.vue index c8b33e309..3e8a775c5 100644 --- a/src/views/ibp/ibpsystem/index.vue +++ b/src/views/ibp/ibpsystem/index.vue @@ -281,8 +281,7 @@ export default { this.clearSubscribe(); const header = { group: this.$route.query.group || '', 'X-Token': getToken() }; creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header); - - await this.$store.dispatch('training/setHasSubscribed'); + // await this.$store.dispatch('training/setHasSubscribed'); }, clearSubscribe() { clearSubscribe(`${displayTopic}\/${this.$route.query.group}`); diff --git a/src/views/iscs/iscsSystem/groupNav.vue b/src/views/iscs/iscsSystem/groupNav.vue index dc0263c4c..cbd86420a 100644 --- a/src/views/iscs/iscsSystem/groupNav.vue +++ b/src/views/iscs/iscsSystem/groupNav.vue @@ -345,8 +345,7 @@ export default { this.clearSubscribe(); const header = { group: this.group || '', 'X-Token': getToken() }; creatSubscribe(`${displayTopic}\/${this.group}`, header); - - await this.$store.dispatch('training/setHasSubscribed'); + // await this.$store.dispatch('training/setHasSubscribed'); }, clearSubscribe() { clearSubscribe(`${displayTopic}\/${this.group}`); diff --git a/src/views/iscs/iscsSystem/stationNav.vue b/src/views/iscs/iscsSystem/stationNav.vue index 898f7d5be..1e31eb0b0 100644 --- a/src/views/iscs/iscsSystem/stationNav.vue +++ b/src/views/iscs/iscsSystem/stationNav.vue @@ -381,7 +381,7 @@ export default { this.clearSubscribe(); const header = { group: this.group || '', 'X-Token': getToken() }; creatSubscribe(`${displayTopic}\/${this.group}`, header); - await this.$store.dispatch('training/setHasSubscribed'); + // await this.$store.dispatch('training/setHasSubscribed'); }, clearSubscribe() { clearSubscribe(`${displayTopic}\/${this.group}`); diff --git a/src/views/newMap/displayNew/demon/planSchedule.vue b/src/views/newMap/displayNew/demon/planSchedule.vue index 8387c0eea..8ceacbbb1 100644 --- a/src/views/newMap/displayNew/demon/planSchedule.vue +++ b/src/views/newMap/displayNew/demon/planSchedule.vue @@ -170,7 +170,7 @@ export default { this.clearSubscribe(); const header = { group: this.$route.query.group || '', 'X-Token': getToken() }; creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header); - await this.$store.dispatch('training/setHasSubscribed'); + // await this.$store.dispatch('training/setHasSubscribed'); this.$store.dispatch('app/animationsClose'); }, clearSubscribe() { diff --git a/src/views/newMap/displayNew/practiceDisplay.vue b/src/views/newMap/displayNew/practiceDisplay.vue index 8f3296696..1edba5942 100644 --- a/src/views/newMap/displayNew/practiceDisplay.vue +++ b/src/views/newMap/displayNew/practiceDisplay.vue @@ -161,19 +161,7 @@ export default { this.$store.dispatch('config/resize', { width, height }); }, async back() { - // if (this.group) { - // await clearSimulation(this.group); - // this.clearSubscribe(); - // } - // this.$store.dispatch('map/setShowCentralizedStationCode', ''); - // history.go(-1); - // await this.$store.dispatch('map/mapClear'); - // if (this.group) { - // await clearSimulation(this.group); - // this.clearSubscribe(); - // } window.close(); - // Notification.closeAll(); }, async statusMessage(list) { await this.$store.dispatch('training/updateMapState', list); @@ -182,13 +170,8 @@ export default { async subscribe() { this.clearSubscribe(); const header = { group: this.group || '', 'X-Token': getToken() }; - // creatSubscribe(`${jl3dTopic}\/${this.$route.query.group}`, header); creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header); - // setTimeout(()=>{ - - // }, 500); - // }); - await this.$store.dispatch('training/setHasSubscribed'); + // await this.$store.dispatch('training/setHasSubscribed'); }, clearSubscribe() { clearSubscribe(`${jl3dTopic}\/${this.group}`); diff --git a/src/views/newMap/mapsystemNew/index.vue b/src/views/newMap/mapsystemNew/index.vue index dafcf2a3a..8e9129b4f 100644 --- a/src/views/newMap/mapsystemNew/index.vue +++ b/src/views/newMap/mapsystemNew/index.vue @@ -109,7 +109,6 @@ export default { this.clearSubscribe(); const header = { group: this.$route.query.group || '', 'X-Token': getToken() }; creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header); - await this.$store.dispatch('training/setHasSubscribed'); }, clearSubscribe() { From 572dc1b3bd35079807d1c0d6ab998cf46512178a Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 30 Nov 2020 11:14:52 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=B9=B3=E5=8F=B0=20?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=88=97=E8=A1=A8=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/trainingPlatform/demonList.vue | 59 +++++------------------- 1 file changed, 11 insertions(+), 48 deletions(-) diff --git a/src/views/trainingPlatform/demonList.vue b/src/views/trainingPlatform/demonList.vue index 2eb874f0f..3f2918a4e 100644 --- a/src/views/trainingPlatform/demonList.vue +++ b/src/views/trainingPlatform/demonList.vue @@ -17,7 +17,6 @@ :filter-node-method="filterNode" :default-expanded-keys="expandList" @node-click="clickEvent" - @node-contextmenu="showContextMenu" @node-expand="nodeExpand" @node-collapse="nodeCollapse" > @@ -54,9 +53,6 @@ export default { loading: true, filterText: '', treeList: [], - selected: {}, - node: { - }, mapId: '', expandList: [], filterSelect: '' @@ -79,8 +75,6 @@ export default { this.$refs.tree.filter(val); } }, - beforeDestroy () { - }, mounted() { if (this.getMapByCode) { this.refresh(); @@ -91,12 +85,6 @@ export default { if (!value) return true; return data.name.includes(value); }, - showContextMenu(e, obj, node, vueElem) { - if (obj) { - this.node = node; - this.selected = obj; - } - }, clickEvent(obj, data, ele, isReplace = false) { localStore.set('trainingPlatformCheckId' + this.filterSelect + this.userId + this.project, obj.key); while (data) { @@ -109,11 +97,8 @@ export default { } if ( obj.type === 'Map') { this.mapId = obj.id; - if (isReplace) { - this.$router.replace({ path: `${UrlConfig.trainingPlatform.permission}/${this.mapId}`}); - } else { - this.$router.push({ path: `${UrlConfig.trainingPlatform.permission}/${this.mapId}`}); - } + const router = { path: `${UrlConfig.trainingPlatform.permission}/${this.mapId}`}; + this.toNextPage(isReplace, router); } else if ( obj.type === 'MapSystem') { getSubSystemInfo(obj.id).then(resp => { // 查询子系统信息 let router = ''; @@ -121,44 +106,19 @@ export default { case 'Exam': this.setLocalRoute(`${UrlConfig.trainingPlatform.examHome}/${obj.id}`); router = localStore.get('examDetail' + obj.id); - if (router) { - if (isReplace) { - this.$router.replace(router); - } else { - this.$router.push(router); - } - } else { - if (isReplace) { - this.$router.replace({ path: `${UrlConfig.trainingPlatform.examHome}/${obj.id}`}); - } else { - this.$router.push({ path: `${UrlConfig.trainingPlatform.examHome}/${obj.id}`}); - } - } + if (!router) { router = { path: `${UrlConfig.trainingPlatform.examHome}/${obj.id}`}; } + this.toNextPage(isReplace, router); break; case 'Lesson': this.setLocalRoute(`${UrlConfig.trainingPlatform.teachHome}/${obj.id}`); router = localStore.get('teachDetail' + obj.id); - if (router) { - if (isReplace) { - this.$router.replace(router); - } else { - this.$router.push(router); - } - } else { - if (isReplace) { - this.$router.replace({ path: `${UrlConfig.trainingPlatform.teachHome}/${obj.id}`}); - } else { - this.$router.push({ path: `${UrlConfig.trainingPlatform.teachHome}/${obj.id}`}); - } - } + if (!router) { router = { path: `${UrlConfig.trainingPlatform.teachHome}/${obj.id}`}; } + this.toNextPage(isReplace, router); break; case 'Simulation': this.setLocalRoute(`${UrlConfig.trainingPlatform.prodDetail}/${obj.id}?mapId=${this.mapId}`); - if (isReplace) { - this.$router.replace({ path: `${UrlConfig.trainingPlatform.prodDetail}/${obj.id}`, query: { mapId: this.mapId}}); - } else { - this.$router.push({ path: `${UrlConfig.trainingPlatform.prodDetail}/${obj.id}`, query: { mapId: this.mapId}}); - } + router = { path: `${UrlConfig.trainingPlatform.prodDetail}/${obj.id}`, query: { mapId: this.mapId}}; + this.toNextPage(isReplace, router); break; } }).catch((error) => { @@ -168,6 +128,9 @@ export default { }); } }, + toNextPage(isReplace, router) { + isReplace ? this.$router.replace(router) : this.$router.push(router); + }, setLocalRoute(path) { localStore.set('trainingPlatformRoute' + this.userId + this.project, path); }, From 19d1a6e0b129955044f8de31d183bd99c5b30395 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 30 Nov 2020 13:56:42 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=B9=B3=E5=8F=B0=20?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=AE=9E=E8=AE=AD=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BB=BF=E7=9C=9F=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/en/system.js | 1 + src/i18n/langs/zh/system.js | 1 + src/utils/date.js | 12 ++++++++++++ src/views/system/userSimulation/index.vue | 16 ++-------------- src/views/system/userTraining/index.vue | 18 ++---------------- 5 files changed, 18 insertions(+), 30 deletions(-) diff --git a/src/i18n/langs/en/system.js b/src/i18n/langs/en/system.js index e5dcaf2c6..e467decf7 100644 --- a/src/i18n/langs/en/system.js +++ b/src/i18n/langs/en/system.js @@ -25,6 +25,7 @@ export default { mapName: 'Map Name', trainingName: 'Training Name', trainingUseTime: 'Training Time', + hour:'Hour', minute: 'Minute', second: 'Second', createSimulationTitle: 'Create Simulation Information', diff --git a/src/i18n/langs/zh/system.js b/src/i18n/langs/zh/system.js index 3c9e83713..d646e817e 100644 --- a/src/i18n/langs/zh/system.js +++ b/src/i18n/langs/zh/system.js @@ -25,6 +25,7 @@ export default { mapName: '地图名称', trainingName: '实训名称', trainingUseTime: '实训用时', + hour:'时', minute: '分', second: '秒', createSimulationTitle: '创建仿真信息', diff --git a/src/utils/date.js b/src/utils/date.js index a1a6a8786..2402fca25 100644 --- a/src/utils/date.js +++ b/src/utils/date.js @@ -82,3 +82,15 @@ export function computationTime(time) { } return hours + ':' + minutes + ':' + seconds; } + +export function computationSeconds(seconds, hourUnit, minuteUnit, secondUnit) { + if (seconds) { + const h = parseInt(seconds / 3600); + const m = parseInt((seconds - h * 3600) / 60); + const s = (seconds - h * 3600) % 60; + return h ? `${h} ${hourUnit} ${m} ${minuteUnit} ${s} ${secondUnit}` + : m ? `${m} ${minuteUnit} ${s} ${secondUnit}` + : `${s} ${secondUnit}`; + } + return null; +} diff --git a/src/views/system/userSimulation/index.vue b/src/views/system/userSimulation/index.vue index 7ecfac0a5..00faefae9 100644 --- a/src/views/system/userSimulation/index.vue +++ b/src/views/system/userSimulation/index.vue @@ -8,7 +8,7 @@