客戶端要求-全系統 出現載入顯示

This commit is contained in:
wanling040@gmail.com 2022-07-25 01:35:52 +08:00
parent b5781eb64c
commit 69ebee1e4d
20 changed files with 1071 additions and 133 deletions

View File

@ -4,6 +4,18 @@
ViewData["Title"] = "逆變器交叉分析"; ViewData["Title"] = "逆變器交叉分析";
} }
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap wrapper"> <div class="row flex-nowrap wrapper">
<div class="col-md-2 col-1 pl-0 pr-0 collapse width border-right sidebar vh-100 overflow-auto"> <div class="col-md-2 col-1 pl-0 pr-0 collapse width border-right sidebar vh-100 overflow-auto">
@ -201,6 +213,16 @@
{ key: "RA5", title: "RA5 (%)", default: false } { key: "RA5", title: "RA5 (%)", default: false }
] ]
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
$('#collapse').trigger("click"); $('#collapse').trigger("click");
@ -425,6 +447,7 @@
}); });
function GetPowerStationCollapse(filter) { function GetPowerStationCollapse(filter) {
showLoading();
var url = "/AnalysisInverter/GetInverterCollapse" var url = "/AnalysisInverter/GetInverterCollapse"
var send_data = { var send_data = {
@ -433,6 +456,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -505,7 +529,7 @@
}); });
$("#js_list_accordion .collapse").collapse('show'); $("#js_list_accordion .collapse").collapse('show');
hideLoading();
}, 'json'); }, 'json');
} }
@ -552,7 +576,7 @@
} }
function GetAnalysisInverter() { function GetAnalysisInverter() {
showLoading();
var date; var date;
if (searchType != 1) { if (searchType != 1) {
date = $('#DateGet').val(); date = $('#DateGet').val();
@ -577,6 +601,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
$("#btn-analysis-inverter").html('查詢').attr("disabled", false); $("#btn-analysis-inverter").html('查詢').attr("disabled", false);
return; return;
@ -592,6 +617,7 @@
ReloadHighCharts(); ReloadHighCharts();
$("#btn-analysis-inverter").html('查詢').attr("disabled", false); $("#btn-analysis-inverter").html('查詢').attr("disabled", false);
hideLoading();
}, 'json'); }, 'json');
} }

View File

@ -6,7 +6,17 @@
@using SolarPower.Models.Role @using SolarPower.Models.Role
@model RoleLayerEnum @model RoleLayerEnum
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap wrapper"> <div class="row flex-nowrap wrapper">
@ -223,6 +233,17 @@
var searchType = 0;//搜尋條件(日,日區間,月,年) var searchType = 0;//搜尋條件(日,日區間,月,年)
var datepicker; var datepicker;
var timerange;//選取時間 var timerange;//選取時間
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
$('#collapse').trigger("click"); $('#collapse').trigger("click");
@ -418,10 +439,11 @@
timerange: timerange, timerange: timerange,
seacrhType: searchType seacrhType: searchType
} }
showLoading();
var Nurl = "/AnalysisStationCombine/GetStationsCard"; var Nurl = "/AnalysisStationCombine/GetStationsCard";
$.post(Nurl, send_data, function (rel) { $.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -440,6 +462,7 @@
$('#today_carbon').html(toThousands(rel.data.now_Carbon.toFixed(2))); $('#today_carbon').html(toThousands(rel.data.now_Carbon.toFixed(2)));
$('#today_irradiance').html(toThousands(rel.data.now_irradiance.toFixed(2))); $('#today_irradiance').html(toThousands(rel.data.now_irradiance.toFixed(2)));
chart(); chart();
hideLoading();
}) })
} }
@ -447,6 +470,7 @@
//#region 圖片輪播 //#region 圖片輪播
function photoshow() { function photoshow() {
showLoading();
var url_image = "/PowerStation/GetAllPowerStationsALLImage"; var url_image = "/PowerStation/GetAllPowerStationsALLImage";
var send_data = { var send_data = {
powerStationId: powerids powerStationId: powerids
@ -454,6 +478,7 @@
$.post(url_image, send_data, function (rel) { $.post(url_image, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -467,7 +492,7 @@
carouselExampleIndicators.find(".carousel-indicators > li").first().addClass("active"); carouselExampleIndicators.find(".carousel-indicators > li").first().addClass("active");
carouselExampleIndicators.find(".carousel-inner > .carousel-item").first().addClass("active"); carouselExampleIndicators.find(".carousel-inner > .carousel-item").first().addClass("active");
hideLoading();
}, 'json'); }, 'json');
} }
function CreatePowerStationImagecarousel(dom, value, index) { function CreatePowerStationImagecarousel(dom, value, index) {
@ -624,6 +649,7 @@
function GetPowerStationCollapse(filter) { function GetPowerStationCollapse(filter) {
showLoading();
@*var url = "/StationReport/GetPowerStationNameList"*@ @*var url = "/StationReport/GetPowerStationNameList"*@
var url = "/AnalysisStationCombine/GetPowerStationCollapse" var url = "/AnalysisStationCombine/GetPowerStationCollapse"
@ -633,6 +659,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -692,7 +719,7 @@
} }
}); });
$("#js_list_accordion .collapse").collapse('show'); $("#js_list_accordion .collapse").collapse('show');
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion

View File

@ -4,6 +4,18 @@
ViewData["Title"] = "電站交叉分析"; ViewData["Title"] = "電站交叉分析";
} }
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap wrapper"> <div class="row flex-nowrap wrapper">
<div class="col-md-2 col-1 pl-0 pr-0 collapse width border-right sidebar vh-100 overflow-auto"> <div class="col-md-2 col-1 pl-0 pr-0 collapse width border-right sidebar vh-100 overflow-auto">
@ -157,6 +169,16 @@
//Dictionary<string, string > sensor_type_detail_dictionary { get; set; }; //Dictionary<string, string > sensor_type_detail_dictionary { get; set; };
var sensor_type_detail_dictionary; var sensor_type_detail_dictionary;
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
$('#collapse').trigger("click"); $('#collapse').trigger("click");
@ -457,6 +479,7 @@
}); });
function GetPowerStationCollapse(filter) { function GetPowerStationCollapse(filter) {
showLoading();
var url = "/AnalysisStationInfo/GetDeviceCollapse" var url = "/AnalysisStationInfo/GetDeviceCollapse"
var send_data = { var send_data = {
@ -465,6 +488,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -574,7 +598,7 @@
}); });
$("#js_list_accordion .collapse").collapse('show'); $("#js_list_accordion .collapse").collapse('show');
hideLoading();
}, 'json'); }, 'json');
} }
@ -582,7 +606,7 @@
//在剛開始就在 sensor_type_detail 資料表中 取得ItemName //在剛開始就在 sensor_type_detail 資料表中 取得ItemName
//#region //#region
function GetItemInfo(itemId) { function GetItemInfo(itemId) {
showLoading();
//sensor_type_detail_dictionary = {''} //sensor_type_detail_dictionary = {''}
//my_dict = { 'first_name': 'eddie', 'last_name': 'kao', 'age': 30 } //my_dict = { 'first_name': 'eddie', 'last_name': 'kao', 'age': 30 }
@ -594,16 +618,19 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
else if (rel.code == "9998") { else if (rel.code == "9998") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
var nowCompare_col = [{ key: rel.data.itemEName, title: rel.data.itemName, default: true }]; var nowCompare_col = [{ key: rel.data.itemEName, title: rel.data.itemName, default: true }];
PushSpecifyCurrentCompareCol(nowCompare_col); PushSpecifyCurrentCompareCol(nowCompare_col);
ChangeCompareSelectOption(); ChangeCompareSelectOption();
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion
@ -666,6 +693,7 @@
} }
function GetAnalysisStationInfo() { function GetAnalysisStationInfo() {
showLoading();
var date; var date;
if (searchType != 1) { if (searchType != 1) {
date = $('#DateGet').val(); date = $('#DateGet').val();
@ -690,6 +718,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -706,7 +735,7 @@
ReloadHighCharts() ReloadHighCharts()
$("#btn-analysis-stationinfo").html('查詢').attr("disabled", false); $("#btn-analysis-stationinfo").html('查詢').attr("disabled", false);
hideLoading();
}, 'json'); }, 'json');
} }

View File

