Commit 63c2343d authored by BaiJiangJie's avatar BaiJiangJie

[Update] 修改列表日期

parent d93fe113
...@@ -51,8 +51,7 @@ function initAssetUserTable() { ...@@ -51,8 +51,7 @@ function initAssetUserTable() {
} else { } else {
innerHtml = '<i class="fa fa-circle text-warning"></i>' innerHtml = '<i class="fa fa-circle text-warning"></i>'
} }
var date = new Date(cellData.datetime); var dateManual = formatDateAsCN(cellData.datetime);
var dateManual = date.toLocaleString();
var dataContent = testDatetime + dateManual; var dataContent = testDatetime + dateManual;
innerHtml = "<a data-toggle='popover' data-content='" + dataContent + "'" + 'data-placement="auto bottom"' + ">" + innerHtml + "</a>"; innerHtml = "<a data-toggle='popover' data-content='" + dataContent + "'" + 'data-placement="auto bottom"' + ">" + innerHtml + "</a>";
$(td).html(innerHtml); $(td).html(innerHtml);
......
...@@ -159,8 +159,7 @@ function initTable() { ...@@ -159,8 +159,7 @@ function initTable() {
} else { } else {
innerHtml = '<i class="fa fa-circle text-warning"></i>' innerHtml = '<i class="fa fa-circle text-warning"></i>'
} }
var date = new Date(cellData.datetime); var dateManual = formatDateAsCN(cellData.datetime);
var dateManual = date.toLocaleString();
var dataContent = testDatetime + dateManual; var dataContent = testDatetime + dateManual;
innerHtml = "<a data-toggle='popover' data-content='" + dataContent + "'" + 'data-placement="auto bottom"' + ">" + innerHtml + "</a>"; innerHtml = "<a data-toggle='popover' data-content='" + dataContent + "'" + 'data-placement="auto bottom"' + ">" + innerHtml + "</a>";
$(td).html(innerHtml); $(td).html(innerHtml);
......
...@@ -82,7 +82,7 @@ function initTable() { ...@@ -82,7 +82,7 @@ function initTable() {
select: [], select: [],
columnDefs: [ columnDefs: [
{targets: 1, createdCell: function (td, cellData, rowData) { {targets: 1, createdCell: function (td, cellData, rowData) {
var d = new Date(cellData); var d = formatDateAsCN(cellData);
$(td).html(d); $(td).html(d);
}}, }},
{targets: 2, createdCell: function (td, cellData) { {targets: 2, createdCell: function (td, cellData) {
......
...@@ -109,8 +109,8 @@ $(document).ready(function () { ...@@ -109,8 +109,8 @@ $(document).ready(function () {
} }
}}, }},
{targets: 6, createdCell: function (td, cellData) { {targets: 6, createdCell: function (td, cellData) {
var d = new Date(cellData); var d = formatDateAsCN(cellData);
$(td).html(d.toLocaleString()) $(td).html(d)
}}, }},
{targets: 7, createdCell: function (td, cellData, rowData) { {targets: 7, createdCell: function (td, cellData, rowData) {
var detail_btn = '<a class="btn btn-xs btn-primary m-l-xs btn-run" href="{% url 'ops:adhoc-detail' pk=DEFAULT_PK %}">{% trans "Detail" %}</a>'.replace('{{ DEFAULT_PK }}', cellData); var detail_btn = '<a class="btn btn-xs btn-primary m-l-xs btn-run" href="{% url 'ops:adhoc-detail' pk=DEFAULT_PK %}">{% trans "Detail" %}</a>'.replace('{{ DEFAULT_PK }}', cellData);
......
...@@ -88,8 +88,9 @@ function initTable() { ...@@ -88,8 +88,9 @@ function initTable() {
select: [], select: [],
columnDefs: [ columnDefs: [
{targets: 1, createdCell: function (td, cellData, rowData) { {targets: 1, createdCell: function (td, cellData, rowData) {
var d = new Date(cellData); var d = formatDateAsCN(cellData);
$(td).html(d.toLocaleString()); $(td).html(d);
}}, }},
{targets: 2, createdCell: function (td, cellData) { {targets: 2, createdCell: function (td, cellData) {
var total = "<span>" + cellData.total + "</span>"; var total = "<span>" + cellData.total + "</span>";
......
...@@ -89,14 +89,16 @@ $(document).ready(function () { ...@@ -89,14 +89,16 @@ $(document).ready(function () {
language: navigator.language || "en", language: navigator.language || "en",
}; };
dateFromRef.datepicker(options).on("changeDate", function () { dateFromRef.datepicker(options).on("changeDate", function () {
var date = new Date($(this).val() + ' 0:0:0'); var value = $(this).val() + ' 0:0:0';
var date = safeDate(value);
var url = table.ajax.url(); var url = table.ajax.url();
url = setUrlParam(url, "date_from", date.getTime()/1000); url = setUrlParam(url, "date_from", date.getTime()/1000);
table.ajax.url(url); table.ajax.url(url);
table.ajax.reload(); table.ajax.reload();
}); });
dateToRef.datepicker(options).on("changeDate", function () { dateToRef.datepicker(options).on("changeDate", function () {
var date = new Date($(this).val() + ' 23:59:59'); var value = $(this).val() + ' 23:59:59';
var date = safeDate(value);
var url = table.ajax.url(); var url = table.ajax.url();
url = setUrlParam(url, "date_to", date.getTime()/1000); url = setUrlParam(url, "date_to", date.getTime()/1000);
table.ajax.url(url); table.ajax.url(url);
......
...@@ -104,8 +104,8 @@ var dateFrom = "{{ date_from.timestamp }}"; ...@@ -104,8 +104,8 @@ var dateFrom = "{{ date_from.timestamp }}";
var dateTo = "{{ date_to.timestamp }}"; var dateTo = "{{ date_to.timestamp }}";
function initTable() { function initTable() {
dateFrom = new Date(dateFrom * 1000).toISOString(); dateFrom = formatDateAsCN(dateFrom * 1000);
dateTo = new Date(dateTo * 1000).toISOString(); dateTo = formatDateAsCN(dateTo * 1000);
sessionListUrl = setUrlParam(sessionListUrl, "date_from", dateFrom); sessionListUrl = setUrlParam(sessionListUrl, "date_from", dateFrom);
sessionListUrl = setUrlParam(sessionListUrl, "date_to", dateTo); sessionListUrl = setUrlParam(sessionListUrl, "date_to", dateTo);
var options = { var options = {
...@@ -201,9 +201,9 @@ $(document).ready(function() { ...@@ -201,9 +201,9 @@ $(document).ready(function() {
return return
} }
var value = $(this).val() + ' 0:0:0'; var value = $(this).val() + ' 0:0:0';
var date = new Date(value); var date = formatDateAsCN(value);
var url = table.ajax.url(); var url = table.ajax.url();
url = setUrlParam(url, "date_from", date.toISOString()); url = setUrlParam(url, "date_from", date);
table.ajax.url(url); table.ajax.url(url);
table.ajax.reload(); table.ajax.reload();
}); });
...@@ -212,9 +212,9 @@ $(document).ready(function() { ...@@ -212,9 +212,9 @@ $(document).ready(function() {
return return
} }
var value = $(this).val() + ' 23:59:59'; var value = $(this).val() + ' 23:59:59';
var date = new Date(value); var date = formatDateAsCN(value);
var url = table.ajax.url(); var url = table.ajax.url();
url = setUrlParam(url, "date_to", date.toISOString()); url = setUrlParam(url, "date_to", date);
table.ajax.url(url); table.ajax.url(url);
table.ajax.reload(); table.ajax.reload();
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment