代码调整

This commit is contained in:
dong 2022-09-01 13:54:10 +08:00
parent 7f5f1e7851
commit b3083b8dc8

View File

@ -1,5 +1,5 @@
<template>
<div class="editContent" :class="{'active': dialogVisible}">
<div class="editContent" :class="{'active': dialogVisible && record}">
<div class="editContentTab">
<div v-if="tabVisible && record" class="editContentTabLable" @click="minisize">
<span class="titleStyle">{{ $t('trainingManage.editTagTitle') }}</span>
@ -85,6 +85,13 @@
</el-tab-pane>
<el-tab-pane label="背景" name="Background">
<div class="tabPaneBox">
<div>
<el-form ref="form" :model="bgSceneObj" label-width="80px">
<el-form-item label="更新时间">
<span>{{ bgSceneObj.systemTime || '' }}</span>
</el-form-item>
</el-form>
</div>
<div class="tabPaneFooter">
<el-button size="small" type="primary" @click="saveScenesStage">{{ $t('trainingManage.saveBackground') }}</el-button>
</div>
@ -283,11 +290,26 @@ export default {
this.tableData = [];
});
},
getTrainingAllInfo(data) {
getTrainingAll(data.id).then(res => {
console.log(res, '获取详细信息成功');
}).catch(err => {
console.log(err, '获取详细信息失败');
getTrainingAllInfo(id) {
return new Promise((resolve, reject) => {
getTrainingAll(id).then(res => {
console.log(res, '获取详细信息成功');
const data = {
...res.data
};
const objArr = ['bgSceneJson', 'mapLocationJson'];
objArr.forEach(key => {
data[key] = res.data[key] ? JSON.parse(res.data[key]) : {};
});
const arr = ['labelJson', 'memberJson', 'playerIdJson', 'stepJson'];
arr.forEach(key => {
data[key] = res.data[key] ? JSON.parse(res.data[key]) : [];
});
resolve(data);
}).catch(err => {
console.log(err, '获取详细信息失败');
reject(err);
});
});
},
updateMapLocation() {
@ -306,6 +328,11 @@ export default {
updateTrainingBackgroud({id: this.editData.id, groupId: this.group}).then(res => {
console.log('保存背景', res);
this.$message.success('保存背景成功!');
this.getTrainingAllInfo(this.editData.id).then(suc => {
this.bgSceneObj = suc.bgSceneJson;
}).catch(() => {
this.bgSceneObj = {};
});
}).catch(err => {
console.log('保存背景失败', err);
this.$message.error('保存背景失败');