调整已加入仿真提示功能
This commit is contained in:
parent
527d16a6df
commit
63200d1a27
@ -240,14 +240,17 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 获取用户已经加入的仿真
|
// 获取用户已经加入的仿真
|
||||||
getJoinedSimulation() {
|
getJoinedSimulation(system) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getSimulationJoined().then(res => {
|
getSimulationJoined().then(res => {
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
if (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: '继续仿真',
|
confirmButtonText: '继续仿真',
|
||||||
cancelButtonText: '退出仿真',
|
cancelButtonText: system ? '退出并新建仿真' : '退出仿真',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
// showClose: false, // 是否显示右上角x
|
// showClose: false, // 是否显示右上角x
|
||||||
distinguishCancelAndClose: true, // close和cancel执行的方法是否有区别
|
distinguishCancelAndClose: true, // close和cancel执行的方法是否有区别
|
||||||
@ -279,6 +282,9 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
exitSimulation(data.group);
|
exitSimulation(data.group);
|
||||||
}
|
}
|
||||||
|
if (system) {
|
||||||
|
this.createNewSimulation(system);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -335,8 +341,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
enterSimulation(system) {
|
enterSimulation(system) {
|
||||||
this.getJoinedSimulation().then(data => {
|
this.getJoinedSimulation(system).then(res => {
|
||||||
if (!data) {
|
if (!res) {
|
||||||
|
this.createNewSimulation(system);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
createNewSimulation(system) {
|
||||||
createSimulation(system.id).then(resp => {
|
createSimulation(system.id).then(resp => {
|
||||||
const query = {
|
const query = {
|
||||||
lineCode: this.$route.query.lineCode,
|
lineCode: this.$route.query.lineCode,
|
||||||
@ -364,8 +375,6 @@ export default {
|
|||||||
}
|
}
|
||||||
this.disabled = false;
|
this.disabled = false;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
async joinSimulation() {
|
async joinSimulation() {
|
||||||
this.$refs.ruleForm.validate((valid) => {
|
this.$refs.ruleForm.validate((valid) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user