[後端] 增加loading顯示, 排程try catch
This commit is contained in:
parent
060dc97391
commit
c468efe0fc
@ -762,11 +762,14 @@
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$('#floor-modal').modal();
|
||||
|
||||
$("#BuildName").html(selected_build_guid_top_name);
|
||||
$("#floor_name_modal").val(rel.data.full_name);
|
||||
@*$("#map_file_preview_modal").attr("data-original", rel.data.mapUrl);*@
|
||||
|
||||
$('#floor-modal').modal();
|
||||
if (rel.data.mapUrl)
|
||||
loadURLToInputFiled(rel.data.mapUrl, rel.data.initMapName + ".svg");
|
||||
else
|
||||
$('#floor_map_file_modal')[0].value = "";
|
||||
}
|
||||
}, 'json');
|
||||
});
|
||||
@ -977,6 +980,27 @@
|
||||
}
|
||||
//#endregion
|
||||
|
||||
function loadURLToInputFiled(url, filesName){
|
||||
getImgURL(url, (imgBlob)=>{
|
||||
// Load img blob to input
|
||||
// WIP: UTF8 character error
|
||||
let fileName = filesName
|
||||
let file = new File([imgBlob], fileName,{type:"image/svg+xml", lastModified:new Date().getTime()}, 'utf-8');
|
||||
let container = new DataTransfer();
|
||||
container.items.add(file);
|
||||
$('#floor_map_file_modal')[0].files = container.files;
|
||||
})
|
||||
}
|
||||
|
||||
// xmlHTTP return blob respond
|
||||
function getImgURL(url, callback){
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onload = function() {
|
||||
callback(xhr.response);
|
||||
};
|
||||
xhr.open('GET', url);
|
||||
xhr.responseType = 'blob';
|
||||
xhr.send();
|
||||
}
|
||||
</script>
|
||||
}
|
@ -140,6 +140,7 @@
|
||||
//#endregion
|
||||
|
||||
function SynchronizeData() {
|
||||
showSpinner();
|
||||
document.getElementById('loadDataText').innerText = "同步中...";
|
||||
if (ds.length > 0) {
|
||||
//比對資料,有差異的話,再同步到device等資料表
|
||||
@ -154,12 +155,13 @@
|
||||
url: url_synchronize_data,
|
||||
data: JSON.stringify(ds),
|
||||
cache: false,
|
||||
async: false,
|
||||
async: true,
|
||||
contentType: "application/json; charset=UTF-8",
|
||||
dataType: 'json',
|
||||
success: function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
showSpinner();
|
||||
document.getElementById('loadDataText').innerText = "比對資料出錯了!";
|
||||
return;
|
||||
}
|
||||
@ -208,10 +210,12 @@
|
||||
success: function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
showSpinner();
|
||||
document.getElementById('loadDataText').innerText = "比對資料出錯了!";
|
||||
return;
|
||||
}
|
||||
|
||||
hideSpinner();
|
||||
console.log(rel);
|
||||
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
|
||||
var dateTime = date + ' ' + time;
|
||||
|
@ -27,6 +27,11 @@
|
||||
</head>
|
||||
<body class="mod-bg-1 mod-nav-link">
|
||||
<!-- BEGIN Page Wrapper -->
|
||||
<div id="spinner" class="justify-content-center text-center loading hide">
|
||||
<div class="spinner-border" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page-wrapper">
|
||||
<div class="page-inner">
|
||||
<!-- BEGIN Left Aside -->
|
||||
|
@ -47,3 +47,34 @@ label.error {
|
||||
.t-gray {
|
||||
color:var(--bims-gray) !important;
|
||||
}
|
||||
|
||||
/* Absolute Center Spinner */
|
||||
.loading {
|
||||
position: fixed;
|
||||
z-index: 999;
|
||||
display: block;
|
||||
margin: auto;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
/* Transparent Overlay */
|
||||
.loading:before {
|
||||
content: '';
|
||||
display: block;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: radial-gradient(rgba(0, 0, 0, .5), rgba(0, 0, 0, .5));
|
||||
background: -webkit-radial-gradient(rgba(0, 0, 0, .5), rgba(0, 0, 0, .5));
|
||||
}
|
||||
|
||||
.loading.hide {
|
||||
display: none;
|
||||
}
|
@ -222,3 +222,11 @@ function SaveSpinner(status) { //1:Spinner 0:還原儲存
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
function showSpinner() {
|
||||
$("#spinner").removeClass("hide");
|
||||
}
|
||||
|
||||
function hideSpinner() {
|
||||
$("#spinner").addClass("hide");
|
||||
}
|
@ -786,6 +786,7 @@ namespace BackendWorkerService.Services.Implement
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
||||
throw exception;
|
||||
}
|
||||
|
||||
@ -795,6 +796,8 @@ namespace BackendWorkerService.Services.Implement
|
||||
private List<Dictionary<string, object>> ArrangeRawData(DeviceNumberPoint deviceNumberPoint, JObject jsonResult)
|
||||
{
|
||||
List<Dictionary<string, object>> arrangeRawDatas = new List<Dictionary<string, object>>();
|
||||
try
|
||||
{
|
||||
var histories = jsonResult["obj"]["list"];
|
||||
var rawdateCount = Convert.ToInt32(jsonResult["obj"]["int"]["@val"].ToString());
|
||||
|
||||
@ -947,5 +950,10 @@ namespace BackendWorkerService.Services.Implement
|
||||
|
||||
return arrangeRawDatas;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return arrangeRawDatas;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user