This commit is contained in:
b110212000 2021-06-18 03:20:22 +08:00
parent 8036c92564
commit b757669d14
8 changed files with 699 additions and 64 deletions

View File

@ -843,7 +843,8 @@ namespace SolarPower.Controllers
TableName = Device.TableName, TableName = Device.TableName,
Type = Device.Type, Type = Device.Type,
UID = Device.PowerStationId + "-" + Device.Type, UID = Device.PowerStationId + "-" + Device.Type,
CreatedBy = myUser.Id CreatedBy = myUser.Id,
TypeName = Device.TypeName
}; };
List<string> properties = new List<string>() List<string> properties = new List<string>()
{ {
@ -858,7 +859,8 @@ namespace SolarPower.Controllers
"TableName", "TableName",
"Type", "Type",
"UID", "UID",
"CreatedBy" "CreatedBy",
"TypeName"
}; };
await powerStationRepository.AddDevice(DeviceInfo,properties); await powerStationRepository.AddDevice(DeviceInfo,properties);
@ -880,7 +882,8 @@ namespace SolarPower.Controllers
TableName = Device.TableName, TableName = Device.TableName,
Type = Device.Type, Type = Device.Type,
UID = Device.PowerStationId + "-" + Device.Type, UID = Device.PowerStationId + "-" + Device.Type,
CreatedBy = myUser.Id CreatedBy = myUser.Id,
TypeName = Device.TypeName
}; };
List<string> properties = new List<string>() List<string> properties = new List<string>()
{ {
@ -895,7 +898,8 @@ namespace SolarPower.Controllers
"TableName", "TableName",
"Type", "Type",
"UID", "UID",
"CreatedBy" "CreatedBy",
"TypeName"
}; };
await powerStationRepository.UpdateDevice(DeviceInfo, properties); await powerStationRepository.UpdateDevice(DeviceInfo, properties);
apiResult.Code = "0000"; apiResult.Code = "0000";
@ -910,7 +914,11 @@ namespace SolarPower.Controllers
} }
return apiResult; return apiResult;
} }
/// <summary>
/// 設備DataTable
/// </summary>
/// <param name="stationId"></param>
/// <returns></returns>
public async Task<ActionResult> DeviceTable(int stationId) public async Task<ActionResult> DeviceTable(int stationId)
{ {
List<DeviceTable> deviceTables = new List<DeviceTable>(); List<DeviceTable> deviceTables = new List<DeviceTable>();
@ -976,6 +984,218 @@ namespace SolarPower.Controllers
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
} }
return apiResult;
}
/// <summary>
/// 取單一設備資料
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<ApiResult<DeviceInfo>> GetOneDevice(int id)
{
DeviceInfo Device = new DeviceInfo();
ApiResult<DeviceInfo> apiResult = new ApiResult<DeviceInfo>();
try
{
apiResult.Code = "0000";
Device = await powerStationRepository.OneDeviceInfo(id);
apiResult.Data = Device;
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = exception.ToString();
}
return apiResult;
}
/// <summary>
/// 刪除設備
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<ApiResult<string>> DeleteOneDevice(int id)
{
ApiResult<string> apiResult = new ApiResult<string>();
DeviceInfo Device = new DeviceInfo();
try
{
Device = await powerStationRepository.OneDeviceInfo(id);
if (Device == null)
{
apiResult.Code = "9996";
apiResult.Msg = errorCode.GetString(apiResult.Code);
return apiResult;
}
await powerStationRepository.DeleteOneOtherTable(Device.Id, "device");
apiResult.Code = "0000";
apiResult.Msg = "刪除成功";
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = errorCode.GetString(apiResult.Code);
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Id=" + id);
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
return apiResult;
}
public async Task<ApiResult<string>> SaveException(ExceptionModal exceptionModal)
{
ApiResult<string> apiResult = new ApiResult<string>();
try
{
if (exceptionModal.Id == 0)
{
ExceptionModal Exception = new ExceptionModal()
{
Alarm = exceptionModal.Alarm,
CreatedBy = myUser.Id,
PowerStationId = exceptionModal.PowerStationId,
Id = exceptionModal.Id,
LowerLimit = exceptionModal.LowerLimit,
Type = exceptionModal.Type,
UpperLimit = exceptionModal.UpperLimit
};
List<string> properties = new List<string>()
{
"Alarm",
"CreatedBy",
"PowerStationId",
"Id",
"LowerLimit",
"Type",
"UpperLimit",
};
await powerStationRepository.AddException(Exception, properties);
apiResult.Code = "0000";
apiResult.Msg = "新增成功";
}
else
{
ExceptionModal Exception = new ExceptionModal()
{
Alarm = exceptionModal.Alarm,
CreatedBy = myUser.Id,
PowerStationId = exceptionModal.PowerStationId,
Id = exceptionModal.Id,
LowerLimit = exceptionModal.LowerLimit,
Type = exceptionModal.Type,
UpperLimit = exceptionModal.UpperLimit
};
List<string> properties = new List<string>()
{
"Alarm",
"CreatedBy",
"PowerStationId",
"Id",
"LowerLimit",
"Type",
"UpperLimit",
};
await powerStationRepository.UpdateException(Exception, properties);
apiResult.Code = "0000";
apiResult.Msg = "儲存成功";
}
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = exception.ToString();
}
return apiResult;
}
public async Task<ActionResult> ExceptionTable(int stationId)
{
List<ExceptionTable> exceptionTable = new List<ExceptionTable>();
ApiResult<List<ExceptionTable>> apiResult = new ApiResult<List<ExceptionTable>>();
try
{
apiResult.Code = "0000";
exceptionTable = await powerStationRepository.ExceptionTable(stationId);
foreach (ExceptionTable a in exceptionTable)
{
a.Function = @"
<button type='button' class='btn btn-primary btn-pills waves-effect waves-themed edit-btn'></button>
<button type='button' class='btn btn-danger btn-pills waves-effect waves-themed del-btn'></button>";
if(a.Type == 1)
{
a.TypeName = "PR值";
}
if (a.Alarm == 1)
{
a.AlarmName = "email通知";
}
}
apiResult.Data = exceptionTable;
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = exception.ToString();
}
var result = Json(new
{
data = apiResult
});
return result;
}
public async Task<ApiResult<ExceptionModal>> GetOneException(int id)
{
ExceptionModal Exception = new ExceptionModal();
ApiResult<ExceptionModal> apiResult = new ApiResult<ExceptionModal>();
try
{
apiResult.Code = "0000";
Exception = await powerStationRepository.OneException(id);
apiResult.Data = Exception;
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = exception.ToString();
}
return apiResult;
}
public async Task<ApiResult<string>> DeleteOneException(int id)
{
ApiResult<string> apiResult = new ApiResult<string>();
ExceptionModal Exception = new ExceptionModal();
try
{
Exception = await powerStationRepository.OneException(id);
if (Exception == null)
{
apiResult.Code = "9996";
apiResult.Msg = errorCode.GetString(apiResult.Code);
return apiResult;
}
await powerStationRepository.DeleteOneOtherTable(Exception.Id, "power_station_exception");
apiResult.Code = "0000";
apiResult.Msg = "刪除成功";
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = errorCode.GetString(apiResult.Code);
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Id=" + id);
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
return apiResult; return apiResult;
} }
} }