@ -18,6 +18,19 @@
</h1> </h1>
</div> </div>
<!-- Your main content goes below here: --> <!-- Your main content goes below here: -->
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="row"> <div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
<div id="panel-5" class="panel"> <div id="panel-5" class="panel">
@ -190,11 +203,23 @@
var companyTable; var companyAuthTable; var companyTable; var companyAuthTable;
var selected_id = 0; var selected_id = 0;
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
//#region 預先載入公司下拉式選單select_option //#region 預先載入公司下拉式選單select_option
showLoading();
var url_company_select_option = "/Company/GetCompanySelectOptionList"; var url_company_select_option = "/Company/GetCompanySelectOptionList";
$.get(url_company_select_option, function (rel) { $.get(url_company_select_option, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -208,6 +233,7 @@
//預設查詢第一個 //預設查詢第一個
$("#company_select").val($("#company_select option:first").val()).trigger('change'); $("#company_select").val($("#company_select option:first").val()).trigger('change');
hideLoading();
}); });
//#endregion //#endregion
@ -439,7 +465,7 @@
$("#company-modal .modal-title").html("公司基本資料 - 編輯"); $("#company-modal .modal-title").html("公司基本資料 - 編輯");
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
showLoading();
//取得單一公司基本資料 //取得單一公司基本資料
var url = "/Company/GetOneCompany/"; var url = "/Company/GetOneCompany/";
@ -449,6 +475,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -460,6 +487,7 @@
$("#company_registerUpperLimit_modal").val(rel.data.registerUpperLimit); $("#company_registerUpperLimit_modal").val(rel.data.registerUpperLimit);
$("#company-modal").modal(); $("#company-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
@ -483,6 +511,7 @@
function SaveComapny() { function SaveComapny() {
if ($("#company-form").valid()) { if ($("#company-form").valid()) {
showLoading();
var url = "/Company/SaveCompany"; var url = "/Company/SaveCompany";
var formData = new FormData(); var formData = new FormData();
@ -507,10 +536,11 @@
processData: false, processData: false,
success: function (rel) { success: function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
hideLoading();
toast_ok(rel.msg); toast_ok(rel.msg);
$('#company-modal').modal('hide'); $('#company-modal').modal('hide');
@ -536,6 +566,7 @@
cancelButtonText: "否" cancelButtonText: "否"
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
showLoading();
//取得單一系統管理員 //取得單一系統管理員
var url = "/Company/DeleteOneCompany/"; var url = "/Company/DeleteOneCompany/";
var send_data = { var send_data = {
@ -543,14 +574,16 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
else if (rel.code == "9998") { else if (rel.code == "9998") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
hideLoading();
toast_ok(rel.msg); toast_ok(rel.msg);
companyTable.ajax.reload(); companyTable.ajax.reload();
}, 'json'); }, 'json');
@ -581,6 +614,7 @@
return $(this).val(); return $(this).val();
}).get(); }).get();
showLoading();
var url = "/Company/SaveCompanyAuth"; var url = "/Company/SaveCompanyAuth";
var send_data = { var send_data = {
@ -590,6 +624,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -598,6 +633,7 @@
$("#company-auth-modal").modal('hide'); $("#company-auth-modal").modal('hide');
companyAuthTable.ajax.reload(); companyAuthTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion

View File

@ -6,6 +6,18 @@
@using SolarPower.Models.Role @using SolarPower.Models.Role
@model RoleLayerEnum @model RoleLayerEnum
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap wrapper"> <div class="row flex-nowrap wrapper">
<div class="col-md-2 col-1 pl-0 pr-0 collapse width border-right sidebar vh-100 overflow-auto"> <div class="col-md-2 col-1 pl-0 pr-0 collapse width border-right sidebar vh-100 overflow-auto">
@ -272,6 +284,17 @@
$(this).trigger('change'); $(this).trigger('change');
}); });
//#endregion //#endregion
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
//#region 預設初始值 //#region 預設初始值
var a = $('#collapse').trigger("click"); var a = $('#collapse').trigger("click");
@ -349,6 +372,7 @@
function GetPowerStationCollapse(filter) { function GetPowerStationCollapse(filter) {
showLoading();
var url = "/ElectricitySoldRecord/GetPowerStationCollapse" var url = "/ElectricitySoldRecord/GetPowerStationCollapse"
var send_data = { var send_data = {
@ -357,6 +381,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -437,7 +462,7 @@
} }
}); });
$("#js_list_accordion .collapse").collapse('show'); $("#js_list_accordion .collapse").collapse('show');
hideLoading();
}, 'json'); }, 'json');
} }
@ -497,6 +522,7 @@
function SaveSoldMoney() function SaveSoldMoney()
{ {
if ($("#Record-form").valid()) { if ($("#Record-form").valid()) {
showLoading();
var url = "/ElectricitySoldRecord/SaveSoldMoney"; var url = "/ElectricitySoldRecord/SaveSoldMoney";
var send_data = { var send_data = {
Id: selected_id, Id: selected_id,
@ -510,6 +536,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -517,6 +544,7 @@
toast_ok(rel.msg); toast_ok(rel.msg);
$('#Record-modal').modal('hide'); $('#Record-modal').modal('hide');
RecordTable.ajax.reload(); RecordTable.ajax.reload();
hideLoading();
return; return;
} }
@ -525,6 +553,7 @@
} }
function DataTable() { function DataTable() {
showLoading();
RecordTable = $("#RecordTable").DataTable({ RecordTable = $("#RecordTable").DataTable({
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
@ -589,6 +618,7 @@
d.searchType = searchType d.searchType = searchType
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
hideLoading();
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
@ -604,6 +634,7 @@
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
@ -630,12 +661,14 @@
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
var powerstationName = $(this).parents('tr').attr('powerstation-Name'); var powerstationName = $(this).parents('tr').attr('powerstation-Name');
//取得單一售電紀錄基本資料 //取得單一售電紀錄基本資料
showLoading();
var url = "/ElectricitySoldRecord/GetOnePowerStation/"; var url = "/ElectricitySoldRecord/GetOnePowerStation/";
var send_data = { var send_data = {
Id: selected_id Id: selected_id
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -648,6 +681,7 @@
$("#Money_modal").val(rel.data.money); $("#Money_modal").val(rel.data.money);
$("#Month_modal").val(rel.data.month); $("#Month_modal").val(rel.data.month);
$("#Record-modal").modal(); $("#Record-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
@ -671,6 +705,7 @@
cancelButtonText: "否" cancelButtonText: "否"
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
showLoading();
var url = "/ElectricitySoldRecord/DeleteRecord/"; var url = "/ElectricitySoldRecord/DeleteRecord/";
var send_data = { var send_data = {
@ -679,11 +714,13 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
RecordTable.ajax.reload(); RecordTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });

View File

@ -12,6 +12,18 @@
<li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li> <li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li>
</ol> </ol>
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="row"> <div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
<div id="panel-5" class="panel"> <div id="panel-5" class="panel">
@ -232,6 +244,16 @@
var AllpoweridsType = true; var AllpoweridsType = true;
var AllidsType = true; var AllidsType = true;
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
//#region Date-Picker //#region Date-Picker
@ -264,10 +286,12 @@
//#endregion //#endregion
showLoading();
//#region 預設載入該使用者可以選擇的電站 //#region 預設載入該使用者可以選擇的電站
var city_url = "/Operation/GetMyCities"; var city_url = "/Operation/GetMyCities";
$.post(city_url, function (rel) { $.post(city_url, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -283,6 +307,7 @@
} }
getPowerStationCheckBox(); getPowerStationCheckBox();
hideLoading();
}, 'json'); }, 'json');
@ -325,6 +350,7 @@
//#endregion //#endregion
//#region DataTable //#region DataTable
showLoading();
ExceptionTable = $("#Exception_Table").DataTable({ ExceptionTable = $("#Exception_Table").DataTable({
"pageLength": 20, "pageLength": 20,
"paging": true, "paging": true,
@ -389,6 +415,7 @@
d.range = $('#date-range').val() d.range = $('#date-range').val()
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
hideLoading();
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
@ -402,6 +429,7 @@
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
@ -598,10 +626,11 @@
var send_data = { var send_data = {
cityIds: ids cityIds: ids
} }
showLoading();
var Nurl = "/ExceptionRecord/GetPowerStationByFilter"; var Nurl = "/ExceptionRecord/GetPowerStationByFilter";
$.post(Nurl, send_data, function (rel) { $.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -626,6 +655,7 @@
}); });
ExceptionTable.ajax.reload(); ExceptionTable.ajax.reload();
hideLoading();
}) })
} }
@ -644,12 +674,14 @@
$("#error_code_modal_exc").attr("disabled", true); $("#error_code_modal_exc").attr("disabled", true);
psids = selected_id = $(this).parents('tr').attr('data-psid'); psids = selected_id = $(this).parents('tr').attr('data-psid');
//#region 維修單運維人員(異常紀錄) //#region 維修單運維人員(異常紀錄)
showLoading();
var url_power_station_operation_personnel = "/PowerStation/GetOperationPersonnelSelectOptionList"; var url_power_station_operation_personnel = "/PowerStation/GetOperationPersonnelSelectOptionList";
send_data = { send_data = {
PowerStationId: parseInt(psids) PowerStationId: parseInt(psids)
} }
$.post(url_power_station_operation_personnel, send_data, function (rel) { $.post(url_power_station_operation_personnel, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -666,6 +698,7 @@
} }
} }
$("#exception-form-modal").modal(); $("#exception-form-modal").modal();
hideLoading();
}); });
//#endregion //#endregion
@ -681,6 +714,7 @@
powerStationData_name = $(this).parents('tr').attr('data-name'); powerStationData_name = $(this).parents('tr').attr('data-name');
errortoID = $(this).parents('tr').attr('data-error'); errortoID = $(this).parents('tr').attr('data-error');
//取得單一記錄表單 //取得單一記錄表單
showLoading();
var url = "/Operation/GetOneOperationRecord/"; var url = "/Operation/GetOneOperationRecord/";
var send_data = { var send_data = {
@ -689,6 +723,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -731,6 +766,7 @@
} }
$.post(url_power_station_operation_personnel, send_data, function (rel) { $.post(url_power_station_operation_personnel, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -749,7 +785,7 @@
$("#exception-form-modal").modal(); $("#exception-form-modal").modal();
}); });
//#endregion //#endregion
hideLoading();
}, 'json'); }, 'json');
}); });
//#endregion //#endregion
@ -758,6 +794,7 @@
function SaveException() { function SaveException() {
if ($("#record-form-exc").valid()) { if ($("#record-form-exc").valid()) {
showLoading();
var url = "/Operation/SaveOperationRecord"; var url = "/Operation/SaveOperationRecord";
var formData = new FormData(); var formData = new FormData();
@ -782,10 +819,11 @@
processData: false, processData: false,
success: function (rel) { success: function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
hideLoading();
var myDropzone = Dropzone.forElement("#record-file-form_exc"); var myDropzone = Dropzone.forElement("#record-file-form_exc");
if (myDropzone.files.length > 0) { if (myDropzone.files.length > 0) {

View File

@ -25,8 +25,21 @@
<!-- icheck bootstrap --> <!-- icheck bootstrap -->
<link href="~/lib/icheck-bootstrap/icheck-bootstrap.min.css" rel="stylesheet" /> <link href="~/lib/icheck-bootstrap/icheck-bootstrap.min.css" rel="stylesheet" />
<!-- Theme style --> <!-- Theme style -->
<link rel="stylesheet" href="~/css/loading.css" />
</head> </head>
<body> <body>
<div class="loadEffect" id="loading" style="top: 50%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="blankpage-form-field"> <div class="blankpage-form-field">
<div class="page-logo m-0 w-100 align-items-center justify-content-center rounded border-bottom-left-radius-0 border-bottom-right-radius-0 px-4"> <div class="page-logo m-0 w-100 align-items-center justify-content-center rounded border-bottom-left-radius-0 border-bottom-right-radius-0 px-4">
<div class="page-logo-link press-scale-down d-flex align-items-center"> <div class="page-logo-link press-scale-down d-flex align-items-center">
@ -62,7 +75,7 @@
<label class="custom-control-label" for="rememberme"> 記住我</label> <label class="custom-control-label" for="rememberme"> 記住我</label>
</div> </div>
</div> </div>
<button type="submit" class="btn btn-default float-right">登入</button> <button type="submit" class="btn btn-default float-right" id="login">登入</button>
</form> </form>
</div> </div>
<div class="blankpage-footer text-center"> <div class="blankpage-footer text-center">
@ -170,6 +183,16 @@
} }
}); });
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$("#rememberme").click(function () { $("#rememberme").click(function () {
if (remember) { if (remember) {
localStorage.setItem('solar-t', 'false'); localStorage.setItem('solar-t', 'false');
@ -184,6 +207,10 @@
} }
}); });
$("#login").click(function () {
showLoading();
});
$("#account").change(function () { $("#account").change(function () {
if (remember) { if (remember) {
localStorage.setItem('solar-a', btoa($("#account").val())); localStorage.setItem('solar-a', btoa($("#account").val()));

View File

@ -11,6 +11,18 @@
<!-- Your main content goes below here: --> <!-- Your main content goes below here: -->
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="row mb-5"> <div class="row mb-5">
<div class="card-columns"> <div class="card-columns">
<div class="card"> <div class="card">
@ -219,8 +231,18 @@
var mapOverview; var mapOverview;
var locations = []; var locations = [];
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
showLoading();
//#region 公司管理列表 DataTable //#region 公司管理列表 DataTable
capacityTable = $("#capacity-Table").DataTable({ capacityTable = $("#capacity-Table").DataTable({
"paging": true, "paging": true,
@ -279,6 +301,7 @@
var url = "/MapOverview/GetMapOverview"; var url = "/MapOverview/GetMapOverview";
$.post(url, null, function (rel) { $.post(url, null, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -311,6 +334,7 @@
//#region google map //#region google map
initMap(); initMap();
hideLoading();
//#endregion //#endregion
}); });
}); });

View File

@ -6,6 +6,18 @@
@using SolarPower.Models.Role @using SolarPower.Models.Role
@model RoleLayerEnum @model RoleLayerEnum
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap wrapper"> <div class="row flex-nowrap wrapper">
<div class="col-md-2 col-1 pl-0 pr-0 collapse width border-right sidebar vh-100 overflow-auto"> <div class="col-md-2 col-1 pl-0 pr-0 collapse width border-right sidebar vh-100 overflow-auto">
@ -267,6 +279,17 @@
var CheckType = 0;//0:全部 1:成功 2:失敗 var CheckType = 0;//0:全部 1:成功 2:失敗
var NoticeDataTable; var NoticeDataTable;
var info; var info;
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
//#region 預設初始值 //#region 預設初始值
var a = $('#collapse').trigger("click"); var a = $('#collapse').trigger("click");
@ -449,6 +472,7 @@
function GetPowerStationCollapse(filter) { function GetPowerStationCollapse(filter) {
showLoading();
var url = "/StationReport/GetPowerStationCollapse" var url = "/StationReport/GetPowerStationCollapse"
var send_data = { var send_data = {
@ -457,6 +481,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -534,7 +559,7 @@
}); });
$("#js_list_accordion .collapse").collapse('show'); $("#js_list_accordion .collapse").collapse('show');
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion
@ -569,6 +594,7 @@
checkType : CheckType, checkType : CheckType,
powerstationIds: selecterd_station powerstationIds: selecterd_station
}; };
showLoading();
NoticeDataTable = $("#NoticeTable").DataTable({ NoticeDataTable = $("#NoticeTable").DataTable({
"pageLength": 10, "pageLength": 10,
"paging": true, "paging": true,
@ -626,6 +652,7 @@
d.info = info d.info = info
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
hideLoading();
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
@ -638,6 +665,7 @@
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });

View File

@ -6,6 +6,17 @@
@using SolarPower.Models.Role @using SolarPower.Models.Role
@model RoleLayerEnum @model RoleLayerEnum
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<ol class="breadcrumb page-breadcrumb"> <ol class="breadcrumb page-breadcrumb">
<li class="breadcrumb-item"><a href="javascript:void(0);">系統管理</a></li> <li class="breadcrumb-item"><a href="javascript:void(0);">系統管理</a></li>
@ -241,12 +252,24 @@
}; };
//#endregion //#endregion
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
//#region 載入縣市 //#region 載入縣市
showLoading();
var city_url = "/Operation/GetMyCities"; var city_url = "/Operation/GetMyCities";
$.post(city_url, function (rel) { $.post(city_url, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -264,6 +287,7 @@
$('#Allcity').trigger("click"); $('#Allcity').trigger("click");
getPowerStationCheckBox(); getPowerStationCheckBox();
hideLoading();
}, 'json'); }, 'json');
@*var Nurl = "/PowerStation/GetSolarCitySummary"; @*var Nurl = "/PowerStation/GetSolarCitySummary";
@ -541,10 +565,11 @@
var send_data = { var send_data = {
cityIds: ids cityIds: ids
} }
showLoading();
var Nurl = "/Operation/GetPowerStationByFilter"; var Nurl = "/Operation/GetPowerStationByFilter";
$.post(Nurl, send_data, function (rel) { $.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -574,6 +599,7 @@
}); });
OperationPlanTable.ajax.reload(); OperationPlanTable.ajax.reload();
hideLoading();
}) })
} }
@ -641,6 +667,7 @@
//#region 儲存定時計畫資料 //#region 儲存定時計畫資料
function SaveOperationPlan() { function SaveOperationPlan() {
showLoading();
var url = "/Operation/SaveOperationPlan"; var url = "/Operation/SaveOperationPlan";
var send_data = { var send_data = {
@ -658,12 +685,14 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
OperationPlanTable.ajax.reload(); OperationPlanTable.ajax.reload();
$('#Operation-modal').modal('hide'); $('#Operation-modal').modal('hide');
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion
@ -684,17 +713,20 @@
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
//取得單一系統管理員 //取得單一系統管理員
showLoading();
var url = "/Operation/DeleteOneOperationPlan/"; var url = "/Operation/DeleteOneOperationPlan/";
var send_data = { var send_data = {
Id: selected_id Id: selected_id
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
OperationPlanTable.ajax.reload(); OperationPlanTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -708,6 +740,7 @@
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
//取得單一異常設定資料 //取得單一異常設定資料
showLoading();
var url = "/Operation/GetOneOperationPlan/"; var url = "/Operation/GetOneOperationPlan/";
var send_data = { var send_data = {
@ -717,6 +750,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -736,6 +770,7 @@
//document.getElementById("operation_endTime_modal").innerHTML = day[0]; //document.getElementById("operation_endTime_modal").innerHTML = day[0];
$("#Operation-modal").modal(); $("#Operation-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
@ -743,7 +778,7 @@
//#region 儲存Excel //#region 儲存Excel
function saveToExcel() { function saveToExcel() {
showLoading();
var url = "/Operation/OperationPlanTable"; var url = "/Operation/OperationPlanTable";
var send_data = { var send_data = {
id: powerids, id: powerids,
@ -751,6 +786,7 @@
}; };
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.data.code != "0000") { if (rel.data.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -777,6 +813,7 @@
//檔案字尾名 //檔案字尾名
fileext: ".xlsx", fileext: ".xlsx",
}); });
hideLoading();
}, 'json'); }, 'json');

View File

@ -17,6 +17,18 @@
</h1> </h1>
</div> </div>
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<!-- Your main content goes below here: --> <!-- Your main content goes below here: -->
<div id="panel-5" class="panel"> <div id="panel-5" class="panel">
<div class="panel-container show"> <div class="panel-container show">
@ -296,6 +308,16 @@
}; };
//#endregion //#endregion
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
//#region Date-Picker //#region Date-Picker
@ -320,9 +342,11 @@
//#endregion //#endregion
//#region 預設載入該使用者可以選擇的電站 //#region 預設載入該使用者可以選擇的電站
showLoading();
var city_url = "/Operation/GetMyCities"; var city_url = "/Operation/GetMyCities";
$.post(city_url, function (rel) { $.post(city_url, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -343,6 +367,7 @@
var Nurl = "/Operation/GetPowerStationByFilter"; var Nurl = "/Operation/GetPowerStationByFilter";
$.post(Nurl, send_data, function (rel) { $.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -361,6 +386,7 @@
$('#Allcity').trigger("click"); $('#Allcity').trigger("click");
getPowerStationCheckBox(); getPowerStationCheckBox();
hideLoading();
}, 'json'); }, 'json');
@ -425,6 +451,7 @@
$("#power_station_select_modal").change(function () { $("#power_station_select_modal").change(function () {
//查詢該電站的運維人員 //查詢該電站的運維人員
showLoading();
var url_power_station_operation_personnel = "/PowerStation/GetOperationPersonnelSelectOptionList"; var url_power_station_operation_personnel = "/PowerStation/GetOperationPersonnelSelectOptionList";
send_data = { send_data = {
@ -433,6 +460,7 @@
$.post(url_power_station_operation_personnel, send_data, function (rel) { $.post(url_power_station_operation_personnel, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -451,14 +479,16 @@
$("#work_person_select_modal").select2({ dropdownParent: $('#record-form-modal') }); $("#work_person_select_modal").select2({ dropdownParent: $('#record-form-modal') });
hideLoading();
}); });
//查詢該電站的廠商 //查詢該電站的廠商
showLoading();
var url_power_station_firm = "/PowerStation/GetFirmSelectOptionList"; var url_power_station_firm = "/PowerStation/GetFirmSelectOptionList";
$.post(url_power_station_firm, send_data, function (rel) { $.post(url_power_station_firm, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -476,6 +506,7 @@
if (record != undefined && record != null) { if (record != undefined && record != null) {
$("#fix_firm_select_modal").val(record.fixFirm) $("#fix_firm_select_modal").val(record.fixFirm)
} }
hideLoading();
}); });
}); });
//#endregion //#endregion
@ -624,10 +655,11 @@
var send_data = { var send_data = {
cityIds: ids cityIds: ids
} }
showLoading();
var Nurl = "/Operation/GetPowerStationByFilter"; var Nurl = "/Operation/GetPowerStationByFilter";
$.post(Nurl, send_data, function (rel) { $.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -659,6 +691,7 @@
operationRecordTable.column(10).visible(false); operationRecordTable.column(10).visible(false);
} }
operationRecordTable.ajax.reload(); operationRecordTable.ajax.reload();
hideLoading();
}) })
} }
@ -1073,6 +1106,7 @@
// 鎖定按鈕 // 鎖定按鈕
$("#save-record-btn").attr('disabled', true); $("#save-record-btn").attr('disabled', true);
showLoading();
var url = "/Operation/SaveOperationRecord"; var url = "/Operation/SaveOperationRecord";
var formData = new FormData(); var formData = new FormData();
@ -1109,10 +1143,11 @@
processData: false, processData: false,
success: function (rel) { success: function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
hideLoading();
var myDropzone = Dropzone.forElement("#record-file-form"); var myDropzone = Dropzone.forElement("#record-file-form");
if (myDropzone.files.length > 0) { if (myDropzone.files.length > 0) {
@ -1188,20 +1223,24 @@
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
//刪除單一運維紀錄 //刪除單一運維紀錄
showLoading();
var url = "/Operation/DeleteOneOperationRecord/"; var url = "/Operation/DeleteOneOperationRecord/";
var send_data = { var send_data = {
Id: selected_id Id: selected_id
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
else if (rel.code == "9998") { else if (rel.code == "9998") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
hideLoading();
toast_ok(rel.msg); toast_ok(rel.msg);
if (status == 2) { if (status == 2) {
operationRecordTable.column(10).visible(true); operationRecordTable.column(10).visible(true);
@ -1232,20 +1271,24 @@
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
//還原單一運維紀錄 //還原單一運維紀錄
showLoading();
var url = "/Operation/ReductionOneOperationRecord/"; var url = "/Operation/ReductionOneOperationRecord/";
var send_data = { var send_data = {
Id: selected_id Id: selected_id
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
else if (rel.code == "9998") { else if (rel.code == "9998") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
hideLoading();
toast_ok(rel.msg); toast_ok(rel.msg);
if (status == 2) { if (status == 2) {
operationRecordTable.column(10).visible(true); operationRecordTable.column(10).visible(true);
@ -1262,9 +1305,11 @@
//#region 取得電站選單資料 (未使用) //#region 取得電站選單資料 (未使用)
function GetPowerStation() { function GetPowerStation() {
showLoading();
var url_power_station_select_option = "/Operation/GetPowerStationSelectOption"; var url_power_station_select_option = "/Operation/GetPowerStationSelectOption";
$.get(url_power_station_select_option, function (rel) { $.get(url_power_station_select_option, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1277,6 +1322,7 @@
//預設查詢第一個 //預設查詢第一個
$("#power_station_select_modal").val($("#power_station_select_modal option:first").val()).trigger('change'); $("#power_station_select_modal").val($("#power_station_select_modal option:first").val()).trigger('change');
hideLoading();
}); });
} }
//#endregion //#endregion
@ -1382,6 +1428,7 @@
//#region 匯出excel //#region 匯出excel
function ExportExcel() { function ExportExcel() {
showLoading();
var url = "/Operation/ExportOperationRecordExcel"; var url = "/Operation/ExportOperationRecordExcel";
var send_data = { var send_data = {
CityIds: [3], CityIds: [3],
@ -1389,6 +1436,7 @@
}; };
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1435,6 +1483,7 @@
//檔案字尾名 //檔案字尾名
fileext: ".xls", fileext: ".xls",
}); });
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion

View File

@ -6,6 +6,18 @@
@using SolarPower.Models.Role @using SolarPower.Models.Role
@model RoleLayerEnum @model RoleLayerEnum
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap wrapper"> <div class="row flex-nowrap wrapper">
<div class="col-md-2 col-1 pl-0 pr-0 collapse width border-right sidebar vh-100 overflow-auto"> <div class="col-md-2 col-1 pl-0 pr-0 collapse width border-right sidebar vh-100 overflow-auto">
@ -296,6 +308,17 @@
var selecterd_powerstationId = []; var selecterd_powerstationId = [];
var searchType; var searchType;
var chart; var chart;
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
$('#collapse').trigger("click"); $('#collapse').trigger("click");
$('#firstclick').trigger("click"); $('#firstclick').trigger("click");
@ -363,6 +386,7 @@
function GetPowerStationCollapse(filter) { function GetPowerStationCollapse(filter) {
showLoading();
var url = "/PowerGeneration/GetPowerStationCollapse" var url = "/PowerGeneration/GetPowerStationCollapse"
var send_data = { var send_data = {
@ -371,6 +395,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -452,7 +477,7 @@
}); });
$("#js_list_accordion .collapse").collapse('show'); $("#js_list_accordion .collapse").collapse('show');
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion
@ -510,6 +535,7 @@
function Search() { function Search() {
showLoading();
var url = "/PowerGeneration/GetGenerationList" var url = "/PowerGeneration/GetGenerationList"
var send_data = { var send_data = {
PowerstationId: nowpowerstation, PowerstationId: nowpowerstation,
@ -518,6 +544,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -667,7 +694,7 @@
}); });
hideLoading();
}); });
} }

View File

@ -6,6 +6,18 @@
@using SolarPower.Models.Role @using SolarPower.Models.Role
@model RoleLayerEnum @model RoleLayerEnum
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<ol class="breadcrumb page-breadcrumb"> <ol class="breadcrumb page-breadcrumb">
<li class="breadcrumb-item"><a href="javascript:void(0);">總覽</a></li> <li class="breadcrumb-item"><a href="javascript:void(0);">總覽</a></li>
<li class="breadcrumb-item active">@ViewData["Title"]</li> <li class="breadcrumb-item active">@ViewData["Title"]</li>
@ -220,6 +232,17 @@
var ids = new Array(0); var ids = new Array(0);
var localurl = this.location.href; var localurl = this.location.href;
var index = 0; var index = 0;
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
$('#collapse').trigger("click"); $('#collapse').trigger("click");
Cityes(); Cityes();
@ -232,9 +255,11 @@
}); });
function Cityes() { function Cityes() {
showLoading();
var url = "/PowerStation/GetSolarCitySummary"; var url = "/PowerStation/GetSolarCitySummary";
$.post(url, function (rel) { $.post(url, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -292,6 +317,7 @@
$("#areaTab").find(".nav-item > a").first().click(); $("#areaTab").find(".nav-item > a").first().click();
$('#tab-' + index + '-collapse').trigger("click"); $('#tab-' + index + '-collapse').trigger("click");
hideLoading();
return; return;
} }
}, 'json'); }, 'json');
@ -306,7 +332,7 @@
function addPowerStationCard(ids) { function addPowerStationCard(ids) {
showLoading();
//alert(ids); //alert(ids);
var url = "/PowerStation/GetSolarByCity"; var url = "/PowerStation/GetSolarByCity";
var send_data = { var send_data = {
@ -314,6 +340,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -365,13 +392,14 @@
'</tr>'); '</tr>');
}); });
$('.nav-tabs a[href="#' + tablocation + '"]').tab('show'); $('.nav-tabs a[href="#' + tablocation + '"]').tab('show');
hideLoading();
return; return;
} }
}, 'json'); }, 'json');
} }
$(document).on("click", "button.status-btnto", function () { $(document).on("click", "button.status-btnto", function () {
showLoading();
var selected_id = $(this).parents('tr').attr('data-id'); var selected_id = $(this).parents('tr').attr('data-id');
var url = "/PowerStation/CheckStationStatus"; var url = "/PowerStation/CheckStationStatus";
@ -381,6 +409,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -405,11 +434,12 @@
} }
} }
hideLoading();
}, 'json'); }, 'json');
}); });
$(document).on("click", "button.unstatus-btnto", function () { $(document).on("click", "button.unstatus-btnto", function () {
showLoading();
var selected_id = $(this).parents('tr').attr('data-id'); var selected_id = $(this).parents('tr').attr('data-id');
var url = "/PowerStation/StationUnStatus"; var url = "/PowerStation/StationUnStatus";
@ -419,6 +449,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -428,6 +459,7 @@
} }
Cityes(); Cityes();
} }
hideLoading();
}, 'json'); }, 'json');
}); });
@ -441,13 +473,14 @@
$(document).on("click", "button.del-btnto", function () { $(document).on("click", "button.del-btnto", function () {
var selected_id = $(this).parents('tr').attr('data-id'); var selected_id = $(this).parents('tr').attr('data-id');
var selected_cityid = $(this).parents('tr').attr('datacity-id'); var selected_cityid = $(this).parents('tr').attr('datacity-id');
showLoading();
var url = "/PowerStation/GetShareDevicePowerstationName"; var url = "/PowerStation/GetShareDevicePowerstationName";
var send_data = { var send_data = {
Id: selected_id Id: selected_id
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -493,7 +526,7 @@
} }
}); });
hideLoading();
return; return;
} }

