[前端] 修改按鈕問題
This commit is contained in:
parent
9b0ad0fbd6
commit
dd2eea50d1
@ -324,7 +324,20 @@
|
|||||||
else if (deviceItem != null && deviceItem != undefined) {
|
else if (deviceItem != null && deviceItem != undefined) {
|
||||||
pageAct.devicePoiName = $(elem).text();
|
pageAct.devicePoiName = $(elem).text();
|
||||||
pageAct.deviceItem = deviceItem;
|
pageAct.deviceItem = deviceItem;
|
||||||
getData();
|
|
||||||
|
let start = new Date($('#his_startdate').val());
|
||||||
|
let end = new Date(new Date().setDate(new Date($('#his_enddate input').val()).getDate() + 1));
|
||||||
|
|
||||||
|
if (pageAct.dateType == "today" || pageAct.dateType == "day" || pageAct.dateType == "ytd")
|
||||||
|
end = new Date(new Date().setDate(start.getDate() + 1));
|
||||||
|
else if (pageAct.dateType == "month") {
|
||||||
|
start = new Date($('#getmonth').val());
|
||||||
|
end = new Date(new Date().setDate(start.getDate() + 30));
|
||||||
|
}
|
||||||
|
else if (pageAct.dateType != "range")
|
||||||
|
getData();
|
||||||
|
|
||||||
|
getData(formatDate(start, "date", true), formatDate(end, "date", true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,7 +398,7 @@
|
|||||||
let start = new Date($('#his_startdate').val());
|
let start = new Date($('#his_startdate').val());
|
||||||
let end = new Date(new Date().setDate(new Date($('#his_enddate input').val()).getDate() + 1));
|
let end = new Date(new Date().setDate(new Date($('#his_enddate input').val()).getDate() + 1));
|
||||||
|
|
||||||
if (pageAct.dateType == "day")
|
if (pageAct.dateType == "today" || pageAct.dateType == "day" || pageAct.dateType == "ytd")
|
||||||
end = new Date(new Date().setDate(start.getDate() + 1));
|
end = new Date(new Date().setDate(start.getDate() + 1));
|
||||||
else if (pageAct.dateType == "month") {
|
else if (pageAct.dateType == "month") {
|
||||||
start = new Date($('#getmonth').val());
|
start = new Date($('#getmonth').val());
|
||||||
@ -416,43 +429,43 @@
|
|||||||
v.type = pageAct.devicePoiName.split(" ")[0];
|
v.type = pageAct.devicePoiName.split(" ")[0];
|
||||||
});
|
});
|
||||||
|
|
||||||
let tag = "#historyTable";
|
let tag = "#historyTable";
|
||||||
|
|
||||||
let column_defs = [
|
let column_defs = [
|
||||||
{ "targets": [0], "width": "20%", "sortable": true },
|
{ "targets": [0], "width": "20%", "sortable": true },
|
||||||
{ "targets": [1], "width": "20%", "sortable": true },
|
{ "targets": [1], "width": "20%", "sortable": true },
|
||||||
{ "targets": [2], "width": "20%", "sortable": true }
|
{ "targets": [2], "width": "20%", "sortable": true }
|
||||||
];
|
];
|
||||||
|
|
||||||
let columns = [
|
let columns = [
|
||||||
{
|
{
|
||||||
"title": "類別",
|
"title": "類別",
|
||||||
"data": "type"
|
"data": "type"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "設備名稱",
|
"title": "設備名稱",
|
||||||
"data": "deviceName",
|
"data": "deviceName",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "數值",
|
"title": "數值",
|
||||||
"data": "value",
|
"data": "value",
|
||||||
"render": function (data) {
|
"render": function (data) {
|
||||||
if (isNaN(data.toString())) {
|
if (isNaN(data.toString())) {
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
return data.roundDecimal(2);
|
return data.roundDecimal(2);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "紀錄時間",
|
"title": "紀錄時間",
|
||||||
"data": "timestamp",
|
"data": "timestamp",
|
||||||
"render": function (data) {
|
"render": function (data) {
|
||||||
return displayDate(data, "datetime");
|
return displayDate(data, "datetime");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
|
historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,29 +485,29 @@
|
|||||||
$(loadEle).Loading("close");
|
$(loadEle).Loading("close");
|
||||||
}, () => {
|
}, () => {
|
||||||
$(loadEle).Loading("close");
|
$(loadEle).Loading("close");
|
||||||
}, "POST",true).send();
|
}, "POST", true).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
//選擇棟別
|
//選擇棟別
|
||||||
function SelectBuild(e, building_tag) {
|
function SelectBuild(e, building_tag) {
|
||||||
$(loadEle).Loading("start");
|
$(loadEle).Loading("start");
|
||||||
checkIsSelectedBuilding();
|
checkIsSelectedBuilding();
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkIsSelectedBuilding() {
|
function checkIsSelectedBuilding() {
|
||||||
let result = false;
|
let result = false;
|
||||||
let buildingRadios = $("[name=buildingRadio]:checked");
|
let buildingRadios = $("[name=buildingRadio]:checked");
|
||||||
buildingTag = null;
|
buildingTag = null;
|
||||||
if (buildingRadios && buildingRadios.length > 0) {
|
if (buildingRadios && buildingRadios.length > 0) {
|
||||||
$("[name=buildingRadio]").parent().removeClass("btn-info");
|
$("[name=buildingRadio]").parent().removeClass("btn-info");
|
||||||
$("[name=buildingRadio]").parent().addClass("btn-secondary");
|
$("[name=buildingRadio]").parent().addClass("btn-secondary");
|
||||||
$("[name=buildingRadio]:checked").parent().removeClass("btn-secondary");
|
$("[name=buildingRadio]:checked").parent().removeClass("btn-secondary");
|
||||||
$("[name=buildingRadio]:checked").parent().addClass("btn-info");
|
$("[name=buildingRadio]:checked").parent().addClass("btn-info");
|
||||||
buildingTag = buildingRadios.val(); //building tag
|
buildingTag = buildingRadios.val(); //building tag
|
||||||
pageAct.hisBuiName = buildingRadios.prop('id').split("-")[1];
|
pageAct.hisBuiName = buildingRadios.prop('id').split("-")[1];
|
||||||
initList();
|
initList();
|
||||||
result = true;
|
result = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue
Block a user