View File

@ -37,7 +37,7 @@ namespace SolarPower.Helper
var passwordStr = ed.DESDecrypt(dbConfig.Password); var passwordStr = ed.DESDecrypt(dbConfig.Password);
//var connStr = $"server={serverStr};database={databaseStr};user={rootStr};password={passwordStr};charset=utf8;"; //var connStr = $"server={serverStr};database={databaseStr};user={rootStr};password={passwordStr};charset=utf8;";
var connStr = @"server=127.0.0.1;database=solar_power;user=root;password=000000;charset=utf8;"; var connStr = @"server=127.0.0.1;port=3308;database=solar_power;user=root;password=00000000;charset=utf8;";
this._connectionString = connStr; this._connectionString = connStr;
} }

View File

@ -321,6 +321,7 @@ namespace SolarPower.Models.PowerStation
public string TableName { get; set; } public string TableName { get; set; }
public string ColName { get; set; } public string ColName { get; set; }
public string Remark { get; set; } public string Remark { get; set; }
public string TypeName { get; set; }//類型名稱
} }
public class Device : DeviceInfo public class Device : DeviceInfo
{ {
@ -332,4 +333,22 @@ namespace SolarPower.Models.PowerStation
public string UID { get; set; }//設備編號 public string UID { get; set; }//設備編號
public string Function { get; set; }//功能 public string Function { get; set; }//功能
} }
public class ExceptionModal : Created
{
public int Id { get; set; }
public int PowerStationId { get; set; }
public byte Type { get; set; }
public decimal UpperLimit { get; set; }
public decimal LowerLimit { get; set; }
public byte Alarm { get; set; }
}
public class ExceptionTable : ExceptionModal
{
public string PowerStationName { get; set; }
public string PowerStationCode { get; set; }
public string Function { get; set; }//功能
public string TypeName { get; set; }
public string AlarmName { get; set; }
}
} }

View File

@ -641,5 +641,122 @@ namespace SolarPower.Repository.Implement
return Device; return Device;
} }
public async Task<DeviceInfo> OneDeviceInfo(int id)
{
using (IDbConnection conn = _databaseHelper.GetConnection())
{
DeviceInfo Device;
conn.Open();
try
{
string sql = @$"SELECT * FROM device WHERE Id = @Id";
Device = await conn.QueryFirstOrDefaultAsync<DeviceInfo>(sql, new { Id = id });
}
catch (Exception exception)
{
throw exception;
}
finally
{
conn.Close();
}
return Device;
}
}
public async Task AddException(ExceptionModal Exception, List<string> properties)
{
using IDbConnection conn = _databaseHelper.GetConnection();
conn.Open();
try
{
string sql = GenerateInsertQueryWithCustomTable(properties, "power_station_exception");
await conn.ExecuteAsync(sql, Exception);
}
catch (Exception exception)
{
throw exception;
}
finally
{
conn.Close();
}
}
/// <summary>
/// 異常dataTable
/// </summary>
/// <param name="stationId"></param>
/// <returns></returns>
public async Task<List<ExceptionTable>> ExceptionTable(int stationId)
{
using IDbConnection conn = _databaseHelper.GetConnection();
conn.Open();
List<ExceptionTable> Exception = new List<ExceptionTable>();
try
{
string sql = @$"SELECT pe.Type,pe.UpperLimit,pe.LowerLimit,pe.Alarm,ps.Code AS PowerStationCode ,ps.Name AS PowerStationName,pe.CreatedAt,pe.Id
FROM power_station_exception pe
LEFT JOIN power_station ps ON pe.PowerStationId = ps.Id
WHERE pe.Deleted = 0 AND pe.PowerStationId = @StationId";
Exception = (await conn.QueryAsync<ExceptionTable>(sql, new { StationId = stationId })).ToList();
}
catch (Exception exception)
{
throw exception;
}
finally
{
conn.Close();
}
return Exception;
}
public async Task<ExceptionModal> OneException(int id)
{
using (IDbConnection conn = _databaseHelper.GetConnection())
{
ExceptionModal Exception;
conn.Open();
try
{
string sql = @$"SELECT * FROM power_station_exception WHERE Id = @Id";
Exception = await conn.QueryFirstOrDefaultAsync<ExceptionModal>(sql, new { Id = id });
}
catch (Exception exception)
{
throw exception;
}
finally
{
conn.Close();
}
return Exception;
}
}
public async Task UpdateException(ExceptionModal Exception, List<string> properties)
{
using IDbConnection conn = _databaseHelper.GetConnection();
conn.Open();
var trans = conn.BeginTransaction();
try
{
var updateQuery = GenerateUpdateQueryWithCustomTable(properties, "power_station_exception");
await conn.ExecuteAsync(updateQuery.ToString(), Exception, trans);
trans.Commit();
}
catch (Exception exception)
{
trans.Rollback();
throw exception;
}
finally
{
conn.Close();
}
}
} }
} }

View File

@ -131,5 +131,29 @@ namespace SolarPower.Repository.Interface
/// <param name="stationId"></param> /// <param name="stationId"></param>
/// <returns></returns> /// <returns></returns>
Task<List<DeviceTable>> DeviceTable(int stationId); Task<List<DeviceTable>> DeviceTable(int stationId);
/// <summary>
/// 異常datatable
/// </summary>
/// <param name="stationId"></param>
/// <returns></returns>
Task<List<ExceptionTable>> ExceptionTable(int stationId);
/// <summary>
/// 取單一筆DeviceInfo
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<DeviceInfo> OneDeviceInfo(int id);
/// <summary>
/// 新增 異常設定
/// </summary>
/// <param name="Exception"></param>
/// <param name="properties"></param>
/// <returns></returns>
Task AddException(ExceptionModal Exception, List<string> properties);
Task<ExceptionModal> OneException(int id);
Task UpdateException(ExceptionModal Exception, List<string> properties);
} }
} }