View File

@ -15,6 +15,19 @@
</ol> </ol>
<!-- Your main content goes below here: --> <!-- Your main content goes below here: -->
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="row"> <div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
<div id="panel-5" class="panel"> <div id="panel-5" class="panel">
@ -102,6 +115,17 @@
var upper = 0; var upper = 0;
var stationDB = ""; var stationDB = "";
var station_infocreate = false; var station_infocreate = false;
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
$('#power_station_operation_personnel-error').hide(); $('#power_station_operation_personnel-error').hide();
$('#coordinate_text-error').hide(); $('#coordinate_text-error').hide();
@ -109,9 +133,11 @@
stationId = url.searchParams.get('stationId'); stationId = url.searchParams.get('stationId');
//#region 預先載入公司下拉式選單select_option //#region 預先載入公司下拉式選單select_option
showLoading();
var url_company_select_option = "/PowerStation/GetCompanySelectOptionList"; var url_company_select_option = "/PowerStation/GetCompanySelectOptionList";
$.get(url_company_select_option, function (rel) { $.get(url_company_select_option, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -129,6 +155,7 @@
else { else {
$("#select_power_station_company").val(powerStationData.companyId).trigger('change'); $("#select_power_station_company").val(powerStationData.companyId).trigger('change');
} }
hideLoading();
}); });
//#endregion //#endregion
@ -200,6 +227,7 @@
$("#tablist").find(".nav-item > a").first().click(); $("#tablist").find(".nav-item > a").first().click();
} else { } else {
showLoading();
var url = "/PowerStation/GetOnePowerStation" var url = "/PowerStation/GetOnePowerStation"
var send_data = { var send_data = {
@ -208,6 +236,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -231,10 +260,11 @@
ChangeMode("land_building_info", "view"); ChangeMode("land_building_info", "view");
SetLandBuildingInfo(); SetLandBuildingInfo();
//#endregion //#endregion
hideLoading();
}, 'json'); }, 'json');
//#region 控制器列表 DataTable //#region 控制器列表 DataTable
showLoading();
DeviceControllerTable = $("#Controller_table").DataTable({ DeviceControllerTable = $("#Controller_table").DataTable({
"pageLength": 5, "pageLength": 5,
"paging": true, "paging": true,
@ -282,6 +312,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -300,17 +331,19 @@
$.each(data, function (index, val) { $.each(data, function (index, val) {
$("#Device_Controller_modal").append($("<option />").val(val.id).text(val.controllerId)); $("#Device_Controller_modal").append($("<option />").val(val.id).text(val.controllerId));
}); });
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
//#endregion //#endregion
//#region 逆變器列表 DataTable //#region 逆變器列表 DataTable
showLoading();
InverterTable = $("#Inverter_table").DataTable({ InverterTable = $("#Inverter_table").DataTable({
"pageLength": 5, "pageLength": 5,
"paging": true, "paging": true,
@ -376,6 +409,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -391,17 +425,19 @@
if (data == null || data.length == 0) { if (data == null || data.length == 0) {
this.data = []; this.data = [];
} }
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
//#endregion //#endregion
//#region 運維列表 DataTable //#region 運維列表 DataTable
showLoading();
OperationTable = $("#Operation_table").DataTable({ OperationTable = $("#Operation_table").DataTable({
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
@ -461,6 +497,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -470,17 +507,19 @@
if (data == null || data.length == 0) { if (data == null || data.length == 0) {
this.data = []; this.data = [];
} }
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
//#endregion //#endregion
//#region 裝置列表 DataTable //#region 裝置列表 DataTable
showLoading();
DeviceTable = $("#Device_table").DataTable({ DeviceTable = $("#Device_table").DataTable({
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
@ -560,6 +599,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -574,17 +614,19 @@
if (data == null || data.length == 0) { if (data == null || data.length == 0) {
this.data = []; this.data = [];
} }
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
//#endregion //#endregion
//#region 共享裝置列表 DataTable //#region 共享裝置列表 DataTable
showLoading();
ShareDeviceTable = $("#ShareDevice_table").DataTable({ ShareDeviceTable = $("#ShareDevice_table").DataTable({
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
@ -664,6 +706,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -677,17 +720,19 @@
if (data == null || data.length == 0) { if (data == null || data.length == 0) {
this.data = []; this.data = [];
} }
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
//#endregion //#endregion
//#region 異常設定列表 DataTable //#region 異常設定列表 DataTable
showLoading();
ExceptionTable = $("#Exception_table").DataTable({ ExceptionTable = $("#Exception_table").DataTable({
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
@ -748,6 +793,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -757,11 +803,12 @@
if (data == null || data.length == 0) { if (data == null || data.length == 0) {
this.data = []; this.data = [];
} }
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
@ -769,6 +816,7 @@
//#endregion //#endregion
//#region 載入上傳資料 - 電站圖片 //#region 載入上傳資料 - 電站圖片
showLoading();
var url_image = "/PowerStation/GetAllPowerStationImage"; var url_image = "/PowerStation/GetAllPowerStationImage";
var send_data = { var send_data = {
powerStationId: stationId powerStationId: stationId
@ -776,6 +824,7 @@
$.post(url_image, send_data, function (rel) { $.post(url_image, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -789,11 +838,12 @@
rel.data.forEach(function (value, index) { rel.data.forEach(function (value, index) {
CreatePowerStationImageBox(powerStationSingleLineCard, value); CreatePowerStationImageBox(powerStationSingleLineCard, value);
}); });
hideLoading();
}, 'json'); }, 'json');
//#endregion //#endregion
//#region 載入上傳資料 - 單線圖 //#region 載入上傳資料 - 單線圖
showLoading();
var url_image = "/PowerStation/GetAllPowerStationSingleLine"; var url_image = "/PowerStation/GetAllPowerStationSingleLine";
var send_data = { var send_data = {
powerStationId: stationId powerStationId: stationId
@ -801,6 +851,7 @@
$.post(url_image, send_data, function (rel) { $.post(url_image, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -821,19 +872,21 @@
}); });
hideLoading();
}, 'json'); }, 'json');
//#endregion //#endregion
} }
//#endregion //#endregion
//#region 預先載入運維人員下拉式選單select_option //#region 預先載入運維人員下拉式選單select_option
showLoading();
var url_user_select_option = "/PowerStation/GetUserSelectOptionList"; var url_user_select_option = "/PowerStation/GetUserSelectOptionList";
var send_data = { var send_data = {
powerStationId: stationId powerStationId: stationId
} }
$.get(url_user_select_option, send_data, function (rel) { $.get(url_user_select_option, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -852,12 +905,14 @@
if (powerStationData) { if (powerStationData) {
$("#power_station_operation_personnel").val(powerStationData.operationPersonnelIds); $("#power_station_operation_personnel").val(powerStationData.operationPersonnelIds);
} }
hideLoading();
}); });
$('.js-example-basic-multiple').select2(); $('.js-example-basic-multiple').select2();
//#endregion //#endregion
//#region 預先載入其餘電站下拉式選單select_option //#region 預先載入其餘電站下拉式選單select_option
showLoading();
var url_powerstation_option = "/PowerStation/GetPowerstationOption"; var url_powerstation_option = "/PowerStation/GetPowerstationOption";
var send_data = { var send_data = {
stationId: stationId stationId: stationId
@ -865,6 +920,7 @@
if (stationId != "new") { if (stationId != "new") {
$.get(url_powerstation_option, send_data, function (rel) { $.get(url_powerstation_option, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -885,6 +941,7 @@
$("#ShareDevice_PowerStationId_modal").attr('disabled', true); $("#ShareDevice_PowerStationId_modal").attr('disabled', true);
$("#ShareDevice-modal").find('.btn-primary').attr('disabled', true); $("#ShareDevice-modal").find('.btn-primary').attr('disabled', true);
} }
hideLoading();
}); });
} }
@ -896,9 +953,11 @@
}); });
//#region 預先載入縣市下拉式選單select_option //#region 預先載入縣市下拉式選單select_option
showLoading();
var url_city_select_option = "/PowerStation/GetCitySelectOptionList"; var url_city_select_option = "/PowerStation/GetCitySelectOptionList";
$.get(url_city_select_option, function (rel) { $.get(url_city_select_option, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -916,11 +975,13 @@
else { else {
$("#select_city").val(powerStationData.cityId).trigger("change"); $("#select_city").val(powerStationData.cityId).trigger("change");
} }
hideLoading();
}); });
//#endregion //#endregion
//#region 縣市選擇後取得地區下拉式選單select_option //#region 縣市選擇後取得地區下拉式選單select_option
$("#select_city").change(function () { $("#select_city").change(function () {
showLoading();
var url_area_select_option = "/PowerStation/GetAreaSelectOptionList"; var url_area_select_option = "/PowerStation/GetAreaSelectOptionList";
var send_data = { var send_data = {
@ -929,6 +990,7 @@
$.post(url_area_select_option, send_data, function (rel) { $.post(url_area_select_option, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -946,14 +1008,17 @@
else { else {
$("#select_area").val(powerStationData.areaId); $("#select_area").val(powerStationData.areaId);
} }
hideLoading();
}); });
}); });
//#endregion //#endregion
//#region 預先載入設備類型下拉式選單select_option //#region 預先載入設備類型下拉式選單select_option
showLoading();
var url_DeviceType = "/PowerStation/GetDeviceTypeSelectOptionList"; var url_DeviceType = "/PowerStation/GetDeviceTypeSelectOptionList";
$.get(url_DeviceType, function (rel) { $.get(url_DeviceType, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -962,6 +1027,7 @@
$.each(rel.data, function (index, val) { $.each(rel.data, function (index, val) {
$("#Device_Type_modal").append($("<option />").val(val.value).text(val.text)); $("#Device_Type_modal").append($("<option />").val(val.value).text(val.text));
}); });
hideLoading();
}); });
//#endregion //#endregion
@ -983,12 +1049,14 @@
//#region 預先載入裝置下拉式選單select_option //#region 預先載入裝置下拉式選單select_option
function DeviceUIDList(powerstationid) function DeviceUIDList(powerstationid)
{ {
showLoading();
var url_powerstation_option = "/PowerStation/GetDeviceUIDList"; var url_powerstation_option = "/PowerStation/GetDeviceUIDList";
var send_data = { var send_data = {
stationId: powerstationid stationId: powerstationid
} }
$.get(url_powerstation_option, send_data, function (rel) { $.get(url_powerstation_option, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1005,19 +1073,21 @@
} }
hideLoading();
}); });
} }
//#endregion //#endregion
//#region 預先載入日照計下拉式選單select_option //#region 預先載入日照計下拉式選單select_option
function PyrheliometerList(powerstationid) { function PyrheliometerList(powerstationid) {
showLoading();
var url_powerstation_option = "/PowerStation/GetPyrheliometerList"; var url_powerstation_option = "/PowerStation/GetPyrheliometerList";
var send_data = { var send_data = {
stationId: powerstationid stationId: powerstationid
} }
$.get(url_powerstation_option, send_data, function (rel) { $.get(url_powerstation_option, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1033,7 +1103,7 @@
}); });
} }
hideLoading();
}); });
} }
//#endregion //#endregion
@ -1098,6 +1168,7 @@
//#endregion //#endregion
function PostPowerStationData() { function PostPowerStationData() {
showLoading();
var url = "/PowerStation/SavePowerStationInfo"; var url = "/PowerStation/SavePowerStationInfo";
var send_data = { var send_data = {
@ -1129,6 +1200,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1143,11 +1215,13 @@
SetStationInfo(); SetStationInfo();
ChangeMode("station_info", "view"); ChangeMode("station_info", "view");
} }
hideLoading();
}, 'json'); }, 'json');
} }
//#region 儲存能源局台電資料資訊 //#region 儲存能源局台電資料資訊
function SaveBoETPCInfo() { function SaveBoETPCInfo() {
showLoading();
var url = "/PowerStation/SaveBoETPCInfo"; var url = "/PowerStation/SaveBoETPCInfo";
var formData = new FormData(); var formData = new FormData();
@ -1183,6 +1257,7 @@
processData: false, processData: false,
success: function (rel) { success: function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1194,6 +1269,7 @@
//回填資料 //回填資料
SetBoETPCInfo(); SetBoETPCInfo();
ChangeMode("BOE_TPC", "view"); ChangeMode("BOE_TPC", "view");
hideLoading();
} }
}); });
} }
@ -1201,6 +1277,7 @@
//#region 儲存土地房屋資訊 //#region 儲存土地房屋資訊
function SaveLandBuildingInfo() { function SaveLandBuildingInfo() {
showLoading();
var url = "/PowerStation/SaveLandBuildingInfo"; var url = "/PowerStation/SaveLandBuildingInfo";
var send_data = { var send_data = {
@ -1217,6 +1294,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1225,7 +1303,7 @@
powerStationData = rel.data; powerStationData = rel.data;
SetLandBuildingInfo(); SetLandBuildingInfo();
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion
@ -2051,6 +2129,7 @@
cancelButtonText: "否" cancelButtonText: "否"
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
showLoading();
var url = "/PowerStation/DeleteLandBuildingInfo"; var url = "/PowerStation/DeleteLandBuildingInfo";
var send_data = { var send_data = {
SelectedId: selectedLandBuildingId, SelectedId: selectedLandBuildingId,
@ -2058,12 +2137,14 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
powerStationData = rel.data; powerStationData = rel.data;
SetLandBuildingInfo(); SetLandBuildingInfo();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -2103,6 +2184,7 @@
//#region 儲存運維資料 //#region 儲存運維資料
function SaveOperation() { function SaveOperation() {
if ($("#Operation-form").valid()) { if ($("#Operation-form").valid()) {
showLoading();
var url = "/PowerStation/SaveOperation"; var url = "/PowerStation/SaveOperation";
var send_data = { var send_data = {
Id: selected_id, Id: selected_id,
@ -2118,6 +2200,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2126,6 +2209,7 @@
toast_ok(rel.msg); toast_ok(rel.msg);
$('#Operation-modal').modal('hide'); $('#Operation-modal').modal('hide');
OperationTable.ajax.reload(); OperationTable.ajax.reload();
hideLoading();
return; return;
} }
@ -2137,6 +2221,7 @@
//#region 儲存共享設備 //#region 儲存共享設備
function SaveShareDevice() { function SaveShareDevice() {
if ($("#Operation-form").valid()) { if ($("#Operation-form").valid()) {
showLoading();
var url = "/PowerStation/SaveShareDevice"; var url = "/PowerStation/SaveShareDevice";
var send_data = { var send_data = {
Id: selected_id, Id: selected_id,
@ -2146,6 +2231,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2153,6 +2239,7 @@
toast_ok(rel.msg); toast_ok(rel.msg);
$('#ShareDevice-modal').modal('hide'); $('#ShareDevice-modal').modal('hide');
ShareDeviceTable.ajax.reload(); ShareDeviceTable.ajax.reload();
hideLoading();
return; return;
} }
@ -2168,6 +2255,7 @@
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
//取得單一運維基本資料 //取得單一運維基本資料
showLoading();
var url = "/PowerStation/GetOneOperation/"; var url = "/PowerStation/GetOneOperation/";
var send_data = { var send_data = {
@ -2177,6 +2265,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2190,6 +2279,7 @@
$("#Operation_remark_modal").val(rel.data.remark); $("#Operation_remark_modal").val(rel.data.remark);
$("#Operation-modal").modal(); $("#Operation-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
@ -2209,6 +2299,7 @@
cancelButtonText: "否" cancelButtonText: "否"
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
showLoading();
var url = "/PowerStation/DeleteOneOperation/"; var url = "/PowerStation/DeleteOneOperation/";
var send_data = { var send_data = {
@ -2218,11 +2309,13 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
OperationTable.ajax.reload(); OperationTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -2287,6 +2380,7 @@
cancelButtonText: "否" cancelButtonText: "否"
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
showLoading();
var url = "/PowerStation/DeleteOneShareDevice/"; var url = "/PowerStation/DeleteOneShareDevice/";
var send_data = { var send_data = {
@ -2296,11 +2390,13 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
ShareDeviceTable.ajax.reload(); ShareDeviceTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -2309,6 +2405,7 @@
//#region 儲存控制器資料 //#region 儲存控制器資料
function SaveController() { function SaveController() {
showLoading();
var url = "/PowerStation/SaveController"; var url = "/PowerStation/SaveController";
if ($("#Controller-form").valid()) { if ($("#Controller-form").valid()) {
var send_data = { var send_data = {
@ -2318,6 +2415,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2325,6 +2423,7 @@
toast_ok(rel.msg); toast_ok(rel.msg);
$('#Controller-modal').modal('hide'); $('#Controller-modal').modal('hide');
DeviceControllerTable.ajax.reload(); DeviceControllerTable.ajax.reload();
hideLoading();
return; return;
} }
}, 'json'); }, 'json');
@ -2346,6 +2445,7 @@
cancelButtonText: "否" cancelButtonText: "否"
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
showLoading();
var url = "/PowerStation/DeleteOneDeviceController/"; var url = "/PowerStation/DeleteOneDeviceController/";
var send_data = { var send_data = {
@ -2355,11 +2455,13 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
DeviceControllerTable.ajax.reload(); DeviceControllerTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -2380,6 +2482,7 @@
cancelButtonText: "否" cancelButtonText: "否"
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
showLoading();
var url = "/PowerStation/DeleteOneInverter/"; var url = "/PowerStation/DeleteOneInverter/";
var send_data = { var send_data = {
@ -2389,11 +2492,13 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
InverterTable.ajax.reload(); InverterTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -2402,7 +2507,7 @@
//#region 儲存逆變器資料 //#region 儲存逆變器資料
function SaveInverter() { function SaveInverter() {
showLoading();
var url = "/PowerStation/SaveInverter"; var url = "/PowerStation/SaveInverter";
if ($("#Inverter-form").valid()) { if ($("#Inverter-form").valid()) {
var send_data = { var send_data = {
@ -2422,6 +2527,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2429,6 +2535,7 @@
toast_ok(rel.msg); toast_ok(rel.msg);
$('#Inverter-modal').modal('hide'); $('#Inverter-modal').modal('hide');
InverterTable.ajax.reload(); InverterTable.ajax.reload();
hideLoading();
return; return;
} }
}, 'json'); }, 'json');
@ -2440,6 +2547,7 @@
function SaveDevice() { function SaveDevice() {
if ($("#Device-form").valid()) { if ($("#Device-form").valid()) {
showLoading();
var url = "/PowerStation/SaveDevice"; var url = "/PowerStation/SaveDevice";
var a = padLeft($("#Device_ColName_modal").val(), 2); var a = padLeft($("#Device_ColName_modal").val(), 2);
var send_data = { var send_data = {
@ -2462,6 +2570,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2469,6 +2578,7 @@
toast_ok(rel.msg); toast_ok(rel.msg);
$('#Device-modal').modal('hide'); $('#Device-modal').modal('hide');
DeviceTable.ajax.reload(); DeviceTable.ajax.reload();
hideLoading();
return; return;
} }
@ -2485,6 +2595,7 @@
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
//取得單一運維基本資料 //取得單一運維基本資料
showLoading();
var url = "/PowerStation/GetOneDevice/"; var url = "/PowerStation/GetOneDevice/";
var send_data = { var send_data = {
@ -2495,6 +2606,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2524,6 +2636,7 @@
$("#Device-modal").modal(); $("#Device-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
@ -2534,6 +2647,7 @@
$("#Inverter-modal .modal-title").html("逆變器 - 編輯"); $("#Inverter-modal .modal-title").html("逆變器 - 編輯");
document.getElementById('Inverter_Status_modal').disabled = true; document.getElementById('Inverter_Status_modal').disabled = true;
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
showLoading();
var url = "/PowerStation/GetOneInverter/"; var url = "/PowerStation/GetOneInverter/";
var send_data = { var send_data = {
@ -2544,6 +2658,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2568,6 +2683,7 @@
$("#Inverter-modal").modal(); $("#Inverter-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
@ -2587,6 +2703,7 @@
cancelButtonText: "否" cancelButtonText: "否"
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
showLoading();
var url = "/PowerStation/DeleteOneDevice/"; var url = "/PowerStation/DeleteOneDevice/";
var send_data = { var send_data = {
SelectedId: selected_id, SelectedId: selected_id,
@ -2594,11 +2711,13 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
DeviceTable.ajax.reload(); DeviceTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -2620,7 +2739,7 @@
if ($("#Exception-form").valid()) { if ($("#Exception-form").valid()) {
showLoading();
var url = "/PowerStation/SaveException"; var url = "/PowerStation/SaveException";
var send_data = { var send_data = {
Id: selected_id, Id: selected_id,
@ -2632,6 +2751,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2639,6 +2759,7 @@
toast_ok(rel.msg); toast_ok(rel.msg);
$('#Exception-modal').modal('hide'); $('#Exception-modal').modal('hide');
ExceptionTable.ajax.reload(); ExceptionTable.ajax.reload();
hideLoading();
return; return;
} }
}, 'json'); }, 'json');
@ -2652,6 +2773,7 @@
var tyname = $(this).parents('tr').attr('data-typename'); var tyname = $(this).parents('tr').attr('data-typename');
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
//取得單一異常設定資料 //取得單一異常設定資料
showLoading();
var url = "/PowerStation/GetOneException/"; var url = "/PowerStation/GetOneException/";
var send_data = { var send_data = {
SelectedId: selected_id, SelectedId: selected_id,
@ -2659,6 +2781,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2670,6 +2793,7 @@
$("#Exception_LowerLimit_modal").val(rel.data.lowerLimit); $("#Exception_LowerLimit_modal").val(rel.data.lowerLimit);
$("#Exception-modal").modal(); $("#Exception-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
@ -2690,6 +2814,7 @@
cancelButtonText: "否" cancelButtonText: "否"
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
showLoading();
var url = "/PowerStation/DeleteOneException/"; var url = "/PowerStation/DeleteOneException/";
var send_data = { var send_data = {
SelectedId: selected_id, SelectedId: selected_id,
@ -2697,11 +2822,13 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
ExceptionTable.ajax.reload(); ExceptionTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -2813,7 +2940,7 @@
cancelButtonText: "否" cancelButtonText: "否"
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
showLoading();
var url = "/PowerStation/DeletePowerStationImage"; var url = "/PowerStation/DeletePowerStationImage";
var send_data = { var send_data = {
@ -2823,6 +2950,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2830,6 +2958,7 @@
toast_ok(rel.msg); toast_ok(rel.msg);
countPowerStationImage -= 1; countPowerStationImage -= 1;
div.remove(); div.remove();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -2853,7 +2982,7 @@
this.checked = true; this.checked = true;
return; return;
} }
showLoading();
var url = "/PowerStation/ChangeMainDisplay"; var url = "/PowerStation/ChangeMainDisplay";
var send_data = { var send_data = {
@ -2863,11 +2992,13 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
hideLoading();
}, 'json'); }, 'json');
}); });
//#endregion //#endregion
@ -2983,7 +3114,7 @@
cancelButtonText: "否" cancelButtonText: "否"
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
showLoading();
var url = "/PowerStation/DeletePowerStationSingleLine"; var url = "/PowerStation/DeletePowerStationSingleLine";
var send_data = { var send_data = {
@ -2993,6 +3124,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -3000,6 +3132,7 @@
toast_ok(rel.msg); toast_ok(rel.msg);
countPowerStationSingleLine -= 1; countPowerStationSingleLine -= 1;
div.remove(); div.remove();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -3164,12 +3297,14 @@
function urlApicallItem() function urlApicallItem()
{ {
showLoading();
var urlApicallItem = "/PowerStation/GetApicallItemList"; var urlApicallItem = "/PowerStation/GetApicallItemList";
var send_data = { var send_data = {
powerStationId: stationId powerStationId: stationId
} }
$.post(urlApicallItem, send_data, function (rel) { $.post(urlApicallItem, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -3187,7 +3322,7 @@
$("#Exception_Type_modal").attr('disabled', true); $("#Exception_Type_modal").attr('disabled', true);
$("#savebtn").attr('disabled', true); $("#savebtn").attr('disabled', true);
} }
hideLoading();
}); });
} }

View File

@ -18,6 +18,19 @@
</h1> </h1>
</div> </div>
<!-- Your main content goes below here: --> <!-- Your main content goes below here: -->
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="row"> <div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
<div id="panel-5" class="panel"> <div id="panel-5" class="panel">
@ -227,8 +240,19 @@
} }
//#endregion //#endregion
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
//#region 裝置類型列表 DataTable //#region 裝置類型列表 DataTable
showLoading();
SensorTypeDeviceTable = $("#SensorType_table").DataTable({ SensorTypeDeviceTable = $("#SensorType_table").DataTable({
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
@ -288,6 +312,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -297,11 +322,12 @@
if (data == null || data.length == 0) { if (data == null || data.length == 0) {
this.data = []; this.data = [];
} }
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
@ -310,6 +336,7 @@
//#region 儲存裝置類型資料 //#region 儲存裝置類型資料
function SaveSensorType() { function SaveSensorType() {
showLoading();
var url = "/SensorType/SaveSensorType"; var url = "/SensorType/SaveSensorType";
if ($("#SensorType-form").valid()) { if ($("#SensorType-form").valid()) {
var send_data = { var send_data = {
@ -320,10 +347,12 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
else { else {
hideLoading();
toast_ok(rel.msg); toast_ok(rel.msg);
$('#SensorType-modal').modal('hide'); $('#SensorType-modal').modal('hide');
SensorTypeDeviceTable.ajax.reload(); SensorTypeDeviceTable.ajax.reload();
@ -349,12 +378,14 @@
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
//取得單一系統管理員 //取得單一系統管理員
showLoading();
var url = "/SensorType/DeleteOneSensorType/"; var url = "/SensorType/DeleteOneSensorType/";
var send_data = { var send_data = {
Id: selected_id Id: selected_id
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -363,6 +394,7 @@
SensorTypeDeviceTable.ajax.reload(); SensorTypeDeviceTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -377,6 +409,7 @@
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
//取得單一裝置 //取得單一裝置
showLoading();
var url = "/SensorType/GetOneSensorType/"; var url = "/SensorType/GetOneSensorType/";
var send_data = { var send_data = {
@ -385,10 +418,12 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
else if (rel.code == "9998") { else if (rel.code == "9998") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -398,6 +433,7 @@
$("#SensorType_Enabled_modal").val(rel.data.enabled); $("#SensorType_Enabled_modal").val(rel.data.enabled);
$("#SensorType-modal").modal(); $("#SensorType-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
@ -413,6 +449,7 @@
//取得單一裝置 //取得單一裝置
showLoading();
var url = "/SensorType/GetOneSensorType/"; var url = "/SensorType/GetOneSensorType/";
var send_data = { var send_data = {
@ -421,10 +458,12 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
else if (rel.code == "9998") { else if (rel.code == "9998") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -433,12 +472,14 @@
$("#SensorDetail_SensorType_modal").val(rel.data.sensorName); $("#SensorDetail_SensorType_modal").val(rel.data.sensorName);
$("#SensorDetail-modal").modal(); $("#SensorDetail-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
//#endregion //#endregion
//#region 儲存裝置細項資料 //#region 儲存裝置細項資料
function SaveSensorDetail() { function SaveSensorDetail() {
showLoading();
var url = "/SensorType/SaveSensorDetail"; var url = "/SensorType/SaveSensorDetail";
if ($("#SensorDetail-form").valid()) { if ($("#SensorDetail-form").valid()) {
var send_data = { var send_data = {
@ -455,6 +496,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -462,6 +504,7 @@
toast_ok(rel.msg); toast_ok(rel.msg);
$('#SensorDetail-modal').modal('hide'); $('#SensorDetail-modal').modal('hide');
SensorTypeDeviceTable.ajax.reload(); SensorTypeDeviceTable.ajax.reload();
hideLoading();
return; return;
} }
}, 'json'); }, 'json');
@ -474,17 +517,18 @@
var send_data = { var send_data = {
Id: id Id: id
} }
showLoading();
var url_sensorType_info = "/SensorType/GetOneSensorType"; var url_sensorType_info = "/SensorType/GetOneSensorType";
$.post(url_sensorType_info, send_data, function (rel) { $.post(url_sensorType_info, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
$("#sensor-detail-modal .modal-title").html(rel.data.sensorName + "- 細項"); $("#sensor-detail-modal .modal-title").html(rel.data.sensorName + "- 細項");
hideLoading();
}, 'json'); }, 'json');
UpdateSensorDetailTable(id, function (returnData) { UpdateSensorDetailTable(id, function (returnData) {
@ -496,6 +540,7 @@
//#endregion //#endregion
function UpdateSensorDetailTable(sensorType_id, callback) { function UpdateSensorDetailTable(sensorType_id, callback) {
showLoading();
var url = "/SensorType/GetSensorDetail"; var url = "/SensorType/GetSensorDetail";
var send_data = { var send_data = {
Id: sensorType_id Id: sensorType_id
@ -503,6 +548,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
callback(false); callback(false);
} }
@ -529,6 +575,7 @@
SensorTypeDeviceTable.ajax.reload(); SensorTypeDeviceTable.ajax.reload();
callback(true); callback(true);
hideLoading();
}, 'json'); }, 'json');
} }
@ -548,12 +595,14 @@
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
//取得單一裝置細項 //取得單一裝置細項
showLoading();
var url = "/SensorType/DeleteOneSensorDetail/"; var url = "/SensorType/DeleteOneSensorDetail/";
var send_data = { var send_data = {
Id: selected_id Id: selected_id
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -561,6 +610,7 @@
del_btn.parents("tr").remove(); del_btn.parents("tr").remove();
toast_ok(rel.msg); toast_ok(rel.msg);
sensorDetailTable.ajax.reload(); sensorDetailTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });

View File

@ -11,6 +11,19 @@
</ol> </ol>
<!-- Your main content goes below here: --> <!-- Your main content goes below here: -->
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="row"> <div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
<div id="panel-5" class="panel"> <div id="panel-5" class="panel">
@ -304,12 +317,23 @@
var AllidsType = true; var AllidsType = true;
var StatusType = true; var StatusType = true;
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
status123 = []; status123 = [];
showLoading();
var city_url = "/StationOverview/GetMyCities"; var city_url = "/StationOverview/GetMyCities";
$.post(city_url, function (rel) { $.post(city_url, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -325,6 +349,7 @@
} }
getStation(ids); getStation(ids);
hideLoading();
}, 'json'); }, 'json');
}); });
@ -390,9 +415,11 @@
$("#update_at").html(0); $("#update_at").html(0);
} }
else { else {
showLoading();
var Nurl = "/StationOverview/GetPowerStationByFilter"; var Nurl = "/StationOverview/GetPowerStationByFilter";
$.post(Nurl, send_data, function (rel) { $.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -476,6 +503,7 @@
'</tr>'); '</tr>');
}); });
GetStationCard(rel.data); GetStationCard(rel.data);
hideLoading();
}, 'json'); }, 'json');
} }

View File

@ -13,6 +13,18 @@
<li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li> <li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li>
</ol>*@ </ol>*@
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="row"> <div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
<div id="panel-5" class="panel"> <div id="panel-5" class="panel">
@ -172,6 +184,16 @@
var HeapMapXAxis = []; var HeapMapXAxis = [];
var countOperationRecordFile = 0; var countOperationRecordFile = 0;
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
var url = new URL(location.href); var url = new URL(location.href);
@ -221,9 +243,11 @@
//#endregion //#endregion
//#region 預先載入公司下拉式選單select_option //#region 預先載入公司下拉式選單select_option
showLoading();
var url_company_select_option = "/Company/GetCompanySelectOptionList"; var url_company_select_option = "/Company/GetCompanySelectOptionList";
$.get(url_company_select_option, function (rel) { $.get(url_company_select_option, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -236,16 +260,19 @@
//預設查詢自己的公司 //預設查詢自己的公司
$("#select_power_station_company").val(@ViewBag.myUser.CompanyId).trigger('change'); $("#select_power_station_company").val(@ViewBag.myUser.CompanyId).trigger('change');
hideLoading();
}); });
//#endregion //#endregion
//#region 即時資訊tab //#region 即時資訊tab
showLoading();
var url = "/StationOverview/GetOneStationUpToDateInfo"; var url = "/StationOverview/GetOneStationUpToDateInfo";
var send_data = { var send_data = {
ids: [stationId] ids: [stationId]
}; };
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -303,10 +330,11 @@
$("#money-card-subtitle-total").html("總省電費用"); $("#money-card-subtitle-total").html("總省電費用");
$("#money-card-subtitle-avg").html("今日省電費用"); $("#money-card-subtitle-avg").html("今日省電費用");
} }
hideLoading();
}, 'json'); }, 'json');
//#region 載入電站圖片 //#region 載入電站圖片
showLoading();
var url_image = "/PowerStation/GetAllPowerStationsALLImage"; var url_image = "/PowerStation/GetAllPowerStationsALLImage";
var send_data = { var send_data = {
powerStationId: stationId powerStationId: stationId
@ -314,6 +342,7 @@
$.post(url_image, send_data, function (rel) { $.post(url_image, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -327,17 +356,19 @@
carouselExampleIndicators.find(".carousel-indicators > li").first().addClass("active"); carouselExampleIndicators.find(".carousel-indicators > li").first().addClass("active");
carouselExampleIndicators.find(".carousel-inner > .carousel-item").first().addClass("active"); carouselExampleIndicators.find(".carousel-inner > .carousel-item").first().addClass("active");
hideLoading();
}, 'json'); }, 'json');
//#endregion //#endregion
//#region 載入圖表資料 //#region 載入圖表資料
showLoading();
var url = "/StationOverview/GetChartUpToDate"; var url = "/StationOverview/GetChartUpToDate";
var send_data = { var send_data = {
id: stationId id: stationId
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -714,6 +745,7 @@
} }
}); });
//#endregion //#endregion
hideLoading();
}, 'json'); }, 'json');
//#endregion //#endregion
@ -728,12 +760,14 @@
//#endregion //#endregion
//#region 基本資料tab //#region 基本資料tab
showLoading();
var url = "/PowerStation/GetOnePowerStation" var url = "/PowerStation/GetOnePowerStation"
var send_data = { var send_data = {
id: stationId id: stationId
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -757,10 +791,11 @@
$("#power_station_select_modal").append($("<option />").val(stationId).text(powerStationData.name)); $("#power_station_select_modal").append($("<option />").val(stationId).text(powerStationData.name));
$("#power_station_select_modal").val($("#power_station_select_modal option:first").val()).trigger('change'); $("#power_station_select_modal").val($("#power_station_select_modal option:first").val()).trigger('change');
hideLoading();
}, 'json'); }, 'json');
//#region 載入單線圖 //#region 載入單線圖
showLoading();
var url_image = "/PowerStation/GetAllPowerStationSingleLine"; var url_image = "/PowerStation/GetAllPowerStationSingleLine";
var send_data = { var send_data = {
powerStationId: stationId powerStationId: stationId
@ -768,6 +803,7 @@
$.post(url_image, send_data, function (rel) { $.post(url_image, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -783,11 +819,12 @@
}); });
hideLoading();
}, 'json'); }, 'json');
//#endregion //#endregion
//#region 預先載入運維人員下拉式選單select_option //#region 預先載入運維人員下拉式選單select_option
showLoading();
var url_user_select_option = "/PowerStation/GetUserSelectOptionList"; var url_user_select_option = "/PowerStation/GetUserSelectOptionList";
var send_data = { var send_data = {
@ -796,6 +833,7 @@
$.get(url_user_select_option, send_data, function (rel) { $.get(url_user_select_option, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -809,6 +847,7 @@
if (powerStationData) { if (powerStationData) {
$("#power_station_operation_personnel").val(powerStationData.operationPersonnelIds); $("#power_station_operation_personnel").val(powerStationData.operationPersonnelIds);
} }
hideLoading();
}); });
$('.js-example-basic-multiple').select2(); $('.js-example-basic-multiple').select2();
@ -857,6 +896,7 @@
//#region 運維作業記錄 DataTable //#region 運維作業記錄 DataTable
powerids.push(stationId); powerids.push(stationId);
showLoading();
operationRecordTable = $("#operation_record_table").DataTable({ operationRecordTable = $("#operation_record_table").DataTable({
"pageLength": 20, "pageLength": 20,
"paging": true, "paging": true,
@ -940,6 +980,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -950,10 +991,12 @@
this.data = []; this.data = [];
} }
$('#operation_record_table_wrapper').show(); $('#operation_record_table_wrapper').show();
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
@ -963,6 +1006,7 @@
$("#power_station_select_modal").change(function () { $("#power_station_select_modal").change(function () {
//查詢該電站的運維人員 //查詢該電站的運維人員
showLoading();
var url_power_station_operation_personnel = "/PowerStation/GetOperationPersonnelSelectOptionList"; var url_power_station_operation_personnel = "/PowerStation/GetOperationPersonnelSelectOptionList";
send_data = { send_data = {
@ -971,6 +1015,7 @@
$.post(url_power_station_operation_personnel, send_data, function (rel) { $.post(url_power_station_operation_personnel, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -989,13 +1034,16 @@
} }
$("#work_person_select_modal").select2({ dropdownParent: $('#record-form-modal') }); $("#work_person_select_modal").select2({ dropdownParent: $('#record-form-modal') });
hideLoading();
}); });
//查詢該電站的廠商 //查詢該電站的廠商
showLoading();
var url_power_station_firm = "/PowerStation/GetFirmSelectOptionList"; var url_power_station_firm = "/PowerStation/GetFirmSelectOptionList";
$.post(url_power_station_firm, send_data, function (rel) { $.post(url_power_station_firm, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1013,6 +1061,7 @@
if (record != undefined && record != null) { if (record != undefined && record != null) {
$("#fix_firm_select_modal").val(record.fixFirm) $("#fix_firm_select_modal").val(record.fixFirm)
} }
hideLoading();
}); });
}); });
//#endregion //#endregion
@ -1026,12 +1075,14 @@
LoadInvertAnalysiskwhBar(); LoadInvertAnalysiskwhBar();
//#region 載入電站逆變器資料 //#region 載入電站逆變器資料
showLoading();
var url = "/StationOverview/GetInverterCheckBox"; var url = "/StationOverview/GetInverterCheckBox";
var send_data = { var send_data = {
id: stationId id: stationId
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1046,19 +1097,21 @@
}); });
SelectAllInvert(); SelectAllInvert();
hideLoading();
}, 'json'); }, 'json');
//#endregion //#endregion
//#endregion //#endregion
//#region 維修單運維人員(異常紀錄) //#region 維修單運維人員(異常紀錄)
showLoading();
var url_power_station_operation_personnel = "/PowerStation/GetOperationPersonnelSelectOptionList"; var url_power_station_operation_personnel = "/PowerStation/GetOperationPersonnelSelectOptionList";
send_data = { send_data = {
PowerStationId: stationId PowerStationId: stationId
} }
$.post(url_power_station_operation_personnel, send_data, function (rel) { $.post(url_power_station_operation_personnel, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1074,10 +1127,12 @@
$("#work_person_select_modal_exc").val(record.workPersonId); $("#work_person_select_modal_exc").val(record.workPersonId);
} }
} }
hideLoading();
}); });
//#endregion //#endregion
//#region 異常table //#region 異常table
showLoading();
ExceptionTable = $("#Exception_Table").DataTable({ ExceptionTable = $("#Exception_Table").DataTable({
"pageLength": 20, "pageLength": 20,
"paging": true, "paging": true,
@ -1141,6 +1196,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -1149,10 +1205,12 @@
this.data = []; this.data = [];
} }
$("#Exception_Table_wrapper").show(); $("#Exception_Table_wrapper").show();
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
@ -1190,6 +1248,7 @@
//#endregion //#endregion
function GetPowerStationCollapse(filter) { function GetPowerStationCollapse(filter) {
showLoading();
var url = "/StationOverview/GetPowerStationCollapse" var url = "/StationOverview/GetPowerStationCollapse"
var send_data = { var send_data = {
@ -1198,6 +1257,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -1240,7 +1300,7 @@
$('#js_list_accordion').append(str); $('#js_list_accordion').append(str);
$('#js_list_accordion').find('.card').first().addClass(" border-top-left-radius-0 border-top-right-radius-0"); $('#js_list_accordion').find('.card').first().addClass(" border-top-left-radius-0 border-top-right-radius-0");
hideLoading();
}, 'json'); }, 'json');
} }
@ -1283,6 +1343,7 @@
//#region 匯出excel(異常) //#region 匯出excel(異常)
function ExportExcelToExc() { function ExportExcelToExc() {
showLoading();
var url = "/StationOverview/GetExceptionTable"; var url = "/StationOverview/GetExceptionTable";
var send_data = { var send_data = {
id: stationId, id: stationId,
@ -1291,6 +1352,7 @@
}; };
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.data.code != "0000") { if (rel.data.code != "0000") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -1321,6 +1383,7 @@
//檔案字尾名 //檔案字尾名
fileext: ".xls", fileext: ".xls",
}); });
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion
@ -1331,6 +1394,7 @@
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
errortoID = $(this).parents('tr').attr('data-error'); errortoID = $(this).parents('tr').attr('data-error');
//取得單一記錄表單 //取得單一記錄表單
showLoading();
var url = "/Operation/GetOneOperationRecord/"; var url = "/Operation/GetOneOperationRecord/";
var send_data = { var send_data = {
@ -1339,6 +1403,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1376,6 +1441,7 @@
}); });
$("#exception-form-modal").modal(); $("#exception-form-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
//#endregion //#endregion
@ -1417,6 +1483,7 @@
function SaveException() { function SaveException() {
if ($("#record-form-exc").valid()) { if ($("#record-form-exc").valid()) {
showLoading();
var url = "/Operation/SaveOperationRecord"; var url = "/Operation/SaveOperationRecord";
var formData = new FormData(); var formData = new FormData();
@ -1441,6 +1508,7 @@
processData: false, processData: false,
success: function (rel) { success: function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1453,6 +1521,7 @@
myDropzone.on("successmultiple", function (file, rel) { myDropzone.on("successmultiple", function (file, rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1469,6 +1538,7 @@
ExceptionTable.ajax.reload(); ExceptionTable.ajax.reload();
} }
hideLoading();
} }
}); });
} }
@ -1547,6 +1617,7 @@
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
//取得單一記錄表單 //取得單一記錄表單
showLoading();
var url = "/Operation/GetOneOperationRecord/"; var url = "/Operation/GetOneOperationRecord/";
var send_data = { var send_data = {
@ -1555,6 +1626,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1597,6 +1669,7 @@
}); });
$("#EmailcheckBox").prop("checked", false); $("#EmailcheckBox").prop("checked", false);
$("#record-form-modal").modal(); $("#record-form-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
//#endregion //#endregion
@ -1679,6 +1752,7 @@
if ($("#record-form").valid()) { if ($("#record-form").valid()) {
// 鎖定按鈕 // 鎖定按鈕
$("#save-record-op-btn").attr('disabled', true); $("#save-record-op-btn").attr('disabled', true);
showLoading();
var url = "/Operation/SaveOperationRecord"; var url = "/Operation/SaveOperationRecord";
var formData = new FormData(); var formData = new FormData();
@ -1712,6 +1786,7 @@
processData: false, processData: false,
success: function (rel) { success: function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1724,6 +1799,7 @@
myDropzone.on("successmultiple", function (file, rel) { myDropzone.on("successmultiple", function (file, rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1744,6 +1820,7 @@
toast_ok("修改完成"); toast_ok("修改完成");
// 取消鎖定按鈕 // 取消鎖定按鈕
$("#save-record-op-btn").attr('disabled', false); $("#save-record-op-btn").attr('disabled', false);
hideLoading();
} }
}); });
} }
@ -1769,6 +1846,7 @@
//#region 匯出excel(運維) //#region 匯出excel(運維)
function ExportExcel() { function ExportExcel() {
showLoading();
var url = "/Operation/ExportOperationRecordExcel"; var url = "/Operation/ExportOperationRecordExcel";
var send_data = { var send_data = {
WorkType: Type, WorkType: Type,
@ -1776,6 +1854,7 @@
}; };
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1824,6 +1903,7 @@
//檔案字尾名 //檔案字尾名
fileext: ".xls", fileext: ".xls",
}); });
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion
@ -2093,6 +2173,7 @@
}).get(); }).get();
//#region HeatMap //#region HeatMap
showLoading();
var url = "/StationOverview/GetInverterHeatMapAnalysis"; var url = "/StationOverview/GetInverterHeatMapAnalysis";
var send_data = { var send_data = {
PowerStationId: stationId, PowerStationId: stationId,
@ -2100,6 +2181,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2176,6 +2258,7 @@
}); });
$('#InverterResult').removeAttr("style", "display:none !important;"); $('#InverterResult').removeAttr("style", "display:none !important;");
hideLoading();
}, 'json'); }, 'json');
//#endregion //#endregion
@ -2256,6 +2339,7 @@
$('#inverter-kWh-convas-div').hide(); $('#inverter-kWh-convas-div').hide();
var url = "/StationOverview/GetInverterkwhBarAnalysis"; var url = "/StationOverview/GetInverterkwhBarAnalysis";
showLoading();
var send_data = { var send_data = {
PowerStationId: stationId, PowerStationId: stationId,
SelectedType: selectInverterkwhBarType, SelectedType: selectInverterkwhBarType,
@ -2264,6 +2348,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2282,8 +2367,7 @@
data: kwhBar.datasets[key], data: kwhBar.datasets[key],
backgroundColor: bgColorlist[index], backgroundColor: bgColorlist[index],
} }
hideLoading();
return dataset;
}); });
$('#inverter-kWh-convas-div').empty(); $('#inverter-kWh-convas-div').empty();
@ -2318,7 +2402,7 @@
//#endregion //#endregion
$('#inverter-kWh-convas-div').show(); $('#inverter-kWh-convas-div').show();
hideLoading();
}, 'json'); }, 'json');
} }
@ -2540,9 +2624,11 @@
PowerstationId: stationId PowerstationId: stationId
} }
//0:日 1:月 2:年 3:歷年 4:dateRange 選擇不同天(採用月的方式顯示) //0:日 1:月 2:年 3:歷年 4:dateRange 選擇不同天(採用月的方式顯示)
showLoading();
var Nurl = "/StationOverview/GetTotalTableToHistory"; var Nurl = "/StationOverview/GetTotalTableToHistory";
$.post(Nurl, send_data, function (rel) { $.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2790,6 +2876,7 @@
'</tr>'); '</tr>');
} }
$('#all').show(); $('#all').show();
hideLoading();
}) })
} }
@ -2798,6 +2885,7 @@
function GetInverterCard(stationId) { function GetInverterCard(stationId) {
showLoading();
var url = "/PowerStation/GetOnePowerStation/"; var url = "/PowerStation/GetOnePowerStation/";
var send_data = { var send_data = {
@ -2805,6 +2893,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -2880,11 +2969,13 @@
stationDB = rel.data.siteDB; stationDB = rel.data.siteDB;
InverterInfoList(); InverterInfoList();
hideLoading();
}, 'json'); }, 'json');
}; };
function InverterInfoList() { function InverterInfoList() {
showLoading();
var url = "/PowerStation/GetInverterInfoList/"; var url = "/PowerStation/GetInverterInfoList/";
var send_data = { var send_data = {
id: stationId, id: stationId,
@ -2892,10 +2983,12 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
if (rel.code == "0001") { if (rel.code == "0001") {
hideLoading();
toast_warning(rel.msg); toast_warning(rel.msg);
return; return;
} }
@ -3020,10 +3113,12 @@
} }
}; };
hideLoading();
}); });
} }
function InverterInfoDetail(id, time, db, table) { function InverterInfoDetail(id, time, db, table) {
showLoading();
var url = "/PowerStation/GetInverterInfoModal/"; var url = "/PowerStation/GetInverterInfoModal/";
var send_data = { var send_data = {
Id: id, Id: id,
@ -3033,6 +3128,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -3089,7 +3185,7 @@
$("#inverterdetailmodal").modal(); $("#inverterdetailmodal").modal();
hideLoading();
}) })

