精简framework.js使用$.bc
This commit is contained in:
parent
1c17bb7362
commit
11326158f2
|
@ -47,7 +47,7 @@
|
|||
if (!$.browser.versions.ios) $("#sidebar").niceScroll({ styler: "fb", cursorcolor: "#e8403f", cursorwidth: '3', cursorborderradius: '10px', background: '#404040', spacebarenabled: false, cursorborder: '', scrollspeed: 60 });
|
||||
|
||||
// load widget data
|
||||
bd({
|
||||
$.bc({
|
||||
url: '../api/Notifications/',
|
||||
swal: false,
|
||||
method: 'GET',
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
(function ($) {
|
||||
var handlerCallback = function (callback, e, data) {
|
||||
if ($.isFunction(callback)) callback.call(e, data);
|
||||
if ($.isFunction(this.options.callback)) this.options.callback.call(e, data);
|
||||
}
|
||||
|
||||
BootstrapAdmin = function (options) {
|
||||
var that = this;
|
||||
options = options || {};
|
||||
|
@ -252,12 +247,33 @@
|
|||
}
|
||||
};
|
||||
|
||||
var htmlTemplate = '<div class="form-group checkbox col-lg-3 col-xs-4"><label class="tooltips" data-placement="top" data-original-title="{3}" title="{3}"><input type="checkbox" value="{0}" {2}/>{1}</label></div>';
|
||||
var handlerCallback = function (callback, e, data) {
|
||||
if ($.isFunction(callback)) callback.call(e, data);
|
||||
if ($.isFunction(this.options.callback)) this.options.callback.call(e, data);
|
||||
}
|
||||
|
||||
var processData = function (options) {
|
||||
var data = $.extend({ data: {}, remote: true, method: "POST", Id: "", url: this.url, title: this.title, html: this.html, swal: true }, options);
|
||||
|
||||
if (data.remote) {
|
||||
$.extend({
|
||||
bc: function (options, callback) {
|
||||
var data = $.extend({
|
||||
remote: true,
|
||||
Id: "",
|
||||
url: this.url,
|
||||
data: {},
|
||||
method: "POST",
|
||||
htmlTemplate: '<div class="form-group checkbox col-lg-3 col-xs-4"><label class="tooltips" data-placement="top" data-original-title="{3}" title="{3}"><input type="checkbox" value="{0}" {2}/>{1}</label></div>',
|
||||
title: this.title,
|
||||
swal: true,
|
||||
modal: null,
|
||||
callback: null
|
||||
}, options);
|
||||
|
||||
if (!data.url || data.url == "") {
|
||||
swal('参数错误', '未设置请求地址Url', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.remote && data.url) {
|
||||
$.ajax({
|
||||
url: data.url + data.Id,
|
||||
data: data.data,
|
||||
|
@ -270,166 +286,79 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
else success()
|
||||
|
||||
function success(result) {
|
||||
if ($.isFunction(data.callback)) {
|
||||
var formatData = result;
|
||||
if ($.isArray(result)) {
|
||||
if ($.isFunction(data.html)) formatData = data.html(result);
|
||||
data.callback(result);
|
||||
}
|
||||
data.callback(formatData);
|
||||
}
|
||||
else if ($.isPlainObject(data.callback) && data.callback.modal !== undefined) {
|
||||
$("#" + data.callback.modal).modal('hide');
|
||||
if (data.modal !== null) {
|
||||
$("#" + data.modal).modal('hide');
|
||||
}
|
||||
if (data.swal) {
|
||||
if (result) { swal("成功", data.title, "success"); }
|
||||
else { swal("失败", data.title, "error"); }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.bd = processData;
|
||||
}
|
||||
});
|
||||
|
||||
// Roles
|
||||
Role = {
|
||||
url: '../api/Roles/',
|
||||
title: "授权角色",
|
||||
html: function (result) {
|
||||
return $.map(result, function (element, index) {
|
||||
return $.format(htmlTemplate, element.ID, element.RoleName, element.Checked, element.Description);
|
||||
}).join('');
|
||||
}
|
||||
};
|
||||
Role.getRolesByUserId = function (userId, callback) {
|
||||
processData.call(this, { Id: userId, callback: callback, data: { type: "user" }, swal: false });
|
||||
};
|
||||
Role.getRolesByGroupId = function (groupId, callback) {
|
||||
processData.call(this, { Id: groupId, callback: callback, data: { type: "group" }, swal: false });
|
||||
};
|
||||
Role.getRolesByMenuId = function (menuId, callback) {
|
||||
processData.call(this, { Id: menuId, callback: callback, data: { type: "menu" }, swal: false });
|
||||
};
|
||||
Role.saveRolesByUserId = function (userId, roleIds, callback) {
|
||||
processData.call(this, { Id: userId, callback: callback, method: "PUT", data: { type: "user", roleIds: roleIds } });
|
||||
};
|
||||
Role.saveRolesByGroupId = function (groupId, roleIds, callback) {
|
||||
processData.call(this, { Id: groupId, callback: callback, method: "PUT", data: { type: "group", roleIds: roleIds } });
|
||||
};
|
||||
Role.saveRolesByMenuId = function (menuId, roleIds, callback) {
|
||||
processData.call(this, { Id: menuId, callback: callback, method: "PUT", data: { type: "menu", roleIds: roleIds } });
|
||||
title: "授权角色"
|
||||
};
|
||||
|
||||
// Users
|
||||
User = {
|
||||
url: '../api/Users/',
|
||||
title: "授权用户",
|
||||
html: function (result) {
|
||||
return $.map(result, function (element, index) {
|
||||
return $.format(htmlTemplate, element.ID, element.DisplayName, element.Checked, element.UserName);
|
||||
}).join('');
|
||||
}
|
||||
};
|
||||
User.getUsersByRoleId = function (roleId, callback) {
|
||||
processData.call(this, { Id: roleId, callback: callback, data: { type: "role" }, swal: false });
|
||||
};
|
||||
User.saveUsersByRoleId = function (roleId, userIds, callback) {
|
||||
processData.call(this, { Id: roleId, callback: callback, method: "PUT", data: { type: "role", userIds: userIds } });
|
||||
};
|
||||
User.getUsersByGroupeId = function (groupId, callback) {
|
||||
processData.call(this, { Id: groupId, callback: callback, data: { type: "group" }, swal: false });
|
||||
};
|
||||
User.saveUsersByGroupId = function (groupId, userIds, callback) {
|
||||
processData.call(this, { Id: groupId, callback: callback, method: "PUT", data: { type: "group", userIds: userIds } });
|
||||
};
|
||||
User.saveUserDisplayName = function (user, callback) {
|
||||
processData.call(this, { Id: '', callback: callback, method: "PUT", data: user, title: "修改用户显示名称" });
|
||||
};
|
||||
User.changePassword = function (user) {
|
||||
processData.call(this, { Id: '', method: "PUT", data: user });
|
||||
};
|
||||
User.processUser = function (id, result, callback) {
|
||||
processData.call(this, { Id: id, callback: callback, method: "PUT", data: { type: "user", userIds: result }, title: result == "1" ? "授权用户" : "拒绝用户" });
|
||||
title: "授权用户"
|
||||
};
|
||||
|
||||
// Groups
|
||||
Group = {
|
||||
url: '../api/Groups/',
|
||||
title: "授权部门",
|
||||
html: function (result) {
|
||||
return $.map(result, function (element, index) {
|
||||
return $.format(htmlTemplate, element.ID, element.GroupName, element.Checked, element.Description);
|
||||
}).join('');
|
||||
}
|
||||
};
|
||||
Group.getGroupsByUserId = function (userId, callback) {
|
||||
processData.call(this, { Id: userId, callback: callback, data: { type: "user" }, swal: false });
|
||||
};
|
||||
Group.saveGroupsByUserId = function (userId, groupIds, callback) {
|
||||
processData.call(this, { Id: userId, callback: callback, method: "PUT", data: { type: "user", groupIds: groupIds } });
|
||||
};
|
||||
Group.getGroupsByRoleId = function (roleId, callback) {
|
||||
processData.call(this, { Id: roleId, callback: callback, data: { type: "role" }, swal: false });
|
||||
};
|
||||
Group.saveGroupsByRoleId = function (roleId, groupIds, callback) {
|
||||
processData.call(this, { Id: roleId, callback: callback, method: "PUT", data: { type: "role", groupIds: groupIds } });
|
||||
title: "授权部门"
|
||||
};
|
||||
|
||||
// Menus
|
||||
Menu = {
|
||||
url: '../api/Menus/',
|
||||
title: "授权菜单",
|
||||
html: function (result) {
|
||||
var htmlString = "";
|
||||
if ($.isArray(result)) {
|
||||
htmlString = Menu.cascadeMenu(result)
|
||||
}
|
||||
return htmlString;
|
||||
}
|
||||
};
|
||||
Menu.cascadeMenu = function (menus) {
|
||||
var html = "";
|
||||
$.each(menus, function (index, menu) {
|
||||
if (menu.Menus.length == 0) {
|
||||
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div></li>', menu.ID, menu.Icon, menu.Name, menu.Category);
|
||||
}
|
||||
else {
|
||||
html = $.format('<li class="dd-item dd3-item" data-id="{0}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div></li><ol class="dd-list">{4}</ol>', menu.ID, menu.Icon, menu.Name, menu.Category, Menu.cascadeMenu(menu.Menus));
|
||||
}
|
||||
});
|
||||
return html;
|
||||
};
|
||||
Menu.getMenus = function (callback) {
|
||||
processData.call(this, { Id: 0, callback: callback, data: { type: "user" }, swal: false });
|
||||
};
|
||||
Menu.getMenusByRoleId = function (roleId, callback) {
|
||||
processData.call(this, { Id: roleId, callback: callback, data: { type: "role" }, swal: false, html: null });
|
||||
};
|
||||
Menu.saveMenusByRoleId = function (roleId, menuIds, callback) {
|
||||
processData.call(this, { Id: roleId, callback: callback, method: "PUT", data: { type: "role", menuIds: menuIds } });
|
||||
title: "授权菜单"
|
||||
};
|
||||
|
||||
// Exceptions
|
||||
Exceptions = {
|
||||
url: '../api/Exceptions/',
|
||||
title: "程序异常日志",
|
||||
html: function (result) {
|
||||
return result.map(function (ele) {
|
||||
return $.format('<div class="form-group col-lg-3 col-md-3 col-sm-4 col-xs-6"><a class="logfile" href="#"><i class="fa fa-file-text-o"></i><span>{0}</span></a></div>', ele);
|
||||
}).join('');
|
||||
}
|
||||
};
|
||||
Exceptions.getFiles = function (callback) {
|
||||
processData.call(this, { Id: "", callback: callback, swal: false });
|
||||
}
|
||||
Exceptions.getFileByName = function (fileName, callback) {
|
||||
processData.call(this, { Id: "", callback: callback, method: "PUT", swal: false, data: { "": fileName } });
|
||||
title: "程序异常日志"
|
||||
};
|
||||
|
||||
// Dicts
|
||||
Dicts = {
|
||||
url: '../api/Dicts/'
|
||||
};
|
||||
Dicts.retrieveCategories = function (callback) {
|
||||
processData.call(this, { Id: 1, callback: callback, swal: false, data: { type: 'category' } });
|
||||
};
|
||||
|
||||
// Infos
|
||||
Infos = {
|
||||
url: '../api/Infos/'
|
||||
}
|
||||
|
||||
// Profiles
|
||||
Profiles = {
|
||||
url: '../api/Profiles/',
|
||||
title: '网站设置'
|
||||
}
|
||||
|
||||
// Messages
|
||||
Messages = {
|
||||
url: '../api/Messages/'
|
||||
}
|
||||
|
||||
// Tasks
|
||||
Tasks = {
|
||||
url: '../api/Tasks/'
|
||||
}
|
||||
|
||||
// Notifications
|
||||
Notifications = {
|
||||
url: '../api/Notifications/'
|
||||
}
|
||||
})(jQuery);
|
|
@ -1,27 +1,15 @@
|
|||
using Bootstrap.DataAccess;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
using System.Linq;
|
||||
|
||||
namespace Bootstrap.Admin.Controllers
|
||||
{
|
||||
public class TasksController : ApiController
|
||||
{
|
||||
[HttpGet]
|
||||
public Tasks Get()
|
||||
public IEnumerable<Task> Get()
|
||||
{
|
||||
var tasks = new Tasks();
|
||||
TaskHelper.RetrieveTasks().AsParallel().ForAll(n => tasks.Users.Add(n));
|
||||
return tasks;
|
||||
}
|
||||
|
||||
public class Tasks
|
||||
{
|
||||
public Tasks()
|
||||
{
|
||||
Users = new List<Task>();
|
||||
}
|
||||
public List<Task> Users { get; set; }
|
||||
return TaskHelper.RetrieveTasks();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
$(function () {
|
||||
$('#panelResultHeader').html('查询结果<span class="hidden-400 text-danger">(仅 Administrators 角色成员可删除数据)<span>');
|
||||
var bsa = new BootstrapAdmin({
|
||||
url: '../api/Dicts',
|
||||
url: Dicts.url,
|
||||
dataEntity: new DataEntity({
|
||||
map: {
|
||||
ID: "dictID",
|
||||
|
@ -14,7 +14,7 @@
|
|||
});
|
||||
|
||||
$('table').smartTable({
|
||||
url: '../api/Dicts',
|
||||
url: Dicts.url,
|
||||
sortName: 'Category',
|
||||
queryParams: function (params) { return $.extend(params, { category: $('#txt_dict_cate').val(), name: $("#txt_dict_name").val(), define: $("#txt_dict_define").val() }); },
|
||||
columns: [{ checkbox: true },
|
||||
|
@ -49,10 +49,13 @@
|
|||
$('select').selectpicker();
|
||||
|
||||
// autocomplete
|
||||
Dicts.retrieveCategories(function (result) {
|
||||
$.bc({
|
||||
Id: 1, url: Dicts.url, data: { type: 'category' }, swal: false,
|
||||
callback: function (result) {
|
||||
$('#txt_dict_cate').typeahead({
|
||||
source: result,
|
||||
autoSelect: true
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
|
@ -32,8 +32,14 @@
|
|||
});
|
||||
|
||||
$('#btn_view').on('click', function (row) {
|
||||
Exceptions.getFiles(function (data) {
|
||||
$dataForm.children('div').html(data);
|
||||
$.bc({
|
||||
Id: "", url: Exceptions.url, swal: false,
|
||||
callback: function (result) {
|
||||
var html = result.map(function (ele) {
|
||||
return $.format('<div class="form-group col-lg-3 col-md-3 col-sm-4 col-xs-6"><a class="logfile" href="#"><i class="fa fa-file-text-o"></i><span>{0}</span></a></div>', ele);
|
||||
}).join('');
|
||||
$dataForm.children('div').html(html);
|
||||
}
|
||||
});
|
||||
$dialog.modal('show');
|
||||
});
|
||||
|
@ -44,8 +50,11 @@
|
|||
$errorList.hide();
|
||||
$errorDetail.show();
|
||||
$dataFormDetail.html('<div class="text-center"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i></div>');
|
||||
Exceptions.getFileByName(fileName, function (data) {
|
||||
$dataFormDetail.html(data);
|
||||
$.bc({
|
||||
Id: "", url: Exceptions.url, method: "PUT", swal: false, data: { "": fileName },
|
||||
callback: function (result) {
|
||||
$dataFormDetail.html(result);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
$(function () {
|
||||
var $dialogUser = $("#dialogUser");
|
||||
var $dialogUserHeader = $('#myUserModalLabel');
|
||||
var $dialogUserForm = $('#userForm');
|
||||
var $dialogRole = $('#dialogRole');
|
||||
var $dialogRoleHeader = $('#myRoleModalLabel');
|
||||
var $dialogRoleForm = $('#roleForm');
|
||||
|
||||
var bsa = new BootstrapAdmin({
|
||||
url: '../api/Groups',
|
||||
url: Group.url,
|
||||
dataEntity: new DataEntity({
|
||||
map: {
|
||||
ID: "groupID",
|
||||
|
@ -12,45 +19,59 @@
|
|||
assign: [{
|
||||
id: 'btn_assignRole',
|
||||
click: function (row) {
|
||||
Role.getRolesByGroupId(row.ID, function (data) {
|
||||
$("#dialogRole .modal-title").text($.format('{0}-角色授权窗口', row.GroupName));
|
||||
$('#dialogRole form').html(data);
|
||||
$('#dialogRole').modal('show');
|
||||
$.bc({
|
||||
Id: row.ID, url: Role.url, data: { type: "group" }, swal: false,
|
||||
callback: function (result) {
|
||||
var htmlTemplate = this.htmlTemplate;
|
||||
var html = $.map(result, function (element, index) {
|
||||
return $.format(htmlTemplate, element.ID, element.RoleName, element.Checked, element.Description);
|
||||
}).join('')
|
||||
$dialogRoleHeader.text($.format('{0}-角色授权窗口', row.GroupName));
|
||||
$dialogRoleForm.html(html);
|
||||
$dialogRole.modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
id: 'btn_assignUser',
|
||||
click: function (row) {
|
||||
User.getUsersByGroupeId(row.ID, function (data) {
|
||||
$("#dialogUser .modal-title").text($.format('{0}-用户授权窗口', row.GroupName));
|
||||
$('#dialogUser form').html(data);
|
||||
$('#dialogUser').modal('show');
|
||||
$.bc({
|
||||
Id: row.ID, url: User.url, data: { type: "group" }, swal: false,
|
||||
callback: function (result) {
|
||||
var htmlTemplate = this.htmlTemplate;
|
||||
var html = $.map(result, function (element, index) {
|
||||
return $.format(htmlTemplate, element.ID, element.DisplayName, element.Checked, element.UserName);
|
||||
}).join('');
|
||||
$dialogUserHeader.text($.format('{0}-用户授权窗口', row.GroupName));
|
||||
$dialogUserForm.html(html);
|
||||
$dialogUser.modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
id: 'btnSubmitRole',
|
||||
click: function (row) {
|
||||
var groupId = row.ID;
|
||||
var roleIds = $('#dialogRole :checked').map(function (index, element) {
|
||||
var roleIds = $dialogRole.find('input:checked').map(function (index, element) {
|
||||
return $(element).val();
|
||||
}).toArray().join(',');
|
||||
Role.saveRolesByGroupId(groupId, roleIds, { modal: 'dialogRole' });
|
||||
$.bc({ Id: groupId, url: Role.url, method: "PUT", data: { type: "group", roleIds: roleIds }, title: Role.title, modal: 'dialogRole' });
|
||||
}
|
||||
}, {
|
||||
id: 'btnSubmitUser',
|
||||
click: function (row) {
|
||||
var groupId = row.ID;
|
||||
var userIds = $('#dialogUser :checked').map(function (index, element) {
|
||||
var userIds = $dialogUser.find(':checked').map(function (index, element) {
|
||||
return $(element).val();
|
||||
}).toArray().join(',');
|
||||
User.saveUsersByGroupId(groupId, userIds, { modal: 'dialogUser' });
|
||||
$.bc({ Id: groupId, url: User.url, method: "PUT", data: { type: "group", userIds: userIds }, title: User.title, modal: 'dialogUser' });
|
||||
}
|
||||
}]
|
||||
}
|
||||
});
|
||||
|
||||
$('table').smartTable({
|
||||
url: '../api/Groups', //请求后台的URL(*)
|
||||
url: Group.url, //请求后台的URL(*)
|
||||
sortName: 'GroupName',
|
||||
queryParams: function (params) { return $.extend(params, { groupName: $("#txt_search_name").val(), description: $("#txt_group_desc").val() }); }, //传递参数(*)
|
||||
columns: [{ checkbox: true },
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
var $headerIcon = $('#headerIcon');
|
||||
var preIcon = $headerIcon.attr('src');
|
||||
$('#fileIcon').fileinput({
|
||||
uploadUrl: '../api/Infos',
|
||||
uploadUrl: Infos.url,
|
||||
language: 'zh',
|
||||
allowedFileExtensions: ['jpg'],
|
||||
initialPreview: [
|
||||
|
@ -62,7 +62,7 @@
|
|||
click: function (row, data) {
|
||||
if ($(this).attr('data-valid') == "true") {
|
||||
data.UserStatus = 2;
|
||||
User.changePassword(data);
|
||||
$.bc({ url: User.url, method: "PUT", data: data, title: "更改密码" });
|
||||
}
|
||||
}
|
||||
}, {
|
||||
|
@ -70,10 +70,13 @@
|
|||
click: function (row, data) {
|
||||
if ($(this).attr('data-valid') == "true") {
|
||||
data.UserStatus = 1;
|
||||
User.saveUserDisplayName(data, function (result) {
|
||||
$.bc({
|
||||
url: User.url, method: "PUT", data: data, title: "修改用户显示名称",
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
$('#userDisplayName').text(data.DisplayName);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,22 @@
|
|||
$(function () {
|
||||
var $dialog = $('#dialogNew');
|
||||
var $pickIcon = $('#pickIcon');
|
||||
var $iconList = $('#iconTab').find('div.fontawesome-icon-list');
|
||||
var $dialogNew = $dialog.find('div.modal-dialog');
|
||||
var $dialogIcon = $('#dialogIcon');
|
||||
var $dialogMenu = $('#dialogSubMenu').find('.modal-content');
|
||||
var $dialogRole = $('#dialogRole');
|
||||
var $dialogRoleHeader = $('#myRoleModalLabel');
|
||||
var $dialogRoleForm = $('#roleForm');
|
||||
var $btnSubmitMenu = $('#btnSubmitMenu');
|
||||
var $btnPickIcon = $('#btnIcon');
|
||||
var $inputIcon = $('#icon');
|
||||
var $nestMenu = $('#nestable_menu');
|
||||
var $nestMenuInput = $nestMenu.find('div.dd3-content');
|
||||
var $parentMenuID = $('#parentId');
|
||||
var $parentMenuName = $('#parentName');
|
||||
$nestMenuInput.find('label:first').hide();
|
||||
|
||||
var bsa = new BootstrapAdmin({
|
||||
url: '../api/Menus',
|
||||
dataEntity: new DataEntity({
|
||||
|
@ -17,39 +35,62 @@
|
|||
assign: [{
|
||||
id: 'btn_assignRole',
|
||||
click: function (row) {
|
||||
Role.getRolesByMenuId(row.ID, function (data) {
|
||||
var dialog = $('#dialogRole');
|
||||
dialog.find('.modal-title').text($.format('{0}-角色授权窗口', row.Name));
|
||||
dialog.find('form').html(data);
|
||||
dialog.modal('show');
|
||||
$.bc({
|
||||
Id: row.ID, url: Role.url, data: { type: "menu" }, swal: false,
|
||||
callback: function (result) {
|
||||
var htmlTemplate = this.htmlTemplate;
|
||||
var html = $.map(result, function (element, index) {
|
||||
return $.format(htmlTemplate, element.ID, element.RoleName, element.Checked, element.Description);
|
||||
}).join('')
|
||||
$dialogRoleHeader.text($.format('{0}-角色授权窗口', row.Name));
|
||||
$dialogRoleForm.html(html);
|
||||
$dialogRole.modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
id: 'btnSubmitRole',
|
||||
click: function (row) {
|
||||
var menuId = row.ID;
|
||||
var dialog = $('#dialogRole');
|
||||
var roleIds = dialog.find('input:checked').map(function (index, element) {
|
||||
var roleIds = $dialogRole.find('input:checked').map(function (index, element) {
|
||||
return $(element).val();
|
||||
}).toArray().join(',');
|
||||
Role.saveRolesByMenuId(menuId, roleIds, { modal: 'dialogRole' });
|
||||
$.bc({ Id: menuId, url: Role.url, method: "PUT", data: { type: "menu", roleIds: roleIds }, title: Role.title, modal: 'dialogRole' });
|
||||
}
|
||||
}]
|
||||
},
|
||||
callback: function (result) {
|
||||
if (!result.success) return;
|
||||
if ((result.oper == "save") || result.oper == "del") {
|
||||
Menu.getMenus(function (data) {
|
||||
$nestMenu.find('ol:first').html(data);
|
||||
$.bc({
|
||||
Id: 0, url: Menu.url, data: { type: "user" }, swal: false,
|
||||
callback: function (result) {
|
||||
var html = "";
|
||||
if ($.isArray(result)) html = cascadeMenu(result);
|
||||
$nestMenu.find('ol:first').html(html);
|
||||
$nestMenuInput = $nestMenu.find('div.dd3-content');
|
||||
$nestMenuInput.find('label:first').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var cascadeMenu = function (menus) {
|
||||
var html = "";
|
||||
$.each(menus, function (index, menu) {
|
||||
if (menu.Menus.length == 0) {
|
||||
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div></li>', menu.ID, menu.Icon, menu.Name, menu.Category);
|
||||
}
|
||||
else {
|
||||
html = $.format('<li class="dd-item dd3-item" data-id="{0}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div></li><ol class="dd-list">{4}</ol>', menu.ID, menu.Icon, menu.Name, menu.Category, cascadeMenu(menu.Menus));
|
||||
}
|
||||
});
|
||||
return html;
|
||||
};
|
||||
|
||||
$('table').smartTable({
|
||||
url: '../api/Menus', //请求后台的URL(*)
|
||||
url: Menu.url, //请求后台的URL(*)
|
||||
sortName: 'Order',
|
||||
queryParams: function (params) { return $.extend(params, { parentName: $('#txt_parent_menus_name').val(), name: $("#txt_menus_name").val(), category: $('#sel_menus_category').val() }); }, //传递参数(*)
|
||||
columns: [{ checkbox: true },
|
||||
|
@ -82,21 +123,6 @@
|
|||
}
|
||||
});
|
||||
|
||||
var $dialog = $('#dialogNew');
|
||||
var $pickIcon = $('#pickIcon');
|
||||
var $iconList = $('#iconTab').find('div.fontawesome-icon-list');
|
||||
var $dialogNew = $dialog.find('div.modal-dialog');
|
||||
var $dialogIcon = $('#dialogIcon');
|
||||
var $dialogMenu = $('#dialogSubMenu').find('.modal-content');
|
||||
var $btnSubmitMenu = $('#btnSubmitMenu');
|
||||
var $btnPickIcon = $('#btnIcon');
|
||||
var $inputIcon = $('#icon');
|
||||
var $nestMenu = $('#nestable_menu');
|
||||
var $nestMenuInput = $nestMenu.find('div.dd3-content');
|
||||
var $parentMenuID = $('#parentId');
|
||||
var $parentMenuName = $('#parentName');
|
||||
$nestMenuInput.find('label:first').hide();
|
||||
|
||||
$iconList.find('ul li').addClass('col-md-3 col-sm-4 col-sm-6');
|
||||
$iconList.on('click', 'div.fa-hover a, ul li', function () {
|
||||
$pickIcon.attr('class', $(this).find('i, span:first').attr('class'));
|
||||
|
@ -182,9 +208,7 @@
|
|||
if (icon == "") icon = "fa fa-dashboard";
|
||||
$btnPickIcon.find('i').attr('class', icon);
|
||||
});
|
||||
|
||||
$nestMenu.nestable();
|
||||
|
||||
// select
|
||||
$('select').selectpicker();
|
||||
});
|
|
@ -17,10 +17,8 @@
|
|||
button: ['footSave']
|
||||
});
|
||||
|
||||
var options = { url: '../api/Profiles', title: '网站设置' };
|
||||
|
||||
var bsa = new BootstrapAdmin({
|
||||
url: options.url,
|
||||
url: Profiles.url,
|
||||
bootstrapTable: null,
|
||||
validateForm: null,
|
||||
modal: null,
|
||||
|
@ -35,26 +33,24 @@
|
|||
id: 'sysSave',
|
||||
click: function (row, data) {
|
||||
if ($(this).attr('data-valid') == "true") {
|
||||
var op = $.extend({
|
||||
data: { name: '网站标题', code: data.Title, category: '网站设置' },
|
||||
$.bc({
|
||||
url: Profiles.url, data: { name: '网站标题', code: data.Title, category: Profiles.title }, title: Profiles.title,
|
||||
callback: function (result) {
|
||||
$('#websiteTitle').text(data.Title);
|
||||
if (result) $('#websiteTitle').text(data.Title);
|
||||
}
|
||||
}, options)
|
||||
bd(op);
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
id: 'footSave',
|
||||
click: function (row, data) {
|
||||
if ($(this).attr('data-valid') == "true") {
|
||||
var op = $.extend({
|
||||
data: { name: '网站页脚', code: data.Footer, category: '网站设置' },
|
||||
$.bc({
|
||||
url: Profiles.url, data: { name: '网站页脚', code: data.Footer, category: Profiles.title }, title: Profiles.title,
|
||||
callback: function (result) {
|
||||
$('#websiteFooter').text(data.Footer);
|
||||
if (result) $('#websiteFooter').text(data.Footer);
|
||||
}
|
||||
}, options)
|
||||
bd(op);
|
||||
});
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
@ -63,7 +59,7 @@
|
|||
|
||||
function listCache(options) {
|
||||
options = $.extend({ url: '../../CacheList.axd' }, options);
|
||||
bd({
|
||||
$.bc({
|
||||
url: options.url,
|
||||
swal: false,
|
||||
callback: function (result) {
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
$(function () {
|
||||
var $dialogUser = $("#dialogUser");
|
||||
var $dialogUserHeader = $('#myUserModalLabel');
|
||||
var $dialogUserForm = $('#userForm');
|
||||
var $dialogGroup = $("#dialogGroup");
|
||||
var $dialogGroupHeader = $('#myGroupModalLabel');
|
||||
var $dialogGroupForm = $('#groupForm');
|
||||
var $dialogMenu = $('#dialogMenu');
|
||||
var $dialogMenuHeader = $('#myMenuModalLabel');
|
||||
var $dialogSubMenu = $('#dialogSubMenu').find('.modal-content');
|
||||
var $btnSubmitMenu = $('#btnSubmitMenu');
|
||||
var $nestMenu = $('#nestable_menu');
|
||||
|
@ -9,7 +14,7 @@
|
|||
$nestMenuInput.find('label:last').hide();
|
||||
|
||||
var bsa = new BootstrapAdmin({
|
||||
url: '../api/Roles',
|
||||
url: Role.url,
|
||||
dataEntity: new DataEntity({
|
||||
map: {
|
||||
ID: "roleID",
|
||||
|
@ -21,20 +26,54 @@
|
|||
assign: [{
|
||||
id: 'btn_assignUser',
|
||||
click: function (row) {
|
||||
User.getUsersByRoleId(row.ID, function (data) {
|
||||
$dialogUser.find("div.modal-header").find('h4').text($.format('{0}-用户授权窗口', row.RoleName));
|
||||
$dialogUser.find('form').html(data);
|
||||
$.bc({
|
||||
Id: row.ID, url: User.url, data: { type: "role" }, swal: false,
|
||||
callback: function (result) {
|
||||
var htmlTemplate = this.htmlTemplate;
|
||||
var html = $.map(result, function (element, index) {
|
||||
return $.format(htmlTemplate, element.ID, element.DisplayName, element.Checked, element.UserName);
|
||||
}).join('');
|
||||
$dialogUserHeader.text($.format('{0}-用户授权窗口', row.RoleName));
|
||||
$dialogUserForm.html(html);
|
||||
$dialogUser.modal('show');
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
id: 'btn_assignGroup',
|
||||
click: function (row) {
|
||||
Group.getGroupsByRoleId(row.ID, function (data) {
|
||||
$dialogGroup.find("div.modal-header").find("h4").text($.format('{0}-部门授权窗口', row.RoleName));
|
||||
$dialogGroup.find('form').html(data);
|
||||
$.bc({
|
||||
Id: row.ID, url: Group.url, data: { type: "role" }, swal: false,
|
||||
callback: function (result) {
|
||||
var htmlTemplate = this.htmlTemplate;
|
||||
var html = $.map(result, function (element, index) {
|
||||
return $.format(htmlTemplate, element.ID, element.GroupName, element.Checked, element.Description);
|
||||
}).join('');
|
||||
$dialogGroupHeader.text($.format('{0}-部门授权窗口', row.RoleName));
|
||||
$dialogGroupForm.html(html);
|
||||
$dialogGroup.modal('show');
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
id: 'btn_assignMenu',
|
||||
click: function (row) {
|
||||
$.bc({
|
||||
Id: row.ID, url: Menu.url, data: { type: "role" }, swal: false,
|
||||
callback: function (result) {
|
||||
$dialogMenuHeader.text($.format('{0}-菜单授权窗口', row.RoleName));
|
||||
$btnSubmitMenu.data('type', 'menu');
|
||||
// set checkbox status
|
||||
var menus = $nestMenu.find('input:checkbox');
|
||||
menus.removeProp('checked');
|
||||
$.each(result, function (index, item) {
|
||||
var selector = $.format('[value={0}]', item.ID);
|
||||
menus.filter(selector).prop('checked', 'checked');
|
||||
});
|
||||
$dialogSubMenu.show();
|
||||
$dialogMenu.modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
id: 'btnSubmitUser',
|
||||
|
@ -43,38 +82,18 @@
|
|||
var userIds = $dialogUser.find(':checked').map(function (index, element) {
|
||||
return $(element).val();
|
||||
}).toArray().join(',');
|
||||
User.saveUsersByRoleId(roleId, userIds, { modal: 'dialogUser' });
|
||||
$.bc({ Id: roleId, url: User.url, method: "PUT", data: { type: "role", userIds: userIds }, modal: 'dialogUser', title: User.title });
|
||||
}
|
||||
},
|
||||
{
|
||||
}, {
|
||||
id: 'btnSubmitGroup',
|
||||
click: function (row) {
|
||||
var roleId = row.ID;
|
||||
var groupIds = $dialogGroup.find(':checked').map(function (index, element) {
|
||||
return $(element).val();
|
||||
}).toArray().join(',');
|
||||
Group.saveGroupsByRoleId(roleId, groupIds, { modal: 'dialogGroup' });
|
||||
$.bc({ Id: roleId, url: Group.url, method: "PUT", data: { type: "role", groupIds: groupIds }, modal: 'dialogGroup', title: Group.title });
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'btn_assignMenu',
|
||||
click: function (row) {
|
||||
Menu.getMenusByRoleId(row.ID, function (data) {
|
||||
$dialogSubMenu.find("div.modal-header").find('h4').text($.format('{0}-菜单授权窗口', row.RoleName));
|
||||
$btnSubmitMenu.data('type', 'menu');
|
||||
// set checkbox status
|
||||
var menus = $nestMenu.find('input:checkbox');
|
||||
menus.removeProp('checked');
|
||||
$.each(data, function (index, item) {
|
||||
var selector = $.format('[value={0}]', item.ID);
|
||||
menus.filter(selector).prop('checked', 'checked');
|
||||
});
|
||||
$dialogSubMenu.show();
|
||||
$dialogMenu.modal('show');
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
}, {
|
||||
id: 'btnSubmitMenu',
|
||||
click: function (row) {
|
||||
var roleId = row.ID;
|
||||
|
@ -88,7 +107,7 @@
|
|||
default:
|
||||
break;
|
||||
}
|
||||
Menu.saveMenusByRoleId(roleId, menuIds, { modal: 'dialogMenu' });
|
||||
$.bc({ Id: roleId, url: Menu.url, method: "PUT", data: { type: "role", menuIds: menuIds }, modal: 'dialogMenu', title: Menu.title });
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
@ -97,7 +116,7 @@
|
|||
$nestMenu.nestable();
|
||||
|
||||
$('table').smartTable({
|
||||
url: '../api/Roles', //请求后台的URL(*)
|
||||
url: Role.url, //请求后台的URL(*)
|
||||
sortName: 'RoleName',
|
||||
queryParams: function (params) { return $.extend(params, { roleName: $("#txt_search_name").val(), description: $("#txt_role_desc").val() }); }, //传递参数(*)
|
||||
columns: [{ checkbox: true },
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
$(function () {
|
||||
var $dialogRole = $('#dialogRole');
|
||||
var $dialogRoleHeader = $('#myRoleModalLabel');
|
||||
var $dialogRoleForm = $('#roleForm');
|
||||
var $dialogGroup = $("#dialogGroup");
|
||||
var $dialogGroupHeader = $('#myGroupModalLabel');
|
||||
var $dialogGroupForm = $('#groupForm');
|
||||
|
||||
var bsa = new BootstrapAdmin({
|
||||
url: '../api/Users',
|
||||
url: User.url,
|
||||
dataEntity: new DataEntity({
|
||||
map: {
|
||||
ID: "userID",
|
||||
|
@ -14,38 +21,52 @@
|
|||
assign: [{
|
||||
id: 'btn_assignRole',
|
||||
click: function (row) {
|
||||
Role.getRolesByUserId(row.ID, function (data) {
|
||||
$("#dialogRole .modal-title").text($.format('{0}-角色授权窗口', row.DisplayName));
|
||||
$('#dialogRole form').html(data);
|
||||
$('#dialogRole').modal('show');
|
||||
$.bc({
|
||||
Id: row.ID, url: Role.url, data: { type: "user" }, swal: false,
|
||||
callback: function (result) {
|
||||
var htmlTemplate = this.htmlTemplate;
|
||||
var html = $.map(result, function (element, index) {
|
||||
return $.format(htmlTemplate, element.ID, element.RoleName, element.Checked, element.Description);
|
||||
}).join('')
|
||||
$dialogRoleHeader.text($.format('{0}-角色授权窗口', row.DisplayName));
|
||||
$dialogRoleForm.html(html);
|
||||
$dialogRole.modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
id: 'btn_assignGroup',
|
||||
click: function (row) {
|
||||
Group.getGroupsByUserId(row.ID, function (data) {
|
||||
$("#dialogGroup .modal-title").text($.format('{0}-部门授权窗口', row.DisplayName));
|
||||
$('#dialogGroup form').html(data);
|
||||
$('#dialogGroup').modal('show');
|
||||
$.bc({
|
||||
Id: row.ID, url: Group.url, data: { type: "user" }, swal: false,
|
||||
callback: function (result) {
|
||||
var htmlTemplate = this.htmlTemplate;
|
||||
var html = $.map(result, function (element, index) {
|
||||
return $.format(htmlTemplate, element.ID, element.GroupName, element.Checked, element.Description);
|
||||
}).join('');
|
||||
$dialogGroupHeader.text($.format('{0}-部门授权窗口', row.DisplayName));
|
||||
$dialogGroupForm.html(html);
|
||||
$dialogGroup.modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
id: 'btnSubmitRole',
|
||||
click: function (row) {
|
||||
var userId = row.ID;
|
||||
var roleIds = $('#dialogRole :checked').map(function (index, element) {
|
||||
var roleIds = $dialogRole.find(':checked').map(function (index, element) {
|
||||
return $(element).val();
|
||||
}).toArray().join(',');
|
||||
Role.saveRolesByUserId(userId, roleIds, { modal: 'dialogRole' });
|
||||
$.bc({ Id: userId, url: Role.url, method: 'PUT', data: { type: "user", roleIds: roleIds }, title: Role.title, modal: 'dialogRole' });
|
||||
}
|
||||
}, {
|
||||
id: 'btnSubmitGroup',
|
||||
click: function (row) {
|
||||
var userId = row.ID;
|
||||
var groupIds = $('#dialogGroup :checked').map(function (index, element) {
|
||||
var groupIds = $dialogGroup.find(':checked').map(function (index, element) {
|
||||
return $(element).val();
|
||||
}).toArray().join(',');
|
||||
Group.saveGroupsByUserId(userId, groupIds, { modal: 'dialogGroup' });
|
||||
$.bc({ Id: userId, url: Group.url, method: 'PUT', data: { type: "user", groupIds: groupIds }, title: Group.title, modal: 'dialogGroup' });
|
||||
}
|
||||
}]
|
||||
},
|
||||
|
@ -57,13 +78,13 @@
|
|||
});
|
||||
|
||||
$('table').smartTable({
|
||||
url: '../api/Users', //请求后台的URL(*)
|
||||
sortName: 'UserName',
|
||||
url: User.url, //请求后台的URL(*)
|
||||
sortName: 'DisplayName',
|
||||
queryParams: function (params) { return $.extend(params, { name: $("#txt_search_name").val(), displayName: $('#txt_display_name').val() }); }, //传递参数(*)
|
||||
columns: [{ checkbox: true },
|
||||
{ title: "Id", field: "ID", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter },
|
||||
{ title: "登陆名称", field: "UserName", sortable: true },
|
||||
{ title: "显示名称", field: "DisplayName", sortable: false }
|
||||
{ title: "显示名称", field: "DisplayName", sortable: true }
|
||||
]
|
||||
});
|
||||
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
var html = '<tr><td class="inbox-small-cells"><input type="checkbox" class="mail-checkbox"></td><td class="inbox-small-cells"><i class="fa fa-star"></i></td><td class="view-message dont-show">{0}</td><td class="view-message dont-show">{1}</td><td class="view-message ">{2}</td><td class="view-message text-right">{3}</td></tr>';
|
||||
|
||||
function listData() {
|
||||
bd({
|
||||
Id: 'inbox',
|
||||
url: '../api/Messages/',
|
||||
method: 'GET',
|
||||
swal: false,
|
||||
$.bc({
|
||||
Id: 'inbox', url: Messages.url, method: 'GET', swal: false,
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
var content = result.map(function (mail) {
|
||||
|
@ -14,7 +11,6 @@
|
|||
}).join('');
|
||||
$('#tbMsg').html(content);
|
||||
}
|
||||
console.log(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
$(function () {
|
||||
var $btnRefreshUser = $('#refreshUsers');
|
||||
var htmlNewUsers = '<li class="list-primary"><i class="fa fa-ellipsis-v"></i><div class="task-title notifi"><span class="task-title-sp">{0}</span><span class="task-value">{1}</span><span class="task-time">{2}</span><div class="pull-right hidden-phone"><button class="btn btn-success btn-xs fa fa-check" data-id="{3}" data-result="1"></button><button class="btn btn-danger btn-xs fa fa-remove" data-id="{3}" data-result="0" data-placement="left" data-original-title="拒绝授权"></button></div></div></li>';
|
||||
|
||||
function listData(options) {
|
||||
options = $.extend({ animation: true, ctl: $('a.fa-refresh') }, options);
|
||||
if (options.animation) options.ctl.toggleClass('fa-spin');
|
||||
bd({
|
||||
Id: 'newusers',
|
||||
url: '../api/Notifications/',
|
||||
method: 'GET',
|
||||
swal: false,
|
||||
function listData() {
|
||||
$btnRefreshUser.toggleClass('fa-spin');
|
||||
$.bc({
|
||||
Id: 'newusers', url: Notifications.url, method: 'GET', swal: false,
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
var content = result.Users.map(function (noti) {
|
||||
|
@ -16,21 +13,24 @@
|
|||
}).join('');
|
||||
$('#tasks-users').html(content);
|
||||
}
|
||||
if (options.animation) options.ctl.toggleClass('fa-spin');
|
||||
$btnRefreshUser.toggleClass('fa-spin');
|
||||
}
|
||||
});
|
||||
}
|
||||
listData();
|
||||
|
||||
$('a.fa-refresh').on('click', function () {
|
||||
listData({ ctl: $(this) });
|
||||
$btnRefreshUser.on('click', function () {
|
||||
listData();
|
||||
});
|
||||
|
||||
$('#tasks-users').on('click', 'button', function () {
|
||||
var id = $(this).attr('data-id');
|
||||
var result = $(this).attr('data-result');
|
||||
User.processUser(id, result, function (result) {
|
||||
$.bc({
|
||||
Id: id, url: User.url, method: "PUT", data: { type: "user", userIds: result }, title: result == "1" ? "授权用户" : "拒绝用户",
|
||||
callback: function (result) {
|
||||
listData({ ctl: $('#refreshUsers') });
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,33 +1,26 @@
|
|||
$(function () {
|
||||
var url = '../api/Tasks/';
|
||||
var $btnRefresh = $('#refreshTask');
|
||||
|
||||
var htmlTask = '<li class="list-primary"><i class="fa fa-ellipsis-v"></i><div class="task-title notifi"><span class="task-title-sp">{0}</span><span class="task-value">{1}</span><span class="task-time">{2}</span>';
|
||||
htmlTask += '<div class="pull-right hidden-phone"><button class="btn btn-success btn-xs fa fa-check" data-id="{3}" data-result="1"></button><button class="btn btn-danger btn-xs fa fa-remove" data-id="{3}" data-result="0" data-placement="left" data-original-title="拒绝授权"></button></div></div></li>';
|
||||
var htmlTask = '<li class="list-primary"><i class="fa fa-ellipsis-v"></i><div class="task-title notifi"><span class="task-title-sp">{0}</span><span class="task-value">{1}</span><span class="task-time">{2}</span><div class="pull-right hidden-phone"><button class="btn btn-success btn-xs fa fa-check" data-id="{3}" data-result="1"></button><button class="btn btn-danger btn-xs fa fa-remove" data-id="{3}" data-result="0" data-placement="left" data-original-title="拒绝授权"></button></div></div></li>';
|
||||
|
||||
function listData(options) {
|
||||
options = $.extend({ url: url, animation: true, ctl: $('a.fa-refresh') }, options);
|
||||
if (options.animation) options.ctl.toggleClass('fa-spin');
|
||||
$.ajax({
|
||||
url: options.url,
|
||||
type: 'GET',
|
||||
success: function (result) {
|
||||
function listData() {
|
||||
$btnRefresh.toggleClass('fa-spin');
|
||||
$.bc({
|
||||
url: Tasks.url, method: 'GET', swal: false,
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
var content = result.Users.map(function (task) {
|
||||
var t = new Date(task.AssignTime).format('yyyy-MM-dd HH:mm:ss');
|
||||
return $.format(htmlTask, task.TaskName, task.UserName, t, task.ID);
|
||||
var content = result.map(function (task) {
|
||||
return $.format(htmlTask, task.TaskName, task.UserName, task.AssignTime, task.ID);
|
||||
}).join('');
|
||||
$('#list-task').html(content);
|
||||
}
|
||||
if (options.animation) options.ctl.toggleClass('fa-spin');
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
if (options.animation) options.ctl.toggleClass('fa-spin');
|
||||
$btnRefresh.toggleClass('fa-spin');
|
||||
}
|
||||
});
|
||||
}
|
||||
listData();
|
||||
|
||||
$('a.fa-refresh').on('click', function () {
|
||||
listData({ ctl: $(this) });
|
||||
$btnRefresh.on('click', function () {
|
||||
listData();
|
||||
});
|
||||
})
|
|
@ -18,20 +18,13 @@
|
|||
@Html.Partial("Navigator", Model)
|
||||
}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">任务消息<span class="pull-right"><a href="javascript:;" class="tooltips fa fa-refresh" data-category="0" data-placement="left" data-original-title="点击刷新"></a></span></div>
|
||||
<div class="panel-heading">任务消息<span class="pull-right"><a id="refreshTask" href="javascript:;" class="fa fa-refresh"></a></span></div>
|
||||
<div class="panel-body">
|
||||
<div class="tasks-widget">
|
||||
<ul id="list-task" class="task-list ui-sortable">
|
||||
<li class="list-primary">
|
||||
<i class="fa fa-ellipsis-v"></i>
|
||||
<div class="task-title notifi">
|
||||
@*<span class="task-title-sp">Title</span>
|
||||
<span class="task-value">Content</span>
|
||||
<span class="task-time">@System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")</span>
|
||||
<div class="pull-right hidden-phone">
|
||||
<button class="btn btn-success btn-xs fa fa-check tooltips" data-placement="left" data-original-title="同意授权"></button>
|
||||
<button class="btn btn-danger btn-xs fa fa-remove tooltips" data-placement="left" data-original-title="拒绝授权"></button>
|
||||
</div>*@
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<h4 class="modal-title" id="myGroupModalLabel">部门授权窗口</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-inline" role="form"></form>
|
||||
<form id="groupForm" class="form-inline" role="form"></form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<h4 class="modal-title" id="myRoleModalLabel">角色授权窗口</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-inline" role="form">
|
||||
<form id="roleForm" class="form-inline" role="form">
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<h4 class="modal-title" id="myUserModalLabel">用户授权窗口</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-inline" role="form"></form>
|
||||
<form id="userForm" class="form-inline" role="form"></form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
|
|
Loading…
Reference in New Issue