-
*@
@@ -265,7 +265,7 @@
"data": "createdAt"
}, {
"data": null,
- "defaultContent": ' '
+ "defaultContent": ' '
}],
"columnDefs": [{
'targets': 2,
@@ -435,7 +435,6 @@
$('#SensorType_table').on("click", "button.detail-btn", function () {
$("#SensorDetail-modal .modal-title").html("裝置細項 - 新增");
$("#SensorDetail-form").trigger("reset");
- document.getElementById('SensorDetail_SensorType_modal').disabled = true;
selected_id = 0;
selected_type_id = $(this).parents('tr').attr('data-id');
@@ -460,9 +459,6 @@
return;
}
- //$("#SensorDetail_SensorType_modal").val(selected_type_id);
- $("#SensorDetail_SensorType_modal").val(rel.data.sensorName);
-
$("#SensorDetail-modal").modal();
hideLoading();
}, 'json');
@@ -608,5 +604,48 @@
});
});
+
+ //#region 編輯裝置
+ $('#SensorType_table').on("click", "button.detailEdit-btn", function () {
+ $("#SensorDetail-modal .modal-title").html("細項資料 - 修改");
+ //document.getElementById('SensorDetail_SensorType_modal').display = none;
+ //document.getElementById('SensorDetail_SensorType_modal').disabled = true;
+ selected_id = $(this).parents('tr').attr('data-id');
+
+ //取得單一裝置
+ showLoading();
+ var url = "/SensorType/GetOneSensorTypeDetail/";
+
+ var send_data = {
+ id: selected_id
+ }
+
+ $.post(url, send_data, function (rel) {
+ if (rel.code == "9999") {
+ hideLoading();
+ toast_error(rel.msg);
+ return;
+ }
+ else if (rel.code == "9998") {
+ hideLoading();
+ toast_error(rel.msg);
+ return;
+ }
+
+ $("#SensorDetail_ItemName_modal").val(rel.data.itemName);
+ $("#SensorDetail_ItemEName_modal").val(rel.data.itemEName);
+ $("#SensorDetail_WarningURL_modal").val(rel.data.warningURL);
+ $("#SensorDetail_HourType_modal").val(rel.data.hourType);
+ $("#SensorDetail_DayType_modal").val(rel.data.dayType);
+ $("#SensorDetail_MonthType_modal").val(rel.data.monthType);
+ $("#SensorDetail_UpperValue_modal").val(rel.data.upperValue);
+ $("#SensorDetail_LowerValue_modal").val(rel.data.lowerValue);
+
+ $("#SensorDetail-modal").modal();
+ hideLoading();
+ }, 'json');
+
+ });
+ //#endregion
}
\ No newline at end of file