2019-07-26 13:32:43 +08:00
|
|
|
|
<template>
|
2019-08-20 13:21:38 +08:00
|
|
|
|
<div class="actionPaneInner">
|
2019-08-09 10:33:11 +08:00
|
|
|
|
<div class="actionList">
|
2019-08-20 18:31:48 +08:00
|
|
|
|
<span class="titleStyle">剧本编制</span>
|
2019-08-09 10:33:11 +08:00
|
|
|
|
</div>
|
2019-08-09 17:26:33 +08:00
|
|
|
|
<div class="tab-pane-big">
|
2019-08-20 15:41:54 +08:00
|
|
|
|
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elScrollbar" class="elScrollbar">
|
|
|
|
|
<add-action ref="addBehavior" :group="group" @create="create" :buttonName="buttonName" :operateType="operateType" @modifyButtonName="modifyButtonName" class="addScript"></add-action>
|
|
|
|
|
</el-scrollbar>
|
2019-08-20 13:21:38 +08:00
|
|
|
|
<!-- <div class="vertialLine"></div> -->
|
2019-08-16 19:33:40 +08:00
|
|
|
|
<div class="block actionListTable">
|
2019-08-20 13:21:38 +08:00
|
|
|
|
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elActionScrollbar">
|
|
|
|
|
<el-timeline :reverse="reverse" class="el_timeline">
|
2019-08-16 19:33:40 +08:00
|
|
|
|
<el-timeline-item v-for="(actionInfo,index) in actionInfoList" :key="index">
|
|
|
|
|
<el-card>
|
|
|
|
|
<div class="actionTable">
|
2019-08-16 20:06:14 +08:00
|
|
|
|
<span class="detail" v-html="actionInfo.detail">
|
|
|
|
|
</span>
|
|
|
|
|
<span class="otherInfo">{{actionInfo.otherInfo}}</span>
|
2019-08-16 19:33:40 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="btnGroup">
|
2019-08-19 18:24:06 +08:00
|
|
|
|
<el-button type="primary" size="mini" style="margin-left:10px;" @click="modifyAction(actionInfo.row)" :disabled="actionInfo.disabled">修改</el-button>
|
|
|
|
|
<!-- <el-button type="danger" size="mini" @click="deleteAction(actionInfo.id)">删除</el-button> -->
|
2019-08-16 19:33:40 +08:00
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-timeline-item>
|
|
|
|
|
</el-timeline>
|
2019-08-20 13:21:38 +08:00
|
|
|
|
</el-scrollbar>
|
2019-08-16 19:33:40 +08:00
|
|
|
|
</div>
|
2019-08-09 17:26:33 +08:00
|
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import Vue from 'vue';
|
2019-08-08 10:31:46 +08:00
|
|
|
|
import AddAction from './addAction';
|
2019-08-16 19:33:40 +08:00
|
|
|
|
import {getScriptRecord,deleteScriptAction,getAvailableDeviceCommand} from '@/api/simulation';
|
|
|
|
|
import ConstConfig from '@/scripts/ConstConfig';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
export default {
|
2019-08-08 10:31:46 +08:00
|
|
|
|
name: 'getAction',
|
2019-07-26 13:32:43 +08:00
|
|
|
|
props: {
|
|
|
|
|
group: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2019-08-16 19:33:40 +08:00
|
|
|
|
// actionList:[],
|
|
|
|
|
actionInfoList:[],
|
|
|
|
|
deviceCommandList:[],
|
|
|
|
|
reverse:true,
|
2019-08-08 10:31:46 +08:00
|
|
|
|
loading:true,
|
|
|
|
|
behaviorName:"",
|
|
|
|
|
memberName:"",
|
|
|
|
|
operateType:"add",
|
2019-08-20 18:31:48 +08:00
|
|
|
|
buttonName:"添加对话",
|
2019-07-26 13:32:43 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2019-08-08 10:31:46 +08:00
|
|
|
|
components: {
|
|
|
|
|
AddAction,
|
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
mounted(){
|
2019-08-19 18:24:06 +08:00
|
|
|
|
this.loadInitData();
|
2019-07-26 13:32:43 +08:00
|
|
|
|
},
|
2019-08-20 18:31:48 +08:00
|
|
|
|
watch:{
|
|
|
|
|
actionInfoList: function(val){
|
|
|
|
|
this.$nextTick(function(){
|
|
|
|
|
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
|
|
|
|
|
div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
methods:{
|
2019-08-19 18:24:06 +08:00
|
|
|
|
loadInitData() {
|
|
|
|
|
let group=this.$route.query.group;
|
2019-08-20 17:54:40 +08:00
|
|
|
|
let data={role:"Driver"};
|
|
|
|
|
getAvailableDeviceCommand(data).then(response=>{
|
2019-08-16 19:33:40 +08:00
|
|
|
|
this.deviceCommandList=response.data;
|
|
|
|
|
this.loadOtherData(this.$route.query);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
loadOtherData(obj){
|
2019-07-26 13:32:43 +08:00
|
|
|
|
let group=obj.group;
|
2019-08-16 09:25:12 +08:00
|
|
|
|
getScriptRecord(group).then(response=>{
|
2019-08-16 19:33:40 +08:00
|
|
|
|
this.actionInfoList=[];
|
|
|
|
|
let roleTypeList=ConstConfig.ConstSelect.roleType;
|
|
|
|
|
let memberVOList=JSON.stringify(response.data.memberVOList);
|
|
|
|
|
roleTypeList.forEach(function(element){
|
|
|
|
|
let rolename=element.value;
|
|
|
|
|
memberVOList=memberVOList.replace(new RegExp(rolename,'g'),element.label);
|
|
|
|
|
});
|
|
|
|
|
memberVOList=JSON.parse(memberVOList);
|
|
|
|
|
let actionList=response.data.actionVOList;
|
|
|
|
|
actionList.forEach(element => {
|
|
|
|
|
let member=memberVOList.find(elem=>{return elem.id==element.memberId});
|
|
|
|
|
let memberName=member.name==undefined?"":" - "+member.name;
|
|
|
|
|
switch(element.type)
|
|
|
|
|
{
|
|
|
|
|
case "Conversation":
|
|
|
|
|
{
|
|
|
|
|
let target=memberVOList.find(elem=>{return elem.id==element.targetId});
|
|
|
|
|
let targetName=target.name==undefined?"":" - "+target.name;
|
2019-08-19 18:24:06 +08:00
|
|
|
|
this.actionInfoList.push({id:element.id,detail:"<span style='color:#409EFF'>"+member.role+memberName+"</span>"+" 对 "+"<span style='color:#409EFF'>"+target.role+targetName+"</span>:",otherInfo:element.reply,row:element,disabled:false});
|
2019-08-16 19:33:40 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case "Command":
|
|
|
|
|
{
|
|
|
|
|
let deviceCommand=this.deviceCommandList.find(elem=>{return elem.deviceCommand==element.deviceCommand});
|
|
|
|
|
switch(element.deviceCommand)
|
|
|
|
|
{
|
|
|
|
|
case 'Train_Manual_Route_Blocking_Drive':
|
|
|
|
|
{
|
2019-08-19 18:24:06 +08:00
|
|
|
|
this.actionInfoList.push({id:element.id,detail:"<span style='color:#409EFF'>"+member.role+memberName+"</span>执行指令 :",otherInfo:deviceCommand.label,row:element,disabled:true});
|
2019-08-16 19:33:40 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'Train_Manual_Limit_Drive':
|
|
|
|
|
{
|
2019-08-19 18:24:06 +08:00
|
|
|
|
this.actionInfoList.push({id:element.id,detail:"<span style='color:#409EFF'>"+member.role+memberName+"</span>执行指令 : ",otherInfo:deviceCommand.label,row:element,disabled:true});
|
2019-08-16 19:33:40 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2019-08-16 09:25:12 +08:00
|
|
|
|
if(response.data.mapLocation)
|
|
|
|
|
{
|
|
|
|
|
let mapLocation={"offsetX":response.data.mapLocation.x,"offsetY":response.data.mapLocation.y,"scaleRate":response.data.mapLocation.scale};
|
|
|
|
|
this.$store.dispatch('scriptRecord/updateMapLocation', mapLocation);
|
|
|
|
|
}
|
2019-08-08 18:41:44 +08:00
|
|
|
|
this.loading=false;
|
2019-07-26 13:32:43 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
deleteAction(row){
|
|
|
|
|
let group=this.$props.group;
|
2019-08-16 19:33:40 +08:00
|
|
|
|
deleteScriptAction(group,row).then(resp => {
|
2019-07-26 13:32:43 +08:00
|
|
|
|
this.reloadTable();
|
2019-08-08 10:31:46 +08:00
|
|
|
|
this.$message.success('删除行为动作成功');
|
2019-07-26 13:32:43 +08:00
|
|
|
|
}).catch(error => {
|
2019-08-08 10:31:46 +08:00
|
|
|
|
this.$messageBox(`删除行为动作失败: ${error.message}`);
|
2019-07-26 13:32:43 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
reloadTable(){
|
2019-08-19 18:24:06 +08:00
|
|
|
|
this.loadInitData();
|
2019-07-26 13:32:43 +08:00
|
|
|
|
},
|
2019-08-20 18:31:48 +08:00
|
|
|
|
create(data){
|
2019-08-08 10:31:46 +08:00
|
|
|
|
this.reloadTable();
|
|
|
|
|
},
|
|
|
|
|
modifyAction(row){
|
|
|
|
|
this.operateType="modify";
|
2019-08-20 18:31:48 +08:00
|
|
|
|
this.buttonName="修改对话"
|
2019-08-08 10:31:46 +08:00
|
|
|
|
this.$refs.addBehavior.doShow(row);
|
|
|
|
|
},
|
|
|
|
|
modifyButtonName(){
|
2019-08-20 18:31:48 +08:00
|
|
|
|
this.buttonName="添加对话",
|
2019-08-08 10:31:46 +08:00
|
|
|
|
this.operateType="add"
|
|
|
|
|
}
|
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
|
|
|
|
.actionPaneInner{
|
|
|
|
|
height:100%;
|
|
|
|
|
padding-top:70px;
|
|
|
|
|
}
|
2019-08-19 14:09:08 +08:00
|
|
|
|
.addScript{
|
|
|
|
|
float:left;
|
|
|
|
|
width:450px;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
.actionListTable{
|
|
|
|
|
font-size: 15px;
|
2019-08-20 13:21:38 +08:00
|
|
|
|
width:490px;
|
2019-08-19 14:09:08 +08:00
|
|
|
|
display: inline-block;
|
|
|
|
|
margin-left:450px;
|
2019-08-20 13:21:38 +08:00
|
|
|
|
height:100%;
|
2019-07-26 13:32:43 +08:00
|
|
|
|
}
|
|
|
|
|
.actionList{
|
2019-08-20 13:21:38 +08:00
|
|
|
|
padding-top: 20px;
|
|
|
|
|
margin-left: 20px;
|
2019-07-26 13:32:43 +08:00
|
|
|
|
font-size: 15px;
|
2019-08-20 13:21:38 +08:00
|
|
|
|
padding-bottom: 15px;
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
margin-right: 20px;
|
|
|
|
|
width: 940px;
|
|
|
|
|
border-bottom: 1px #ccc solid;
|
2019-07-26 13:32:43 +08:00
|
|
|
|
}
|
2019-08-08 10:31:46 +08:00
|
|
|
|
.titleStyle{
|
|
|
|
|
margin-left:10px;
|
|
|
|
|
}
|
2019-08-09 17:26:33 +08:00
|
|
|
|
.tab-pane-big{
|
2019-08-20 13:21:38 +08:00
|
|
|
|
height:100%;
|
|
|
|
|
padding-bottom: 20px;
|
|
|
|
|
position: relative;
|
2019-08-09 17:26:33 +08:00
|
|
|
|
}
|
2019-08-16 19:33:40 +08:00
|
|
|
|
.actionTable{
|
2019-08-19 14:09:08 +08:00
|
|
|
|
width:370px;
|
|
|
|
|
padding: 15px 0px 10px 15px;
|
2019-08-16 20:06:14 +08:00
|
|
|
|
display: inline-block;
|
|
|
|
|
line-height: 200%;
|
2019-08-16 19:33:40 +08:00
|
|
|
|
}
|
|
|
|
|
.btnGroup{
|
2019-08-16 20:06:14 +08:00
|
|
|
|
padding: 10px 10px 10px 10px;
|
|
|
|
|
float:right;
|
|
|
|
|
vertical-align: top;
|
|
|
|
|
display: inline-block;
|
2019-08-16 19:33:40 +08:00
|
|
|
|
}
|
2019-08-19 18:24:06 +08:00
|
|
|
|
.vertialLine{
|
2019-08-20 13:21:38 +08:00
|
|
|
|
height: 100%;
|
2019-08-19 18:24:06 +08:00
|
|
|
|
margin-left: 440px;
|
|
|
|
|
border-right: 1px #dadada solid;
|
2019-08-20 13:21:38 +08:00
|
|
|
|
position:absolute;
|
2019-08-19 18:24:06 +08:00
|
|
|
|
width: 0px;
|
|
|
|
|
}
|
2019-08-20 13:21:38 +08:00
|
|
|
|
.el_timeline{
|
|
|
|
|
width: 470px;
|
|
|
|
|
margin-top:10px;
|
|
|
|
|
}
|
2019-08-20 15:41:54 +08:00
|
|
|
|
.elScrollbar{
|
|
|
|
|
width: 450px;
|
|
|
|
|
position: absolute;
|
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
|
</style>
|