功能描述
新增自定義審核按鈕,點擊審核按鈕后,按鈕變為取消審核按鈕,同理點擊取消審核按鈕后,按鈕變為審核按鈕
實現功能如下圖
微信圖片_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的值就行了