代码调整

This commit is contained in:
joylink_cuiweidong 2019-08-08 18:41:44 +08:00
parent 50c57837eb
commit bf9a92d6b7
4 changed files with 60 additions and 83 deletions

View File

@ -105,8 +105,7 @@
row.condition="";
getDeviceCodeByDeviceType(group,params).then(response =>{
let resultData=response.data;
if(index=="Train")
{resultData=JSON.parse(JSON.stringify(response.data).replace(/groupNumber/g,"name"));}
resultData=this.changeData(index,resultData);
this.deviceCodeList=resultData;
})
getDeviceCoditionByDeviceType(params).then(response =>{
@ -118,11 +117,13 @@
let group=this.$props.group;
getDeviceCodeByDeviceType(group,params).then(response =>{
let resultData=response.data;
if(index=="Train")
{resultData=JSON.parse(JSON.stringify(response.data).replace(/groupNumber/g,"name"));}
resultData=this.changeData(index,resultData);
this.paramDeviceCodeList=resultData;
})
},
changeData(param,data){
return param=="Train"?JSON.parse(JSON.stringify(data).replace(/groupNumber/g,"name")):data;
},
deleteOperate(data){
this.$props.ConditionVOList.splice(data,1);
},

View File

@ -70,22 +70,9 @@
let behaviorId=this.$props.behaviorId;
getMembersByGroup(group).then(response=>{
let datalist=response.data;
for(let i=0;i<datalist.length;i++)
{
if(datalist[i].id==memberId)
{
let behaviorList=datalist[i].behaviorVOList;
for(let i=0;i<behaviorList.length;i++)
{
if(behaviorList[i].id==behaviorId)
{
this.actionList=behaviorList[i].actionVOList;
this.loading=false;
return;
}
}
}
}
let behaviorList=datalist.find(elem=>{return elem.id==memberId}).behaviorVOList;
this.actionList=behaviorList.find(elem=>{return elem.id==behaviorId}).actionVOList;
this.loading=false;
});
},
backToMember:function(){
@ -95,8 +82,7 @@
let group=this.$props.group;
let memberId=this.$props.memberId;
let behaviorId=this.$props.behaviorId;
let actionId=row.id;
deleteMemberBehaviorAction(group,memberId,behaviorId,actionId).then(resp => {
deleteMemberBehaviorAction(group,memberId,behaviorId,row.id).then(resp => {
this.reloadTable();
this.$message.success('删除行为动作成功');
}).catch(error => {

View File

@ -1,44 +1,46 @@
<template>
<div>
<div class="behaviorList">
<i class="el-icon-back" @click="backToMember" style="cursor:pointer;"></i>
<span class="titleStyle">{{memberName}}角色<span class="titleStyle">/</span><span class="titleStyle">行为信息</span></span>
</div>
<add-behavior ref="addBehavior" :title="title" :group="group" :memberId="memberId" @create="handleCreate" :operateType="operateType" :buttonName="buttonName" @modifyButtonName="modifyButtonName"></add-behavior>
<div class="behaviorList">行为列表</div>
<el-table
v-loading="loading"
:data="behaviorList" border class="behaviorListTable">
<el-table-column label="是否主动触发" width="150">
<template slot-scope="scope">
<div>{{scope.row.auto?"是":"否"}}</div>
</template>
</el-table-column>
<el-table-column label="目标角色" width="200">
<template slot-scope="scope">
<div>{{scope.row.targetMemberId}}</div>
</template>
</el-table-column>
<el-table-column label="描述" width="200">
<template slot-scope="scope">
<div>{{scope.row.description}}</div>
</template>
</el-table-column>
<el-table-column label="触发条件" width="150">
<template slot-scope="scope">
<div>{{scope.row.conditionVO.triggerType==null?"无":scope.row.conditionVO.triggerType}}</div>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-row>
<el-button type="primary" size="mini" @click="modifyActions(scope.row)">修改</el-button>
<el-button type="primary" size="mini" @click="deleteBehavior(scope.row)">删除</el-button>
</el-row>
<el-row style="margin-top:10px"><el-button type="primary" size="mini" @click="getActions(scope.row)">动作操作</el-button></el-row>
</template>
</el-table-column>
</el-table>
<div class="tab-pane-big">
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elScrollbar">
<div class="behaviorList">
<i class="el-icon-back" @click="backToMember" style="cursor:pointer;"></i>
<span class="titleStyle">{{memberName}}角色<span class="titleStyle">/</span><span class="titleStyle">行为信息</span></span>
</div>
<add-behavior ref="addBehavior" :title="title" :group="group" :memberId="memberId" @create="handleCreate" :operateType="operateType" :buttonName="buttonName" @modifyButtonName="modifyButtonName"></add-behavior>
<div class="behaviorList">行为列表</div>
<el-table
v-loading="loading"
:data="behaviorList" border class="behaviorListTable">
<el-table-column label="是否主动触发" width="150">
<template slot-scope="scope">
<div>{{scope.row.auto?"是":"否"}}</div>
</template>
</el-table-column>
<el-table-column label="目标角色" width="200">
<template slot-scope="scope">
<div>{{scope.row.targetMemberId}}</div>
</template>
</el-table-column>
<el-table-column label="描述" width="200">
<template slot-scope="scope">
<div>{{scope.row.description}}</div>
</template>
</el-table-column>
<el-table-column label="触发条件" width="150">
<template slot-scope="scope">
<div>{{scope.row.conditionVO.triggerType==null?"无":scope.row.conditionVO.triggerType}}</div>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-row>
<el-button type="primary" size="mini" @click="modifyActions(scope.row)">修改</el-button>
<el-button type="primary" size="mini" @click="deleteBehavior(scope.row)">删除</el-button>
</el-row>
<el-row style="margin-top:10px"><el-button type="primary" size="mini" @click="getActions(scope.row)">动作操作</el-button></el-row>
</template>
</el-table-column>
</el-table>
</el-scrollbar>
</div>
</template>
<script>
@ -80,22 +82,14 @@
let memberId=this.$props.memberId;
getMembersByGroup(group).then(response=>{
let datalist=response.data;
for(let i=0;i<datalist.length;i++)
{
if(datalist[i].id==memberId)
{
this.behaviorList=datalist[i].behaviorVOList;
this.loading=false;
return;
}
}
this.behaviorList=datalist.find(elem=>{return elem.id==memberId}).behaviorVOList;
this.loading=false;
});
},
deleteBehavior(row){
let group=this.$props.group;
let memberId=this.$props.memberId;
let behaviorId=row.id;
deleteMemberBehavior(group,memberId,behaviorId).then(resp => {
deleteMemberBehavior(group,memberId,row.id).then(resp => {
this.reloadTable();
this.$message.success('删除任务角色行为成功');
}).catch(error => {
@ -113,7 +107,8 @@
this.operateType="add"
},
modifyActions(row){
this.$emit('backToTop');
var div = this.$refs['elScrollbar'].$refs['wrap'];
div.scrollTop=0;
this.operateType="modify";
this.buttonName="修改行为"
this.$refs.addBehavior.doShow(row);
@ -144,4 +139,7 @@
.titleStyle{
margin-left:10px;
}
.tab-pane-big{
height:420px;
}
</style>

View File

@ -14,11 +14,7 @@
<role-condition-script :group="group" @getBehaviorList="getBehaviorList"></role-condition-script>
</template>
<template v-if="displayType=='behavior'">
<div class="tab-pane-big">
<el-scrollbar wrapClass="scrollbar-wrapper" ref="elScrollbar">
<get-behavior ref="getBehavior" :group="group" :memberId="memberId" @backToMember="backToMember" @getActions="getActions" @backToTop="backToTop"></get-behavior>
</el-scrollbar>
</div>
<get-behavior ref="getBehavior" :group="group" :memberId="memberId" @backToMember="backToMember" @getActions="getActions"></get-behavior>
</template>
<template v-if="displayType=='action'">
<div class="tab-pane-big">
@ -142,10 +138,6 @@
this.displayType="behavior";
this.memberId=id;
},
backToTop(){
var div = this.$refs['elScrollbar'].$refs['wrap'];
div.scrollTop=0;
},
backToActionTop(){
var div = this.$refs['elActionScrollbar'].$refs['wrap'];
div.scrollTop=0;