增加運維程序, 修改歷史資料程序
This commit is contained in:
parent
06d0e84782
commit
d68f166f5c
@ -1,13 +1,13 @@
|
||||
<main id="js-page-content" role="main" class="page-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-xl-2">
|
||||
<div class="bg-success-900 rounded bg-info-gradient">
|
||||
<div class="rounded border border-white">
|
||||
<div class="d-flex position-relative py-3 px-4">
|
||||
<i class="fal fa-search color-success-700 position-absolute pos-left fs-lg px-3 py-2 mt-1 ml-4"></i>
|
||||
<input type="text" id="js_nested_list_filter" class="form-control shadow-inset-1 pl-6 border-success" placeholder="Filter nested items (e.g buttons, chart)">
|
||||
<input type="text" id="js_nested_list_filter" class="form-control shadow-inset-1 pl-6 border-success" placeholder="輸入兩字以上">
|
||||
</div>
|
||||
<!-- nav-menu-reset will reset the font colors -->
|
||||
<ul id="js_nested_list" class="nav-menu nav-menu-reset nav-menu-compact bg-success-900 bg-info-gradient mb-sm-4 mb-md-0 rounded" data-nav-accordion="true">
|
||||
<ul id="js_nested_list" class="nav-menu nav-menu-reset nav-menu-compact mb-sm-4 mb-md-0 rounded border border-white" data-nav-accordion="true">
|
||||
</ul>
|
||||
<div class="filter-message js-filter-message m-0 text-left pl-4 py-3 fw-500"></div>
|
||||
</div>
|
||||
@ -18,15 +18,15 @@
|
||||
<div class="row bg-dark p-2 mb-5">
|
||||
<div class="col-auto">
|
||||
<div class="btn-group">
|
||||
<button type="button" onclick="setDateType('day')" class="btn btn-secondary waves-effect waves-themed">日期</button>
|
||||
<button type="button" onclick="setDateType('range')" class="btn btn-secondary waves-effect waves-themed">日區間</button>
|
||||
<button type="button" onclick="setDateType('month')" class="btn btn-secondary waves-effect waves-themed">月</button>
|
||||
<button type="button" onclick="setDateType('day', this)" class="btn btn-secondary waves-effect waves-themed">日期</button>
|
||||
<button type="button" onclick="setDateType('range', this)" class="btn btn-secondary waves-effect waves-themed">日區間</button>
|
||||
<button type="button" onclick="setDateType('month', this)" class="btn btn-secondary waves-effect waves-themed">月</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="btn-group">
|
||||
<button type="button" onclick="setDateType('today')" class="btn btn-secondary waves-effect waves-themed">今天</button>
|
||||
<button type="button" onclick="setDateType('ytd')" class="btn btn-secondary waves-effect waves-themed">昨天</button>
|
||||
<button type="button" onclick="setDateType('today', this)" class="btn btn-secondary waves-effect waves-themed">今天</button>
|
||||
<button type="button" onclick="setDateType('ytd', this)" class="btn btn-secondary waves-effect waves-themed">昨天</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
@ -49,13 +49,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row col mb-2">
|
||||
<div class="row-cols-1 mb-2">
|
||||
<div id="devPointsList" class="btn-group">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div>
|
||||
<div class="frame-wrap">
|
||||
<table id="historyTable" class="table table-bordered table-striped text-center m-0 w-100">
|
||||
</table>
|
||||
@ -84,7 +84,8 @@
|
||||
initApp.buildNavigation($('#js_nested_list'));
|
||||
|
||||
loadTable(null);
|
||||
$(`[onclick="setDateType('today')"]`).click();
|
||||
$(`[onclick="setDateType('day', this)"]`).click();
|
||||
$(`[onclick="setDateType('today', this)"]`).click();
|
||||
});
|
||||
|
||||
function initList() {
|
||||
@ -101,7 +102,7 @@
|
||||
$.each(res.data.history_Main_Systems, function (index, val) {
|
||||
if (pageAct.mainStatus) {
|
||||
strHtml += `<li>
|
||||
<a href="#" data-filter-tags="user interface buttons compass action dropdown navigation sidebars" data-maintag="${val.main_system_tag}">
|
||||
<a href="#" data-filter-tags="${val.full_name.toLowerCase() }" data-maintag="${val.main_system_tag}">
|
||||
<span class="nav-link-text">${val.full_name}</span>
|
||||
</a>
|
||||
<ul style="${index == 0 ? `display:block;` : ``}">`;
|
||||
@ -113,7 +114,7 @@
|
||||
i2 = (val2.device != null && i2 == null) ? index2 : null;
|
||||
|
||||
strHtml += `<li>
|
||||
<a href="#" data-filter-tags="user interface buttons" data-subtag="${val2.sub_system_tag}">
|
||||
<a href="#" data-filter-tags="${val2.full_name.toLowerCase() } ${val2.sub_system_tag.toLowerCase() }" data-subtag="${val2.sub_system_tag}">
|
||||
<span class="nav-link-text">
|
||||
${val2.full_name} ${val2.sub_system_tag}
|
||||
</span>
|
||||
@ -122,7 +123,7 @@
|
||||
|
||||
$.each(val2.device, function (index3, val3) {
|
||||
strHtml += `<li>
|
||||
<a href="#" onClick="setValue('${val3.device_number}', '${val3.full_name}', null)" data-filter-tags="user interface buttons" data-devnum="${val3.device_number}">
|
||||
<a href="#" onClick="setValue('${val3.device_number}', '${val3.full_name}', null)" data-filter-tags="${val3.full_name.toLowerCase() } ${val3.device_serial_tag.toLowerCase()}" data-devnum="${val3.device_number}">
|
||||
<span class="nav-link-text">
|
||||
${val3.full_name} ${val3.device_serial_tag}
|
||||
</span>
|
||||
@ -169,11 +170,12 @@
|
||||
let strHtml = ``;
|
||||
|
||||
$.each(res.data, function (index, val) {
|
||||
strHtml += `<button onClick="setValue(null, null, '${val.points}')" type="button" class="btn btn-secondary waves-effect waves-themed">${val.full_name} ${val.points}</button>`;
|
||||
|
||||
if (index == 0) {
|
||||
strHtml += `<button onClick="setValue(null, null, '${val.points}', this)" type="button" class="btn btn-dark waves-effect waves-themed">${val.full_name} ${val.points}</button>`;
|
||||
pageAct.deviceItem = val.points;
|
||||
getData();
|
||||
} else {
|
||||
strHtml += `<button onClick="setValue(null, null, '${val.points}', this)" type="button" class="btn btn-secondary waves-effect waves-themed">${val.full_name} ${val.points}</button>`;
|
||||
}
|
||||
});
|
||||
|
||||
@ -187,12 +189,12 @@
|
||||
var edt = new Date(new Date().setDate(sdt.getDate() + 1));
|
||||
start = start ?? sdt.toLocaleDateString();
|
||||
end = end ?? edt.toLocaleDateString();
|
||||
// getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem,
|
||||
//new Date(start).getTime(),
|
||||
//new Date(end).getTime(),
|
||||
//pageAct.deviceName,
|
||||
// "Mitsubishi_Sup",
|
||||
// callBackFromHistory);
|
||||
getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem,
|
||||
new Date(start).getTime(),
|
||||
new Date(end).getTime(),
|
||||
pageAct.deviceName,
|
||||
"Mitsubishi_Sup",
|
||||
callBackFromHistory);
|
||||
}
|
||||
|
||||
function callBackFromHistory(res) {
|
||||
@ -207,7 +209,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
function setValue(deviceNumber, deviceName, deviceItem) {
|
||||
function setValue(deviceNumber, deviceName, deviceItem, elem) {
|
||||
btnSelCss(elem);
|
||||
|
||||
if ((deviceNumber != null && deviceNumber != undefined) && (deviceName != null && deviceName != undefined)) {
|
||||
pageAct.deviceNumber = deviceNumber;
|
||||
pageAct.deviceName = deviceName;
|
||||
@ -219,11 +223,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
function setDateType(type) {
|
||||
function setDateType(type, elem) {
|
||||
btnSelCss(elem);
|
||||
|
||||
pageAct.dateType = type;
|
||||
let now = formatDate(new Date(Date.now()), "date");
|
||||
let ytd = formatDate(new Date(new Date().setDate(new Date().getDate() - 1)), "date");
|
||||
let tmr = formatDate(new Date(new Date().setDate(new Date().getDate() + 1)), "date");
|
||||
|
||||
if (type == "day" || type == "today" || type == "ytd") {
|
||||
let date = type == "ytd" ? ytd : now;
|
||||
$('#startdate').css('display', 'block');
|
||||
@ -232,11 +239,18 @@
|
||||
$('#startdate').val(date);
|
||||
|
||||
if (type == "today")
|
||||
getData(formatDate(now, "date", true), formatDate(tmr, "date", true));
|
||||
getData(formatDate(now, "date", true), formatDate(tmr, "date", true));
|
||||
else if (type == "ytd")
|
||||
getData(formatDate(ytd, "date", true), formatDate(now, "date", true));
|
||||
getData(formatDate(ytd, "date", true), formatDate(now, "date", true));
|
||||
else {
|
||||
$(`[onclick="setDateType('today', this)"]`).removeClass('btn-secondary');
|
||||
$(`[onclick="setDateType('today', this)"]`).addClass('btn-dark');
|
||||
}
|
||||
}
|
||||
else if (type == "range") {
|
||||
$(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).removeClass('btn-dark');
|
||||
$(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
|
||||
|
||||
$('#startdate').css('display', 'block');
|
||||
$('#enddate').css('display', 'block');
|
||||
$('#getmonth').css('display', 'none');
|
||||
@ -244,6 +258,9 @@
|
||||
$('#enddate input').val(tmr);
|
||||
}
|
||||
else if (type == "month") {
|
||||
$(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).removeClass('btn-dark');
|
||||
$(`[onclick="setDateType('today', this)"], [onclick="setDateType('ytd', this)"]`).addClass('btn-secondary');
|
||||
|
||||
$('#startdate').css('display', 'none');
|
||||
$('#enddate').css('display', 'none');
|
||||
$('#getmonth').css('display', 'block');
|
||||
@ -286,6 +303,12 @@
|
||||
}
|
||||
|
||||
function loadTable(data) {
|
||||
if (data) {
|
||||
$.each(data, function (i, v) {
|
||||
v.type = deviceName;
|
||||
});
|
||||
}
|
||||
|
||||
let tag = "#historyTable";
|
||||
|
||||
let column_defs = [
|
||||
@ -294,7 +317,11 @@
|
||||
{ "targets": [2], "width": "20%", "sortable": true }
|
||||
];
|
||||
|
||||
let columns = [
|
||||
let columns = [
|
||||
{
|
||||
"title": "類別",
|
||||
"data": "type"
|
||||
},
|
||||
{
|
||||
"title": "設備名稱",
|
||||
"data": "deviceName",
|
||||
@ -306,8 +333,8 @@
|
||||
{
|
||||
"title": "紀錄時間",
|
||||
"data": "timestamp",
|
||||
"render": function (date) {
|
||||
return displayDate(date, "datetime");
|
||||
"render": function (data) {
|
||||
return displayDate(data, "datetime");
|
||||
}
|
||||
}
|
||||
];
|
||||
@ -329,5 +356,5 @@
|
||||
if (rel.code == "0000")
|
||||
location.href = baseApiUrl + "/api/df?fileName=" + rel.data + "&token=" + localStorage.getItem("JWT-Authorization");
|
||||
}, null, "POST").send();
|
||||
}
|
||||
}
|
||||
</script>
|
629
Frontend/_operation.html
Normal file
629
Frontend/_operation.html
Normal file
@ -0,0 +1,629 @@
|
||||
<main id="js-page-content" role="main" class="page-content">
|
||||
<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 type="button" onclick="setType(1)" class="btn btn-secondary waves-effect waves-themed">維修</button>
|
||||
<button type="button" onclick="setType(2)" class="btn btn-secondary waves-effect waves-themed">保義記錄</button>
|
||||
<button type="button" onclick="setType(null)" class="btn btn-secondary waves-effect waves-themed">廠商資料</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="btn-group">
|
||||
<button onclick="setDate('tdy')" type="button" class="btn btn-secondary waves-effect waves-themed">今天</button>
|
||||
<button onclick="setDate('ytd')" type="button" class="btn btn-secondary waves-effect waves-themed">昨天</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="form-group">
|
||||
<input class="form-control" id="startdate" type="date" name="date" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="form-group">
|
||||
<input class="form-control" id="enddate" type="date" name="date" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto" style="display: none">
|
||||
<div class="form-group">
|
||||
<input type="text" id="serial_number" class="form-control" placeholder="表單號">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto" style="display: none">
|
||||
<a href="#" for="serial_number" onclick="snSearch()" class="btn btn-info">單號查詢</a>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
</div>
|
||||
<div class="row bg-dark p-2 align-items-center">
|
||||
<div class="col-auto">
|
||||
<a href="#" onclick="selAllSysVal" class="btn btn-info">全部類別</a>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div id="mainList" class="frame-wrap">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bg-dark p-2 mb-5 align-items-center">
|
||||
<div class="col-auto" style="padding-left: 133px">
|
||||
<div id="subList" class="frame-wrap">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="">
|
||||
<div class="frame-wrap">
|
||||
<div class="mb-3">
|
||||
<a href="#" id="newForm" class="btn btn-success" data-toggle="modal" data-target="#opeFirmModal">+ 維修單</a>
|
||||
<a href="#" onclick="exportExcel()" class="btn btn-info waves-effect waves-themed">
|
||||
<span class="fal fa-file-excel mr-1"></span>
|
||||
匯出
|
||||
</a>
|
||||
</div>
|
||||
<table id="opeFirmTable" class="table table-bordered table-striped text-center m-0 w-100">
|
||||
</table>
|
||||
<table id="opeRecTable" class="table table-bordered table-striped text-center m-0 w-100">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- Modal center 廠商資料 -->
|
||||
<div class="modal fade" id="opeFirmModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 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="opeFirmForm">
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="selSysMain">系統大類</label>
|
||||
<select class="form-control" id="selSysMain" name="selSysMain">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="selSysSub">系統小類</label>
|
||||
<select class="form-control" id="selSysSub" name="selSysSub">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpName">姓名</label>
|
||||
<input type="text" id="inpName" name="inpName" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpConPer">聯絡人</label>
|
||||
<input type="text" id="inpConPer" name="inpConPer" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpPhone">電話</label>
|
||||
<input type="text" id="inpPhone" name="inpPhone" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpEmail">Email</label>
|
||||
<input type="email" id="inpEmail" name="inpEmail" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpTaxIdNum">統一編號</label>
|
||||
<input type="text" id="inpTaxIdNum" name="inpTaxIdNum" maxlength="8" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="inpRemark">備注</label>
|
||||
<input type="text" id="inpRemark" name="inpRemark" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
|
||||
<button type="button" class="btn btn-primary" id="OpeFirmSendBtn" e-prevent>儲存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal center 設備權限 -->
|
||||
<div class="modal fade" id="opeRecModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 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>
|
||||
<div class="modal-body">
|
||||
<table class="table table-bordered table-striped text-center m-0">
|
||||
<thead class="thead-themed">
|
||||
<tr>
|
||||
<th>選擇</th>
|
||||
<th>編號</th>
|
||||
<th>功能名稱</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>1</td>
|
||||
<td>系統監控</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>2</td>
|
||||
<td>歷史資料</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>3</td>
|
||||
<td>異常記錄</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>4</td>
|
||||
<td>即時告警</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>5</td>
|
||||
<td>運維管理</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>6</td>
|
||||
<td>圖資管理</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox"></td>
|
||||
<td>7</td>
|
||||
<td>帳號管理</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
|
||||
<button type="button" class="btn btn-primary">儲存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
pageAct.sub_system_tag = null;
|
||||
pageAct.main_system_tag = null;
|
||||
|
||||
initMaiList();
|
||||
$('input[type=checkbox][data-type=main]').parent().on('change', function () {
|
||||
pageAct.main_system_tag = $('input[type=checkbox]:checked').map(function (i, v) { if ($(v).data('type') == 'main') return $(v).prop('id') }).toArray();
|
||||
|
||||
subList();
|
||||
|
||||
if ($('input[type=checkbox][data-type=main]:checked').length <= 0) {
|
||||
pageAct.main_system_tag = null
|
||||
pageAct.sub_system_tag = null;
|
||||
}
|
||||
|
||||
refTable();
|
||||
});
|
||||
|
||||
$('#subList').on('change', $('input[type=checkbox][data-type=sub]').parent(), function () {
|
||||
pageAct.sub_system_tag = $('input[type=checkbox]:checked').map(function (i, v) { if ($(v).data('type') == 'sub') return $(v).prop('id') }).toArray();
|
||||
|
||||
if ($('input[type=checkbox][data-type=sub]:checked').length <= 0) {
|
||||
pageAct.sub_system_tag = null;
|
||||
}
|
||||
|
||||
refTable();
|
||||
});
|
||||
|
||||
$('[onclick^=setType]').on('click', function () {
|
||||
btnSelCss(this);
|
||||
});
|
||||
|
||||
$(`[onclick^=setDate]`).on('click', function () {
|
||||
if ($(this).hasClass('btn-dark')) {
|
||||
$(this).removeClass('btn-dark');
|
||||
$(this).addClass('btn-secondary');
|
||||
setDate();
|
||||
}
|
||||
else
|
||||
btnSelCss(this);
|
||||
});
|
||||
|
||||
$('#startdate, #enddate').on('change', function () {
|
||||
let startdate = new Date($('#startdate').val());
|
||||
let enddate = new Date($('#enddate').val());
|
||||
setDate(null, startdate, enddate)
|
||||
});
|
||||
|
||||
$(`[onclick="setType(null)"]`).click();
|
||||
|
||||
initDate();
|
||||
event();
|
||||
});
|
||||
|
||||
function loadOpeFirmTable() {
|
||||
$('#opeFirmTable_wrapper').css('display', 'block');
|
||||
$('#opeRecTable_wrapper').css('display', 'none');
|
||||
$('#serial_number').parent().parent().css('display', 'none');
|
||||
$('[for=serial_number]').parent().css('display', 'none');
|
||||
|
||||
serial_number = $('#serial_number').val() || null;
|
||||
let ajaxObj = {
|
||||
url: baseApiUrl + "/operation/OpeFirList",
|
||||
method: "POST",
|
||||
data: { work_type: null, start_created_at: pageAct.startdate, end_created_at: pageAct.enddate, serial_number: pageAct.serial_number, main_system_tag: pageAct.main_system_tag, sub_system_tag: pageAct.sub_system_tag }
|
||||
};
|
||||
let tag = "#opeFirmTable";
|
||||
|
||||
let column_defs = [
|
||||
{ "targets": [0], "width": "4%", "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 }
|
||||
];
|
||||
|
||||
let columns = [
|
||||
{
|
||||
"title": "廠商類別",
|
||||
"data": "system_key",
|
||||
},
|
||||
{
|
||||
"title": "廠商",
|
||||
"data": "name",
|
||||
},
|
||||
{
|
||||
"title": "聯絡人",
|
||||
"data": "contact_person",
|
||||
},
|
||||
{
|
||||
"title": "電話",
|
||||
"data": "phone",
|
||||
},
|
||||
{
|
||||
"title": "email",
|
||||
"data": "email",
|
||||
},
|
||||
{
|
||||
"title": "建立日期",
|
||||
"data": "created_at"
|
||||
},
|
||||
{
|
||||
"title": "功能",
|
||||
"data": "id",
|
||||
"render": function () {
|
||||
let btnDiv = creDiv(["row", "m-0", "justify-content-center"], { "style": "gap:10px" });
|
||||
btnDiv.append(creBtnHtml("刪除", "rolAuthDelBtn", null, ["btn", "btn-danger"]));
|
||||
return btnDiv.outerHtml();
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
opeFirmTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
|
||||
}
|
||||
|
||||
function loadOpeRecTable() {
|
||||
$('#opeFirmTable_wrapper').css('display', 'none');
|
||||
$('#opeRecTable_wrapper').css('display', 'block');
|
||||
$('#serial_number').parent().parent().css('display', 'block');
|
||||
$('[for=serial_number]').parent().css('display', 'block');
|
||||
|
||||
let ajaxObj = {
|
||||
url: baseApiUrl + "/operation/OpeRecList",
|
||||
method: "POST",
|
||||
data: { work_type: pageAct.work_type, start_created_at: pageAct.startdate, end_created_at: pageAct.enddate, serial_number: pageAct.serial_number, main_system_tag: pageAct.main_system_tag, sub_system_tag: pageAct.sub_system_tag }
|
||||
}
|
||||
|
||||
let tag = "#opeRecTable";
|
||||
|
||||
let column_defs = [
|
||||
{ "targets": [0], "width": "8%", "sortable": true },
|
||||
{ "targets": [1], "width": "8%", "sortable": true },
|
||||
{ "targets": [2], "width": "8%", "sortable": true },
|
||||
{ "targets": [3], "width": "8%", "sortable": true },
|
||||
{ "targets": [4], "width": "8%", "sortable": true },
|
||||
{ "targets": [5], "width": "8%", "sortable": true },
|
||||
{ "targets": [6], "width": "8%", "sortable": true },
|
||||
{ "targets": [7], "width": "8%", "sortable": true },
|
||||
{ "targets": [8], "width": "8%", "sortable": false },
|
||||
{ "targets": [9], "width": "8%", "sortable": false },
|
||||
{ "targets": [10], "width": "8%", "sortable": false },
|
||||
{ "targets": [11], "width": "8%", "sortable": false },
|
||||
];
|
||||
|
||||
let columns = [
|
||||
{
|
||||
"title": "項目",
|
||||
"data": "work_type_name",
|
||||
},
|
||||
{
|
||||
"title": "位置",
|
||||
"data": "location",
|
||||
},
|
||||
{
|
||||
"title": "異常代號",
|
||||
"data": "error_code",
|
||||
},
|
||||
{
|
||||
"title": "表單號",
|
||||
"data": "formId",
|
||||
},
|
||||
{
|
||||
"title": "設備名稱",
|
||||
"data": "device_name",
|
||||
},
|
||||
{
|
||||
"title": "狀態",
|
||||
"data": "status_name",
|
||||
},
|
||||
{
|
||||
"title": "處理人員",
|
||||
"data": "user_full_name",
|
||||
},
|
||||
{
|
||||
"title": "預計施工時間",
|
||||
"data": "start_time",
|
||||
"render": function (data) {
|
||||
return displayDate(data, "datetime");
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "檔案上傳",
|
||||
"data": "start_time",
|
||||
},
|
||||
{
|
||||
"title": "完成時間",
|
||||
"data": "finish_time",
|
||||
"render": function (data) {
|
||||
return displayDate(data, "datetime");
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"title": "建立時間",
|
||||
"data": "created_at",
|
||||
},
|
||||
{
|
||||
"title": "功能",
|
||||
"data": "id",
|
||||
"render": function () {
|
||||
let btnDiv = creDiv(["row", "m-0", "justify-content-center"], { "style": "gap:10px" });
|
||||
btnDiv.append(creBtnHtml("刪除", "rolAuthDelBtn", null, ["btn", "btn-danger"]));
|
||||
return btnDiv.outerHtml();
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
opeRecTable = new YourTeam.JqDataTables.getTableByAjax(ajaxObj, tag, null, columns, column_defs);
|
||||
}
|
||||
|
||||
function setType(wt) {
|
||||
pageAct.work_type = wt;
|
||||
|
||||
if (wt == null) {
|
||||
$('#newForm').data('target', '#opeFirmModal')
|
||||
loadOpeFirmTable();
|
||||
}
|
||||
else {
|
||||
$('#newForm').data('target', '#opeRecModal')
|
||||
loadOpeRecTable();
|
||||
}
|
||||
}
|
||||
|
||||
function setDate(dateType = null, startdate = null, enddate = null) {
|
||||
clearPageAct();
|
||||
pageAct.startdate = startdate;
|
||||
pageAct.enddate = enddate;
|
||||
|
||||
if (dateType == 'tdy') {
|
||||
pageAct.startdate = new Date(displayDate(new Date(new Date().setDate(new Date().getDate())), 'date'));
|
||||
}
|
||||
else if (dateType == 'ytd') {
|
||||
pageAct.startdate = new Date(displayDate(new Date(new Date().setDate(new Date().getDate() - 1)), 'date'));
|
||||
}
|
||||
else {
|
||||
$(`[onclick^=setDate]`).removeClass('btn-dark');
|
||||
$(`[onclick^=setDate]`).addClass('btn-secondary');
|
||||
}
|
||||
|
||||
refTable();
|
||||
}
|
||||
|
||||
function initDate() {
|
||||
$('#startdate').val(displayDate(new Date(new Date().setDate(new Date().getDate())), 'date').replaceAll('/', '-'));
|
||||
$('#enddate').val(displayDate(new Date(new Date().setDate(new Date().getDate() + 1)), 'date').replaceAll('/', '-'));
|
||||
}
|
||||
|
||||
function clearPageAct() {
|
||||
pageAct.startdate = null;
|
||||
pageAct.enddate = null;
|
||||
pageAct.serial_number = null;
|
||||
}
|
||||
|
||||
function snSearch() {
|
||||
clearPageAct();
|
||||
pageAct.serial_number = $('#serial_number').val() || null;
|
||||
}
|
||||
|
||||
function initMaiList() {
|
||||
let url = baseApiUrl + "/operation/MaiSysList";
|
||||
function success(res) {
|
||||
let strHtml = ``;
|
||||
$.each(res.data, function (i, v) {
|
||||
strHtml += `<div class="custom-control custom-checkbox custom-control-inline">
|
||||
<input type="checkbox" class="custom-control-input" data-type="main" id="${v.system_value}">
|
||||
<label class="custom-control-label" for="${v.system_value}">${v.system_key}</label>
|
||||
</div>`;
|
||||
});
|
||||
|
||||
$('#mainList').html(strHtml);
|
||||
}
|
||||
ytAjax = new YourTeam.Ajax(url, null, success, null, "POST").send();
|
||||
}
|
||||
|
||||
function subList() {
|
||||
let sendData = {
|
||||
main_system_tag: pageAct.main_system_tag
|
||||
}
|
||||
objSendData.Data = sendData;
|
||||
|
||||
let url = baseApiUrl + "/operation/SubSysList";
|
||||
let strHtml = ``;
|
||||
function success(res) {
|
||||
$.each(res.data, function (i, v) {
|
||||
strHtml += `<div class="custom-control custom-checkbox custom-control-inline">
|
||||
<input type="checkbox" class="custom-control-input" data-type="sub" id="${v.system_value}">
|
||||
<label class="custom-control-label" for="${v.system_value}">${v.system_key}</label>
|
||||
</div>`;
|
||||
});
|
||||
|
||||
$('#subList').html(strHtml);
|
||||
|
||||
if (pageAct.sub_system_tag != null) {
|
||||
$.each(pageAct.sub_system_tag, function (i, v) {
|
||||
$('#' + v).click();
|
||||
});
|
||||
}
|
||||
}
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
|
||||
}
|
||||
|
||||
function refTable() {
|
||||
if (pageAct.work_type == null)
|
||||
loadOpeFirmTable();
|
||||
else
|
||||
loadOpeRecTable();
|
||||
}
|
||||
|
||||
function exportExcel() {
|
||||
let url = baseApiUrl + "/operation/OpeExportExcel";
|
||||
|
||||
objSendData.Data = {
|
||||
work_type: pageAct.work_type,
|
||||
startdate: pageAct.startdate == undefined ? null : pageAct.startdate,
|
||||
enddate: pageAct.enddate == undefined ? null : pageAct.enddate,
|
||||
};
|
||||
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (rel) {
|
||||
if (rel.code == "0000")
|
||||
location.href = baseApiUrl + "/api/df?fileName=" + rel.data + "&token=" + localStorage.getItem("JWT-Authorization");
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
function selSysMain() {
|
||||
let url = baseApiUrl + "/operation/MaiSysList";
|
||||
|
||||
ytAjax = new YourTeam.Ajax(url, null, function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
} else {
|
||||
$("#selSysMain").html();
|
||||
$("#selSysSub").html();
|
||||
strHtml = ``;
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
strHtml += `<option value='${roleObj.system_value}'>${roleObj.system_key}</option>`;
|
||||
|
||||
if (index == 0)
|
||||
pageAct.selSysMain = roleObj.system_value
|
||||
})
|
||||
$("#selSysMain").html(strHtml);
|
||||
selSysSub();
|
||||
}
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
function selSysSub() {
|
||||
url = baseApiUrl + "/operation/SubSysList";
|
||||
sendData = {
|
||||
main_system_tag: [pageAct.selSysMain],
|
||||
};
|
||||
objSendData.Data = sendData;
|
||||
strHtml = ``;
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
$.each(res.data, (index, roleObj) => {
|
||||
strHtml += `<option value='${roleObj.system_value}'>${roleObj.system_key}</option>`;
|
||||
})
|
||||
$("#selSysSub").html(strHtml);
|
||||
}, null, "POST").send();
|
||||
}
|
||||
|
||||
function event() {
|
||||
onEvent('click', '#newForm', function () {
|
||||
selSysMain();
|
||||
});
|
||||
|
||||
onEvent('change', '#selSysMain', function () {
|
||||
pageAct.selSysMain = $(this).val();
|
||||
selSysSub();
|
||||
});
|
||||
|
||||
onEvent("click", "#OpeFirmSendBtn", function () {
|
||||
let form = $("#opeFirmForm");
|
||||
console.log(form);
|
||||
$(form).validate({
|
||||
rules: {
|
||||
selSysMain: { required: true },
|
||||
selSysSub: { required: true },
|
||||
name: { required: true, maxlength: 50 }
|
||||
}
|
||||
});
|
||||
//if ($(form).valid()) {
|
||||
// console.log($('#selSysMain').val());
|
||||
// let url = baseApiUrl + "/operation/SaveOpeFirm";
|
||||
// let sendData = {
|
||||
// device_system_category_layer2: $('#selSysMain').val(),
|
||||
// device_system_category_layer3: $('#selSysSub').val(),
|
||||
// name: $("#inpName").val(),
|
||||
// contact_person: $("#inpConPer").val(),
|
||||
// phone: $("#inpPhone").val(),
|
||||
// email: $("#inpEmail").val(),
|
||||
// tax_id_number: $("#inpTaxIdNum").val(),
|
||||
// remark: $("#inpRemark").val()
|
||||
// };
|
||||
// objSendData.Data = sendData;
|
||||
// //$("#opeFirmModal").modal("hide");
|
||||
// //ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||
// // if (!res || res.code != "0000" || !res.data) {
|
||||
|
||||
// // } else {
|
||||
// // toast_ok(common.AddSuc);
|
||||
// // $("#opeFirmModal").modal("hide");
|
||||
// // }
|
||||
// //}, null, "POST").send();
|
||||
//}
|
||||
});
|
||||
}
|
||||
</script>
|
@ -1495,8 +1495,8 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
</a>
|
||||
</div>
|
||||
<div class="btn-group mx-4">
|
||||
<a href="javascript:;" class="dropdown-toggle no-arrow text-center" data-toggle="dropdown"
|
||||
aria-haspopup="true" aria-expanded="false">
|
||||
<a href="javascript:;" name ="topFunBtn" class="no-arrow text-center"
|
||||
data-page="operation">
|
||||
<i class="fal fa-server fa-2x"></i><br>運維管理
|
||||
</a>
|
||||
</div>
|
||||
|
@ -1562,3 +1562,13 @@ YT.Loading = function (type, ele = null, text = null, delay = 0) {
|
||||
$(ele.ele).YTAlert().hide(delay);
|
||||
}
|
||||
}
|
||||
|
||||
//change css of clicked button
|
||||
function btnSelCss(elem) {
|
||||
$.each($(elem).parent().find('button'), function (i, v) {
|
||||
$(v).removeClass('btn-dark');
|
||||
$(v).addClass('btn-secondary');
|
||||
});
|
||||
$(elem).removeClass('btn-secondary');
|
||||
$(elem).addClass('btn-dark');
|
||||
}
|
@ -56,7 +56,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
try
|
||||
{
|
||||
var fileDateName = lhe.FirstOrDefault().dateType == "month" ? lhe.FirstOrDefault().starttime.ToString("yyyy-MM") : lhe.FirstOrDefault().endtime == null ? lhe.FirstOrDefault().starttime.ToString("yyyy-MM-dd") : lhe.FirstOrDefault().starttime.ToString("yyyy-MM-dd") + "_" + ((DateTime)lhe.FirstOrDefault().endtime).ToString("yyyy-MM-dd");
|
||||
var fileName = "廠商資料_"+fileDateName+".xlsx";
|
||||
var fileName = "歷史資料_"+fileDateName+".xlsx";
|
||||
var filePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "excel", "history");
|
||||
|
||||
if (!System.IO.Directory.Exists(filePath))
|
||||
@ -136,13 +136,17 @@ namespace FrontendWebApi.ApiControllers
|
||||
cell = row.CreateCell(i);
|
||||
if (i == 0)
|
||||
{
|
||||
cell.SetCellValue(he.deviceName);
|
||||
cell.SetCellValue(he.type);
|
||||
}
|
||||
if (i == 1)
|
||||
{
|
||||
cell.SetCellValue(he.value);
|
||||
cell.SetCellValue(he.deviceName);
|
||||
}
|
||||
if (i == 2)
|
||||
{
|
||||
cell.SetCellValue(he.value);
|
||||
}
|
||||
if (i == 3)
|
||||
{
|
||||
cell.SetCellValue(he.timestamp.ToString("yyyy-MM-dd HH:mm") + ":00");//
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -271,5 +271,6 @@ namespace FrontendWebApi.Models
|
||||
public DateTime starttime { get; set; }
|
||||
public DateTime? endtime { get; set; }
|
||||
public string dateType { get; set; }
|
||||
public string type { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ namespace FrontendWebApi.Models
|
||||
public DateTime? end_created_at { get; set; }//结束建立时间
|
||||
//public bool today { get; set; }//今天建立时间
|
||||
//public bool yesterday { get; set; }//昨天建立时间
|
||||
public string main_system_tag { get; set; }//大类tag
|
||||
public string sub_system_tag { get; set; }//小类tag
|
||||
public List<string> main_system_tag { get; set; }//大类tag
|
||||
public List<string> sub_system_tag { get; set; }//小类tag
|
||||
public byte? work_type { get; set; } // 1:保養, 2:維修
|
||||
}
|
||||
|
||||
@ -125,4 +125,16 @@ namespace FrontendWebApi.Models
|
||||
public string ori_file_name { get; set; }
|
||||
public string save_file_name { get; set; }
|
||||
}
|
||||
|
||||
public class Find_Sub_List
|
||||
{
|
||||
public List<string> main_system_tag { get; set; }
|
||||
}
|
||||
|
||||
public class ExportExcel
|
||||
{
|
||||
public byte? work_type { get; set; }
|
||||
public DateTime? startdate { get; set; }
|
||||
public DateTime? enddate { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user