alarmservice.min.js 76 KB

1
  1. function getFlag(){return(new Date).getTime().toString()}function getAlarmGroups(e){e=e||function(){};var a={method:"GetGroups",param:{}},t=[];if(t.push("*"),GD.isEmptyObj(alarmGroupDic))return socket.alarmPost("/alarm/doservice?group",a,function(a){if(a.success)for(var l=a.data.data,r=0;r<l.length;r++)alarmGroupDic[l[r].group_name]=l[r],alarmGroupDicName[l[r].id]=l[r],t.push(l[r].group_name);e(alarmGroupDic)}),t;e(alarmGroupDic)}function getAlarmCateByName(e){if(null==e||e.length<=0)return 0;for(var a in alarmCategoryDicName)return alarmCategoryDicName[a].id}function getAlarmSnapshort(e,a,t){a=a||function(){};var l={page_no:0,page_size:500,condition:getFilterCondition((GD.getParams("extra")||{}).area||"*","*",null,null,null)},r="/alarm/getSnapshots?"+e;socket.alarmPost(r,l,function(e){if(t)if(e&&e.success){var o=e.data.total;if(o<500)return void a(e);l.page_size=o,socket.alarmPost(r,l,function(e){a(e)})}else a(e);else a(e)})}function refreshAlarmInfoWindow(){getAlarmSnapshort("snapshotwindow",function(e){if(e&&e.success){e.data.total;(function(e,a){for(var t,l,r=[],o=0,i=e.length;o<i;o++)l=(t=e[o]||{}).state0||"0",(1===t.is_first||alarmLevelDic[l]&&1==alarmLevelDic[l].popup)&&0===t.is_ensure&&r.push(t);setTimeout(function(){void 0!==alarmAreasDic&&AlarmInfoShow(r,r.length,alarmDialogStyle)},100)})(alarmData=e.data.data||[])}},!0)}function getAlarmLevels(){var e={method:"GetLevels",param:{}},a="level",t="/alarm/doservice?"+a;socket.alarmPost(t,e,function(e){if(e&&e.success){_alarmLevelArray=[],DataType=e.data.data;for(var t=0;t<DataType.length;t++)alarmId=t+1,alarmLevelDic[DataType[t].level]=DataType[t],alarmLevelDicName[DataType[t].level_name]=DataType[t],dataTypes.push(DataType[t].level_name),_alarmLevelArray.push(DataType[t].level_name);alarmFilterState=!0,isRealFirst=1,isRealFirst=null,getAlarmSnapshort(a="snapshotgz",function(e){if(e&&e.success){e.data.total;(function(e,a){for(var t,l,r=[],o=0,i=e.length;o<i;o++)l=(t=e[o]||{}).state0||"",(1===t.is_first||alarmLevelDic[l]&&1==alarmLevelDic[l].popup)&&0===t.is_ensure&&r.push(t);setTimeout(function(){void 0!==alarmAreasDic&&AlarmInfoShow(r,r.length,alarmDialogStyle)},500)})(alarmData=e.data.data||[]);var a=getFlag();socket.alarmPost("/alarm/SubscribeNotify?"+a,function(e){if("alarm_notify"==e[0]){for(var a,t,l=e[1],r=!1,o=(alarmData.length,0);o<l.length;o++)a=(t=l[o]||{}).state0,(alarmLevelDic[a]&&1===alarmLevelDic[a].popup||1===t.is_first)&&!r&&(r=!0);r&&refreshAlarmInfoWindow(),r||realdataModelReal&&getRealAlarmInfos(realdataModelReal,tablePaneReal,pageinputReal.value,rowssizeReal.getValue(),pageCountReal,dataAreaNameReal,alarmGroupValueReal,alarmLevelValueReal,alarmStateValueReal)}})}},!0)}})}function getAlarmLevelsData(e){if(e=e||function(){},GD.isEmptyObj(alarmLevelDic)){var a={method:"GetLevels",param:{}};socket.alarmPost("/alarm/doservice?level",a,function(a){if(a&&a.success){DataType=a.data.data;for(var t=0;t<DataType.length;t++)alarmId=t+1,alarmLevelDic[DataType[t].level]=DataType[t],alarmLevelDicName[DataType[t].level_name]=DataType[t],dataTypes.push(DataType[t].level_name);e(alarmLevelDic)}else e({})})}else e(alarmLevelDic)}function getAlarmSystem(e){var a={method:"GetSystem",param:{}};socket.alarmPost("/alarm/doservice?system",a,function(a){if(a&&a.success&&a.data)return e(a.data.data);e([])})}function getAlarmLevelNameByName(e){for(var a in alarmLevelDicName)return alarmLevelDicName[a].level}function getAlarmLevelTables(e,a){e.clear();var t={method:"GetLevels",param:{}};socket.alarmPost("/alarm/doservice?levels",t,function(a){if(a&&a.success){for(var t=a.data.data,l=t.length,r=0;r<l;r++)(a=new ht.Data).setId(r+1),a.a("alarmName",t[r].level_name),a.a("wavName",t[r].wave_file),a.a("alarmColor",ARGB2HexString(t[r].alarm_color)),a.a("resetColor",ARGB2HexString(t[r].reset_color)),a.a("confirmColor",ARGB2HexString(t[r].ensure_color)),a.a("normalColor",ARGB2HexString(t[r].normal_color)),a.a("islight",1==t[r].popup?"是":"否"),a.a("alarmLevel",t[r].level),e.add(a);e.sm().ss(a)}})}function deleteAlarmLevels(e){var a={method:"DeleteLevel",param:{level:Number(e)}};socket.alarmPost("/alarm/doservice?deletelevel",a,function(e){})}function updateAlarmLevels(e){var a={method:"UpdateLevel",param:e};socket.alarmPost("/alarm/doservice?updatelevel",a,function(e){})}function getAlarmCategories(e){e=e||function(){};var a={method:"GetCategories",param:{}},t=[];if(t.push("*"),GD.isEmptyObj(alarmCategoryDic))return socket.alarmPost("/alarm/doservice?category",a,function(a){if(a&&a.success){for(var l=a.data.data,r=0;r<l.length;r++)alarmCategoryDic[l[r].id]=l[r],alarmCategoryDicName[l[r].category_name]=l[r],t.push(l[r].category_name);e(alarmCategoryDic)}else e({})}),t;e(alarmCategoryDic)}function getAlarmCateTables(e){e.clear();var a={method:"GetCategories",param:{}};socket.alarmPost("/alarm/doservice?categories",a,function(a){if(a&&a.success){for(var t=a.data.data,l=t.length,r=0;r<l;r++)(a=new ht.Data).a("alarmCateId",t[r].id),a.a("alarmCateName",t[r].category_name),e.add(a);e.sm().ss(a)}})}function updateAlarmCates(e){var a={method:"UpdateCategory",param:e};socket.alarmPost("/alarm/doservice?updatecategory",a,function(e){})}function deleteAlarmCates(e){var a={method:"DeleteCategory",param:{id:Number(e)}};socket.alarmPost("/alarm/doservice?deletecategory",a,function(e){})}function getAlarmGropTables(e){var a={method:"GetGroups",param:{}};socket.alarmPost("/alarm/doservice?groups",a,function(a){if(a){e.clear();for(var t=a&&a.data.data||[],l=t.length,r=0;r<l;r++)(a=new ht.Data).setId(t[r].id),a.a("groupName",t[r].group_name),e.add(a)}})}function updateAlarmGroup(e){var a={method:"UpdateGroup",param:e};socket.alarmPost("/alarm/doservice?updategroup",a,function(e){})}function deleteAlarmGrop(e){var a={method:"DeleteGroup",param:{id:Number(e)}};socket.alarmPost("/alarm/doservice?deletegroup",a,function(e){})}function getAlarmAreas(e){e=e||function(){};var a={method:"GetAreas",param:{}},t=[];return t.push("*"),socket.alarmPost("/alarm/doservice?areas",a,function(a){if(a&&a.success){for(var l,r=a.data.data,o=0;o<r.length;o++)l=r[o].area_name+r[o].id,t.push(r[o].area_name),alarmAreaDicName[r[o].area_name]=r[o],alarmAreaDicNameId[l]=r[o],alarmAreasDic[r[o].id]=r[o].area_name;e(r)}else e({})}),t}function updateAlarmArea(e){var a={method:"UpdateArea",param:e};socket.alarmPost("/alarm/doservice?updatearea",a,function(e){})}function deleteAlarmArea(e){var a={method:"DeleteArea",param:{id:Number(e)}};socket.alarmPost("/alarm/doservice?deletearea",a,function(e){})}function getAlarmAreaTables(e){var a={method:"GetAreas",param:{}};socket.alarmPost("/alarm/doservice?getareas",a,function(a){if(a){e.clear();for(var t=a.data&&a.data.data||[],l=t.length,r=0;r<l;r++)(a=new ht.Data).setId(t[r].id),a.a("areaName",t[r].area_name),a.a("parentId",t[r].parent_id),e.add(a)}})}function getAlarmAreasDicName(e){if(e.length>0)for(var a=0;a<e.length;a++)alarmAreaDicName[e[a].area_name]>0||(alarmAreaDicName[e[a].area_name]=e[a].id)}function getAreaDic(e){if(e.length>0)for(var a=0;a<e.length;a++)alarmAreasDic[e[a].Id]!=e[a].Id&&(alarmAreasDic[e[a].Id]=e[a],e[a].Children.length&&getAreaDic(e[a].Children))}function sleep(e){for(var a=new Date,t=a.getTime()+e;;)if((a=new Date).getTime()>t)return}function getFilterCondition(e,a,t,l,r,o){var i=[];if(null!=e&&"*"!=e)if(void 0===alarmAreaDicName[e])(n=new FieldCondition).field="state1",n.value=-1,n.method=0,i.push(n);else for(s=0;s<alarmAreaIds.length;s++){var n=new FieldCondition;n.field="state1",n.value=alarmAreaIds[s],n.method=0,i.push(n)}if(null!=a&&"*"!=a)for(var s=0;s<a.length;s++)if("*"!=a[s]){var m=new FieldCondition;m.field="state0","{}"!=JSON.stringify(alarmLevelDicName)&&(m.value=alarmLevelDicName[a[s]]&&alarmLevelDicName[a[s]].level),m.method=0,i.push(m)}if(null!=t&&"*"!=t){var d=new FieldCondition;d.field="state2",d.value=alarmGroupDic[t]&&alarmGroupDic[t].id||"*",d.method=0,i.push(d)}if(l&&((u=new FieldCondition).field="alarm_time",u.value=new Date(l).getTime(),u.method=1,i.push(u)),r){var u=new FieldCondition;u.field="alarm_time",u.value=new Date(r).getTime(),u.method=2,i.push(u)}if(null==isHisFirst||null==r&&null==l||((g=new FieldCondition).field="is_first",g.value=isHisFirst,g.method=0,i.push(g)),null!=isRealFirst&&null==r&&null==l){var g=new FieldCondition;g.field="is_first",g.value=isRealFirst,g.method=0,i.push(g)}if(null!=o&&"*"!=o){var c=new FieldCondition;c.field=alarmStatesDic[o].split("=")[0],c.value=alarmStatesDic[o].split("=")[1],c.method=0,i.push(c)}return i}function setAlarmShield(e,a){var t=e.split(",");socket.emit("goldenalarm.setAlarmShield",{TagNames:t,IsShield:a}),socket.once("goldenalarm.setAlarmShield",function(e){e.result.ecode})}function deleteAlarmPoints(e){var a=e;socket.alarmPost("/alarm/deleteTags",a,function(e){})}function updateAlarmPoints(e){var a=e;socket.alarmPost("/alarm/appendTags",a,function(e){})}function getRealAlarmInfos(e,a,t,l,r,o,i,n,s){var m={page_no:t-1,page_size:l,condition:getFilterCondition(o,n,i,null,null,s)};socket.alarmPost("/alarm/getSnapshots?snapshot",m,function(t){if(t&&t.success){e.clear();var l=t.data.data;r.setValue(Math.ceil(t.data.page_count)),(toolbar2Real&&toolbar2Real.getItemById("realAlarmTotalPageNum")||{}).label="共 "+(t.data.page_count||1)+" 页",toolbar2Real&&toolbar2Real.redraw();for(var o=l.length,i=[],n=[],s=0;s<o;s++){(t=new ht.Data).setId(s+1),t.a("tagName",l[s].tag_name),t.a("groupName",alarmGroupDicName[l[s].state2]&&alarmGroupDicName[l[s].state2].group_name),t.a("desc",l[s].user_data0),t.a("value",GetDital(l[s].value,2)),t.a("ensureinfo",l[s].is_ensure),t.a("resetinfo",l[s].is_reset),t.a("isFirst",l[s].is_first);var m=new Date;m.setTime(l[s].trigger_time),t.a("alarmtime",moment(m).format("YYYY-MM-DD HH:mm:ss")),t.a("area",alarmAreasDic[l[s].state1]),void 0!==alarmLevelDic[l[s].state0]&&t.a("alarmlevel",alarmLevelDic[l[s].state0].level_name),t.a("levelId",l[s].state0),l[s].is_ensure?l[s].is_reset?t.a("state","已确认|已恢复"):t.a("state","已确认|未恢复"):l[s].is_reset?t.a("state","未确认|已恢复"):t.a("state","未确认|未恢复"),t.a("alarmshuoming",l[s].alarm_message),void 0!==alarmGroupDicName[l[s].state2]&&t.a("alarmGroup",alarmGroupDicName[l[s].state2].group_name),e.add(t),i.push(l[s].is_ensure),n.push(l[s].is_reset)}setTimeout(function(){a&&a.getTableView&&a.getTableView().redraw()},100)}})}function getRealAlarmData(e){e=e||function(){};var a={page_no:pageIndex-1,page_size:pageSize,condition:condition};socket.alarmPost("/alarm/getSnapshots?snapshot",a,e)}function getHisAlarmInfos(e,a,t,l,r,o,i,n,s,m,d){searchHisAlarmInfos(t,l,o,i,n,s,m,d,function(a){if(!GD.isEmptyObj(a)){var t=a.data;r.setValue&&r.setValue(a.page_count),(toolbar2His&&toolbar2His.getItemById("hisAlarmTotalPageNum")||{}).label="共 "+(a.page_count||1)+" 页",toolbar2His&&toolbar2His.redraw();var l,o=t.length;e.clear();for(var i=0;i<o;i++){data=new ht.Data,data.setId(i+1);var n=new Date;l=t[i],n.setTime(l.trigger_time),data.a("alarmtime",moment(n).format("YYYY-MM-DD HH:mm:ss")),data.a("area",alarmAreasDic[l.state1]),data.a("tagName",l.tag_name),data.a("isFirst",l.is_first),alarmLevelDic[l.state0]&&data.a("alarmlevel",alarmLevelDic[l.state0].level_name),data.a("levelId",alarmLevelDic[l.state0]&&alarmLevelDic[l.state0].level),data.a("ensureinfo",l.is_ensure),data.a("resetinfo",l.is_reset),l.is_ensure?l.is_reset?data.a("state","已确认|已恢复"):data.a("state","已确认|未恢复"):l.is_reset?data.a("state","未确认|已恢复"):data.a("state","未确认|未恢复"),data.a("alarmshuoming",l.alarm_message),alarmGroupDicName[l.state2]&&data.a("alarmGroup",alarmGroupDicName[l.state2].group_name),data.a("desc",l.user_data0),data.a("value",GetDital(l.value,2)),data.a("",l.message),e.add(data)}}})}function searchHisAlarmInfos(e,a,t,l,r,o,i,n,s){if(s=s||function(){},GD.testSearchTime(o,i)){var m=getFilterCondition(t,r,l,o,i,n),d={page_no:Number(e-1),page_size:a,condition:m};socket.alarmPost("/alarm/getHistories?searchhistory",d,function(e){s(e&&e.success?e.data||{}:{})})}}function ensureAlarm(e,a){a=a||function(){};var t=e;socket.alarmPost("/alarm/ensure?ensure",t,function(e){a(e)})}function getAlarmPoints(e,a,t,l,r,o,i){e.clear();var n=[];if(null!=o&&"*"!=o){var s=new FieldCondition;s.field="AlarmAreaId",s.value=alarmAreaDicName[o],s.method=0,n.push(s)}if(null!=i&&"*"!=i){var m=new FieldCondition;m.field="TagType",m.value=DataType[i],m.method=0,n.push(m)}var d={page_no:0,page_size:l};socket.alarmPost("/alarm/getTags?gettags",d,function(a){if(a&&a.success)for(var t=a.data.data,l=t.length,r=0;r<l;r++)(a=new ht.Data).setId(r+1),a.a("tagName",t[r].tag_name),a.a("desc",t[r].description),e.add(a)})}function getTags(e,a,t,l){str="http://"+webServiceIP+":"+webServicePort+"/api/Point?tagType="+e+"&tagNameFilter="+a+"&tagDescFilter="+t,str=encodeURI(str),$.ajax({url:str,type:"GET",dataType:"json",cache:!1,success:function(e){for(var a=e.length,t=0;t<a;t++)datas=new ht.Data,datas.setId(e[t].Id),datas.a("configPointName",e[t].TableDotTag),datas.a("configPointDesc",e[t].Desc),l.add(datas);l.sm().ss(e)},complete:function(e,a){null}})}function pad(e,a,t){for(var l=e.toString(a),r=l.length;r<t;)l="0"+l,r++;return l}function ARGB2HexString(e){var a=(e=parseInt(e,10)).toString(16),t="";if(a.length<6){for(var l=0;l<6-a.length;l++)t+="0";a=t+a}return"#"+a}function ARGBToInt(e){if(e.length<=0)return 0;if(-1!=e.indexOf("#"))return parseInt(e.substring(1,e.length),16);if(-1!=e.indexOf("rgb")){var a=e.colorHex();return parseInt(a.substring(1,e.length),16)}}function GetRandomNum(e,a){var t=a-e,l=Math.random();return e+Math.round(l*t)}function DropDownBorderPane(e){DropDownBorderPane.superClass.constructor.call(this,e),areaDataModel=new ht.DataModel;var a=this,t=a._borderPane=new ht.widget.BorderPane,l=a._areatreeview=new ht.widget.TreeView(areaDataModel);areaIds=",";for(var r=0;r<alarmAreas.length;r++){var o=new ht.Data;o.setName(alarmAreas[r].Name),o.setTag(name),-1==areaIds.indexOf(","+alarmAreas[r].Id+",")&&(areaIds+=alarmAreas[r].Id+",",areaDataModel.add(o),getAreaTree(alarmAreas[r].Children,o,areaDataModel))}t.setCenterView(l),l.getView().style.background="#FCFCFC",l.setAutoHideScrollBar(!0),l.onDataDoubleClicked=function(a){e.close()},a.bindingHandleInputValueChange=a.handleInputValueChange.bind(a)}function getAreaTree(e,a,t){if(e.length>0)for(var l=0;l<e.length;l++){areaIds+=e[l].Id+",";var r=e[l],o=new ht.Data;o.setName(e[l].Name),o.setParent(a),t.add(o),r.Children.length>0&&getAreaTree(r.Children,o,t)}}function getDataTypes(){var e=[];e.push("*");for(var a in DataType)e.push(a);return e}function toggleColumnDisplay(e,a,t,l){if(e){var r,o,i,n,s,m=a.getColumnModel();"时序事件"===e?(r=["alarmlevel","alarmtime","area"],t&&(t.getItemById("alarmlavel").label="状态:",t.getItemById("alarmstatus").visible=!1,t.getItemById("alarmlavel").visible=!0,t.getItemById("alarmgroup").visible=!1,t.redraw())):(r=["state","alarmtime","area","desc","value","alarmGroup","alarmshuoming","alarmlevel","tagName"],"全部"===e?(t.getItemById("alarmstatus").visible=!1,t.getItemById("alarmlavel").visible=!1,t.getItemById("alarmgroup").visible=!1,t.redraw()):t&&(t.getItemById("alarmlavel").label="级别:",t.getItemById("alarmstatus").visible=!1,t.getItemById("alarmlavel").visible=!0,t.getItemById("alarmgroup").visible=!0,"首出故障"===e&&(t.getItemById("alarmstatus").visible=!0),t.redraw())),function(){if(l){var a,t=l.getItemById("confirm"),r=l.getItemById("confirmAll");a="首出故障"===e,t&&(t.visible=a),r&&(r.visible=a),l.redraw()}}(),m.each(function(a){o=a.getName(),i=-1!==r.indexOf(o),void 0===o&&a.isEditable()&&(i=!0),"alarmlevel"===o&&("时序事件"===e?a.setDisplayName("状态"):a.setDisplayName("报警级别")),a.setVisible(i),"state"===o&&(n=a),o||(s=a)}),"首出故障"===e?(n&&n.setVisible(!0),s&&s.setVisible(!0)):(n&&n.setVisible(!1),s&&s.setVisible(!1))}}function createRealAlarm(e,a,t,l,r){function o(){void 0===(dataAreaNameReal=c.getValue())&&(dataAreaNameReal="*"),void 0===(alarmGroupValueReal=alarmGroupReal.getValue())&&(alarmGroupValueReal="*"),void 0===(alarmStateValueReal=alarmStateReal.getValue())&&(alarmStateValueReal="*"),"{}"!=JSON.stringify(alarmGroupDic)&&"{}"!=JSON.stringify(alarmLevelDicName)&&"{}"!=JSON.stringify(alarmAreaDicName)?getRealAlarmInfos(realdataModelReal,tablePaneReal,pageinputReal.value,r.PageSize||200,pageCountReal,dataAreaNameReal,alarmGroupValueReal,alarmLevelValueReal,alarmStateValueReal):setTimeout(function(){o()},500)}function i(e){function a(e){for(var a,t={},r=-1,o=0;o<e.length;o++){var i=e[o];""==JSON.parse(localStorage.getItem("extra")).area||'""'==localStorage.getItem("extra")?t[i.id]||(r=i.id,(a=new ht.Data)._id=i.id,a._pid=i.parent_id,a.setName(i.area_name),a.setTag(i.area_name),a.setParent(t[i.parent_id]),l.dm().add(a),t[i.id]=a):i.area_name==JSON.parse(localStorage.getItem("extra")).area&&(r=i.id,(a=new ht.Data)._id=i.id,a._pid=i.parent_id,a.setName(i.area_name),a.setTag(i.area_name),a.setParent(t[i.parent_id]),l.dm().add(a),t[i.id]=a)}getAreaTreeData(l,e,r,t),l.expandAll()}var t=this;i.superClass.constructor.call(t,e);var l=t._treeView=new ht.widget.TreeView;if(l.sm().ms(function(a){e.setValue(t.getValue())}),GD.setAreaTreeViewStyle(l),l.onDataClicked=function(a){alarmAreaIds.length=0,alarmAreaIds.push(a._id),getAreaIds(a),pageinputReal.value=1,realdataModelReal.clear(),a._id>=0?GoldenAlarm.getGroupsByAreaID(a._id,function(e){for(var a,t=["*"],l=0;a=e[l++];)t.push(a.group_name);alarmGroupReal.setValues(t),alarmGroupReal.setValue(t[0])}):getAlarmGroups(function(e){var a=["*"];for(var t in e)e.hasOwnProperty(t)&&a.push(t);alarmGroupReal.setValues(a),alarmGroupReal.setValue(a[0])}),o(),e.close()},""==JSON.parse(localStorage.getItem("extra")).area||'""'==localStorage.getItem("extra")){var r=new ht.Data;r.setName("*"),r.setTag("*"),r.setId(-1),l.dm().add(r)}var n={method:"GetAreas",param:{}};0===alarmAreaData.length?socket.alarmPost("/alarm/doservice?areas",n,function(e){if(e&&e.success){var t=e.data.data;alarmAreaData=t,a(t)}}):a(alarmAreaData)}currentControlContent+="realalarm",alarmCateReal=r.alarmCategoryReal,alarmLevelVisible=r.alarmLevelVisible;var n=new ht.widget.BorderPane;if(realdataModelReal=new ht.DataModel,tablePaneReal=new ht.widget.TablePane(realdataModelReal),tablePaneReal=createTableByObj(tablePaneReal,r),n.setCenterView(tablePaneReal),alarmLevelVisible){(formRealLeft=new ht.widget.FormPane).getView().style.background=r.backcolor,formRealLeft.setVGap(0),formRealLeft.setHGap(0),formRealLeft.setVPadding(0),formRealLeft.setHPadding(0),formRealLeft.setScrollBarSize(0);Math.ceil((l-100)/alarmCateReal.length);!function(){for(var e,a=["","","",""],t=0,l=alarmCateReal.length;t<l;t++)"时序事件"===(e=alarmCateReal[t]).name?a[1]=e:"告警提示"===e.name?a[2]=e:"故障"===e.name?a[3]=e:"全部"===e.name?a[0]=e:a.push(e);alarmCateReal=a}(),formRealLeft.addRow([{image:{width:45*ratio.ratioX,id:"levelimg10",name:"aaa"}}],[45*ratio.ratioX],12*ratio.ratioY);for(h=0;h<alarmCateReal.length;h++){var s=alarmCateReal[h],m=imagePath+s.icon;"故障"==alarmCateReal[h].name&&(alarmLevelArray=s.alarmLevelList,isRealFirst=null),formRealLeft.addRow([{image:{width:45*ratio.ratioX,icon:m,id:"levelimg"+h,name:s.name,data:s.alarmLevelList,clickicon:imagePath+s.clickicon,onClicked:function(){this.setIcon(this.clickicon);for(var e=formRealLeft._rows,a=0;a<e.length;a++){var t=e[a].items[0].element;t.id!=this.id&&t.setIcon(e[a].items[0].image.icon)}pageinputReal.value=1,realdataModelReal.clear(),alarmLevelArray=this.data,"首出故障"==this.name?isRealFirst=1:"故障"==this.name||"全部"==this.name?isRealFirst=null:"时序事件"===this.name||(isRealFirst=0),"*"!=alarmLevelArray?("*"!=alarmLevelArray[0]&&alarmLevelArray.unshift("*"),alarmLevelValueReal=alarmLevelArray,alarmLevelReal.setValues(alarmLevelArray),alarmLevelReal.setValue(alarmLevelArray[0])):(alarmLevelValueReal=alarmLevelArray,alarmLevelReal.setValues(dataTypes),alarmLevelReal.setValue(dataTypes[0])),toggleColumnDisplay(this.name,tablePaneReal,p,toolbar2Real),o()}}}],[45*ratio.ratioX],100*ratio.ratioY);for(var d=formRealLeft._rows,u=0;u<d.length;u++){var g=d[u].items[0].element;"故障"==g.name&&g.setIcon(d[u].items[0].image.clickicon)}}n.setLeftView(formRealLeft,28)}!function(e){if(e){for(var a,t=e.colStyles||[],l={},r=0,o=t.length;r<o;r++)l[(a=t[r]).Name]=a;e.colStylesObj=l}}(r);var c=new ht.widget.MultiComboBox;c.setWidth(145*ratio.ratioX),c.setValue(""==JSON.parse(localStorage.getItem("extra")).area||'""'==localStorage.getItem("extra")?"*":JSON.parse(localStorage.getItem("extra")).area),c.setDropDownComponent(i),c.setBackground("url("+PAGEROOTDIR+"Script/image/f3.png) no-repeat center center"),pointDataTypeReal=new ht.widget.ComboBox,pointDataTypeReal.setWidth(120*ratio.ratioX),pointDataTypeReal.setDropDownWidth(120*ratio.ratioX),pointTypesReal=getDataTypes(),pointDataTypeReal.setValues(pointTypesReal),pointDataTypeReal.setValue(pointTypesReal[0]),pointtypeReal=pointDataTypeReal.getValue(),alarmCategoryReal=new ht.widget.ComboBox,alarmCategoryReal.setWidth(120*ratio.ratioX),alarmCategoryReal.setDropDownWidth(120*ratio.ratioX),alarmCateValueReal=alarmCategoryReal.getValue(),alarmGroupReal=new ht.widget.ComboBox,alarmGroupReal.setWidth(127*ratio.ratioX),alarmGroupReal.setDropDownWidth(127*ratio.ratioX),alarmGroupReal.setBackground("url("+PAGEROOTDIR+"Script/image/f2.png) center center no-repeat"),alarmGroupValueReal=alarmGroupReal.getValue(),alarmGroupReal.onValueChanged=function(){pageinputReal.value=1,realdataModelReal.clear(),o()},alarmLevelReal=new ht.widget.ComboBox,alarmLevelReal.setWidth(163*ratio.ratioX),alarmLevelReal.setDropDownWidth(163*ratio.ratioX),alarmLevelReal.setBackground("url("+PAGEROOTDIR+"Script/image/f4.png) center center no-repeat"),0!=alarmLevelArray.length?("*"!=alarmLevelArray[0]&&alarmLevelArray.unshift("*"),alarmLevelReal.setValues(alarmLevelArray),alarmLevelReal.setValue(alarmLevelArray[0]),alarmLevelValueReal=alarmLevelArray):(alarmLevelReal.setValues(dataTypes),alarmLevelReal.setValue(dataTypes[0]),alarmLevelValueReal="*"),pageCountReal=new ht.widget.TextField,alarmLevelReal.onValueChanged=function(){var e=[];e.push(alarmLevelReal.getValue()),"*"==(alarmLevelValueReal=e)&&0!=alarmLevelArray.length&&(alarmLevelValueReal=alarmLevelArray),pageinputReal.value=1,realdataModelReal.clear(),o()},alarmStateReal=new ht.widget.ComboBox,alarmStateReal.setWidth(127*ratio.ratioX),alarmStateReal.setDropDownWidth(127*ratio.ratioX),alarmStateReal.setValues(alarmStates),alarmStateReal.setValue(alarmStates[0]),alarmStateReal.setBackground("url("+PAGEROOTDIR+"Script/image/f2.png) center center no-repeat"),alarmStateValueReal=alarmStateReal.getValue(),alarmStateReal.onValueChanged=function(){pageinputReal.value=1,realdataModelReal.clear(),o()};var p=new ht.widget.Toolbar([{label:" "+(r.colStylesObj&&r.colStylesObj.area&&r.colStylesObj.area.DisplayName||"设备")+":",element:c,unfocusable:!0},{label:"类别:",id:"alarmgroup",element:alarmGroupReal,unfocusable:!0},{label:"级别:",id:"alarmlavel",element:alarmLevelReal,unfocusable:!0,visible:!0},{label:"操作:",id:"alarmstatus",element:alarmStateReal,unfocusable:!0,visible:!0}]);if(ht.Default.def(i,ht.widget.BaseDropDownTemplate,{getView:function(){return this._treeView.getView()},onOpened:function(e){if(e){var a=this._treeView,t=e.split(",");a.dm().each(function(e){t.indexOf(e.getName())>=0&&a.sm().as(e)})}},onClosed:function(){},getValue:function(){var e="";return this._treeView.sm().each(function(a){e=a.getName()}),e},getHeight:function(){return 300}}),p.getView().style.background=r.backcolor,p.getView().style.padding=10,!r.IsHeadVisible){var f=tablePaneReal.getTableHeader();f.setHeight(1),f.getView().style.display="none"}r.IsSearchVisible&&n.setTopView(p),p.setStickToRight(!1),pageinputReal=document.createElement("input"),pageinputReal.value=1,pageinputReal.style.position="absolute",pageinputReal.style.margin=0,pageinputReal.style.padding="0px 2px",pageinputReal.style.outline=0,pageinputReal.style.border=0,pageinputReal.style.width=60*ratio.ratioX+"px",pageinputReal.style.height=ht.Default.widgetRowHeight+"px",pageinputReal.style.textAlign="center",pageinputReal.style.fontFamily='"苹方 粗体"',pageinputReal.style.color="rgb(0,0,0)",pageinputReal.style.fontSize=17*ratio.ratioY+"px",pageinputReal.style.fontWeight="bold",pageinputReal.onfocus=function(){pageinputReal.style.outline="1px solid "+ht.Color.highlight},pageinputReal.onblur=function(){pageinputReal.style.outline=0},pageinputReal.onkeydown=function(e){e.keyCode},rowssizeReal=new ht.widget.ComboBox,rowssizeReal.setValues([10,20,30,50,100]),rowssizeReal.setValue(20),rowssizeReal.setWidth(50),rowssizeReal.setDropDownWidth(140),rowssizeReal.onValueChanged=function(){pageinputReal.value=1,realdataModelReal.clear(),o()},(toolbar2Real=new ht.widget.Toolbar([{id:"bottomtoolbarsepratorleft",selected:!1,unfocusable:!0,button:{width:.5*t-90,editable:!1,background:"rgba(0,0,0,0)",selectBackground:"rgba(0,0,0,0)",borderColor:"rgba(0,0,0,0)"}},{unfocusable:!0,label:"<<",action:function(){pageinputReal.value=1,realdataModelReal.clear(),o()}},{unfocusable:!0,label:"<",action:function(){Number(pageinputReal.value)>1&&(pageinputReal.value=Number(pageinputReal.value)-1,realdataModelReal.clear(),o())}},{unfocusable:!0,label:"页:",element:pageinputReal},{unfocusable:!0,label:">",action:function(){Number(pageinputReal.value)<Number(pageCountReal.getValue())&&(pageinputReal.value=Number(pageinputReal.value)+1,o())}},{unfocusable:!0,label:">>",action:function(){pageinputReal.value=pageCountReal.getValue(),o()}},{unfocusable:!0,label:"共 1 页",id:"realAlarmTotalPageNum"},{id:"bottomtoolbarseprator",selected:!1,unfocusable:!0,button:{width:.5*t-360,editable:!1,background:"rgba(0,0,0,0)",selectBackground:"rgba(0,0,0,0)",borderColor:"rgba(0,0,0,0)"}},{unfocusable:!0,id:"confirm",visible:!alarmLevelVisible,button:{label:"确认",width:r.btnWidth,height:r.btnHeight,labelColor:r.btnfontcolor,labelFont:r.btnfontsize+"px "+r.btnfontfamily,selectBackground:r.btnAfterClickBackColor,border:0,background:r.btnBackgroundColor,onClicked:function(){var e={},a=tablePaneReal.getTableView().sm()._map;for(var t in a){var l=[],r=JSON.stringify(a[t]._attrObject.desc);e={tag_name:a[t]._attrObject.tagName,ensure_info:r},l.push(e),ensureAlarm(l)}}}},{unfocusable:!0,id:"confirmAll",visible:!alarmLevelVisible,button:{label:"全部确认",width:r.btnWidth,height:r.btnHeight,border:0,labelColor:r.btnfontcolor,labelFont:r.btnfontsize+"px "+r.btnfontfamily,selectBackground:r.btnAfterClickBackColor,background:r.btnBackgroundColor,onClicked:function(){for(var e={},a=realdataModelReal.getDatas()._as,t=0;t<a.length;t++){var l=[],r=JSON.stringify(a[t].a("desc"));e={tag_name:a[t].a("tagName"),ensure_info:r},l.push(e),ensureAlarm(l)}}}}])).getView().style.background=r.backcolor,toolbar2Real.setStickToRight(!1),window.addEventListener("resize",function(e){},!1);var v=t/ratio.ratioX;$(window).on("resizeOver",function(e){n.invalidate();var a=toolbar2Real.getItemById("bottomtoolbarseprator"),t=toolbar2Real.getItemById("bottomtoolbarsepratorleft");a.element.setWidth((.5*v-260)*ratio.ratioX),t.element.setWidth((.5*v-90)*ratio.ratioX),toolbar2Real.redraw()});var b=tablePaneReal.getColumnModel();(w=new ht.Column).setAlign("center"),w.setName("levelId"),w.setDisplayName("等级ID"),w.setAccessType("attr"),w.setVisible(!1),b.add(w),(w=new ht.Column).setAlign("center"),w.setName("ensureinfo"),w.setDisplayName("确定状态"),w.setAccessType("attr"),w.setVisible(!1),b.add(w),(w=new ht.Column).setAlign("center"),w.setName("resetinfo"),w.setDisplayName("复位状态"),w.setAccessType("attr"),w.setVisible(!1),b.add(w),(w=new ht.Column).setAlign("center"),w.setName("accdata"),w.setDisplayName("事故追忆"),w.setAccessType("attr"),w.setVisible(!1),b.add(w);for(var h=0;h<r.colStyles.length;h++){var w=new ht.Column;w.setAlign("center"),w.setName(r.colStyles[h].Name),w.setDisplayName(r.colStyles[h].DisplayName),w.setAccessType("attr"),w.setWidth(r.colStyles[h].Width*ratio.ratioY),w.drawCell=function(e,a,t,l,o,i,n,s){drawCell(e,a,a.a(l.getName()),t,l,o,i,n,s,r)},b.add(w)}tableViewRealConfig=tablePaneReal.getTableView(),tableViewRealConfig.setRowLineColor("#54b7db"),tableViewRealConfig.setColumnLineColor("transparent"),tableViewRealConfig.setSelectBackground("#31647e"),tableViewRealConfig.getLabelColor=function(){return"white"},tableViewRealConfig.setCheckMode(!0),n.getView().style.background=r.backcolor;tableViewRealConfig.getView();var C=null,y=[{label:"事故追忆",action:function(e,a){if(C){var t=C.a("groupName"),l=C.a("tagName").split(".")[0]+".",r=C.a("alarmtime")||Date.now();getKeyValueData(t,function(e){if(""!=e&&void 0!==e){accdata=JSON.parse(e.replace(/'/g,'"'));var a=accdata[0].split(";"),t=new Date(r);t.setMinutes(t.getMinutes()-parseInt(a[0]));var o=getDateString(t);t.setMinutes(t.getMinutes()+parseInt(a[1])+parseInt(a[0]));var i=getDateString(t);o=o||moment(new Date).format("YYYY-MM-DD H:mm:ss"),i=i||moment(new Date(o)).add(30,"seconds").format("YYYY-MM-DD H:mm:ss");for(var n=parseInt(a[2]),s="",m=1;m<accdata.length;m++)s+=l+accdata[m].name+",";exportDataExcel(s=s.substring(0,s.length-1),o,i,n,0),C=null}else alert("请设置相关联的指标")})}}}];new ht.widget.ContextMenu(y).beforeShow=function(e){C=tableViewRealConfig.getDataAt(e)},n.getView().style.background=r.backcolor,r.IsPageVisible?n.setBottomView(toolbar2Real):tableViewRealConfig.setCheckMode(!1);var P=new ht.HtmlNode;return P.setScalable(!1),P.s({"2d.selectable":!0,"2d.movable":!1}),P.setHtml(n),P.setPosition({x:e,y:a}),P.setWidth(t),P.setHeight(l),P.setPadding(0),function(e){socket&&socket.socketio&&socket.socketio.connected?(getAlarmGroups(function(e){var a=["*"];for(var t in e)e.hasOwnProperty(t)&&a.push(t);alarmGroupReal.setValues(a),alarmGroupReal.setValue(a[0])}),getAlarmCategories(function(e){if(e){var a=["*"];for(var t in e)e.hasOwnProperty(t)&&a.push(a[t]);alarmCategoryReal.setValues(a),alarmCategoryReal.setValue(a[0])}})):++e<10?setTimeout("getAlarmFilterData("+e+")",500):e=0}(0),o(),GD.setAlarmTableStyle(n,tablePaneReal,p,toolbar2Real,formRealLeft,r),alarmLevelVisible&&toggleColumnDisplay("故障",tablePaneReal,p,toolbar2Real),P}function exportDataExcel(e,a,t,l,r){var o="tagName="+e;o+="&beginTime="+a,o+="&endTime="+t,o+="&interval="+l,o+="&valueType="+r;var i=document.createElement("a");i.download="exportExcel",i.href="http://"+webServiceIP+":"+webServicePort+"/api/ExportToExcelInterpo?"+encodeURI(o),i.click()}function createAlarmConfig(e,a,t,l){function r(){if(","===n)getAlarmLevelTables(dataModelLevel,tablePaneLevel);else{for(var e,a=n.split(","),t=0;t<a.length;t++)if(0!=a[t].length){var l=dataModelLevel.getDataById(a[t])._attrObject,r=new AlarmLevels;r.level={value:Number(a[t])},r.level_name={value:l.alarmName},r.wave_file={value:l.wavName},r.alarm_color={value:ARGBToInt(l.alarmColor)},r.reset_color={value:ARGBToInt(l.resetColor)},r.ensure_color={value:ARGBToInt(l.confirmColor)},r.normal_color={value:ARGBToInt(l.normalColor)},r.popup={value:"是"==l.islight?1:0},r.wave_count={value:l.alarmLevel},e=r}n=",",updateAlarmLevels(e),getAlarmLevelTables(dataModelLevel,tablePaneLevel)}}function o(){data=new ht.Data,data.setId(GetRandomNum(0,99999)),data.a("alarmName","test"),data.a("wavName","wavName"),data.a("alarmColor","#0000001"),data.a("resetColor","#0000001"),data.a("confirmColor","#0000001"),data.a("islight","是"),data.a("alarmLevel","20"),dataModelLevel.add(data),dataModelLevel.sm().ss(data),tableLevelView.setFocusDataById(data.getId())}dataModelLevel=new ht.DataModel,tablePaneLevel=new ht.widget.TablePane(dataModelLevel),borderPaneAlarmLevel=new ht.widget.BorderPane,borderPaneAlarmLevel.setCenterView(tablePaneLevel);getAlarmLevelTables(dataModelLevel,tablePaneLevel);var i=[{name:"id",displayName:"编号",color:"#ceae42",align:"center",width:50},{name:"alarmName",displayName:"等级名称",color:"#ceae42",editable:!0,align:"center",accessType:"attr",width:80},{name:"wavName",displayName:"声音文件名",color:"#ceae42",align:"center",accessType:"attr",width:150},{name:"alarmColor",displayName:"报警颜色",color:"#ceae42",align:"center",accessType:"attr",colorPicker:{instant:!1},editable:!0,width:150},{name:"resetColor",displayName:"恢复颜色",color:"#ceae42",align:"center",accessType:"attr",colorPicker:{instant:!1},editable:!0,width:150},{name:"confirmColor",displayName:"确认颜色",color:"#ceae42",align:"center",colorPicker:{instant:!1},editable:!0,accessType:"attr",width:150},{name:"normalColor",displayName:"默认颜色",color:"#ceae42",align:"center",colorPicker:{instant:!1},editable:!0,accessType:"attr",width:150},{name:"islight",displayName:"是否闪烁",color:"#ceae42",align:"center",editable:!0,accessType:"attr",width:170,enum:["是","否"]},{name:"alarmLevel",displayName:"优先级",color:"#ceae42",align:"center",editable:!0,accessType:"attr",width:170}];tablePaneLevel.addColumns(i),tableLevelView=tablePaneLevel.getTableView(),tablePaneLevel.getView().style.background="#0C152A",tableLevelView.setRowLineColor("#54b7db"),tableLevelView.setColumnLineColor("transparent"),tableLevelView.setSelectBackground("#31647e"),tableLevelView.setRowHeight(25),tableLevelView.getLabelColor=function(){return"white"},tableLevelView.setCheckMode(!0);var n=",";dataModelLevel.onDataPropertyChanged=function(e,a){-1==n.indexOf(","+e._id+",")&&(n+=e._id+",")};var s=new ht.widget.Toolbar([{button:{width:50,label:"添加",borderColor:"#31647e",background:"#52b4d7",onClicked:function(){o()}}},{button:{width:50,label:"删除",borderColor:"#31647e",background:"#52b4d7",onClicked:function(){var e,a=tableLevelView.sm()._map;for(var t in a)e=t,dataModelLevel.removeDataById(t),deleteAlarmLevels(e)}}},{button:{width:50,label:"保存",borderColor:"#31647e",background:"#52b4d7",onClicked:function(){r()}}}]);s.getLabelColor=function(e){return"white"},s.getView().style.background="#3D3D3D",borderPaneAlarmLevel.setTopView(s);var m=new ht.HtmlNode;m.setScalable(!1),m.s({"2d.selectable":!0,"2d.movable":!1}),m.setHtml(borderPaneAlarmLevel),m.setPosition({x:e,y:a}),m.setWidth(t),m.setHeight(l),m.setPadding(0),dataModel.add(m)}function add(e,a,t,l){var r=document.createElement("div");r.style.background=t;var o=new ht.Tab;o.setName(a),o.setView(r);var i=e.getTabModel();return i.add(o),l&&i.getSelectionModel().setSelection(o),o}function createHisAlarm(e,a,t,l,r){function o(){if(!(socket&&socket.socketio&&socket.socketio.connected))return o._count++,void(o._count<10?setTimeout(o,500):o._count=0);getAlarmGroups(function(e){if(e){var a=["*"];for(var t in e)e.hasOwnProperty(t)&&a.push(t);alarmGroupHis.setValues(a),alarmGroupHis.setValue(a[0])}}),getAlarmCategories(function(e){if(e){var a=["*"];for(var t in e)e.hasOwnProperty(t)&&a.push(a[t]);h.setValues(a),h.setValue(a[0])}})}function i(){alarmFilterState?(dataAreaNameHis=f.getValue()||"*",alarmGroupValueHis=alarmGroupHis.getValue()||"*",alarmStateValueHis=alarmStateHis.getValue()||"*",getHisAlarmInfos(hisdataModelHis,null,pageinputHis.value,r.PageSize||200,pageCountHis,dataAreaNameHis,alarmGroupValueHis,alarmLevelValueHis,hisStartTime,hisEndTime,alarmStateValueHis)):++V<10?intervalTimers.push(setTimeout(i,800)):V=0}function n(e){function a(e){for(var a,t={},r=-1,o=0;o<e.length;o++){var i=e[o];""==JSON.parse(localStorage.getItem("extra")).area||'""'==localStorage.getItem("extra")?t[i.id]||(r=i.id,(a=new ht.Data)._id=i.id,a._pid=i.parent_id,a.setName(i.area_name),a.setTag(i.area_name),a.setParent(t[i.parent_id]),l.dm().add(a),t[i.id]=a):i.area_name==JSON.parse(localStorage.getItem("extra")).area&&(r=i.id,(a=new ht.Data)._id=i.id,a._pid=i.parent_id,a.setName(i.area_name),a.setTag(i.area_name),a.setParent(t[i.parent_id]),l.dm().add(a),t[i.id]=a)}getAreaTreeData(l,e,r,t),l.expandAll()}var t=this;n.superClass.constructor.call(t,e);var l=t._treeView=new ht.widget.TreeView;l.sm().ms(function(a){e.setValue(t.getValue())}),GD.setAreaTreeViewStyle(l),l.onDataClicked=function(a){alarmAreaIds.length=0,alarmAreaIds.push(a._id),getAreaIds(a),a._id>=0?GoldenAlarm.getGroupsByAreaID(a._id,function(e){for(var a,t=["*"],l=0;a=e[l++];)t.push(a.group_name);alarmGroupHis.setValues(t),alarmGroupHis.setValue(t[0])}):getAlarmGroups(function(e){var a=["*"];for(var t in e)e.hasOwnProperty(t)&&a.push(t);alarmGroupHis.setValues(a),alarmGroupHis.setValue(a[0])}),e.close()};var r={method:"GetAreas",param:{}};if(""==JSON.parse(localStorage.getItem("extra")).area||'""'==localStorage.getItem("extra")){var o=new ht.Data;o.setName("*"),o.setTag("*"),o.setId(-1),l.dm().add(o)}0===alarmAreaData.length?socket.alarmPost("/alarm/doservice?areas",r,function(e){if(e&&e.success){var t=e.data.data;alarmAreaData=t,a(t)}}):a(alarmAreaData)}function s(){function e(e){if(e){var a,t,l,r=[],o=[],i=[];tablePaneHis.getColumnModel().each(function(e){e.isVisible()&&(i.push(e),r.push(e.getDisplayName()))}),o.push(r);for(var n=0,s=e.length;n<s;n++){a=e[n],r=[];for(var m=0,d=i.length;m<d;m++)t=i[m].getName(),l=a[alarmHisTableColumnDic[t]],"alarmtime"===t&&(l=moment(l).format("YYYY-MM-DD HH:mm:ss")),"area"===t&&(l=alarmAreasDic[l]||"-"),"alarmGroup"===t&&(l=alarmGroupDicName[l]&&alarmGroupDicName[l].group_name||"-"),"alarmlevel"===t&&(l=alarmLevelDic[l]&&alarmLevelDic[l].level_name||"-"),"state"===t&&(l=a.is_ensure?a.is_reset?"已确认|已复归":"已确认|未复归":a.is_reset?"未确认|已复归":"未确认|未复归"),r.push(l);o.push(r)}GD.exportArrToCsv(o,"历史报警")}}searchHisAlarmInfos(1,1e3,f.getValue()||"*",alarmGroupHis.getValue()||"*",alarmLevelValueHis,hisStartTime,hisEndTime,alarmStateHis.getValue()||"*",function(a){a.total>1e3?searchHisAlarmInfos(1,a.total,f.getValue()||"*",alarmGroupHis.getValue()||"*",alarmLevelValueHis,hisStartTime,hisEndTime,alarmStateHis.getValue()||"*",function(a){e(a.data)}):e(a.data)})}currentControlContent+="hisalarm";if(borderPaneHis=new ht.widget.BorderPane,alarmCateHis=r.alarmCategoryReal,alarmLevelVisible=r.alarmLevelVisible,hisdataModelHis=new ht.DataModel,tablePaneHis=new ht.widget.TablePane(hisdataModelHis),tablePaneHis=createTableByObj(tablePaneHis,r),borderPaneHis.setCenterView(tablePaneHis),alarmLevelVisible){(formHisLeft=new ht.widget.FormPane).getView().style.background=r.backcolor,formHisLeft.setVGap(0),formHisLeft.setVPadding(0),formHisLeft.setHPadding(0),formHisLeft.setScrollBarSize(0),formHisLeft.addRow([{image:{width:45*ratio.ratioX,id:"levelimg10",name:"aaa"}}],[45*ratio.ratioX],12*ratio.ratioY);Math.ceil((l-100)/alarmCateHis.length);for(R=0;R<alarmCateHis.length;R++){var m=alarmCateHis[R],d=imagePath+m.icon;"故障"==alarmCateHis[R].name&&(alarmLevelArray=m.alarmLevelList),formHisLeft.addRow([{image:{width:45*ratio.ratioX,icon:d,id:"levelimg"+R,name:m.name,data:m.alarmLevelList,clickicon:imagePath+m.clickicon,onClicked:function(){this.setIcon(this.clickicon);for(var e=formHisLeft._rows,a=0;a<e.length;a++){var t=e[a].items[0].element;t.id!=this.id&&t.setIcon(e[a].items[0].image.icon)}pageinputHis.value=1,hisdataModelHis.clear(),alarmLevelArray=this.data,isHisFirst="首出故障"==this.name?1:"故障"==this.name||"全部"==this.name?null:0,"*"!=alarmLevelArray?("*"!=alarmLevelArray[0]&&alarmLevelArray.unshift("*"),alarmLevelValueHis=alarmLevelArray,w.setValues(alarmLevelArray),w.setValue(alarmLevelArray[0])):(alarmLevelValueHis=alarmLevelArray,w.setValues(dataTypes),w.setValue(dataTypes[0])),toggleColumnDisplay(this.name,tablePaneHis,A),i()}}}],[45*ratio.ratioX],100*ratio.ratioY);for(var u=formHisLeft._rows,g=0;g<u.length;g++){var c=u[g].items[0].element;"故障"==c.name&&c.setIcon(u[g].items[0].image.clickicon)}}borderPaneHis.setLeftView(formHisLeft,45*ratio.ratioX)}!function(e){if(e){for(var a,t=e.colStyles||[],l={},r=0,o=t.length;r<o;r++)l[(a=t[r]).Name]=a;e.colStylesObj=l}}(r);var p=new ht.HtmlNode;p.setScalable(!1),p.s({"2d.selectable":!0,"2d.movable":!1}),p.setHtml(borderPaneHis),p.setPosition({x:e,y:a}),p.setWidth(t),p.setHeight(l),p.setPadding(0),dataModel.add(p),pageinputHis=document.createElement("input"),pageinputHis.value=1,pageinputHis.style.position="absolute",pageinputHis.style.margin=0,pageinputHis.style.padding="0px 2px",pageinputHis.style.outline=0,pageinputHis.style.border=0,pageinputHis.style.width=60*ratio.ratioX+"px",pageinputHis.style.height=ht.Default.widgetRowHeight+"px",pageinputHis.style.textAlign="center",pageinputHis.style.fontFamily='"苹方 粗体"',pageinputHis.style.color="rgb(0,0,0)",pageinputHis.style.fontSize=17*ratio.ratioY+"px",pageinputHis.style.fontWeight="bold",pageinputHis.onfocus=function(){pageinputHis.style.outline="1px solid "+ht.Color.highlight},pageinputHis.onblur=function(){pageinputHis.style.outline=0},pageinputHis.onkeydown=function(e){e.keyCode};var f=new ht.widget.MultiComboBox;f.setWidth(145*ratio.ratioX),f.setValue(""==JSON.parse(localStorage.getItem("extra")).area||'""'==localStorage.getItem("extra")?"*":JSON.parse(localStorage.getItem("extra")).area),f.setDropDownComponent(n),f.setBackground("url("+PAGEROOTDIR+"Script/image/f3.png) no-repeat center center");var v=new ht.widget.ComboBox;v.setWidth(163*ratio.ratioX),v.setDropDownWidth(163*ratio.ratioX);var b=getDataTypes();v.setValues(b),v.setValue(b[0]),pointtypeHis=v.getValue(),v.setBackground("url("+PAGEROOTDIR+"Script/image/f4.png) no-repeat center center");var h=new ht.widget.ComboBox;h.setWidth(181*ratio.ratioX),alarmCateValueHis=h.getValue(),h.setBackground("url("+PAGEROOTDIR+"Script/image/f5.png) no-repeat center center");var w=new ht.widget.ComboBox;w.setWidth(163*ratio.ratioX),w.setBackground("url("+PAGEROOTDIR+"Script/image/f4.png) no-repeat center center"),0!=alarmLevelArray.length?("*"!=alarmLevelArray[0]&&alarmLevelArray.unshift("*"),w.setValues(alarmLevelArray),w.setValue(alarmLevelArray[0]),alarmLevelValueHis=alarmLevelArray):(w.setValues(dataTypes),w.setValue(dataTypes[0]),alarmLevelValueHis="*"),w.onValueChanged=function(){var e=[];e.push(w.getValue()),alarmLevelValueHis=e,"*"==alarmLevelValueHis&&0!=alarmLevelArray.length&&(alarmLevelValueHis=alarmLevelArray)},alarmGroupHis=new ht.widget.ComboBox,alarmGroupHis.setWidth(127*ratio.ratioX),alarmGroupHis.setBackground("url("+PAGEROOTDIR+"Script/image/f2.png) no-repeat center center"),alarmGroupValueHis=alarmGroupHis.getValue(),alarmGroupHis.onValueChanged=function(){},alarmStateHis=new ht.widget.ComboBox,alarmStateHis.setWidth(127*ratio.ratioX),alarmStateHis.setValues(alarmStates),alarmStateHis.setValue(alarmStates[0]),alarmStateHis.setBackground("url("+PAGEROOTDIR+"Script/image/f2.png) no-repeat center center"),alarmStateValueHis=alarmStateHis.getValue(),alarmStateHis.onValueChanged=function(){};var C=new Date,y=new Date(C.getTime()-864e5);hisStartTime=y,hisEndTime=C;var P=$('<input id ="startTimeNode0" class = "dateTimePicker back-size100" style = "border: none; padding-left:'+18*ratio.ratioX+"px;width:"+235*ratio.ratioX+"px;height:"+36*ratio.ratioY+"px;font-size:12px;background: url("+PAGEROOTDIR+'Script/image/f8.png) center center no-repeat;" />')[0];document.body.appendChild(P);var D=$('<input id ="endTimeNode0" class = "dateTimePicker back-size100" style = "border: none; padding-left:'+18*ratio.ratioX+"px;width:"+235*ratio.ratioX+"px;height:"+36*ratio.ratioY+"px;font-size:12px;background: url("+PAGEROOTDIR+'Script/image/f8.png) center center no-repeat;" />')[0];document.body.appendChild(D),function(){var e=laydate.render({elem:"#startTimeNode0",istime:!0,type:"datetime",value:y,theme:"blueblack",format:"yyyy-MM-dd HH:mm:ss",done:function(e,a,t){hisStartTime=e}}),a=laydate.render({elem:"#endTimeNode0",istime:!0,type:"datetime",value:C,format:"yyyy-MM-dd HH:mm:ss",theme:"blueblack",done:function(e,a,t){hisEndTime=e}});GD.setupDatePicker(P,e),GD.setupDatePicker(D,a)}(),o._count=0,o();var A=new ht.widget.Toolbar([{label:" "+(r.colStylesObj&&r.colStylesObj.area&&r.colStylesObj.area.DisplayName||"设备")+":",element:f,unfocusable:!0},{label:"类别:",id:"alarmgroup",element:alarmGroupHis,unfocusable:!0},{label:"级别:",id:"alarmlavel",element:w,unfocusable:!0,visible:alarmLevelVisible},{label:"操作:",id:"alarmstatus",element:alarmStateHis,unfocusable:!0,visible:!0},{label:"开始时间:",element:P,unfocusable:!0},{label:"结束时间:",element:D,unfocusable:!0},{button:{width:70,label:"查询",width:r.btnWidth,height:r.btnHeight,labelColor:r.btnfontcolor,labelFont:r.btnfontsize+"px "+r.btnfontfamily,selectBackground:r.btnAfterClickBackColor,background:r.btnBackgroundColor,onClicked:function(){pageinputHis.value=1,i()}},unfocusable:!0},{button:{width:70,label:"导出",width:r.btnWidth,height:r.btnHeight,labelColor:r.btnfontcolor,labelFont:r.btnfontsize+"px "+r.btnfontfamily,selectBackground:r.btnAfterClickBackColor,background:r.btnBackgroundColor,onClicked:function(){s()}},unfocusable:!0}]);A.getView().style.background=r.backcolor,borderPaneHis.setTopView(A),A.setStickToRight(!1),rowssizeHis=new ht.widget.ComboBox,rowssizeHis.setValues([10,20,30,50,100]),rowssizeHis.setValue(20),rowssizeHis.setWidth(50),rowssizeHis.setDropDownWidth(140),rowssizeHis.onValueChanged=function(){pageinputHis.value=1,i()};var V=0;ht.Default.def(n,ht.widget.BaseDropDownTemplate,{getView:function(){return this._treeView.getView()},onOpened:function(e){if(e){var a=this._treeView,t=e.split(",");a.dm().toDatas().each(function(e){t.indexOf(e.getName())>=0&&a.sm().as(e)})}},onClosed:function(){},getValue:function(){var e="";return this._treeView.sm().each(function(a){e+=a.getName()}),e},getHeight:function(){return 300}}),(toolbar2His=new ht.widget.Toolbar([{id:"bottomtoolbarseprator",selected:!1,unfocusable:!0,button:{width:.5*t-90,editable:!1,background:"rgba(0,0,0,0)",selectBackground:"rgba(0,0,0,0)",borderColor:"rgba(0,0,0,0)"}},{label:"<<",action:function(){pageinputHis.value=1,i()},unfocusable:!0},{label:"<",action:function(){Number(pageinputHis.value)>1&&(pageinputHis.value=Number(pageinputHis.value)-1,i())},unfocusable:!0},{label:"页:",element:pageinputHis,unfocusable:!0},{label:">",action:function(){Number(pageinputHis.value)<Number(pageCountHis.getValue())&&(pageinputHis.value=Number(pageinputHis.value)+1,i())},unfocusable:!0},{label:">>",action:function(){pageinputHis.value=pageCountHis.getValue(),i()},unfocusable:!0},{unfocusable:!0,label:"共 1 页",id:"hisAlarmTotalPageNum"}])).getView().style.background=r.backcolor,borderPaneHis.setBottomView(toolbar2His),toolbar2His.setStickToRight(!1),viewHis=borderPaneHis.getView(),viewHis.className="main",document.body.appendChild(viewHis),window.addEventListener("resize",function(e){borderPaneHis.invalidate()},!1),pageCountHis=new ht.widget.TextField,columnModel=tablePaneHis.getColumnModel(),(N=new ht.Column).setAlign("center"),N.setName("levelId"),N.setDisplayName("等级ID"),N.setAccessType("attr"),N.setVisible(!1),columnModel.add(N),(N=new ht.Column).setAlign("center"),N.setName("ensureinfo"),N.setDisplayName("确定状态"),N.setAccessType("attr"),N.setVisible(!1),columnModel.add(N),(N=new ht.Column).setAlign("center"),N.setName("resetinfo"),N.setDisplayName("复位状态"),N.setAccessType("attr"),N.setVisible(!1),columnModel.add(N);for(var R=0;R<r.colStyles.length;R++){var N=new ht.Column;N.setAlign("center"),N.setName(r.colStyles[R].Name),N.setDisplayName(r.colStyles[R].DisplayName),N.setAccessType("attr"),N.setWidth(r.colStyles[R].Width),N.drawCell=function(e,a,t,l,o,i,n,s){drawCell(e,a,a.a(l.getName()),t,l,o,i,n,s,r)},columnModel.add(N)}tableViewHis=tablePaneHis.getTableView(),tablePaneHis._toolbar2His=tablePaneHis._toolbar2His||toolbar2His,setTimeout(function(){i()},500),tablePaneHis.getView().style.background=r.backcolor,tableViewHis.setRowLineColor("#54b7db"),tableViewHis.setColumnLineColor("transparent"),tableViewHis.setSelectBackground("#31647e"),tableViewHis.getLabelColor=function(){return"white"};var L=t/ratio.ratioX;return $(window).on("resizeOver",function(e){toolbar2His.invalidate(),toolbar2His.getItemById("bottomtoolbarseprator").element.setWidth((.5*L-90)*ratio.ratioX),toolbar2His.redraw()}),GD.setAlarmTableStyle(borderPaneHis,tablePaneHis,A,toolbar2His,formHisLeft,r),alarmLevelVisible&&toggleColumnDisplay("故障",tablePaneHis,A,toolbar2His),p.exportHistoryAlarmData=s,p}function createAlarmPointConfig(e,a,t,l){function r(){var e=window.dialog=new ht.widget.Dialog;formPanePointConfig=new ht.widget.FormPane,dataModelTag=new ht.DataModel,tablePointConfigPane=new ht.widget.TablePane(dataModelTag);var a=[{name:"id",displayName:"Id",align:"center",width:50},{name:"configPointName",displayName:"标签名",align:"center",accessType:"attr",width:180},{name:"configPointDesc",displayName:"描述",align:"center",accessType:"attr",width:300}];tablePointConfigPane.addColumns(a),tablePointCofigView=tablePointConfigPane.getTableView(),tablePointCofigView.setCheckMode(!0),document.body.appendChild(formPanePointConfig.getView());var t=-1;formPanePointConfig.addRow(["测点类型:",{id:"pointAlarmType",comboBox:{values:["模拟量","数字量"],value:"模拟量",onValueChanged:function(){"模拟量"==this.getValue()?(1==t&&(formPanePointConfig.removeRow(3),formPanePointConfig.removeRow(3),addAnalogRows(formPanePointConfig,f,o,d)),t=0):(0!=t&&-1!=t||(formPanePointConfig.removeRow(3),formPanePointConfig.removeRow(3),formPanePointConfig.removeRow(3)),t=1,addDigitalRows(formPanePointConfig,f,o,d))}}},"标签名称:",{id:"pointName",textField:{text:"*"}},"标签描述:",{id:"pointDesc",textField:{text:"*"}},{button:{label:"查找",onClicked:function(){dataModelTag.clear(),getTags("模拟量"==formPanePointConfig.v("pointAlarmType")?"false":"true",formPanePointConfig.v("pointName"),formPanePointConfig.v("pointDesc"),dataModelTag)}}}],[60,.03,60,.03,60,.03,60,.03]),formPanePointConfig.addRow([tablePointConfigPane],[.1],.1);var l=[];for(var r in f)"*"!=f[r]&&l.push(f[r]);var o=l.length>0?l[0]:"";formPanePointConfig.addRow(["组:",{id:"pointGroup",comboBox:{values:p,value:p[0]}}],[60,.03]),addAnalogRows(formPanePointConfig,l,o,d),e.setConfig({title:"报警规则添加",titleIcon:"node_image",content:formPanePointConfig,width:600,height:450,draggable:!0,closable:!0,maximizable:!0,resizeMode:"wh",buttons:[{label:"保存"},{label:"取消",className:"button-yes"}],buttonsAlign:"center",action:function(a,l){if("保存"==a.label){var r={};formPanePointConfig.v("pointGroup");if(0==t){if(checkNumber(formPanePointConfig.v("highvalue1"))){var o=new AlarmFilterSetting;o.message=formPanePointConfig.v("highdesc1"),o.value=Number(formPanePointConfig.v("highvalue1"));y=getAlarmLevelNameByName(formPanePointConfig.v("highlevel1"));o.level=y}if(checkNumber(formPanePointConfig.v("highvalue2"))){var i=new AlarmFilterSetting;i.message=formPanePointConfig.v("highdesc2"),i.value=Number(formPanePointConfig.v("highvalue2"));D=getAlarmLevelNameByName(formPanePointConfig.v("highlevel2"));i.level=D}if(checkNumber(formPanePointConfig.v("highvalue3"))){var n=new AlarmFilterSetting;n.message=formPanePointConfig.v("highdesc3"),n.value=Number(formPanePointConfig.v("highvalue3"));var s=getAlarmLevelNameByName(formPanePointConfig.v("highlevel3"));n.level=s}if(checkNumber(formPanePointConfig.v("lowvalue1"))){var m=new AlarmFilterSetting;m.message=formPanePointConfig.v("lowdesc1"),m.value=Number(formPanePointConfig.v("lowvalue1"));var d=getAlarmLevelNameByName(formPanePointConfig.v("lowlevel1"));m.level=d}if(checkNumber(formPanePointConfig.v("lowvalue2"))){var u=new AlarmFilterSetting;u.message=formPanePointConfig.v("lowdesc2"),u.value=Number(formPanePointConfig.v("lowvalue2"));var g=getAlarmLevelNameByName(formPanePointConfig.v("lowlevel2"));u.level=g}if(checkNumber(formPanePointConfig.v("lowvalue3"))){var c=new AlarmFilterSetting;c.message=formPanePointConfig.v("lowdesc3"),c.value=Number(formPanePointConfig.v("lowvalue3"));var p=getAlarmLevelNameByName(formPanePointConfig.v("lowlevel3"));c.level=p}r={h1:o,h2:i,h3:n,l1:m,l2:u,l3:c};var f=tablePointCofigView.sm()._map,v=[];for(var b in f){var h={},w=dataModelTag.getDataById(b);(A=new AlarmPoints).tag_name=w._attrObject.configPointName,A.template="analog",A.description=w._attrObject.configPointDesc,A.attributes=JSON.stringify(r),h={tag:w._attrObject.configPointName},A.factor_tags=JSON.stringify(h),v.push(A)}updateAlarmPoints(v)}if(1==t){var C=new AlarmFilterSetting;C.message=formPanePointConfig.v("shiftAlarmDesc1");var y=getAlarmLevelNameByName(formPanePointConfig.v("shiftlevel1"));C.level=y;var P=new AlarmFilterSetting;P.message=formPanePointConfig.v("shiftAlarmDesc2");var D=getAlarmLevelNameByName(formPanePointConfig.v("shiftlevel2"));P.level=D,r={to0:C,to1:P};var f=tablePointCofigView.sm()._map,v=[];for(var b in f){var h={},w=dataModelTag.getDataById(b),A=new AlarmPoints;A.tag_name=w._attrObject.configPointName,A.template="boolean",A.description=w._attrObject.configPointDesc,A.attributes=JSON.stringify(r),h={tag:w._attrObject.configPointName},A.factor_tags=JSON.stringify(h),v.push(A)}updateAlarmPoints(v)}e.hide(),getAlarmPoints(dataModelPointConfig,1,20,pageCountPointConfig,dataAreaName,pointtypePointConfig)}"取消"==a.label&&e.hide()}}),e.show()}currentControlContent+="alarmpointconfig";borderPanePointConfig=new ht.widget.BorderPane,dataModelPointConfig=new ht.DataModel,tablePanePointConfig=new ht.widget.TablePane(dataModelPointConfig),borderPanePointConfig.setCenterView(tablePanePointConfig);var o=new ht.HtmlNode;o.setScalable(!1),o.s({"2d.selectable":!0,"2d.movable":!1}),o.setHtml(borderPanePointConfig),o.setPosition({x:e,y:a}),o.setWidth(t),o.setHeight(l),o.setPadding(0),dataModel.add(o);var i=new ht.widget.ComboBox;i.setWidth(120),i.setDropDownWidth(120),getAlarmAreas(function(e){if(dataTypes=[],GD.isEmptyObj(e))dataTypes.push("*");else for(var a=0;a<e.length;a++)dataTypes.push(e[a].area_name);i.setValues(dataTypes),i.setValue(dataTypes[0])}),dataAreaName=i.getValue();var n=new ht.widget.ComboBox;n.setWidth(150),n.setDropDownWidth(140);var s=getDataTypes();n.setValues(s),n.setValue(s[0]),pointtypePointConfig=n.getValue();var m=new ht.widget.ComboBox,d=getAlarmCategories(function(e){if(e){var a=["*"];for(var t in e)e.hasOwnProperty(t)&&a.push(a[t]);m.setValues(a),m.setValue(a[0])}});getAlarmLevels(new ht.widget.ComboBox);var u=",";getAlarmPoints(dataModelPointConfig,tablePanePointConfig);var g=new ht.widget.Toolbar([{label:"区域:",element:i,unfocusable:!0},{label:"点类型:",element:n,unfocusable:!0},{button:{width:50,label:"查询",borderColor:"#31647e",background:"#52b4d7",onClicked:function(){pageinputPointConfig.value=1,dataAreaName=i.getValue(),pointtypePointConfig=n.getValue(),getAlarmPoints(dataModelPointConfig,tablePanePointConfig,pageinputPointConfig.value,rowssizePointConfig.getValue(),pageCountPointConfig,dataAreaName,pointtypePointConfig)}}},{button:{width:50,label:"添加",borderColor:"#31647e",background:"#52b4d7",onClicked:function(){r()}}},{button:{width:50,label:"删除",borderColor:"#31647e",background:"#52b4d7",onClicked:function(){var e=tableViewPointConfig.sm()._map,a={};for(var t in e)t,a={tag_name:e[t]._attrObject.tagName},dataModelPointConfig.removeDataById(t);deleteAlarmPoints(a)}}},{button:{width:50,label:"确认",borderColor:"#31647e",background:"#52b4d7",onClicked:function(){var e=[],a={},t=tablePanePointConfig.getTableView().sm()._map;for(var l in t)EnsureUser=JSON.stringify(t[l]._attrObject.desc),Ensuretag=t[l]._attrObject.tagName,a={tag_name:Ensuretag,ensure_info:EnsureUser},e.push(a);ensureAlarm(e),getAlarmPoints(dataModelPointConfig,tablePanePointConfig,pageinputPointConfig.value,rowssizePointConfig.getValue(),pageCountPointConfig,dataAreaName,pointtypePointConfig)}}}]);g.getLabelColor=function(e){return"#52b4d7"},g.getView().style.background="#3D3D3D",borderPanePointConfig.setTopView(g),g.setStickToRight(!1),pageinputPointConfig=document.createElement("input"),pageinputPointConfig.value=1,pageinputPointConfig.style.position="absolute",pageinputPointConfig.style.margin=0,pageinputPointConfig.style.padding="0px 2px",pageinputPointConfig.style.outline=0,pageinputPointConfig.style.border=0,pageinputPointConfig.style.width="60px",pageinputPointConfig.style.height=ht.Default.widgetRowHeight+"px",pageinputPointConfig.onfocus=function(){pageinputPointConfig.style.outline="1px solid "+ht.Color.highlight},pageinputPointConfig.onblur=function(){pageinputPointConfig.style.outline=0},pageinputPointConfig.onkeydown=function(e){e.keyCode},rowssizePointConfig=new ht.widget.ComboBox,rowssizePointConfig.setValues([10,20,30,50,100]),rowssizePointConfig.setValue(20),rowssizePointConfig.setWidth(50),rowssizePointConfig.setDropDownWidth(140),rowssizePointConfig.onValueChanged=function(){pageinputPointConfig.value=1,dataModelPointConfig.clear(),getAlarmPoints(dataModelPointConfig,pageinputPointConfig.value,rowssizePointConfig.getValue(),pageCountPointConfig,dataAreaName,pointtypePointConfig)};var c=new ht.widget.Toolbar([{label:"Rows:",element:rowssizePointConfig},{label:"<<",action:function(){pageinputPointConfig.value=1,getAlarmPoints(dataModelPointConfig,pageinputPointConfig.value,rowssizePointConfig.getValue(),pageCountPointConfig,dataAreaName,pointtypePointConfig)}},{label:"<",action:function(){Number(pageinputPointConfig.value)>1&&(pageinputPointConfig.value=Number(pageinputPointConfig.value)-1,dataModelPointConfig.clear(),getAlarmPoints(dataModelPointConfig,pageinputPointConfig.value,rowssizePointConfig.getValue(),pageCountPointConfig,dataAreaName,pointtypePointConfig))}},{label:"Page:",element:pageinputPointConfig},{label:">",action:function(){Number(pageinputPointConfig.value)<Number(pageCountPointConfig.getValue())&&(pageinputPointConfig.value=Number(pageinputPointConfig.value)+1,dataModelPointConfig.clear(),getAlarmPoints(dataModelPointConfig,pageinputPointConfig.value,rowssizePointConfig.getValue(),pageCountPointConfig,dataAreaName,pointtypePointConfig))}},{label:">>",action:function(){pageinputPointConfig.value=pageCountPointConfig.getValue(),dataModelPointConfig.clear(),getAlarmPoints(dataModelPointConfig,pageinputPointConfig.value,rowssizePointConfig.getValue(),pageCountPointConfig,dataAreaName,pointtypePointConfig)}}]);c.getLabelColor=function(e){return"white"},c.getView().style.background="#3D3D3D",borderPanePointConfig.setBottomView(c),c.setStickToRight(!0),viewPointConfig=borderPanePointConfig.getView(),viewPointConfig.className="main",document.body.appendChild(viewPointConfig),window.addEventListener("resize",function(e){borderPanePointConfig.invalidate()},!1),dataModelPointConfig.onDataPropertyChanged=function(e,a){-1==u.indexOf(","+e._id+",")&&(u+=e._id+",")};var p=getAlarmGroups(),f=getAlarmLevels();pageCountPointConfig=new ht.widget.TextField;var v=[{name:"tagnum",displayName:"序号",color:"#ceae42",align:"center",accessType:"attr",width:150,editable:!1},{name:"area",displayName:"区域",color:"#ceae42",align:"center",accessType:"attr",width:150,editable:!1},{name:"tagName",displayName:"标签名",color:"#ceae42",align:"center",accessType:"attr",width:700,editable:!1},{name:"desc",displayName:"描述",color:"#ceae42",align:"center",accessType:"attr",width:60,editable:!1},{name:"rol",displayName:"报警规则",color:"#ceae42",align:"center",accessType:"attr",width:60,editable:!1},{name:"group",displayName:"组",color:"#ceae42",align:"center",accessType:"attr",width:60,editable:!1},{name:"issheild",displayName:"是否屏蔽",color:"#ceae42",align:"center",accessType:"attr",width:60,editable:!1,enum:{values:["开","关"],editable:!0,maxHeight:120}}];tablePanePointConfig.addColumns(v),tableViewPointConfig=tablePanePointConfig.getTableView(),tablePanePointConfig.getView().style.background="#0C152A",tableViewPointConfig.setRowLineColor("#54b7db"),tableViewPointConfig.setColumnLineColor("transparent"),tableViewPointConfig.setSelectBackground("#31647e"),tableViewPointConfig.setRowHeight(25),tableViewPointConfig.getLabelColor=function(){return"white"},tableViewPointConfig.setCheckMode(!0)}function createAlarmGroup(e,a,t,l){function r(){if(","===n);else{for(var e,a=n.split(","),t=0;t<a.length;t++)if(0!=a[t].length){var l=dataModelGroup.getDataById(a[t])._attrObject,r=new AlarmGroup;r.id={value:Number(a[t])},r.group_name={value:l.groupName},e=r}updateAlarmGroup(e),getAlarmGropTables(dataModelGroup,tablePaneGroup)}}function o(){data=new ht.Data,data.setId(GetRandomNum(0,99999)),data.a("groupName","组名称"),data.a("groupDesc","说明"),dataModelGroup.add(data),dataModelGroup.sm().ss(data),tableGroupView.setFocusDataById(data.getId())}dataModelGroup=new ht.DataModel,tablePaneGroup=new ht.widget.TablePane(dataModelGroup),borderPaneGroup=new ht.widget.BorderPane,borderPaneGroup.setCenterView(tablePaneGroup),getAlarmGropTables(dataModelGroup,tablePaneGroup);var i=[{name:"id",displayName:"编号",color:"#ceae42",align:"center",width:50},{name:"groupName",displayName:"组名称",color:"#ceae42",align:"center",accessType:"attr",width:500,editable:!0},{name:"groupDesc",displayName:"说明",color:"#ceae42",align:"center",accessType:"attr",width:550,editable:!0}];tablePaneGroup.addColumns(i),tableGroupView=tablePaneGroup.getTableView(),tablePaneGroup.getView().style.background="#0C152A",tableGroupView.setRowLineColor("#54b7db"),tableGroupView.setColumnLineColor("transparent"),tableGroupView.setSelectBackground("#31647e"),tableGroupView.setRowHeight(25),tableGroupView.getLabelColor=function(){return"white"},tableGroupView.setCheckMode(!0);var n=",";dataModelGroup.onDataPropertyChanged=function(e,a){-1==n.indexOf(","+e._id+",")&&(n+=e._id+",")};var s=new ht.widget.Toolbar([{button:{width:50,label:"添加",borderColor:"#31647e",background:"#52b4d7",onClicked:function(){o()}}},{button:{width:50,label:"删除",borderColor:"#31647e",background:"#52b4d7",onClicked:function(){var e,a=tableGroupView.sm()._map;for(var t in a)e=t,dataModelGroup.removeDataById(t);deleteAlarmGrop(e)}}},{button:{width:50,label:"保存",borderColor:"#31647e",background:"#52b4d7",onClicked:function(){r()}}}]);s.getLabelColor=function(e){return"white"},s.getView().style.background="#3D3D3D",borderPaneGroup.setTopView(s);var m=new ht.HtmlNode;m.setScalable(!1),m.s({"2d.selectable":!0,"2d.movable":!1}),m.setHtml(borderPaneGroup),m.setPosition({x:e,y:a}),m.setWidth(t),m.setHeight(l),m.setPadding(0),dataModel.add(m)}function addAnalogRows(e,a,t,l){formPanePointConfig.addRow([l[1],{id:"highvalue1",textField:{text:"*"}},{id:"highlevel1",comboBox:{values:a,value:t}},{id:"highdesc1",textField:{text:"*"}},l[4],{id:"lowvalue1",textField:{text:"*"}},{id:"lowlevel1",comboBox:{values:a,value:t}},{id:"lowdesc1",textField:{text:"*"}}],[60,.03,60,.03,60,.03,60,.03]),formPanePointConfig.addRow([l[2],{id:"highvalue2",textField:{text:"*"}},{id:"highlevel2",comboBox:{values:a,value:t}},{id:"highdesc2",textField:{text:"*"}},l[5],{id:"lowvalue2",textField:{text:"*"}},{id:"lowlevel2",comboBox:{values:a,value:t}},{id:"lowdesc2",textField:{text:"*"}}],[60,.03,60,.03,60,.03,60,.03]),formPanePointConfig.addRow([l[3],{id:"highvalue3",textField:{text:"*"}},{id:"highlevel3",comboBox:{values:a,value:t}},{id:"highdesc3",textField:{text:"*"}},l[6],{id:"lowvalue3",textField:{text:"*"}},{id:"lowlevel3",comboBox:{values:a,value:t}},{id:"lowdesc3",textField:{text:"*"}}],[60,.03,60,.03,60,.03,60,.03])}function addDigitalRows(e,a,t,l){for(var r=[],o=0;o<l.length;o++)r.push(l[o]);formPanePointConfig.addRow(["报警设置:",{id:"shiftTo1",comboBox:{values:r,value:r[0]}},{id:"shiftlevel1",comboBox:{values:a,value:t}},{id:"shiftAlarmDesc1",textField:{text:"*"}}],[60,.03,60,.03,60,.03,60,.03]),formPanePointConfig.addRow(["报警设置:",{id:"shiftTo2",comboBox:{values:r,value:r[0]}},{id:"shiftlevel2",comboBox:{values:a,value:t}},{id:"shiftAlarmDesc2",textField:{text:"*"}}],[60,.03,60,.03,60,.03,60,.03])}function getAlarmSound(e){var a,t="",l=0;null!=alarmLevelDic[e.state0]&&(t=alarmLevelDic[e.state0].wave_file,a=alarmLevelDic[e.state0].duration),""!=t&&(audio.src="http://"+authServiceIP+":"+authServicePort+"/html/audio/"+t,audio.play(),audio.addEventListener("ended",function(){(l+=audio.duration)<=a?audio.play():(l=0,audio.pause())}))}function AlarmInfoShow(e,a){function t(e){var t,l={},i=[];l.isCurrent=!0,l.trigger_time=0;for(var n in alarmSystemObj)o[n]=null;o.count=0;for(var s=0,m=e.length;s<m;s++)(t=e[s]).systemName=alarmSystemObj[t.state3]&&alarmSystemObj[t.state3].system_name||"",t.alarmDesc=t.user_data0,t.alarmTime=moment(r.trigger_time).format("YYYY-MM-DD HH:mm:ss"),alarmAreasDic[t.state1]?t.alarmAreaName=alarmAreasDic[t.state1]:t.alarmAreaName=" ",alarmAreaFilter(t.alarmAreaName)&&(t.trigger_time>l.trigger_time&&(l.isCurrent=!1,(l=t).isCurrent=!0),o[t.state3]||(o[t.state3]=t),i.push(t));o.count=a||i.length}var l,r=e&&e[0]||null,o={};try{l=!(!window.parent||!0!==window.parent.showAlarmWindow)}catch(e){l=!1}if(!0!==l){var i=AlarmInfoShow.alarmInfoWindow||GD.createAlarmWindow(function(){var e=i.currentData&&i.currentData.ensure_info;ensureAlarm([{tag_name:i.currentData&&i.currentData.tag_name,ensure_info:e}],function(e){})});r?(i.isHide()&&i.alarmWindowShow(),t(e),i.refreshData(o),document.body.appendChild(i._dom),i.addEventToDom(i._dom),i.alarmWindowDragable(!0),i.setFlagShaly(),AlarmInfoShow.alarmInfoWindow||(AlarmInfoShow.alarmInfoWindow=i),getAlarmSound(r)):i.alarmWindowHide()}}function AlarmInfoShow1(e,a,t){t=t||{};var l=e.length;if(a==l&&0!=l&&(a-=1),a>l&&(l=a),e.length<=0)void 0!==alarmInfoDialog&&alarmInfoDialog.isShowing()&&alarmInfoDialog.hide();else{var r=e[a],o=alarmAreasDic[r.state1],i=moment(Number(r.alarm_time)).format("YYYY-MM-DD HH:mm:ss"),n=r.user_data0||r.alarm_message,s=(r.tag_name,document.body.clientWidth,graphView.getView().clientHeight,imagePath+"alarm.png"),m=.22*document.body.clientWidth,d=.35*graphView.getView().clientHeight,u="<div style='padding-right:15px;width:"+m+"px;height:"+d+"px;background:"+t.paneContentBackColor+";opacity:0.78;filter:Alpha(opacity=78);'><p><img src="+s+" id='alarm_img' width='45px' height='50px'><span style='height:30px;color:"+t.paneUnEnsureFontColor+";font:"+t.paneUnEnsureFontSize+"px "+t.paneUnEnsureFontFamily+" ;float:right;display:block;'>待确认故障<font color='"+t.paneCountFontColor+"' size='"+t.paneCountFontSize+"' face='"+t.paneCountFontFamily+"'>"+l+"</font>项</span></p><p style='height:23px;color:"+t.paneContentFontColor+";font:"+t.paneContentFontSize+"px "+t.paneContentFontFamily+";'>&nbsp;&nbsp;设备名称:"+o+"</p><p style='height:23px;color:"+t.paneContentFontColor+";font:"+t.paneContentFontSize+"px "+t.paneContentFontFamily+";'>&nbsp;&nbsp;故障名称:"+n+"</p><p style='height:23px;color:"+t.paneContentFontColor+";font:"+t.paneContentFontSize+"px "+t.paneContentFontFamily+";'>&nbsp;&nbsp;故障时间:"+i+"</p></p></div>",g={titleBackground:t.paneTitleBackColor,titleColor:t.paneTitleFontColor,position:{x:"",y:""},draggable:!1,content:u,width:m,height:d,buttons:[{label:"确认",className:"ensurebtn",action:function(){window.alarmData.removeArr(a),0!=a&&(a-=1);var e=r.ensure_info,t=r.tag_name;tagobj={tag_name:t,ensure_info:e},ensureAlarm([tagobj],function(e){})}}],buttonsAlign:"right"},c=alarmSystemObj[r.state3].system_name;(alarmInfoDialog=createDialogAlarm(alarmInfoDialog,g,!0,t,c)).setModal(!1),alarmInfoDialog.$dialogTitle.text(e.length),alarmInfoDialog.isShowing()||alarmInfoDialog.show(),document.getElementsByClassName("dialog-container-buttons")[0].style.background=t.paneContentBackColor,document.getElementsByClassName("dialog-content")[0].style.background=t.paneContentBackColor,getAlarmSound(e[a])}}function getAllUnsureAlarmInfo(e){e=e||function(){};var a={condition:[{field:"is_ensure",method:0,value:"0"}]};socket.alarmPost("/alarm/GetSnapshots",a,function(a){if(a.success&&a.data)return e(a.data.data);e([])})}function AlarmErrorShow(e){var a=new ht.widget.Dialog;a.setConfig({title:"错误消息提示",titleAlign:"left",closable:!0,draggable:!0,contentPadding:20,content:"<p>"+e+"</p>",buttons:[{label:"关闭"}],buttonsAlign:"right",action:function(e,t){a.hide()}}),a.setModal(!1),a.show()}function getAreaIds(e){if(e._children)for(var a=0;a<e._children._as.length;a++)alarmAreaIds.push(e._children._as[a]._id),getAreaIds(e._children._as[a])}function alarmInit(){getAlarmGroups(function(){getAlarmSystem(function(e){alarmSystem=e,e.forEach(function(e,a){alarmSystemObj[e.id]=e}),getAlarmAreas(function(){getAlarmCateByName(),getAlarmLevels(),alarmAreaFilter=function(){function e(a){for(var t,r,o,i,n,s=[],m=[],d=0,u=a.length;d<u;d++){""!=(n=a[d])&&alarmAreaIds.push(n);for(var g in alarmAreaDicNameId)alarmAreaDicNameId.hasOwnProperty(g)&&(r=(t=alarmAreaDicNameId[g]||{}).parent_id,o=t.id,i=t.area_name,r===n&&(s.push(i),m.push(o)))}s.length>0&&(l=l.concat(s),e(m))}var a=(GD.getParams("extra")||{}).area||"",t=alarmAreaDicName[a]&&alarmAreaDicName[a].id||"",l=[];return l.push(a),alarmAreaIds.length=0,e([t]),function(e){return!a||-1!==l.indexOf(e)}}()})})})}function getAreaTreeData(e,a,t,l){for(var r=t,o=0;o<a.length;o++){var i=a[o];if(i.parent_id==r){if(data=new ht.Data,data._id=i.id,data._pid=i.parent_id,data.setName(i.area_name),data.setTag(i.area_name),data.setParent(l[i.parent_id]),e.dm().add(data),l[i.id]=data,o==a.length-1)break;getAreaTreeData(e,a,i.id,l)}}}var socket;!function(){var e={path:"/wsaccess/socket.io/"};"True"!=isAuthEnable&&(e.reconnection=!1),socket||(socket=GD.io("http://"+authServiceIP+":"+authServicePort,e)).socketio.on("connect",function(e){alarmInit()})}(),function(e){var a=e.GD||{};a.setAlarmTableStyle=function(e,a,t,l,r,o){var i=a.getTableHeader(),n=(a.getTableView(),$(i.getView()),$(l.getView()));o.IsHeadVisible&&(e.setBottomHeight(60*ratio.ratioY),e.setTopHeight(60*ratio.ratioY),e.setLeftWidth(45*ratio.ratioX),$(e.getView()).css({border:"1px solid rgb(14,37,79)"}),function(e,t){var l=a.getDataModel().getSelectionModel(),r=i.drawColumn;a.getTableView().getCheckIcon=function(a){return l.contains(a)?t:e},i.drawColumn=function(a,o,i,n,s,m){var d;o.getName()||o.getDisplayName()?r.apply(this,arguments):(d=l.getSelection()._as.length>0?t:e,ht.Default.drawImage(a,d,i+.5*s-6,n+.5*m-6,12,12))}}({width:12,height:12,comps:[{type:"rect",background:"rgb(255,255,255)",borderWidth:2,borderColor:"rgb(204,214,215)"}]},{width:12,height:12,comps:[{type:"rect",background:"rgb(255,255,255)",borderWidth:2,borderColor:"rgb(204,214,215)",rect:[0,0,12,12]},{type:"shape",shadow:!1,points:[2,6,6,10,10,2],segments:[1,2,2],borderWidth:2,borderColor:"rgb(186,118,81)"}]}),function(){if(t){t.setLabelColor("rgb(160,160,160)"),t.setLabelFont("bold "+21*ratio.ratioY+'px "苹方 特粗"'),t.setItemGap(20*ratio.ratioX);for(var e,a,l=t.getItems(),r=0,o=l.length;r<o;r++)a=l[r]||{},(e=a.element)&&(e instanceof ht.widget.ComboBox?function(e){e.getLabelColor=function(e,a){return this.isOpened()||a?"rgb(0,0,0)":"rgb(218,219,172)"},e.setLabelFont("bold "+18*ratio.ratioY+'px "苹方 特粗"'),e.onOpened=function(){var e=this._listView.getView();$(e).css({maxHeight:500*ratio.ratioY,cursor:"pointer"}),$(this.getView()).find("input").css({display:"none"})},e._dropDownBackground="rgb(255,255,255)",e.setSelectBackground("rgb(104,216,255)"),$(e.getView()).css({border:"1px solid rgba(0,0,0,0)",height:36*ratio.ratioY,cursor:"pointer"}).addClass("back-size100"),e.setDropDownIcon({width:9,height:6,comps:[{type:"triangle",borderJoin:"miter",background:"rgba(35,213,91,0)",rotation:Math.PI}]});var a=e.drawValue;e.drawValue=function(e,t,l,r,o,i,n){var s=Array.prototype.slice.call(arguments,0);s[3]=20*ratio.ratioX,a.apply(this,s)}}(e):e instanceof ht.widget.MultiComboBox?function(){e.setDropDownIcon(null),$(e.getView()).css({border:"1px solid rgba(0,0,0,0)",height:36*ratio.ratioY,cursor:"pointer"}).addClass("back-size100"),e.getLabelColor=function(e,a){return this.isOpened()||a?"rgb(0,0,0)":"rgb(218,219,172)"},e.setLabelFont(18*ratio.ratioY+'px "苹方 粗体"');var a=e.drawValue;e.drawValue=function(e,t,l,r,o){var i=Array.prototype.slice.call(arguments,0);i[1]=20*ratio.ratioY,a.apply(this,i)}}():e instanceof ht.widget.Button?(e.setBorderColor("rgba(0,0,0,0)"),e.setLabelColor("rgb(255,255,255)"),e.setSelectBackground("rgba(0,0,0,0)"),e.setLabelFont(18*ratio.ratioY+'px "苹方 粗体"'),e.setBackground("rgba(0,0,0,0)"),$(e.getView()).css({width:69*ratio.ratioX,height:30*ratio.ratioY,cursor:"pointer",backgroundImage:"url("+PAGEROOTDIR+"Script/image/f2button.png)",backgroundPosition:"center",backgroundSize:"100%"}).on("mousedown",function(){$(this).css({margin:"1px 0 0 1px"})}).on("mouseup",function(){$(this).css({margin:0})})):e&&$(e).css({fontSize:18*ratio.ratioY+"px",color:"rgb(218,219,172)",fontWeight:"normal"}))}}(),function(){function e(e){var a=$(e.element.getView());e.element.setBorderColor("rgba(0,0,0,0)"),e.element.setBackground("rgba(0,0,0,0)"),e.element.setSelectBackground("rgba(0,0,0,0)"),e.element.setLabelFont(16*ratio.ratioY+'px "苹方 粗体"'),e.element.setWidth(80*ratio.ratioX),e.element.setHeight(30*ratio.ratioY),a.css(r).hover(function(){$(this).css({boxShadow:"0 0 10px rgb(200, 200, 200)"})},function(){$(this).css({boxShadow:"1px 1px 4px rgb(20,20,20)"})}).mousedown(function(){$(this).css({marginTop:1,marginLeft:1})}).mouseup(function(){$(this).css({marginTop:0,marginLeft:0})})}if(l){n.css({borderTop:"5px solid rgb(27,51,95)",backgroundColor:"rgb(11,32,89)"}).find("div").css({left:0}),l.setLabelFont(16*ratio.ratioY+'px "苹方 粗体"'),l.setLabelColor("rgb(7,192,255)");var a=l.getItemById("confirm"),t=l.getItemById("confirmAll"),r={borderRadius:0,cursor:"pointer",boxShadow:"1px 1px 4px rgb(20,20,20)",backgroundImage:"url("+PAGEROOTDIR+"Script/image/f4button.png)",backgroundSize:"100% 100%",backgroundPosition:"center",backgroundRepeat:"no-repeat",marginLeft:-20};a&&e(a),t&&e(t)}}(),r&&$(r.getView()).css({background:"linear-gradient(to bottom, "+o.backcolor+", rgb(7, 45, 110))"}).find("div").css({cursor:"pointer"}))},a.setAreaTreeViewStyle=function(e){e.getLabelColor=function(){return"rgba(0,0,0,1)"},e.getLabelFont=function(){return 18*ratio.ratioY+'px "苹方 粗体"'},e.setSelectBackground("rgb(104,216,255)"),e.setRowHeight(36*ratio.ratioY),e.getView().style.background="#FCFCFC",e.setIndent(24*ratio.ratioX),e.setAutoHideScrollBar(!1)},e.GD=a}(window);var alarmLevelDic={},GoldenAlarm={},alarmCategoryDic={},alarmCategoryDicName={},alarmAreasDic={},alarmLevelDicName={},alarmGroupDic={},alarmGroupDicName={},dataAreaNameReal={},alarmAreaDicName={},alarmAreaDicNameId={},currentAreaName="*",audio=new Audio,alarmSystem=[],alarmAreaIds=[],alarmAreaData=[],alarmSystemObj={},allUnsureAlarm=[],alarmGroupValueReal,alarmLevelValueReal,alarmStateValueReal,alarmAreaValueReal,realdataModelReal,formRealLeft,formHisLeft,toolbar2His,toolbar2Real,alarmFilterState=!1,alarmAreaFilter=function(){return!0},isRealFirst=null,isHisFirst=null;"undefined"==typeof localStorage&&null==localStorage||(currentAreaName=null==localStorage.getItem("currentAreaName")?"*":localStorage.getItem("currentAreaName"));var alarmAreas,currentControlContent="",areaIds="",alarmInfoDialog,alarmData=[],alarmCateReal,alarmLevelArray=[],_alarmLevelArray=[],alarmLevelVisible,alarmStates=["*","未确认","已确认","未恢复","已恢复"],alarmStatesDic={"未确认":"is_ensure=0","已确认":"is_ensure=1","未恢复":"is_reset=0","已恢复":"is_reset=1"},alarmHisTableColumnDic={alarmtime:"trigger_time",area:"state1",tagName:"tag_name",isFirst:"is_first",alarmlevel:"state0",levelId:"level",ensureinfo:"is_ensure",resetinfo:"is_reset",state:"",alarmshuoming:"alarm_message",alarmGroup:"group_name",desc:"user_data0",value:"value"},dataTypes=[];dataTypes.push("*");var DataType;GoldenAlarm.getGroupsByAreaID=function(e,a,t){2===arguments.length&&"function"==typeof a&&(t=a,a=!1),t=t||function(){};var l={method:"GetGroupsByAreaID",param:{id:e,multi:!!a}};socket.alarmPost("/alarm/doservice?getGroupsByAreaId",l,function(e){if(e&&e.success){var a=e.data.data;t(a)}else t({})})};var reg=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;String.prototype.colorHex=function(){var e=this;if(/^(rgb|RGB)/.test(e)){for(var a=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),t="#",l=0;l<a.length;l++){var r=Number(a[l]).toString(16);"0"===r&&(r+=r),t+=r}return 7!==t.length&&(t=e),t}if(!reg.test(e))return e;var o=e.replace(/#/,"").split("");if(6===o.length)return e;if(3===o.length){for(var i="#",l=0;l<o.length;l+=1)i+=o[l]+o[l];return i}},String.prototype.colorRgb=function(){var e=this.toLowerCase();if(e&&reg.test(e)){if(4===e.length){for(var a="#",t=1;t<4;t+=1)a+=e.slice(t,t+1).concat(e.slice(t,t+1));e=a}for(var l=[],t=1;t<7;t+=2)l.push(parseInt("0x"+e.slice(t,t+2)));return"RGB("+l.join(",")+")"}return e};var areaIds="";ht.Default.def(DropDownBorderPane,ht.widget.BaseDropDownTemplate,{getView:function(){return this._borderPane.getView()},handleInputValueChange:function(){},initColumn:function(){},getValue:function(){var e="";return this._areatreeview.dm().sm().each(function(a){e+=a.getName()+","}),e=""!==e?e.substr(0,e.length-1):currentAreaName},onClosed:function(){},onOpened:function(e){},getHeight:function(){return 200}});var drawCell=function(e,a,t,l,r,o,i,n,s,m){var d="";a.a("ensureinfo")?a.a("resetinfo")||(d=alarmLevelDic[a.a("levelId")]&&alarmLevelDic[a.a("levelId")].ensure_color||"0"):d=a.a("resetinfo")?alarmLevelDic[a.a("levelId")]&&alarmLevelDic[a.a("levelId")].reset_color||"0":alarmLevelDic[a.a("levelId")]&&alarmLevelDic[a.a("levelId")].alarm_color||"0";var u=ARGB2HexString(d);a.a("isFirst")&&(u="rgb(239,55,68)");var g=m.fontsize*ratio.ratioY+"px "+m.fontfamily,c=GD.measureCanvasText(t,g);c>r.getWidth()&&r.setWidth(c),ht.Default.drawText(e,t,g,u,o,i,n,s,"center")},alarmTimer;Array.prototype.removeArr=function(e){return!(isNaN(e)||e>=this.length)&&this.splice(e,1)};