[Frontend] bajascript 衝突合併 | 圖資管理事件合併

This commit is contained in:
dev01 2022-11-22 13:37:21 +08:00
commit 8875206511
8 changed files with 1218 additions and 438 deletions

View File

@ -0,0 +1,201 @@
<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" class="btn btn-secondary waves-effect waves-themed">建築</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed">電力管線</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed">水力管線</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed">控制系統</button>
</div>
</div>
<div class="col-auto">
<div class="form-group">
<input type="text" id="simpleinput" class="form-control" placeholder="關鍵字">
</div>
</div>
<div class="col-auto">
<a href="#" class="btn btn-info">查詢</a>
</div>
<hr>
</div>
<div class="row bg-dark p-2 mb-5 align-items-center">
<div class="col-auto">
<a href="#" class="btn btn-info">全選</a>
</div>
<div class="col-auto">
<div class="frame-wrap">
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="defaultInline1">
<label class="custom-control-label" for="defaultInline1">施工詳圖</label>
</div>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="defaultInline2">
<label class="custom-control-label" for="defaultInline2">設備規範</label>
</div>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="defaultInline3">
<label class="custom-control-label" for="defaultInline3">工程介面圖說</label>
</div>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="defaultInline4">
<label class="custom-control-label" for="defaultInline4">門禁規範</label>
</div>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="defaultInline5">
<label class="custom-control-label" for="defaultInline5">監控平面圖</label>
</div>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="defaultInline6">
<label class="custom-control-label" for="defaultInline6">其它</label>
</div>
</div>
</div>
</div>
<div class="row">
<div class="mb-3">
<a href="#" class="btn btn-success">+ 上傳</a>
</div>
<table class="table table-bordered table-striped text-center m-0">
<thead class="thead-themed">
<tr>
<th>圖號</th>
<th>圖名</th>
<th>原設計</th>
<th>竣工圖</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>TEST03</td>
<td>TEST03</td>
<td>A-01.dwg</td>
<td></td>
<td>
<a href="#" class="btn btn-info">編輯</a>
<a href="#" class="btn btn-danger">刪除</a>
</td>
</tr>
<tr>
<td>TEST06</td>
<td>TEST06</td>
<td>A-01.dwg</td>
<td>AS-01.dwg</td>
<td>
<a href="#" class="btn btn-info">編輯</a>
<a href="#" class="btn btn-danger">刪除</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</main>
<!-- TEST Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#staticBackdrop">
Launch static backdrop modal
</button>
<div class="mb-3"> <a href="#" class="btn btn-success" data-toggle="modal" data-target="#accManModal">+ 新增</a>
</div>
<div class="modal fade" id="accManModal" 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="accManForm">
<div class="modal-body">
<div class="row">
<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"
placeholder="Email">
</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>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">關閉</button>
<button type="submit" class="btn btn-primary" id="accManSendBtn" e-prevent>儲存</button>
</div>
</form>
</div>
</div>
</div>
<!-- TEST Modal -->
<div class="modal fade" id="staticBackdrop" data-backdrop="static" data-keyboard="false" tabindex="-1"
aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="staticBackdropLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Understood</button>
</div>
</div>
</div>
</div>
<div class="modal fade modal-backdrop-transparent" id="modal-shortcut" tabindex="-1" role="dialog"
aria-labelledby="modal-shortcut" aria-hidden="true">
<div class="modal-dialog modal-dialog-top modal-transparent" role="document">
<div class="modal-content">
<div class="modal-body">
<ul class="app-list w-auto h-auto p-0 text-left">
<li>
<a href="intel_introduction.html" class="app-list-item text-white border-0 m-0">
<div class="icon-stack">
<i class="base base-7 icon-stack-3x opacity-100 color-primary-500 "></i>
<i class="base base-7 icon-stack-2x opacity-100 color-primary-300 "></i>
<i class="fal fa-home icon-stack-1x opacity-100 color-white"></i>
</div>
<span class="app-list-name">
Home
</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>

162
Frontend/_historyData.html Normal file
View File

