[Frontend] 時間格式統一 Y:M:D H:M:S
This commit is contained in:
parent
a18152e23a
commit
c2bb9cb199
@ -1109,16 +1109,7 @@
|
|||||||
title: "發生時間",
|
title: "發生時間",
|
||||||
data: "timestamp",
|
data: "timestamp",
|
||||||
render: function (data) {
|
render: function (data) {
|
||||||
return (
|
return displayDate(data);
|
||||||
new Date(data).toLocaleString("zh-tw", {
|
|
||||||
year: "numeric",
|
|
||||||
month: "2-digit",
|
|
||||||
day: "2-digit",
|
|
||||||
hour: "2-digit",
|
|
||||||
minute: "2-digit",
|
|
||||||
}),
|
|
||||||
displayDate(data, "datetime")
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1133,9 +1124,7 @@
|
|||||||
let btnCol = data == "1" ? "warning" : "info";
|
let btnCol = data == "1" ? "warning" : "info";
|
||||||
return data == "1"
|
return data == "1"
|
||||||
? `<td><button onclick="chgAck('${row.uuid}')" class="btn btn-${btnCol}">${confirm}</button></td>`
|
? `<td><button onclick="chgAck('${row.uuid}')" class="btn btn-${btnCol}">${confirm}</button></td>`
|
||||||
: `<td><span>${new Date(row.ackedTime).toLocaleString(
|
: `<td><span>${displayDate(row.ackedTime)}</span></td>` /*`<td><button class="btn btn-${btnCol}">${confirm}</button></td>`*/;
|
||||||
"zh-tw"
|
|
||||||
)}</span></td>` /*`<td><button class="btn btn-${btnCol}">${confirm}</button></td>`*/;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -917,6 +917,7 @@
|
|||||||
{
|
{
|
||||||
title: "預計施工時間",
|
title: "預計施工時間",
|
||||||
data: "start_time",
|
data: "start_time",
|
||||||
|
className: "text-nowrap",
|
||||||
render: function (data) {
|
render: function (data) {
|
||||||
return displayDate(data, "datetime");
|
return displayDate(data, "datetime");
|
||||||
},
|
},
|
||||||
@ -1099,6 +1100,7 @@
|
|||||||
{
|
{
|
||||||
title: "預計施工時間",
|
title: "預計施工時間",
|
||||||
data: "start_time",
|
data: "start_time",
|
||||||
|
className: "text-nowrap",
|
||||||
render: function (data) {
|
render: function (data) {
|
||||||
return displayDate(data, "datetime");
|
return displayDate(data, "datetime");
|
||||||
},
|
},
|
||||||
|
@ -1483,7 +1483,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body p-2 tab-content w-100">
|
<div class="card-body p-2 tab-content w-100">
|
||||||
<div id="state" class="show active w-100" data-tabname="cardTab" data-tabrole="child" >
|
<div id="state" class="show active w-100" data-tabname="cardTab" data-tabrole="child" >
|
||||||
${drawStateTabBlo(devNum)}
|
${drawStateTabBlo(
|
||||||
|
devNum
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div id="info" data-tabname="cardTab" data-tabrole="child">
|
<div id="info" data-tabname="cardTab" data-tabrole="child">
|
||||||
|
|
||||||
@ -1606,30 +1608,41 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
let tag = "#opeRecTable";
|
let tag = "#opeRecTable";
|
||||||
|
|
||||||
let column_defs = [
|
let column_defs = [
|
||||||
{ targets: [0], width: "8%", sortable: true },
|
{ targets: [0], width: "10%", sortable: true },
|
||||||
{ targets: [1], width: "8%", sortable: true },
|
{ targets: [1], width: "10%", sortable: true },
|
||||||
{ targets: [2], width: "7%", sortable: true },
|
{ targets: [2], width: "5%", sortable: true },
|
||||||
{ targets: [3], width: "7%", sortable: true },
|
{ targets: [3], width: "5%", sortable: true },
|
||||||
];
|
];
|
||||||
|
|
||||||
let columns = [
|
let columns = [
|
||||||
{
|
{
|
||||||
title: "類型",
|
title: "類型",
|
||||||
data: "work_type_name",
|
data: "work_type_name",
|
||||||
|
className: "text-nowrap",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "項目",
|
title: "項目",
|
||||||
data: "fix_do",
|
data: "fix_do",
|
||||||
|
className: "text-nowrap",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "處理人員",
|
title: "處理人員",
|
||||||
data: "work_person_name",
|
data: "work_person_name",
|
||||||
|
className: "text-nowrap",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "發生/完成時間",
|
title: "發生/完成時間",
|
||||||
data: "finishTime",
|
data: "finishTime",
|
||||||
|
className: "text-nowrap",
|
||||||
render: function (data, type, row) {
|
render: function (data, type, row) {
|
||||||
return row.createdAt + "<br>" + (data.includes("0001")? "未完工": data);
|
return (
|
||||||
|
displayDate(row.createdAt) +
|
||||||
|
"<br>" +
|
||||||
|
(data.includes("0001")
|
||||||
|
? "未完工"
|
||||||
|
: displayDate(data)
|
||||||
|
)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -1648,6 +1661,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
null,
|
null,
|
||||||
"<'scrolledTable'tpi>"
|
"<'scrolledTable'tpi>"
|
||||||
);
|
);
|
||||||
|
$("#opeRecTable").DataTable().order([3, "desc"]).draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadLightSchTable(devGuid) {
|
function loadLightSchTable(devGuid) {
|
||||||
@ -1766,31 +1780,40 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
let datas;
|
let datas;
|
||||||
|
|
||||||
let column_defs = [
|
let column_defs = [
|
||||||
{ targets: [0], width: "15%", sortable: true },
|
{ targets: [0], sortable: true },
|
||||||
{ targets: [1], width: "25%", sortable: true },
|
{ targets: [1], sortable: true },
|
||||||
{ targets: [2], width: "25%", sortable: true },
|
{ targets: [2], sortable: true },
|
||||||
{ targets: [3], width: "35%", sortable: true },
|
{ targets: [3], sortable: true },
|
||||||
];
|
];
|
||||||
|
|
||||||
let columns = [
|
let columns = [
|
||||||
{
|
{
|
||||||
title: "異常ID",
|
title: "異常ID",
|
||||||
data: "uuid",
|
data: "uuid",
|
||||||
|
className: "text-nowrap",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "異常原因",
|
title: "異常原因",
|
||||||
data: "msgText",
|
data: "msgText",
|
||||||
|
className: "text-nowrap",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "ACK確認",
|
title: "ACK確認",
|
||||||
data: "ackState",
|
data: "ackState",
|
||||||
|
className: "text-nowrap",
|
||||||
|
render: function (data, type, row) {
|
||||||
|
return data === 1
|
||||||
|
? "未確認"
|
||||||
|
: displayDate(row.ackedTime);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "發生時間",
|
title: "發生時間",
|
||||||
data: "timestamp",
|
data: "timestamp",
|
||||||
// "render": function (data, type, row) {
|
className: "text-nowrap",
|
||||||
// return row.timestamp + "<br>" + data;
|
render: function (data, type, row) {
|
||||||
// },
|
return displayDate(row.timestamp);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -1807,6 +1830,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
null,
|
null,
|
||||||
"<'scrolledTable'tpi>"
|
"<'scrolledTable'tpi>"
|
||||||
);
|
);
|
||||||
|
$("#errRecTable").DataTable().order([3, "desc"]).draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//根據 data-type 設置顏色 (判斷後台是否有設定,若無則帶預設)
|
//根據 data-type 設置顏色 (判斷後台是否有設定,若無則帶預設)
|
||||||
@ -2345,7 +2369,8 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
|
|
||||||
datas[idx].full_name =
|
datas[idx].full_name =
|
||||||
allDevices.filter((x) => x.device_number == data.devicePath)[0]
|
allDevices.filter((x) => x.device_number == data.devicePath)[0]
|
||||||
?.full_name || (data.alarmClass === "Sys_Con_AlarmClass"
|
?.full_name ||
|
||||||
|
(data.alarmClass === "Sys_Con_AlarmClass"
|
||||||
? `${building_name}_電錶邊緣控制器_${data.split("_")[7]}`
|
? `${building_name}_電錶邊緣控制器_${data.split("_")[7]}`
|
||||||
: "");
|
: "");
|
||||||
|
|
||||||
@ -2390,6 +2415,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
"add_many",
|
"add_many",
|
||||||
notices.oSort("id").reverse()
|
notices.oSort("id").reverse()
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
$("#noticeBlock").innerHTML = "";
|
||||||
|
$("#noticeBlock").css({ display: "none", opacity: "0" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -227,46 +227,29 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
|
|||||||
|
|
||||||
var _occurrenceTime = new Date(
|
var _occurrenceTime = new Date(
|
||||||
record.get("timestamp").$cEncStr
|
record.get("timestamp").$cEncStr
|
||||||
).toLocaleString("zh-tw", {
|
)
|
||||||
year: "numeric",
|
|
||||||
month: "2-digit",
|
|
||||||
day: "2-digit",
|
|
||||||
hour: "2-digit",
|
|
||||||
minute: "2-digit",
|
|
||||||
});
|
|
||||||
// _occurrenceTime += _timestampTemp.getFullYear().toString() + "-" + addzero(_timestampTemp.getMonth() + 1).toString() + "-" + addzero(_timestampTemp.getDate()).toString() + " " + addzero(_timestampTemp.getHours()).toString() + ":" + addzero(_timestampTemp.getMinutes()).toString() + ":" + addzero(_timestampTemp.getSeconds()).toString();
|
// _occurrenceTime += _timestampTemp.getFullYear().toString() + "-" + addzero(_timestampTemp.getMonth() + 1).toString() + "-" + addzero(_timestampTemp.getDate()).toString() + " " + addzero(_timestampTemp.getHours()).toString() + ":" + addzero(_timestampTemp.getMinutes()).toString() + ":" + addzero(_timestampTemp.getSeconds()).toString();
|
||||||
|
|
||||||
//var _occurrenceTime = _timestamp.format("yyyy-MM-dd hh:mm:ss");//.toLocaleString();
|
//var _occurrenceTime = _timestamp.format("yyyy-MM-dd hh:mm:ss");//.toLocaleString();
|
||||||
var _ackTime = new Date(
|
var _ackTime = new Date(
|
||||||
record.get("ackTime").$cEncStr
|
record.get("ackTime").$cEncStr
|
||||||
).toLocaleString("zh-tw", {
|
)
|
||||||
year: "numeric",
|
|
||||||
month: "2-digit",
|
|
||||||
day: "2-digit",
|
|
||||||
hour: "2-digit",
|
|
||||||
minute: "2-digit",
|
|
||||||
});
|
|
||||||
// _normalTime += _normaltime.getFullYear().toString() + "-" + addzero(_normaltime.getMonth() + 1).toString() + "-" + addzero(_normaltime.getDate()).toString() + " " + addzero(_normaltime.getHours()).toString() + ":" + addzero(_normaltime.getMinutes()).toString() + ":" + addzero(_normaltime.getSeconds()).toString();
|
// _normalTime += _normaltime.getFullYear().toString() + "-" + addzero(_normaltime.getMonth() + 1).toString() + "-" + addzero(_normaltime.getDate()).toString() + " " + addzero(_normaltime.getHours()).toString() + ":" + addzero(_normaltime.getMinutes()).toString() + ":" + addzero(_normaltime.getSeconds()).toString();
|
||||||
|
|
||||||
var _normalTime = new Date(
|
var _normalTime = new Date(
|
||||||
record.get("normalTime").$cEncStr
|
record.get("normalTime").$cEncStr
|
||||||
).toLocaleString("zh-tw", {
|
)
|
||||||
year: "numeric",
|
|
||||||
month: "2-digit",
|
|
||||||
day: "2-digit",
|
|
||||||
hour: "2-digit",
|
|
||||||
minute: "2-digit",
|
|
||||||
});
|
|
||||||
|
|
||||||
var _msgText = record.get("alarmData").get("msgText"); // == 1 ? _occurrenceTime : "未確認";
|
var _msgText = record.get("alarmData").get("msgText"); // == 1 ? _occurrenceTime : "未確認";
|
||||||
var _ackText =
|
var _ackText =
|
||||||
record.get("ackState") == 0 ? _ackTime : "未確認";
|
record.get("ackState")
|
||||||
_ss.push({
|
_ss.push({
|
||||||
uuid: _resultUuid[0],
|
uuid: _resultUuid[0],
|
||||||
msgText: _msgText,
|
msgText: _msgText,
|
||||||
ackState: _ackText,
|
ackState: _ackText,
|
||||||
timestamp: _occurrenceTime,
|
timestamp: _occurrenceTime,
|
||||||
normalTime: _normalTime,
|
normalTime: _normalTime,
|
||||||
|
ackedTime: _ackTime
|
||||||
});
|
});
|
||||||
_index++;
|
_index++;
|
||||||
},
|
},
|
||||||
|
@ -1001,9 +1001,9 @@ function BajaSubscribeElectricmeterByBql(
|
|||||||
);
|
);
|
||||||
|
|
||||||
//使用bql語法
|
//使用bql語法
|
||||||
// console.log(
|
console.log(
|
||||||
// `local:|foxs:${port}|station:|slot:/${ordPathForElectricmeter.devicePath}|bql:select name, out, out.value, slotPath, facets from control:ControlPoint`
|
`local:|foxs:${port}|station:|slot:/${ordPathForElectricmeter.devicePath}|bql:select name, out, out.value, slotPath, facets from control:ControlPoint`
|
||||||
// );
|
);
|
||||||
baja.Ord.make(
|
baja.Ord.make(
|
||||||
`local:|foxs:${port}|station:|slot:/${ordPathForElectricmeter.devicePath}|bql:select name, out, out.value, slotPath, facets from control:ControlPoint`
|
`local:|foxs:${port}|station:|slot:/${ordPathForElectricmeter.devicePath}|bql:select name, out, out.value, slotPath, facets from control:ControlPoint`
|
||||||
).get(function (table) {
|
).get(function (table) {
|
||||||
|
Loading…
Reference in New Issue
Block a user