View File

@ -52,7 +52,7 @@
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link fs-lg px-4 disabled" data-toggle="tab" href="#tab-005" role="tab"> <a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-exception" role="tab">
<i class="fal fa-home text-success"></i> <span class="hidden-sm-down ml-1">異常設定</span> <i class="fal fa-home text-success"></i> <span class="hidden-sm-down ml-1">異常設定</span>
</a> </a>
</li> </li>
@ -74,10 +74,8 @@
@Html.Partial("_UploadImage") @Html.Partial("_UploadImage")
</div> </div>
<div class="tab-pane fade" id="tab-005" role="tabpanel" aria-labelledby="tab-005"> <div class="tab-pane fade" id="tab-exception" role="tabpanel" aria-labelledby="tab-exception">
<div class="row mb-5"> @Html.Partial("_Exception")
此處放異常設定數據
</div>
</div> </div>
</div> </div>
</div> </div>
@ -178,7 +176,7 @@
} }
}); });
//#endregion //#endregion
//#region 運維列表 DataTable //#region 設備列表 DataTable
DeviceTable = $("#Device_table").DataTable({ DeviceTable = $("#Device_table").DataTable({
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
@ -189,17 +187,17 @@
"responsive": true, "responsive": true,
"order": [[9, "desc"]], "order": [[9, "desc"]],
"columns": [{ "columns": [{
"data": "uID" "data": "uid"
}, { }, {
"data": "name" "data": "name"
}, { }, {
"data": "type" "data": "typeName"
}, { }, {
"data": "brand" "data": "brand"
}, { }, {
"data": "productModel" "data": "productModel"
}, { }, {
"data": "dBName" "data": "dbName"
}, { }, {
"data": "tableName" "data": "tableName"
}, { }, {
@ -263,6 +261,87 @@
} }
}); });
//#endregion //#endregion
//#region 異常設定列表 DataTable
ExceptionTable = $("#Exception_table").DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
"order": [[7, "desc"]],
"columns": [{
"data": "powerStationCode"
}, {
"data": "powerStationName"
}, {
"data": "typeName"
}, {
"data": "upperLimit"
}, {
"data": "lowerLimit"
}, {
"data": "alarmName"
}, {
"data": "createdAt"
}, {
"data": "function"
}],
"columnDefs": [{
'targets': 1,
'searchable': false,
'orderable': false,
'className': 'dt-body-center'
}],
"language": {
"emptyTable": "無資料...",
"processing": "處理中...",
"loadingRecords": "載入中...",
"lengthMenu": "顯示 _MENU_ 項結果",
"zeroRecords": "沒有符合的結果",
"info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項",
"infoEmpty": "顯示第 0 至 0 項結果,共 0 項",
"infoFiltered": "(從 _MAX_ 項結果中過濾)",
"infoPostFix": "",
"search": "搜尋:",
"paginate": {
"first": "第一頁",
"previous": "上一頁",
"next": "下一頁",
"last": "最後一頁"
},
"aria": {
"sortAscending": ": 升冪排列",
"sortDescending": ": 降冪排列"
}
},
'createdRow': function (row, data, dataIndex) {
$(row).attr('data-id', data.id);
},
"ajax": {
"url": "/PowerStation/ExceptionTable",
"type": "POST",
"data": function (d) {
d.stationId = stationId;
},
"dataSrc": function (rel) {
if (rel.data.code == "9999") {
toast_error(rel.data.msg);
return;
}
data = rel.data.data;
if (data == null || data.length == 0) {
this.data = [];
}
return data;
}
}
});
//#endregion
//#region 電站資料 view 控制 //#region 電站資料 view 控制
if (stationId == 'new') { if (stationId == 'new') {
//#region 電站基本資料 //#region 電站基本資料
@ -942,7 +1021,7 @@
//加入新增土地房屋卡片 //加入新增土地房屋卡片
CreateAddLandBuildingCard(landBuildingCard); CreateAddLandBuildingCard(landBuildingCard);
} }
//#endregion
//#region 創建每份土地房屋資訊卡片 //#region 創建每份土地房屋資訊卡片
function CreateLandBuildingCard(dom, value) { function CreateLandBuildingCard(dom, value) {
var appendStr = ""; var appendStr = "";
@ -1143,7 +1222,7 @@
} }
//#endregion
//#region 新增維運資料 //#region 新增維運資料
function AddOperation() function AddOperation()
{ {
@ -1217,6 +1296,29 @@
}); });
//#endregion //#endregion
//#region 刪除運維 //#region 刪除運維
$('#Device_table').on("click", "button.del-btn", function () {
selected_id = $(this).parents('tr').attr('data-id');
var url = "/PowerStation/DeleteOneDevice/";
var send_data = {
Id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code == "9999") {
toast_error(rel.msg);
return;
}
toast_ok(rel.msg);
DeviceTable.ajax.reload();
}, 'json');
});
//#endregion
//#region 刪除設備
$('#Operation_table').on("click", "button.del-btn", function () { $('#Operation_table').on("click", "button.del-btn", function () {
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
@ -1246,7 +1348,13 @@
$("#Device-modal").modal(); $("#Device-modal").modal();
} }
//#endregion //#endregion
//#region 新增異常設定資料
function AddException() {
$("#Exception-modal .modal-title").html("異常設定資料 - 新增");
$("#Exception-form").trigger("reset");
$("#Exception-modal").modal();
}
//#endregion
//#region 儲存裝置資料 //#region 儲存裝置資料
function SaveDevice() { function SaveDevice() {
@ -1257,12 +1365,14 @@
PowerStationId: stationId, PowerStationId: stationId,
Name: $("#Device_Name_modal").val(), Name: $("#Device_Name_modal").val(),
Type: $("#Device_Type_modal").val(), Type: $("#Device_Type_modal").val(),
TypeName: $("#Device_Type_modal :selected").text(),
Brand: $("#Device_Brand_modal").val(), Brand: $("#Device_Brand_modal").val(),
ProductModel: $("#Device_ProductModel_modal").val(), ProductModel: $("#Device_ProductModel_modal").val(),
DBName: $("#Device_DBName_modal").val(), DBName: $("#Device_DBName_modal").val(),
TableName: $("#Device_TableName_modal").val(), TableName: $("#Device_TableName_modal").val(),
ColName: $("#Device_ColName_modal").val(), ColName: $("#Device_ColName_modal").val(),
Remark: $("#Device_Remark_modal").val(), Remark: $("#Device_Remark_modal").val()
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
@ -1272,6 +1382,7 @@
else { else {
toast_ok(rel.msg); toast_ok(rel.msg);
$('#Device-modal').modal('hide'); $('#Device-modal').modal('hide');
DeviceTable.ajax.reload();
return; return;
} }
@ -1280,9 +1391,66 @@
} }
} }
//#endregion //#endregion
//#region 儲存異常設定資料
function SaveException() {
if ($("#Exception-form").valid()) {
var url = "/PowerStation/SaveException";
var send_data = {
Id: selected_id,
PowerStationId: stationId,
Type: $("#Exception_Type_modal").val(),
UpperLimit: $("#Exception_UpperLimit_modal").val(),
LowerLimit: $("#Exception_LowerLimit_modal").val(),
Alarm: $("#Exception_Alarm_modal").val()
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
else {
toast_ok(rel.msg);
$('#Exception-modal').modal('hide');
ExceptionTable.ajax.reload();
return;
}
}, 'json');
}
}
//#endregion
//#region 取一筆異常設定
$('#Exception_table').on("click", "button.edit-btn", function () {
$("#Exception-modal .modal-title").html("異常設定資料 - 編輯");
selected_id = $(this).parents('tr').attr('data-id');
//取得單一異常設定資料
var url = "/PowerStation/GetOneException/";
var send_data = {
id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$("#Exception_Type_modal").val(rel.data.type);
$("#Exception_Alarm_modal").val(rel.data.alarm);
$("#Exception_UpperLimit_modal").val(rel.data.upperLimit);
$("#Exception_LowerLimit_modal").val(rel.data.lowerLimit);
$("#Exception-modal").modal();
}, 'json');
});
//#endregion
//#region 土地與房屋按鈕控制 //#region 土地與房屋按鈕控制
//儲存 //儲存
$('#land_buildingPart').on("click", "button.save-land-building-info-btn", function () { $('#land_buildingPart').on("click", "button.save-land-building-info-btn", function () {
@ -1353,5 +1521,62 @@
$("#add-land-building-card button#cancel-add-land-building-info-btn").hide(); $("#add-land-building-card button#cancel-add-land-building-info-btn").hide();
}); });
//#endregion //#endregion
//#region 取一筆設備
$('#Device_table').on("click", "button.edit-btn", function () {
$("#Device-modal .modal-title").html("設備資料 - 編輯");
selected_id = $(this).parents('tr').attr('data-id');
//取得單一運維基本資料
var url = "/PowerStation/GetOneDevice/";
var send_data = {
id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$("#Device_Name_modal").val(rel.data.name);
$("#Device_Type_modal").val(rel.data.type);
$("#Device_Brand_modal").val(rel.data.brand);
$("#Device_ProductModel_modal").val(rel.data.productModel);
$("#Device_DBName_modal").val(rel.data.dbName);
$("#Device_TableName_modal").val(rel.data.tableName);
$("#Device_ColName_modal").val(rel.data.colName);
$("#Device_Remark_modal").val(rel.data.remark);
$("#Device-modal").modal();
}, 'json');
});
//#endregion
//#region 刪除運維
$('#Exception_table').on("click", "button.del-btn", function () {
selected_id = $(this).parents('tr').attr('data-id');
var url = "/PowerStation/DeleteOneException/";
var send_data = {
Id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code == "9999") {
toast_error(rel.msg);
return;
}
toast_ok(rel.msg);
ExceptionTable.ajax.reload();
}, 'json');
});
//#endregion
</script> </script>
} }

