<script>
$(function () {
gridList();
})
function gridList() {
var $gridList = $("#gridList");
$gridList.dataGrid({
url: "/SystemManage/User/GetGridJson",
height: $(window).height() - 128,
colModel: [
{ label: '主键', name: 'F_Id', hidden: true },
{ label: '账户', name: 'F_Account', 80, align: 'left' },
{ label: '姓名', name: 'F_RealName', 80, align: 'left' },
{
label: '性别', name: 'F_Gender', 60, align: 'center',
formatter: function (cellvalue, options, rowObject) {
if (cellvalue == true) {
return '男';
} else {
return '女';
}
}
},
{ label: '手机', name: 'F_MobilePhone', 80, align: 'left' },
{
label: '公司', name: 'F_OrganizeId', 150, align: 'left',
formatter: function (cellvalue, options, rowObject) {
return top.clients.organize[cellvalue] == null ? "" : top.clients.organize[cellvalue].fullname;
}
},
{
label: '部门', name: 'F_DepartmentId', 80, align: 'left',
formatter: function (cellvalue, options, rowObject) {
return top.clients.organize[cellvalue] == null ? "" : top.clients.organize[cellvalue].fullname;
}
},
{
label: '岗位', name: 'F_DutyId', 80, align: 'left',
formatter: function (cellvalue, options, rowObject) {
return top.clients.duty[cellvalue] == null ? "" : top.clients.duty[cellvalue].fullname;
}
},
{
label: '创建时间', name: 'F_CreatorTime', 80, align: 'left',
formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' }
},
{
label: "允许登录", name: "F_EnabledMark", 60, align: "center",
formatter: function (cellvalue, options, rowObject) {
if (cellvalue == 1) {
return '<span class="label label-success">正常</span>';
} else if (cellvalue == 0) {
return '<span class="label label-default">禁用</span>';
}
}
},
{ label: '备注', name: 'F_Description', 200, align: 'left' }
],
pager: "#gridPager",
sortname: 'F_DepartmentId asc,F_CreatorTime desc',
viewrecords: true
});
$("#btn_search").click(function () {
$gridList.jqGrid('setGridParam', {
postData: { keyword: $("#txt_keyword").val() },
}).trigger('reloadGrid');
});
}
function btn_add() {
$.modalOpen({
id: "Form",
title: "新增用户",
url: "/SystemManage/User/Form",
"700px",
height: "510px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
function btn_edit() {
var keyValue = $("#gridList").jqGridRowValue().F_Id;
$.modalOpen({
id: "Form",
title: "修改用户",
url: "/SystemManage/User/Form?keyValue=" + keyValue,
"700px",
height: "510px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
function btn_delete() {
$.deleteForm({
url: "/SystemManage/User/DeleteForm",
param: { keyValue: $("#gridList").jqGridRowValue().F_Id },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
function btn_details() {
var keyValue = $("#gridList").jqGridRowValue().F_Id;
$.modalOpen({
id: "Details",
title: "查看用户",
url: "/SystemManage/User/Details?keyValue=" + keyValue,
"700px",
height: "550px",
btn: null,
});
}
function btn_revisepassword() {
var keyValue = $("#gridList").jqGridRowValue().F_Id;
var Account = $("#gridList").jqGridRowValue().F_Account;
var RealName = $("#gridList").jqGridRowValue().F_RealName;
$.modalOpen({
id: "RevisePassword",
title: '重置密码',
url: '/SystemManage/User/RevisePassword?keyValue=' + keyValue + "&account=" + escape(Account) + '&realName=' + escape(RealName),
"450px",
height: "260px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
function btn_disabled() {
var keyValue = $("#gridList").jqGridRowValue().F_Id;
$.modalConfirm("注:您确定要【禁用】该项账户吗?", function (r) {
if (r) {
$.submitForm({
url: "/SystemManage/User/DisabledAccount",
param: { keyValue: keyValue },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
});
}
function btn_enabled() {
var keyValue = $("#gridList").jqGridRowValue().F_Id;
$.modalConfirm("注:您确定要【启用】该项账户吗?", function (r) {
if (r) {
$.submitForm({
url: "/SystemManage/User/EnabledAccount",
param: { keyValue: keyValue },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
});
}
</script>
jQuery("#myTab").jqGrid({
datatype: "json", //将这里改为使用JSON数据
url:'DataServlet', //这是Action的请求地址
mtype: 'POST',
height: 250,
400,
colNames:['编号','姓名', '电话'],
colModel:[
{name:'id',index:'id', 60, sorttype:"int"},
{name:'name',index:'name', 90},
{name:'phone',index:'phone', 100}
],
pager: 'pager', //分页工具栏
imgpath: 'js/themes/basic/images', //图片存放路径
rowNum:10, //每页显示记录数
viewrecords: true, //是否显示行数
rowList:[10,20,30], //可调整每页显示的记录数
multiselect: false, //是否支持多选
caption: "信息显示"
});