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;r0)for(var a=0;a0||(alarmAreaDicName[e[a].area_name]=e[a].id)}function getAreaDic(e){if(e.length>0)for(var a=0;at)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;s0)for(var l=0;l0&&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=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=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)>",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=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;n1e3?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')[0];document.body.appendChild(P);var D=$('')[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)>",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;R0?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;a1&&(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)>",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;tl.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="

待确认故障"+l+"

  设备名称:"+o+"

  故障名称:"+n+"

  故障时间:"+i+"

",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:"

"+e+"

",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;a0&&(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;o0?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;rr.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)};