2022-12-07 09:25:43 +08:00
|
|
|
<main id="js-page-content" role="main" class="page-content">
|
2022-12-08 18:26:23 +08:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-12 col-xl-12">
|
|
|
|
<h1 class="p-2 mb-0">即時告警</h1>
|
|
|
|
<div class="row bg-dark p-2">
|
|
|
|
<div class="col-auto">
|
|
|
|
<div class="btn-group">
|
|
|
|
<button id="returnFalse" onclick="setReturn(false)" type="button" class="btn btn-secondary waves-effect waves-themed">未復歸</button>
|
|
|
|
<button id="returnTrue" onclick="setReturn(true)" type="button" class="btn btn-secondary waves-effect waves-themed">已復歸</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-auto">
|
|
|
|
<div class="btn-group">
|
|
|
|
<button id="unconfirmed" onclick="setConfirm(false)" type="button" class="btn btn-secondary waves-effect waves-themed">未確認</button>
|
|
|
|
<button id="confirmed" onclick="setConfirm(true)" type="button" class="btn btn-secondary waves-effect waves-themed">已確認</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-auto">
|
|
|
|
<a href="#" id="nearthirty" class="btn btn-secondary">近30天</a>
|
|
|
|
</div>
|
|
|
|
<div class="col-auto">
|
|
|
|
<div class="form-group">
|
|
|
|
<input class="form-control" id="alr_startdate" data-val="" type="date" name="alr_startdate" value="" style="cursor: pointer">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-auto">
|
|
|
|
<div class="form-group">
|
|
|
|
<input class="form-control" id="alr_enddate" data-val="" type="date" name="alr_enddate" value="" style="cursor: pointer">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="row bg-dark p-2 align-items-center" id="alr_mainList">
|
|
|
|
</div>
|
|
|
|
<div class="row bg-dark p-2 mb-5 align-items-center" id="alr_subList">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<div class="frame-wrap">
|
|
|
|
<table id="alertTable" class="table table-bordered table-striped text-center m-0 w-100">
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-12-07 09:25:43 +08:00
|
|
|
</main>
|
|
|
|
|
2022-12-08 18:26:23 +08:00
|
|
|
<!-- Modal center 保養/維修 -->
|
|
|
|
<div class="modal fade" id="alr_opeRecModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
|
|
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<h4 id="opeRecTitle" class="modal-title">
|
|
|
|
新增維修單
|
|
|
|
</h4>
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
|
<span aria-hidden="true"><i class="fal fa-times"></i></span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<form id="opeRecForm">
|
|
|
|
<div class="modal-body">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="form-label" for="inpErrCode">異常編號</label>
|
|
|
|
<select class="form-control" id="inpErrCode" name="inpErrCode" disabled>
|
|
|
|
<option value=''>未選擇</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="form-label" for="inpStaTime">預計開始時間</label>
|
|
|
|
<input type="date" id="inpStaTime" name="inpStaTime" class="form-control">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="form-label" for="inpWorTyp">項目</label>
|
|
|
|
<select class="form-control custom-select-ri" id="inpWorTyp" name="inpWorTyp" disabled>
|
|
|
|
<option value=2 selected>維修</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="form-label" for="inpFixDo">維修項目</label>
|
|
|
|
<input type="text" id="inpFixDo" name="inpFixDo" class="form-control">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="form-label" for="inpFixDoCode">維修項目代碼(設備編號)</label>
|
|
|
|
<select class="form-control" id="inpFixDoCode" name="inpFixDoCode" disabled>
|
|
|
|
<option value=''>未選擇</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="form-label" for="inpFixFirm">負責廠商</label>
|
|
|
|
<select class="form-control" id="inpFixFirm" name="inpFixFirm">
|
|
|
|
<option value=''>未選擇</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="form-label" for="inpStatus">狀態</label>
|
|
|
|
<div class="form-control" id="inpStatus">
|
|
|
|
<div class="row container">
|
|
|
|
<div class="">
|
|
|
|
<input class="custom-radio-input" type="radio" name="inpSta" id="inpSta_0" value="0" checked>
|
|
|
|
<label class="form-label" for="inpSta_0">未完成</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="px-4">
|
|
|
|
<input class="custom-radio-input" type="radio" name="inpSta" id="inpSta_1" value="1">
|
|
|
|
<label class="form-label" for="inpSta_1">完成</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="form-label" for="inpWorPerId">工作人員編號</label>
|
|
|
|
<select class="form-control" id="inpWorPerId" name="inpWorPerId">
|
|
|
|
<option value=''>未選擇</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="form-label" for="inpNotice">注意事項</label>
|
|
|
|
<textarea class="form-control" type="text" id="inpNotice" name="inpNotice" rows="7"></textarea>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="form-label" for="inpDescription">結果描述</label>
|
|
|
|
<textarea class="form-control" type="text" id="inpDescription" name="inpDescription" rows="7"></textarea>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-12 dropzone-container">
|
|
|
|
<label class="form-label">上傳檔案</label>
|
|
|
|
<div class="form-group dropzone" id="frmFileUpload">
|
|
|
|
<div class="dz-message">
|
|
|
|
<div class="drag-icon-cph">
|
|
|
|
<i class="material-icons">backup</i>
|
|
|
|
</div>
|
|
|
|
<h3>選擇一個文件或拖放到這裡</h3>
|
|
|
|
<p class="mb-0 col-grey">
|
|
|
|
PDF檔案不超過 3MB
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div class="fallback">
|
|
|
|
<input name="file" type="file" multiple />
|
|
|
|
</div>
|
|
|
|
<!--<label for="myImage" class="file-upload" style="cursor : pointer ">點擊上傳檔案</label>
|
|
|
|
<input id="myImage" class="form-control dropzone" type="file" multiple hidden />-->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id='forImage' class="col-sm-12 forimage mt-2 p-0">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-secondary" id="OpeRecCanBtn" data-dismiss="modal">關閉</button>
|
|
|
|
<button type="button" class="btn btn-primary" id="OpeRecSendBtn" e-prevent>儲存</button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-12-07 09:25:43 +08:00
|
|
|
<script>
|
2022-12-08 18:26:23 +08:00
|
|
|
pageAct.selSysMain = null;
|
|
|
|
pageAct.selSysSub = null;
|
|
|
|
pageAct.alr_startdate = null;
|
|
|
|
pageAct.alr_enddate = null;
|
|
|
|
first = true;
|
|
|
|
|
|
|
|
$(function () {
|
|
|
|
$(loadEle).Loading("close");
|
|
|
|
setReturn(false);
|
|
|
|
setConfirm(false);
|
|
|
|
event();
|
|
|
|
sysList();
|
|
|
|
$('#nearthirty').click();
|
|
|
|
|
|
|
|
$('#alr_mainList').on('click', 'a[data-type=alr_main]', function () {
|
|
|
|
$(this).parent().parent().find('a').removeClass('btn-info');
|
|
|
|
$(this).parent().parent().find('a').addClass('btn-secondary');
|
|
|
|
$(this).addClass('btn-info');
|
|
|
|
|
|
|
|
$('a[data-type=alr_sub]').parent().parent().find('a').removeClass('btn-info');
|
|
|
|
$('a[data-type=alr_sub]').parent().parent().find('a').addClass('btn-secondary');
|
|
|
|
|
|
|
|
pageAct.SysType = null;
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#alr_subList, #alr_mainList').on('click', 'a[data-type=alr_sub][id!=selAllSys]', function () {
|
|
|
|
pageAct.selSysMain = $(this).parent().data('main');
|
|
|
|
pageAct.selSysSub = $(this).prop('id');
|
|
|
|
|
|
|
|
if ($('#selAllSys').hasClass('btn-info')) {
|
|
|
|
$('#selAllSys').removeClass('btn-info');
|
|
|
|
$('#selAllSys').addClass('btn-secondary');
|
|
|
|
$('#alr_mainList a[data-type=alr_main]').removeClass('btn-info');
|
|
|
|
$('#alr_mainList a[data-type=alr_main]').addClass('btn-secondary');
|
|
|
|
$(`#alr_mainList a[data-type=alr_main][id=` + pageAct.selSysMain + `]`).addClass('btn-info');
|
|
|
|
$('#alr_subList a[data-type=alr_sub]').parent().attr('hidden', true);
|
|
|
|
$('#alr_subList a[data-type=alr_sub]').parent('[data-main=' + pageAct.selSysMain + ']').attr('hidden', false);
|
|
|
|
}
|
|
|
|
|
|
|
|
$(this).parent().parent().find('a').removeClass('btn-info');
|
|
|
|
$(this).parent().parent().find('a').addClass('btn-secondary');
|
|
|
|
$(this).addClass('btn-info');
|
|
|
|
|
|
|
|
pageAct.SysType = null;
|
|
|
|
getData();
|
|
|
|
});
|
|
|
|
|
|
|
|
first = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
function event() {
|
|
|
|
onEvent('click', '#nearthirty', function () {
|
|
|
|
let today = displayDate(new Date(Date.now()), "date").replaceAll('/', '-');
|
|
|
|
let thirtyDays = displayDate(new Date(new Date().setDate(new Date(Date.now()).getDate() - 30)), "date").replaceAll('/', '-');
|
|
|
|
$('#alr_startdate').val(thirtyDays);
|
|
|
|
$('#alr_startdate').data('val', thirtyDays);
|
|
|
|
$('#alr_enddate').val(today);
|
|
|
|
$('#alr_enddate').data('val', today);
|
|
|
|
if (!$(this).hasClass('btn-info'))
|
|
|
|
elemSelCol($(this));
|
|
|
|
|
|
|
|
pageAct.alr_startdate = $("#alr_startdate").val();
|
|
|
|
pageAct.alr_enddate = $("#alr_enddate").val();
|
|
|
|
getData();
|
|
|
|
});
|
|
|
|
|
|
|
|
onEvent('change', '#alr_startdate, #alr_enddate', function () {
|
|
|
|
if ($('#alr_startdate').val() > $('#alr_enddate').val()) {
|
|
|
|
$('#alr_startdate').val($('#alr_startdate').data('val'));
|
|
|
|
$('#alr_enddate').val($('#alr_enddate').data('val'));
|
|
|
|
toast_error('不可選擇大於結束時間');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
let today = displayDate(new Date(Date.now()), "date").replaceAll('/', '-');
|
|
|
|
let alr_enddate = displayDate(new Date(new Date().setDate(new Date($('#alr_enddate').val()).getDate() - 30)), "date").replaceAll('/', '-');
|
|
|
|
let alr_startdate = $('#alr_startdate').val();
|
|
|
|
if (alr_enddate == alr_startdate && $('#alr_enddate').val() == today) {
|
|
|
|
$('#nearthirty').click();
|
|
|
|
}
|
|
|
|
else {
|
2022-12-07 09:25:43 +08:00
|
|
|
$('#nearthirty').removeClass('btn-info');
|
|
|
|
$('#nearthirty').addClass('btn-secondary');
|
|
|
|
}
|
|
|
|
|
2022-12-08 18:26:23 +08:00
|
|
|
$('#alr_startdate').data('val', $('#alr_startdate').val());
|
|
|
|
$('#alr_enddate').data('val', $('#alr_enddate').val());
|
2022-12-07 09:25:43 +08:00
|
|
|
}
|
|
|
|
|
2022-12-08 18:26:23 +08:00
|
|
|
pageAct.alr_startdate = $("#alr_startdate").val();
|
|
|
|
pageAct.alr_enddate = $("#alr_enddate").val();
|
|
|
|
getData();
|
|
|
|
});
|
|
|
|
|
|
|
|
onEvent('click', 'a[data-type=alr_main]', function () {
|
|
|
|
$(`a[data-type=alr_sub]`).parent(`[data-main!=` + $(this).prop('id') + `]`).attr('hidden', true);
|
|
|
|
$(`a[data-type=alr_sub]`).parent(`[data-main=` + $(this).prop('id') + `]`).attr('hidden', false);
|
|
|
|
});
|
|
|
|
|
|
|
|
onEvent('click', '#alertTable a[id=alr_recModal]', function () {
|
|
|
|
let alr_table = $('#alertTable').DataTable();
|
|
|
|
let alr_elem = $(this).parent().parent();
|
|
|
|
let alr_tableData = alr_table.row(alr_elem).data();
|
|
|
|
$('#inpErrCode').html(`<option value = ${alr_tableData.uuid}>${alr_tableData.msgText}</option>`);
|
|
|
|
$('#inpStaTime').val(displayDate(new Date(Date.now()), "date").replaceAll('/', '-'));
|
|
|
|
let deviceNumber = null
|
|
|
|
|
|
|
|
deviceNumber = pageAct.AreaTag + "_" + alr_tableData.buildingFloorName_zh.toString().split('-')[0] + "_" + alr_tableData.alarmClass.toString().split('_')[0] + "_"
|
|
|
|
+ alr_tableData.alarmClass.toString().split('_')[1] + "_" + alr_tableData.buildingFloorName_zh.toString().split('-')[1] + "_" + alr_tableData.sourceName_zh.toString().split('-')[0] + "_"
|
|
|
|
+ alr_tableData.sourceName_zh.toString().split('-')[1];
|
|
|
|
|
|
|
|
$('#inpFixDoCode').val($(`option[value*=${deviceNumber}]`).val() !== undefined ? $(`option[value*=${deviceNumber}]`).val() : "");
|
|
|
|
selUser();
|
|
|
|
selDevice();
|
|
|
|
selOpeFir();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function setReturn(bool) {
|
|
|
|
pageAct.return = bool;
|
2022-12-07 09:25:43 +08:00
|
|
|
$('#returnFalse').removeClass('btn-info');
|
|
|
|
$('#returnTrue').removeClass('btn-info');
|
2022-12-08 18:26:23 +08:00
|
|
|
if (!bool) {
|
|
|
|
$('#returnFalse').removeClass('btn-secondary');
|
|
|
|
$('#returnFalse').addClass('btn-info');
|
2022-12-07 09:25:43 +08:00
|
|
|
$('#returnTrue').addClass('btn-secondary');
|
2022-12-08 18:26:23 +08:00
|
|
|
}
|
|
|
|
else {
|
2022-12-07 09:25:43 +08:00
|
|
|
$('#returnTrue').removeClass('btn-secondary');
|
2022-12-08 18:26:23 +08:00
|
|
|
$('#returnTrue').addClass('btn-info');
|
2022-12-07 09:25:43 +08:00
|
|
|
$('#returnFalse').addClass('btn-secondary');
|
|
|
|
}
|
|
|
|
|
2022-12-08 18:26:23 +08:00
|
|
|
if (!first)
|
|
|
|
getData();
|
|
|
|
}
|
|
|
|
|
|
|
|
function setConfirm(bool) {
|
|
|
|
pageAct.confirm = bool;
|
|
|
|
$('#unconfirmed').removeClass('btn-info');
|
2022-12-07 09:25:43 +08:00
|
|
|
$('#confirmed').removeClass('btn-info');
|
2022-12-08 18:26:23 +08:00
|
|
|
if (!bool) {
|
|
|
|
$('#unconfirmed').removeClass('btn-secondary');
|
|
|
|
$('#unconfirmed').addClass('btn-info');
|
2022-12-07 09:25:43 +08:00
|
|
|
$('#confirmed').addClass('btn-secondary');
|
2022-12-08 18:26:23 +08:00
|
|
|
}
|
|
|
|
else {
|
2022-12-07 09:25:43 +08:00
|
|
|
$('#confirmed').removeClass('btn-secondary');
|
2022-12-08 18:26:23 +08:00
|
|
|
$('#confirmed').addClass('btn-info');
|
2022-12-07 09:25:43 +08:00
|
|
|
$('#unconfirmed').addClass('btn-secondary');
|
|
|
|
}
|
2022-12-08 18:26:23 +08:00
|
|
|
|
|
|
|
if (!first)
|
|
|
|
getData();
|
2022-12-07 09:25:43 +08:00
|
|
|
}
|
|
|
|
|
2022-12-08 18:26:23 +08:00
|
|
|
function elemSelCol(elem) {
|
|
|
|
if (elem.hasClass('btn-secondary')) {
|
2022-12-07 09:25:43 +08:00
|
|
|
$(elem).removeClass('btn-secondary');
|
2022-12-08 18:26:23 +08:00
|
|
|
$(elem).addClass('btn-info');
|
|
|
|
}
|
|
|
|
else if (elem.hasClass('btn-info')) {
|
2022-12-07 09:25:43 +08:00
|
|
|
$(elem).removeClass('btn-info');
|
|
|
|
$(elem).addClass('btn-secondary');
|
|
|
|
}
|
|
|
|
}
|
2022-12-08 18:26:23 +08:00
|
|
|
|
|
|
|
function sysList() {
|
|
|
|
let url = baseApiUrl + "/api/GetMainSub";
|
|
|
|
let sendData = {
|
|
|
|
building_tag: pageAct.buiTag
|
|
|
|
}
|
|
|
|
objSendData.Data = sendData;
|
|
|
|
function success(res) {
|
|
|
|
let mainStrHtml = ``;
|
|
|
|
let subStrHtml = ``;
|
|
|
|
let display = pageAct.mainStatus ? "hidden" : "";
|
|
|
|
|
|
|
|
if (pageAct.mainStatus) {
|
|
|
|
mainStrHtml += `<div class="col-auto">
|
|
|
|
<a href="#" id="selAllSys" onclick="selAllSysVal(this)" class="btn btn-secondary">全部類別</a>
|
|
|
|
</div>`;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
subStrHtml += `<div class="col-auto">
|
|
|
|
<a href="#" id="selAllSys" onclick="selAllSysVal(this)" class="btn btn-secondary">全部類別</a>
|
|
|
|
</div>`;
|
|
|
|
}
|
|
|
|
|
|
|
|
$.each(res.data.history_Main_Systems, function (i, v) {
|
|
|
|
if (pageAct.mainStatus) {
|
|
|
|
mainStrHtml += `<div class="col-auto">
|
|
|
|
<a href="#" class="btn btn-secondary" id=${v.main_system_tag} data-type="alr_main">${v.full_name}</a>
|
|
|
|
</div>`;
|
|
|
|
}
|
|
|
|
|
|
|
|
$.each(v.history_Sub_systems, function (i2, v2) {
|
|
|
|
let selected = (i2 == 0 && i == 0) ? "info" : "secondary";
|
|
|
|
subStrHtml += `<div class="col-auto" data-main="${v.main_system_tag}" ${display}>
|
|
|
|
<a href="#" class="btn btn-${selected}" id="${v2.sub_system_tag}" data-type="alr_sub">${v2.full_name}</a>
|
|
|
|
</div>`;
|
|
|
|
|
|
|
|
if (i2 == 0 && i == 0) {
|
|
|
|
pageAct.selSysSub = v2.sub_system_tag;
|
|
|
|
pageAct.selSysMain = v.main_system_tag;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
if (pageAct.mainStatus) {
|
|
|
|
$('#alr_mainList').html(mainStrHtml);
|
|
|
|
$('#alr_subList').html(subStrHtml);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#alr_mainList').html(subStrHtml);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
|
|
|
|
}
|
|
|
|
|
|
|
|
function selAllSysVal(elem) {
|
|
|
|
$(elem).parent().parent().find('a').removeClass('btn-secondary');
|
|
|
|
$(elem).parent().parent().find('a').addClass('btn-info');
|
|
|
|
|
|
|
|
if ($('a[data-type=alr_sub]').length > 0) {
|
|
|
|
$('a[data-type=alr_sub]').parent().attr('hidden', false);
|
|
|
|
$('a[data-type=alr_sub]').parent().parent().find('a').removeClass('btn-secondary');
|
|
|
|
$('a[data-type=alr_sub]').parent().parent().find('a').addClass('btn-info');
|
|
|
|
}
|
|
|
|
|
|
|
|
pageAct.SysType = 'all';
|
|
|
|
getData();
|
|
|
|
}
|
|
|
|
|
|
|
|
function getData(type = null) {
|
|
|
|
$(loadEle).Loading("start");
|
|
|
|
|
|
|
|
let enddate = new Date(new Date().setDate(new Date(pageAct.alr_enddate).getDate() + 1)).getTime();
|
|
|
|
|
|
|
|
if (pageAct.SysType == "all") {
|
|
|
|
getAllDeviceAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, callBackFromAllDeviceAlert);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
getAlarmByBaja(new Date(pageAct.alr_startdate).getTime(), enddate, pageAct.return, pageAct.confirm, pageAct.selSysMain + "_" + pageAct.selSysSub + "_AlarmClass", callBackFromOneDeviceAlert);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function callBackFromAllDeviceAlert(res) {
|
|
|
|
res = JSON.parse(res);
|
|
|
|
refTable(res.data);
|
|
|
|
if (historyTable != null) {
|
|
|
|
let t = $('#alertTable').dataTable();
|
|
|
|
|
|
|
|
t.fnClearTable();
|
|
|
|
if (res.data.length > 0)
|
|
|
|
t.fnAddData(res.data);
|
|
|
|
}
|
|
|
|
$(loadEle).Loading("close");
|
|
|
|
}
|
|
|
|
|
|
|
|
function callBackFromOneDeviceAlert(res) {
|
|
|
|
res = JSON.parse(res);
|
|
|
|
refTable(res.data);
|
|
|
|
if (historyTable != null) {
|
|
|
|
let t = $('#alertTable').dataTable();
|
|
|
|
|
|
|
|
t.fnClearTable();
|
|
|
|
if (res.data.length > 0)
|
|
|
|
t.fnAddData(res.data);
|
|
|
|
}
|
|
|
|
$(loadEle).Loading("close");
|
|
|
|
}
|
|
|
|
|
|
|
|
function refTable(data) {
|
|
|
|
let tag = "#alertTable";
|
|
|
|
$.each(data, function (i, v) {
|
|
|
|
v.formId = AlertList(v.uuid);
|
|
|
|
});
|
|
|
|
|
|
|
|
let column_defs = [
|
|
|
|
{ "targets": [0], "width": "5%", "sortable": true },
|
|
|
|
{ "targets": [1], "width": "5%", "sortable": true },
|
|
|
|
{ "targets": [2], "width": "5%", "sortable": true },
|
|
|
|
{ "targets": [3], "width": "5%", "sortable": true },
|
|
|
|
{ "targets": [4], "width": "5%", "sortable": true },
|
|
|
|
{ "targets": [5], "width": "5%", "sortable": true },
|
|
|
|
{ "targets": [6], "width": "5%", "sortable": true },
|
|
|
|
{ "targets": [7], "width": "5%", "sortable": true },
|
|
|
|
];
|
|
|
|
|
|
|
|
let columns = [
|
|
|
|
{
|
|
|
|
"title": "棟別-樓層",
|
|
|
|
"data": "buildingFloorName_zh"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "異常ID",
|
|
|
|
"data": "uuid",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "發生時間",
|
|
|
|
"data": "timestamp",
|
|
|
|
"render": function (data) {
|
|
|
|
return displayDate(data, "datetime");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "異常類別",
|
|
|
|
"data": "alarmClass",
|
|
|
|
"render": function (data) {
|
|
|
|
return data.split('_')[1];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "設備編號",
|
|
|
|
"data": "sourceName_zh",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "異常原因",
|
|
|
|
"data": "msgText",
|
|
|
|
"render": function (data) {
|
|
|
|
return data.split(':')[0];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Ack 確認",
|
|
|
|
"data": "ackState",
|
|
|
|
"render": function (data) {
|
|
|
|
let confirm = data == "1" ? "未確認" : "確認";
|
|
|
|
let btnCol = data == "1" ? "warning" : "info";
|
|
|
|
return `<td><a href="#" onclick="return false" class="btn btn-${btnCol}">${confirm}</a></td>`
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "派工/維運單號",
|
|
|
|
"data": "formId",
|
|
|
|
"render": function (data) {
|
|
|
|
return data ?? `<td><a href="#" id="alr_recModal" class="btn btn-info" data-toggle="modal" data-target="#alr_opeRecModal">+ 維修單</a></td>`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
|
|
|
|
}
|
|
|
|
|
|
|
|
function AlertList(errCode) {
|
|
|
|
objSendData.Data = { uuid: errCode };
|
|
|
|
let a = null
|
|
|
|
url = baseApiUrl + "/Alert/AlertList";
|
|
|
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (rel) {
|
|
|
|
if (rel.code == "0000")
|
|
|
|
a = rel.data;
|
|
|
|
}, null, "POST").send();
|
|
|
|
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
|
|
|
function selDevice() {
|
|
|
|
let url = baseApiUrl + "/operation/DevList";
|
|
|
|
let lsst = [];
|
|
|
|
$('a[data-type=alr_sub]').map(function (i, v) { lsst.push($(v).prop('id')); });
|
|
|
|
sendData = {
|
|
|
|
device_area_tag: pageAct.AreaTag,
|
|
|
|
device_building_tag: pageAct.buiTag,
|
|
|
|
list_sub_system_tag: lsst,
|
|
|
|
};
|
|
|
|
objSendData.Data = sendData;
|
|
|
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
|
|
|
if (!res || res.code != "0000" || !res.data) {
|
|
|
|
|
|
|
|
} else {
|
|
|
|
strHtml = ``;
|
|
|
|
$("#inpFixDoCode").html();
|
|
|
|
$.each(res.data, (index, roleObj) => {
|
|
|
|
strHtml += `<option value='${roleObj.device_number}' data-floor=${roleObj.device_floor_tag} data-main=${roleObj.device_system_tag} data-sub=${roleObj.device_name_tag}>${roleObj.device_name}</option>`;
|
|
|
|
|
|
|
|
if (index == 0) {
|
|
|
|
pageAct.sysMain = roleObj.device_system_tag;
|
|
|
|
pageAct.sysSub = roleObj.device_name_tag;
|
|
|
|
pageAct.floor = roleObj.device_floor_tag;
|
|
|
|
pageAct.number = roleObj.device_number;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
$("#inpFixDoCode").html(strHtml);
|
|
|
|
}
|
|
|
|
}, null, "POST").send();
|
|
|
|
}
|
|
|
|
|
|
|
|
function selUser() {
|
|
|
|
let url = baseApiUrl + "/User/UserManagerList";
|
|
|
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
|
|
|
if (!res || res.code != "0000" || !res.data) {
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$("#inpWorPerId").html();
|
|
|
|
strHtml = ``;
|
|
|
|
strHtml += `<option value=''>未選擇</option>`;
|
|
|
|
$.each(res.data, (index, roleObj) => {
|
|
|
|
strHtml += `<option value='${roleObj.userinfo_guid}'>${roleObj.full_name}</option>`;
|
|
|
|
})
|
|
|
|
$("#inpWorPerId").html(strHtml);
|
|
|
|
}
|
|
|
|
}, null, "POST").send();
|
|
|
|
}
|
|
|
|
|
|
|
|
function selOpeFir() {
|
|
|
|
let url = baseApiUrl + "/operation/OpeFirSel";
|
|
|
|
objSendData.Data = { sub_system_tag: $('a[data-type=alr_sub].btn-info').map(function (i, v) { return $(v).prop('id'); }).toArray() };
|
|
|
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
|
|
|
if (!res || res.code != "0000" || !res.data) {
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$("#inpFixFirm").html();
|
|
|
|
strHtml = ``;
|
|
|
|
strHtml += `<option value=''>未選擇</option>`;
|
|
|
|
$.each(res.data, (index, roleObj) => {
|
|
|
|
strHtml += `<option value='${roleObj.id}'>${roleObj.name}</option>`;
|
|
|
|
})
|
|
|
|
$("#inpFixFirm").html(strHtml);
|
|
|
|
}
|
|
|
|
}, null, "POST").send();
|
|
|
|
}
|
2022-12-07 09:25:43 +08:00
|
|
|
</script>
|