代码重构:重构BootstrapAdmin脚本,使用更简单
This commit is contained in:
parent
622adfc9a7
commit
e31dfe5055
|
@ -27,7 +27,6 @@
|
||||||
<script src="~/js/common-scripts.js"></script>
|
<script src="~/js/common-scripts.js"></script>
|
||||||
<script src="~/js/log.js"></script>
|
<script src="~/js/log.js"></script>
|
||||||
<script src="~/js/toastr.min.js"></script>
|
<script src="~/js/toastr.min.js"></script>
|
||||||
<script src="~/js/framework.js"></script>
|
|
||||||
@RenderSection("Javascript", false)
|
@RenderSection("Javascript", false)
|
||||||
}
|
}
|
||||||
@await Html.PartialAsync("navigator")
|
@await Html.PartialAsync("navigator")
|
||||||
|
|
|
@ -1,29 +1,25 @@
|
||||||
$(function () {
|
$(function () {
|
||||||
var bsa = new BootstrapAdmin({
|
$('table').lgbTable({
|
||||||
url: Dicts.url,
|
url: Dicts.url,
|
||||||
dataEntity: new DataEntity({
|
dataBinder: {
|
||||||
map: {
|
map: {
|
||||||
Id: "dictID",
|
Id: "#dictID",
|
||||||
Category: "dictCate",
|
Category: "#dictCate",
|
||||||
Name: "dictName",
|
Name: "#dictName",
|
||||||
Code: "dictCode",
|
Code: "#dictCode",
|
||||||
Define: "dictDefine"
|
Define: "#dictDefine"
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
});
|
smartTable: {
|
||||||
|
sortName: 'Category',
|
||||||
$('table').smartTable({
|
queryParams: function (params) { return $.extend(params, { category: $('#txt_dict_cate').val(), name: $("#txt_dict_name").val(), define: $("#txt_dict_define").val() }); },
|
||||||
url: Dicts.url,
|
columns: [
|
||||||
sortName: 'Category',
|
{ title: "字典标签", field: "Category", sortable: true },
|
||||||
queryParams: function (params) { return $.extend(params, { category: $('#txt_dict_cate').val(), name: $("#txt_dict_name").val(), define: $("#txt_dict_define").val() }); },
|
{ title: "字典名称", field: "Name", sortable: true },
|
||||||
columns: [
|
{ title: "字典代码", field: "Code", sortable: true },
|
||||||
{ checkbox: true },
|
{ title: "字典分类", field: "Define", sortable: true, formatter: function (value) { return value === "0" ? "系统使用" : "自定义"; } }
|
||||||
{ title: "编辑", field: "Id", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter },
|
]
|
||||||
{ title: "字典标签", field: "Category", sortable: true },
|
}
|
||||||
{ title: "字典名称", field: "Name", sortable: true },
|
|
||||||
{ title: "字典代码", field: "Code", sortable: true },
|
|
||||||
{ title: "字典分类", field: "Define", sortable: true, formatter: function (value, row, index) { return value == "0" ? "系统使用" : "自定义"; } }
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// autocomplete
|
// autocomplete
|
||||||
|
|
|
@ -6,11 +6,6 @@
|
||||||
var $errorDetail = $('#errorDetail');
|
var $errorDetail = $('#errorDetail');
|
||||||
var $errorDetailTitle = $('#myDetailModalLabel');
|
var $errorDetailTitle = $('#myDetailModalLabel');
|
||||||
|
|
||||||
var bsa = new BootstrapAdmin({
|
|
||||||
url: Exceptions.url,
|
|
||||||
validateForm: null
|
|
||||||
});
|
|
||||||
|
|
||||||
$('table').smartTable({
|
$('table').smartTable({
|
||||||
url: Exceptions.url,
|
url: Exceptions.url,
|
||||||
sortName: 'LogTime',
|
sortName: 'LogTime',
|
||||||
|
|
|
@ -1,218 +0,0 @@
|
||||||
(function ($) {
|
|
||||||
BootstrapAdmin = function (options) {
|
|
||||||
var that = this;
|
|
||||||
options = options || {};
|
|
||||||
options.click = $.extend({}, BootstrapAdmin.settings.click, options.click);
|
|
||||||
this.options = $.extend({}, BootstrapAdmin.settings, options);
|
|
||||||
this.dataEntity = options.dataEntity;
|
|
||||||
|
|
||||||
// handler click event
|
|
||||||
for (name in this.options.click) {
|
|
||||||
var ele = this.options.click[name];
|
|
||||||
var cId = ele;
|
|
||||||
var event = null;
|
|
||||||
if ($.isArray(ele)) {
|
|
||||||
for (index in ele) {
|
|
||||||
if (ele[index].id === undefined) {
|
|
||||||
window.console.log('options.click.assign[{0}].{1}.id 未设置控件id', ele[index].id, name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
cId = ele[index]['id'];
|
|
||||||
event = ele[index]['click'];
|
|
||||||
handler(cId, event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else handler(cId, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
// handler modal window show event
|
|
||||||
function handler(cid, event) {
|
|
||||||
var source = $("#" + cId);
|
|
||||||
source.data('click', name);
|
|
||||||
if (event !== null) source.data('event', event);
|
|
||||||
source.on('click', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var method = source.data('click');
|
|
||||||
BootstrapAdmin.prototype[method].call(that, this, source.data('event'));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
BootstrapAdmin.VERSION = "1.0";
|
|
||||||
BootstrapAdmin.Author = "Argo Zhang";
|
|
||||||
BootstrapAdmin.Email = "argo@163.com";
|
|
||||||
|
|
||||||
BootstrapAdmin.settings = {
|
|
||||||
url: undefined,
|
|
||||||
bootstrapTable: 'table',
|
|
||||||
modal: '#dialogNew',
|
|
||||||
click: {
|
|
||||||
query: 'btn_query',
|
|
||||||
create: 'btn_add',
|
|
||||||
edit: 'btn_edit',
|
|
||||||
del: 'btn_delete',
|
|
||||||
save: 'btnSubmit',
|
|
||||||
assign: []
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
BootstrapAdmin.idFormatter = function (value, row, index) {
|
|
||||||
return "<a class='edit' title='" + value + "' href='javascript:void(0)'>编辑</a>";
|
|
||||||
};
|
|
||||||
|
|
||||||
BootstrapAdmin.prototype = {
|
|
||||||
constructor: BootstrapAdmin,
|
|
||||||
idEvents: function () {
|
|
||||||
var op = {
|
|
||||||
dataEntity: $.extend({}, this.options.dataEntity),
|
|
||||||
table: this.options.bootstrapTable,
|
|
||||||
modal: this.options.modal,
|
|
||||||
src: this
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
'click .edit': function (e, value, row, index) {
|
|
||||||
op.dataEntity.load(row);
|
|
||||||
$(op.table).bootstrapTable('uncheckAll');
|
|
||||||
$(op.table).bootstrapTable('check', index);
|
|
||||||
handlerCallback.call(op.src, null, e, { oper: 'edit', data: row });
|
|
||||||
$(op.modal).modal("show");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
query: function (e, callback) {
|
|
||||||
if (this.options.bootstrapTable.constructor === String) $(this.options.bootstrapTable).bootstrapTable('refresh');
|
|
||||||
handlerCallback.call(this, callback, e, { oper: 'query' });
|
|
||||||
},
|
|
||||||
|
|
||||||
create: function (e, callback) {
|
|
||||||
if (this.dataEntity instanceof DataEntity) this.dataEntity.reset();
|
|
||||||
if (this.options.modal.constructor === String) $(this.options.modal).modal("show");
|
|
||||||
if (this.options.bootstrapTable.constructor === String) $(this.options.bootstrapTable).bootstrapTable('uncheckAll');
|
|
||||||
handlerCallback.call(this, callback, e, { oper: 'create' });
|
|
||||||
},
|
|
||||||
|
|
||||||
edit: function (e, callback) {
|
|
||||||
var options = this.options;
|
|
||||||
var data = {};
|
|
||||||
if (options.bootstrapTable.constructor === String) {
|
|
||||||
var arrselections = $(options.bootstrapTable).bootstrapTable('getSelections');
|
|
||||||
if (arrselections.length == 0) {
|
|
||||||
lgbSwal({ title: '请选择要编辑的数据', type: "warning" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (arrselections.length > 1) {
|
|
||||||
lgbSwal({ title: '请选择一个要编辑的数据', type: "warning" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
data = arrselections[0];
|
|
||||||
if (this.dataEntity instanceof DataEntity) this.dataEntity.load(data);
|
|
||||||
if (options.modal.constructor === String) $(options.modal).modal("show");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
handlerCallback.call(this, callback, e, { oper: 'edit', data: data });
|
|
||||||
},
|
|
||||||
|
|
||||||
del: function (e, callback) {
|
|
||||||
var that = this;
|
|
||||||
var options = this.options;
|
|
||||||
if (options.bootstrapTable.constructor === String) {
|
|
||||||
var arrselections = $(options.bootstrapTable).bootstrapTable('getSelections');
|
|
||||||
if (arrselections.length == 0) {
|
|
||||||
lgbSwal({ title: '请选择要删除的数据', type: "warning" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
swal({
|
|
||||||
title: "您确定要删除吗?",
|
|
||||||
type: "warning",
|
|
||||||
showCancelButton: true,
|
|
||||||
closeOnConfirm: true,
|
|
||||||
confirmButtonText: "是的,我要删除",
|
|
||||||
confirmButtonColor: "#d9534f",
|
|
||||||
cancelButtonText: "取消"
|
|
||||||
}, function () {
|
|
||||||
setTimeout(function () {
|
|
||||||
var iDs = arrselections.map(function (element, index) { return element.Id; });
|
|
||||||
$.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, callback, e, { oper: 'del', success: result });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
save: function (e, callback) {
|
|
||||||
var that = this;
|
|
||||||
var options = $.extend({ data: {} }, this.options);
|
|
||||||
if (this.dataEntity instanceof DataEntity) options = $.extend(options, { data: this.dataEntity.get() });
|
|
||||||
$.bc({
|
|
||||||
url: options.url, data: options.data, title: "保存数据", modal: options.modal,
|
|
||||||
callback: function (result) {
|
|
||||||
if (result) {
|
|
||||||
var finalData = null;
|
|
||||||
var index = 0;
|
|
||||||
if (result) {
|
|
||||||
if (options.bootstrapTable.constructor === String && options.data.Id.constructor === String) {
|
|
||||||
// 更新表格
|
|
||||||
if (options.data.Id > 0) {
|
|
||||||
var allTableData = $(options.bootstrapTable).bootstrapTable('getData');
|
|
||||||
for (index = 0; index < allTableData.length; index++) {
|
|
||||||
finalData = allTableData[index];
|
|
||||||
if (finalData.Id == options.data.Id) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(options.bootstrapTable).bootstrapTable('refresh');
|
|
||||||
finalData = options.data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$(options.bootstrapTable).bootstrapTable('refresh');
|
|
||||||
handlerCallback.call(that, callback, e, { oper: 'save', success: result, index: index, data: finalData });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
assign: function (e, callback) {
|
|
||||||
var options = this.options;
|
|
||||||
var row = {};
|
|
||||||
if (options.bootstrapTable && options.bootstrapTable.constructor === String) {
|
|
||||||
var arrselections = $(options.bootstrapTable).bootstrapTable('getSelections');
|
|
||||||
if (arrselections.length === 0) {
|
|
||||||
lgbSwal({ title: '请选择要编辑的数据', type: "warning" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (arrselections.length > 1) {
|
|
||||||
lgbSwal({ title: '请选择一个要编辑的数据', type: "warning" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
row = arrselections[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var data = options.dataEntity;
|
|
||||||
if (data instanceof DataEntity) data = data.get();
|
|
||||||
if ($.isFunction(callback)) callback.call(e, row, $.extend({}, data));
|
|
||||||
if ($.isFunction(this.options.callback)) this.options.callback.call(e, { oper: 'assign', row: row, data: data });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var handlerCallback = function (callback, e, data) {
|
|
||||||
if ($.isFunction(callback)) callback.call(e, data);
|
|
||||||
if ($.isFunction(this.options.callback)) this.options.callback.call(e, data);
|
|
||||||
};
|
|
||||||
})(jQuery);
|
|
|
@ -6,37 +6,32 @@
|
||||||
var $dialogRoleHeader = $('#myRoleModalLabel');
|
var $dialogRoleHeader = $('#myRoleModalLabel');
|
||||||
var $dialogRoleForm = $('#roleForm');
|
var $dialogRoleForm = $('#roleForm');
|
||||||
|
|
||||||
var bsa = new BootstrapAdmin({
|
$('table').lgbTable({
|
||||||
url: Group.url,
|
url: Group.url,
|
||||||
dataEntity: new DataEntity({
|
dataBinder: {
|
||||||
map: {
|
map: {
|
||||||
Id: "groupID",
|
Id: "#groupID",
|
||||||
GroupName: "groupName",
|
GroupName: "#groupName",
|
||||||
Description: "groupDesc"
|
Description: "#groupDesc"
|
||||||
}
|
},
|
||||||
}),
|
events: {
|
||||||
click: {
|
'#btn_assignRole': function (row) {
|
||||||
assign: [{
|
|
||||||
id: 'btn_assignRole',
|
|
||||||
click: function (row) {
|
|
||||||
$.bc({
|
$.bc({
|
||||||
id: row.Id, url: Role.url, data: { type: "group" }, swal: false,
|
id: row.Id, url: Role.url, data: { type: "group" }, swal: false,
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
var htmlTemplate = this.htmlTemplate;
|
var htmlTemplate = this.htmlTemplate;
|
||||||
var html = $.map(result, function (element, index) {
|
var html = $.map(result, function (element, index) {
|
||||||
return $.format(htmlTemplate, element.Id, element.RoleName, element.Checked, element.Description);
|
return $.format(htmlTemplate, element.Id, element.RoleName, element.Checked, element.Description);
|
||||||
}).join('')
|
}).join('');
|
||||||
$dialogRoleHeader.text($.format('{0}-角色授权窗口', row.GroupName));
|
$dialogRoleHeader.text($.format('{0}-角色授权窗口', row.GroupName));
|
||||||
$dialogRoleForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
$dialogRoleForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
||||||
if (label.title == "") label.title = "未设置";
|
if (label.title === "") label.title = "未设置";
|
||||||
}).tooltip();
|
}).tooltip();
|
||||||
$dialogRole.modal('show');
|
$dialogRole.modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}, {
|
'#btn_assignUser': function (row) {
|
||||||
id: 'btn_assignUser',
|
|
||||||
click: function (row) {
|
|
||||||
$.bc({
|
$.bc({
|
||||||
id: row.Id, url: User.url, data: { type: "group" }, swal: false,
|
id: row.Id, url: User.url, data: { type: "group" }, swal: false,
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
|
@ -46,42 +41,35 @@
|
||||||
}).join('');
|
}).join('');
|
||||||
$dialogUserHeader.text($.format('{0}-用户授权窗口', row.GroupName));
|
$dialogUserHeader.text($.format('{0}-用户授权窗口', row.GroupName));
|
||||||
$dialogUserForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
$dialogUserForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
||||||
if (label.title == "") label.title = "未设置";
|
if (label.title === "") label.title = "未设置";
|
||||||
}).tooltip();
|
}).tooltip();
|
||||||
$dialogUser.modal('show');
|
$dialogUser.modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}, {
|
'#btnSubmitRole': function (row) {
|
||||||
id: 'btnSubmitRole',
|
|
||||||
click: function (row) {
|
|
||||||
var groupId = row.Id;
|
var groupId = row.Id;
|
||||||
var roleIds = $dialogRole.find('input:checked').map(function (index, element) {
|
var roleIds = $dialogRole.find('input:checked').map(function (index, element) {
|
||||||
return $(element).val();
|
return $(element).val();
|
||||||
}).toArray().join(',');
|
}).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' });
|
||||||
}
|
},
|
||||||
}, {
|
'#btnSubmitUser': function (row) {
|
||||||
id: 'btnSubmitUser',
|
|
||||||
click: function (row) {
|
|
||||||
var groupId = row.Id;
|
var groupId = row.Id;
|
||||||
var userIds = $dialogUser.find(':checked').map(function (index, element) {
|
var userIds = $dialogUser.find(':checked').map(function (index, element) {
|
||||||
return $(element).val();
|
return $(element).val();
|
||||||
}).toArray().join(',');
|
}).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' });
|
||||||
}
|
}
|
||||||
}]
|
}
|
||||||
|
},
|
||||||
|
smartTable: {
|
||||||
|
sortName: 'GroupName',
|
||||||
|
queryParams: function (params) { return $.extend(params, { groupName: $("#txt_search_name").val(), description: $("#txt_group_desc").val() }); }, //传递参数(*)
|
||||||
|
columns: [
|
||||||
|
{ title: "部门名称", field: "GroupName", sortable: true },
|
||||||
|
{ title: "部门描述", field: "Description", sortable: false }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('table').smartTable({
|
|
||||||
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 },
|
|
||||||
{ title: "编辑", field: "Id", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter },
|
|
||||||
{ title: "部门名称", field: "GroupName", sortable: true },
|
|
||||||
{ title: "部门描述", field: "Description", sortable: false }
|
|
||||||
]
|
|
||||||
});
|
|
||||||
});
|
});
|
|
@ -1,9 +1,5 @@
|
||||||
$(function () {
|
$(function () {
|
||||||
var url = '../api/Logs/';
|
var url = 'api/Logs/';
|
||||||
var bsa = new BootstrapAdmin({
|
|
||||||
url: url,
|
|
||||||
validateForm: null
|
|
||||||
});
|
|
||||||
|
|
||||||
$('table').smartTable({
|
$('table').smartTable({
|
||||||
url: url,
|
url: url,
|
||||||
|
|
|
@ -171,7 +171,7 @@
|
||||||
function success(result) {
|
function success(result) {
|
||||||
var interval = 10;
|
var interval = 10;
|
||||||
if ($.isFunction(options.callback)) {
|
if ($.isFunction(options.callback)) {
|
||||||
options.callback.call(options.$element == null ? options : options.$element, result);
|
options.callback.call(options.$element === null ? options : options.$element, result);
|
||||||
}
|
}
|
||||||
if (options.modal !== null && (result || options.loading)) {
|
if (options.modal !== null && (result || options.loading)) {
|
||||||
$(options.modal).modal('hide');
|
$(options.modal).modal('hide');
|
||||||
|
@ -182,7 +182,7 @@
|
||||||
lgbSwal({ title: options.title + (result ? "成功" : "失败"), type: result ? 'success' : 'error' });
|
lgbSwal({ title: options.title + (result ? "成功" : "失败"), type: result ? 'success' : 'error' });
|
||||||
}
|
}
|
||||||
if ($.isFunction(callback)) {
|
if ($.isFunction(callback)) {
|
||||||
callback.call(options.$element == null ? this : options.$element);
|
callback.call(options.$element === null ? this : options.$element);
|
||||||
}
|
}
|
||||||
}, interval);
|
}, interval);
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@
|
||||||
return prefix;
|
return prefix;
|
||||||
},
|
},
|
||||||
fullScreenStatus: function fullScreenStatus(value) {
|
fullScreenStatus: function fullScreenStatus(value) {
|
||||||
if (value != undefined) window.fullscreen = value;
|
if (value !== undefined) window.fullscreen = value;
|
||||||
return document.fullscreen ||
|
return document.fullscreen ||
|
||||||
document.mozFullScreen ||
|
document.mozFullScreen ||
|
||||||
document.webkitIsFullScreen || window.fullscreen ||
|
document.webkitIsFullScreen || window.fullscreen ||
|
||||||
|
@ -217,7 +217,7 @@
|
||||||
},
|
},
|
||||||
formatUrl: function (url) {
|
formatUrl: function (url) {
|
||||||
if (!url) return url;
|
if (!url) return url;
|
||||||
if (url.substr(0, 4) == "http") return url;
|
if (url.substr(0, 4) === "http") return url;
|
||||||
var base = $('#pathBase').attr('href');
|
var base = $('#pathBase').attr('href');
|
||||||
return base + url;
|
return base + url;
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@
|
||||||
var $collapse = $root.find('a[data-toggle="collapse"]:visible');
|
var $collapse = $root.find('a[data-toggle="collapse"]:visible');
|
||||||
$collapse.each(function () {
|
$collapse.each(function () {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
if ($this.attr('href') != '#') return;
|
if ($this.attr('href') !== '#') return;
|
||||||
var $target = $this.parent().next();
|
var $target = $this.parent().next();
|
||||||
var tId = $.getUID('collapse');
|
var tId = $.getUID('collapse');
|
||||||
$target.attr('id', tId);
|
$target.attr('id', tId);
|
||||||
|
@ -325,6 +325,20 @@
|
||||||
var op = $.extend({ header: "header", content: ".main-content" }, options);
|
var op = $.extend({ header: "header", content: ".main-content" }, options);
|
||||||
return ($(op.header).outerHeight() + $(op.content).outerHeight() + this.outerHeight() > $(window).height()) ? this.removeClass('fixed') : this.addClass('fixed');
|
return ($(op.header).outerHeight() + $(op.content).outerHeight() + this.outerHeight() > $(window).height()) ? this.removeClass('fixed') : this.addClass('fixed');
|
||||||
},
|
},
|
||||||
|
lgbTable: function (options) {
|
||||||
|
var bsa = new DataTable($.extend(options.dataBinder, { url: options.url }));
|
||||||
|
|
||||||
|
var settings = $.extend({
|
||||||
|
url: options.url,
|
||||||
|
checkbox: true,
|
||||||
|
edit: true,
|
||||||
|
editTitle: "编辑",
|
||||||
|
editField: "Id"
|
||||||
|
}, options.smartTable);
|
||||||
|
if (settings.edit) settings.columns.unshift({ title: settings.editTitle, field: settings.editField, events: bsa.idEvents(), formatter: DataTable.idFormatter });
|
||||||
|
if (settings.checkbox) settings.columns.unshift({ checkbox: true });
|
||||||
|
this.smartTable(settings);
|
||||||
|
},
|
||||||
smartTable: function (options) {
|
smartTable: function (options) {
|
||||||
var settings = $.extend({
|
var settings = $.extend({
|
||||||
method: 'get', //请求方式(*)
|
method: 'get', //请求方式(*)
|
||||||
|
@ -353,7 +367,7 @@
|
||||||
$('#' + $(this).attr('id').replace('tb_', 'btn_')).trigger("click");
|
$('#' + $(this).attr('id').replace('tb_', 'btn_')).trigger("click");
|
||||||
}).insertBefore(this.parents('.bootstrap-table').find('.fixed-table-toolbar > .bs-bars'));
|
}).insertBefore(this.parents('.bootstrap-table').find('.fixed-table-toolbar > .bs-bars'));
|
||||||
return this;
|
return this;
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//extend dropdown method
|
//extend dropdown method
|
||||||
|
|
|
@ -1,54 +1,226 @@
|
||||||
(function ($) {
|
(function ($) {
|
||||||
DataEntity = function (options) {
|
DataEntity = function (options) {
|
||||||
this.options = $.extend({ map: {} }, options);
|
this.options = options;
|
||||||
};
|
};
|
||||||
|
|
||||||
DataEntity.VERSION = "1.0";
|
|
||||||
DataEntity.Author = "Argo Zhang";
|
|
||||||
DataEntity.Email = "argo@163.com";
|
|
||||||
|
|
||||||
DataEntity.prototype = {
|
DataEntity.prototype = {
|
||||||
load: function (value) {
|
load: function (value) {
|
||||||
for (name in this.options.map) {
|
for (name in this.options) {
|
||||||
var ctl = $("#" + this.options.map[name]);
|
var ctl = $(this.options[name]);
|
||||||
if (ctl.attr('data-toggle') == "dropdown") {
|
if (ctl.attr('data-toggle') === "dropdown") {
|
||||||
ctl.val(value[name]).dropdown('val');
|
ctl.val(value[name]).dropdown('val');
|
||||||
}
|
}
|
||||||
else if (ctl.attr('data-toggle') == 'toggle') {
|
else if (ctl.attr('data-toggle') === 'toggle') {
|
||||||
ctl.bootstrapToggle(value[name] ? 'on' : 'off');
|
ctl.bootstrapToggle(value[name] ? 'on' : 'off');
|
||||||
}
|
}
|
||||||
else ctl.val(value[name]);
|
else ctl.val(value[name]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reset: function () {
|
reset: function () {
|
||||||
for (name in this.options.map) {
|
for (name in this.options) {
|
||||||
var ctl = $("#" + this.options.map[name]);
|
var ctl = $(this.options[name]);
|
||||||
var dv = ctl.attr("data-default-val");
|
var dv = ctl.attr("data-default-val");
|
||||||
if (dv === undefined) dv = "";
|
if (dv === undefined) dv = "";
|
||||||
if (ctl.attr('data-toggle') == "dropdown") {
|
if (ctl.attr('data-toggle') === "dropdown") {
|
||||||
ctl.val(dv).dropdown('val');
|
ctl.val(dv).dropdown('val');
|
||||||
}
|
}
|
||||||
else if (ctl.attr('data-toggle') == 'toggle') {
|
else if (ctl.attr('data-toggle') === 'toggle') {
|
||||||
ctl.bootstrapToggle(dv == "true" ? 'on' : 'off');
|
ctl.bootstrapToggle(dv === "true" ? 'on' : 'off');
|
||||||
}
|
}
|
||||||
else ctl.val(dv);
|
else ctl.val(dv);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
get: function () {
|
get: function () {
|
||||||
var target = {};
|
var target = {};
|
||||||
for (name in this.options.map) {
|
for (name in this.options) {
|
||||||
var ctl = $("#" + this.options.map[name]);
|
var ctl = $(this.options[name]);
|
||||||
var dv = ctl.attr('data-default-val');
|
var dv = ctl.attr('data-default-val');
|
||||||
if (ctl.attr('data-toggle') == 'toggle') {
|
if (ctl.attr('data-toggle') === 'toggle') {
|
||||||
target[name] = ctl.prop('checked');
|
target[name] = ctl.prop('checked');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (dv != undefined && ctl.val() == "") target[name] = dv;
|
else if (dv !== undefined && ctl.val() === "") target[name] = dv;
|
||||||
else target[name] = ctl.val();
|
else target[name] = ctl.val();
|
||||||
if (target[name] == "true" || target[name] == "True") target[name] = true;
|
if (target[name] === "true" || target[name] === "True") target[name] = true;
|
||||||
if (target[name] == "false" || target[name] == "False") target[name] = false;
|
if (target[name] === "false" || target[name] === "False") target[name] = false;
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTable = function (options) {
|
||||||
|
var that = this;
|
||||||
|
this.options = $.extend(true, {}, DataTable.settings, options);
|
||||||
|
this.dataEntity = new DataEntity(options.map);
|
||||||
|
|
||||||
|
// handler click event
|
||||||
|
for (var name in this.options.click) {
|
||||||
|
$(name).on('click', { handler: this.options.click[name] }, function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.data.handler.call(that, this);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// handler extra click event
|
||||||
|
for (var cId in this.options.events) {
|
||||||
|
$(cId).on('click', { handler: this.options.events[cId] }, function (e) {
|
||||||
|
var options = that.options;
|
||||||
|
var row = {};
|
||||||
|
if (options.bootstrapTable && options.bootstrapTable.constructor === String) {
|
||||||
|
var arrselections = $(options.bootstrapTable).bootstrapTable('getSelections');
|
||||||
|
if (arrselections.length === 0) {
|
||||||
|
lgbSwal({ title: '请选择要编辑的数据', type: "warning" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (arrselections.length > 1) {
|
||||||
|
lgbSwal({ title: '请选择一个要编辑的数据', type: "warning" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
row = arrselections[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e.data.handler.call(this, row);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTable.settings = {
|
||||||
|
url: undefined,
|
||||||
|
bootstrapTable: 'table',
|
||||||
|
modal: '#dialogNew',
|
||||||
|
click: {
|
||||||
|
'#btn_query': function (element) {
|
||||||
|
if (this.options.bootstrapTable.constructor === String) $(this.options.bootstrapTable).bootstrapTable('refresh');
|
||||||
|
handlerCallback.call(this, null, element, { oper: 'query' });
|
||||||
|
},
|
||||||
|
'#btn_add': function (element) {
|
||||||
|
this.dataEntity.reset();
|
||||||
|
if (this.options.modal.constructor === String) $(this.options.modal).modal("show");
|
||||||
|
if (this.options.bootstrapTable.constructor === String) $(this.options.bootstrapTable).bootstrapTable('uncheckAll');
|
||||||
|
handlerCallback.call(this, null, element, { oper: 'create' });
|
||||||
|
},
|
||||||
|
'#btn_edit': function (element) {
|
||||||
|
var options = this.options;
|
||||||
|
var data = {};
|
||||||
|
if (options.bootstrapTable.constructor === String) {
|
||||||
|
var arrselections = $(options.bootstrapTable).bootstrapTable('getSelections');
|
||||||
|
if (arrselections.length === 0) {
|
||||||
|
lgbSwal({ title: '请选择要编辑的数据', type: "warning" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (arrselections.length > 1) {
|
||||||
|
lgbSwal({ title: '请选择一个要编辑的数据', type: "warning" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
data = arrselections[0];
|
||||||
|
this.dataEntity.load(data);
|
||||||
|
if (options.modal.constructor === String) $(options.modal).modal("show");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handlerCallback.call(this, null, element, { oper: 'edit', data: data });
|
||||||
|
},
|
||||||
|
'#btn_delete': function (element) {
|
||||||
|
var that = this;
|
||||||
|
var options = this.options;
|
||||||
|
if (options.bootstrapTable.constructor === String) {
|
||||||
|
var arrselections = $(options.bootstrapTable).bootstrapTable('getSelections');
|
||||||
|
if (arrselections.length === 0) {
|
||||||
|
lgbSwal({ title: '请选择要删除的数据', type: "warning" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
swal({
|
||||||
|
title: "您确定要删除吗?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
closeOnConfirm: true,
|
||||||
|
confirmButtonText: "是的,我要删除",
|
||||||
|
confirmButtonColor: "#d9534f",
|
||||||
|
cancelButtonText: "取消"
|
||||||
|
}, function () {
|
||||||
|
setTimeout(function () {
|
||||||
|
var iDs = arrselections.map(function (element, index) { return element.Id; });
|
||||||
|
$.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 });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'#btnSubmit': function (element) {
|
||||||
|
var that = this;
|
||||||
|
var options = $.extend(true, {}, this.options, { data: this.dataEntity.get() });
|
||||||
|
$.bc({
|
||||||
|
url: options.url, data: options.data, title: "保存数据", modal: options.modal,
|
||||||
|
callback: function (result) {
|
||||||
|
if (result) {
|
||||||
|
var finalData = null;
|
||||||
|
var index = 0;
|
||||||
|
if (result) {
|
||||||
|
if (options.bootstrapTable.constructor === String && options.data.Id.constructor === String) {
|
||||||
|
// 更新表格
|
||||||
|
if (options.data.Id > 0) {
|
||||||
|
var allTableData = $(options.bootstrapTable).bootstrapTable('getData');
|
||||||
|
for (index = 0; index < allTableData.length; index++) {
|
||||||
|
finalData = allTableData[index];
|
||||||
|
if (finalData.Id === options.data.Id) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(options.bootstrapTable).bootstrapTable('refresh');
|
||||||
|
finalData = options.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$(options.bootstrapTable).bootstrapTable('refresh');
|
||||||
|
handlerCallback.call(that, null, element, { oper: 'save', success: result, index: index, data: finalData });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTable.idFormatter = function (value, row, index) {
|
||||||
|
return "<a class='edit' title='" + value + "' href='javascript:void(0)'>编辑</a>";
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTable.prototype = {
|
||||||
|
constructor: DataTable,
|
||||||
|
idEvents: function () {
|
||||||
|
var op = {
|
||||||
|
dataEntity: this.dataEntity,
|
||||||
|
table: this.options.bootstrapTable,
|
||||||
|
modal: this.options.modal,
|
||||||
|
src: this
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
'click .edit': function (e, value, row, index) {
|
||||||
|
op.dataEntity.load(row);
|
||||||
|
$(op.table).bootstrapTable('uncheckAll');
|
||||||
|
$(op.table).bootstrapTable('check', index);
|
||||||
|
handlerCallback.call(op.src, null, e, { oper: 'edit', data: row });
|
||||||
|
$(op.modal).modal("show");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function handlerCallback(callback, element, data) {
|
||||||
|
if ($.isFunction(callback)) callback.call(e, data);
|
||||||
|
if ($.isFunction(this.options.callback)) this.options.callback.call(element, data);
|
||||||
}
|
}
|
||||||
}(jQuery));
|
}(jQuery));
|
|
@ -19,120 +19,111 @@
|
||||||
var initNestMenu = function () {
|
var initNestMenu = function () {
|
||||||
$nestMenuInput = $nestMenu.find('div.dd3-content');
|
$nestMenuInput = $nestMenu.find('div.dd3-content');
|
||||||
$nestMenuInput.children('.checkbox').hide();
|
$nestMenuInput.children('.checkbox').hide();
|
||||||
}
|
};
|
||||||
|
|
||||||
var state = [];
|
var state = [];
|
||||||
|
|
||||||
var bsa = new BootstrapAdmin({
|
$('table').lgbTable({
|
||||||
url: Menu.url,
|
url: Menu.url,
|
||||||
dataEntity: new DataEntity({
|
dataBinder: {
|
||||||
map: {
|
map: {
|
||||||
Id: "menuID",
|
Id: "#menuID",
|
||||||
ParentId: "parentId",
|
ParentId: "#parentId",
|
||||||
ParentName: "parentName",
|
ParentName: "#parentName",
|
||||||
Name: "name",
|
Name: "#name",
|
||||||
Order: "order",
|
Order: "#order",
|
||||||
Icon: "icon",
|
Icon: "#icon",
|
||||||
Url: "url",
|
Url: "#url",
|
||||||
Category: "category",
|
Category: "#category",
|
||||||
Target: "target",
|
Target: "#target",
|
||||||
IsResource: "isRes",
|
IsResource: "#isRes",
|
||||||
ApplicationCode: "app"
|
ApplicationCode: "#app"
|
||||||
}
|
},
|
||||||
}),
|
events: {
|
||||||
click: {
|
'#btn_assignRole': function (row) {
|
||||||
assign: [{
|
|
||||||
id: 'btn_assignRole',
|
|
||||||
click: function (row) {
|
|
||||||
$.bc({
|
$.bc({
|
||||||
id: row.Id, url: Role.url, data: { type: "menu" }, swal: false,
|
id: row.Id, url: Role.url, data: { type: "menu" }, swal: false,
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
var htmlTemplate = this.htmlTemplate;
|
var htmlTemplate = this.htmlTemplate;
|
||||||
var html = $.map(result, function (element, index) {
|
var html = $.map(result, function (element, index) {
|
||||||
return $.format(htmlTemplate, element.Id, element.RoleName, element.Checked, element.Description);
|
return $.format(htmlTemplate, element.Id, element.RoleName, element.Checked, element.Description);
|
||||||
}).join('')
|
}).join('');
|
||||||
$dialogRoleHeader.text($.format('{0}-角色授权窗口', row.Name));
|
$dialogRoleHeader.text($.format('{0}-角色授权窗口', row.Name));
|
||||||
$dialogRoleForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
$dialogRoleForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
||||||
if (label.title == "") label.title = "未设置";
|
if (label.title === "") label.title = "未设置";
|
||||||
}).tooltip();
|
}).tooltip();
|
||||||
$dialogRole.modal('show');
|
$dialogRole.modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}, {
|
'#btnSubmitRole': function (row) {
|
||||||
id: 'btnSubmitRole',
|
|
||||||
click: function (row) {
|
|
||||||
var menuId = row.Id;
|
var menuId = row.Id;
|
||||||
var roleIds = $dialogRole.find('input:checked').map(function (index, element) {
|
var roleIds = $dialogRole.find('input:checked').map(function (index, element) {
|
||||||
return $(element).val();
|
return $(element).val();
|
||||||
}).toArray().join(',');
|
}).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' });
|
||||||
}
|
}
|
||||||
}]
|
},
|
||||||
|
callback: function (result) {
|
||||||
|
if (!result.success) return;
|
||||||
|
if ((result.oper === "save") || result.oper === "del") {
|
||||||
|
$nestMenu.nestMenu(initNestMenu);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
callback: function (result) {
|
smartTable: {
|
||||||
if (!result.success) return;
|
sortName: 'Order',
|
||||||
if ((result.oper == "save") || result.oper == "del") {
|
queryParams: function (params) { return $.extend(params, { parentName: $('#txt_parent_menus_name').val(), name: $("#txt_menus_name").val(), category: $('#sel_menus_category').val(), isresource: $('#sel_menus_res').val() }); }, //传递参数(*)
|
||||||
$nestMenu.nestMenu(initNestMenu);
|
columns: [
|
||||||
}
|
{ title: "父级菜单", field: "ParentName", sortable: true },
|
||||||
|
{ title: "菜单名称", field: "Name", sortable: true },
|
||||||
|
{ title: "菜单序号", field: "Order", sortable: true },
|
||||||
|
{
|
||||||
|
title: "菜单图标", field: "Icon", sortable: false, align: 'center', formatter: function (value, row, index) {
|
||||||
|
if (value) {
|
||||||
|
return $.format('<i class="text-info {0}"></i>', value);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ title: "菜单路径", field: "Url", sortable: false },
|
||||||
|
{ title: "菜单类别", field: "CategoryName", sortable: true },
|
||||||
|
{
|
||||||
|
title: "目标", field: "Target", sortable: true, formatter: function (value, row, index) {
|
||||||
|
var ret = value;
|
||||||
|
switch (value) {
|
||||||
|
case "_self":
|
||||||
|
ret = "本窗口";
|
||||||
|
break;
|
||||||
|
case "_blank":
|
||||||
|
ret = "新窗口";
|
||||||
|
break;
|
||||||
|
case "_parent":
|
||||||
|
ret = "父级窗口";
|
||||||
|
break;
|
||||||
|
case "_top":
|
||||||
|
ret = "顶级窗口";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "菜单类型", field: "IsResource", sortable: true, formatter: function (value, row, index) {
|
||||||
|
return value === 0 ? "菜单" : "资源";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "所属应用", field: "ApplicationCode", sortable: true, formatter: function (value, row, index) {
|
||||||
|
return $('#app').next().find('[data-val="' + value + '"]:first').text();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('table').smartTable({
|
|
||||||
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(), isresource: $('#sel_menus_res').val() }); }, //传递参数(*)
|
|
||||||
columns: [
|
|
||||||
{ checkbox: true },
|
|
||||||
{ title: "编辑", field: "Id", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter },
|
|
||||||
{ title: "父级菜单", field: "ParentName", sortable: true },
|
|
||||||
{ title: "菜单名称", field: "Name", sortable: true },
|
|
||||||
{ title: "菜单序号", field: "Order", sortable: true },
|
|
||||||
{
|
|
||||||
title: "菜单图标", field: "Icon", sortable: false, align: 'center', formatter: function (value, row, index) {
|
|
||||||
if (value) {
|
|
||||||
return $.format('<i class="text-info {0}"></i>', value);
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ title: "菜单路径", field: "Url", sortable: false },
|
|
||||||
{ title: "菜单类别", field: "CategoryName", sortable: true },
|
|
||||||
{
|
|
||||||
title: "目标", field: "Target", sortable: true, formatter: function (value, row, index) {
|
|
||||||
var ret = value;
|
|
||||||
switch (value) {
|
|
||||||
case "_self":
|
|
||||||
ret = "本窗口";
|
|
||||||
break;
|
|
||||||
case "_blank":
|
|
||||||
ret = "新窗口";
|
|
||||||
break;
|
|
||||||
case "_parent":
|
|
||||||
ret = "父级窗口";
|
|
||||||
break;
|
|
||||||
case "_top":
|
|
||||||
ret = "顶级窗口";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "菜单类型", field: "IsResource", sortable: true, formatter: function (value, row, index) {
|
|
||||||
return value == 0 ? "菜单" : "资源";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "所属应用", field: "ApplicationCode", sortable: true, formatter: function (value, row, index) {
|
|
||||||
return $('#app').next().find('[data-val="' + value + '"]:first').text();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
$('#dataForm').on('click', '[data-method]', function () {
|
$('#dataForm').on('click', '[data-method]', function () {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
@ -174,11 +165,11 @@
|
||||||
$nestMenu.find('li[data-category="' + $category.val() + '"]').show();
|
$nestMenu.find('li[data-category="' + $category.val() + '"]').show();
|
||||||
// handler new menu
|
// handler new menu
|
||||||
var did = $('#menuID').val();
|
var did = $('#menuID').val();
|
||||||
if (did == "") did = 0;
|
if (did === "") did = 0;
|
||||||
if (did == 0) {
|
if (did === 0) {
|
||||||
var menuName = $('#name').val();
|
var menuName = $('#name').val();
|
||||||
var menuCate = $category.val();
|
var menuCate = $category.val();
|
||||||
if (menuName == "") menuName = "新建菜单-未命名";
|
if (menuName === "") menuName = "新建菜单-未命名";
|
||||||
$nestMenu.find('ol.dd-list:first').append($.format('<li class="dd-item dd3-item" data-id="0" data-order="10" data-category="{1}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><label><span>{0}</span></label></div></li>', menuName, menuCate));
|
$nestMenu.find('ol.dd-list:first').append($.format('<li class="dd-item dd3-item" data-id="0" data-order="10" data-category="{1}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><label><span>{0}</span></label></div></li>', menuName, menuCate));
|
||||||
}
|
}
|
||||||
$nestMenu.find('li[data-id="' + did + '"] > div.dd3-content span').addClass('active');
|
$nestMenu.find('li[data-id="' + did + '"] > div.dd3-content span').addClass('active');
|
||||||
|
@ -221,7 +212,7 @@
|
||||||
var mid = $('#menuID').val();
|
var mid = $('#menuID').val();
|
||||||
for (index in data) {
|
for (index in data) {
|
||||||
var $data = $(data[index]);
|
var $data = $(data[index]);
|
||||||
if ($data.attr('data-id') == mid || $data.attr('data-id') == 0) {
|
if ($data.attr('data-id') === mid || $data.attr('data-id') === 0) {
|
||||||
if (index > 0) index--;
|
if (index > 0) index--;
|
||||||
$('#order').val($(data[index]).attr('data-order'));
|
$('#order').val($(data[index]).attr('data-order'));
|
||||||
break;
|
break;
|
||||||
|
@ -236,7 +227,7 @@
|
||||||
// Dialog shown event
|
// Dialog shown event
|
||||||
$dialog.on('show.bs.modal', function () {
|
$dialog.on('show.bs.modal', function () {
|
||||||
var icon = $inputIcon.val();
|
var icon = $inputIcon.val();
|
||||||
if (icon == "") icon = "fa fa-dashboard";
|
if (icon === "") icon = "fa fa-dashboard";
|
||||||
$btnPickIcon.find('i').attr('class', icon);
|
$btnPickIcon.find('i').attr('class', icon);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
var id = $this.attr('data-id');
|
var id = $this.attr('data-id');
|
||||||
var result = $this.attr('data-result');
|
var result = $this.attr('data-result');
|
||||||
$.bc({
|
$.bc({
|
||||||
id: id, url: User.url, method: "PUT", data: { type: "user", userIds: result }, title: result == "1" ? "授权用户" : "拒绝用户",
|
id: id, url: User.url, method: "PUT", data: { type: "user", userIds: result }, title: result === "1" ? "授权用户" : "拒绝用户",
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
$table.bootstrapTable('refresh');
|
$table.bootstrapTable('refresh');
|
||||||
$.pullNotification($('.header .nav').reloadWidget());
|
$.pullNotification($('.header .nav').reloadWidget());
|
||||||
|
|
|
@ -19,27 +19,21 @@
|
||||||
dropZoneTitle: "请选择头像"
|
dropZoneTitle: "请选择头像"
|
||||||
}).on('fileuploaded', function (event, data, previewId, index) {
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||||
var url = data.response.initialPreview[0];
|
var url = data.response.initialPreview[0];
|
||||||
if (!!url) $headerIcon.attr('src', url);
|
if (!!url === true) $headerIcon.attr('src', url);
|
||||||
});
|
});
|
||||||
|
|
||||||
var bsa = new BootstrapAdmin({
|
var dataBinder = new DataEntity({
|
||||||
url: Profiles.url,
|
Password: "#currentPassword",
|
||||||
bootstrapTable: null,
|
NewPassword: "#newPassword",
|
||||||
dataEntity: new DataEntity({
|
DisplayName: "#displayName",
|
||||||
map: {
|
UserName: "#userName",
|
||||||
Password: "currentPassword",
|
Css: "#css"
|
||||||
NewPassword: "newPassword",
|
|
||||||
DisplayName: "displayName",
|
|
||||||
UserName: "userName",
|
|
||||||
Css: "css"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('button[data-method]').on('click', function (e) {
|
$('button[data-method]').on('click', function (e) {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
if ($this.parent().attr("data-admin") === "True") return false;
|
if ($this.parent().attr("data-admin") === "True") return false;
|
||||||
var data = bsa.dataEntity.get();
|
var data = dataBinder.get();
|
||||||
switch ($this.attr('data-method')) {
|
switch ($this.attr('data-method')) {
|
||||||
case 'password':
|
case 'password':
|
||||||
data.UserStatus = 2;
|
data.UserStatus = 2;
|
||||||
|
|
|
@ -12,19 +12,16 @@
|
||||||
var $nestMenu = $('#nestable_menu');
|
var $nestMenu = $('#nestable_menu');
|
||||||
var $nestMenuInput = $nestMenu.find('div.dd3-content');
|
var $nestMenuInput = $nestMenu.find('div.dd3-content');
|
||||||
|
|
||||||
var bsa = new BootstrapAdmin({
|
$('table').lgbTable({
|
||||||
url: Role.url,
|
url: Role.url,
|
||||||
dataEntity: new DataEntity({
|
dataBinder: {
|
||||||
map: {
|
map: {
|
||||||
Id: "roleID",
|
Id: "#roleID",
|
||||||
RoleName: "roleName",
|
RoleName: "#roleName",
|
||||||
Description: "roleDesc"
|
Description: "#roleDesc"
|
||||||
}
|
},
|
||||||
}),
|
events: {
|
||||||
click: {
|
'#btn_assignUser': function (row) {
|
||||||
assign: [{
|
|
||||||
id: 'btn_assignUser',
|
|
||||||
click: function (row) {
|
|
||||||
$.bc({
|
$.bc({
|
||||||
id: row.Id, url: User.url, data: { type: "role" }, swal: false,
|
id: row.Id, url: User.url, data: { type: "role" }, swal: false,
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
|
@ -34,15 +31,13 @@
|
||||||
}).join('');
|
}).join('');
|
||||||
$dialogUserHeader.text($.format('{0}-用户授权窗口', row.RoleName));
|
$dialogUserHeader.text($.format('{0}-用户授权窗口', row.RoleName));
|
||||||
$dialogUserForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
$dialogUserForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
||||||
if (label.title == "") label.title = "未设置";
|
if (label.title === "") label.title = "未设置";
|
||||||
}).tooltip();
|
}).tooltip();
|
||||||
$dialogUser.modal('show');
|
$dialogUser.modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}, {
|
'#btn_assignGroup': function (row) {
|
||||||
id: 'btn_assignGroup',
|
|
||||||
click: function (row) {
|
|
||||||
$.bc({
|
$.bc({
|
||||||
id: row.Id, url: Group.url, data: { type: "role" }, swal: false,
|
id: row.Id, url: Group.url, data: { type: "role" }, swal: false,
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
|
@ -52,15 +47,13 @@
|
||||||
}).join('');
|
}).join('');
|
||||||
$dialogGroupHeader.text($.format('{0}-部门授权窗口', row.RoleName));
|
$dialogGroupHeader.text($.format('{0}-部门授权窗口', row.RoleName));
|
||||||
$dialogGroupForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
$dialogGroupForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
||||||
if (label.title == "") label.title = "未设置";
|
if (label.title === "") label.title = "未设置";
|
||||||
}).tooltip();
|
}).tooltip();
|
||||||
$dialogGroup.modal('show');
|
$dialogGroup.modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}, {
|
'#btn_assignMenu': function (row) {
|
||||||
id: 'btn_assignMenu',
|
|
||||||
click: function (row) {
|
|
||||||
$.bc({
|
$.bc({
|
||||||
id: row.Id, url: Menu.url, data: { type: "role" }, swal: false,
|
id: row.Id, url: Menu.url, data: { type: "role" }, swal: false,
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
|
@ -77,28 +70,22 @@
|
||||||
$dialogMenu.modal('show');
|
$dialogMenu.modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}, {
|
'#btnSubmitUser': function (row) {
|
||||||
id: 'btnSubmitUser',
|
|
||||||
click: function (row) {
|
|
||||||
var roleId = row.Id;
|
var roleId = row.Id;
|
||||||
var userIds = $dialogUser.find(':checked').map(function (index, element) {
|
var userIds = $dialogUser.find(':checked').map(function (index, element) {
|
||||||
return $(element).val();
|
return $(element).val();
|
||||||
}).toArray().join(',');
|
}).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 });
|
||||||
}
|
},
|
||||||
}, {
|
'#btnSubmitGroup': function (row) {
|
||||||
id: 'btnSubmitGroup',
|
|
||||||
click: function (row) {
|
|
||||||
var roleId = row.Id;
|
var roleId = row.Id;
|
||||||
var groupIds = $dialogGroup.find(':checked').map(function (index, element) {
|
var groupIds = $dialogGroup.find(':checked').map(function (index, element) {
|
||||||
return $(element).val();
|
return $(element).val();
|
||||||
}).toArray().join(',');
|
}).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 });
|
||||||
}
|
},
|
||||||
}, {
|
'#btnSubmitMenu': function (row) {
|
||||||
id: 'btnSubmitMenu',
|
|
||||||
click: function (row) {
|
|
||||||
var roleId = row.Id;
|
var roleId = row.Id;
|
||||||
var type = $btnSubmitMenu.data('type');
|
var type = $btnSubmitMenu.data('type');
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -112,22 +99,18 @@
|
||||||
}
|
}
|
||||||
$.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 });
|
||||||
}
|
}
|
||||||
}]
|
}
|
||||||
|
},
|
||||||
|
smartTable: {
|
||||||
|
sortName: 'RoleName',
|
||||||
|
queryParams: function (params) { return $.extend(params, { roleName: $("#txt_search_name").val(), description: $("#txt_role_desc").val() }); }, //传递参数(*)
|
||||||
|
columns: [
|
||||||
|
{ title: "角色名称", field: "RoleName", sortable: true },
|
||||||
|
{ title: "角色描述", field: "Description", sortable: false }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('table').smartTable({
|
|
||||||
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 },
|
|
||||||
{ title: "编辑", field: "Id", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter },
|
|
||||||
{ title: "角色名称", field: "RoleName", sortable: true },
|
|
||||||
{ title: "角色描述", field: "Description", sortable: false }
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
$nestMenu.nestMenu(function () {
|
$nestMenu.nestMenu(function () {
|
||||||
$nestMenuInput = $nestMenu.find('div.dd3-content');
|
$nestMenuInput = $nestMenu.find('div.dd3-content');
|
||||||
$nestMenuInput.on('click', ':checkbox', function () {
|
$nestMenuInput.on('click', ':checkbox', function () {
|
||||||
|
|
|
@ -1,24 +1,17 @@
|
||||||
$(function () {
|
$(function () {
|
||||||
$('a[data-admin="False"]').hide();
|
$('a[data-admin="False"]').hide();
|
||||||
|
|
||||||
var bsa = new BootstrapAdmin({
|
var dataBinder = new DataEntity({
|
||||||
url: Settings.url,
|
Title: "#sysName",
|
||||||
bootstrapTable: null,
|
Footer: "#sysFoot"
|
||||||
validateForm: null,
|
|
||||||
modal: null,
|
|
||||||
dataEntity: new DataEntity({
|
|
||||||
map: {
|
|
||||||
Title: "sysName",
|
|
||||||
Footer: "sysFoot"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('button[data-method]').on('click', function (e) {
|
$('button[data-method]').on('click', function (e) {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
var data = {};
|
||||||
switch ($this.attr('data-method')) {
|
switch ($this.attr('data-method')) {
|
||||||
case 'footer':
|
case 'footer':
|
||||||
var data = bsa.dataEntity.get();
|
data = dataBinder.get();
|
||||||
$.bc({
|
$.bc({
|
||||||
url: Settings.url, data: { name: '网站页脚', code: data.Footer, category: Settings.title }, title: Settings.title,
|
url: Settings.url, data: { name: '网站页脚', code: data.Footer, category: Settings.title }, title: Settings.title,
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
|
@ -27,7 +20,7 @@
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'title':
|
case 'title':
|
||||||
var data = bsa.dataEntity.get();
|
data = dataBinder.get();
|
||||||
$.bc({
|
$.bc({
|
||||||
url: Settings.url, data: { name: '网站标题', code: data.Title, category: Settings.title }, title: Settings.title,
|
url: Settings.url, data: { name: '网站标题', code: data.Title, category: Settings.title }, title: Settings.title,
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
|
@ -100,7 +93,7 @@
|
||||||
},
|
},
|
||||||
swal: false
|
swal: false
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
$('a[data-method]').on('click', function (e) {
|
$('a[data-method]').on('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
|
@ -6,39 +6,34 @@
|
||||||
var $dialogGroupHeader = $('#myGroupModalLabel');
|
var $dialogGroupHeader = $('#myGroupModalLabel');
|
||||||
var $dialogGroupForm = $('#groupForm');
|
var $dialogGroupForm = $('#groupForm');
|
||||||
|
|
||||||
var bsa = new BootstrapAdmin({
|
$('table').lgbTable({
|
||||||
url: User.url,
|
url: User.url,
|
||||||
dataEntity: new DataEntity({
|
dataBinder: {
|
||||||
map: {
|
map: {
|
||||||
Id: "userID",
|
Id: "#userID",
|
||||||
UserName: "userName",
|
UserName: "#userName",
|
||||||
Password: "password",
|
Password: "#password",
|
||||||
DisplayName: "displayName",
|
DisplayName: "#displayName",
|
||||||
NewPassword: "confirm"
|
NewPassword: "#confirm"
|
||||||
}
|
},
|
||||||
}),
|
events: {
|
||||||
click: {
|
'#btn_assignRole': function (row) {
|
||||||
assign: [{
|
|
||||||
id: 'btn_assignRole',
|
|
||||||
click: function (row) {
|
|
||||||
$.bc({
|
$.bc({
|
||||||
id: row.Id, url: Role.url, data: { type: "user" }, swal: false,
|
id: row.Id, url: Role.url, data: { type: "user" }, swal: false,
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
var htmlTemplate = this.htmlTemplate;
|
var htmlTemplate = this.htmlTemplate;
|
||||||
var html = $.map(result, function (element, index) {
|
var html = $.map(result, function (element, index) {
|
||||||
return $.format(htmlTemplate, element.Id, element.RoleName, element.Checked, element.Description);
|
return $.format(htmlTemplate, element.Id, element.RoleName, element.Checked, element.Description);
|
||||||
}).join('')
|
}).join('');
|
||||||
$dialogRoleHeader.text($.format('{0}-角色授权窗口', row.DisplayName));
|
$dialogRoleHeader.text($.format('{0}-角色授权窗口', row.DisplayName));
|
||||||
$dialogRoleForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
$dialogRoleForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
||||||
if (label.title == "") label.title = "未设置";
|
if (label.title === "") label.title = "未设置";
|
||||||
}).tooltip();
|
}).tooltip();
|
||||||
$dialogRole.modal('show');
|
$dialogRole.modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}, {
|
'#btn_assignGroup': function (row) {
|
||||||
id: 'btn_assignGroup',
|
|
||||||
click: function (row) {
|
|
||||||
$.bc({
|
$.bc({
|
||||||
id: row.Id, url: Group.url, data: { type: "user" }, swal: false,
|
id: row.Id, url: Group.url, data: { type: "user" }, swal: false,
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
|
@ -48,59 +43,51 @@
|
||||||
}).join('');
|
}).join('');
|
||||||
$dialogGroupHeader.text($.format('{0}-部门授权窗口', row.DisplayName));
|
$dialogGroupHeader.text($.format('{0}-部门授权窗口', row.DisplayName));
|
||||||
$dialogGroupForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
$dialogGroupForm.html(html).find('[data-toggle="tooltip"]').each(function (index, label) {
|
||||||
if (label.title == "") label.title = "未设置";
|
if (label.title === "") label.title = "未设置";
|
||||||
}).tooltip();
|
}).tooltip();
|
||||||
$dialogGroup.modal('show');
|
$dialogGroup.modal('show');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
}, {
|
'#btnSubmitRole': function (row) {
|
||||||
id: 'btnSubmitRole',
|
|
||||||
click: function (row) {
|
|
||||||
var userId = row.Id;
|
var userId = row.Id;
|
||||||
var roleIds = $dialogRole.find(':checked').map(function (index, element) {
|
var roleIds = $dialogRole.find(':checked').map(function (index, element) {
|
||||||
return $(element).val();
|
return $(element).val();
|
||||||
}).toArray().join(',');
|
}).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, modal: '#dialogRole' });
|
||||||
}
|
},
|
||||||
}, {
|
'#btnSubmitGroup': function (row) {
|
||||||
id: 'btnSubmitGroup',
|
|
||||||
click: function (row) {
|
|
||||||
var userId = row.Id;
|
var userId = row.Id;
|
||||||
var groupIds = $dialogGroup.find(':checked').map(function (index, element) {
|
var groupIds = $dialogGroup.find(':checked').map(function (index, element) {
|
||||||
return $(element).val();
|
return $(element).val();
|
||||||
}).toArray().join(',');
|
}).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, modal: '#dialogGroup' });
|
||||||
}
|
}
|
||||||
}]
|
},
|
||||||
|
callback: function (data) {
|
||||||
|
if (data && data.success && data.oper === 'save' && data.data.UserName === $('#userDisplayName').attr('data-userName')) {
|
||||||
|
$('#userDisplayName').text(data.data.DisplayName);
|
||||||
|
}
|
||||||
|
if (data && data.oper === 'create') {
|
||||||
|
$('#userName').prop('readonly', false).removeClass("ignore");
|
||||||
|
}
|
||||||
|
else if (data && data.oper === 'edit') {
|
||||||
|
$('#userName').prop('readonly', true).addClass("ignore");
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
callback: function (data) {
|
smartTable: {
|
||||||
if (data && data.success && data.oper === 'save' && data.data.UserName == $('#userDisplayName').attr('data-userName')) {
|
sortName: 'DisplayName',
|
||||||
$('#userDisplayName').text(data.data.DisplayName);
|
sortOrder: "asc",
|
||||||
}
|
queryParams: function (params) { return $.extend(params, { name: $("#txt_search_name").val(), displayName: $('#txt_display_name').val() }); }, //传递参数(*)
|
||||||
if (data && data.oper === 'create') {
|
columns: [
|
||||||
$('#userName').prop('readonly', false).removeClass("ignore");
|
{ title: "登陆名称", field: "UserName", sortable: true },
|
||||||
}
|
{ title: "显示名称", field: "DisplayName", sortable: true },
|
||||||
else if (data && data.oper === 'edit') {
|
{ title: "注册时间", field: "RegisterTime", sortable: true },
|
||||||
$('#userName').prop('readonly', true).addClass("ignore");
|
{ title: "授权时间", field: "ApprovedTime", sortable: true },
|
||||||
}
|
{ title: "授权人", field: "ApprovedBy", sortable: true },
|
||||||
|
{ title: "说明", field: "Description", sortable: false }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('table').smartTable({
|
|
||||||
url: User.url, //请求后台的URL(*)
|
|
||||||
sortName: 'DisplayName',
|
|
||||||
sortOrder: "asc",
|
|
||||||
queryParams: function (params) { return $.extend(params, { name: $("#txt_search_name").val(), displayName: $('#txt_display_name').val() }); }, //传递参数(*)
|
|
||||||
columns: [
|
|
||||||
{ checkbox: true },
|
|
||||||
{ title: "编辑", field: "Id", events: bsa.idEvents(), formatter: BootstrapAdmin.idFormatter },
|
|
||||||
{ title: "登陆名称", field: "UserName", sortable: true },
|
|
||||||
{ title: "显示名称", field: "DisplayName", sortable: true },
|
|
||||||
{ title: "注册时间", field: "RegisterTime", sortable: true },
|
|
||||||
{ title: "授权时间", field: "ApprovedTime", sortable: true },
|
|
||||||
{ title: "授权人", field: "ApprovedBy", sortable: true },
|
|
||||||
{ title: "说明", field: "Description", sortable: false }
|
|
||||||
]
|
|
||||||
});
|
|
||||||
});
|
});
|
Loading…
Reference in New Issue