2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-19 14:09:08 +08:00
|
|
|
<div class="reminder-drag">
|
2019-08-20 13:21:38 +08:00
|
|
|
<div class="reminder-box" ref="drapBox" :style="{height:'100%'}">
|
|
|
|
<div class="actionPane">
|
|
|
|
<get-action ref="getAction" :group="group"></get-action>
|
2019-08-19 14:09:08 +08:00
|
|
|
</div>
|
2019-08-20 13:21:38 +08:00
|
|
|
<el-button-group class="button-group">
|
|
|
|
<el-button type="primary" @click="pauseScript" v-if="isPause" :disabled="executeDisabled">暂停</el-button>
|
|
|
|
<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="success" @click="saveScenesData" :loading="isSavingScript" >{{$t('scriptRecord.saveData')}}</el-button>
|
|
|
|
<!-- 暂停 -->
|
|
|
|
</el-button-group>
|
2019-07-26 13:32:43 +08:00
|
|
|
</div>
|
2019-08-20 12:47:39 +08:00
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
<script>
|
2019-08-20 12:47:39 +08:00
|
|
|
import Vue from 'vue';
|
2019-08-20 15:41:54 +08:00
|
|
|
import GetAction from '../scriptRecord/getAction';
|
2019-08-20 12:47:39 +08:00
|
|
|
import {saveScriptScenes, saveScriptData, dumpScriptData, updateMapLocation, scriptPause, executeScript} from '@/api/simulation';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-19 14:09:08 +08:00
|
|
|
export default {
|
|
|
|
name: 'TipScriptRecord',
|
|
|
|
props: {
|
|
|
|
group: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
GetAction,
|
|
|
|
},
|
|
|
|
// this.$t('scriptRecord.scriptTitle')
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
title:"剧本编制",
|
|
|
|
isShrink: false,
|
|
|
|
mapLocation:{},
|
|
|
|
autoSaveScript: null,
|
|
|
|
isSavingScript:false,
|
2019-08-19 18:24:06 +08:00
|
|
|
isPause:false,
|
|
|
|
executeDisabled:false,
|
2019-08-19 14:09:08 +08:00
|
|
|
// isSaveStage: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
},
|
|
|
|
mounted(){
|
|
|
|
this.initAutoSaveScript();
|
2019-08-20 13:21:38 +08:00
|
|
|
// this.shrink();
|
2019-08-19 14:09:08 +08:00
|
|
|
},
|
|
|
|
beforeDestroy() {
|
|
|
|
this.clearAutoSave();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
jump(obj) {
|
|
|
|
},
|
|
|
|
shrink() {
|
|
|
|
let height = this.$refs.dragBody.offsetHeight + 40;
|
|
|
|
let top = this.$refs.drapBox.style.top;
|
|
|
|
if (this.isShrink) {
|
|
|
|
this.$refs.drapBox.style.height = '40px';
|
|
|
|
this.$refs.drapBox.style.top = '';
|
|
|
|
this.isShrink = false;
|
|
|
|
} else {
|
|
|
|
this.$refs.drapBox.style.height = height + 'px';
|
|
|
|
this.$refs.drapBox.style.top = top;
|
|
|
|
this.isShrink = true;
|
|
|
|
}
|
|
|
|
},
|
2019-08-19 18:24:06 +08:00
|
|
|
setIsParse(isPause){
|
|
|
|
this.isPause=isPause;
|
|
|
|
},
|
|
|
|
setDisabled(data)
|
|
|
|
{
|
|
|
|
this.executeDisabled=!data;
|
|
|
|
},
|
2019-08-19 14:09:08 +08:00
|
|
|
initAutoSaveScript() {
|
|
|
|
const timeout = 1000 * 20;
|
|
|
|
this.clearAutoSave(this.autoSaveScript);
|
|
|
|
this.autoSaveScript = setInterval(this.saveScenesData,timeout);
|
|
|
|
},
|
|
|
|
clearAutoSave() {
|
|
|
|
if (this.autoSaveScript) {
|
|
|
|
clearInterval(this.autoSaveScript);
|
|
|
|
this.autoSaveScript = null;
|
|
|
|
}
|
|
|
|
},
|
2019-08-19 18:24:06 +08:00
|
|
|
pauseScript(){
|
|
|
|
scriptPause(this.group).then(resp => {
|
|
|
|
// this.isSaveStage = false;
|
|
|
|
this.$store.dispatch('scriptRecord/updateSimulationPause',true);
|
|
|
|
// this.$message.success('暂停成功');
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox('暂停失败!');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
executePlayScript(){
|
|
|
|
executeScript(this.group).then(resp => {
|
|
|
|
// this.isSaveStage = false;
|
|
|
|
this.$store.dispatch('scriptRecord/updateSimulationPause',false);
|
|
|
|
// this.$message.success('暂停成功');
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox('恢复失败!');
|
|
|
|
});
|
|
|
|
},
|
2019-08-19 14:09:08 +08:00
|
|
|
saveScenesStage() {
|
2019-08-20 13:21:38 +08:00
|
|
|
|
|
|
|
let data=Vue.prototype.$jlmap.$options;
|
|
|
|
let group=this.$route.query.group;
|
|
|
|
let dataZoom={scale:data.scaleRate,x:data.offsetX,y:data.offsetY};
|
2019-08-19 14:09:08 +08:00
|
|
|
saveScriptScenes(this.group).then(resp => {
|
2019-08-20 13:21:38 +08:00
|
|
|
updateMapLocation(group,dataZoom).then(response=>{
|
|
|
|
// this.$message.success('更新定位成功');
|
|
|
|
this.$message.success('保存背景成功');
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox(`更新定位失败: ${error.message}`);
|
|
|
|
});
|
2019-08-19 14:09:08 +08:00
|
|
|
// this.isSaveStage = false;
|
2019-08-20 13:21:38 +08:00
|
|
|
// this.$message.success('保存背景成功');
|
2019-08-19 14:09:08 +08:00
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox('保存背景失败!');
|
|
|
|
})
|
2019-08-20 13:21:38 +08:00
|
|
|
|
2019-08-19 14:09:08 +08:00
|
|
|
},
|
|
|
|
saveScenesData() {
|
|
|
|
this.isSavingScript=true;
|
|
|
|
saveScriptData(this.group).then(resp => {
|
|
|
|
this.$message.success('保存数据成功');
|
|
|
|
this.isSavingScript=false;
|
|
|
|
this.initAutoSaveScript();
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox(`保存数据失败!: ${error.message}`);
|
|
|
|
this.isSavingScript=false;
|
|
|
|
if (error.code === 40004 || error.code === 40005 || error.code === 40003) {
|
|
|
|
this.clearAutoSave();
|
|
|
|
} else {
|
|
|
|
this.initAutoSaveScript();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
dumpScenesData() {
|
2019-08-19 18:24:06 +08:00
|
|
|
this.clearAutoSave();
|
2019-08-19 14:09:08 +08:00
|
|
|
let group=this.group;
|
|
|
|
this.$confirm('此操作将会清除已保存的编制数据, 是否继续?', '提示', {
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
dumpScriptData(group).then(resp => {
|
|
|
|
// this.isSaveStage = true;
|
2019-08-20 15:41:54 +08:00
|
|
|
this.$parent.$refs['display'].$refs['menuScript'].resetBeginTime();
|
2019-08-19 18:24:06 +08:00
|
|
|
this.$refs["getAction"].loadInitData();
|
|
|
|
this.initAutoSaveScript();
|
2019-08-19 14:09:08 +08:00
|
|
|
this.$message.success('清除数据成功');
|
|
|
|
}).catch(error => {
|
|
|
|
this.$messageBox('清除数据失败!');
|
|
|
|
})
|
2019-08-19 18:24:06 +08:00
|
|
|
}).catch(error => {
|
|
|
|
this.initAutoSaveScript();
|
|
|
|
})
|
2019-08-19 14:09:08 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
|
2019-08-20 13:21:38 +08:00
|
|
|
// .tip-body-box {
|
|
|
|
// position: relative;
|
|
|
|
// height:100%;
|
|
|
|
// }
|
2019-07-26 13:32:43 +08:00
|
|
|
.tab-pane-big{
|
|
|
|
height:420px;
|
2019-08-20 13:21:38 +08:00
|
|
|
// width:100%;
|
|
|
|
// height:100%;
|
2019-07-26 13:32:43 +08:00
|
|
|
}
|
2019-08-08 10:31:46 +08:00
|
|
|
.breadColor{
|
|
|
|
color:#fff;
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
|
|
|
.reminder-box {
|
|
|
|
position: absolute;
|
|
|
|
float: left;
|
2019-08-20 13:21:38 +08:00
|
|
|
left: 0px;
|
|
|
|
top:0px;
|
2019-08-21 10:24:55 +08:00
|
|
|
width: 765px;
|
2019-08-20 13:21:38 +08:00
|
|
|
height:100%;
|
2019-07-26 13:32:43 +08:00
|
|
|
background-color: #fff;
|
|
|
|
overflow: hidden;
|
|
|
|
z-index: 10;
|
|
|
|
font-size: 18px;
|
|
|
|
|
2019-08-20 13:21:38 +08:00
|
|
|
.actionPane{
|
|
|
|
height: 100%;
|
|
|
|
padding-bottom: 80px;
|
2019-07-26 13:32:43 +08:00
|
|
|
}
|
2019-08-20 13:21:38 +08:00
|
|
|
|
|
|
|
.list-label {
|
|
|
|
width: 105px;
|
|
|
|
}
|
|
|
|
.button-group{
|
|
|
|
position: absolute;
|
|
|
|
bottom: 30px;
|
|
|
|
right: 20px;
|
|
|
|
}
|
|
|
|
.actionInfo{
|
|
|
|
margin-top:30px;
|
|
|
|
}
|
|
|
|
.conditionVO{
|
|
|
|
width:400px;
|
|
|
|
}
|
|
|
|
.actionList{
|
|
|
|
margin-top: 10px;
|
|
|
|
margin-left: 5px;
|
|
|
|
font-size: 15px;
|
|
|
|
margin-bottom:10px;
|
|
|
|
}
|
|
|
|
.titleStyle{
|
|
|
|
margin-left:10px;
|
2019-07-26 13:32:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
float: right;
|
|
|
|
margin-right: 10px;
|
|
|
|
cursor: pointer;
|
|
|
|
background-color: #f3f3f3;
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
|
|
|
|
|
|
|
/deep/ {
|
|
|
|
.el-tree-node__content {
|
|
|
|
margin-bottom: 4px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
|
|
|
|
background-color: #d6e5f7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-20 12:47:39 +08:00
|
|
|
</style>
|