From 63200d1a27eabae9b79f9e7194e67e6e614cd21c Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Mon, 8 May 2023 17:31:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=B7=B2=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E4=BB=BF=E7=9C=9F=E6=8F=90=E7=A4=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/trainingPlatform/simulation.vue | 73 +++++++++++++---------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/src/views/trainingPlatform/simulation.vue b/src/views/trainingPlatform/simulation.vue index 7c863de2d..70e5a5e4c 100644 --- a/src/views/trainingPlatform/simulation.vue +++ b/src/views/trainingPlatform/simulation.vue @@ -240,14 +240,17 @@ export default { }, methods: { // 获取用户已经加入的仿真 - getJoinedSimulation() { + getJoinedSimulation(system) { return new Promise((resolve, reject) => { getSimulationJoined().then(res => { const data = res.data; if (data) { - this.$confirm('存在未完成的仿真', '警告', { + const h = this.$createElement; + const msgData = [h('p', null, '存在未完成的仿真:'), h('p', null, `线路:${data.map.name}`), h('p', null, `功能:${data.mapFunctionVO.name}`)]; + this.$confirm('', '警告', { + message: h('div', null, msgData), confirmButtonText: '继续仿真', - cancelButtonText: '退出仿真', + cancelButtonText: system ? '退出并新建仿真' : '退出仿真', type: 'warning', // showClose: false, // 是否显示右上角x distinguishCancelAndClose: true, // close和cancel执行的方法是否有区别 @@ -279,6 +282,9 @@ export default { } else { exitSimulation(data.group); } + if (system) { + this.createNewSimulation(system); + } } }); } @@ -335,38 +341,41 @@ export default { } }, enterSimulation(system) { - this.getJoinedSimulation().then(data => { - if (!data) { - createSimulation(system.id).then(resp => { - const query = { - lineCode: this.$route.query.lineCode, - group: resp.data, - mapId: system.mapId, - simType: system.simType, - project: this.project - }; - if (system.paramVO && system.paramVO.domConfig && system.paramVO.domConfig.client) { - query.client = system.paramVO.domConfig.client; - } - if (system.paramVO && system.paramVO.domConfig && system.paramVO.domConfig.singleClient) { - query.singleClient = system.paramVO.domConfig.singleClient; - } - if (this.loadingProjectList.includes(this.project)) { - this.$store.dispatch('app/transitionAnimations'); - } - this.$router.push({ path: `/display/demon`, query: query }); - launchFullscreen(); - }).catch(error=>{ - if (error.code == 10003) { - this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!'); - } else { - this.$messageBox(this.$t('error.createSimulationFailed') + error.message); - } - this.disabled = false; - }); + this.getJoinedSimulation(system).then(res => { + if (!res) { + this.createNewSimulation(system); } }); }, + createNewSimulation(system) { + createSimulation(system.id).then(resp => { + const query = { + lineCode: this.$route.query.lineCode, + group: resp.data, + mapId: system.mapId, + simType: system.simType, + project: this.project + }; + if (system.paramVO && system.paramVO.domConfig && system.paramVO.domConfig.client) { + query.client = system.paramVO.domConfig.client; + } + if (system.paramVO && system.paramVO.domConfig && system.paramVO.domConfig.singleClient) { + query.singleClient = system.paramVO.domConfig.singleClient; + } + if (this.loadingProjectList.includes(this.project)) { + this.$store.dispatch('app/transitionAnimations'); + } + this.$router.push({ path: `/display/demon`, query: query }); + launchFullscreen(); + }).catch(error=>{ + if (error.code == 10003) { + this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!'); + } else { + this.$messageBox(this.$t('error.createSimulationFailed') + error.message); + } + this.disabled = false; + }); + }, async joinSimulation() { this.$refs.ruleForm.validate((valid) => { if (valid) {