背景只能保存一次

This commit is contained in:
joylink_cuiweidong 2019-08-21 14:28:34 +08:00
parent 8553a9dcdc
commit 52c4106a75
3 changed files with 24 additions and 5 deletions

View File

@ -6,8 +6,8 @@ const scriptRecord = {
state: {
mapLocation: {}, // 地图定位,
simulationPause: true,
scriptId: ''
scriptId: '',
bgSet: false
},
getters: {
mapLocation: (state)=>{
@ -18,6 +18,9 @@ const scriptRecord = {
},
scriptId: (state)=>{
return state.scriptId;
},
bgSet: (state)=>{
return state.bgSet;
}
},
mutations: {
@ -29,6 +32,9 @@ const scriptRecord = {
},
setscriptId: (state, scriptId) => {
state.scriptId = scriptId;
},
setBgSet: (state, bgSet) => {
state.bgSet = bgSet;
}
},
actions: {
@ -43,6 +49,9 @@ const scriptRecord = {
},
updateScriptId: ({ commit }, scriptId) => {
commit('setscriptId', scriptId);
},
updateBgSet: ({ commit }, bgSet) => {
commit('setBgSet', bgSet);
}
}
};

View File

@ -9,7 +9,7 @@
<el-button type="primary" @click="executePlayScript" v-else :disabled="executeDisabled">恢复并执行</el-button>
<!-- <el-button type="primary" @click="saveMaplocation">{{$t('scriptRecord.saveMaplocation')}}</el-button> -->
<el-button type="danger" @click="dumpScenesData">重置剧本</el-button>
<el-button type="primary" @click="saveScenesStage">{{$t('scriptRecord.saveBackground')}}</el-button>
<el-button type="primary" @click="saveScenesStage" :disabled="backDisabled">{{$t('scriptRecord.saveBackground')}}</el-button>
<el-button type="success" @click="saveScenesData" :loading="isSavingScript" >{{$t('scriptRecord.saveData')}}</el-button>
<!-- 暂停 -->
</el-button-group>
@ -42,13 +42,20 @@ import {saveScriptScenes, saveScriptData, dumpScriptData, updateMapLocation, scr
isSavingScript:false,
isPause:false,
executeDisabled:false,
backDisabled:false,
// isSaveStage: true,
}
},
created() {
},
watch:{
'$store.state.scriptRecord.bgSet': function (val) {
this.backDisabled=val;
},
},
mounted(){
this.initAutoSaveScript();
this.backDisabled=this.$store.state.scriptRecord.bgSet;
// this.shrink();
},
beforeDestroy() {
@ -114,6 +121,7 @@ import {saveScriptScenes, saveScriptData, dumpScriptData, updateMapLocation, scr
saveScriptScenes(this.group).then(resp => {
updateMapLocation(group,dataZoom).then(response=>{
// this.$message.success('');
this.$store.dispatch('scriptRecord/updateBgSet',true);
this.$message.success('保存背景成功');
}).catch(error => {
this.$messageBox(`更新定位失败: ${error.message}`);
@ -154,9 +162,10 @@ import {saveScriptScenes, saveScriptData, dumpScriptData, updateMapLocation, scr
this.$parent.$refs['display'].$refs['menuScript'].resetBeginTime();
this.$refs["getAction"].loadInitData();
this.initAutoSaveScript();
this.$message.success('清除数据成功');
this.$store.dispatch('scriptRecord/updateBgSet',false);
this.$message.success('重置剧本成功');
}).catch(error => {
this.$messageBox('清除数据失败!');
this.$messageBox('重置剧本失败!');
})
}).catch(error => {
this.initAutoSaveScript();

View File

@ -95,6 +95,7 @@
loadOtherData(obj){
let group=obj.group;
getScriptRecord(group).then(response=>{
this.$store.dispatch('scriptRecord/updateBgSet', response.data.bgSet);
this.actionInfoList=[];
let roleTypeList=ConstConfig.ConstSelect.roleType;
let memberVOList=JSON.stringify(response.data.memberVOList);