fastadmin 自定义操作按钮 执行成功后刷新列表


自定义操作按钮 ,执行后自动刷新,注意这里如果定义了 success 需要单独处理刷新逻辑,属性中的refresh:true 就不会生效了

 {field: 'operate',
 title: __('Operate'),
 table: table,
 events: Table.api.events.operate,
 formatter: Table.api.formatter.operate,
  buttons:[
             {
                                   name: "agree",
                                   title: __("通过店铺审核"),
                                   classname: "btn btn-xs btn-success btn-magic btn-ajax",
                                   icon: "fa fa-check",
                                   text: "通过",
                                   confirm: "确认通过审核?",
                                   url: "user/user_real/agree",
                                   refresh:true,
                                   visible: function (e) {
                                      return 0 === e.audit_status;
                                   },
                                   error: function (data, ret) {
                                       console.log(data, ret)
                                       Layer.alert(t.msg)
                                       return false;
                                   },
                               },
                               {
                                   name: "refuse",
                                   title: __("审核不通过"),
                                   classname: "btn btn-xs btn-danger btn-magic btn-ajax",
                                   icon: "fa fa-times",
                                   text: "不通过",
                                   confirm: "确认拒绝吗?",
                                   refresh:true,
                                   url: "user/user_real/refuse",
                                   visible: function (e) {
                                       return 0 === e.audit_status;
                                   },
                                   error: function (data, ret) {
                                       console.log(data, ret)
                                       Layer.alert(t.msg)
                                       return false;
                                   },
                               },
                           ]
                       }

 

 

其中visible控制是否展示

 visible: function (e) {
      return 0 === e.audit_status;
},


参数refresh控制执行成功后是否刷新

refresh:true,

 

error函数 在执行异常时触发 这里打印信息 并弹窗提示

error: function (data, ret) {
   console.log(data, ret)
   Layer.alert(t.msg)
   return false;
},
发布时间 : 2024-04-11,阅读量:1386
本文链接:https://upwqy.com/details/944.html
macOS 系统设置java环境变量 nvm list-remote 只有n/a