api_log.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. $(function(){
  2. initWidget();
  3. });
  4. function initWidget(){
  5. $('#apiLogGrid').datagrid({
  6. url:$.common.urlByBizAction("ApiLogAction_queryApiLogInfo"),
  7. rownumbers:true,
  8. columns:[[{field:'apiName',title:'API名称',align:'center',width:$(this).width()*0.2},
  9. {field:'operator',title:'操作人',align:'center',width:$(this).width()*0.2},
  10. {field:'operateTime',title:'操作时间',align:'center',width:$(this).width()*0.2,formatter:function(value,row,index){
  11. var opDate = new Date(value.time);
  12. return opDate.getFullYear()+'-'+opDate.getMonth()+'-'+opDate.getDate()+' '+opDate.getHours()+':'+opDate.getMinutes()+':'+opDate.getSeconds();
  13. }},
  14. {field:'operateContent',title:'操作内容',align:'center',width:$(this).width()*0.4,formatter:function(value,row,index){
  15. return JSON.stringify(value);
  16. }}]],
  17. onBeforeLoad: function(param){
  18. param.api = $("#txtApi").val();
  19. param.operateor = $("#txtOperator").val();
  20. param.startTime = $("#txtOperateTimeStart").datebox('getValue');
  21. param.endTime = $("#txtOperateTimeEnd").datebox('getValue');
  22. },
  23. onClickRow:function(rowIndex, rowData){
  24. $("#txtLogContent").val( JSON.stringify(rowData.operateContent));
  25. $("#apiLogInfoDialog").dialog('open');
  26. },
  27. toolbar:'#toolbar',
  28. pagination: true,
  29. pageList:[8,10,12,15,20],
  30. pageSize:12,
  31. method:'post',
  32. fit:true,
  33. fitColumns: true,
  34. striped: true,
  35. singleSelect:true,
  36. loadMsg:"正在加载...",
  37. loadFilter:function(data)
  38. {
  39. //console.log(data);
  40. return data;
  41. }
  42. });
  43. }
  44. function loadDataGrid(){
  45. $('#apiLogGrid').datagrid('reload');
  46. }