2023-12-03 11:30:02 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								window.teaweb={set:function(t,e){localStorage.setItem(t,JSON.stringify(e))},get:function(t){t=localStorage.getItem(t);return null==t||0==t.length?null:JSON.parse(t)},getString:function(t){t=this.get(t);return"string"==typeof t?t:""},getBool:function(t){return Boolean(this.get(t))},remove:function(t){localStorage.removeItem(t)},match:function(t,e){if(null==t)return!1;if(null==e)return!0;if(t=t.trim(),0==(e=e.trim()).length)return!0;if(0==t.length)return!1;for(var n=e.split(/\s+/),o=0;o<n.length;o++){var i=(i=n[o]).replace(/(\+|\*|\?|[|]|{|}|\||\\|\(|\)|\.)/g,"\\$1");if(!new RegExp(i,"i").test(t))return!1}return!0},clone:function(t){t=JSON.stringify(t);return JSON.parse(t)},loadJS:function(t,e){let n=document.createElement("script");n.setAttribute("type","text/javascript"),n.setAttribute("src",t),"function"==typeof e&&n.addEventListener("load",e),document.head.append(n)},loadCSS:function(t,e){let n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css"),n.setAttribute("href",t),"function"==typeof e&&n.addEventListener("load",e),document.head.append(n)},datepicker:function(e,n,o){if("undefined"==typeof Pikaday){let t=this;return this.loadJS("/js/moment.min.js",function(){t.loadJS("/js/pikaday.js",function(){t.datepicker(e,n,o)})}),this.loadCSS("/js/pikaday.css"),this.loadCSS("/js/pikaday.theme.css"),void this.loadCSS("/js/pikaday.triangle.css")}"string"==typeof e&&(e=document.getElementById(e));var t=(new Date).getFullYear();let i=new Pikaday({field:e,firstDay:1,minDate:new Date(t-1,0,1),maxDate:new Date(t+20,11,31),yearRange:[t-1,t+20],format:"YYYY-MM-DD",i18n:{previousMonth:"上月",nextMonth:"下月",months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],weekdays:["周日","周一","周二","周三","周四","周五","周六"],weekdaysShort:["周日","周一","周二","周三","周四","周五","周六"]},theme:"triangle-theme",onSelect:function(){"function"==typeof n&&n.call(Tea.Vue,i.toString())},reposition:!o});e.picker=i},formatBytes:function(t){return(t=Math.ceil(t))<Math.pow(1024,1)?t+"B":t<Math.pow(1024,2)?Math.round(100*t/Math.pow(1024,1))/100+"KiB":t<Math.pow(1024,3)?Math.round(100*t/Math.pow(1024,2))/100+"MiB":t<Math.pow(1024,4)?Math.round(100*t/Math.pow(1024,3))/100+"GiB":t<Math.pow(1024,5)?Math.round(100*t/Math.pow(1024,4))/100+"TiB":t<Math.pow(1024,6)?Math.round(100*t/Math.pow(1024,5))/100+"PiB":Math.round(100*t/Math.pow(1024,6))/100+"EiB"},formatBits:function(t,e){t=Math.ceil(t);let n=1e4;switch(e){case 1:n=10;break;case 2:n=100;break;case 3:n=1e3;break;case 4:n=1e4}return t<Math.pow(1024,1)?t+"bps":t<Math.pow(1024,2)?Math.round(t*n/Math.pow(1024,1))/n+"Kbps":t<Math.pow(1024,3)?Math.round(t*n/Math.pow(1024,2))/n+"Mbps":t<Math.pow(1024,4)?Math.round(t*n/Math.pow(1024,3))/n+"Gbps":t<Math.pow(1024,5)?Math.round(t*n/Math.pow(1024,4))/n+"Tbps":t<Math.pow(1024,6)?Math.round(t*n/Math.pow(1024,5))/n+"Pbps":Math.round(t*n/Math.pow(1024,6))/n+"Ebps"},formatNumber:function(t){if(null==t)return"null";let e=t.toString();t=e.indexOf(".");if(0<=t)return this.formatNumber(e.substring(0,t))+"."+e.substring(t+1);if(e.length<=3)return e;let n=[];for(let t=0;t<Math.floor(e.length/3);t++){var o=e.length-3*(t+1);n.push(e.substring(o,3+o))}return e.length%3!=0&&n.push(e.substring(0,e.length%3)),n.reverse().join(", ")},formatCount:function(t){let e="",n="";return 1e9<=t?(e="B",n=1e9):1e6<=t?(e="M",n=1e6):1e3<=t&&(e="K",n=1e3),0==e.length?t.toString():Math.round(100*t/n)/100+e},bytesAxis:function(t,e){t=Math.max.apply(this,t.map(e));let n=1,o="B";return t>=Math.pow(1024,6)?(o="E",n=Math.pow(1024,6)):t>=Math.pow(1024,5)?(o="P",n=Math.pow(1024,5)):t>=Math.pow(1024,4)?(o="T",n=Math.pow(1024,4)):t>=Math.pow(1024,3)?(o="G",n=Math.pow(1024,3)):t>=Math.pow(1024,2)?(o="M",n=Math.pow(1024,2)):t>=Math.pow(1024,1)&&(o="K",n=Math.pow(1024,1)),{unit:o,divider:n}},bitsAxis:function(t,e){t=this.bytesAxis(t,e);let n=t.unit;return"B"==n?n="bps":n+="bps",{unit:n,divider:t.divider}},countAxis:function(t,e){t=Math.max.apply(this,t.map(e));l
							 |