完成即時告警列表顯示, 新增串接程序
This commit is contained in:
parent
b704d183e7
commit
1b012e49ba
@ -20,73 +20,25 @@
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="form-group">
|
||||
<input class="form-control" id="startdate" data-val="" type="date" name="startdate" value="" style="cursor: pointer">
|
||||
<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="enddate" data-val="" type="date" name="enddate" value="" style="cursor: pointer">
|
||||
<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 mb-5">
|
||||
<div class="col-auto">
|
||||
<a href="#" onclick="selAll()" class="btn btn-secondary">全部類別</a>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<a href="#" class="btn btn-secondary">空調</a>
|
||||
<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 class="row">
|
||||
<div>
|
||||
<div class="frame-wrap">
|
||||
<table class="table table-bordered table-striped text-center m-0">
|
||||
<thead class="thead-themed">
|
||||
<tr>
|
||||
<th>棟別-樓層</th>
|
||||
<th>異常ID</th>
|
||||
<th>發生時間</th>
|
||||
<th>異常類別</th>
|
||||
<th>設備編號</th>
|
||||
<th>異常原因</th>
|
||||
<th>Ack 確認</th>
|
||||
<th>派工/維運單號</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>板橋-19F</td>
|
||||
<td>ER20210630001</td>
|
||||
<td>2022-08-01 09:36</td>
|
||||
<td>照明故障</td>
|
||||
<td>s02101000101</td>
|
||||
<td>照明設備 LA01 故障</td>
|
||||
<td><a href="#" class="btn btn-warning">未確認</a></td>
|
||||
<td>Op0004</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>板橋-19F</td>
|
||||
<td>ER20210630001</td>
|
||||
<td>2022-08-01 09:36</td>
|
||||
<td>照明故障</td>
|
||||
<td>s02101000101</td>
|
||||
<td>照明設備 LA01 故障</td>
|
||||
<td><a href="#" class="btn btn-warning">未確認</a></td>
|
||||
<td><a href="#" class="btn btn-info">+ 維修單</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>板橋-19F</td>
|
||||
<td>ER20210630001</td>
|
||||
<td>2022-08-01 09:36</td>
|
||||
<td>照明故障</td>
|
||||
<td>s02101000101</td>
|
||||
<td>照明設備 LA01 故障</td>
|
||||
<td><a href="#" class="btn btn-info">確認</a></td>
|
||||
<td><a href="#" class="btn btn-info">+ 維修單</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<table id="alertTable" class="table table-bordered table-striped text-center m-0 w-100">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@ -94,38 +46,214 @@
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<script>
|
||||
pageAct.selSysMain = null;
|
||||
pageAct.selSysSub = null;
|
||||
pageAct.alr_startdate = null;
|
||||
pageAct.alr_enddate = null;
|
||||
first = true;
|
||||
|
||||
$(function () {
|
||||
$('#nearthirty').click();
|
||||
$(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('/', '-');
|
||||
$('#startdate').val(thirtyDays);
|
||||
$('#startdate').data('val', thirtyDays);
|
||||
$('#enddate').val(today);
|
||||
$('#enddate').data('val', today);
|
||||
$('#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', '#startdate, #enddate', function () {
|
||||
if ($('#startdate').val() > $('#enddate').val()) {
|
||||
$('#startdate').val($('#startdate').data('val'));
|
||||
$('#enddate').val($('#enddate').data('val'));
|
||||
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 enddate = displayDate(new Date(new Date().setDate(new Date($('#enddate').val()).getDate() - 30)), "date").replaceAll('/', '-');
|
||||
let startdate = $('#startdate').val();
|
||||
if (enddate == startdate && $('#enddate').val() == today) {
|
||||
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 {
|
||||
@ -133,9 +261,36 @@
|
||||
$('#nearthirty').addClass('btn-secondary');
|
||||
}
|
||||
|
||||
$('#startdate').data('val', $('#startdate').val());
|
||||
$('#enddate').data('val', $('#enddate').val());
|
||||
$('#alr_startdate').data('val', $('#alr_startdate').val());
|
||||
$('#alr_enddate').data('val', $('#alr_enddate').val());
|
||||
}
|
||||
|
||||
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();
|
||||
});
|
||||
}
|
||||
|
||||
@ -153,6 +308,9 @@
|
||||
$('#returnTrue').addClass('btn-info');
|
||||
$('#returnFalse').addClass('btn-secondary');
|
||||
}
|
||||
|
||||
if (!first)
|
||||
getData();
|
||||
}
|
||||
|
||||
function setConfirm(bool) {
|
||||
@ -169,6 +327,9 @@
|
||||
$('#confirmed').addClass('btn-info');
|
||||
$('#unconfirmed').addClass('btn-secondary');
|
||||
}
|
||||
|
||||
if (!first)
|
||||
getData();
|
||||
}
|
||||
|
||||
function elemSelCol(elem) {
|
||||
@ -181,4 +342,260 @@
|
||||
$(elem).addClass('btn-secondary');
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
</script>
|
@ -31,11 +31,11 @@
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="form-group">
|
||||
<input class="form-control" id="startdate" data-val="" type="date" name="date" value="">
|
||||
<input class="form-control" id="his_startdate" data-val="" type="date" name="date" value="">
|
||||
<input class="form-control" id="getmonth" type="month" style="display: none"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto" id="enddate" style="display: none">
|
||||
<div class="col-auto" id="his_enddate" style="display: none">
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="date" data-val="" name="date" value="">
|
||||
</div>
|
||||
@ -87,30 +87,31 @@
|
||||
$(`[onclick="setDateType('day', this)"]`).click();
|
||||
$(`[onclick="setDateType('today', this)"]`).click();
|
||||
|
||||
onEvent('change', '#startdate', function () {
|
||||
onEvent('change', '#his_startdate', function () {
|
||||
let today = displayDate(new Date(Date.now()), 'date').replaceAll('/', '-');
|
||||
let ytd = displayDate(new Date(new Date().setDate(new Date(Date.now()).getDate() - 1)), 'date').replaceAll('/', '-');
|
||||
|
||||
if (pageAct.dateType == 'range') {
|
||||
if ($('#startdate').val() > $('#enddate input').val() && ($('#startdate').val() != "" && $('#enddate input').val() != "")) {
|
||||
$('#startdate').val($('#startdate').data('val'));
|
||||
if ($('#his_startdate').val() > $('#his_enddate input').val() && ($('#his_startdate').val() != "" && $('#his_enddate input').val() != "")) {
|
||||
console.log('aaaa');
|
||||
$('#his_startdate').val($('#his_startdate').data('val'));
|
||||
toast_error('不可選擇大於結束時間');
|
||||
}
|
||||
else {
|
||||
$('#startdate').data('val', $('#startdate').val());
|
||||
$('#enddate input').data('val', $('#enddate input').val());
|
||||
$('#his_startdate').data('val', $('#his_startdate').val());
|
||||
$('#his_enddate input').data('val', $('#his_enddate input').val());
|
||||
|
||||
$(`[onclick="setDateType('today', this)"]`).addClass('btn-secondary');
|
||||
$(`[onclick="setDateType('today', this)"]`).removeClass('btn-info');
|
||||
$(`[onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
|
||||
$(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
|
||||
|
||||
if ($('#startdate').val() == $('#enddate input').val()) {
|
||||
if ($('#startdate').val() == today) {
|
||||
if ($('#his_startdate').val() == $('#his_enddate input').val()) {
|
||||
if ($('#his_startdate').val() == today) {
|
||||
$(`[onclick="setDateType('today', this)"]`).removeClass('btn-secondary');
|
||||
$(`[onclick="setDateType('today', this)"]`).addClass('btn-info');
|
||||
}
|
||||
else if ($('#startdate').val() == ytd) {
|
||||
else if ($('#his_startdate').val() == ytd) {
|
||||
$(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-secondary');
|
||||
$(`[onclick="setDateType('ytd', this)"]`).addClass('btn-info');
|
||||
}
|
||||
@ -131,29 +132,30 @@
|
||||
}
|
||||
});
|
||||
|
||||
onEvent('change', '#enddate input', function () {
|
||||
onEvent('change', '#his_enddate input', function () {
|
||||
let today = displayDate(new Date(Date.now()), 'date').replaceAll('/', '-');
|
||||
let ytd = displayDate(new Date(new Date().setDate(new Date(Date.now()).getDate() - 1)), 'date').replaceAll('/', '-');
|
||||
|
||||
if ($('#startdate').val() > $('#enddate input').val() && ($('#startdate').val() != "" && $('#enddate input').val() != "")) {
|
||||
$('#enddate input').val($('#enddate input').data('val'));
|
||||
if ($('#his_startdate').val() > $('#his_enddate input').val() && ($('#his_startdate').val() != "" && $('#his_enddate input').val() != "")) {
|
||||
console.log('bbbb');
|
||||
$('#his_enddate input').val($('#his_enddate input').data('val'));
|
||||
toast_error('不可選擇大於結束時間');
|
||||
}
|
||||
else {
|
||||
$('#startdate').data('val', $('#startdate').val());
|
||||
$('#enddate input').data('val', $('#enddate input').val());
|
||||
$('#his_startdate').data('val', $('#his_startdate').val());
|
||||
$('#his_enddate input').data('val', $('#his_enddate input').val());
|
||||
|
||||
$(`[onclick="setDateType('today', this)"]`).addClass('btn-secondary');
|
||||
$(`[onclick="setDateType('today', this)"]`).removeClass('btn-info');
|
||||
$(`[onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
|
||||
$(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
|
||||
|
||||
if ($('#startdate').val() == $('#enddate input').val()) {
|
||||
if ($('#startdate').val() == today) {
|
||||
if ($('#his_startdate').val() == $('#his_enddate input').val()) {
|
||||
if ($('#his_startdate').val() == today) {
|
||||
$(`[onclick="setDateType('today', this)"]`).removeClass('btn-secondary');
|
||||
$(`[onclick="setDateType('today', this)"]`).addClass('btn-info');
|
||||
}
|
||||
else if ($('#startdate').val() == ytd) {
|
||||
else if ($('#his_startdate').val() == ytd) {
|
||||
$(`[onclick="setDateType('ytd', this)"]`).removeClass('btn-secondary');
|
||||
$(`[onclick="setDateType('ytd', this)"]`).addClass('btn-info');
|
||||
}
|
||||
@ -309,10 +311,10 @@
|
||||
|
||||
if (type == "day" || type == "today" || type == "ytd") {
|
||||
let date = type == "ytd" ? ytd : now;
|
||||
$('#startdate').css('display', 'block');
|
||||
$('#enddate').css('display', 'none');
|
||||
$('#his_startdate').css('display', 'block');
|
||||
$('#his_enddate').css('display', 'none');
|
||||
$('#getmonth').css('display', 'none');
|
||||
$('#startdate').val(date);
|
||||
$('#his_startdate').val(date);
|
||||
|
||||
if (type == "today")
|
||||
getData(formatDate(now, "date", true), formatDate(tmr, "date", true));
|
||||
@ -327,34 +329,34 @@
|
||||
$(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
|
||||
$(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
|
||||
|
||||
$('#startdate').css('display', 'block');
|
||||
$('#enddate').css('display', 'block');
|
||||
$('#his_startdate').css('display', 'block');
|
||||
$('#his_enddate').css('display', 'block');
|
||||
$('#getmonth').css('display', 'none');
|
||||
$('#startdate').val(now);
|
||||
$('#startdate').data('val', now);
|
||||
$('#enddate input').val(tmr);
|
||||
$('#enddate input').data('val', tmr);
|
||||
$('#his_startdate').val(now);
|
||||
$('#his_startdate').data('val', now);
|
||||
$('#his_enddate input').val(tmr);
|
||||
$('#his_enddate input').data('val', tmr);
|
||||
}
|
||||
else if (type == "month") {
|
||||
$(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).removeClass('btn-info');
|
||||
$(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
|
||||
|
||||
$('#startdate').css('display', 'none');
|
||||
$('#enddate').css('display', 'none');
|
||||
$('#his_startdate').css('display', 'none');
|
||||
$('#his_enddate').css('display', 'none');
|
||||
$('#getmonth').css('display', 'block');
|
||||
$('#getmonth').val(now.substr(0, 7));
|
||||
}
|
||||
else if (type == "ytd") {
|
||||
$('#startdate').css('display', 'block');
|
||||
$('#enddate').css('display', 'none');
|
||||
$('#his_startdate').css('display', 'block');
|
||||
$('#his_enddate').css('display', 'none');
|
||||
$('#getmonth').css('display', 'none');
|
||||
$('#startdate').val(ytd);
|
||||
$('#his_startdate').val(ytd);
|
||||
}
|
||||
}
|
||||
|
||||
function searchDate() {
|
||||
let start = new Date($('#startdate').val());
|
||||
let end = new Date(new Date().setDate(new Date($('#enddate input').val()).getDate() + 1));
|
||||
let start = new Date($('#his_startdate').val());
|
||||
let end = new Date(new Date().setDate(new Date($('#his_enddate input').val()).getDate() + 1));
|
||||
|
||||
if (pageAct.dateType == "day")
|
||||
end = new Date(new Date().setDate(start.getDate() + 1));
|
||||
@ -425,8 +427,8 @@
|
||||
objSendData.Data = $('#historyTable').dataTable().fnGetData();
|
||||
|
||||
$.each(objSendData.Data, function (i, v) {
|
||||
v.starttime = (pageAct.dateType == "month" ? new Date($('#getmonth').val()) : new Date($('#startdate').val()));
|
||||
v.endtime = $('#enddate input').val() === "" ? null : new Date($('#enddate input').val());
|
||||
v.starttime = (pageAct.dateType == "month" ? new Date($('#getmonth').val()) : new Date($('#his_startdate').val()));
|
||||
v.endtime = $('#his_enddate input').val() === "" ? null : new Date($('#his_enddate input').val());
|
||||
v.dateType = pageAct.dateType;
|
||||
});
|
||||
|
||||
|
@ -74,12 +74,11 @@
|
||||
</main>
|
||||
|
||||
<!-- Modal center 廠商資料 -->
|
||||
<div class="modal fade" id="opeFirmModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal fade" id="opeFirmModal" 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="opeFirmTitle" 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>
|
||||
@ -151,12 +150,11 @@
|
||||
</div>
|
||||
|
||||
<!-- Modal center 保養/維修 -->
|
||||
<div class="modal fade" id="opeRecModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal fade" id="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>
|
||||
@ -248,14 +246,26 @@
|
||||
<textarea class="form-control" type="text" id="inpDescription" name="inpDescription" rows="7"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='forImage' class="col-sm-12 forimage mt-2 p-0">
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-12 dropzone-container">
|
||||
<label class="form-label">上傳檔案</label>
|
||||
<label for="myImage" class="file-upload" style="cursor : pointer ">點擊上傳檔案</label>
|
||||
<input id="myImage" class="form-control" type="file" multiple hidden />
|
||||
<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>
|
||||
@ -270,7 +280,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Modal center 刪除 -->
|
||||
<div class="modal fade" id="delModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal fade" id="delModal" 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">
|
||||
@ -291,8 +301,6 @@
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
pageAct.mainStatus = false;
|
||||
$(loadEle).Loading("close");
|
||||
pageAct.sub_system_tag = null;
|
||||
pageAct.main_system_tag = null;
|
||||
pageAct.selSysSub = [];
|
||||
@ -734,8 +742,12 @@
|
||||
$.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.sysSub = roleObj.device_name_tag
|
||||
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);
|
||||
}
|
||||
@ -778,7 +790,7 @@
|
||||
}
|
||||
|
||||
function selAllSysVal(elem) {
|
||||
//loading process
|
||||
$(loadEle).Loading("start");
|
||||
if ($(elem).html() == '全選類別') {
|
||||
$('#mainList input').map(function (i, v) {
|
||||
if (!$(v).is(':checked')) {
|
||||
@ -805,7 +817,7 @@
|
||||
}
|
||||
|
||||
refTable();
|
||||
//end loading
|
||||
$(loadEle).Loading("close");
|
||||
}
|
||||
|
||||
function event() {
|
||||
@ -827,6 +839,7 @@
|
||||
selUser();
|
||||
selDevice();
|
||||
selOpeFir();
|
||||
errCodeList();
|
||||
$('#forImage').html('');
|
||||
}
|
||||
|
||||
@ -946,10 +959,11 @@
|
||||
fd.append("lorf[" + i + "].save_file_name", v.save_file_name);
|
||||
fd.append("lorf[" + i + "].ori_file_name", v.ori_file_name);
|
||||
});
|
||||
fd.append("location", $('#inpArea option:selected').text() + $('#inpBuilding option:selected').text() + $('#inpFloor option:selected').text());
|
||||
fd.append("location_code", $('#inpArea').val().toString() + $('#inpBuilding').val().toString() + $('#inpFloor').val().toString());
|
||||
fd.append("device_system_category_layer2", $('#inpRecSelSysMain').val());
|
||||
fd.append("device_system_category_layer3", $('#inpRecSelSysSub').val());
|
||||
|
||||
fd.append("location", "台北" + $('#buiActDrop').text() + pageAct.floor);
|
||||
fd.append("location_code", pageAct.AreaTag + pageAct.buiTag + pageAct.floor);
|
||||
fd.append("device_system_category_layer2", pageAct.sysMain);
|
||||
fd.append("device_system_category_layer3", pageAct.sysMain);
|
||||
fd.append("work_type", parseInt($('#inpWorTyp').val()));
|
||||
fd.append("fix_do", $('#inpFixDo').val());
|
||||
fd.append("fix_do_code", $('#inpFixDoCode').val());
|
||||
@ -957,9 +971,9 @@
|
||||
fd.append("status", parseInt($('#inpStatus').val()));
|
||||
fd.append("work_person_id", $('#inpWorPerId').val());
|
||||
fd.append("start_time", ($('#inpStaTime').val() || null) == null ? null : new Date($('#inpStaTime').val()).toISOString());
|
||||
fd.append("end_time", ($('#inpEndTime').val() || null) == null ? $('#inpEndTime').val() : new Date($('#inpEndTime').val()).toISOString());
|
||||
fd.append("work_time", ($('#inpWorTime').val() || null) == null ? $('#inpWorTime').val() : new Date($('#inpWorTime').val()).toISOString());
|
||||
fd.append("finish_time", ($('#inpFinTime').val() || null) == null ? null : new Date($('#inpFinTime').val()).toISOString());
|
||||
//fd.append("end_time", ($('#inpEndTime').val() || null) == null ? $('#inpEndTime').val() : new Date($('#inpEndTime').val()).toISOString());
|
||||
//fd.append("work_time", ($('#inpWorTime').val() || null) == null ? $('#inpWorTime').val() : new Date($('#inpWorTime').val()).toISOString());
|
||||
//fd.append("finish_time", ($('#inpFinTime').val() || null) == null ? null : new Date($('#inpFinTime').val()).toISOString());
|
||||
fd.append("notice", $('#inpNotice').val() || null);
|
||||
fd.append("description", $('#inpDescription').val() || null);
|
||||
|
||||
@ -1039,9 +1053,6 @@
|
||||
$('#inpStatus').val(res.data.status);
|
||||
$('#inpWorPerId').val(res.data.work_person_id);
|
||||
//$('#inpStaTime').val(displayDate(res.data.start_time, 'datetime').replace(' ', 'T').replaceAll('/', '-'));
|
||||
//$('#inpEndTime').val(displayDate(res.data.end_time, 'datetime').replace(' ', 'T').replaceAll('/', '-'));
|
||||
//$('#inpWorTime').val(displayDate(res.data.work_time, 'datetime').replace(' ', 'T').replaceAll('/', '-'));
|
||||
//$('#inpFinTime').val(displayDate(res.data.finish_time, 'datetime').replace(' ', 'T').replaceAll('/', '-'));
|
||||
$('#inpNotice').text(res.data.notice);
|
||||
$('#inpDescription').text(res.data.description);
|
||||
let strHtml = ``;
|
||||
@ -1123,12 +1134,84 @@
|
||||
}
|
||||
|
||||
function errCodeList() {
|
||||
//$(loadEle).Loading("start");
|
||||
let _pathArr = pageAct.number.split("_"); //TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1
|
||||
let _devicePath = _pathArr[0] + "_" + _pathArr[1] + "_" + _pathArr[2] + "_" + _pathArr[3] + "_" + _pathArr[4] + "_" + _pathArr[5];
|
||||
getOneDeviceAlarmTop10ByBaja(_devicePath, callbackForErr);
|
||||
}
|
||||
|
||||
function callbackForErr(res) {
|
||||
console.log(res);
|
||||
res = JSON.parse(res);
|
||||
strHtml = ``;
|
||||
|
||||
$.each(res.data, function (i, v) {
|
||||
msg = v.msgText != null ? ($.trim(v.msgText.toString()).length > 0 ? v.msgText.split(':')[0] : '') : '';
|
||||
strHtml += `<option value=${v.uuid}>${msg}</option>`;
|
||||
});
|
||||
|
||||
if (res.count > 0)
|
||||
$('#inpErrCode').html(strHtml);
|
||||
|
||||
$(loadEle).Loading("close");
|
||||
}
|
||||
|
||||
//上傳檔案 dropzone
|
||||
function initDropzone() {
|
||||
let avaUplFilsArr = $("#frmFileUpload").parents(".update").data("avauplfil");
|
||||
let uploadedFilesNameArr = [];
|
||||
uploader = $("#frmFileUpload").dropzone({
|
||||
addRemoveLinks: true,
|
||||
dictRemoveFile: `<span class="material-icons mi-delete">delete</span>`,
|
||||
dictInvalidFileType: `上傳格式錯誤`,
|
||||
dictCancelUploadConfirmation: `確定要取消上傳此檔案嗎?`,
|
||||
dictCancelUpload: `<span class="material-icons mi-cancel">cancel</span>`,
|
||||
maxFilesize: 3,
|
||||
filesizeBase: 1024,
|
||||
maxFiles: 5,
|
||||
acceptedFiles: ".pdf, .docx, .doc, .xls, .xlsm, .xlsx, .ppt, .pptx",
|
||||
accept: function (file, done) {
|
||||
|
||||
if (avaUplFilsArr.findIndex(x => x.split(".")[0] == file.name.split(".")[0]) == -1) {
|
||||
done("只能上傳諮詢師指派給您的相關檔案。");
|
||||
} else if (uplFiles.findIndex(x => x.name == file.name) != -1) {
|
||||
done("只能上傳一筆同檔名檔案。");
|
||||
}
|
||||
else { done(); }
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
uploader[0].dropzone.on("addedfile", file => {
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(file)
|
||||
|
||||
reader.onload = function (event) {
|
||||
file.dataUrl = event.target.result;
|
||||
};
|
||||
})
|
||||
|
||||
uploader[0].dropzone.on("success", file => {
|
||||
let strHtml = ``;
|
||||
strHtml += `<li class="d-flex align-items-center py-2 px-3" data-uuid="${file.upload.uuid}">
|
||||
<div><i class="material-icons">cloud_done</i></div>
|
||||
<div class="d-flex justify-content-between align-items-center p-2 flex-fill">
|
||||
<span>${file.upload.filename}</span>
|
||||
<span>${convertSize(file.upload.total)}</span>
|
||||
</div>
|
||||
</li>`;
|
||||
$(".update_box ul").append(strHtml);
|
||||
$("#uploadBtnGro").show();
|
||||
uplFiles.push(file);
|
||||
uploadBtnGro();
|
||||
})
|
||||
|
||||
uploader[0].dropzone.on("removedfile", file => {
|
||||
$(`[data-uuid='${file.upload.uuid}']`).remove();
|
||||
|
||||
if (uplFiles.findIndex(x => x.upload.uuid == file.upload.uuid) != -1) {
|
||||
uplFiles.splice(uplFiles.findIndex(x => x.upload.uuid == file.upload.uuid), 1);
|
||||
}
|
||||
uploadBtnGro();
|
||||
})
|
||||
}
|
||||
</script>
|
@ -13,8 +13,8 @@ using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace FrontendWebApi.ApiControllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
//[Route("api/[controller]")]
|
||||
//[ApiController]
|
||||
public class AlertController : MyBaseApiController<AlertController>
|
||||
{
|
||||
private readonly IBackendRepository backendRepository;
|
||||
@ -129,7 +129,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
if (i == 2)
|
||||
{
|
||||
cell.SetCellValue(a.Created_at);
|
||||
//cell.SetCellValue(a.created_time);
|
||||
}
|
||||
if (i == 3)
|
||||
{
|
||||
@ -169,22 +169,16 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<List<Alert>>> AlertList([FromBody] List<Alert> alerts)
|
||||
public async Task<ApiResult<string>> AlertList([FromBody] FindFormId alerts)
|
||||
{
|
||||
ApiResult<List<Alert>> apiResult = new ApiResult<List<Alert>>();
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
try
|
||||
{
|
||||
if(alerts.Count > 0)
|
||||
{
|
||||
foreach(var a in alerts)
|
||||
{
|
||||
var sqlString = $@"select formId from operation_record where error_code = @error_code";
|
||||
var formId = await backendRepository.GetOneAsync<string>(sqlString, new { @error_code = a.uuid });
|
||||
a.formId = formId;
|
||||
}
|
||||
}
|
||||
var sqlString = $@"select formId from operation_record where error_code = @error_code limit 1";
|
||||
var formId = await backendRepository.GetOneAsync<string>(sqlString, new { @error_code = alerts.uuid });
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Data = alerts;
|
||||
apiResult.Data = formId;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -29,4 +29,10 @@ namespace FrontendWebApi.Models
|
||||
public string created_at { get { return timestamp.ToString(); } set { } }
|
||||
public string Created_at { get { return Convert.ToDateTime(created_at).ToString("yyyy-MM-dd HH:mm:ss"); } set { created_at = value; } } //發生時間顯示
|
||||
}
|
||||
|
||||
public class FindFormId
|
||||
{
|
||||
public string uuid { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user