diff --git a/Bootstrap.Admin/Controllers/Api/DictsController.cs b/Bootstrap.Admin/Controllers/Api/DictsController.cs
index 0ffd186f..862c3f1d 100644
--- a/Bootstrap.Admin/Controllers/Api/DictsController.cs
+++ b/Bootstrap.Admin/Controllers/Api/DictsController.cs
@@ -39,10 +39,9 @@ namespace Bootstrap.Admin.Controllers.Api
///
[HttpDelete]
[Authorize(Roles = "Administrators")]
- public object Delete([FromBody]IEnumerable value)
+ public bool Delete([FromBody]IEnumerable value)
{
- var result = DictHelper.DeleteDict(value);
- return new { result, msg = result ? "成功!" : "失败" };
+ return DictHelper.DeleteDict(value);
}
}
}
\ No newline at end of file
diff --git a/Bootstrap.Admin/wwwroot/js/common-scripts.js b/Bootstrap.Admin/wwwroot/js/common-scripts.js
index bfcef974..49bcd801 100644
--- a/Bootstrap.Admin/wwwroot/js/common-scripts.js
+++ b/Bootstrap.Admin/wwwroot/js/common-scripts.js
@@ -24,7 +24,7 @@
nestMenu: function (callback) {
var $this = $(this);
$.bc({
- id: 0, url: Menu.url, data: { type: "user" }, swal: false,
+ id: 0, url: Menu.url, data: { type: "user" },
callback: function (result) {
var html = "";
if ($.isArray(result)) html = cascadeMenu(result);
@@ -47,7 +47,6 @@
var that = this;
$.bc({
url: Notifications.url,
- swal: false,
method: 'GET',
callback: function (result) {
$('#logoutNoti').text(result.NewUsersCount === 0 ? "" : result.NewUsersCount);
diff --git a/Bootstrap.Admin/wwwroot/js/dicts.js b/Bootstrap.Admin/wwwroot/js/dicts.js
index 3112a474..b2f1f5c7 100644
--- a/Bootstrap.Admin/wwwroot/js/dicts.js
+++ b/Bootstrap.Admin/wwwroot/js/dicts.js
@@ -24,7 +24,7 @@
// autocomplete
$.bc({
- url: "api/Category", swal: false, method: 'get',
+ url: "api/Category", method: 'get',
callback: function (result) {
var data = result.map(function (ele, index) { return ele.Category; });
$('#txt_dict_cate').typeahead({
diff --git a/Bootstrap.Admin/wwwroot/js/exceptions.js b/Bootstrap.Admin/wwwroot/js/exceptions.js
index 78c991d1..50f6e490 100644
--- a/Bootstrap.Admin/wwwroot/js/exceptions.js
+++ b/Bootstrap.Admin/wwwroot/js/exceptions.js
@@ -36,7 +36,7 @@
$('#btn_view').on('click', function (row) {
$.bc({
- url: Exceptions.url, swal: false,
+ url: Exceptions.url,
callback: function (result) {
var html = result.map(function (ele) {
return $.format('', ele);
@@ -54,7 +54,7 @@
$errorDetail.show();
$dataFormDetail.html('
');
$.bc({
- url: Exceptions.url, method: "PUT", swal: false, data: { FileName: fileName },
+ url: Exceptions.url, method: "PUT", data: { FileName: fileName },
callback: function (result) {
$dataFormDetail.html(result);
}
diff --git a/Bootstrap.Admin/wwwroot/js/groups.js b/Bootstrap.Admin/wwwroot/js/groups.js
index 72f7512e..356a30c4 100644
--- a/Bootstrap.Admin/wwwroot/js/groups.js
+++ b/Bootstrap.Admin/wwwroot/js/groups.js
@@ -17,7 +17,7 @@
events: {
'#btn_assignRole': function (row) {
$.bc({
- id: row.Id, url: Role.url, data: { type: "group" }, swal: false,
+ id: row.Id, url: Role.url, data: { type: "group" },
callback: function (result) {
var htmlTemplate = this.htmlTemplate;
var html = $.map(result, function (element, index) {
@@ -33,7 +33,7 @@
},
'#btn_assignUser': function (row) {
$.bc({
- id: row.Id, url: User.url, data: { type: "group" }, swal: false,
+ id: row.Id, url: User.url, data: { type: "group" },
callback: function (result) {
var htmlTemplate = this.htmlTemplate;
var html = $.map(result, function (element, index) {
@@ -52,14 +52,14 @@
var roleIds = $dialogRole.find('input:checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
- $.bc({ id: groupId, url: Role.url, method: "PUT", data: { type: "group", roleIds: roleIds }, title: Role.title, modal: '#dialogRole' });
+ $.bc({ id: groupId, url: Role.url, method: "PUT", data: { type: "group", roleIds: roleIds }, title: Role.title, modal: '#dialogRole', info: true });
},
'#btnSubmitUser': function (row) {
var groupId = row.Id;
var userIds = $dialogUser.find(':checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
- $.bc({ id: groupId, url: User.url, method: "PUT", data: { type: "group", userIds: userIds }, title: User.title, modal: '#dialogUser' });
+ $.bc({ id: groupId, url: User.url, method: "PUT", data: { type: "group", userIds: userIds }, title: User.title, modal: '#dialogUser', info: true });
}
}
},
diff --git a/Bootstrap.Admin/wwwroot/js/login.js b/Bootstrap.Admin/wwwroot/js/login.js
index 43d1a2a3..215f13dc 100644
--- a/Bootstrap.Admin/wwwroot/js/login.js
+++ b/Bootstrap.Admin/wwwroot/js/login.js
@@ -17,7 +17,6 @@
url: 'api/New',
data: { UserName: $('#userName').val(), Password: $('#password').val(), DisplayName: $('#displayName').val(), Description: $('#description').val() },
modal: '#dialogNew',
- swal: false,
callback: function (result) {
var title = result ? "提交成功
等待管理员审批" : "提交失败";
swal({ html: true, showConfirmButton: false, showCancelButton: false, timer: 1500, title: title, type: result ? "success" : "error" });
diff --git a/Bootstrap.Admin/wwwroot/js/longbow.common.js b/Bootstrap.Admin/wwwroot/js/longbow.common.js
index 42094234..208dfbf3 100644
--- a/Bootstrap.Admin/wwwroot/js/longbow.common.js
+++ b/Bootstrap.Admin/wwwroot/js/longbow.common.js
@@ -122,18 +122,17 @@
method: "post",
htmlTemplate: '',
title: "",
- swal: true,
modal: null,
loading: false,
loadingTimeout: 10000,
callback: null,
$element: null,
async: true,
- toastr: false
+ info: false
}, options);
if (!options.url || options.url === "") {
- lgbSwal({ title: '参数错误', text: '未设置请求地址Url', type: 'error' });
+ toastr.error('参数错误: 未设置请求地址Url');
return;
}
@@ -160,31 +159,21 @@
success(result);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
- if (options.toastr && toastr) {
- options.toastr = $.extend({ msg: "未设置", title: "系统错误" }, options.toastr);
- toastr.error(options.toastr.msg, options.toastr.title);
- }
success(false);
}
});
}
function success(result) {
- var interval = 10;
if ($.isFunction(options.callback)) {
options.callback.call(options.$element === null ? options : options.$element, result);
}
if (options.modal !== null && (result || options.loading)) {
$(options.modal).modal('hide');
- interval = 400;
}
- window.setTimeout(function () {
- if (options.swal) {
- lgbSwal({ title: options.title + (result ? "成功" : "失败"), type: result ? 'success' : 'error' });
- }
- if ($.isFunction(callback)) {
- callback.call(options.$element === null ? this : options.$element);
- }
- }, interval);
+ if (options.info) toastr[result ? 'success' : 'error'](options.title + (result ? "成功" : "失败"));
+ if ($.isFunction(callback)) {
+ callback.call(options.$element === null ? this : options.$element);
+ }
}
},
lgbSwal: function (options) {
@@ -274,7 +263,14 @@
editField: "Id",
queryButton: false
}, options.smartTable);
- if (settings.edit) settings.columns.unshift({ title: settings.editTitle, field: settings.editField, events: bsa.idEvents(), formatter: DataTable.idFormatter });
+ if (settings.edit) settings.columns.unshift({
+ title: settings.editTitle,
+ field: settings.editField,
+ events: bsa.idEvents(),
+ formatter: function (value, row, index) {
+ return "" + this.title + "";
+ }
+ });
if (settings.checkbox) settings.columns.unshift({ checkbox: true });
return this.smartTable(settings);
},
@@ -329,8 +325,6 @@
$.bc({
url: uri,
id: this.sendMessage,
- swal: false,
- toastr: false,
callback: function (result) {
if (!result) {
that.errorHandler.call(that.target);
diff --git a/Bootstrap.Admin/wwwroot/js/longbow.dataentity.js b/Bootstrap.Admin/wwwroot/js/longbow.dataentity.js
index 8dab493a..495ecb58 100644
--- a/Bootstrap.Admin/wwwroot/js/longbow.dataentity.js
+++ b/Bootstrap.Admin/wwwroot/js/longbow.dataentity.js
@@ -145,10 +145,6 @@
$.bc({
url: options.url, data: iDs, method: 'DELETE', title: '删除数据',
callback: function (result) {
- if ($.isPlainObject(result)) {
- lgbSwal({ title: result.msg, type: result.result ? "success" : "error" });
- result = result.result;
- }
if (result) $(options.bootstrapTable).bootstrapTable('refresh');
handlerCallback.call(that, null, element, { oper: 'del', success: result });
}
@@ -162,7 +158,7 @@
var that = this;
var options = $.extend(true, {}, this.options, { data: this.dataEntity.get() });
$.bc({
- url: options.url, data: options.data, title: "保存数据", modal: options.modal,
+ url: options.url, data: options.data, title: "保存数据", modal: options.modal, info: true,
callback: function (result) {
if (result) {
var finalData = null;
@@ -194,10 +190,6 @@
}
};
- DataTable.idFormatter = function (value, row, index) {
- return "编辑";
- };
-
DataTable.prototype = {
constructor: DataTable,
idEvents: function () {
diff --git a/Bootstrap.Admin/wwwroot/js/menus.js b/Bootstrap.Admin/wwwroot/js/menus.js
index 48af857d..638bfe02 100644
--- a/Bootstrap.Admin/wwwroot/js/menus.js
+++ b/Bootstrap.Admin/wwwroot/js/menus.js
@@ -42,7 +42,7 @@
events: {
'#btn_assignRole': function (row) {
$.bc({
- id: row.Id, url: Role.url, data: { type: "menu" }, swal: false,
+ id: row.Id, url: Role.url, data: { type: "menu" },
callback: function (result) {
var htmlTemplate = this.htmlTemplate;
var html = $.map(result, function (element, index) {
@@ -61,7 +61,7 @@
var roleIds = $dialogRole.find('input:checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
- $.bc({ id: menuId, url: Role.url, method: "PUT", data: { type: "menu", roleIds: roleIds }, title: Role.title, modal: '#dialogRole' });
+ $.bc({ id: menuId, url: Role.url, method: "PUT", data: { type: "menu", roleIds: roleIds }, title: Role.title, modal: '#dialogRole', info: true });
}
},
callback: function (result) {
@@ -235,7 +235,6 @@
$.bc({
url: Menu.iconView,
- swal: false,
contentType: 'text/html',
dataType: 'html',
method: 'GET',
diff --git a/Bootstrap.Admin/wwwroot/js/message.js b/Bootstrap.Admin/wwwroot/js/message.js
index eb89d9e2..a4333c40 100644
--- a/Bootstrap.Admin/wwwroot/js/message.js
+++ b/Bootstrap.Admin/wwwroot/js/message.js
@@ -2,9 +2,9 @@
function loadData() {
$.bc({
- url: Messages.url, method: 'GET', swal: false,
+ url: Messages.url, method: 'GET',
callback: function (result) {
- if (result) {
+ if (result) {
$('#s_inbox').text(result.inboxCount);
$('#s_sendmail').text(result.sendmailCount);
$('#s_mark').text(result.markCount);
@@ -18,19 +18,19 @@
function listData(options) {
$.bc({
- id: options.id, url: Messages.url, method: 'GET', swal: false,
+ id: options.id, url: Messages.url, method: 'GET',
callback: function (result) {
if (result) {
var content = result.map(function (mail) {
- if (mail.Status == '0')
+ if (mail.Status === '0')
mailStatus = 'class="unread"';
else
- mailStatus = " "
- if (mail.Mark == '1')
+ mailStatus = " ";
+ if (mail.Mark === '1')
mailMark = "inbox-started";
else
mailMark = " ";
- if (mail.Label == '0')
+ if (mail.Label === '0')
mailLabel = 'label-success';
else
mailLabel = 'label-warning';
@@ -47,5 +47,5 @@
$('#mailBox').on('click', 'a', function () {
listData({ Id: $(this).attr('data-id') });
- })
+ });
});
\ No newline at end of file
diff --git a/Bootstrap.Admin/wwwroot/js/roles.js b/Bootstrap.Admin/wwwroot/js/roles.js
index aa809c61..8a1dfa91 100644
--- a/Bootstrap.Admin/wwwroot/js/roles.js
+++ b/Bootstrap.Admin/wwwroot/js/roles.js
@@ -23,7 +23,7 @@
events: {
'#btn_assignUser': function (row) {
$.bc({
- id: row.Id, url: User.url, data: { type: "role" }, swal: false,
+ id: row.Id, url: User.url, data: { type: "role" },
callback: function (result) {
var htmlTemplate = this.htmlTemplate;
var html = $.map(result, function (element, index) {
@@ -39,7 +39,7 @@
},
'#btn_assignGroup': function (row) {
$.bc({
- id: row.Id, url: Group.url, data: { type: "role" }, swal: false,
+ id: row.Id, url: Group.url, data: { type: "role" },
callback: function (result) {
var htmlTemplate = this.htmlTemplate;
var html = $.map(result, function (element, index) {
@@ -55,7 +55,7 @@
},
'#btn_assignMenu': function (row) {
$.bc({
- id: row.Id, url: Menu.url, data: { type: "role" }, swal: false,
+ id: row.Id, url: Menu.url, data: { type: "role" },
callback: function (result) {
$dialogMenuHeader.text($.format('{0}-菜单授权窗口', row.RoleName));
$btnSubmitMenu.data('type', 'menu');
@@ -76,14 +76,14 @@
var userIds = $dialogUser.find(':checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
- $.bc({ id: roleId, url: User.url, method: "PUT", data: { type: "role", userIds: userIds }, modal: '#dialogUser', title: User.title });
+ $.bc({ id: roleId, url: User.url, method: "PUT", data: { type: "role", userIds: userIds }, modal: '#dialogUser', title: User.title, info: true });
},
'#btnSubmitGroup': function (row) {
var roleId = row.Id;
var groupIds = $dialogGroup.find(':checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
- $.bc({ id: roleId, url: Group.url, method: "PUT", data: { type: "role", groupIds: groupIds }, modal: '#dialogGroup', title: Group.title });
+ $.bc({ id: roleId, url: Group.url, method: "PUT", data: { type: "role", groupIds: groupIds }, modal: '#dialogGroup', title: Group.title, info: true });
},
'#btnSubmitMenu': function (row) {
var roleId = row.Id;
@@ -97,7 +97,7 @@
default:
break;
}
- $.bc({ id: roleId, url: Menu.url, method: "PUT", data: { type: "role", menuIds: menuIds }, modal: '#dialogMenu', title: Menu.title });
+ $.bc({ id: roleId, url: Menu.url, method: "PUT", data: { type: "role", menuIds: menuIds }, modal: '#dialogMenu', title: Menu.title, info: true });
}
}
},
diff --git a/Bootstrap.Admin/wwwroot/js/settings.js b/Bootstrap.Admin/wwwroot/js/settings.js
index 677bb2c0..1787998d 100644
--- a/Bootstrap.Admin/wwwroot/js/settings.js
+++ b/Bootstrap.Admin/wwwroot/js/settings.js
@@ -51,7 +51,6 @@
$.bc({
url: Settings.url,
method: 'GET',
- swal: false,
callback: function (urls) {
if (urls && $.isArray(urls)) {
$.each(urls, function (index, item) {
@@ -62,7 +61,6 @@
xhrFields: {
withCredentials: true
},
- swal: false,
callback: function (result) {
if ($.isArray(result)) {
var html = '';
@@ -75,7 +73,7 @@
$sortable.append(content);
$sortable.find('[data-toggle="tooltip"]').tooltip();
}
- if (index == urls.length - 1) $refresh.removeClass('fa-spin');
+ if (index === urls.length - 1) $refresh.removeClass('fa-spin');
}
});
});
@@ -83,15 +81,14 @@
else $refresh.removeClass('fa-spin');
}
});
- }
+ };
var listCache = function (options) {
$.bc({
url: options.url,
xhrFields: {
withCredentials: true
- },
- swal: false
+ }
});
};
$('a[data-method]').on('click', function (e) {
@@ -115,4 +112,4 @@
});
var $css = $('#dictCssDefine').dropdown('val');
-})
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/Bootstrap.Admin/wwwroot/js/tasks.js b/Bootstrap.Admin/wwwroot/js/tasks.js
index 1375a5e7..d0a7fe67 100644
--- a/Bootstrap.Admin/wwwroot/js/tasks.js
+++ b/Bootstrap.Admin/wwwroot/js/tasks.js
@@ -7,7 +7,7 @@
var that = $(this);
that.toggleClass('fa-spin');
$.bc({
- url: Tasks.url, method: 'GET', swal: false,
+ url: Tasks.url, method: 'GET',
callback: function (result) {
if (result) {
var content = result.map(function (task) {
diff --git a/Bootstrap.Admin/wwwroot/js/users.js b/Bootstrap.Admin/wwwroot/js/users.js
index 0df6f569..8c415576 100644
--- a/Bootstrap.Admin/wwwroot/js/users.js
+++ b/Bootstrap.Admin/wwwroot/js/users.js
@@ -19,7 +19,7 @@
events: {
'#btn_assignRole': function (row) {
$.bc({
- id: row.Id, url: Role.url, data: { type: "user" }, swal: false,
+ id: row.Id, url: Role.url, data: { type: "user" },
callback: function (result) {
var htmlTemplate = this.htmlTemplate;
var html = $.map(result, function (element, index) {
@@ -35,7 +35,7 @@
},
'#btn_assignGroup': function (row) {
$.bc({
- id: row.Id, url: Group.url, data: { type: "user" }, swal: false,
+ id: row.Id, url: Group.url, data: { type: "user" },
callback: function (result) {
var htmlTemplate = this.htmlTemplate;
var html = $.map(result, function (element, index) {
@@ -54,14 +54,14 @@
var roleIds = $dialogRole.find(':checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
- $.bc({ id: userId, url: Role.url, method: 'PUT', data: { type: "user", roleIds: roleIds }, title: Role.title, modal: '#dialogRole' });
+ $.bc({ id: userId, url: Role.url, method: 'PUT', data: { type: "user", roleIds: roleIds }, title: Role.title, info: true, modal: '#dialogRole' });
},
'#btnSubmitGroup': function (row) {
var userId = row.Id;
var groupIds = $dialogGroup.find(':checked').map(function (index, element) {
return $(element).val();
}).toArray().join(',');
- $.bc({ id: userId, url: Group.url, method: 'PUT', data: { type: "user", groupIds: groupIds }, title: Group.title, modal: '#dialogGroup' });
+ $.bc({ id: userId, url: Group.url, method: 'PUT', data: { type: "user", groupIds: groupIds }, title: Group.title, info: true, modal: '#dialogGroup' });
}
},
callback: function (data) {