修改 动作列表展现
This commit is contained in:
parent
8f1755162b
commit
08d00d3f93
@ -183,6 +183,7 @@
|
||||
this.$emit('modifyButtonName');
|
||||
this.$message.success('修改动作成功');
|
||||
this.$emit('create');
|
||||
this.resetDisabled();
|
||||
}).catch(error => {
|
||||
this.$messageBox(`修改动作失败: ${error.message}`);
|
||||
});
|
||||
|
@ -5,8 +5,24 @@
|
||||
</div>
|
||||
<div class="tab-pane-big">
|
||||
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elActionScrollbar">
|
||||
<div class="block actionListTable">
|
||||
<el-timeline :reverse="reverse">
|
||||
<el-timeline-item v-for="(actionInfo,index) in actionInfoList" :key="index">
|
||||
<el-card>
|
||||
<div class="actionTable">
|
||||
<div class="detail">{{actionInfo.detail}}</div>
|
||||
<div class="otherInfo">{{actionInfo.otherInfo}}</div>
|
||||
</div>
|
||||
<div class="btnGroup">
|
||||
<el-button type="primary" size="mini" style="margin-left:10px;" @click="modifyAction(actionInfo.row)">修改</el-button>
|
||||
<el-button type="danger" size="mini" @click="deleteAction(actionInfo.id)">删除</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</div>
|
||||
<add-action ref="addBehavior" :group="group" @create="create" :buttonName="buttonName" :operateType="operateType" @modifyButtonName="modifyButtonName"></add-action>
|
||||
<el-table
|
||||
<!-- <el-table
|
||||
v-loading="loading"
|
||||
:data="actionList" border class="actionListTable">
|
||||
<el-table-column prop="reply" label="内容" width="200">
|
||||
@ -23,7 +39,7 @@
|
||||
</el-row>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-table> -->
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</div>
|
||||
@ -31,7 +47,8 @@
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
import AddAction from './addAction';
|
||||
import {getScriptRecord,deleteScriptAction} from '@/api/simulation';
|
||||
import {getScriptRecord,deleteScriptAction,getAvailableDeviceCommand} from '@/api/simulation';
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
export default {
|
||||
name: 'getAction',
|
||||
props: {
|
||||
@ -42,7 +59,10 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
actionList:[],
|
||||
// actionList:[],
|
||||
actionInfoList:[],
|
||||
deviceCommandList:[],
|
||||
reverse:true,
|
||||
loading:true,
|
||||
behaviorName:"",
|
||||
memberName:"",
|
||||
@ -60,9 +80,61 @@
|
||||
},
|
||||
methods:{
|
||||
loadInitData(obj) {
|
||||
let group=obj.group;
|
||||
getAvailableDeviceCommand().then(response=>{
|
||||
this.deviceCommandList=response.data;
|
||||
this.loadOtherData(this.$route.query);
|
||||
});
|
||||
},
|
||||
loadOtherData(obj){
|
||||
let group=obj.group;
|
||||
getScriptRecord(group).then(response=>{
|
||||
this.actionList=response.data.actionVOList;
|
||||
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=actionList.reverse();
|
||||
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;
|
||||
this.actionInfoList.push({id:element.id,detail:member.role+memberName+" 对 "+target.role+targetName+":",otherInfo:element.reply,row:element});
|
||||
break;
|
||||
}
|
||||
case "Command":
|
||||
{
|
||||
let deviceCommand=this.deviceCommandList.find(elem=>{return elem.deviceCommand==element.deviceCommand});
|
||||
switch(element.deviceCommand)
|
||||
{
|
||||
case 'Train_Manual_Route_Blocking_Drive':
|
||||
{
|
||||
this.actionInfoList.push({id:element.id,detail:member.role+memberName+": ",otherInfo:deviceCommand.label,row:element});
|
||||
break;
|
||||
}
|
||||
case 'Train_Manual_Limit_Drive':
|
||||
{
|
||||
this.actionInfoList.push({id:element.id,detail:member.role+memberName+": ",otherInfo:deviceCommand.label,row:element});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
// 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};
|
||||
@ -73,7 +145,7 @@
|
||||
},
|
||||
deleteAction(row){
|
||||
let group=this.$props.group;
|
||||
deleteScriptAction(group,row.id).then(resp => {
|
||||
deleteScriptAction(group,row).then(resp => {
|
||||
this.reloadTable();
|
||||
this.$message.success('删除行为动作成功');
|
||||
}).catch(error => {
|
||||
@ -88,7 +160,7 @@
|
||||
},
|
||||
modifyAction(row){
|
||||
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
|
||||
div.scrollTop=0;
|
||||
div.scrollTop=this.$refs['elActionScrollbar'].wrap.scrollHeight;
|
||||
this.operateType="modify";
|
||||
this.buttonName="修改动作"
|
||||
this.$refs.addBehavior.doShow(row);
|
||||
@ -103,7 +175,7 @@
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
@import "src/styles/mixin.scss";
|
||||
.actionListTable{
|
||||
margin-top: 20px;
|
||||
margin-top: 40px;
|
||||
margin-left: 5px;
|
||||
font-size: 15px;
|
||||
width:802px;
|
||||
@ -120,4 +192,17 @@
|
||||
.tab-pane-big{
|
||||
height:380px;
|
||||
}
|
||||
.actionTable{
|
||||
display:table;
|
||||
padding: 15px;
|
||||
}
|
||||
.detail{
|
||||
display:table-cell;
|
||||
}
|
||||
.otherInfo{
|
||||
display:table-cell;
|
||||
}
|
||||
.btnGroup{
|
||||
padding:0px 10px 10px 10px;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user