diff --git a/Bootstrap.Admin/App_Start/WebApiConfig.cs b/Bootstrap.Admin/App_Start/WebApiConfig.cs index 5ff0a0cf..eb7b6b37 100644 --- a/Bootstrap.Admin/App_Start/WebApiConfig.cs +++ b/Bootstrap.Admin/App_Start/WebApiConfig.cs @@ -16,6 +16,9 @@ namespace Bootstrap.Admin routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); + + var json = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings; + json.DateFormatString = "yyyy'-'MM'-'dd' 'HH':'mm':'ss"; } } } diff --git a/Bootstrap.Admin/Scripts/Exceptions.js b/Bootstrap.Admin/Scripts/Exceptions.js index 7fbd0352..12f465bd 100644 --- a/Bootstrap.Admin/Scripts/Exceptions.js +++ b/Bootstrap.Admin/Scripts/Exceptions.js @@ -8,18 +8,14 @@ $('table').smartTable({ url: '../api/Exceptions', - sortName: 'ErrorPage', + sortName: 'LogTime', queryParams: function (params) { return $.extend(params, { OperateTimeStart: $("#txt_operate_start").val(), OperateTimeEnd: $("#txt_operate_end").val() }); }, columns: [{ checkbox: true }, { title: "请求网址", field: "ErrorPage", sortable: false }, { title: "用户名", field: "UserID", sortable: false }, { title: "IP", field: "UserIp", sortable: false }, { title: "错误", field: "Message", sortable: false }, - { - title: "异常捕获时间", field: "LogTime", sortable: true, formatter: function (value, row, index) { - return new Date(value).format("yyyy-MM-dd HH:mm:ss"); - } - } + { title: "记录时间", field: "LogTime", sortable: true } ] }); diff --git a/Bootstrap.Admin/Scripts/Logs.js b/Bootstrap.Admin/Scripts/Logs.js index c550d367..d14bf942 100644 --- a/Bootstrap.Admin/Scripts/Logs.js +++ b/Bootstrap.Admin/Scripts/Logs.js @@ -1,20 +1,15 @@ $(function () { $('table').smartTable({ - url: '../api/Logs', //请求后台的URL(*) + url: '../api/Logs', sortName: 'OperationType', - queryParams: function (params) { return $.extend(params, { operateType: $("#txt_operate_type").val(), OperateTimeStart: $("#txt_operate_start").val(), OperateTimeEnd: $("#txt_operate_end").val() }); }, //传递参数(*) + queryParams: function (params) { return $.extend(params, { operateType: $("#txt_operate_type").val(), OperateTimeStart: $("#txt_operate_start").val(), OperateTimeEnd: $("#txt_operate_end").val() }); }, columns: [{ checkbox: true }, { title: "操作类型", field: "CRUD", sortable: true }, { title: "用户名称", field: "UserName", sortable: false }, - { - title: "操作时间", field: "LogTime", sortable: false, - formatter: function (value, row, index) { - return value.substring(0, 19).replace("T", " "); - } - }, + { title: "操作时间", field: "LogTime", sortable: false }, { title: "操作IP", field: "ClientIp", sortable: false }, - { title: "备注", field: "ClientAgent", sortable: false }, - { title: "操作模块", field: "RequestUrl", sortable: false } + { title: "Url", field: "RequestUrl", sortable: false }, + { title: "备注", field: "ClientAgent", sortable: false } ] }); diff --git a/Bootstrap.Admin/Scripts/noti.js b/Bootstrap.Admin/Scripts/noti.js index a01de573..33482aad 100644 --- a/Bootstrap.Admin/Scripts/noti.js +++ b/Bootstrap.Admin/Scripts/noti.js @@ -16,22 +16,19 @@ if (result) { if (category == '0' || category == '') { var content = result.Users.map(function (noti) { - var t = new Date(noti.RegisterTime).format('yyyy-MM-dd HH:mm:ss'); - return $.format(htmlNewUsers, noti.Title, noti.Content, t, noti.ID); + return $.format(htmlNewUsers, noti.Title, noti.Content, noti.RegisterTime, noti.ID); }).join(''); $('#tasks-users').html(content); } if (category == '1' || category == '') { var content = result.Apps.map(function (noti) { - var t = new Date(noti.RegisterTime).format('yyyy-MM-dd HH:mm:ss'); - return $.format(htmlApp, noti.Title, noti.Content, t, noti.ID); + return $.format(htmlApp, noti.Title, noti.Content, noti.RegisterTime, noti.ID); }).join(''); $('#tasks-app').html(content); } if (category == '2' || category == '') { var content = result.Dbs.map(function (noti) { - var t = new Date(noti.RegisterTime).format('yyyy-MM-dd HH:mm:ss'); - return $.format(htmlDb, noti.Title, noti.Content, t, noti.ID); + return $.format(htmlDb, noti.Title, noti.Content, noti.RegisterTime, noti.ID); }).join(''); $('#tasks-db').html(content); }