View File

@ -6,6 +6,18 @@
@using SolarPower.Models.Role @using SolarPower.Models.Role
@model RoleLayerEnum @model RoleLayerEnum
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="container-fluid"> <div class="container-fluid">
<div class="row flex-nowrap wrapper"> <div class="row flex-nowrap wrapper">
<div class="col-md-2 col-1 pl-0 pr-0 collapse width border-right sidebar vh-100 overflow-auto"> <div class="col-md-2 col-1 pl-0 pr-0 collapse width border-right sidebar vh-100 overflow-auto">
@ -313,6 +325,17 @@
var nowform; var nowform;
var xxx; var xxx;
var button; var button;
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
//#region 預設初始值 //#region 預設初始值
$('#collapse').trigger("click"); $('#collapse').trigger("click");
@ -593,6 +616,7 @@
function GetPowerStationCollapse(filter) { function GetPowerStationCollapse(filter) {
showLoading();
var url = "/StationReport/GetPowerStationCollapse" var url = "/StationReport/GetPowerStationCollapse"
var send_data = { var send_data = {
@ -601,6 +625,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -682,7 +707,7 @@
}); });
$("#js_list_accordion .collapse").collapse('show'); $("#js_list_accordion .collapse").collapse('show');
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion
@ -727,9 +752,11 @@
break; break;
} }
showLoading();
var url = "/StationReport/GetTableHead"; var url = "/StationReport/GetTableHead";
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_warning(rel.msg); toast_warning(rel.msg);
switch (form) { switch (form) {
@ -842,6 +869,7 @@
//綜合報表 //綜合報表
maxtableinfobody(rel.data.showMoney); maxtableinfobody(rel.data.showMoney);
} }
hideLoading();
}, 'json'); }, 'json');
} }
@ -870,6 +898,7 @@
FormType: form, FormType: form,
PowerStation: nowpowerstation PowerStation: nowpowerstation
} }
showLoading();
var url = "/StationReport/GetForm"; var url = "/StationReport/GetForm";
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
@ -905,6 +934,7 @@
} }
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
if (rel.code == "9985") { if (rel.code == "9985") {
toast_warning(rel.msg); toast_warning(rel.msg);
} else { } else {
@ -1090,6 +1120,7 @@
var posturl = "/StationReport/GetHireInfo"; var posturl = "/StationReport/GetHireInfo";
$.post(posturl, dataTosent, function (rel) { $.post(posturl, dataTosent, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -1210,6 +1241,7 @@
var posturl = "/StationReport/GetHireInfo"; var posturl = "/StationReport/GetHireInfo";
$.post(posturl, dataTosent, function (rel) { $.post(posturl, dataTosent, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -1240,6 +1272,7 @@
$('#all').show(); $('#all').show();
nowform = form; nowform = form;
hideLoading();
}, 'json'); }, 'json');
} }
@ -1252,12 +1285,14 @@
PowerStation: selecterd_invert PowerStation: selecterd_invert
} }
if (send_data.FormType != null && send_data.PowerStation.length != 0 && send_data.FormType != 2) { if (send_data.FormType != null && send_data.PowerStation.length != 0 && send_data.FormType != 2) {
showLoading();
$.post("/StationReport/CheckExcel", send_data, function (rel) { $.post("/StationReport/CheckExcel", send_data, function (rel) {
if (rel.code == "0000") { if (rel.code == "0000") {
//window.location = "/StationReport/ExportExcel?post=" + JSON.stringify(send_data); //window.location = "/StationReport/ExportExcel?post=" + JSON.stringify(send_data);
$("#post").val(JSON.stringify(send_data)); $("#post").val(JSON.stringify(send_data));
document.report.action = "StationReport/ExportExcel"; document.report.action = "StationReport/ExportExcel";
document.report.submit(); document.report.submit();
hideLoading();
return; return;
} }
else else
@ -1272,6 +1307,7 @@
icon: 'warning', icon: 'warning',
html: text, html: text,
}); });
hideLoading();
} }
}, 'json'); }, 'json');
} }
@ -1296,6 +1332,7 @@
FormType: 2, FormType: 2,
PowerStation: selecterd_invert PowerStation: selecterd_invert
} }
showLoading();
var url = "/StationReport/GetMaxForm"; var url = "/StationReport/GetMaxForm";
var StrInfoBody = ""; var StrInfoBody = "";
var CityArray = []; var CityArray = [];
@ -1306,6 +1343,7 @@
var kwp = 0; var kwp = 0;
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_warning(rel.msg); toast_warning(rel.msg);
return; return;
} }
@ -1437,6 +1475,7 @@
nowform = 2; nowform = 2;
$('#all').show(); $('#all').show();
hideLoading();
}) })
} }
@ -1448,6 +1487,7 @@
Sitedb: db, Sitedb: db,
PowerstationId: id PowerstationId: id
} }
showLoading();
var posturl = "/StationReport/GetHireInfo"; var posturl = "/StationReport/GetHireInfo";
$.ajax({ $.ajax({
url: posturl, url: posturl,
@ -1460,6 +1500,7 @@
$.each(response.data, function (index, value) { $.each(response.data, function (index, value) {
hirerate += Number(value.leaseRate); hirerate += Number(value.leaseRate);
}) })
hideLoading();
} }
}); });
return hirerate; return hirerate;