@ -0,0 +1,162 @@
<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="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)">
</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>
<div class="filter-message js-filter-message m-0 text-left pl-4 py-3 fw-500"></div>
</div>
</div>
<div class="col-sm-12 col-xl-10">
<h1 class="p-2 mb-0">歷史資料瀏覽</h1>
<div class="row bg-dark p-2 mb-5">
<div class="col-auto">
<div class="btn-group">
<button type="button" class="btn btn-secondary waves-effect waves-themed">日期</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed">日區間</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed"></button>
</div>
</div>
<div class="col-auto">
<div class="btn-group">
<button type="button" class="btn btn-secondary waves-effect waves-themed">今天</button>
<button 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="example-date" type="date" name="date" value="2023-07-23">
</div>
</div>
<div class="col-auto">
<a href="#" class="btn btn-info">查詢</a> <a href="#" class="btn btn-info waves-effect waves-themed">
<span class="fal fa-file-excel mr-1"></span>
匯出
</a>
</div>
</div>
<div class="row mb-2">
<div class="btn-group">
<button type="button" class="btn btn-secondary waves-effect waves-themed">溫度</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed">輸入電壓</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed">輸入電流</button>
</div>
</div>
<div class="row">
<div class="frame-wrap">
<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>儲冰設備A01</td>
<td>27.0</td>
<td>2021-08-01 23:55:00</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</main>
<script>
let sst = '';
let mst = '';
$(function () {
initList();
// default list filter
initApp.listFilter($('#js_default_list'), $('#js_default_list_filter'));
// custom response message
initApp.listFilter($('#js-list-msg'), $('#js-list-msg-filter'));
//accordion filter
initApp.listFilter($('#js_list_accordion'), $('#js_list_accordion_filter'));
// nested list filter
initApp.listFilter($('#js_nested_list'), $('#js_nested_list_filter'));
//init navigation
initApp.buildNavigation($('#js_nested_list'));
initData();
});
function initList() {
let sendData = {
building_tag: pageAct.buiTag
}
objSendData.Data = sendData;
let url = baseApiUrl + "/api/History/GetMainSub";
function success(res) {
let strHtml = ``;
$.each(res.data.history_Main_Systems, function (index, val) {
console.log(index)
strHtml += `<li>
<a href="#" data-filter-tags="user interface buttons compass action dropdown navigation sidebars" data-maintag="${val.main_system_tag}">
<span class="nav-link-text">${val.full_name}</span>
</a>
<ul style="${index == 0 ? `display:block;` : ``}">`;
$.each(val.history_Sub_systems, function (index2, val2) {
strHtml += `<li>
<a href="#" onClick="getData(${val2.sub_system_tag}, ${val.main_system_tag})" data-filter-tags="user interface buttons" data-subtag="${val2.sub_system_tag}">
<span class="nav-link-text">
${val2.full_name} ${val2.sub_system_tag}
</span>
</a>
</li>`;
if (index == 0 && index2 == 0) {
sst = val2.sub_system_tag;
mst = val.main_system_tag;
}
});
strHtml += `</ul> </li>`;
});
$('#js_nested_list').html(strHtml);
getData(sst, mst);
}
ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
}
function initData() {
getHistoryDataByBaja("TPE_B1_EE_E4_R2F_NA_WHT_N1_A1",
1667232000000,
1667232000000,
"空調設備",
"Mitsubishi_Sup",
callbackForHistory);
}
function getData(sst2, mst1)
{
//getHistoryDataByBaja("TPE_B1_EE_E4_R2F_NA_WHT_N1_A1",
// 1667232000000,
// 1667232000000,
// "空調設備",
// "Mitsubishi_Sup",
// callbackForHistory);
}
function callBackFromHistory(res) {
console.log(res)
}
</script>

File diff suppressed because it is too large Load Diff

View File

