增加服务器时间查询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 System.IO;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
@ -89,5 +90,14 @@ namespace ReportService.Controllers.api
|
||||||
return Content(result,"application/json; charset=utf-8");
|
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",
|
fileContentUrl: "/api/ReportApi/GetHtml",
|
||||||
reportUrl: "/api/ReportApi/GetPrint",
|
reportUrl: "/api/ReportApi/GetPrint",
|
||||||
getresult: "/api/ReportApi/GetResult",
|
getresult: "/api/ReportApi/GetResult",
|
||||||
|
GetServerTime: "/api/ReportApi/GetServerTime",
|
||||||
},
|
},
|
||||||
//定义从对象获取请求参数的方法
|
//定义从对象获取请求参数的方法
|
||||||
getParaStr(data) {
|
getParaStr(data) {
|
||||||
|
@ -77,5 +78,10 @@ var myjs = {
|
||||||
},
|
},
|
||||||
getSqlStr() {
|
getSqlStr() {
|
||||||
return $.cookie("_SqlString");
|
return $.cookie("_SqlString");
|
||||||
|
},
|
||||||
|
GetServerTime(format, callback) {
|
||||||
|
this.post(this.urls.GetServerTime, { format: format }, function (r) {
|
||||||
|
callback(r.str);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -32,6 +32,11 @@
|
||||||
<th>登录用户名</th>
|
<th>登录用户名</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th colspan="5">打印时间:{{printTime}}</th>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="i in result">
|
<tr v-for="i in result">
|
||||||
<td>{{i.name}}</td>
|
<td>{{i.name}}</td>
|
||||||
|
@ -50,13 +55,18 @@
|
||||||
data: {
|
data: {
|
||||||
url: myjs.urls.getresult,
|
url: myjs.urls.getresult,
|
||||||
result: [],
|
result: [],
|
||||||
|
printTime: "",
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
var _this = this;
|
||||||
var sql = myjs.getSqlStr();
|
var sql = myjs.getSqlStr();
|
||||||
console.log(sql);
|
console.log(sql);
|
||||||
myjs.post(this.url, { sql: sql }, function (d) {
|
myjs.post(this.url, { sql: sql }, function (d) {
|
||||||
findPersonPrint.result = d;
|
findPersonPrint.result = d;
|
||||||
});
|
});
|
||||||
|
myjs.GetServerTime("yyyy年MM月dd日 HH点", function (r) {
|
||||||
|
_this.printTime = r;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user