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">
|
|
|
|
<i class="el-icon-back" @click="backToMember"></i>
|
|
|
|
<span class="titleStyle">{{memberName}}角色<span class="titleStyle">/</span><span class="titleStyle">{{behaviorName}}行为</span><span class="titleStyle">/</span><span class="titleStyle">动作信息</span></span>
|
|
|
|
</div>
|
2019-08-09 17:26:33 +08:00
|
|
|
<div class="tab-pane-big">
|
|
|
|
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elActionScrollbar">
|
|
|
|
<add-action ref="addBehavior" :group="group" :memberId="memberId" :behaviorId="behaviorId" @create="create" :buttonName="buttonName" :operateType="operateType" @modifyButtonName="modifyButtonName"></add-action>
|
|
|
|
<el-table
|
|
|
|
v-loading="loading"
|
|
|
|
:data="actionList" border class="actionListTable">
|
|
|
|
<el-table-column prop="reply" label="回复消息" width="200">
|
|
|
|
</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-09 10:33:11 +08:00
|
|
|
import {getQuestRecord,deleteMemberBehaviorAction} 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
|
|
|
|
},
|
|
|
|
memberId:{
|
|
|
|
type:String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
behaviorId:{
|
|
|
|
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-08 10:31:46 +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;
|
|
|
|
let memberId=this.$props.memberId;
|
|
|
|
let behaviorId=this.$props.behaviorId;
|
2019-08-09 10:33:11 +08:00
|
|
|
getQuestRecord(group).then(response=>{
|
|
|
|
let datalist=response.data.memberVOList;
|
2019-08-08 18:41:44 +08:00
|
|
|
let behaviorList=datalist.find(elem=>{return elem.id==memberId}).behaviorVOList;
|
|
|
|
this.actionList=behaviorList.find(elem=>{return elem.id==behaviorId}).actionVOList;
|
|
|
|
this.loading=false;
|
2019-07-26 13:32:43 +08:00
|
|
|
});
|
|
|
|
},
|
|
|
|
backToMember:function(){
|
|
|
|
this.$emit('backToBehavior');
|
|
|
|
},
|
|
|
|
deleteAction(row){
|
|
|
|
let group=this.$props.group;
|
|
|
|
let memberId=this.$props.memberId;
|
|
|
|
let behaviorId=this.$props.behaviorId;
|
2019-08-08 18:41:44 +08:00
|
|
|
deleteMemberBehaviorAction(group,memberId,behaviorId,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>
|