1 |
- function setNumberControl(e,t,a,n,o,i,l,r){isdowncontrol()&&("True"==isAuthEnable&&r>=0?getAuthInfoByGroupId(r,function(s){s&&showDialog(e,t,a,n,o,i,l,r)}):showDialog(e,t,a,n,o,i,l,r))}function showDialog(e,t,a,n,o,i,l,r){var s=$(window).width(),c=$(window).height();t+=40,(e+=40)+290>s&&(e-=380),t+190>c&&(t-=280);var d='<div style="text-align: center;"><label style="font-size: 18px; font-weight: 600;">'+l+':</label><input focus type="number" style="height: 36px; font-size: 16px; width: 140px;" id="isetnumber" /></div>';GD.createMessageDialog(300,200,d,function(){var e=$("#isetnumber").val();1==checkNumber(e)&&e.length>0?e-0>o-0?GD.createErrorDialog(300,200,"设定值不能高于上限值!"):e-0<i-0?GD.createErrorDialog(300,200,"设定值不能低于下限值!"):submitAddSingle(a,e,"",n,l+" "+e,r):$("#isetnumber").val("")},function(){},null,null," ",e,t),$("#isetnumber").focus()}function setPageDialogControl(e,t,a,n,o,i,l,r,s){var c=browserSize.width,d=browserSize.height,g=c/backSize.width,u=d/backSize.height,p=GD.getParams("trendtags")||{},h="",b=(GD.getSearchObjFromUrl(o)||{}).tagName||"";if(-1!==(p=p.trendTags||[]).indexOf(b)&&p.splice(p.indexOf(b),1),p.length>0&&(h=","+p.join(",")),n>d&&(i="false"),l){a>c&&(a=document.body.clientWidth),r&&(a=c,e=0),s&&(n=d,t=0);var f={titleAlign:"left",closable:!0,maximizable:!0,draggable:!0,width:a,height:n,content:w="<iframe src='"+(o=PAGEROOTDIR+o+h)+"' name='' width='100%' height='100%' scrolling='no' frameborder='0'></iframe>"};"true"==i?openPageDialog.setConfig(f):f.position={x:e,y:t},openPageDialog.setConfig(f),openPageDialog.setModal(!1),openPageDialog.show()}else{var m=e+.5*a,v=t+.5*n;a*=g,n*=u,m*=g,v*=u,r&&(m=.5*(a=c)),s&&(v=.5*(n=d)),"true"===i&&(m=.5*c,v=.5*d);var w="<iframe src='"+(o=PAGEROOTDIR+o+h)+"' name='' width='"+a+"' height='"+n+"' scrolling='no' frameborder='0'></iframe>";(openPageDialog=new ht.HtmlNode).setPosition(m,v),openPageDialog.setSize(a,n),openPageDialog.setHtml(w),dataModel.add(openPageDialog)}openPageDialog.onHidden=function(e){GD.removeParams("trendtags")},$(".main").off("click").on("click",function(){"function"==typeof openPageDialog.hide&&openPageDialog.hide(!0),setTimeout(function(){p.push(b),p=GD.removeRepeated(p),GD.setParams({trendTags:p},"trendtags")},500)})}function closePageDialogControl(){"function"==typeof openPageDialog.isShowing?openPageDialog.isShowing()&&openPageDialog.hide():dataModel.remove(openPageDialog)}function initData(e,t,a,n){var o=[n],i={position:16,names:[a],rotation:Math.PI,keepOrien:!0,offsetX:-60,offsetY:5},l={position:19,names:o,keepOrien:!0,offsetX:10,offsetY:-5};"start"==t&&(l={}),"end"==t&&(i={}),"no"==t&&(i={},l={}),e.s({icons:{fromArrow:i,toArrow:l}})}function createMessageDialog(e,t,a,n,o){var i=new ht.widget.Dialog,a='<p class="dialog-content-custom">'+a+"</p>";i.setConfig({title:"提示",titleIcon:"node_image",titleAlign:"left",closable:!0,draggable:!0,width:e,height:t,content:a,contentPadding:20,buttons:[{label:"确认",className:"dialog-button-confirm"},{label:"取消",className:"dialog-button-cancel"}],buttonsAlign:"center",action:function(e,t){"确认"==e.label?(n(),i.hide()):(o(),i.hide())}}),i.setModal(!1),i.show()}function getChartLineFeed(e,t,a,n,o,i,l){if(!t||0==t.length)return!1;if(isNaN(n))return!1;a||(a=12),isNaN(o)&&(o=80),isNaN(i)&&(i=80),l||(l="\n");var r=parseInt(n)-(parseInt(o)+parseInt(i)),s=t.length,c=Math.floor(r/s),d=Math.floor(c/a);d>3?d-=2:d<=3&&d>=2&&(d-=1);var g="",u="",p=Math.ceil(e.length/d);if(p>1)for(var h=1;h<=p;h++)if(1==h)g+=e.substring(0,d)+l,u=e.substring(d);else{var b=d;u.length>d?(g+=u.substring(0,b)+l,u=u.substring(b)):u.length>0&&(g+=u.substring(0))}else g=e;return g}function vectorMoveRotate(e,t,a,n,o,i,l,r){var s=t,c=a;n&&(s+=e.getPosition().x),o&&(c+=e.getPosition().y),"Horizontal"==r&&(s=(s=s>=l?l:s)<=i?i:s),"Vertical"==r&&(c=(c=c>=l?l:c)<=i?i:c),e.setPosition(s,c)}function createTagProperty(e,t,a,n){var o=new ht.widget.Dialog,i=e[t.toLowerCase()],l="",r={title:"属性",titleAlign:"left",closable:!0,draggable:!0,width:a,height:n,content:l=void 0===i?"<p style='color:cadetblue;font-size:15px'>标签名称:"+t+"<br/>描述:<br/>单位:<br/>量程上限:<br/>量程下限:<br/>快照时间:</p>":"<p style='color:cadetblue;font-size:15px'>标签名称:"+i.TableDotTag+"<br/>描述:"+i.Desc+"<br/>单位:"+i.Unit+"<br/>量程上限:"+i.HighLimit+"<br/>量程下限:"+i.LowLimit+"<br/>快照时间:"+VarSnapshotTime[t.toLowerCase()]+"</p>",contentPadding:0};o.setConfig(r),o.setModal(!1),o.show();var s=setInterval(function(){if(void 0!==i){var e="<p style='color:cadetblue;font-size:15px'>标签名称:"+i.TableDotTag+"<br/>描述:"+i.Desc+"<br/>单位:"+i.Unit+"<br/>量程上限:"+i.HighLimit+"<br/>量程下限:"+i.LowLimit+"<br/>快照时间:"+VarSnapshotTime[t.toLowerCase()]+"</p>";r.content=e,o.isShowing()&&(o.setConfig(r),o.setModal(!1))}},2e3);o.onHidden=function(){o.hide(),clearInterval(s)}}function PointSelectDialog(e,t,a,n,o,i,l){var r=new ht.widget.FormPane,s=new ht.DataModel,c=new ht.widget.TablePane(s),d=[{name:"id",displayName:"Id",align:"center",width:50},{name:"configPointDesc",displayName:"描述",align:"center",accessType:"attr",width:200},{name:"configPointName",displayName:"标签名",align:"center",accessType:"attr",width:250}];c.addColumns(d);var g=c.getTableView();g.setCheckMode(!0);var u=1;document.body.appendChild(r.getView()),r.addRow(["表名称:",{id:"tablename",textField:{text:"*"}},"标签点描述:",{id:"pointDesc",textField:{text:"*"}},{button:{label:"查找",onClicked:function(){s.clear();var e=r.v("pointDesc"),t=r.v("tablename");u=1,r.v("pageindex",u.toString()),getPointsSelect(u,100,t,e,s,r)}}}],[.12,.3,.2,.3,.3]),r.addRow([c],[.1],.1),r.addRow([{button:{label:"<<",onClicked:function(){s.clear(),u=1,r.v("pageindex",u.toString());var e=r.v("pointDesc"),t=r.v("tablename");getPointsSelect(u,100,t,e,s,r)}}},{button:{label:"<",onClicked:function(){s.clear(),u>1&&(u-=1),r.v("pageindex",u.toString());var e=r.v("pointDesc"),t=r.v("tablename");getPointsSelect(u,100,t,e,s,r)}}},{id:"pageindex",element:u.toString()},{element:"/"},{id:"pagecount",element:"1"},{button:{label:">",onClicked:function(){s.clear(),u<r.v("pagecount")&&(u+=1),r.v("pageindex",u.toString());var e=r.v("pointDesc"),t=r.v("tablename");getPointsSelect(u,100,t,e,s,r)}}},{button:{label:">>",onClicked:function(){s.clear(),u=r.v("pagecount"),r.v("pageindex",u.toString());var e=r.v("pointDesc"),t=r.v("tablename");getPointsSelect(u,100,t,e,s,r)}}}],[.05,.05,.02,.02,.02,.05,.05]),getPointsSelect(u,100,"*","*",s,r),r.getView().style.background=a;var p=new ht.widget.Dialog,h={title:"标签点选择",titleAlign:"left",closable:!0,draggable:!0,contentPadding:5,width:e,height:t,content:r,buttons:[{label:"确认",className:"button-yes"},{label:"取消",className:"button-yes"}],buttonsAlign:"center",action:function(e,t){if("确认"==e.label){var a=g.sm()._map;for(var r in a){var s=a[r],c=new ht.Data;c.a("index",n._datas._as.length+1),c.a("configPointDesc",s.a("configPointDesc")),c.a("configPointName",s.a("configPointName")),c.a("pintunit",s.a("pintunit")),c.a("pointtype",s.a("pointtype")),c.a("snapvalue",""),c.a("timestamp",""),n.add(c)}GetModelByPage(1,l,n,o,i),p.hide()}else p.hide()}};p.setConfig(h),p.setModal(!1),p.show()}function PointSnapPropsTable(e,t,a,n,o){var i=new ht.widget.FormPane,l=new ht.widget.TablePane(o),r=[{name:"index",displayName:"ID",align:"center",accessType:"attr",width:50},{name:"configPointName",displayName:"标签名",align:"center",accessType:"attr",width:250},{name:"configPointDesc",displayName:"描述",align:"center",accessType:"attr",width:200},{name:"snapvalue",displayName:"值",align:"center",accessType:"attr",width:200},{name:"pintunit",displayName:"工程单位",align:"center",accessType:"attr",width:100},{name:"timestamp",displayName:"时间戳",align:"center",accessType:"attr",width:150},{name:"pointtype",displayName:"数值类型",align:"center",accessType:"attr",width:100}];l.addColumns(r);var s=1;document.body.appendChild(i.getView()),i.addRow(["",{button:{label:"追加",onClicked:function(){var e=parseInt(c.getValue());PointSelectDialog(600,500,"rgba(240,248,255,1)",n,o,i,e)}}},{button:{label:"选择文件",width:64,onClicked:function(){var e=document.createElement("input");e.type="file",e.style.display="none",e.onchange=function(){n.clear(),o.clear();var t=e.files[0],a=new FileReader;a.readAsText(t),a.onload=function(){var e,t=this.result;if(t.length>=0){e=t.split("\n");for(var a=1;a<e.length-1;a++){var l=e[a].split(","),r=new ht.Data;r.a("index",l[0]),r.a("configPointDesc",l[2]),r.a("configPointName",l[1]),r.a("pintunit",l[4]),r.a("pointtype",l[6]),r.a("snapvalue",l[3]),r.a("timestamp",l[5]),n.add(r)}i.v("pageindex","1"),GetModelByPage(1,parseInt(c.getValue()),n,o,i)}}},document.body.appendChild(e),e.click()}}},{button:{label:"清除选择",onClicked:function(){i.v("pagecount","1"),i.v("pageindex","1"),n.clear(),o.clear()}}}],[.6,.05,.05,.05]),i.addRow([l],[.1],.1);var c=new ht.widget.ComboBox;return c.setValues([10,20,30,50,100,200,300,400,500]),c.setValue(50),c.setEditable(!0),c.setDropDownWidth(140),c.onValueChanged=function(){i.v("pageindex","1"),GetModelByPage(1,parseInt(c.getValue()),n,o,i)},i.addRow(["",{button:{label:"<<",onClicked:function(){s=1,i.v("pageindex",s.toString());var e=parseInt(c.getValue());GetModelByPage(s,e,n,o,i)}}},{button:{label:"<",onClicked:function(){(s=i.v("pageindex"))>1&&(s-=1),i.v("pageindex",s.toString());var e=parseInt(c.getValue());GetModelByPage(s,e,n,o,i)}}},{id:"pageindex",element:s.toString()},{element:"/"},{id:"pagecount",element:"1"},{button:{label:">",onClicked:function(){(s=parseInt(i.v("pageindex")))<i.v("pagecount")&&(s+=1),i.v("pageindex",s.toString());var e=parseInt(c.getValue());GetModelByPage(s,e,n,o,i)}}},{button:{label:">>",onClicked:function(){0==(s=i.v("pagecount"))?s=1:i.v("pagecount","1"),i.v("pageindex",s.toString());var e=parseInt(c.getValue());GetModelByPage(s,e,n,o,i)}}},"rows:",{element:c},{button:{label:"导出",onClicked:function(){var e=["ID","标签点","描述","值","工程单位","时间戳","数值类型"],t=["index","configPointName","configPointDesc","snapvalue","pintunit","timestamp","pointtype"],a=[],o=n._datas._as;if(0==o.length);else for(var i=0;i<o.length;i++){var l=o[i].a("configPointName"),r={index:o[i].a("index"),configPointName:l,configPointDesc:o[i].a("configPointDesc"),snapvalue:getVarValue(l),pintunit:o[i].a("pintunit"),timestamp:VarSnapshotTime[l.toLowerCase()],pointtype:o[i].a("pointtype")};a.push(r)}var s={title:e,titleForKey:t,data:a};exportCsv(s)}}},""],[.3,.1,.1,.04,.02,.04,.1,.1,.05,.1,.1,.3]),i.getView().style.background=a,i}function GetModelByPage(e,t,a,n,o){var i=a._datas._as.length,l=1;0==(l=i%t==0?i/t:Math.ceil(i/t))&&(l=1),o.v("pagecount",l.toString()),n.clear();for(var r=(e-1)*t,s=a._datas._as,c=r;c<r+t;c++){var d=new ht.Data;d.a("index",n._datas._as.length+1),d.a("configPointDesc",s[c].a("configPointDesc")),d.a("configPointName",s[c].a("configPointName")),d.a("pintunit",s[c].a("pintunit")),d.a("pointtype",s[c].a("pointtype")),d.a("snapvalue",""),d.a("timestamp",""),n.add(d)}}function DirectPointDialogShow(e,t){var a=new ht.widget.FormPane,n=new ht.DataModel,o=new ht.widget.TablePane(n),i=[{name:"id",displayName:"Id",align:"center",width:50},{name:"configPointDesc",displayName:"描述",align:"center",accessType:"attr",width:200},{name:"configPointName",displayName:"标签名",align:"center",accessType:"attr",width:250}];o.addColumns(i);var l=o.getTableView();l.setCheckMode(!0);var r=1;document.body.appendChild(a.getView()),a.addRow(["表名称:",{id:"tablename",textField:{text:"*"}},"标签点描述:",{id:"pointDesc",textField:{text:"*"}},{button:{label:"查找",onClicked:function(){n.clear();var e=a.v("pointDesc"),t=a.v("tablename");r=1,a.v("pageindex",r.toString()),getPointsSelect(r,100,t,e,n,a)}}}],[.12,.3,.2,.3,.3]),a.addRow([o],[.1],.1),a.addRow([{button:{label:"<<",onClicked:function(){n.clear(),r=1,a.v("pageindex",r.toString());var e=a.v("pointDesc"),t=a.v("tablename");getPointsSelect(r,100,t,e,n,a)}}},{button:{label:"<",onClicked:function(){n.clear(),r>1&&(r-=1),a.v("pageindex",r.toString());var e=a.v("pointDesc"),t=a.v("tablename");getPointsSelect(r,100,t,e,n,a)}}},{id:"pageindex",element:r.toString()},{element:"/"},{id:"pagecount",element:"1"},{button:{label:">",onClicked:function(){n.clear(),r<a.v("pagecount")&&(r+=1),a.v("pageindex",r.toString());var e=a.v("pointDesc"),t=a.v("tablename");getPointsSelect(r,100,t,e,n,a)}}},{button:{label:">>",onClicked:function(){n.clear(),r=a.v("pagecount"),a.v("pageindex",r.toString());var e=a.v("pointDesc"),t=a.v("tablename");getPointsSelect(r,100,t,e,n,a)}}}],[.05,.05,.02,.02,.02,.05,.05]),getPointsSelect(r,100,"*","*",n,a),a.getView().style.background="rgba(240,248,255,1)";var s=new ht.widget.Dialog,c={title:"标签点选择",titleAlign:"left",closable:!0,draggable:!0,contentPadding:5,width:600,height:500,content:a,buttons:[{label:"确认",className:"button-yes"},{label:"取消",className:"button-yes"}],buttonsAlign:"center",action:function(a,n){if("确认"==a.label){var o=l.sm()._map,i="";for(var r in o)i=i+(o[r].a("configPointName")+":"+o[r].a("configPointDesc")+":true")+",";","==i[i.length-1]&&(i=i.substring(0,i.length-1)),e.setName(i),t(),s.hide()}else s.hide()}};s.setConfig(c),s.setModal(!1),s.show()}function createBaseTable(e,t,a,n,o,i,l,r,s,c,d,g,u,p){var h=createTableAttr(a,n,o,i,l,r,s,c,d,g,u,p);return setTableStyle(e,h),e}function createTableByObj(e,t){return setTableStyle(e,t),e}function getTagInfos(e,t){var a="",n=e.split(","),o=t.split(",");if(n.length>0){for(var i=0;i<o.length;i++)if(o[i].split(":").length>=1)for(l=0;l<n.length;l++)n[l].split(":").length>=1&&(a+=o[i].split(":")[0]+n[l].split(":")[0]+",")}else for(var l=0;l<o.length;l++)o[l].split(":").length>=1&&(a+=o[l].split(":")[0]+",");return","==a[a.length-1]&&(a=a.substr(0,a.length-1)),a}function getColumnsInfo(e,t,a,n){var o=[];n?(o.push({name:"time",displayName:a,accessType:"attr",align:"center",width:100}),""!=e&&o.push({name:"shebei",displayName:"设备",accessType:"attr",align:"center",width:100})):o.push({name:"title",displayName:a,accessType:"attr",align:"center",width:100}),""==e&&(e=t);var i=e.split(",");if(i.length>0)for(var l=0;l<i.length;l++){var r=i[l].split(":");r.length>=2&&"true"==r[2]&&o.push({name:r[0],displayName:r[1],accessType:"attr",align:"center",width:100})}return o}function getColumnsOrRowInfo(e,t){var a=e._datas._as,n=t._datas._as,o="";if(a.length>0)for(var i=0;i<a.length;i++)o=o+(r=a[i]).a("name")+":"+r.a("desc")+":true,";if(n.length>0)for(var l=0;l<n.length;l++){var r=n[l];o=o+r.a("name")+":"+r.a("desc")+":false,"}return o=o.substr(0,o.length-1)}function getCellsStr(e,t){var a=[],n=[],o=e.split(",");if(o.length>0)for(r=0;r<o.length;r++){var i=o[r].split(":");"true"==i[2]&&n.push(i[0])}var l=t.split(",");if(l.length>0)for(var r=0;r<l.length;r++){var s=l[r].split(":")[0],c=l[r].split(":")[2];if(void 0!=typeof s&&"true"==c){var d={};d.tagFirstHalf=s,d.title=l[r].split(":")[1];for(var g=0;g<n.length;g++)d[n[g]]=getVarValue(s+n[g]);a.push(d)}}return a}function tableDataInit(e,t,a,n,o,i){e.getColumnModel().clear(),n.clear();var l=getColumnsInfo(t,o);e.addColumns(l);var r=getCellsStr(t,a);if(i){var s=e.getTableView();s.setCheckMode(!0),s.getCheckColumn().setWidth(100)}for(var c=0;c<r.length;c++){var d=new ht.Data;d.a(r[c]),d.setId(c),n.add(d)}}function tableHisDataInit(e,t,a,n,o){e.getColumnModel().clear(),n.clear();var i=getColumnsInfo(t,a,o,!0);e.addColumns(i)}function tableRefresh(e,t,a){for(var n=getCellsStr(t,a),o=0;o<n.length;o++)e.getDataById(o).a(n[o])}function getIndicatorArr(e){var t=[],a=e.split(",");if(a.length>=1)for(var n=0;n<a.length;n++){var o=a[n].split(":")[0];o.length>0&&t.push(o)}return t}function getHisData(e,t,a){if(a.clear(),"undefined"!=typeof start&&"undefined"!=typeof end&&"undefined"!=typeof interval){""==start&&(start=moment(new Date).format("YYYY-MM-DD H:mm:ss")),""==end&&(end=moment(new Date(start)).add(30,"seconds").format("YYYY-MM-DD H:mm:ss"));var n=getTagInfos(e,t)+"&beginTime="+start+"&endTime="+end+"&interval="+interval+"&count=0",o=getIndicatorArr(e);getTableHisData(n,a,o)}}function createTableHistory(e,t,a,n,o){t.clear();var i=getColumnsInfo(a,"time",!0),l=getTagInfos(a,n);setTableStyle(e,o),columnModel=e.getColumnModel(),e.setColumns(i);for(var r=l.split(","),s=0;s<r.length;s++){var c=new ht.Data;c.a("time",""),c.a("rowId",(s+1).toString()),t.add(c)}return e}function initFileSelector(){}function getIndicators(e,t,a){e.clear(),t.clear();var n=a.split(",");if(n.length>0)for(var o=0;o<n.length;o++){var i=n[o].split(":");if(3==i.length){var l={name:i[0],desc:i[1]},r=new ht.Data;r.a(l),"true"==i[2]?e.add(r):t.add(r)}}}function listViewInit(e){e.setRowHeight(30),e.setRowLineVisible(!0),e.setLabelColor("white"),e.setLabelFont("黑体"),e.setRowLineColor("#006666"),e.setScrollBarColor("#27C5DB"),e.getIcon=function(e){return"productIcon"},e.drawRowBackground=function(e,t,a,n,o,i,l){e.fillStyle="rgb(8,44,50)",e.beginPath(),e.rect(n,o,i,l),e.fill()},e.getLabel=function(e){return e.a("desc")}}function createSelectDialog(e,t,a,n,o){function i(e,t){for(var a,n,o,i,l,r=e._rows||[],s=0,c=r.length;s<c;s++)for(var d=0,g=(n=(a=r[s]||{}).items||[]).length;d<g;d++)if(o=n[d])switch(i=o.element||{},t){case"all":i.isSelected()||(i.setSelected(!0),i.onClicked&&i.onClicked());break;case"clear":i.isSelected()&&(i.setSelected(!1),i.onClicked&&i.onClicked());break;case"reverse":l=!i.isSelected(),i.setSelected(l),i.onClicked&&i.onClicked()}}function l(e){i(e,"reverse")}function r(e){i(e,"clear")}t.isShowing()&&t.hide(),o=o||1e6;var s=new ht.widget.BorderPane,c=e.getDatas()._as,d=[];!function(){for(var e,t=0,a=c.length;t<a;t++)(e=c[t]).a("isFrozenColumn")||d.push(e)}();var g=d.length,u=new ht.widget.FormPane,p=new ht.widget.FormPane,h=4,b=0,f=u.setValue,m=u.getValue;s.getView().style.background=n.paneBackColor,$count=$('<span class="top-count">已选指标(<strong>6</strong>)项</span>'),$count.setValue=function(e){$count.find("strong").text(e)},$count.getValue=function(){return $count.find("strong").text()},u.setValue=function(e,t){"indicatorCount"===e?$count.setValue(t):f.call(u,e,t)},u.getValue=function(e){return"indicatorCount"===e?$count.getValue():m.cal(u,e)},u.addRow([{element:$('<span class="top-title">功能列表:</span>')[0]},{id:"selectall",button:{label:"全选",labelColor:void 0===n?"black":n.btnFontColor,borderColor:"transparent",labelFont:'bold 14px "苹方 粗体"',background:"rgba(0,0,0,0)",icon:PAGEROOTDIR+"script/image/noselected.png",selectBackground:"rgba(0,0,0,0)",onClicked:function(){i(p,"all"),u.getItemById("multiple").element.setIcon(PAGEROOTDIR+"script/image/noselected.png"),u.getItemById("clear").element.setIcon(PAGEROOTDIR+"script/image/noselected.png"),this.setIcon(PAGEROOTDIR+"script/image/selected.png")}}},{id:"multiple",button:{label:"反选",borderColor:"transparent",labelFont:'bold 14px "苹方 粗体"',labelColor:n.btnFontColor,background:"rgba(0,0,0,0)",icon:PAGEROOTDIR+"script/image/noselected.png",selectBackground:"rgba(0,0,0,0)",onClicked:function(){l(p),u.getItemById("selectall").element.setIcon(PAGEROOTDIR+"script/image/noselected.png"),u.getItemById("clear").element.setIcon(PAGEROOTDIR+"script/image/noselected.png"),this.setIcon(PAGEROOTDIR+"script/image/selected.png")}}},{id:"clear",button:{label:"清除",labelColor:n.btnFontColor,borderColor:"transparent",labelFont:'bold 14px "苹方 粗体"',background:"rgba(0,0,0,0)",icon:PAGEROOTDIR+"script/image/noselected.png",selectBackground:"rgba(0,0,0,0)",onClicked:function(){r(p),u.getItemById("selectall").element.setIcon(PAGEROOTDIR+"script/image/noselected.png"),u.getItemById("multiple").element.setIcon(PAGEROOTDIR+"script/image/noselected.png"),this.setIcon(PAGEROOTDIR+"script/image/selected.png")}}},null,{element:$count[0]}],[.1,.1,.1,.1,.4,.2],20,{index:1});for(var v=0,w=d.length;v<w;v++){var C=d[v].a("displayName")&&GD.getStrLength(d[v].a("displayName"));b=C>b?C:b}for(var y=0,h=Math.floor(860/(5*b+50)),k=Math.ceil(d.length/h),B=0;B<k;B++){for(var S=[],x=[],D=B*h;D<(B+1)*h;D++)D<d.length?(S.push({id:d[D].a("name"),element:createButton(d[D].a("displayName"),d[D].a("visible"),u,n,o)}),d[D].a("visible")&&(y+=1),x.push(.1)):(S.push(null),x.push(.1));p.addRow(S,x,30,{index:B+2}),$count.setValue(y)}s.setTopView(u,50),s.setCenterView(p),s.setBottomView($('<div"></div>')[0],9),t.setConfig({title:"设置名称",titleBackground:n.paneTitleBackColor,titleIcon:"",titleColor:n.paneTitleFontColor,closable:!0,draggable:!0,maximizable:!1,width:860,height:460,content:s,buttonsAlign:"left",buttons:[{label:"确认",className:"dialog-confirm",action:function(e,n){for(s=0;s<g;s++){var o=d[s].a("name");p.getItemById(o).element.isSelected()?d[s].a("visible",!0):d[s].a("visible",!1)}for(var i,l,r=p._rows,s=0,c=r.length;s<c;s++)for(var u=0,h=(i=(l=r[s]).items||[]).length;u<h;u++);t.hide(),a()}},{label:"取消",width:50,height:30,className:"dialog-cancel",action:function(e,a){t.hide()}}]}),function(){var e=$(u.getView()),a=$(p.getView()),o=$(t.getView()),i=$(s.getView());o.find(".dialog-container").css({padding:0,border:"1px solid rgb(31,90,150)",borderRadius:4,padding:"5px 20px"}).find(".dialog-content").css({overflow:"visible"}),e.css({border:"1px solid rgb(31,90,150)",boxShadow:"0 2px 6px rgb(1,8,24)",borderRadius:4,overflow:"visible",backgroundColor:"rgb(7,45,118)",minWidth:860,marginLeft:-22,marginTop:10,maxHeight:40}).addClass("pane-topview").find("div").css({cursor:"pointer"}).end().parent().css({overflow:"visible"}).find(".top-title").css({fontFamily:"苹方 粗体",fontSize:14,color:"rgb(18,203,249)",fontWeight:600,lineHeight:"25px",textAlign:"center"}),$count.css({fontFamily:"苹方 粗体",fontSize:14,color:"rgb(18,203,249)",fontWeight:600,lineHeight:"25px",paddingLeft:30}),i.css({}),a.css({backgroundColor:"rgb(5,32,87)",boxShadow:"0 0 8px rgb(4,4,4) inset",borderRadius:2,height:310}).addClass("pane-container"),o.find(".dialog-container-buttons").css({backgroundColor:n.paneBackColor,textAlign:"right"}).find(".dialog-button").css({backgroundColor:n.btnBackColor,width:100,height:30,marginRight:20,marginBottom:2,position:"relative",cursor:"pointer",color:"rgb(255,255,255)",borderRadius:2,boxShadow:"1px 1px 4px #000",fontFamily:"苹方 粗体",fontWeight:600,fontSize:14}).hover(function(){$(this).css({color:"rgb(255,255,255)",boxShadow:"0 0 8px rgb(66,160,194)"})},function(){$(this).css({color:"rgb(255,255,255)",boxShadow:"1px 1px 4px #000"})}).end().find(".dialog-confirm").css({}).prepend('<span style="position: absolute; line-height: 30px; width: 100px; text-align: center;">确认</span>').end().find(".dialog-cancel").css({}).prepend('<span style="position: absolute; line-height: 30px; width: 100px; text-align: center;">取消</span>').end().find("canvas").css({visibility:"hidden"})}(),t.setModal(!0),$(t.getView()).find(".dialog-overlay").css({backgroundColor:"rgba(20,20,20,0.6)"}),t.show()}function createHistorySelectDialog(e,t,a,n,o,i,l,r){function s(e,t){e.each(function(e){if("time"!=e.a("name")&&"device"!=e.a("name")){var a={};a.name=e.a("name"),a.displayName=e.a("displayName"),a.visible=e.a("visible"),a.Low=e.a("Low"),a.High=e.a("High"),a.width=e.a("width"),a.color=e.a("color"),e.a("position")&&(a.position=e.a("position")),t.push(a)}})}function c(e,t,a,n,o){for(var i,l=0,r=$(e.getView()).width(),s=0,c=t.length;s<c;s++)l=(i=t[s].displayName&&GD.getStrLength(t[s].displayName))>l?i:l;a=Math.floor(r/(5*l+50));var d=Math.ceil(t.length/a);e.clear();for(s=0;s<d;s++){for(var g,p=[],h=[],b=s*a;b<(s+1)*a;b++)t[b]?(t[b].buttonType=n,g=u(t[b],n,o),p.push(g),h.push(.1)):(p.push(null),h.push(.1));e.addRow(p,h,30)}}function d(e,t,a){a=a||F;if(!e)return[];for(var n=0,o=t.length;n<o;n++){var i=t[n];if(i.isSelected){var l={};l.name="device"===e.type?e.name+i.name:i.name+e.name,l.isSelected=!0,l.displayName="device"===e.type?e.displayName+" "+i.displayName:i.displayName+" "+e.displayName,l.visible=!0,l.deviceName="device"===e.type?e.name:i.name,l.indicatorName="device"===e.type?i.name:e.name,l.Low="device"===e.type?i.Low:e.Low,l.High="device"===e.type?i.High:e.High,l.width="device"===e.type?i.width:e.width,l.color=i.color||e.color,l.position=i.position||e.position,i.inArr=i.inArr||[],e.isSelected?(i.inArr.push(e),a.push(l)):(h(i.inArr,e),h(a,l))}}p(a),Y.find("strong").text(a.length)}function g(){this.isSelected();for(var e,t,a=$.trim(this.getLabel()),n=0,o=F.length;n<o;n++)if(F[n].displayName===a){e=F[n],F.splice(n,1);break}for(var i=0,l=R.length;i<l;i++)if(R[i].name===e.indicatorName){R[i].isSelected=!1,t=R[i];break}for(var r=0,s=L.length;r<s;r++)L[r].name===e.deviceName&&L[r].inArr&&L[r].inArr.length>0&&h(L[r].inArr,t);b(M,L),b(H,R),c(O,F,8,"tagButton",g),Y.find("strong").text(F.length)}function u(e,t,a){var n=new ht.widget.Button,o=$(n.getView()),i=e.displayName,l=e.visible,r=e.name;n.setLabel(i),n.setTogglable(!0),n.setWidth(100),n.setHeight(40),o.addClass("history-button"),o.prepend('<div class="button-icon"></div>'),n.__id=r;var s,c,d,g;switch(t){case"tagButton":s=P.tagBtnBackColor,c=P.tagBtnBackColor,d=P.tagBtnBorderColor,g=null,n.setSelected(!0),n.setLabelSelectColor(P.tagBtnFontColor),n.setClickable(!1);break;case"deviceButton":s=P.btnBackColor,c=P.btnCheckedBackColor,d=P.btnBorderColor,g=null;break;case"indicatorButton":s=P.btnBackColor,c=P.btnCheckedBackColor,d=P.btnBorderColor,g=E.indicatorButton}return l?(n.setSelected(!0),n.setSelectBackground(c),n.setLabelSelectColor(P.btnCheckedFontColor),n.setBorderColor(d),g?(n.setIcon(imagePath+g),n.setLabel(" "+i)):(n.setIcon(null),n.setLabel(i))):(n.setSelected(!1),n.setIcon(null),n.setLabel(i),n.setBackground(s),n.setLabelColor(P.btnFontColor),n.setBorderColor(d)),n.onClicked=function(e){a.call(this,e)},"tagButton"===t&&(n.setLabel(i+" "),$(n.getView()).find(".button-icon").off("click").on("click",function(e){a.call(n,e)})),A[r]=n,n}function p(e){if(e){for(var t,a={},n=[],o=0,i=e.length;o<i;o++)a[(t=e[o]).displayName]||(a[t.displayName]=!0,n.push(t));for(e.length=0,o=0,i=n.length;o<i;o++)e[o]=n[o];return n}}function h(e,t){for(var a,n=[],o=0,i=e.length;o<i;o++)a=e[o],$.trim(a.displayName)!=$.trim(t.displayName)&&n.push(a);for(e.length=0,o=0,i=n.length;o<i;o++)e[o]=n[o]}function b(e,t){for(var a,n,o,i,l=0,r=t.length;l<r;l++)(o=A[t[l].name])&&(i=t[l].buttonType,t[l].isSelected?(a=!0,n=imagePath+E[i],"deviceButton"===i&&(n=null)):(a=!1,n=null),o.setSelected(a),o.setIcon(n))}function f(e,t){for(var a,n=0,o=t.length;n<o;n++)(a=A[t[n].name])&&(a.setSelected(!1),a.setIcon(null))}function m(e){if(F.length<=0)return alert("请先选择测点指标!");for(var t,a,n="",o=[],i=0,l=F.length;i<l;i++){a=F[i],t=[];for(var r in a)a.hasOwnProperty(r)&&(t.push(a[r]),0===i&&o.push(r));n+=t.join(",")+"\r\n"}n="\ufeff"+o.join(",")+"\r\n"+n;var s=new Blob([n],{type:"text/csv;charset=UTF-8"});saveAs(s,"data"+Date.now()+".csv")}function v(e){var t=$('<input type="file" accept=".csv" id="fileInput">');$(window.body).append(t),t.trigger("click"),t.change(function(e){for(var t=e.target.files,a=0,n=t.length;a<n;a++){var o=t[a];if(o&&o.type.match("application/vnd.ms-excel")){var i=new FileReader;i.onload=function(e){var t=w(e.target.result);Papa.parse(o,{encoding:t,complete:function(e){var t=e.data;""==t[t.length-1]&&t.pop(),C(t)}})},i.readAsDataURL(o)}else alert("不支持的文件格式!")}})}function w(e){var t=atob(e.split(";base64,")[1]),a=jschardet.detect(t);return"windows-1252"==(a=a.encoding)&&(a="ANSI"),a}function C(e){try{F=[];for(var t=e[0],a=1,n=e.length;a<n;a++){var o={};if(e[a]){for(var i=e[a],l=0,r=i.length;l<r;l++){var s=i[l];"true"===s.toLowerCase()?s=!0:"false"===s.toLowerCase()&&(s=!1),o[$.trim(t[l])]=s}o.isSelected&&F.push(o)}}p(F),c(O,F,8,"tagButton",g)}catch(e){alert("导入的文件格式错误,请重新编辑后导入!"),console.log(e)}}function y(){a.clear();for(var e=0,t=F.length;e<t;e++){var o=new ht.Data,l=F[e];o.a("displayName",l.displayName),o.a("name",l.name),o.a("visible",l.visible),o.a("Low",l.Low),o.a("High",l.High),o.a("width",l.width),o.a("position",l.position),o.a("color",l.color),o.setName(l.name),o.setDisplayName(l.displayName),o.setTag(l.name),a.add(o)}n.hide(),i("search")}function k(){a.clear();for(var e=0,t=F.length;e<t;e++){var o=new ht.Data,l=F[e];o.a("displayName",l.displayName),o.a("name",l.name),o.a("visible",l.visible),o.setName(l.name),o.setDisplayName(l.displayName),o.setTag(l.name),a.add(o)}n.hide(),i("export")}function B(){n.hide()}function S(e,t){for(var a,n,o,i,l=e._rows,r=0,s=l.length;r<s;r++)if((a=l[r]).items)for(var c=0,d=(n=a.items).length;c<d;c++)if(o=n[c],(i=o&&o.element)&&"function"==typeof i.onClicked)switch(t){case"all":!1===i._selected&&(i._selected=!0,i.onClicked());break;case"reverse":i._selected=!i._selected,i.onClicked();break;case"clear":!0===i._selected&&(i._selected=!1,i.onClicked())}}function x(e){S(e,"clear")}function D(e){S(e,"reverse")}n.isShowing()&&n.hide(),r=r||{};var P={paneBackColor:"rgb(7,42,114)",paneTitleBackColor:"rgb(7,42,114)",paneTitleFontColor:"rgb(195,208,241)",paneTitleBtnFontColor:"rgb(156,163,172)",paneTitleBtnCheckedFontColor:"rgb(7,164,234)",btnBackColor:"rgb(7,42,114)",btnFontColor:"rgb(255,255,255)",btnBorderColor:"rgba(0,0,0,0)",btnCheckedFontColor:"rgb(255,255,255)",btnCheckedBackColor:"rgb(18,172,221)",tagBtnBackColor:"rgba(0,0,0,0)",tagBtnBorderColor:"rgba(0,0,0,0)",tagBtnFontColor:"rgb(168,193,219)",paneBorderColor:"rgb(4,94,137)",paneTopBarBackColor:"rgb(7,42,114)",paneTopBarBorderColor:"rgb(4,94,137)",paneShadowColor:"rgb(1,13,33)",formPaneBackColor:"rgb(4,33,89)",bottomButtonColor:"rgb(255,255,255)",bottomButtonHoverColor:"white",bottomButtonBackColor:"rgb(7,41,107)",bottomButtonHoverShadowColor:"rgb(36,128,172)",scrollBarColor:"rgb(18,75,147)"},I=P.paneBackColor;P.btnBackColor,P.btnFontColor;o=o<=0?20:o;var N=new ht.widget.BorderPane;N.getView().style.background=I;var T=e.getDatas()._as,V=t.getDatas()._as,L=[],R=[],F=[],A={};s(e,L),s(t,R),s(a,F);T.length,new ht.widget.FormPane;var M=new ht.widget.FormPane,H=new ht.widget.FormPane,O=new ht.widget.FormPane,G=new ht.widget.BorderPane,_=new ht.widget.BorderPane;Math.ceil(T.length/4);M.setAutoHideScrollBar(!1),H.setAutoHideScrollBar(!1),O.setAutoHideScrollBar(!1),M.setScrollBarColor(P.scrollBarColor),H.setScrollBarColor(P.scrollBarColor),O.setScrollBarColor(P.scrollBarColor);var E={tagButton:"sub.png",deviceButton:"DuiHao.png",indicatorButton:"plus.png"};Math.ceil(V.length/4);O.getView().className="bottom-pane",M.setWidth(400),H.setWidth(400),O.setWidth(840);var z=$('<div class="pane-title-container"></div>'),W=$('<div class="pane-title pane-title-left" ></div>'),Y=$('<div class="pane-title pane-title-right noselect"><span class="pull-left">功能列表:</span><ul class="pull-left"><li data-role="selectall"><a>全选</a></li><li data-role="reverseselect"><a>反选</a></li><li data-role="clearall"><a>清除</a></li></ul><div class="pull-right">已选指标( <strong>0</strong> )项</div></div>');W.css({"box-shadow":"0 2px 10px "+P.paneShadowColor}),Y.css({"box-shadow":"0 2px 10px "+P.paneShadowColor}).find("li").off("click").on("click",function(){var e=$(this),t=e.data("role");switch(Y.find("li").removeClass("active").find("a").css({color:P.paneTitleBtnFontColor}),e.addClass("active").find("a").css({color:P.paneTitleBtnCheckedFontColor}),t){case"selectall":S(H,"all");break;case"reverseselect":D(H);break;case"clearall":x(H)}}).find("a").css({color:P.paneTitleBtnFontColor}),Y.find("li.active a").css({color:P.paneTitleBtnCheckedFontColor}),z.append(W),z.append(Y),_.setTopView(z[0],35),_.setLeftView(M,430),_.setCenterView(H),G.setCenterView(O),N.setCenterView(_),N.setBottomView(G,280);var j=[{label:"取消",className:"dialog-button-cancel",action:function(e,t){}}];n.setConfig({title:"设置名称",titleBackground:P.paneTitleBackColor,titleIcon:"",titleColor:P.paneTitleFontColor,closable:!0,draggable:!0,maximizable:!1,width:860,height:600,position:{x:($(window).innerWidth()-860)/2,y:($(window).innerHeight()-600)/2},content:N,buttonsAlign:"left",buttons:j}),n.setModal(!0),$(n.getView()).find(".dialog-overlay").css({backgroundColor:"rgba(20,20,20,0.6)"}),c(M,L,4,"deviceButton",function(){var e=$.trim(this.getLabel()),t=this.isSelected();t?(this.setSelectBackground(P.btnCheckedBackColor),this.setLabelSelectColor(P.btnCheckedFontColor),this.setIcon(null),this.setLabel(e)):(this.setBackground(P.btnBackColor),this.setIcon(null),this.setLabel(e),this.setLabelColor(P.btnFontColor));for(var a,n=0,o=L.length;n<o;n++)L[n].displayName===e?(L[n].isSelected=t,a=L[n]):L[n].isSelected=!1;for(var i=0,l=R.length;i<l;i++)if(R[i].isSelected=!1,a.inArr)for(var r=0,s=a.inArr.length;r<s;r++)a.inArr[r].name===R[i].name&&(R[i].isSelected=!0);else R[i].isSelected=!1;a.type="device",f(0,R),b(0,L),t?b(0,R):(a.inArr&&(a.inArr.length=0),d(a,R,F),c(O,F,8,"tagButton",g))}),c(H,R,4,"indicatorButton",function(){var e=$.trim(this.getLabel()),t=this.isSelected();if(F.length>=o&&t)return dialogTip("已选择的指标超过"+o+"个了,最多选择"+o+"个!"),void this.setSelected(!1);t?(this.setSelectBackground(P.btnCheckedBackColor),this.setLabelSelectColor(P.btnCheckedFontColor),this.setIcon(imagePath+"plus.png"),this.setLabel(" "+e)):(this.setBackground(P.btnBackColor),this.setLabelColor(P.btnFontColor),this.setIcon(null),this.setLabel(e));for(var a={},n=0,i=R.length;n<i;n++)if(R[n].displayName===e){R[n].isSelected=t,a=R[n];break}a.type="indicator",d(a,L,F),c(O,F,8,"tagButton",g)}),c(O,F,8,"tagButton",g),function(e){var t=$(e.getView()).find(".dialog-container-buttons"),a=$('<div data-role="confirmandsearch" class="pull-left pane-bottom-btn-right"><a class="btn btn-defuault">确认并查询</a></div>'),n=$('<div data-role="confirmandexport" class="pull-left pane-bottom-btn-right"><a class="btn btn-defuault">确认并导出</a></div>'),o=$('<div data-role="cancel" class="pull-left pane-bottom-btn-right"><a class="btn btn-defuault">取消</a></div>'),i=$('<div data-role="upload" class="pull-left cursor-pointer pane-bottom-btn-left"><a>上传</a></div>'),r=$('<div data-role="download" class="pull-left cursor-pointer pane-bottom-btn-left"><a>下载</a></div>'),s=$('<div data-role="clearall" class="pull-left cursor-pointer pane-bottom-btn-left"><a>清空</a></div>'),c=$('<div class="pull-right pane-bottom-container-right"></div>'),d=$('<div class="pull-left pane-bottom-container-left"></div>');t.find(".dialog-button").remove(),c.append(a).append(n).append(o),d.append(i).append(r).append(s),t.append(c).append(d),l&&(a.find("a.btn").text("确认"),n.css("display","none"),i.css("display","none"),r.css("display","none")),t.find(".pane-bottom-btn-right").css({backgroundColor:P.bottomButtonBackColor}).hover(function(){$(this).css({}).find("a").css({color:P.bottomButtonHoverColor})},function(){$(this).css({}).find("a").css({color:P.bottomButtonColor})}).find("a").css({color:P.bottomButtonColor}),t.find(".pane-bottom-btn-left").css({}).hover(function(){$(this).css({}).find("a").css({color:P.bottomButtonHoverColor})},function(){$(this).css({}).find("a").css({color:P.bottomButtonColor})}).find("a").css({color:P.bottomButtonColor}),t.find("div div.pull-left").off("click").on("click",function(e){switch($(this).data("role")){case"confirmandsearch":y();break;case"confirmandexport":k();break;case"cancel":B(e);break;case"upload":v(e);break;case"download":m(e);break;case"clearall":x(O)}})}(n),$(M.getView()).css({backgroundColor:P.formPaneBackColor,"box-shadow":"2px 2px 5px "+P.paneShadowColor+" inset"}).addClass("pane-left"),$(H.getView()).css({backgroundColor:P.formPaneBackColor,"box-shadow":"2px 2px 5px "+P.paneShadowColor+" inset"}).addClass("pane-right"),$(O.getView()).css({backgroundColor:P.formPaneBackColor,"box-shadow":"2px 2px 5px "+P.paneShadowColor+" inset"}).addClass("pane-bottom"),$(n.getView()).find(".dialog-container").css({borderWidth:"1px",borderStyle:"solid",borderColor:P.paneBorderColor,borderRadius:"4px",zIndex:99}),n.show(),$(".dialog-container-buttons").css("background",P.paneBackColor),$(".dialog-button-confirm").css("background",P.btnBackColor)}function createchartSelectDialog(e,t,a,n){t.isShowing()&&t.hide();var o=new ht.widget.BorderPane,i=e.getDatas()._as,l=i.length,r=new ht.widget.FormPane;r.setHeight(360),r.addRow(["已选择个数:",{id:"indicatorCount",textField:{text:"0",editable:!1,width:100,border:0}},"",{button:{label:"清除",labelColor:"blue",borderColor:"transparent",background:"",onClicked:function(){for(var e=0;e<l;e++){var t=i[e].a("name");r.getItemById(t).button.setSelected(!1),r.getItemById(t).button.setBackground("rgb(255,255,255)"),r.getItemById(t).button.setIcon(null),r.getItemById(t).button.setLabel(i[e].a("displayName"))}r.setValue("indicatorCount","0")}}}],[.1,.1,.8,.05,.05,.05],25,{index:1}),r.addRow([],[.1],1.01,{background:"rgb(243,243,250)",index:2});for(var s=0,c=Math.ceil(i.length/8),d=0;d<c;d++){for(var g=[],u=[],p=8*d;p<8*(d+1);p++)p<i.length?(g.push({id:i[p].a("name"),button:function(e,t,n){var o=new ht.widget.Button;return o.setLabel(e),o.setTogglable(!0),o.setWidth(100),o.setHeight(40),t?(o.setSelected(!0),o.setSelectBackground("rgb(53,199,122)"),o.setIcon(imagePath+"DuiHao.png"),o.setLabel(" "+e)):(o.setBackground("rgb(255,255,255)"),o.setSelected(!1),o.setIcon(null),o.setLabel(e)),o.onClicked=function(){if(parseInt(n.getValue("indicatorCount"))>=5&&this.isSelected())return dialogTip("已选择的指标超过"+a+"个了,最多选择5个!"),this.setSelected(!1),this.setBackground("rgb(255,255,255)"),this.setIcon(null),this.setLabel(e),o;this.isSelected()?(n.setValue("indicatorCount",parseInt(n.getValue("indicatorCount"))+1),this.setSelectBackground("rgb(53,199,122)"),this.setIcon(imagePath+"DuiHao.png"),this.setLabel(" "+e)):(n.setValue("indicatorCount",parseInt(n.getValue("indicatorCount"))-1),this.setBackground("rgb(255,255,255)"),this.setIcon(null),this.setLabel(e))},o}(i[p].a("displayName"),i[p].a("visible"),r)}),i[p].a("visible")&&(s+=1),u.push(.1)):(g.push(null),u.push(.1));r.addRow(g,u,30,{index:d+2}),r.setValue("indicatorCount",s)}o.setTopView(r),t.setConfig({title:"设置名称",titleIcon:"",titleColor:"black",closable:!0,draggable:!0,maximizable:!1,width:860,height:460,position:{x:200,y:100},content:o,buttonsAlign:"left",buttons:[{label:"确认",className:"dialog-button-confirm",action:function(e,a){for(var o={},s=[],c="",d=0;d<l;d++){var g=i[d].a("name");r.getItemById(g).button.isSelected()?(i[d].a("visible",!0),s.push(g),o[i[d].a("name")]=i[d].a("displayName")):i[d].a("visible",!1)}t.hide();for(d=0;d<s.length;d++)c+=s[d]+",",d==s.length-1&&(c=c.substring(0,c.length-1));n(c,o)}},{label:"取消",className:"dialog-button-cancel",action:function(e,a){t.hide()}}]}),t.setModal(!1),t.show()}function dialogTip(e,t){GD.createErrorDialog(360,240,e,t)}function createButton(e,t,a,n,o){var i=new ht.widget.Button;return i.setLabel(e),i.setTogglable(!0),i.setWidth(100),i.setHeight(40),i.setLabelFont('bold 12px "苹方 粗体"'),i.setBorderColor("rgba(0,0,0,0)"),o=o||1e6,t?(i.setSelected(!0),i.setIcon(imagePath+"DuiHao.png"),i.setLabel(" "+e)):(i.setSelected(!1),i.setIcon(null),i.setLabel(e)),i.setSelectBackground(n.btnCheckedBackColor),i.setBackground(n.btnBackColor),i.setLabelSelectColor(n.btnCheckedFontColor),i.setLabelColor(n.btnFontColor),i.onClicked=function(){if(this.isSelected()){if(a.getValue("indicatorCount")>=o)return dialogTip("选择的太多啦, 最多可选择"+o+"个!"),this.setSelected(!1),this.setBackground(n.btnBackColor),this.setIcon(null),this.setLabel(e),void this.setLabelColor(n.btnFontColor);a.setValue("indicatorCount",parseInt(a.getValue("indicatorCount"))+1),this.setIcon(imagePath+"DuiHao.png"),this.setLabel(" "+e)}else a.setValue("indicatorCount",parseInt(a.getValue("indicatorCount"))-1),this.setIcon(null),this.setLabel(e)},$(i.getView()).css({boxShadow:"1px 1px 4px #000"}),i}var dialog=new ht.widget.Dialog,openPageDialog=new ht.widget.Dialog,customEventMap={jumpPage:"customEventJump",resizeNodes:"customEventResizeNodes",setPageSize:"customEventSetPageSizeWithRatio"};window.addEventListener("message",function(e){var t=e.data||{};"close"==t&&closePageDialogControl(),"getZoom"===t&&e.source.postMessage({action:"resizeNodes",args:{ratioX:1,ratioY:1,zoom:graphView.getZoom()}},"*"),customEventMap[t.action]&&$(window).trigger(customEventMap[t.action],t.args)});
|