diff --git a/SolarPower/Helper/DatabaseHelper.cs b/SolarPower/Helper/DatabaseHelper.cs
index 2e57aa3..b359893 100644
--- a/SolarPower/Helper/DatabaseHelper.cs
+++ b/SolarPower/Helper/DatabaseHelper.cs
@@ -37,7 +37,7 @@ namespace SolarPower.Helper
var passwordStr = ed.DESDecrypt(dbConfig.Password);
//var connStr = $"server={serverStr};database={databaseStr};user={rootStr};password={passwordStr};charset=utf8;";
- var connStr = @"server=127.0.0.1;port=3308;database=solar_power;user=root;password=00000000;charset=utf8;";
+ var connStr = @"server=127.0.0.1;database=solar_power;user=root;password=000000;charset=utf8;";
this._connectionString = connStr;
}
diff --git a/SolarPower/Views/PowerStation/PowerStationAdd.cshtml b/SolarPower/Views/PowerStation/PowerStationAdd.cshtml
deleted file mode 100644
index 7155fc9..0000000
--- a/SolarPower/Views/PowerStation/PowerStationAdd.cshtml
+++ /dev/null
@@ -1,163 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
是否為代管:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@section Scripts{
-
-
-}
\ No newline at end of file
diff --git a/SolarPower/Views/PowerStation/PowerStationEdit.cshtml b/SolarPower/Views/PowerStation/PowerStationEdit.cshtml
index cb2aebc..a5ea878 100644
--- a/SolarPower/Views/PowerStation/PowerStationEdit.cshtml
+++ b/SolarPower/Views/PowerStation/PowerStationEdit.cshtml
@@ -175,92 +175,93 @@
}
}
});
- //#endregion
+ //#endregion
+
//#region 設備列表 DataTable
DeviceTable = $("#Device_table").DataTable({
- "paging": true,
- "lengthChange": false,
- "searching": false,
- "ordering": true,
- "info": true,
- "autoWidth": false,
- "responsive": true,
- "order": [[9, "desc"]],
- "columns": [{
- "data": "uid"
- }, {
- "data": "name"
- }, {
- "data": "typeName"
- }, {
- "data": "brand"
- }, {
- "data": "productModel"
- }, {
- "data": "dbName"
- }, {
- "data": "tableName"
- }, {
- "data": "colName"
- }, {
- "data": "remark"
- },{
- "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/DeviceTable",
- "type": "POST",
- "data": function (d) {
- d.stationId = stationId;
- },
- "dataSrc": function (rel) {
- if (rel.data.code == "9999") {
- toast_error(rel.data.msg);
- return;
+ "paging": true,
+ "lengthChange": false,
+ "searching": false,
+ "ordering": true,
+ "info": true,
+ "autoWidth": false,
+ "responsive": true,
+ "order": [[9, "desc"]],
+ "columns": [{
+ "data": "uid"
+ }, {
+ "data": "name"
+ }, {
+ "data": "typeName"
+ }, {
+ "data": "brand"
+ }, {
+ "data": "productModel"
+ }, {
+ "data": "dbName"
+ }, {
+ "data": "tableName"
+ }, {
+ "data": "colName"
+ }, {
+ "data": "remark"
+ },{
+ "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/DeviceTable",
+ "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;
+ data = rel.data.data;
- if (data == null || data.length == 0) {
- this.data = [];
+ if (data == null || data.length == 0) {
+ this.data = [];
+ }
+
+ return data;
}
-
- return data;
}
- }
- });
- //#endregion
+ });
+ //#endregion
//#region 異常設定列表 DataTable
ExceptionTable = $("#Exception_table").DataTable({
"paging": true,
@@ -341,7 +342,8 @@
}
}
});
- //#endregion
+ //#endregion
+
//#region 電站資料 view 控制
if (stationId == 'new') {
//#region 電站基本資料
@@ -378,6 +380,7 @@
$("#land_buildingPart").hide();
$("#tablist").hide();
+ $("#tablist").find(".nav-item > a").first().click();
} else {
var url = "/PowerStation/GetOnePowerStation"
@@ -410,6 +413,7 @@
}, 'json');
}
+ //#endregion
//#region 預先載入運維人員下拉式選單select_option
var url_user_select_option = "/PowerStation/GetUserSelectOptionList";
@@ -486,6 +490,8 @@
});
});
//#endregion
+
+ //#region 預先載入設備類型下拉式選單select_option
var url_DeviceType = "/PowerStation/GetDeviceTypeSelectOptionList";
$.get(url_DeviceType, function (rel) {
if (rel.code != "0000") {
@@ -498,11 +504,10 @@
$("#Device_Type_modal").append($("").val(val.value).text(val.text));
});
})
+ //#endregion
});
-
-
//#region 代管切換
$("#check_escrow").click(function () {
if ($(this).prop("checked")) {
@@ -646,7 +651,6 @@
//觀看
//#region 電站基本資料 文字
-
$("#address_detail_text").show();
$("#power_station_code_text").show();
$("#power_station_name_text").show();
@@ -968,7 +972,6 @@
$("#photovoltaic_panel_specification").val(powerStationData.photovoltaicPanelSpecification);
$("#photovoltaic_panel_amount").val(powerStationData.photovoltaicPanelAmount);
//#endregion
-
}
//#endregion
@@ -1022,6 +1025,7 @@
CreateAddLandBuildingCard(landBuildingCard);
}
//#endregion
+
//#region 創建每份土地房屋資訊卡片
function CreateLandBuildingCard(dom, value) {
var appendStr = "";
@@ -1219,238 +1223,9 @@
'';
dom.append(appendStr);
-
-
}
//#endregion
- //#region 新增維運資料
- function AddOperation()
- {
- $("#Operation-modal .modal-title").html("運維廠商資料 - 新增");
- $("#Operation-form").trigger("reset");
- $("#Operation-modal").modal();
- }
- //#endregion
- //#region 儲存運維資料
- function SaveOperation() {
- if ($("#Operation-form").valid()) {
- var url = "/PowerStation/SaveOperation";
- var send_data = {
- Id: selected_id,
- PowerStationId: stationId,
- Type: $("#Operation_role_modal").val(),
- Name: $("#Operation_factory_modal").val(),
- ContactPerson: $("#Operation_name_modal").val(),
- Phone: $("#Operation_phone_modal").val(),
- Email: $("#Operation_email_modal").val(),
- }
-
- $.post(url, send_data, function (rel) {
- if (rel.code != "0000") {
- toast_error(rel.msg);
- return;
- }
- else
- {
- toast_ok(rel.msg);
- $('#Operation-modal').modal('hide');
- OperationTable.ajax.reload();
- return;
- }
-
-
- }, 'json');
- }
- }
- //#endregion
- //#region 取一筆運維
- $('#Operation_table').on("click", "button.edit-btn", function () {
- $("#Operation-modal .modal-title").html("運維廠商資料 - 編輯");
-
- selected_id = $(this).parents('tr').attr('data-id');
-
- //取得單一運維基本資料
- var url = "/PowerStation/GetOneOperation/";
-
- var send_data = {
- id: selected_id
- }
-
-
- $.post(url, send_data, function (rel) {
- if (rel.code != "0000") {
- toast_error(rel.msg);
- return;
- }
-
- $("#Operation_role_modal").val(rel.data.type);
- $("#Operation_factory_modal").val(rel.data.name);
- $("#Operation_name_modal").val(rel.data.contactPerson);
- $("#Operation_phone_modal").val(rel.data.phone);
- $("#Operation_email_modal").val(rel.data.email);
-
- $("#Operation-modal").modal();
- }, 'json');
-
- });
- //#endregion
- //#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 () {
-
- selected_id = $(this).parents('tr').attr('data-id');
-
- var url = "/PowerStation/DeleteOneOperation/";
-
- 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);
- OperationTable.ajax.reload();
- }, 'json');
-
- });
- //#endregion
- //#region 新增裝置資料
- function AddDevice() {
- $("#Device-modal .modal-title").html("裝置資料 - 新增");
- $("#Device-form").trigger("reset");
- $("#Device-modal").modal();
- }
- //#endregion
- //#region 新增異常設定資料
- function AddException() {
- $("#Exception-modal .modal-title").html("異常設定資料 - 新增");
- $("#Exception-form").trigger("reset");
- $("#Exception-modal").modal();
- }
- //#endregion
- //#region 儲存裝置資料
- function SaveDevice() {
-
- if ($("#Device-form").valid()) {
- var url = "/PowerStation/SaveDevice";
- var send_data = {
- Id: selected_id,
- PowerStationId: stationId,
- Name: $("#Device_Name_modal").val(),
- Type: $("#Device_Type_modal").val(),
- TypeName: $("#Device_Type_modal :selected").text(),
- Brand: $("#Device_Brand_modal").val(),
- ProductModel: $("#Device_ProductModel_modal").val(),
- DBName: $("#Device_DBName_modal").val(),
- TableName: $("#Device_TableName_modal").val(),
- ColName: $("#Device_ColName_modal").val(),
- Remark: $("#Device_Remark_modal").val()
-
- }
- $.post(url, send_data, function (rel) {
- if (rel.code != "0000") {
- toast_error(rel.msg);
- return;
- }
- else {
- toast_ok(rel.msg);
- $('#Device-modal').modal('hide');
- DeviceTable.ajax.reload();
- return;
- }
-
-
- }, 'json');
- }
- }
- //#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 土地與房屋按鈕控制
//儲存
$('#land_buildingPart').on("click", "button.save-land-building-info-btn", function () {
@@ -1521,6 +1296,152 @@
$("#add-land-building-card button#cancel-add-land-building-info-btn").hide();
});
//#endregion
+
+ //#region 新增維運資料
+ function AddOperation()
+ {
+ selected_id = 0;
+
+ $("#Operation-modal .modal-title").html("運維廠商資料 - 新增");
+ $("#Operation-form").trigger("reset");
+ $("#Operation-modal").modal();
+ }
+ //#endregion
+
+ //#region 儲存運維資料
+ function SaveOperation() {
+ if ($("#Operation-form").valid()) {
+ var url = "/PowerStation/SaveOperation";
+ var send_data = {
+ Id: selected_id,
+ PowerStationId: stationId,
+ Type: $("#Operation_role_modal").val(),
+ Name: $("#Operation_factory_modal").val(),
+ ContactPerson: $("#Operation_name_modal").val(),
+ Phone: $("#Operation_phone_modal").val(),
+ Email: $("#Operation_email_modal").val(),
+ }
+
+ $.post(url, send_data, function (rel) {
+ if (rel.code != "0000") {
+ toast_error(rel.msg);
+ return;
+ }
+ else
+ {
+ toast_ok(rel.msg);
+ $('#Operation-modal').modal('hide');
+ OperationTable.ajax.reload();
+ return;
+ }
+
+ }, 'json');
+ }
+ }
+ //#endregion
+
+ //#region 取一筆運維
+ $('#Operation_table').on("click", "button.edit-btn", function () {
+ $("#Operation-modal .modal-title").html("運維廠商資料 - 編輯");
+
+ selected_id = $(this).parents('tr').attr('data-id');
+
+ //取得單一運維基本資料
+ var url = "/PowerStation/GetOneOperation/";
+
+ var send_data = {
+ id: selected_id
+ }
+
+
+ $.post(url, send_data, function (rel) {
+ if (rel.code != "0000") {
+ toast_error(rel.msg);
+ return;
+ }
+
+ $("#Operation_role_modal").val(rel.data.type);
+ $("#Operation_factory_modal").val(rel.data.name);
+ $("#Operation_name_modal").val(rel.data.contactPerson);
+ $("#Operation_phone_modal").val(rel.data.phone);
+ $("#Operation_email_modal").val(rel.data.email);
+
+ $("#Operation-modal").modal();
+ }, 'json');
+
+ });
+ //#endregion
+
+ //#region 刪除運維資料
+ $('#Operation_table').on("click", "button.del-btn", function () {
+
+ selected_id = $(this).parents('tr').attr('data-id');
+
+ var url = "/PowerStation/DeleteOneOperation/";
+
+ 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);
+ OperationTable.ajax.reload();
+ }, 'json');
+
+ });
+ //#endregion
+
+ //#region 新增裝置資料
+ function AddDevice() {
+ selected_id = 0;
+ $("#Device-modal .modal-title").html("裝置資料 - 新增");
+ $("#Device-form").trigger("reset");
+ $("#Device-modal").modal();
+ }
+ //#endregion
+
+ //#region 儲存裝置資料
+ function SaveDevice() {
+
+ if ($("#Device-form").valid()) {
+ var url = "/PowerStation/SaveDevice";
+ var send_data = {
+ Id: selected_id,
+ PowerStationId: stationId,
+ Name: $("#Device_Name_modal").val(),
+ Type: $("#Device_Type_modal").val(),
+ TypeName: $("#Device_Type_modal :selected").text(),
+ Brand: $("#Device_Brand_modal").val(),
+ ProductModel: $("#Device_ProductModel_modal").val(),
+ DBName: $("#Device_DBName_modal").val(),
+ TableName: $("#Device_TableName_modal").val(),
+ ColName: $("#Device_ColName_modal").val(),
+ Remark: $("#Device_Remark_modal").val()
+
+ }
+ $.post(url, send_data, function (rel) {
+ if (rel.code != "0000") {
+ toast_error(rel.msg);
+ return;
+ }
+ else {
+ toast_ok(rel.msg);
+ $('#Device-modal').modal('hide');
+ DeviceTable.ajax.reload();
+ return;
+ }
+
+
+ }, 'json');
+ }
+ }
+ //#endregion
+
//#region 取一筆設備
$('#Device_table').on("click", "button.edit-btn", function () {
$("#Device-modal .modal-title").html("設備資料 - 編輯");
@@ -1555,7 +1476,101 @@
});
//#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 新增異常設定資料
+ function AddException() {
+ selected_id = 0;
+ $("#Exception-modal .modal-title").html("異常設定資料 - 新增");
+ $("#Exception-form").trigger("reset");
+ $("#Exception-modal").modal();
+ }
+ //#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 刪除異常
$('#Exception_table').on("click", "button.del-btn", function () {
selected_id = $(this).parents('tr').attr('data-id');