View File

@ -11,6 +11,18 @@
<li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li> <li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li>
</ol> </ol>
<link rel="stylesheet" href="~/css/loading.css" />
<div class="loadEffect" id="loading" style="top: 10%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="row"> <div class="row">
<div class="col-xl-12"> <div class="col-xl-12">
<div id="panel-5" class="panel"> <div id="panel-5" class="panel">
@ -50,13 +62,26 @@
var userTable; var roleTable; var roleAuthTable; var roleAuthNotJoinTable; var userTable; var roleTable; var roleAuthTable; var roleAuthNotJoinTable;
var selected_id = 0, selected_role_id = 0, selected_company_id = 0; var selected_id = 0, selected_role_id = 0, selected_company_id = 0;
var selected_tab = ""; var selected_tab = "";
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$(function () { $(function () {
selected_tab = $('#tabs').find("li a.active").attr("href"); // 當前tab selected_tab = $('#tabs').find("li a.active").attr("href"); // 當前tab
//#region 預先載入公司下拉式選單select_option //#region 預先載入公司下拉式選單select_option
showLoading();
var url_company_select_option = "/Company/GetCompanySelectOptionList"; var url_company_select_option = "/Company/GetCompanySelectOptionList";
$.get(url_company_select_option, function (rel) { $.get(url_company_select_option, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -69,7 +94,7 @@
//預設查詢第一個 //預設查詢第一個
$(".select_user_company").val($(".select_user_company option:first").val()).trigger('change'); $(".select_user_company").val($(".select_user_company option:first").val()).trigger('change');
hideLoading();
}); });
//#endregion //#endregion
@ -101,6 +126,7 @@
} }
//查詢該公司的基本資料 //查詢該公司的基本資料
showLoading();
var url_company_info = "/Company/GetOneCompany" var url_company_info = "/Company/GetOneCompany"
var send_data = { var send_data = {
@ -109,6 +135,7 @@
$.post(url_company_info, send_data, function (rel) { $.post(url_company_info, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -117,6 +144,7 @@
$("#company-name").html(rel.data.name); $("#company-name").html(rel.data.name);
$("#company-modal").modal(); $("#company-modal").modal();
hideLoading();
}, 'json'); }, 'json');
//更新當前剩餘可註冊使用者人數 //更新當前剩餘可註冊使用者人數
@ -148,6 +176,7 @@
//#endregion //#endregion
//#region 使用者列表 DataTable //#region 使用者列表 DataTable
showLoading();
userTable = $("#user_table").DataTable({ userTable = $("#user_table").DataTable({
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
@ -223,6 +252,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -232,17 +262,19 @@
if (data == null || data.length == 0) { if (data == null || data.length == 0) {
this.data = []; this.data = [];
} }
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
//#endregion //#endregion
//#region 角色管理列表 DataTable //#region 角色管理列表 DataTable
showLoading();
roleTable = $("#role_table").DataTable({ roleTable = $("#role_table").DataTable({
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
@ -301,6 +333,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -310,17 +343,19 @@
if (data == null || data.length == 0) { if (data == null || data.length == 0) {
this.data = []; this.data = [];
} }
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
//#endregion //#endregion
//#region 角色權限列表 DataTable //#region 角色權限列表 DataTable
showLoading();
roleAuthTable = $("#roleAuth_table").DataTable({ roleAuthTable = $("#roleAuth_table").DataTable({
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
@ -402,6 +437,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -411,17 +447,19 @@
if (data == null || data.length == 0) { if (data == null || data.length == 0) {
this.data = []; this.data = [];
} }
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
//#endregion //#endregion
//#region 角色未加入權限列表 DataTable //#region 角色未加入權限列表 DataTable
showLoading();
roleAuthNotJoinTable = $("#roleAuth_NotJoin_table").DataTable({ roleAuthNotJoinTable = $("#roleAuth_NotJoin_table").DataTable({
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
@ -489,6 +527,7 @@
}, },
"dataSrc": function (rel) { "dataSrc": function (rel) {
if (rel.data.code == "9999") { if (rel.data.code == "9999") {
hideLoading();
toast_error(rel.data.msg); toast_error(rel.data.msg);
return; return;
} }
@ -498,11 +537,12 @@
if (data == null || data.length == 0) { if (data == null || data.length == 0) {
this.data = []; this.data = [];
} }
hideLoading();
return data; return data;
} }
}, },
"error": function (xhr, error, thrown) { "error": function (xhr, error, thrown) {
hideLoading();
console.log(xhr); console.log(xhr);
} }
}); });
@ -574,6 +614,7 @@
selected_id = $(this).parents('tr').attr('data-id'); selected_id = $(this).parents('tr').attr('data-id');
//取得單一使用者管理員 //取得單一使用者管理員
showLoading();
var url = "/User/GetOneUser/"; var url = "/User/GetOneUser/";
var send_data = { var send_data = {
@ -582,10 +623,12 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
else if (rel.code == "9998") { else if (rel.code == "9998") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -605,6 +648,7 @@
$(".user-password-div").hide(); $(".user-password-div").hide();
$("#user-modal").modal(); $("#user-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
@ -631,6 +675,7 @@
function SaveUser() { function SaveUser() {
if ($("#user-form").valid()) { if ($("#user-form").valid()) {
showLoading();
var url = "/User/SaveUser"; var url = "/User/SaveUser";
@*var send_data = { @*var send_data = {
@ -681,6 +726,7 @@
processData: false, processData: false,
success: function (rel) { success: function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -692,6 +738,7 @@
UpdateRegisterNumber($("#user_companyId_modal").val()); UpdateRegisterNumber($("#user_companyId_modal").val());
userTable.ajax.reload(); userTable.ajax.reload();
hideLoading();
} }
}); });
} }
@ -713,12 +760,14 @@
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
//取得單一系統管理員 //取得單一系統管理員
showLoading();
var url = "/User/DeleteOneUser/"; var url = "/User/DeleteOneUser/";
var send_data = { var send_data = {
Id: selected_id Id: selected_id
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -729,6 +778,7 @@
UpdateRegisterNumber($("#select_user_company_userManager_tab").val()); UpdateRegisterNumber($("#select_user_company_userManager_tab").val());
userTable.ajax.reload(); userTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -737,7 +787,7 @@
//#region 更新公司當前剩餘註冊數量 //#region 更新公司當前剩餘註冊數量
function UpdateRegisterNumber(companyId) { function UpdateRegisterNumber(companyId) {
showLoading();
var url = "/Company/GetRemainingRegisterNumber" var url = "/Company/GetRemainingRegisterNumber"
var send_data = { var send_data = {
@ -746,6 +796,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -756,6 +807,7 @@
} else { } else {
$("#addUser-btn").show(); $("#addUser-btn").show();
} }
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion
@ -765,17 +817,18 @@
var send_data = { var send_data = {
Id: id Id: id
} }
showLoading();
var url_user_info = "/User/GetOneUser"; var url_user_info = "/User/GetOneUser";
$.post(url_user_info, send_data, function (rel) { $.post(url_user_info, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
$("#user-power-station-modal .modal-title").html(rel.data.companyName + "" + rel.data.name); $("#user-power-station-modal .modal-title").html(rel.data.companyName + "" + rel.data.name);
hideLoading();
}, 'json'); }, 'json');
UpdateUserPowerStationTable(id, function (returnData) { UpdateUserPowerStationTable(id, function (returnData) {
@ -804,12 +857,14 @@
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
//取得單一系統管理員 //取得單一系統管理員
showLoading();
var url = "/User/DeleteOneUserPowerStation/"; var url = "/User/DeleteOneUserPowerStation/";
var send_data = { var send_data = {
Id: selected_id Id: selected_id
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -817,6 +872,7 @@
del_btn.parents("tr").remove(); del_btn.parents("tr").remove();
toast_ok(rel.msg); toast_ok(rel.msg);
userTable.ajax.reload(); userTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -844,7 +900,7 @@
check = 0; check = 0;
} }
showLoading();
var url = "/User/DeleteOneGetEmail/"; var url = "/User/DeleteOneGetEmail/";
var send_data = { var send_data = {
Id: selected_id, Id: selected_id,
@ -853,11 +909,12 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
hideLoading();
}, 'json'); }, 'json');
}) })
@ -866,7 +923,7 @@
function AddUserPowerStation(e) { function AddUserPowerStation(e) {
var user_id = $(e).attr("data-user-id"); var user_id = $(e).attr("data-user-id");
showLoading();
var url = "/User/GetUserCompanyPowerStation"; var url = "/User/GetUserCompanyPowerStation";
var send_data = { var send_data = {
Id: user_id Id: user_id
@ -874,6 +931,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -895,6 +953,7 @@
$("#add-user-manager-station-modal").modal(); $("#add-user-manager-station-modal").modal();
userTable.ajax.reload(); userTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
@ -907,6 +966,7 @@
var save_btn = $(this); var save_btn = $(this);
//取得單一系統管理員 //取得單一系統管理員
showLoading();
var url = "/User/SaveUserPowerStation/"; var url = "/User/SaveUserPowerStation/";
var send_data = { var send_data = {
PowerStationId: selected_power_station_id, PowerStationId: selected_power_station_id,
@ -914,6 +974,7 @@
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -922,11 +983,13 @@
toast_ok(rel.msg); toast_ok(rel.msg);
UpdateUserPowerStationTable(selected_user_id); UpdateUserPowerStationTable(selected_user_id);
hideLoading();
}, 'json'); }, 'json');
}); });
function UpdateUserPowerStationTable(user_id, callback) { function UpdateUserPowerStationTable(user_id, callback) {
showLoading();
var url = "/User/GetUserPowerStation"; var url = "/User/GetUserPowerStation";
var send_data = { var send_data = {
Id: user_id Id: user_id
@ -934,6 +997,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
callback(false); callback(false);
} }
@ -979,6 +1043,7 @@
userPowerStationTable.append(str); userPowerStationTable.append(str);
}); });
hideLoading();
userTable.ajax.reload(); userTable.ajax.reload();
callback(true); callback(true);
}, 'json'); }, 'json');
@ -1015,6 +1080,7 @@
selected_role_id = $(this).parents('tr').attr('data-id'); selected_role_id = $(this).parents('tr').attr('data-id');
//取得單一公司角色資料 //取得單一公司角色資料
showLoading();
var url = "/Role/GetOneRole/"; var url = "/Role/GetOneRole/";
var send_data = { var send_data = {
@ -1023,10 +1089,12 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code == "9999") { if (rel.code == "9999") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
else if (rel.code == "9998") { else if (rel.code == "9998") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1036,6 +1104,7 @@
$("#role_name_modal").val(rel.data.name); $("#role_name_modal").val(rel.data.name);
$("#role-modal").modal(); $("#role-modal").modal();
hideLoading();
}, 'json'); }, 'json');
}); });
@ -1058,6 +1127,7 @@
function SaveRole() { function SaveRole() {
if ($("#role-form").valid()) { if ($("#role-form").valid()) {
showLoading();
var url = "/Role/SaveRole"; var url = "/Role/SaveRole";
var send_data = { var send_data = {
@ -1068,6 +1138,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1077,6 +1148,7 @@
UpdateCompanyRoleSelectOption($("#role_companyId_modal").val()) UpdateCompanyRoleSelectOption($("#role_companyId_modal").val())
roleTable.ajax.reload(); roleTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
} }
@ -1098,6 +1170,7 @@
}).then(function (result) { }).then(function (result) {
if (result.value) { if (result.value) {
//取得單一系統管理員 //取得單一系統管理員
showLoading();
var url = "/Role/DeleteOneRole/"; var url = "/Role/DeleteOneRole/";
var send_data = { var send_data = {
@ -1106,12 +1179,14 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
roleTable.ajax.reload(); roleTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -1150,6 +1225,7 @@
return $(this).val(); return $(this).val();
}).get(); }).get();
showLoading();
var url = "/Role/SaveRoleAuth"; var url = "/Role/SaveRoleAuth";
var send_data = { var send_data = {
@ -1159,6 +1235,7 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1167,6 +1244,7 @@
$("#role-auth-modal").modal('hide'); $("#role-auth-modal").modal('hide');
roleAuthTable.ajax.reload(); roleAuthTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
//#endregion //#endregion
@ -1190,6 +1268,7 @@
{ {
if (result.value) { if (result.value) {
//取得單一系統管理員 //取得單一系統管理員
showLoading();
var url = "/Role/DeleteOneRoleAuth/"; var url = "/Role/DeleteOneRoleAuth/";
var send_data = { var send_data = {
@ -1199,12 +1278,14 @@
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
toast_ok(rel.msg); toast_ok(rel.msg);
roleAuthTable.ajax.reload(); roleAuthTable.ajax.reload();
hideLoading();
}, 'json'); }, 'json');
} }
}); });
@ -1214,6 +1295,7 @@
//#endregion //#endregion
function UpdateCompanyRoleSelectOption(companyId) { function UpdateCompanyRoleSelectOption(companyId) {
showLoading();
var url_company_role_select_option = "/Role/GetRoleSelectOptionList"; var url_company_role_select_option = "/Role/GetRoleSelectOptionList";
send_data = { send_data = {
@ -1222,6 +1304,7 @@
$.get(url_company_role_select_option, send_data, function (rel) { $.get(url_company_role_select_option, send_data, function (rel) {
if (rel.code != "0000") { if (rel.code != "0000") {
hideLoading();
toast_error(rel.msg); toast_error(rel.msg);
return; return;
} }
@ -1295,6 +1378,7 @@
if (selected_tab == "#tab-role-manager") { if (selected_tab == "#tab-role-manager") {
roleTable.ajax.reload(); roleTable.ajax.reload();
} }
hideLoading();
}); });
} }

View File

@ -0,0 +1,86 @@
.loadEffect {
z-index: 9999;
left: 50%;
transform: translate(-50%,-50%);
width: 100px;
height: 100px;
position: absolute;
margin: 0 auto;
margin-top: 100px;
display: none;
}
.loadEffect span {
display: inline-block;
width: 13px;
height: 13px;
border-radius: 50%;
background: black;
position: absolute;
-webkit-animation: load 1.04s ease infinite;
}
@-webkit-keyframes load {
0% {
opacity: 1;
}
100% {
opacity: 0.2;
}
}
.loadEffect span:nth-child(1) {
left: 0;
top: 50%;
margin-top: -8px;
-webkit-animation-delay: 0.13s;
}
.loadEffect span:nth-child(2) {
left: 14px;
top: 14px;
-webkit-animation-delay: 0.26s;
}
.loadEffect span:nth-child(3) {
left: 50%;
top: 0;
margin-left: -8px;
-webkit-animation-delay: 0.39s;
}
.loadEffect span:nth-child(4) {
top: 14px;
right: 14px;
-webkit-animation-delay: 0.52s;
}
.loadEffect span:nth-child(5) {
right: 0;
top: 50%;
margin-top: -8px;
-webkit-animation-delay: 0.65s;
}
.loadEffect span:nth-child(6) {
right: 14px;
bottom: 14px;
-webkit-animation-delay: 0.78s;
}
.loadEffect span:nth-child(7) {
bottom: 0;
left: 50%;
margin-left: -8px;
-webkit-animation-delay: 0.91s;
}
.loadEffect span:nth-child(8) {
bottom: 14px;
left: 14px;
-webkit-animation-delay: 1.04s;
}