@ -189,80 +189,3 @@ function BajaSubscribeDevicesByBql() {
});
}
function getElevatorInfoByBaja(path, callback) {
var _result = "";
var _ss = '{';
var _index = 0;
//
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|station:|slot:/TPE/B1/ELEV/EL/R2F/NA/ELEV1/N1|bql:select name, displayName, out, out.value, slotPath, parent.name as 'device_number' from control:ControlPoint where name = 'CP' or name = 'RD' or name = 'DS' or name = 'ST' or name = 'LOAD' or name = 'MID' or name = 'HAND' or name = 'IND' or name = 'MD' or name = 'DNO'").get()
.then(function (table) {
return table.cursor({
each: function (record) {
var item = null;
var value = null;
if (record.get('name') == "CP") {
item = "floor";
value = record.get('out').get('value');
}
else if (record.get('name') == "RD") { //UP or DOWN
item = "direction";
value = record.get('out').get('value');
}
else if (record.get('name') == "DS") {
item = "door_state";
value = record.get('out').get('value') == true ? "OPEN" : "CLOSE";;
}
else if (record.get('name') == "ST") {
item = "running_status";
value = record.get('out').get('value');
}
else if (record.get('name') == "LOAD") {
item = "loading";
value = record.get('out').get('value');
}
else if (record.get('name') == "MID") {
item = "maintenance";
value = record.get('out').get('value');
}
else if (record.get('name') == "HAND") {
item = "manual";
value = record.get('out').get('value');
}
else if (record.get('name') == "IND") {
item = "independent";
value = record.get('out').get('value');
}
else if (record.get('name') == "MD") {
item = "vip";
value = record.get('out').get('value');
}
else if (record.get('name') == "DNO") {
item = "automatic";
value = record.get('out').get('value');
}
if (item != null && item != "")
{
if (_index == 0)
_ss += '{"item":"' + item + '", "value":"' + value + '"}';
else
_ss += ',{"item":"' + item + '", "value":"' + value + '"}';
_index++;
}
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss;
_result += ']}';
if (typeof callback === 'function') {
callback(_result);
}
}
});
});
});
}

View File

@ -0,0 +1,77 @@

function getElevatorInfoByBaja(path, callback) {
var _result = "";
var _ss = '{';
var _index = 0;
//
require(['baja!'], function (baja) {
baja.Ord.make("local:|foxs:|station:|slot:/" + path + "|bql:select name, displayName, out, out.value, slotPath, parent.name as 'device_number' from control:ControlPoint where name = 'CP' or name = 'RD' or name = 'DS' or name = 'ST' or name = 'LOAD' or name = 'MID' or name = 'HAND' or name = 'IND' or name = 'MD' or name = 'DNO'").get()
.then(function (table) {
return table.cursor({
each: function (record) {
var item = null;
var value = null;
if (record.get('name') == "CP") {
item = "floor";
value = record.get('out').get('value');
}
else if (record.get('name') == "RD") { //UP or DOWN
item = "direction";
value = record.get('out').get('value');
}
else if (record.get('name') == "DS") {
item = "door_state";
value = record.get('out').get('value') == true ? "OPEN" : "CLOSE";
}
else if (record.get('name') == "ST") {
item = "running_status";
value = record.get('out').get('value');
}
else if (record.get('name') == "LOAD") {
item = "loading";
value = record.get('out').get('value');
}
else if (record.get('name') == "MID") {
item = "maintenance";
value = record.get('out').get('value');
}
else if (record.get('name') == "HAND") {
item = "manual";
value = record.get('out').get('value');
}
else if (record.get('name') == "IND") {
item = "independent";
value = record.get('out').get('value');
}
else if (record.get('name') == "MD") {
item = "vip";
value = record.get('out').get('value');
}
else if (record.get('name') == "DNO") {
item = "automatic";
value = record.get('out').get('value');
}
if (item != null && item != "") {
if (_index == 0)
_ss += '{"item":"' + item + '", "value":"' + value + '"}';
else
_ss += ',{"item":"' + item + '", "value":"' + value + '"}';
_index++;
}
},
after: function () {
_result += '{' + '"count": ' + _index + ', "data":[';
_result += _ss;
_result += ']}';
if (typeof callback === 'function') {
callback(_result);
}
}
});
});
});
}

View File

@ -61,16 +61,16 @@ namespace FrontendWebApi.ApiControllers
{
var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
@$"select distinct v1.system_key main_name, v1.system_value main_system_tag, v2.system_key sub_name, v2.system_value sub_system_tag, v1.system_priority, v2.system_priority,
dk.device_normal_color, dk.device_close_color, dk.device_error_color,
di.full_name as device_item_name, di.points as device_item_points, di.unit as device_item_unit, di.is_show_riserDiagram as device_item_is_show_riserDiagram,
di.is_controll as device_item_is_controll, di.is_bool as device_item_is_bool, di.is_link as device_item_is_link
dk.device_normal_color, dk.device_close_color, dk.device_error_color
-- di.full_name as device_item_name, di.points as device_item_points, di.unit as device_item_unit, di.is_show_riserDiagram as device_item_is_show_riserDiagram,
-- di.is_controll as device_item_is_controll, di.is_bool as device_item_is_bool, di.is_link as device_item_is_link
from role_auth a
join auth_page b on a.AuthCode = b.AuthCode
join userinfo c on c.role_guid = a.role_guid
join variable v2 on b.ShowView = v2.id and v2.system_type = @sub_system_type
join variable v1 on v1.id = v2.system_parent_id and v1.system_type = @main_system_type
left join device_kind dk on v1.system_value = dk.device_system_tag and v2.system_value = dk.device_name_tag and dk.device_building_tag = @building_tag
left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0
-- left join device_item di on v2.system_value = di.device_name_tag and v1.system_value = di.device_system_tag and di.deleted = 0
where c.account = @account
order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type, @building_tag = fd.building_tag });
var mains = dbsub.GroupBy(a => a.main_system_tag).ToList();

