2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div class="actionList">
|
|
|
|
<i class="el-icon-back" @click="backToMember"></i>
|
2019-08-08 10:31:46 +08:00
|
|
|
<span class="titleStyle">{{memberName}}角色<span class="titleStyle">/</span><span class="titleStyle">{{behaviorName}}行为</span><span class="titleStyle">/</span><span class="titleStyle">动作信息</span></span>
|
2019-07-26 13:32:43 +08:00
|
|
|
</div>
|
2019-08-08 10:31:46 +08:00
|
|
|
<add-action ref="addBehavior" :group="group" :memberId="memberId" :behaviorId="behaviorId" @create="create" :buttonName="buttonName" :operateType="operateType" @modifyButtonName="modifyButtonName"></add-action>
|
2019-07-26 13:32:43 +08:00
|
|
|
<el-table
|
2019-08-08 10:31:46 +08:00
|
|
|
v-loading="loading"
|
|
|
|
:data="actionList" border class="actionListTable">
|
|
|
|
<el-table-column prop="reply" label="回复消息" width="200">
|
2019-07-26 13:32:43 +08:00
|
|
|
</el-table-column>
|
2019-08-08 10:31:46 +08:00
|
|
|
<el-table-column prop="time" label="完成时间" width="200">
|
2019-07-26 13:32:43 +08:00
|
|
|
</el-table-column>
|
2019-08-08 10:31:46 +08:00
|
|
|
<el-table-column prop="type" label="动作类型" width="200">
|
2019-07-26 13:32:43 +08:00
|
|
|
</el-table-column>
|
2019-08-08 10:31:46 +08:00
|
|
|
<el-table-column label="操作" width="200">
|
2019-07-26 13:32:43 +08:00
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-row>
|
2019-08-08 10:31:46 +08:00
|
|
|
<el-button type="primary" size="mini" @click="modifyAction(scope.row)">修改</el-button>
|
2019-07-26 13:32:43 +08:00
|
|
|
<el-button type="primary" size="mini" @click="deleteAction(scope.row)">删除</el-button>
|
|
|
|
</el-row>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import Vue from 'vue';
|
2019-08-08 10:31:46 +08:00
|
|
|
import AddAction from './addAction';
|
2019-07-26 13:32:43 +08:00
|
|
|
import {getMembersByGroup,deleteMemberBehaviorAction} from '@/api/simulation';
|
|
|
|
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;
|
|
|
|
getMembersByGroup(group).then(response=>{
|
|
|
|
let datalist=response.data;
|
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){
|
|
|
|
this.$emit('backToTop');
|
|
|
|
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{
|
|
|
|
margin-top: 20px;
|
|
|
|
margin-left: 5px;
|
|
|
|
font-size: 15px;
|
|
|
|
}
|
2019-08-08 10:31:46 +08:00
|
|
|
.titleStyle{
|
|
|
|
margin-left:10px;
|
|
|
|
}
|
2019-07-26 13:32:43 +08:00
|
|
|
</style>
|