$(function () {
|
initSystemName();
|
initActionType();
|
var appid = getAppId()!=null?getAppId():null;
|
$("#jqGrid").jqGrid({
|
url: restServerBaseURL + 'log/action/list',
|
datatype: "json",
|
colModel: [
|
{ label: '用户名', name: 'chinesename', index: 'CHINESENAME', width: 50,align:'center' },
|
{ label: '客户端IP', name: 'requestip', index: 'REQUESTIP', width: 50,align:'center' },
|
{ label: '所属系统', name: 'appfullname', index: 'APPFULLNAME', width: 100,align:'center' },
|
{ label: '大模块名称', name: 'largemodel', index: 'LARGEMODEL', width: 80,align:'center' },
|
{ label: '小模块名称', name: 'smallmodel', index: 'SMALLMODEL', width: 80,align:'center' },
|
{ label: '资源名称', name: 'title', index: 'TITLE', width: 80,align:'center',formatter:function(value,grid,rows,state) {
|
var id = rows.resourceid;
|
if (id != null) {
|
var html = "<a style='cursor:pointer;color:black;' onclick='openZY("+id+")'>"
|
+rows.title+"</a>";
|
return html;
|
} else {
|
return "";
|
}
|
}
|
},
|
{ label: '时间', name: 'dodate', index: 'DODATE', width: 80,align:'center',formatter:function(value,grid,rows,state){
|
var date =rows.dodate;
|
var d=date.substring(0,11);
|
return date;
|
}
|
},
|
{ label: '操作类型', name: 'actiontype', index: 'ACTIONTYPE',align:'center', width: 50},
|
|
],
|
postData:{'appid':appid},
|
viewrecords: true,
|
height: "auto",
|
rowNum: 10,
|
//rowList : [10,30,50],
|
rownumbers: true,
|
rownumWidth: 50,
|
autowidth:true,
|
pager: "#jqGridPager",
|
jsonReader : {
|
root: "page.list",
|
page: "page.currPage",
|
total: "page.totalPage",
|
records: "page.totalCount"
|
},
|
prmNames : {
|
page:"page",
|
rows:"limit",
|
order: "order"
|
},
|
gridComplete:function(){
|
//隐藏grid底部滚动条
|
$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" });
|
|
},
|
onSortCol:function(index,colindex,sortorder){
|
jQuery("#jqGrid").jqGrid('setGridParam',{
|
page:$(".ui-pg-input").val()
|
});
|
}
|
});
|
$("#jqGrid").jqGrid('setLabel','rn','序号',{'text-align':'center'},'');
|
});
|
|
var vm = new Vue({
|
el:'#rapp',
|
data:{
|
showList: true,
|
title: null,
|
action: {}
|
},
|
methods: {
|
query: function () {
|
if(!checkDate()) {
|
// $("#End_Date").focus();
|
// $("#End_Date").focus();
|
return false;
|
}
|
vm.reload();
|
},
|
add: function(){
|
vm.showList = false;
|
vm.title = "新增";
|
vm.action = {};
|
},
|
update: function () {
|
var actionid = getSelectedRow();
|
if(actionid == null){
|
return ;
|
}
|
vm.showList = false;
|
vm.title = "修改";
|
|
vm.getInfo(actionid)
|
},
|
saveOrUpdate: function () {
|
var url = vm.action.actionid == null ? "log/action/save" : "log/action/update";
|
$.ajax({
|
type: "POST",
|
url: restServerBaseURL + url,
|
contentType: "application/json",
|
data: JSON.stringify(vm.action),
|
success: function(r){
|
if(r.code === 0){
|
alert('操作成功', function(){
|
vm.reload();
|
});
|
}else{
|
alert(r.msg);
|
}
|
}
|
});
|
},
|
del: function () {
|
var actionids = getSelectedRows();
|
if(actionids == null){
|
return ;
|
}
|
|
confirm('确定要删除选中的记录?', function(){
|
$.ajax({
|
type: "POST",
|
url: restServerBaseURL + "log/action/delete",
|
contentType: "application/json",
|
data: JSON.stringify(actionids),
|
success: function(r){
|
if(r.code == 0){
|
alert('操作成功', function(){
|
vm.reload();
|
});
|
}else{
|
alert(r.msg);
|
}
|
}
|
});
|
});
|
},
|
getInfo: function(actionid){
|
$.get(restServerBaseURL + "log/action/info/"+actionid, function(r){
|
vm.action = r.action;
|
});
|
},
|
reload: function () {
|
var beginDate=$("#Begin_Date").val();
|
var endDate=$("#End_Date").val();
|
var UserName=$("#UserName").val();
|
var appid=$("#appidName").val();
|
var actiontype = $("#actionType").val();
|
var requestip = $("#requestip").val();
|
vm.showList = true;
|
var page = $("#jqGrid").jqGrid('getGridParam','page');
|
$("#jqGrid").jqGrid('setGridParam',{
|
postData:{
|
'UserName':UserName ,
|
'beginDate':beginDate,
|
'endDate':endDate,
|
'appid':appid,
|
'actiontype':actiontype,
|
'requestip':requestip
|
},page:1
|
}).trigger("reloadGrid");
|
},
|
refresh: function () {
|
vm.showList = true;
|
window.location.reload();
|
}
|
}
|
});
|
|
function initSystemName() {
|
var local=window.location.href;
|
$.ajax({
|
type: "GET",
|
url: restServerBaseURL + "sys/systeminfo/queryListAll",
|
contentType: "application/json",
|
success: function(msg) {
|
var systemList = msg.systemList;
|
jQuery("#appidName").append("<option value=''>全部</option>");
|
var appid = '';
|
if (getAppId()!=null) {
|
appid = getAppId();
|
}
|
jQuery.each(systemList, function(i, item) {
|
if(appid == item.appid) {
|
jQuery("#appidName").append("<option value=" + item.appid + " selected = 'true'>" + item.appfullname + "</option>");
|
}
|
else {
|
jQuery("#appidName").append("<option value=" + item.appid + ">" + item.appfullname + "</option>");
|
}
|
});
|
}
|
});
|
}
|
|
function findUserByWord(){
|
var username = $("#UserName").val();
|
$("#UserName").autocomplete({
|
source: restServerBaseURL + 'org/user/findUserByWord?keyWord='+encodeURI(encodeURI(username)), //请求的url
|
minLength: 1,
|
});
|
}
|
|
function initActionType() {
|
var local=window.location.href;
|
$.ajax({
|
type: "GET",
|
url: restServerBaseURL + "log/action/actionType",
|
contentType: "application/json",
|
success: function(msg) {
|
var list = msg.actionTypes;
|
jQuery("#actionType").append("<option value=''>全部</option>");
|
jQuery.each(list, function(i, item) {
|
jQuery("#actionType").append("<option value=" + item + ">" + item + "</option>");
|
});
|
}
|
});
|
}
|
|
//打开资源查看页面
|
function openZY(id) {
|
$.ajax({
|
type: "GET",
|
url: LanCatalogBaseURL + "api/cheackZYIsExist?resourceid="+id,
|
contentType: "application/json",
|
success: function(data) {
|
if(data){
|
window.open(LanCatalogBaseURL + "res/ZiYuan/ZiYuanBaseInfo?resourceid=" + id, "_blank");
|
}else{
|
alert("该资源已删除!");
|
}
|
}
|
});
|
}
|
|
function checkDate() {
|
var beginDate=$("#Begin_Date").val();
|
var endDate=$("#End_Date").val();
|
if(beginDate != "" && endDate != ""){
|
var pubdatestart = new Date(beginDate.replace(/-/g,"/"));
|
var pubdateend = new Date(endDate.replace(/-/g,"/"));
|
if(pubdatestart > pubdateend){
|
alert("结束时间不能小于开始时间!", function () {
|
$("#End_Date").focus();
|
$("#End_Date").focus();
|
});
|
return false;
|
}
|
else {
|
return true;
|
}
|
}
|
else {
|
return true;
|
}
|
}
|