View File

@ -22,49 +22,6 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">PEP-NTP001-PYR-01</th>
<td>日照計01</td>
<td>日照計</td>
<td>ADTEK</td>
<td>CS1</td>
<td></td>
<td>CS1</td>
<td></td>
<td></td>
<td>
<button type="button" class="btn btn-primary btn-pills waves-effect waves-themed">修改</button>
</td>
</tr>
<tr>
<th scope="row">PEP-NTP001-THR-01</th>
<td>溫度計03</td>
<td>溫度計</td>
<td>ADTEK</td>
<td>CS1</td>
<td></td>
<td>CS1</td>
<td></td>
<td></td>
<td>
<button type="button" class="btn btn-primary btn-pills waves-effect waves-themed">修改</button>
</td>
</tr>
<tr>
<th scope="row">05101300967-PWR</th>
<td>電表01</td>
<td>電表</td>
<td>ADTEK</td>
<td>CS1</td>
<td></td>
<td>CS1</td>
<td></td>
<td></td>
<td>
<button type="button" class="btn btn-primary btn-pills waves-effect waves-themed">修改</button>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -0,0 +1,73 @@
<div class="row mb-5">
<div class="col-6"><h3>異常自動檢查設定</h3></div>
<div class="col-6 text-right">
<a href="javascript:;" class="btn btn-success waves-effect waves-themed mb-3" id="addException-btn" onclick="AddException()">
<span class="fal fa-plus mr-1"></span>新增
</a>
</div>
<div class="w-100">
<table id="Exception_table" class="table table-bordered table-hover m-0 text-center">
<thead class="thead-themed">
<tr>
<th>電站編號</th>
<th>電站名稱</th>
<th>項目</th>
<th>下限 ( <= )</th>
<th>上限 ( >= )</th>
<th>警示方式</th>
<th>建立時間</th>
<th>功能</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="modal fade" id="Exception-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
異常設定資料 - 新增
</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="fal fa-times"></i></span>
</button>
</div>
<div class="modal-body">
<form class="Exception-form" id="Exception-form">
<div class="row">
<div class="form-group col-lg-6">
<label class="form-label" for="Exception_Type_modal"><span class="text-danger">*</span>項目</label>
<select class="form-control" id="Exception_Type_modal">
<option value="1">PR值</option>
</select>
</div>
<div class="form-group col-lg-6">
<label class="form-label" for="Exception_Alarm_modal"><span class="text-danger">*</span>警示方式</label>
<select class="form-control" id="Exception_Alarm_modal">
<option value="1">email通知</option>
</select>
</div>
<div class="form-group col-lg-6">
<label class="form-label" for="Exception_UpperLimit_modal"><span class="text-danger">*</span>上限</label>
<input type="number" id="Exception_UpperLimit_modal" name="Exception_UpperLimit_modal" class="form-control">
</div>
<div class="form-group col-lg-6">
<label class="form-label" for="Exception_LowerLimit_modal"><span class="text-danger">*</span>下限</label>
<input type="number" id="Exception_LowerLimit_modal" name="Exception_LowerLimit_modal" class="form-control">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" onclick="SaveException()">確定</button>
</div>
</div>
</div>
</div>