|
var OperationRecordManager = {
|
OperationRecordGrid: undefined,
|
//接口服务
|
Server: function () {
|
//配置后端接口api
|
var config = (function () {
|
var urlGetList = "/OperationRecordAjax/GetOperationRecordList";
|
|
return {
|
URL_GetList: urlGetList
|
};
|
})();
|
|
//数据操作服务
|
var dataServer = (function ($, config) {
|
|
//查询分页列表
|
var getList = function (data, callback) {
|
|
$.gitAjax({
|
url: config.URL_GetList,
|
data: { ajaxData: JSON.stringify(data) },
|
type: "post",
|
dataType: "json",
|
success: function (result) {
|
if (callback != undefined && typeof callback == "function") {
|
callback(result);
|
}
|
}
|
});
|
}
|
|
return {
|
GetList: getList
|
}
|
|
})($, config);
|
return dataServer;
|
},
|
|
//list列表查询第一步
|
PageClick: function (PageIndex, PageSize) {
|
$.jBox.tip("正在努力加载数据...", "loading");
|
var Server = OperationRecordManager.Server();
|
var search = OperationRecordManager.GetSearch();
|
search["PageIndex"] = PageIndex;
|
search["PageSize"] = PageSize;
|
Server.GetList(search, function (result) {
|
OperationRecordManager.SetTable(result);
|
$.jBox.closeTip();
|
});
|
},
|
Refresh: function () {
|
|
var PageSize = $("#mypager").pager("GetPageSize");
|
var PageIndex = $("#mypager").pager("GetCurrent");
|
$.jBox.tip("正在努力加载数据...", "loading");
|
var Server = OperationRecordManager.Server();
|
var search = OperationRecordManager.GetSearch();
|
search["PageIndex"] = PageIndex;
|
search["PageSize"] = PageSize;
|
Server.GetList(search, function (result) {
|
OperationRecordManager.SetTable(result);
|
$.jBox.closeTip();
|
});
|
},
|
//渲染表格
|
SetTable: function (result) {
|
//获取表格需要的高度
|
var ht = masterUI.MMGridHeight();
|
//渲染表格列信息
|
var cols = [
|
{
|
title: '操作内容', name: 'Msg', width: 300, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '操作类型', name: 'TypeName', width: 100, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '数据编号', name: 'FkNo', width: 100, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '菜单名称', name: 'MenuName', width: 100, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '模块号', name: 'ParentNo', width: 100, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '操作人', name: 'CreateUserName', width: 140, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '操作时间', name: 'CreateTime', width: 160, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return git.JsonToDateTimeto(data);
|
}
|
},
|
];
|
|
if (this.OperationRecordGrid == undefined) {
|
this.OperationRecordGrid = $("#tabList").mmGrid({
|
cols: cols,
|
items: result.Result.List,
|
checkCol: true,
|
nowrap: true,
|
fullWidthRows: true,
|
remoteSort: true,
|
multiSelect: true,
|
height: ht
|
});
|
//绑定事件
|
OperationRecordManager.BindEvent();
|
} else {
|
this.OperationRecordGrid.load(result.Result.List);
|
}
|
//判断渲染分页插件
|
var pageInfo = result.PageInfo;
|
if (pageInfo != undefined) {
|
$("#mypager").pager({ pagenumber: pageInfo.PageIndex, recordCount: pageInfo.RowCount, pageSize: pageInfo.PageSize, buttonClickCallback: OperationRecordManager.PageClick });
|
}
|
},
|
BindEvent: function () {
|
//控制按钮权限
|
this.OperationRecordGrid.on('loadSuccess', function (e, data) {
|
window.LoadBtn.SetBtn();
|
});
|
//编辑删除事件都绑定
|
this.OperationRecordGrid.off("cellSelected").on("cellSelected", function (e, item, rowIndex, colIndex) {
|
if ($(e.target).is("a.edit")) {
|
var ID = item.ID;
|
|
OperationRecordManager.Dialog(ID, "Edit");
|
} else if ($(e.target).is("a.delete")) {
|
var ID = item.ID;
|
var submit = function (v, h, f) {
|
if (v == "ok") {
|
var list = [];
|
list.push(ID);
|
var param = {};
|
param["list"] = JSON.stringify(list);
|
var Server = OperationRecordManager.Server();
|
Server.Delete(param, function (result) {
|
$.jBox.tip(result.Message, "success");
|
var pageSize = $("#mypager").pager("GetPageSize");
|
OperationRecordManager.PageClick(1, pageSize);
|
});
|
}
|
}
|
$.jBox.confirm("确定要删除该品牌吗?", "提示", submit);
|
}
|
});
|
},
|
|
//获取搜索栏中的数据信息
|
GetSearch: function () {
|
var searchBar = $("div[data-condition='search']");
|
|
var userCode = searchBar.find("select[name='UserCode']").val();
|
var menuName = searchBar.find("select[name='MenuName']").val();
|
var beginTime = searchBar.find("input[name='BeginTime']").val();
|
var endTime = searchBar.find("input[name='EndTime']").val();
|
|
var search = {};
|
search["UserCode"] = userCode;
|
search["MenuName"] = menuName;
|
search["BeginTime"] = beginTime;
|
search["EndTime"] = endTime;
|
|
return search;
|
},
|
|
//初始化方法(渲染按钮事件、表格数据)
|
ToolBar: function () {
|
//搜索按钮点击事件
|
var searchBar = $("div[data-condition='search']");
|
searchBar.find("a[data-command='search']").click(function () {
|
OperationRecordManager.PageClick(1, 15);
|
});
|
|
//加载默认数据
|
OperationRecordManager.PageClick(1, 15);
|
}
|
};
|