mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
modified 新增ajax put请求
This commit is contained in:
parent
b41e37f48d
commit
32f5c17ffc
@ -64,19 +64,19 @@ class User extends Base {
|
||||
[
|
||||
'info' => '启用',
|
||||
'href' => url('User/open'),
|
||||
'class'=> 'btn-success',
|
||||
'class'=> 'btn-success ajax-put-url',
|
||||
'param'=> [$this->primaryKey],
|
||||
'icon' => 'fa fa-check',
|
||||
'confirm' => 0,
|
||||
'confirm' => 1,
|
||||
'show' => ['status', 0]
|
||||
],
|
||||
[
|
||||
'info' => '禁用',
|
||||
'href' => url('User/close'),
|
||||
'class'=> 'btn-warning',
|
||||
'class'=> 'btn-warning ajax-put-url',
|
||||
'param'=> [$this->primaryKey],
|
||||
'icon' => 'fa fa-close',
|
||||
'confirm' => 0,
|
||||
'confirm' => 1,
|
||||
'show' => ['status', 1]
|
||||
],
|
||||
[
|
||||
|
@ -220,6 +220,52 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* Ajax put by url 请求(改) *
|
||||
*/
|
||||
bodyDom.on('click', '.ajax-put-url', function() {
|
||||
var url = $(this).attr('url'), urlData = '';
|
||||
if( $(this).attr('data') ){
|
||||
urlData = $(this).attr('data');
|
||||
}
|
||||
if( $(this).hasClass('confirm') ){
|
||||
bootbox.confirm({
|
||||
title: "温馨提醒:",
|
||||
message: "您确定要这么做么?",
|
||||
buttons: {
|
||||
cancel: {
|
||||
label: '<i class="fa fa-times"></i> 取消'
|
||||
},
|
||||
confirm: {
|
||||
label: '<i class="fa fa-check"></i> 确定'
|
||||
}
|
||||
},
|
||||
callback: function (result) {
|
||||
if( result ){
|
||||
$.ajax({
|
||||
type: "PUT",
|
||||
url: url,
|
||||
data: urlData
|
||||
}).done(function( data ) {
|
||||
var wait = 1000*data.wait;
|
||||
if (data.code == 1) {
|
||||
$.alertMsg(data.msg);
|
||||
setTimeout(function() {
|
||||
if (data.url) {
|
||||
$.refresh(data.url);
|
||||
}
|
||||
}, wait);
|
||||
} else {
|
||||
$.alertMsg(data.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* Ajax 刷新页面 *
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user