2018-06-07 00:45:47 +08:00
|
|
|
|
$(function () {
|
2018-09-13 16:58:59 +08:00
|
|
|
|
var apiUrl = "api/New";
|
2018-08-26 19:40:21 +08:00
|
|
|
|
var $table = $('table').smartTable({
|
2018-09-13 16:34:32 +08:00
|
|
|
|
url: apiUrl,
|
2018-08-26 19:40:21 +08:00
|
|
|
|
sidePagination: "client",
|
|
|
|
|
showToggle: false,
|
|
|
|
|
showRefresh: false,
|
|
|
|
|
showColumns: false,
|
|
|
|
|
columns: [
|
|
|
|
|
{ title: "登陆名称", field: "UserName" },
|
|
|
|
|
{ title: "显示名称", field: "DisplayName" },
|
|
|
|
|
{ title: "说明信息", field: "Description" },
|
|
|
|
|
{ title: "注册时间", field: "RegisterTime" },
|
|
|
|
|
{
|
|
|
|
|
title: "操作", field: "Id", formatter: function (value, row, index, field) {
|
2018-09-07 15:53:16 +08:00
|
|
|
|
return $.format('<button class="btn btn-success" data-toggle="tooltip" data-id="{0}" data-result="ApproveUser" title="同意授权"><i class="fa fa-check"></i></button> <button class="btn btn-danger" data-toggle="tooltip" data-id="{0}" data-result="RejectUser" title="拒绝授权"><i class="fa fa-remove"></i></button>', value);
|
2018-06-07 00:45:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-08-26 19:40:21 +08:00
|
|
|
|
]
|
|
|
|
|
}).on('click', 'button[data-id]', function () {
|
|
|
|
|
var $this = $(this);
|
|
|
|
|
var id = $this.attr('data-id');
|
|
|
|
|
var result = $this.attr('data-result');
|
2018-06-07 00:45:47 +08:00
|
|
|
|
$.bc({
|
2018-09-13 16:34:32 +08:00
|
|
|
|
id: id, url: apiUrl, method: "put", data: { Id: id, UserStatus: result }, title: result === "ApproveUser" ? "授权用户" : "拒绝用户",
|
2018-06-07 00:45:47 +08:00
|
|
|
|
callback: function (result) {
|
2018-09-07 15:53:16 +08:00
|
|
|
|
if (!result) return;
|
2018-08-26 19:40:21 +08:00
|
|
|
|
$table.bootstrapTable('refresh');
|
2018-09-07 15:53:16 +08:00
|
|
|
|
$('.header .nav').reloadWidget();
|
2018-06-07 00:45:47 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
2018-08-26 19:40:21 +08:00
|
|
|
|
|
|
|
|
|
$('#refreshUsers').tooltip().on('click', function () {
|
|
|
|
|
$table.bootstrapTable('refresh');
|
|
|
|
|
});
|
2016-11-12 15:26:40 +08:00
|
|
|
|
});
|