2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-09 17:26:33 +08:00
|
|
|
<div>
|
2019-08-09 10:33:11 +08:00
|
|
|
<div class="actionList">
|
2019-08-16 09:25:12 +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">
|
|
|
|
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elActionScrollbar">
|
2019-08-16 09:25:12 +08:00
|
|
|
<add-action ref="addBehavior" :group="group" @create="create" :buttonName="buttonName" :operateType="operateType" @modifyButtonName="modifyButtonName"></add-action>
|
2019-08-09 17:26:33 +08:00
|
|
|
<el-table
|
|
|
|
v-loading="loading"
|
|
|
|
:data="actionList" border class="actionListTable">
|
2019-08-16 14:37:42 +08:00
|
|
|
<el-table-column prop="reply" label="内容" width="200">
|
2019-08-09 17:26:33 +08:00
|
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="time" label="完成时间" width="200">
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="type" label="动作类型" width="200">
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="操作" width="200">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-row>
|
|
|
|
<el-button type="primary" size="mini" @click="modifyAction(scope.row)">修改</el-button>
|
|
|
|
<el-button type="primary" size="mini" @click="deleteAction(scope.row)">删除</el-button>
|
|
|
|
</el-row>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
</el-scrollbar>
|
|
|
|
</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 09:25:12 +08:00
|
|
|
import {getScriptRecord,deleteScriptAction} from '@/api/simulation';
|
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 {
|
|
|
|
actionList:[],
|
2019-08-08 10:31:46 +08:00
|
|
|
loading:true,
|
|
|
|
behaviorName:"",
|
|
|
|
memberName:"",
|
|
|
|
operateType:"add",
|
|
|
|
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(){
|
|
|
|
this.loadInitData(this.$route.query);
|
2019-08-16 09:25:12 +08:00
|
|
|
// this.memberName=this.$store.state.scriptRecord.memberName;
|
|
|
|
// this.behaviorName=this.$store.state.scriptRecord.behaviorName;
|
2019-07-26 13:32:43 +08:00
|
|
|
},
|
|
|
|
methods:{
|
|
|
|
loadInitData(obj) {
|
|
|
|
let group=obj.group;
|
2019-08-16 09:25:12 +08:00
|
|
|
getScriptRecord(group).then(response=>{
|
|
|
|
this.actionList=response.data.actionVOList;
|
|
|
|
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 09:25:12 +08:00
|
|
|
deleteScriptAction(group,row.id).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(){
|
|
|
|
this.loadInitData(this.$route.query);
|
|
|
|
},
|
2019-08-08 10:31:46 +08:00
|
|
|
create(){
|
|
|
|
this.reloadTable();
|
|
|
|
},
|
|
|
|
modifyAction(row){
|
2019-08-09 10:33:11 +08:00
|
|
|
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
|
|
|
|
div.scrollTop=0;
|
2019-08-08 10:31:46 +08:00
|
|
|
this.operateType="modify";
|
|
|
|
this.buttonName="修改动作"
|
|
|
|
this.$refs.addBehavior.doShow(row);
|
|
|
|
},
|
|
|
|
modifyButtonName(){
|
|
|
|
this.buttonName="添加动作",
|
|
|
|
this.operateType="add"
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
@import "src/styles/mixin.scss";
|
|
|
|
.actionListTable{
|
|
|
|
margin-top: 20px;
|
|
|
|
margin-left: 5px;
|
|
|
|
font-size: 15px;
|
2019-08-08 10:31:46 +08:00
|
|
|
width:802px;
|
2019-07-26 13:32:43 +08:00
|
|
|
}
|
|
|
|
.actionList{
|
2019-08-09 17:26:33 +08:00
|
|
|
margin-top: 10px;
|
2019-07-26 13:32:43 +08:00
|
|
|
margin-left: 5px;
|
|
|
|
font-size: 15px;
|
2019-08-09 17:26:33 +08:00
|
|
|
margin-bottom:10px;
|
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{
|
|
|
|
height:380px;
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
</style>
|