diff --git a/Frontend/index.html b/Frontend/index.html index f925835..a311627 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -1009,17 +1009,18 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li }) - onEvent("click", "button[id^=noticeChkBtn]", function () { - $(this).parents(".toast").YTNotice("hide"); - }) + //onEvent("click", "button[id^=noticeChkBtn]", function () { + // $(this).parents(".toast").YTNotice("hide"); + //}) - onEvent("click", "button[id^=bajaAckBtn]", function () { + onEvent("click", "button[id^=noticeChkBtn]", function () { /**button[id^=bajaAckBtn] */ let uuid = $(this).data("uuid"); let url = window.location.origin + "/obix/alarm/" + uuid + "/ack"; let myBaja = new MyBaja(); myBaja.setMyUserAccount((data) => { let sendData = ''; $.post(url, sendData, (rel) => { + console.log(rel) $(this).parents(".toast").YTNotice("hide"); }, "text") }) @@ -1659,6 +1660,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li let notices = []; $.each(datas, (idx, data) => { if (noticeOptArr.findIndex(x => x.id == data.id) == -1) { + /* */ let content = `
異常編號:${data.id} @@ -1676,8 +1678,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li 異常訊息:${data.errMsg}
- - +
` let main = { @@ -1685,7 +1686,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li content: content, type: "warning", id: data.id, - hasCloseBtn: false, + hasCloseBtn: true, timeText: displayDate(data.timestamp), } noticeOptArr.push(main); diff --git a/Frontend/js/yourteam/plugins/yt-notice/yt-notice.js b/Frontend/js/yourteam/plugins/yt-notice/yt-notice.js index 9e01431..216c6b9 100644 --- a/Frontend/js/yourteam/plugins/yt-notice/yt-notice.js +++ b/Frontend/js/yourteam/plugins/yt-notice/yt-notice.js @@ -173,7 +173,7 @@ class YTNoticeBlock { setTimeout(() => { $(toast).remove(); - let tarNoticeId = $(obj)[0]._ytNotice.id + let tarNoticeId = $(toast)[0]._ytNotice.id let tarNoticeIdx = this.noticeArr.findIndex(x => x.obj.id == tarNoticeId); if (tarNoticeIdx != -1) { this.noticeArr[tarNoticeIdx].canShow = false; @@ -220,6 +220,7 @@ class YTNoticeBlock { if (this.noticeArr.findIndex(x => x.obj.id == option.id) == -1) { let notice = new YTNotice(option); this.noticeArr.push({ obj: notice, time: (new Date()).getTime(), canShow: true }); + this.setEvent(notice); } this.updEleObj(); } @@ -227,6 +228,23 @@ class YTNoticeBlock { updEleObj = function () { $(this.element)[0]._noticeBlock = this; } + + setEvent = function (notice) { + let _this = this; + $(notice.container).on("hidden.bs.toast", function () { + setTimeout(() => { + $(notice.container).remove(); + + let tarNoticeId = $(notice.container)[0]._ytNotice.id + let tarNoticeIdx = _this.noticeArr.findIndex(x => x.obj.id == tarNoticeId); + if (tarNoticeIdx != -1) { + _this.noticeArr[tarNoticeIdx].canShow = false; + } + _this.showNotices(); + }, 100) + }) + } + } $.fn.YTNotice = function (method = "init", ...args) {