Commit bf800570 authored by xinzhedeai's avatar xinzhedeai

add:大屏点位数据显示处理(qf源码修改)

parent 2039ab78
!function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(n,o,function(t){return e[t]}.bind(null,o));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=2)}([,,function(e,t,i){e.exports=i(3)},function(e,t,i){!function(e){document;var t=document.body;new function(){var i=this;e.extend.call(this,{popupLayer:function(e){var t=e.title&&(e.title.indexOf("<")>-1?e.title:"<span>"+e.title+"</span>")||"",i=e.closeBtnColor?"color:"+e.closeBtnColor:"",n=t?'<div class="qfui-message-box el-message-box__header"><div class="el-message-box__title">'+t+"</div></div>":"",o=e.confirm,a="[object Function]"===Object.prototype.toString.call(o)?'<div class="el-message-box__btns"><button type="button" aria-label="Confirm" class="el-button el-button--default el-button--small el-button--primary">确定</button></div>':"",s='<div class="kmb-message-box custom-alert">'+n+'<div class="el-message-box__content" style="min-width:300px;width:'+e.width+'"><div class="alert-ctbox">'+(e.html||"")+"</div></div>"+a+'<button class="el-message-box__headerbtn el-icon-close" aria-label="Close" style="top:8px;right:10px;font-size:18px;'+i+'"></button></div>',l=document.createElement("div");l.id="culayer",l.className="el-message-box__wrapper "+(e.className||""),l.style.cssText="z-index:2001;background-color:rgba(0,0,0,.5);",l.innerHTML=s,document.body.appendChild(l);var r=l.querySelector(".alert-ctbox");e.onload&&e.onload(r),l.onclick=function(t){var i=t.target||t.srcElement;"BUTTON"===i.nodeName&&("Confirm"===i.getAttribute("aria-label")?(document.body.removeChild(l),e.confirm&&e.confirm(r)):"Close"===i.getAttribute("aria-label")&&(document.body.removeChild(l),e.close&&e.close()))}},pointCharts:function(t){var n=function(t){var i=t.chartsBox;return this.pictureArea=i.firstElementChild,this.pointsLayer=i.lastElementChild,this.pointsCtn=this.pointsLayer.firstElementChild,this.itemClick=t.itemClick,this.pointsCtn.innerHTML="",this.layoutWidth=e.parseWpx(t.width),this.layoutHeight=e.parseWpx(t.height),this.isRelieveAlarm=t.isRelieveAlarm||!1,this};return n.prototype={init:function(e,t,i){this.setBackground(i).then(()=>{}),this.createPoints(t,e)},setBackground:function(e){return new Promise((t,i)=>{if(e){var n=this.pictureArea.firstElementChild;n.src=e,n.style.cssText="height:100%;width:100%;",this.pictureArea.classList.add("show"),this.pointsLayer.classList.add("show"),n.onload=function(){t()}}else this.pictureArea.classList.remove("show"),this.pointsLayer.classList.remove("show")})},createPoint:function(t,i){var n=i.height,o=i.width,a=this.layoutWidth/o,s=this.layoutHeight/n,l=t.name||"",r=t.infoseat||"up",c=document.createElement("li"),u=t.guid||e.getGuid();c.className=t.type,c.dataset.id=u,c.style.diesplay="none",c.style.top=e.parseRem(t.y*s)+"rem",c.style.left=e.parseRem(t.x*a)+"rem",c.style.width=e.parseRem(t.width)+"rem",c.style.height=e.parseRem(t.height)+"rem",c.innerHTML='<i style="transform:rotate('+~~t.angle+'deg)"></i><div class="'+r+'"><div class="text"><h4>'+l+"</h4><dl></dl></div></div>",this.pointsCtn.appendChild(c),t.guid=u;var d={config:t,element:c};this.setBindAttr(d,c.lastElementChild),d.items=t.items||[]},createPoints:function(e,t){for(var i of e)this.createPoint(i,t)},switchActive:function(e){var t=this.mouseInfo;t.target&&t.target.classList.remove("active"),e.classList.add("active"),t.target=e;var n=e.dataset.id;i.focusPoint=this.pointList[n],i.form2.monitorValues=i.focusPoint.values||[]},cancelActive:function(){var e=this.mouseInfo;e.target&&e.target.classList.remove("active"),i.focusPoint={},i.form2.monitorValues=[]},setBindAttr:function(e,t){var i=this,n=t.firstElementChild.lastElementChild;Object.defineProperty(e,"items",{set:function(t){var o="",a=[];for(var s of t){var l=i.getAlarmlevel(s.alarmlevel),r=s.state?"offline":"online",c=l.icon||(s.state?"el-icon-remove-outline":"el-icon-check"),u=(l.level||r)+" "+c,d=s.id||s.value,f=s.alarmlevel&&i.isRelieveAlarm?'<a class="relieve el-icon-close-notification"></a>':"";o+='<dd class="'+u+'" data-id="'+d+'" style="animation:'+l.level+" "+l.freq+'ms infinite;">'+s.name+f+"</dd>",a.push(d)}n.innerHTML=o,e.values=a}}),n.onclick=function(e){var t=e.target||e.srcElement;t.classList.contains("relieve")&&i.itemClick&&i.itemClick(t.parentNode.dataset.id)}},getAlarmlevel:function(e){var t="",i="",n=0;switch(e){case 1:t="red",i="el-icon-info",n=2e3;break;case 2:t="orange",i="el-icon-info",n=2500;break;case 3:t="yellow",i="el-icon-info",n=3e3;break;case 4:t="blue",i="el-icon-info",n=3500}return{level:t,icon:i,freq:n}}},new n(t)},scrollingPreview:function(t){var i,n=function(){var e=t.scrollHeight-t.offsetHeight;return{dist:e,apex:e*((s+1)/2)}},o=function(){return Math.abs(t.scrollTop-1)-t.scrollTop},a=0,s=o(),l=n();function r(){t.scrollTop*s>=l.apex?(cancelAnimationFrame(i),s=o(),l=n(),r()):(t.scrollTop=a,a+=.3333*s,i=window.requestAnimationFrame(r))}t.scrollHeight>t.offsetHeight&&r(),t.onmousedown=function(){cancelAnimationFrame(i)},t.onmouseup=function(e){e.target.className.match("scrolling4")&&(a=e.target.scrollTop),r()},e.resize((function(){var e=l.dist/(l=n()).dist;t.scrollTop=a/=e}))},Dates:function(e){return{format:function(t){var i=e?new Date(e):new Date,n={"M+":i.getMonth()+1,"d+":i.getDate(),"h+":i.getHours()%12==0?12:i.getHours()%12,"H+":i.getHours(),"m+":i.getMinutes(),"s+":i.getSeconds(),"q+":Math.floor((i.getMonth()+3)/3),S:i.getMilliseconds()};for(var o in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(i.getFullYear()+"").substr(4-RegExp.$1.length))),/(E+)/.test(t)&&(t=t.replace(RegExp.$1,(RegExp.$1.length>1?RegExp.$1.length>2?"星期":"":"")+{0:"",1:"",2:"",3:"",4:"",5:"",6:""}[i.getDay()+""])),n)new RegExp("("+o+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?n[o]:("00"+n[o]).substr((""+n[o]).length)));return t},getDayStamp:function(){return{start:new Date((new Date).toLocaleDateString()).getTime()/1e3,end:~~((new Date).getTime()/1e3)}}}},Notify:function(i){var n=this,o={close:!0},a=(i=i||{}).duration||2e4,s=i.title||"提示",l=i.type||"warning",r=i.message||"提示内容!";return this.__proto__={open:function(c){c=c||{},o.ctn=o.ctn||document.createElement("div"),o.ctn.className="el-notification right el-notification-fade-enter el-notification-fade-leave-active",o.ctn.style="bottom:16px;z-index:2000;",o.ctn.innerHTML='<i class="el-notification__icon el-icon-'+l+'"></i><div class="el-notification__group is-with-icon"><h2 class="el-notification__title">'+(c.title||s)+'</h2><div class="el-notification__content">'+(c.content||r)+'</div><div class="el-notification__closeBtn el-icon-close"></div></div>',t.appendChild(o.ctn),setTimeout((function(){o.ctn.classList.remove("el-notification-fade-enter","el-notification-fade-leave-active")}),100),o.timer=e.Async.timeout((function(){n.close()}),a),o.ctn.onclick=function(e){var t=e.target||e.srcElement;t.classList.contains("el-icon-close")?n.close():i.onClick&&i.onClick(t)},o.ctn.addEventListener("mouseenter",(function(){!o.await&&o.timer.pause()}),!1),o.ctn.addEventListener("mouseleave",(function(){!o.await&&o.timer.continued()}),!1)},close:function(e){o.close&&(o.await=!0,o.ctn.classList.add("el-notification-fade-leave-active"),o.timer.clear(),setTimeout((function(){t.removeChild(o.ctn),!e&&i.onClose&&i.onClose()}),200),delete o.close)},pause:function(){o.await=!0,o.timer.pause()},recover:function(){o.timer.continued(),o.await=!1}},i.autoOpen&&this.open(),this}}),e.UI=this},new function(){(e.Async||this).__proto__={intervalLoop:function(e,t,i){var n=function(e,t,i){t&&t(),this.timer=setInterval((function(){i?i():t()}),e||3e3)};return n.prototype={clear:function(){clearInterval(this.timer)}},"function"==typeof t?new n(e,t,i):console.log("intervalLoop param must contain function")},loopList:function(e,t,i){var n="object"==typeof e?Object.keys(e):e||[],o=n.length;(function a(s){s<o?(()=>{var i=n[s],o=e[i];t&&t.call(this,i,o,()=>{a.call(this,++s)})})():(()=>{i&&i.call(this)})()}).bind(this)(0)},timeout:function(e,t){return t=t||3e3,new function(){var i,n,o;return this.__proto__={start:function(t){n=(new Date).getTime(),i=setTimeout((function(){t=n=o=0,e&&e()}),t)},pause:function(){
//!pauseTime && (pauseTime = new Date().getTime());this.clear()
o=(new Date).getTime(),this.clear()},continued:function(e){t-=o-n,o&&t>0&&this.start(e||t)},clear:function(){clearTimeout(i)}},this.start(t),this}}}}}(qf)}]);
\ No newline at end of file
!function(e) {
var t = {};
function i(n) {
if (t[n])
return t[n].exports;
var o = t[n] = {
i: n,
l: !1,
exports: {}
};
return e[n].call(o.exports, o, o.exports, i),
o.l = !0,
o.exports
}
i.m = e,
i.c = t,
i.d = function(e, t, n) {
i.o(e, t) || Object.defineProperty(e, t, {
enumerable: !0,
get: n
})
}
,
i.r = function(e) {
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
value: "Module"
}),
Object.defineProperty(e, "__esModule", {
value: !0
})
}
,
i.t = function(e, t) {
if (1 & t && (e = i(e)),
8 & t)
return e;
if (4 & t && "object" == typeof e && e && e.__esModule)
return e;
var n = Object.create(null);
if (i.r(n),
Object.defineProperty(n, "default", {
enumerable: !0,
value: e
}),
2 & t && "string" != typeof e)
for (var o in e)
i.d(n, o, function(t) {
return e[t]
}
.bind(null, o));
return n
}
,
i.n = function(e) {
var t = e && e.__esModule ? function() {
return e.default
}
: function() {
return e
}
;
return i.d(t, "a", t),
t
}
,
i.o = function(e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
}
,
i.p = "",
i(i.s = 2)
}([, , function(e, t, i) {
e.exports = i(3)
}
, function(e, t, i) {
!function(e) {
document;
var t = document.body;
new function() {
var i = this;
e.extend.call(this, {
popupLayer: function(e) {
var t = e.title && (e.title.indexOf("<") > -1 ? e.title : "<span>" + e.title + "</span>") || ""
, i = e.closeBtnColor ? "color:" + e.closeBtnColor : ""
, n = t ? '<div class="qfui-message-box el-message-box__header"><div class="el-message-box__title">' + t + "</div></div>" : ""
, o = e.confirm
, a = "[object Function]" === Object.prototype.toString.call(o) ? '<div class="el-message-box__btns"><button type="button" aria-label="Confirm" class="el-button el-button--default el-button--small el-button--primary">确定</button></div>' : ""
, s = '<div class="kmb-message-box custom-alert">' + n + '<div class="el-message-box__content" style="min-width:300px;width:' + e.width + '"><div class="alert-ctbox">' + (e.html || "") + "</div></div>" + a + '<button class="el-message-box__headerbtn el-icon-close" aria-label="Close" style="top:8px;right:10px;font-size:18px;' + i + '"></button></div>'
, l = document.createElement("div");
l.id = "culayer",
l.className = "el-message-box__wrapper " + (e.className || ""),
l.style.cssText = "z-index:2001;background-color:rgba(0,0,0,.5);",
l.innerHTML = s,
document.body.appendChild(l);
var r = l.querySelector(".alert-ctbox");
e.onload && e.onload(r),
l.onclick = function(t) {
var i = t.target || t.srcElement;
"BUTTON" === i.nodeName && ("Confirm" === i.getAttribute("aria-label") ? (document.body.removeChild(l),
e.confirm && e.confirm(r)) : "Close" === i.getAttribute("aria-label") && (document.body.removeChild(l),
e.close && e.close()))
}
},
pointCharts: function(t) {
var n = function(t) {
var i = t.chartsBox;
return this.pictureArea = i.firstElementChild,
this.pointsLayer = i.lastElementChild,
this.pointsCtn = this.pointsLayer.firstElementChild,
this.itemClick = t.itemClick,
this.pointsCtn.innerHTML = "",
this.layoutWidth = e.parseWpx(t.width),
this.layoutHeight = e.parseWpx(t.height),
this.isRelieveAlarm = t.isRelieveAlarm || !1,
this
};
return n.prototype = {
init: function(e, t, i) {
this.setBackground(i).then(()=>{}
),
this.createPoints(t, e)
},
setBackground: function(e) {
return new Promise((t,i)=>{
if (e) {
var n = this.pictureArea.firstElementChild;
n.src = e,
n.style.cssText = "height:100%;width:100%;",
this.pictureArea.classList.add("show"),
this.pointsLayer.classList.add("show"),
n.onload = function() {
t()
}
} else
this.pictureArea.classList.remove("show"),
this.pointsLayer.classList.remove("show")
}
)
},
createPoint: function(t, i) {
var n = i.height
, o = i.width
, a = this.layoutWidth / o
, s = this.layoutHeight / n
, l = t.name || ""
, r = t.infoseat || "up"
, c = document.createElement("li")
, u = t.guid || e.getGuid();
c.className = t.type,
c.dataset.id = u,
c.style.diesplay = "none",
c.style.top = e.parseRem(t.y * s) + "rem",
c.style.left = e.parseRem(t.x * a) + "rem",
c.style.width = e.parseRem(t.width) + "rem",
c.style.height = e.parseRem(t.height) + "rem",
c.innerHTML = '<i style="transform:rotate(' + ~~t.angle + 'deg)"></i><div class="' + r + '"><div class="text"><h4>' + l + "</h4><dl></dl></div></div>",
this.pointsCtn.appendChild(c),
t.guid = u;
var d = {
config: t,
element: c
};
this.setBindAttr(d, c.lastElementChild),
d.items = t.items || []
},
createPoints: function(e, t) {
for (var i of e)
this.createPoint(i, t)
},
switchActive: function(e) {
var t = this.mouseInfo;
t.target && t.target.classList.remove("active"),
e.classList.add("active"),
t.target = e;
var n = e.dataset.id;
i.focusPoint = this.pointList[n],
i.form2.monitorValues = i.focusPoint.values || []
},
cancelActive: function() {
var e = this.mouseInfo;
e.target && e.target.classList.remove("active"),
i.focusPoint = {},
i.form2.monitorValues = []
},
setBindAttr: function(e, t) {
var i = this
, n = t.firstElementChild.lastElementChild;
Object.defineProperty(e, "items", {
set: function(t) {
var o = ""
, a = [];
for (var s of t) {
var l = i.getAlarmlevel(s.alarmlevel)
, r = s.state ? "offline" : "online"
, c = l.icon || (s.state ? "el-icon-remove-outline" : "el-icon-check")
, u = (l.level || r) + " " + c
, d = s.id || s.value
, f = s.alarmlevel && i.isRelieveAlarm ? '<a class="relieve el-icon-close-notification"></a>' : "";
var tempName = s.name + f
console.log('tempName',tempName.length)
tempName = tempName.length > 15? (tempName.substring(0, 15) + '...') : tempName
o += '<dd class="' + u + '" data-id="' + d + '" style="animation:' + l.level + " " + l.freq + 'ms infinite;" title="'+ (s.name+f) +'">' +
// tempName.length > 15 ? (tempName.substring(0, 15) + '...') : tempName +
tempName +
"</dd>",
a.push(d)
}
n.innerHTML = o,
e.values = a
}
}),
n.onclick = function(e) {
var t = e.target || e.srcElement;
t.classList.contains("relieve") && i.itemClick && i.itemClick(t.parentNode.dataset.id)
}
},
getAlarmlevel: function(e) {
var t = ""
, i = ""
, n = 0;
switch (e) {
case 1:
t = "red",
i = "el-icon-info",
n = 2e3;
break;
case 2:
t = "orange",
i = "el-icon-info",
n = 2500;
break;
case 3:
t = "yellow",
i = "el-icon-info",
n = 3e3;
break;
case 4:
t = "blue",
i = "el-icon-info",
n = 3500
}
return {
level: t,
icon: i,
freq: n
}
}
},
new n(t)
},
scrollingPreview: function(t) {
var i, n = function() {
var e = t.scrollHeight - t.offsetHeight;
return {
dist: e,
apex: e * ((s + 1) / 2)
}
}, o = function() {
return Math.abs(t.scrollTop - 1) - t.scrollTop
}, a = 0, s = o(), l = n();
function r() {
t.scrollTop * s >= l.apex ? (cancelAnimationFrame(i),
s = o(),
l = n(),
r()) : (t.scrollTop = a,
a += .3333 * s,
i = window.requestAnimationFrame(r))
}
t.scrollHeight > t.offsetHeight && r(),
t.onmousedown = function() {
cancelAnimationFrame(i)
}
,
t.onmouseup = function(e) {
e.target.className.match("scrolling4") && (a = e.target.scrollTop),
r()
}
,
e.resize((function() {
var e = l.dist / (l = n()).dist;
t.scrollTop = a /= e
}
))
},
Dates: function(e) {
return {
format: function(t) {
var i = e ? new Date(e) : new Date
, n = {
"M+": i.getMonth() + 1,
"d+": i.getDate(),
"h+": i.getHours() % 12 == 0 ? 12 : i.getHours() % 12,
"H+": i.getHours(),
"m+": i.getMinutes(),
"s+": i.getSeconds(),
"q+": Math.floor((i.getMonth() + 3) / 3),
S: i.getMilliseconds()
};
for (var o in /(y+)/.test(t) && (t = t.replace(RegExp.$1, (i.getFullYear() + "").substr(4 - RegExp.$1.length))),
/(E+)/.test(t) && (t = t.replace(RegExp.$1, (RegExp.$1.length > 1 ? RegExp.$1.length > 2 ? "星期" : "" : "") + {
0: "",
1: "",
2: "",
3: "",
4: "",
5: "",
6: ""
}[i.getDay() + ""])),
n)
new RegExp("(" + o + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? n[o] : ("00" + n[o]).substr(("" + n[o]).length)));
return t
},
getDayStamp: function() {
return {
start: new Date((new Date).toLocaleDateString()).getTime() / 1e3,
end: ~~((new Date).getTime() / 1e3)
}
}
}
},
Notify: function(i) {
var n = this
, o = {
close: !0
}
, a = (i = i || {}).duration || 2e4
, s = i.title || "提示"
, l = i.type || "warning"
, r = i.message || "提示内容!";
return this.__proto__ = {
open: function(c) {
c = c || {},
o.ctn = o.ctn || document.createElement("div"),
o.ctn.className = "el-notification right el-notification-fade-enter el-notification-fade-leave-active",
o.ctn.style = "bottom:16px;z-index:2000;",
o.ctn.innerHTML = '<i class="el-notification__icon el-icon-' + l + '"></i><div class="el-notification__group is-with-icon"><h2 class="el-notification__title">' + (c.title || s) + '</h2><div class="el-notification__content">' + (c.content || r) + '</div><div class="el-notification__closeBtn el-icon-close"></div></div>',
t.appendChild(o.ctn),
setTimeout((function() {
o.ctn.classList.remove("el-notification-fade-enter", "el-notification-fade-leave-active")
}
), 100),
o.timer = e.Async.timeout((function() {
n.close()
}
), a),
o.ctn.onclick = function(e) {
var t = e.target || e.srcElement;
t.classList.contains("el-icon-close") ? n.close() : i.onClick && i.onClick(t)
}
,
o.ctn.addEventListener("mouseenter", (function() {
!o.await && o.timer.pause()
}
), !1),
o.ctn.addEventListener("mouseleave", (function() {
!o.await && o.timer.continued()
}
), !1)
},
close: function(e) {
o.close && (o.await = !0,
o.ctn.classList.add("el-notification-fade-leave-active"),
o.timer.clear(),
setTimeout((function() {
t.removeChild(o.ctn),
!e && i.onClose && i.onClose()
}
), 200),
delete o.close)
},
pause: function() {
o.await = !0,
o.timer.pause()
},
recover: function() {
o.timer.continued(),
o.await = !1
}
},
i.autoOpen && this.open(),
this
}
}),
e.UI = this
}
,
new function() {
(e.Async || this).__proto__ = {
intervalLoop: function(e, t, i) {
var n = function(e, t, i) {
t && t(),
this.timer = setInterval((function() {
i ? i() : t()
}
), e || 3e3)
};
return n.prototype = {
clear: function() {
clearInterval(this.timer)
}
},
"function" == typeof t ? new n(e,t,i) : console.log("intervalLoop param must contain function")
},
loopList: function(e, t, i) {
var n = "object" == typeof e ? Object.keys(e) : e || []
, o = n.length;
(function a(s) {
s < o ? (()=>{
var i = n[s]
, o = e[i];
t && t.call(this, i, o, ()=>{
a.call(this, ++s)
}
)
}
)() : (()=>{
i && i.call(this)
}
)()
}
).bind(this)(0)
},
timeout: function(e, t) {
return t = t || 3e3,
new function() {
var i, n, o;
return this.__proto__ = {
start: function(t) {
n = (new Date).getTime(),
i = setTimeout((function() {
t = n = o = 0,
e && e()
}
), t)
},
pause: function() {
//!pauseTime && (pauseTime = new Date().getTime());this.clear()
o = (new Date).getTime(),
this.clear()
},
continued: function(e) {
t -= o - n,
o && t > 0 && this.start(e || t)
},
clear: function() {
clearTimeout(i)
}
},
this.start(t),
this
}
}
}
}
}(qf)
}
]);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment