rt-sim-training-client/src/views/display/tipScriptRecord.vue

293 lines
12 KiB
Vue
Raw Normal View History

2019-07-26 13:32:43 +08:00
<template>
<div class="reminder-drag">
<div class="reminder-box" ref="drapBox">
<div class="tip-title">
<i class="icon el-icon-minus" @click="shrink" v-show="isShrink"></i>
<i class="icon el-icon-plus" @click="shrink" v-show="!isShrink"></i>
<p style="color: #fff;" v-if="isShrink">
<span>{{ title }}</span>
</p>
</div>
<div class="tip-body-box" ref="dragBody">
<div class="tip-body">
2019-08-08 10:31:46 +08:00
<template v-if="displayType=='role'">
2019-07-26 13:32:43 +08:00
<template>
<el-tabs v-model="activeName" type="card">
2019-08-08 10:31:46 +08:00
<el-tab-pane label="角色管理" name="first">
2019-07-26 13:32:43 +08:00
<div class="tab-pane">
<el-scrollbar wrapClass="scrollbar-wrapper">
2019-08-08 10:31:46 +08:00
<role-section ref="roleSection" :group="group" @getBehaviorList="getBehaviorList"></role-section>
2019-07-26 13:32:43 +08:00
</el-scrollbar>
</div>
</el-tab-pane>
2019-08-08 10:31:46 +08:00
<el-tab-pane label="任务目标" name="second">
2019-07-26 13:32:43 +08:00
<div class="tab-pane">
<el-scrollbar wrapClass="scrollbar-wrapper">
<target-condition ref="targetCondition" :group="group"></target-condition>
</el-scrollbar>
</div>
</el-tab-pane>
2019-08-08 10:31:46 +08:00
<el-tab-pane label="任务剧本" name="third">
<div class="tab-pane">
<el-scrollbar wrapClass="scrollbar-wrapper">
<task-script ref="taskScript" :group="group"></task-script>
</el-scrollbar>
</div>
</el-tab-pane>
2019-07-26 13:32:43 +08:00
</el-tabs>
</template>
</template>
2019-08-08 10:31:46 +08:00
<template v-if="displayType=='behavior'">
2019-07-26 13:32:43 +08:00
<div class="tab-pane-big">
2019-08-08 10:31:46 +08:00
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elScrollbar">
<get-behavior ref="getBehavior" :group="group" :memberId="memberId" @backToMember="backToMember" @getActions="getActions" @backToTop="backToTop"></get-behavior>
2019-07-26 13:32:43 +08:00
</el-scrollbar>
</div>
</template>
2019-08-08 10:31:46 +08:00
<template v-if="displayType=='action'">
2019-07-26 13:32:43 +08:00
<div class="tab-pane-big">
2019-08-08 10:31:46 +08:00
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elActionScrollbar">
<get-action ref="getAction" :group="group" :memberId="memberId" :behaviorId="behaviorId" @backToBehavior="backToBehavior" @backToTop="backToActionTop"></get-action>
2019-07-26 13:32:43 +08:00
</el-scrollbar>
</div>
</template>
<el-button-group class="button-group">
2019-08-08 10:31:46 +08:00
<el-button type="primary" @click="saveMaplocation">更新定位</el-button>
2019-07-26 13:32:43 +08:00
<el-button type="primary" @click="saveScenesStage">保存背景</el-button>
<el-button type="success" @click="saveScenesData">保存数据</el-button>
<!-- <el-button type="danger" @click="dumpScenesData">重置剧本</el-button> -->
</el-button-group>
</div>
</div>
</div>
</div>
</template>
<script>
2019-08-08 10:31:46 +08:00
2019-07-26 13:32:43 +08:00
import RoleSection from './scriptRecord/roleSection';
import GetBehavior from './scriptRecord/getBehavior';
import GetAction from './scriptRecord/getAction';
import TargetCondition from './scriptRecord/targetCondition';
2019-08-08 10:31:46 +08:00
import TaskScript from './scriptRecord/taskScript';
2019-07-26 13:32:43 +08:00
import { launchFullscreen, exitFullscreen } from '@/utils/screen';
2019-08-08 10:31:46 +08:00
import {saveScriptScenes, saveScriptData, dumpScriptData,getQuestRecord} from '@/api/simulation';
import {updateMapLocation} from '@/api/quest';
2019-07-26 13:32:43 +08:00
export default {
name: 'TipScriptRecord',
props: {
group: {
type: String,
required: true
},
},
components: {
RoleSection,
GetBehavior,
GetAction,
2019-08-08 10:31:46 +08:00
TargetCondition,
TaskScript
2019-07-26 13:32:43 +08:00
},
data() {
return {
title: '任务录制',
isShrink: false,
memberId:null,
behaviorId:null,
2019-08-08 10:31:46 +08:00
displayType:"role",
2019-07-26 13:32:43 +08:00
activeName:"first",
2019-08-08 10:31:46 +08:00
mapLocation:{},
2019-07-26 13:32:43 +08:00
// isSaveStage: true,
}
},
watch: {
2019-08-08 10:31:46 +08:00
'$store.state.map.mapViewLoadedCount': function (val) {
// debugger;
//
// this.$parent.$parent.$refs['mapCanvas'].$refs['mapCommon'].$refs['jlmapVisual'].$jlmap.setOptions({type: 'zoom', scale:this.mapLocation.scale});
}
2019-07-26 13:32:43 +08:00
},
2019-08-08 10:31:46 +08:00
created() {
2019-07-26 13:32:43 +08:00
},
2019-08-08 10:31:46 +08:00
mounted(){
this.loadInitData(this.$route.query);
this.shrink();
2019-07-26 13:32:43 +08:00
},
methods: {
loadInitData(obj) {
2019-08-08 10:31:46 +08:00
let group=obj.group;
let that=this;
getQuestRecord(group).then(response =>{
let deviceConditionList=response.data.questTargetVO.deviceConditionVOList;
this.$store.dispatch('scriptRecord/updateDeviceCondition', deviceConditionList);
this.$store.dispatch('scriptRecord/updateMemberList', response.data.memberVOList);
this.$store.dispatch('scriptRecord/updateScript', response.data.script);
// if(response.data.mapLocation)
// {
// let mapLocation={"offsetX":response.data.mapLocation.x,"offsetY":response.data.mapLocation.y,"scaleRate":response.data.mapLocation.scale};
// this.mapLocation=mapLocation;
// }
});
2019-07-26 13:32:43 +08:00
},
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-08 10:31:46 +08:00
getBehaviorList(row){
this.displayType="behavior";
this.memberId=row.id;
this.$store.dispatch('scriptRecord/updateMemberName',row.name);
2019-07-26 13:32:43 +08:00
},
backToMember(){
2019-08-08 10:31:46 +08:00
this.displayType="role";
2019-07-26 13:32:43 +08:00
},
backToBehavior(){
2019-08-08 10:31:46 +08:00
this.displayType="behavior";
2019-07-26 13:32:43 +08:00
},
2019-08-08 10:31:46 +08:00
getActions(row){
this.displayType="action";
this.behaviorId=row.id;
this.$store.dispatch('scriptRecord/updateBehaviorName',row.description);
2019-07-26 13:32:43 +08:00
},
saveScenesStage() {
saveScriptScenes(this.group).then(resp => {
// this.isSaveStage = false;
this.$message.success('保存背景成功');
}).catch(error => {
this.$messageBox('保存背景失败!');
})
},
saveScenesData() {
saveScriptData(this.group).then(resp => {
this.$message.success('保存数据成功');
}).catch(error => {
this.$messageBox('保存数据失败!');
})
},
dumpScenesData() {
this.$confirm('此操作将会清除已保存的录制数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
dumpScriptData(this.scriptId).then(resp => {
// this.isSaveStage = true;
this.$message.success('清除数据成功');
}).catch(error => {
this.$messageBox('清除数据失败!');
})
}).catch(error => { })
},
2019-08-08 10:31:46 +08:00
backToTop(){
var div = this.$refs['elScrollbar'].$refs['wrap'];
div.scrollTop=0;
},
backToActionTop(){
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
div.scrollTop=0;
},
saveMaplocation()
{
debugger;
// this.$parent.$parent.$refs['mapCanvas'].$refs['mapCommon'].$refs['jlmapVisual'].$jlmap.$options
// let dataZoom = this.$store.state.map.dataZoom;
// let scriptId=this.$route.query.scriptId;
// let data={scale:dataZoom.scaleRate,x:dataZoom.offsetX,y:dataZoom.offsetY};
// updateMapLocation(scriptId,data).then(response=>{
// this.$message.success('更新定位成功');
// }).catch(error => {
// this.$messageBox(`更新定位失败: ${error.message}`);
// });
}
2019-07-26 13:32:43 +08:00
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.tip-body-box {
position: relative;
// height: 540px;
}
.tab-pane{
height:360px;
}
.tab-pane-big{
height:420px;
}
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;
left: 15px;
bottom: 15px;
2019-08-08 10:31:46 +08:00
width: 995px;
2019-07-26 13:32:43 +08:00
height: 540px;
background-color: #fff;
border-radius: 5px;
overflow: hidden;
z-index: 10;
font-size: 18px;
.tip-title {
width: 100%;
overflow: hidden;
height: 40px;
display: flex;
align-items: center;
flex-direction: row-reverse;
background-color: #409EFF;
border-radius: 5px 5px 0 0;
justify-content: space-between;
padding: 0 10px;
}
.tip-body {
height: 500px;
padding: 10px;
.list-label {
width: 105px;
}
.button-group{
margin-top:15px;
margin-left: 20px;
float:right;
}
}
.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;
}
}
}
</style>