修改BUG:MVC默认json返回日期时间字符串格式为yyyy-MM-ddTHH:mm:ss
This commit is contained in:
parent
7521492088
commit
73057e5ca4
|
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 }
|
||||
]
|
||||
});
|
||||
|
||||
|
|
|
@ -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 }
|
||||
]
|
||||
});
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue