function wdRecord(bjid) { try{ //if(true)return; //回显个人选值数据 if("0"==window.loginStatus) return; if(window.wdRecordValue&&!document.querySelector("ssDlg[setPval=false]")){ // ("wdDialog[setValue=。Lin if(typeof wdRecordValue=="string") wdRecordValue=eval("("+wdRecordValue+")") for(var key in wdRecordValue){ // var ele= document.querySelector("[name="+key+"]"); // if(!ele||ele.value)continue; // // ele.value=wdRecordValue[key]["value"]; // $(ele).trigger("change") var box=wd.display.getInputBox(key); if(!box||box.getValue())continue; box.setValue(wdRecordValue[key]["value"]); } } if(window.wdRecordValue){ window.wdRecordValue=(typeof wdRecordValue=="object")?window.wdRecordValue: eval("("+wdRecordValue+")") var thisEle=document.querySelector("[name=wdComponentID]"); var wdComponentID=window.wdRecordValue["wdComponentID"]; if(wdComponentID&&thisEle){ thisEle.value=wdComponentID.value; } } /** * 根据是否找到wdDialogId判断当前页面在弹窗中或应用页面 * */ var wdDialogId = wd.display.getwdDialogId(); //当前窗口在弹出窗口中 if(wdDialogId){ var win=wd.topWindow.dhxWins.window(wdDialogId); var allWindows= wd.display.getwdDialogWindowObjects(wdDialogId); var targetWindows=[]; for(var i=0;i0){ win.button("wdRecord").show(); win.button("wdRecord_save").hide(); //编辑个人选值和保存个人选值切换 win.button("wdRecord").onclick = function() { for(var i=0;i0){//第二次点击 // this.hide(); // return; // } if(window.wdRecordValue){ this.wdRecordValue=(typeof wdRecordValue=="object")?wdRecordValue: eval("("+wdRecordValue+")") } for(var key in wdRecordList){ this.showDialog(wdRecordList[key]) } } , hide:function(){ var recordZhi=this.getRecordData(); // if(!document.querySelector("#wdComponentID"))return; // console.log(recordZhi) // var bjid= document.getElementsByName("wdComponentID")[0].value this.insertRecordsService(recordZhi); this.removeDialog() } , showDialog:function(inputbox){ var ele=inputbox.container; if(!ele)return; var eleName=inputbox.name var topDoc = window.document; var chartDiv =$("
") var status="0"; if(this.wdRecordValue[eleName]){ status=("true"==this.wdRecordValue[eleName].default)?"1":"2"; } var rule={"0":{class:"icon-empty",status:"0",next:"1",title:"未启用"}, "1":{class:"icon-warningFull",status:"1",next:"2",title:"填左边录入的值"}, "2":{class:"icon-copy",status:"2",next:"0",title:"填上次录入的值"}} $(chartDiv).html("
") $(ele).after(chartDiv); chartDiv.css({width:chartDiv.children().css("width"),height:chartDiv.children().css("height")}) chartDiv[0].inputbox=inputbox; // var bounding=ele.getBoundingClientRect(); // var $p=$(ele).parents().filter(function(){ // if($(this).css("position")=="relative"|| $(this).css("position") == "absolute"|| $(this).css("position") == "fixed")return true; // }).first() // var $p=$(ele).offsetParent(); // if($p.length==0)$p=null // // var chartDivWidth=chartDiv.width(); // var chartDivHeight=chartDiv.height(); // var pbounding=$p? $p[0].getBoundingClientRect():null; // // chartDiv.css("left" ,(bounding.width+bounding.left-(pbounding?pbounding.left:0) )+"px") // chartDiv.css("top" ,(bounding.top-(pbounding?pbounding.top:0)+(bounding.height-chartDivHeight)*0.5)+"px") var pos=$(ele).position(); var bounding=ele.getBoundingClientRect(); console.log(pos.left+bounding.width); chartDiv.css("left",pos.left+bounding.width) chartDiv.css("top",pos.top+(bounding.height-bounding.height)*0.5) var leftx=chartDiv.offset().left+chartDiv.width()-$(window).width(); if(leftx>0){ chartDiv.animate({left:"-="+leftx}); } $(chartDiv).on("click","[wdrecordcheckbox=true]",function(){ var thisstatus= $(this).attr("status"); var nextrule=rule[rule[thisstatus].next]; $(this).attr("class","").addClass(nextrule.class).attr("title",nextrule.title).attr("status",nextrule.status); }) }, recursionIframe:function(win){ if(win.parent==top&&win.parent==win){ // var xy = this.getAbsPoint(win); return {"x": 0, "y": 0 , "w" : 0 , "h" : 0 }; } var winPar = win.parent;// .opener var iframeArr = winPar.document.getElementsByTagName('IFRAME'); var targetIframe; for(var i=0;i0){ var record={} var removeEle= this.findDialog()[0]; // console.log(removeEle.record) removeEle.parentNode.removeChild(removeEle) } } , /*获得部件ID:bjid */ getBjid:function(){ var con=document.getElementsByName("wdComponentID"); if(con.length==0)return; return con[0].value; } /*根据勾选框+元素值生成数据 */ ,getRecordData:function(){ var recordZhi={}; var cancelZhi={};//删除 if(window.wdRecordValue&&typeof wdRecordValue=="string"){ recordZhi=eval("("+wdRecordValue+")") }else if(window.wdRecordValue&&typeof wdRecordValue=="object"){ recordZhi=wdRecordValue; } console.log(recordZhi); var dialogList=this.findDialog(); // {"nrid": {value:"440120001400",defualt:true},"bt":{"nrid": {value:"标题",defualt:false} } for(var i=0;i