功能描述
新增自定义审核按钮,点击审核按钮后,按钮变为取消审核按钮,同理点击取消审核按钮后,按钮变为审核按钮
实现功能如下图
微信图片_20200827112914.png
上代码
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
buttons:[
{
name: 'question',
text:'问卷调查',
title: __('问卷调查'),
classname: 'btn btn-xs btn-primary btn-view btn-dialog',
icon: 'fa fa-list',
url: 'order/question',
},
{
name:'adopt',
text:'通过',
title:'通过',
classname: 'btn btn-xs btn-info btn-view btn-ajax',
icon: 'fa fa-check',
url: 'order/adopt',
visible:function(row){
if(row['status']==0){
return true;
}else{
return false;
}
},
refresh:true
},
{
name:'cancel',
text:'取消通过',
title:'取消通过',
classname: 'btn btn-xs btn-warning btn-view btn-ajax',
icon: 'fa fa-times',
url: 'order/cancel',
visible:function(row){
if(row['status']==1){
return true;
}else{
return false;
}
},
refresh:true
}
],formatter: Table.api.formatter.operate
}
后端逻辑我就不写了,修改status的值就行了