[Frontend] Login Niagara 登入串接 | Niagara baja 取得帳號資料
This commit is contained in:
parent
86426b5782
commit
c2ebd6eb3a
@ -173,7 +173,7 @@ namespace Backend.Controllers
|
||||
{ "@message_content", sendContent}
|
||||
};
|
||||
|
||||
await backendRepository.AddOneByCustomTable(insertNotify, "background_service_message_notification_task");
|
||||
//await backendRepository.AddOneByCustomTable(insertNotify, "background_service_message_notification_task");
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "儲存成功";
|
||||
|
@ -499,7 +499,7 @@
|
||||
</div>
|
||||
<div id="detDevDiv" style="display:none">
|
||||
<button class="btn btn-info" data-toggle="prevDiv"><i class="fas fa-angle-left mr-2"></i>上一頁</button>
|
||||
<table class="table table-hover">
|
||||
<table id="eleManDevTable" class="table table-hover">
|
||||
<thead>
|
||||
<tr class="text-center">
|
||||
<th scope="col">號機</th>
|
||||
@ -520,7 +520,7 @@
|
||||
<td>
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<div class="row mr-2">
|
||||
<input name="preMea" type="checkbox" class="toggle" data-toggle="toggle">
|
||||
<input name="preMea" type="checkbox" class="toggle" data-toggle="toggle" data-point="SP_DP" >
|
||||
</div>
|
||||
<i id="preMeaSche" data-point="DP" class="fas fa-calendar-alt fs-1-1 mr-2 cur-poi"></i>
|
||||
</div>
|
||||
@ -528,7 +528,7 @@
|
||||
<td>
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<div class="row mr-2">
|
||||
<input name="stop" type="checkbox" class="toggle" data-toggle="toggle">
|
||||
<input name="stop" type="checkbox" class="toggle" data-toggle="toggle" data-point="SP_RCS">
|
||||
</div>
|
||||
<i id="stopSche" data-point="RCS" class="fas fa-calendar-alt fs-1-1 mr-2 cur-poi"></i>
|
||||
</div>
|
||||
@ -536,7 +536,7 @@
|
||||
<td>
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<div class="row mr-2">
|
||||
<input name="onlyOpe" type="checkbox" class="toggle" data-toggle="toggle">
|
||||
<input name="onlyOpe" type="checkbox" class="toggle" data-toggle="toggle" data-point="SP_IND">
|
||||
</div>
|
||||
<i id="onlyOpeSche" data-point="IND" class="fas fa-calendar-alt fs-1-1 mr-2 cur-poi"></i>
|
||||
</div>
|
||||
@ -544,7 +544,7 @@
|
||||
<td>
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<div class="row mr-2">
|
||||
<input name="vip" type="checkbox" class="toggle" data-toggle="toggle">
|
||||
<input name="vip" type="checkbox" class="toggle" data-toggle="toggle" data-point="SP_VIP">
|
||||
</div>
|
||||
<i id="vipSche" data-point="VIP" class="fas fa-calendar-alt fs-1-1 mr-2 cur-poi"></i>
|
||||
</div>
|
||||
@ -552,7 +552,7 @@
|
||||
<td>
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<div class="row mr-2">
|
||||
<input name="retOpe" type="checkbox" class="toggle" data-toggle="toggle">
|
||||
<input name="retOpe" type="checkbox" class="toggle" data-toggle="toggle" data-point="SP_RET">
|
||||
</div>
|
||||
<i id="retOpeSche" data-point="RET" class="fas fa-calendar-alt fs-1-1 mr-2 cur-poi"></i>
|
||||
</div>
|
||||
@ -1430,6 +1430,7 @@
|
||||
onEvent("click", "#eleManTable [id^=eleManDevEdit]", function () {
|
||||
let devNum = $(this).prop("id").split("eleManDevEdit")[1];
|
||||
let scheBtn = ["preMeaSche", "stopSche", "onlyOpeSche", "vipSche", "retOpeSche"];
|
||||
$("#detDevDiv").data("devnum", devNum);
|
||||
$("#bajaSche").html("");
|
||||
// 電梯管理 Modal 切換到 detail 頁面
|
||||
modalTogDiv("#eleManModal", "#tabDiv", "#detDevDiv", "next", function () {
|
||||
@ -1451,26 +1452,45 @@
|
||||
let master = $(this).prop("id").split("eleManMasEdit")[1];
|
||||
let subData = subSeviceData.filter(x => x.device_number.split("_")[5] == master)[0];
|
||||
$("#bajaMasSche").html("");
|
||||
|
||||
// 電梯管理 Modal 切換到 detail 頁面
|
||||
modalTogDiv("#eleManModal", "#tabDiv", "#detMasDiv", "next", function () {
|
||||
subDeviceSetEleManNotSerFloor(master);
|
||||
let devNumPath = subData.device_number?.split("_").join("/");
|
||||
let ifHtml = `<iframe src="/ord?station:%7Cslot:${devNumPath}/Sch_FLS|view:?fullScreen=true" width="100%" height="100%" style="height:30rem"></iframe>`
|
||||
$("#bajaMasSche").html(ifHtml);
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
// 電梯管理 Modal 不服務樓層 設定不服務樓層(BAJA)
|
||||
onEvent("click", "#eleManTable [name^=notSerChk]", function () {
|
||||
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()
|
||||
baja.Ord.make("local:|foxs:|station:|slot:/TPE/B1/ELEV/EL/R2F/NA/ELEV1/N1").get()
|
||||
.then(function (table) {
|
||||
});
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
// 電梯管理 Modal 設備 設定點位(BAJA)
|
||||
onEvent("change", "#eleManDevTable input:checkbox", function () {
|
||||
debugger
|
||||
let devNum = $("#detDevDiv").data("devnum");
|
||||
let point = $(this).data("point");
|
||||
let val = $(this).val();
|
||||
let devNumPath = devNum?.split("_").join("/");
|
||||
require(['baja!'], function (baja) {
|
||||
baja.Ord.make(`local:|foxs:|station:|slot:${devNumPath}`).get()
|
||||
.then(function (dev) {
|
||||
dev.set({
|
||||
slot: point,
|
||||
value:val == "on"? true : false,
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
// 切換 modal 內 div 頁面
|
||||
function modalTogDiv(modal, div1, div2, type = "next", callback = null) {
|
||||
$(modal).find(div1).parent("div").css("overflow", "hidden");
|
||||
|
@ -2560,6 +2560,10 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
||||
location.href = "login.html";
|
||||
}
|
||||
|
||||
if (location.href.indexOf("ord") != -1) {
|
||||
location.href = "/file/index.html"
|
||||
}
|
||||
|
||||
$(function () {
|
||||
// 二次引用 jquery.js
|
||||
// - 在 require 內部程序需要引用 jquery,由於 require 的套件需要依賴 jquery ,就算 HTML 已經引用 jquery, require 也無法參考
|
||||
|
@ -1,6 +1,9 @@
|
||||
let baja_subscribe_device_callback_func; //設定BQL訂閱之後要回傳的Function
|
||||
let baja_my_user_account_func; //取得帳號資料要回傳的Function
|
||||
var ordPath; //當前點選選單的tag,用來抓出設備路徑,例如:旅館棟->H,消防偵煙器->F3
|
||||
window.tolSubList = [];
|
||||
|
||||
var user_name = "";
|
||||
function subscriptionDevices() {
|
||||
// 用BQL的方式去訂閱
|
||||
this.setSubscribeDevicesByBql = function (tempOrdPath) {
|
||||
@ -13,6 +16,16 @@ function subscriptionDevices() {
|
||||
baja_subscribe_device_callback_func = callBackFunc;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function MyBaja() {
|
||||
// 取得使用者帳號
|
||||
this.setMyUserAccount = function (callBackFunc) {
|
||||
if (callBackFunc != undefined && callBackFunc != null) {
|
||||
baja_my_user_account_func = callBackFunc;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@ -270,7 +283,12 @@ function getElevatorInfoByBaja(path, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
require(['baja!'], function (baja) {
|
||||
user_name = baja.getUserName();
|
||||
if (baja_my_user_account_func != undefined && baja_my_user_account_func != null) {
|
||||
baja_my_user_account_func(user_name);
|
||||
}
|
||||
});
|
||||
|
||||
// baja.Ord.make('ip:greencloud.fic.com.tw|foxs:|station:|slot:/Arena/H/F3|bql:select name, displayname, slotPath, out.value, out from control:ControlPoint')
|
||||
// // baja.Ord.make('ip:greencloud.fic.com.tw|foxs:|station:|slot:/Arena/H/E1/B1F/TestData/H_E1_B1F_TestData_Data|bql:select slotPath,out.value from control:NumericWritable')
|
||||
|
@ -69,23 +69,62 @@
|
||||
<source src="media/video/cc.mp4" type="video/mp4">
|
||||
</video>
|
||||
<!--Base JS-->
|
||||
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
|
||||
<!--<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>-->
|
||||
<script src="lib/vendors.bundle.js"></script>
|
||||
<script src="lib/app.bundle.js"></script>
|
||||
<!-- JQuery Validate -->
|
||||
<script src="lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||
<!--<script src="lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||
<script src="lib/jquery-validation/dist/additional-methods.min.js"></script>
|
||||
<script src="lib/jquery-validation/dist/localization/messages_zh_TW.js"></script>
|
||||
<script src="lib/notifications/sweetalert2/sweetalert2.bundle.js"></script>
|
||||
<script src="lib/notifications/sweetalert2/sweetalert2.bundle.js"></script>-->
|
||||
<script src="lib/notifications/toastr/toastr.min.js"></script>
|
||||
<script src="js/toast.js"></script>
|
||||
<script src="js/init.js"></script>
|
||||
|
||||
|
||||
<!--Bajascript-->
|
||||
<script src="js/bajascript/bscriptReq.js"></script>
|
||||
<!--<script type='text/javascript' src='/module/js/com/tridium/js/ext/require/require.min.js?version=1496767636459'></script>-->
|
||||
<script src='js/bajascript/require.js'></script>
|
||||
|
||||
<script src="js/n4js/bajatest.js"></script>
|
||||
<script src="js/bajascript/require.config.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<script>
|
||||
var remember = false;
|
||||
var myBaja = null;
|
||||
$(function () {
|
||||
require(["jquery"], loadedBasePack);
|
||||
});
|
||||
/**
|
||||
* jquery.js 二次引用後 Callback,載入第三方套件
|
||||
* */
|
||||
function loadedBasePack() {
|
||||
require(
|
||||
[
|
||||
"lib/app.bundle",
|
||||
"lib/app.menu",
|
||||
"lib/jquery-validation/dist/jquery.validate",
|
||||
"lib/jquery-validation/dist/additional-methods.min",
|
||||
"lib/jquery-validation/dist/localization/messages_zh_TW",
|
||||
/*"lib/notifications/sweetalert2/sweetalert2.bundle",*/
|
||||
], loadedMasterPack);
|
||||
}
|
||||
/**
|
||||
* 第三方套件引用後 Callback,載入額外套件
|
||||
* */
|
||||
function loadedMasterPack() {
|
||||
require(
|
||||
[
|
||||
"init",
|
||||
|
||||
] ,loadedJsPack);
|
||||
}
|
||||
|
||||
function loadedJsPack() {
|
||||
myBaja = new MyBaja();
|
||||
myBaja.setMyUserAccount(Login)
|
||||
|
||||
if (localStorage.getItem('taipei-t') == 'true') {
|
||||
document.getElementById("rememberme").checked = true;
|
||||
remember = true;
|
||||
@ -95,8 +134,37 @@
|
||||
else {
|
||||
document.getElementById("rememberme").checked = false;
|
||||
}
|
||||
|
||||
var loginValidate = $("#login-form").validate({
|
||||
rules: {
|
||||
account: {
|
||||
required: true,
|
||||
maxlength: 50,
|
||||
filterspace: true
|
||||
},
|
||||
password: {
|
||||
required: true,
|
||||
maxlength: 50,
|
||||
filterspace: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//驗證是否為空白
|
||||
jQuery.validator.addMethod("filterspace", function (value, element) {
|
||||
var str = value;
|
||||
var result = false;
|
||||
if (str.length > 0) {
|
||||
if ($.trim(str) != '') {
|
||||
result = true;
|
||||
}
|
||||
else {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}, "不可填入空白");
|
||||
|
||||
$("#rememberme").click(function () {
|
||||
if (remember) {
|
||||
localStorage.setItem('taipei-t', 'false');
|
||||
@ -126,48 +194,15 @@
|
||||
localStorage.removeItem('taipei-p');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
//#region 登入表單驗證
|
||||
var loginValidate = $("#login-form").validate({
|
||||
rules: {
|
||||
account: {
|
||||
required: true,
|
||||
maxlength: 50,
|
||||
filterspace: true
|
||||
},
|
||||
password: {
|
||||
required: true,
|
||||
maxlength: 50,
|
||||
filterspace: true
|
||||
}
|
||||
}
|
||||
});
|
||||
function Login(account) {
|
||||
|
||||
//驗證是否為空白
|
||||
jQuery.validator.addMethod("filterspace", function (value, element) {
|
||||
var str = value;
|
||||
var result = false;
|
||||
if (str.length > 0) {
|
||||
if ($.trim(str) != '') {
|
||||
result = true;
|
||||
}
|
||||
else {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}, "不可填入空白");
|
||||
//#endregion
|
||||
|
||||
function Login(e) {
|
||||
e.preventDefault();
|
||||
if ($("#login-form").valid()) {
|
||||
console.log(account)
|
||||
/*if ($("#login-form").valid()) {*/
|
||||
var url = baseApiUrl + "/api/Login/";
|
||||
var send_data = {
|
||||
account: "admin",
|
||||
password: "123456"
|
||||
account: account,
|
||||
password: "rJ2T5Kkj"
|
||||
}
|
||||
$.ajax({
|
||||
method: "post",
|
||||
@ -177,6 +212,8 @@
|
||||
contentType: "application/json; charset=UTF-8",
|
||||
dataType: 'json',
|
||||
success: function (rel) {
|
||||
console.log(rel)
|
||||
|
||||
//rel = JSON.stringify(rel);
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg || "系統內部發生錯誤,請聯絡系統管理員");
|
||||
@ -190,10 +227,21 @@
|
||||
}
|
||||
},
|
||||
error: function (xhr, textStatus, thrownError) {
|
||||
toast_error(textStatus);
|
||||
alert(textStatus);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
//#region 登入表單驗證
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user