View File

@ -91,11 +91,6 @@ namespace FrontendWebApi.ApiControllers
sheet.SetColumnWidth(0, 4 * 160 * 12);
sheet.SetColumnWidth(1, 4 * 160 * 12);
sheet.SetColumnWidth(2, 4 * 160 * 12);
sheet.SetColumnWidth(3, 4 * 160 * 12);
sheet.SetColumnWidth(4, 4 * 160 * 12);
sheet.SetColumnWidth(5, 4 * 160 * 12);
sheet.SetColumnWidth(6, 4 * 160 * 12);
sheet.SetColumnWidth(7, 4 * 160 * 12);
ICell cell = row.CreateCell(0);
cell.SetCellValue("設備名稱");
cell.CellStyle = styleLine12;
@ -152,7 +147,7 @@ namespace FrontendWebApi.ApiControllers
/// <returns></returns>
[HttpPost]
[Route("api/History/GetMainSub")]
public async Task<ActionResult<ApiResult<History_MainSubBuildFloor>>> GetMainSub()
public async Task<ActionResult<ApiResult<History_MainSubBuildFloor>>> GetMainSub([FromBody] HistoryFind hf)
{
ApiResult<History_MainSubBuildFloor> apiResult = new ApiResult<History_MainSubBuildFloor>(jwt_str);
if (!jwtlife)
@ -160,6 +155,13 @@ namespace FrontendWebApi.ApiControllers
apiResult.Code = "5000";
return BadRequest(apiResult);
}
else if (string.IsNullOrEmpty(hf.building_tag))
{
apiResult.Code = "0002";
apiResult.Msg = "必須選擇東別";
return apiResult;
}
try
{
var dbsub = await frontendRepository.GetAllAsync<HistoryDBMainSub>(
@ -176,9 +178,9 @@ namespace FrontendWebApi.ApiControllers
join auth_page b on a.AuthCode = b.AuthCode
join userinfo c on c.role_guid = a.role_guid
join building d on d.building_tag = b.building_tag
where c.account = '{myUser.account}'
where c.account = @account and d.building_tag = @building_tag
order by d.priority
", new { @account = myUser.account });
", new { @account = myUser.account, @building_tag = hf.building_tag });
var mains = dbsub.GroupBy(a => a.main_system_tag).ToList();
apiResult.Data = new History_MainSubBuildFloor();
apiResult.Data.history_Main_Systems = new List<History_Main_system>();
@ -189,12 +191,12 @@ namespace FrontendWebApi.ApiControllers
history_Main_System.full_name = main.Select(a => a.main_name).FirstOrDefault();
history_Main_System.History_Sub_systems = new List<History_Sub_system>();
var subs = main.GroupBy(a => a.main_system_tag).ToList();
var subs = dbsub.Where(x => x.main_system_tag == main.Select(m => m.main_system_tag).FirstOrDefault()).ToList();
foreach (var sub in subs)
{
History_Sub_system history_Sub_System = new History_Sub_system();
history_Sub_System.full_name = sub.Select(a => a.sub_name).FirstOrDefault();
history_Sub_System.sub_system_tag = sub.Select(a => a.sub_system_tag).FirstOrDefault();
history_Sub_System.full_name = sub.sub_name;
history_Sub_System.sub_system_tag = sub.sub_system_tag;
history_Main_System.History_Sub_systems.Add(history_Sub_System);
}
apiResult.Data.history_Main_Systems.Add(history_Main_System);

View File

@ -72,6 +72,10 @@ namespace FrontendWebApi.Models
public byte device_item_is_link { get; set; }
}
public class HistoryFind
{
public string building_tag { get; set; }
}
public class BuildingFloorRawData
{
public string building_guid { get; set; }