增加服务器时间查询API。主要用于报表显示等
This commit is contained in:
parent
219783ced2
commit
d29552c455
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -89,5 +90,14 @@ namespace ReportService.Controllers.api
|
|||
return Content(result,"application/json; charset=utf-8");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统时间
|
||||
/// </summary>
|
||||
/// <param name="format">时间格式</param>
|
||||
/// <returns>时间字符串</returns>
|
||||
public object GetServerTime(string format) {
|
||||
format ??= "yyyyMMdd HH:mm:ss";
|
||||
return new { str = DateTimeOffset.Now.ToString(format) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ var myjs = {
|
|||
fileContentUrl: "/api/ReportApi/GetHtml",
|
||||
reportUrl: "/api/ReportApi/GetPrint",
|
||||
getresult: "/api/ReportApi/GetResult",
|
||||
GetServerTime: "/api/ReportApi/GetServerTime",
|
||||
},
|
||||
//定义从对象获取请求参数的方法
|
||||
getParaStr(data) {
|
||||
|
@ -77,5 +78,10 @@ var myjs = {
|
|||
},
|
||||
getSqlStr() {
|
||||
return $.cookie("_SqlString");
|
||||
},
|
||||
GetServerTime(format, callback) {
|
||||
this.post(this.urls.GetServerTime, { format: format }, function (r) {
|
||||
callback(r.str);
|
||||
});
|
||||
}
|
||||
};
|
|
@ -32,6 +32,11 @@
|
|||
<th>登录用户名</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="5">打印时间:{{printTime}}</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr v-for="i in result">
|
||||
<td>{{i.name}}</td>
|
||||
|
@ -50,13 +55,18 @@
|
|||
data: {
|
||||
url: myjs.urls.getresult,
|
||||
result: [],
|
||||
printTime: "",
|
||||
},
|
||||
created() {
|
||||
var _this = this;
|
||||
var sql = myjs.getSqlStr();
|
||||
console.log(sql);
|
||||
myjs.post(this.url, { sql: sql }, function (d) {
|
||||
findPersonPrint.result = d;
|
||||
});
|
||||
myjs.GetServerTime("yyyy年MM月dd日 HH点", function (r) {
|
||||
_this.printTime = r;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user