803 lines
32 KiB
Plaintext
803 lines
32 KiB
Plaintext
@{
|
|
ViewData["MainNum"] = "6";
|
|
ViewData["SubNum"] = "1";
|
|
ViewData["Title"] = "電站資料管理";
|
|
}
|
|
|
|
<ol class="breadcrumb page-breadcrumb">
|
|
<li class="breadcrumb-item"><a href="javascript:void(0);">總覽</a></li>
|
|
<li class="breadcrumb-item">@ViewData["Title"]</li>
|
|
<li class="breadcrumb-item">新竹市</li>
|
|
<li class="breadcrumb-item active">新竹巨城站</li>
|
|
<li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li>
|
|
</ol>
|
|
|
|
<!-- Your main content goes below here: -->
|
|
<div class="row">
|
|
<div class="col-xl-12">
|
|
<div id="panel-5" class="panel">
|
|
<div class="panel-container show">
|
|
<div class="panel-content">
|
|
<div class="subheader">
|
|
<h1 class="subheader-title">
|
|
<span class="icon-stack fa-1x">
|
|
<i class="base-7 icon-stack-3x color-info-500"></i>
|
|
<i class="base-7 icon-stack-2x color-info-700"></i>
|
|
<i class="ni ni-graph icon-stack-1x text-white"></i>
|
|
</span> 新竹巨城站
|
|
</h1>
|
|
</div>
|
|
<ul class="nav nav-tabs mb-5" role="tablist" id="tablist">
|
|
<li class="nav-item">
|
|
<a class="nav-link fs-lg px-4 active" data-toggle="tab" href="#tab-station-info" role="tab">
|
|
<i class="fal fa-home text-success"></i> <span class="hidden-sm-down ml-1">電站資料</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-device-setting" role="tab">
|
|
<i class="fal fa-home text-success"></i> <span class="hidden-sm-down ml-1">裝置列表</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-operation-firm" role="tab">
|
|
<i class="fal fa-home text-success"></i> <span class="hidden-sm-down ml-1">維運廠商</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-upload-image" role="tab">
|
|
<i class="fal fa-home text-success"></i> <span class="hidden-sm-down ml-1">資料上傳</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link fs-lg px-4 disabled" data-toggle="tab" href="#tab-005" role="tab">
|
|
<i class="fal fa-home text-success"></i> <span class="hidden-sm-down ml-1">異常設定</span>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content p-3">
|
|
<div class="tab-pane fade show active" id="tab-station-info" role="tabpanel" aria-labelledby="tab-station-info">
|
|
@Html.Partial("_StationInfo")
|
|
</div>
|
|
|
|
<div class="tab-pane fade" id="tab-device-setting" role="tabpanel" aria-labelledby="tab-device-setting">
|
|
@Html.Partial("_DeviceSetting")
|
|
</div>
|
|
|
|
<div class="tab-pane fade" id="tab-operation-firm" role="tabpanel" aria-labelledby="tab-operation-firm">
|
|
@Html.Partial("_Operation")
|
|
</div>
|
|
|
|
<div class="tab-pane fade" id="tab-upload-image" role="tabpanel" aria-labelledby="tab-upload-image">
|
|
@Html.Partial("_UploadImage")
|
|
</div>
|
|
|
|
<div class="tab-pane fade" id="tab-005" role="tabpanel" aria-labelledby="tab-005">
|
|
<div class="row mb-5">
|
|
此處放異常設定數據
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@section Scripts{
|
|
<script>
|
|
var stationId;
|
|
var selected_id = 0;
|
|
$(function () {
|
|
|
|
var url = new URL(location.href);
|
|
stationId = url.searchParams.get('stationId');
|
|
//#region 運維列表 DataTable
|
|
OperationTable = $("#Operation_table").DataTable({
|
|
"paging": true,
|
|
"lengthChange": false,
|
|
"searching": false,
|
|
"ordering": true,
|
|
"info": true,
|
|
"autoWidth": false,
|
|
"responsive": true,
|
|
"order": [[7, "desc"]],
|
|
"columns": [{
|
|
"data": "typeName"
|
|
}, {
|
|
"data": "name"
|
|
}, {
|
|
"data": "contactPerson"
|
|
}, {
|
|
"data": "phone"
|
|
}, {
|
|
"data": "email"
|
|
}, {
|
|
"data": "createdAt"
|
|
}, {
|
|
"data": "createdName"
|
|
}, {
|
|
"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/OperationTable",
|
|
"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 運維列表 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": "type"
|
|
}, {
|
|
"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;
|
|
|
|
if (data == null || data.length == 0) {
|
|
this.data = [];
|
|
}
|
|
|
|
return data;
|
|
}
|
|
}
|
|
});
|
|
//#endregion
|
|
//#region 電站資料 view 控制
|
|
if (stationId == 'new') {
|
|
//#region 電站基本資料
|
|
$("#power_station_code_text").hide();
|
|
$("#power_station_name_text").hide();
|
|
$("#electricity_meter_at_text").hide();
|
|
$("#estimated_recovery_time_text").hide();
|
|
$("#created_by_text").hide();
|
|
|
|
$("#generating_capacity_text").hide();
|
|
$("#escrow_name_text").hide();
|
|
$("#power_rate_text").hide();
|
|
$("#coordinate_text").hide();
|
|
$("#created_at_text").hide();
|
|
|
|
//逆變器
|
|
$("#inverter_brand_text").hide();
|
|
$("#inverter_product_model_text").hide();
|
|
$("#inverter_amount_text").hide();
|
|
|
|
//光電板
|
|
$("#photovoltaic_panel_brand_text").hide();
|
|
$("#photovoltaic_panel_specification_text").hide();
|
|
$("#photovoltaic_panel_amount_text").hide();
|
|
$("#photovoltaic_panel_product_model_text").hide();
|
|
//#endregion
|
|
|
|
$("#edit-station-info-btn").hide();
|
|
$("#canecl-station-info-btn").hide();
|
|
$("#check_escrow").attr('disabled', false);
|
|
|
|
$("#BoEPart").hide();
|
|
$("#land_buildingPart").hide();
|
|
|
|
$("#tablist").hide();
|
|
} else {
|
|
var url = "/PowerStation/GetOnePowerStation"
|
|
|
|
var send_data = {
|
|
id: stationId
|
|
}
|
|
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
toast_error(rel.msg);
|
|
return;
|
|
}
|
|
|
|
//#region 電站基本資料
|
|
$("#add-station-info-btn").hide()
|
|
$("#canecl-station-info-btn").hide()
|
|
SetStationInfo(rel.data);
|
|
ChangeMode("station_info", "view");
|
|
//#endregion
|
|
|
|
//#region 能源局與台電資料
|
|
$("#add-station-info-btn").hide()
|
|
$("#canecl-station-info-btn").hide()
|
|
SetStationInfo(rel.data);
|
|
ChangeMode("BOE_TPC", "view");
|
|
//#endregion
|
|
|
|
}, 'json');
|
|
}
|
|
|
|
//#region 預先載入公司下拉式選單select_option
|
|
var url_user_select_option = "/PowerStation/GetUserSelectOptionList";
|
|
$.get(url_user_select_option, function (rel) {
|
|
if (rel.code != "0000") {
|
|
toast_error(rel.msg);
|
|
return;
|
|
}
|
|
|
|
$("#power_station_operation_personnel").empty();
|
|
|
|
$.each(rel.data, function (index, val) {
|
|
$("#power_station_operation_personnel").append($("<option />").val(val.value).text(val.text));
|
|
});
|
|
|
|
//預設查詢第一個
|
|
$("#power_station_operation_personnel").val($("#power_station_operation_personnel option:first").val());
|
|
});
|
|
//#endregion
|
|
|
|
|
|
|
|
$('.js-example-basic-multiple').select2();
|
|
|
|
|
|
var url_DeviceType = "/PowerStation/GetDeviceTypeSelectOptionList";
|
|
$.get(url_DeviceType, function (rel) {
|
|
if (rel.code != "0000") {
|
|
toast_error(rel.msg);
|
|
return;
|
|
}
|
|
$("Device_Type_modal").empty();
|
|
|
|
$.each(rel.data, function (index, val) {
|
|
$("#Device_Type_modal").append($("<option />").val(val.value).text(val.text));
|
|
});
|
|
})
|
|
|
|
});
|
|
|
|
//#region 代管切換
|
|
$("#check_escrow").click(function () {
|
|
if ($(this).prop("checked")) {
|
|
$('#check_escrow_label').html("Yes");
|
|
$("#escrow_name").attr('disabled', false)
|
|
} else {
|
|
$('#check_escrow_label').html("No");
|
|
$("#escrow_name").attr('disabled', true)
|
|
}
|
|
});
|
|
//#endregion
|
|
|
|
|
|
|
|
function SaveStationInfo() {
|
|
|
|
var url = "/PowerStation/SavePowerStationInfo";
|
|
|
|
var send_data = {
|
|
Id: stationId,
|
|
CityId: $("#select_city").val(),
|
|
AreaId: $("#select_area").val(),
|
|
AddressDetail: $("#address_detail").val(),
|
|
Name: $("#power_station_name").val(),
|
|
IsEscrow: $("#check_escrow").val() == true ? 1 : 0,
|
|
ElectricityMeterAt: $("electricity_meter_at").val(),
|
|
EstimatedRecoveryTime: $("estimated_recovery_time").val(),
|
|
GeneratingCapacity: $("generating_capacity").val(),
|
|
EscrowName: $("#check_escrow").val() == true? $("escrow_name").val() : "",
|
|
PowerRate: $("#power_rate").val(),
|
|
Coordinate: $("#coordinate").val(),
|
|
InverterBrand: $("#inverter_brand").val(),
|
|
InverterProductModel: $("#inverter_product_model").val(),
|
|
InverterAmount: $("#inverter_amount").val(),
|
|
PhotovoltaicPanelBrand: $("#photovoltaic_panel_brand").val(),
|
|
PhotovoltaicPanelSpecification: $("#photovoltaic_panel_specification").val(),
|
|
PhotovoltaicPanelAmount: $("#photovoltaic_panel_amount").val(),
|
|
PhotovoltaicProductModel: $("#photovoltaic_panel_product_model").val()
|
|
}
|
|
|
|
$.post(url, send_data, function (rel) {
|
|
if (rel.code != "0000") {
|
|
toast_error(rel.msg);
|
|
return;
|
|
}
|
|
|
|
if (stationId == "new") {
|
|
window.location = "/PowerStation/Edit?stationId=" + rel.data
|
|
} else {
|
|
//回填資料
|
|
SetStationInfo(rel.data);
|
|
}
|
|
}, 'json');
|
|
}
|
|
|
|
//#region 切換【電站基本資料】、【能源局與台電】等檢視或修改模式
|
|
function ChangeMode(type, mode) {
|
|
switch (type) {
|
|
case "station_info": //【電站基本資料】
|
|
if (mode === "view") {
|
|
//觀看
|
|
//#region 電站基本資料 文字
|
|
$("#power_station_code_text").show();
|
|
$("#power_station_name_text").show();
|
|
$("#electricity_meter_at_text").show();
|
|
$("#estimated_recovery_time_text").show();
|
|
$("#created_by_text").show();
|
|
|
|
$("#generating_capacity_text").show();
|
|
$("#escrow_name_text").show();
|
|
$("#power_rate_text").show();
|
|
$("#coordinate_text").show();
|
|
$("#created_at_text").show();
|
|
|
|
//逆變器
|
|
$("#inverter_brand_text").show();
|
|
$("#inverter_product_model_text").show();
|
|
$("#inverter_amount_text").show();
|
|
|
|
//光電板
|
|
$("#photovoltaic_panel_brand_text").show();
|
|
$("#photovoltaic_panel_specification_text").show();
|
|
$("#photovoltaic_panel_amount_text").show();
|
|
$("#photovoltaic_panel_product_model_text").show();
|
|
//#endregion
|
|
|
|
//#region 電站基本資料 input
|
|
$("#power_station_name").hide();
|
|
$("#check_escrow").attr("disabled", true);
|
|
$("#electricity_meter_at").hide();
|
|
$("#estimated_recovery_time").hide();
|
|
|
|
$("#generating_capacity").hide();
|
|
$("#escrow_name").hide();
|
|
$("#power_rate").hide();
|
|
$("#coordinate").hide();
|
|
|
|
//逆變器
|
|
$("#inverter_brand").hide();
|
|
$("#inverter_product_model").hide();
|
|
$("#inverter_amount").hide();
|
|
|
|
//光電板
|
|
$("#photovoltaic_panel_brand").hide();
|
|
$("#photovoltaic_panel_specification").hide();
|
|
$("#photovoltaic_panel_amount").hide();
|
|
$("#photovoltaic_panel_product_model").hide();
|
|
//#endregion
|
|
|
|
//電站基本資料btn
|
|
$("#add-station-info-btn").hide();
|
|
$("#edit-station-info-btn").show();
|
|
$("#canecl-station-info-btn").hide();
|
|
} else {
|
|
//修改
|
|
//#region 電站基本資料 文字
|
|
$("#power_station_code_text").hide();
|
|
$("#power_station_name_text").hide();
|
|
$("#electricity_meter_at_text").hide();
|
|
$("#estimated_recovery_time_text").hide();
|
|
$("#created_by_text").hide();
|
|
|
|
$("#generating_capacity_text").hide();
|
|
$("#escrow_name_text").hide();
|
|
$("#power_rate_text").hide();
|
|
$("#coordinate_text").hide();
|
|
$("#created_at_text").hide();
|
|
|
|
//逆變器
|
|
$("#inverter_brand_text").hide();
|
|
$("#inverter_product_model_text").hide();
|
|
$("#inverter_amount_text").hide();
|
|
|
|
//光電板
|
|
$("#photovoltaic_panel_brand_text").hide();
|
|
$("#photovoltaic_panel_specification_text").hide();
|
|
$("#photovoltaic_panel_amount_text").hide();
|
|
$("#photovoltaic_panel_product_model_text").hide();
|
|
//#endregion
|
|
|
|
//#region 電站基本資料 input
|
|
$("#power_station_name").show();
|
|
$("#check_escrow").attr("disabled", false);
|
|
$("#electricity_meter_at").show();
|
|
$("#estimated_recovery_time").show();
|
|
|
|
$("#generating_capacity").show();
|
|
$("#escrow_name").show();
|
|
$("#power_rate").show();
|
|
$("#coordinate").show();
|
|
|
|
//逆變器
|
|
$("#inverter_brand").show();
|
|
$("#inverter_product_model").show();
|
|
$("#inverter_amount").show();
|
|
|
|
//光電板
|
|
$("#photovoltaic_panel_brand").show();
|
|
$("#photovoltaic_panel_specification").show();
|
|
$("#photovoltaic_panel_amount").show();
|
|
$("#photovoltaic_panel_product_model").show();
|
|
//#endregion
|
|
|
|
//電站基本資料btn
|
|
$("#add-station-info-btn").show();
|
|
$("#edit-station-info-btn").hide();
|
|
$("#canecl-station-info-btn").show();
|
|
}
|
|
break;
|
|
case "BOE_TPC": //【能源局與台電】
|
|
if (mode === "view") {
|
|
//觀看
|
|
//#region 能源局與台電資料 文字
|
|
$("#link-boe-file").show();
|
|
$("#BoE_discount_rate_text").show();
|
|
$("#BoE_device_register_number_text").show();
|
|
$("#BoE_discount_rate_text").show();
|
|
|
|
$("#TPC_contract_number_text").show();
|
|
$("#TPC_contract_at_text").show();
|
|
$("#TPC_sell_deadline_text").show();
|
|
$("#TPC_meter_reading_text").show();
|
|
$("#TPC_purchase_electricity_at_text").show();
|
|
$("#TPC_sell_electricity_at_text").show();
|
|
//#endregion
|
|
|
|
//#region 能源局與台電資料 input
|
|
$("#BoE_file").hide();
|
|
$("#BoE_discount_rate").hide();
|
|
$("#BoE_device_register_number").hide();
|
|
$("#BoE_discount_rate").hide();
|
|
|
|
$("#TPC_contract_number").hide();
|
|
$("#TPC_contract_at").hide();
|
|
$("#TPC_sell_deadline").hide();
|
|
$("#TPC_meter_reading").hide();
|
|
$("#TPC_purchase_electricity_at").hide();
|
|
$("#TPC_sell_electricity_at").hide();
|
|
//#endregion
|
|
|
|
//能源局與台電btn
|
|
$("#add-boe-tpc-btn").hide();
|
|
$("#edit-boe-tpc-btn").show();
|
|
$("#canecl-boe-tpc-btn").hide();
|
|
} else {
|
|
//修改
|
|
//#region 能源局與台電資料 文字
|
|
$("#link-boe-file").hide();
|
|
$("#BoE_discount_rate_text").hide();
|
|
$("#BoE_device_register_number_text").hide();
|
|
$("#BoE_discount_rate_text").hide();
|
|
|
|
$("#TPC_contract_number_text").hide();
|
|
$("#TPC_contract_at_text").hide();
|
|
$("#TPC_sell_deadline_text").hide();
|
|
$("#TPC_meter_reading_text").hide();
|
|
$("#TPC_purchase_electricity_at_text").hide();
|
|
$("#TPC_sell_electricity_at_text").hide();
|
|
//#endregion
|
|
|
|
//#region 能源局與台電資料 input
|
|
$("#BoE_file").show();
|
|
$("#BoE_discount_rate").show();
|
|
$("#BoE_device_register_number").show();
|
|
$("#BoE_discount_rate").show();
|
|
|
|
$("#TPC_contract_number").show();
|
|
$("#TPC_contract_at").show();
|
|
$("#TPC_sell_deadline").show();
|
|
$("#TPC_meter_reading").show();
|
|
$("#TPC_purchase_electricity_at").show();
|
|
$("#TPC_sell_electricity_at").show();
|
|
//#endregion
|
|
|
|
//能源局與台電btn
|
|
$("#add-boe-tpc-btn").show();
|
|
$("#edit-boe-tpc-btn").hide();
|
|
$("#canecl-boe-tpc-btn").show();
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
//#endregion
|
|
|
|
//#region 設定電站基本資料
|
|
function SetStationInfo(data) {
|
|
//#region 顯示的部分
|
|
$("#power_station_code_text").html(station);
|
|
$("#power_station_name_text").hide();
|
|
$("#electricity_meter_at_text").hide();
|
|
$("#estimated_recovery_time_text").hide();
|
|
$("#created_by_text").hide();
|
|
|
|
$("#generating_capacity_text").hide();
|
|
$("#escrow_name_text").hide();
|
|
$("#power_rate_text").hide();
|
|
$("#coordinate_text").hide();
|
|
$("#created_at_text").hide();
|
|
|
|
//逆變器
|
|
$("#inverter_brand_text").hide();
|
|
$("#inverter_product_model_text").hide();
|
|
$("#inverter_amount_text").hide();
|
|
|
|
//光電板
|
|
$("#photovoltaic_panel_brand_text").hide();
|
|
$("#photovoltaic_panel_specification_text").hide();
|
|
$("#photovoltaic_panel_amount_text").hide();
|
|
$("#photovoltaic_panel_product_model_text").hide();
|
|
//#endregion
|
|
|
|
}
|
|
//#endregion
|
|
|
|
//#region 設定能源局與台電資料
|
|
function SetBoETPCInfo(data) {
|
|
//#region 顯示的部分
|
|
$("#BoE_file").html(data.boeFileName).attr("href", data.boeFile);
|
|
$("#BoE_discount_rate_text").hide();
|
|
$("#electricity_meter_at_text").hide();
|
|
$("#estimated_recovery_time_text").hide();
|
|
$("#created_by_text").hide();
|
|
|
|
$("#generating_capacity_text").hide();
|
|
$("#escrow_name_text").hide();
|
|
$("#power_rate_text").hide();
|
|
$("#coordinate_text").hide();
|
|
$("#created_at_text").hide();
|
|
|
|
//逆變器
|
|
$("#inverter_brand_text").hide();
|
|
$("#inverter_product_model_text").hide();
|
|
$("#inverter_amount_text").hide();
|
|
|
|
//光電板
|
|
$("#photovoltaic_panel_brand_text").hide();
|
|
$("#photovoltaic_panel_specification_text").hide();
|
|
$("#photovoltaic_panel_amount_text").hide();
|
|
$("#photovoltaic_panel_product_model_text").hide();
|
|
//#endregion
|
|
|
|
}
|
|
//#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 刪除運維
|
|
$('#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 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(),
|
|
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');
|
|
return;
|
|
}
|
|
|
|
|
|
}, 'json');
|
|
}
|
|
}
|
|
//#endregion
|
|
</script>
|
|
} |