function getGroupUsers(groupPath) {
$('#tbGroupUsersList').datagrid({
800,
height: 100,
nowrap: false,
striped: true,
fit: true,
url: '/AD/getGroupObject',
queryParams: {
GroupPath: groupPath
},
frozen: true,
frozenColumns:[[
{ field: 'ck', checkbox: true },
{ field: 'ObjectType', title: '类型', 50, align: 'center' },
{ field: 'UserName', title: '姓名', 100, align: 'center' },
{
field: 'ADAccount', title: 'AD域帐号', 100, align: 'center'
},
]] ,
columns: [[
{
field: 'EmployeeID', title: '工号', 70, align: 'center'
},
{
field: 'Department', title: '部门名称', 100, align: 'left'
},
{
field: 'DeptLevel', title: '部门级别', 70, align: 'center'
},
{
field: 'Postion', title: '岗位', 80, align: 'center'
},
{ field: 'Telephone', title: '联系电话', 150, align: 'left', hidden: 'true' },
{
field: 'JobLevel', title: '职级', 50, align: 'center'
},
{
field: 'ADStatus', title: 'AD状态', 50, align: 'center'
},
{
field: 'HrStatus', title: 'HR状态', 50, align: 'center'
},
{
field: 'Groups', title: '所在组', 90, align: 'left'
}
]],
toolbar: [
{
id: 'btnDel',
text: '删除',
iconCls: 'icon-delete',
handler: function () {
//编辑处理
var row = $('#tbGroupUsersList').datagrid('getSelections');
if (row != null) {
var vGrouplist = "";
for (var i = 0; i < row.length; i++) {
vGrouplist += row[i].ADAccount + ",";
}
if (vGrouplist != "") {
$.messager.confirm('确认', '确认要从组' + groupPath.split(',')[0] + '中删除' + vGrouplist + "吗?", function (r) {
if (r) {
DelObjectFromGroup(vGrouplist, groupPath);
}
});
}
else {
$.messager.alert('警告', '请至少选择一项删除!', 'warning');
}
}
else {
$.messager.alert('警告', '请至少选择一项删除!', 'warning');
}
}
}, {
id: 'btnExcel',
text: '导出Excel',
iconCls: 'icon-excel',
handler: function () {
location.href = '/AD/DownLoadCSVFile?GroupPath=' + groupPath;
}
}
],
pagePosition: 'both',
pageNumber: 1,
pagination: true,//分页控件
rownumbers: true,//显示行号
pageSize: 10,
pageList: [10, 15, 50, 100],
loader: myLoader
});
}
function myLoader(param, success, error) {
var that = $(this);
var opts = that.datagrid("options");
if (!opts.url) {
return false;
}
var cache = that.data().datagrid.cache;
if (!cache) {
$.ajax({
type: opts.method,
url: opts.url,
data: param,
dataType: "json",
success: function (data) {
that.data().datagrid['cache'] = data;
success(bulidData(data));
},
error: function () {
error.apply(this, arguments);
}
});
} else {
success(bulidData(cache));
}
function bulidData(data) {
debugger;
var temp = $.extend({}, data);
var tempRows = [];
var start = (param.page - 1) * parseInt(param.rows);
var end = start + parseInt(param.rows);
var rows = data.rows;
for (var i = start; i < end; i++) {
if (rows[i]) {
tempRows.push(rows[i]);
} else {
break;
}
}
temp.rows = tempRows;
return temp;
}
}