// ----------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------- var CNodeSec = {"LeftCols":0,"Cols":1,"RightCols":2}; // ----------------------------------------------------------------------------------------------------------- // Updates XML to begin with , optionaly replaces entities, if it was coded // Return null for error (no tag ) TGP.PrepareData = function(Xml,DataIO){ if(typeof(Xml)!="string") { var X = Xml ? Xml.xml : null; if(X) Xml = X; else return typeof(Xml)=="object" ? Xml : null; } MS.JsonIn; if(Xml.search(/^[^\<\&]*\{/)>=0) { try { var A = new Function("return "+Xml.replace(/^[^\<\{]*\{/,'{').replace(/\}[^\}]*$/,'}')); A = A(); } catch(e){ this.Debug(1,"Incorrect JSON data from "+this.DebugDataGetName(DataIO)+", error returned: ",(e.message?e.message:e)); if(this.DebugFlags["ioerror"] && !DataIO.Debug["in"]) this.DebugData(DataIO,Xml," JSON:"); return null; } return A; } ME.JsonIn; Xml = Xml.replace(//g,""); var fr = Xml.search(/\/); if(fr<0) { fr = Xml.search(/\<\;Grid(\>|\>\;)/); if(fr<0) { MS.Debug; this.Debug(1,"No tag found in XML data from "+this.DebugDataGetName(DataIO)); if(this.DebugFlags["ioerror"] && !DataIO.Debug["in"]) this.DebugData(DataIO,Xml," XML:"); ME.Debug; if(Grids.OnDataError) Grids.OnDataError(this,DataIO,-4,null,Xml); //*** if(DataIO.AlertError) alert("TreeeGrid communication error \r\n\r\nURL: "+DataIO.Url+" \r\n\r\n"+Xml); var fl=""; if(Xml.indexOf("#|#@success")>-1){ var data=Xml.split("#|#"); var onlinePament=null; var tempDoccode=data[0].split(","); if(tempDoccode[1]!=undefined&&tempDoccode[1]!=""){ //linkDocInfo,表示有返回下一单的审核内容,保存到全局变量中 try{ tempDoccode[1]=tempDoccode[1].replace(/%2B/g,"+").replace(/%2F/g,"/"); var info=new Base64().decode(tempDoccode[1]); top.approvedDoc.nextDoc=info; var formInfo=info.split(";");//formid;formtype;doccode;formName //http://yingchen.onbus.cn:9001/app/82/0/cnzh/150302/496/index.jsp?d2hlcmU9ZG9jY29kZT0nWkMwMDEyMyclMjA= //where=doccode='ZC00123' var pageUrl=document.URL.split("/"); for(var i=0;i a > span.tabs-title")).html(formInfo[3]+"-"+formInfo[0]+"-"+formInfo[2]); if(top.approvedDoc!=null&&top.approvedDoc.index!=null&&top.approvedDoc.nextDoc!=null &&top.approvedDoc.nextDoc!=""){ var tab= parent.jQuery('#home-tabs').tabs('getTab',top.approvedDoc.index); //console.log("get-index:"+top.approvedDoc.index); parent.jQuery('#home-tabs').tabs('update', { tab: tab, type:'header', options: { title: formInfo[3]+"-"+formInfo[0]+"-"+formInfo[2] } }); } location.href=pageUrl.join("/"); return; }catch(e){ console.log("e:"+e) } } try{ onlinePament=JSON.parse(new Base64().decode(data[1].replace("@success",""))); //console.log("onlinePament:"+onlinePament.onlinePay) }catch(e){ //console.log("e:"+e) } //{"onlinePay":1,"onlineRefund":1} //**符合条件,表示需要调用支付 if(onlinePament!=null&&onlinePament!=""&&onlinePament.onlinePay!=-1){ var type=""; if(onlinePament.onlinePay==1){ //在线支付 type="pay"; } // else if(onlinePament.onlineRefund==1){ // //在线退款 // type="refund"; // } else{ type="commit"; } OpenPayAndRefund(new Base64().decode(tempDoccode[0]),type,this.formid); }else{ this.tempCode=tempDoccode[0]; fl=data[2]; if(this.aflg==3){//由于确定时先调用保存,所以在这里作判断 this.doccode=this.tempCode; postCheck(Xml,this);//传到外面hotkey.js调用 //this.tran("",this.callback,this.aflg); // this.aflg=0;//去掉3的情况 }else{ //增加弹出提示,针对取消确认成功后返回 by2014-6-7 if(data.length==6){ if(procCallBack){ procCallBack(data[5],1,0); }else{ this.showMsgAlert(data[5]); } } this.cM1(data[3],fl); if(typeof this.callback=='function'){//新增callback回调函数 hq 2010-08-11 this.callback(true,true);//执行成功 } } } }else{ if(typeof this.callback=='function'){//新增callback回调函数 hq 2010-08-11 this.Data.Upload.Url=this.Data.Upload.Url.replace("&canPric=1","");//***by 2014-6-3,增加取消确认处理 this.iscanelProc=false;//***这个值是从页面点击取消确认时传进来 var tsr=Xml; if(Xml.indexOf("tranError#|#")==0){ // by 2015-10-16最新修改,不需要这样了,保存和确认合并一起操作。by 2015-4-27 表示确认出错,需要刷新当前页面,避免还是新单状态,再确认时会生成重复单的问题 // this.cM1(Xml.split("#|#")[4],2); tsr=Xml.split("#|#")[1]; this.showMsgAlert(tsr); this.callback(false,false);//执行成功失败 }else if(Xml.indexOf("datacheckError#|#")==0){//数据范围检查返回 var check=2; if(this.istran){ //表示之前是执行确认操作 check=3; } this.callback(Xml.replace("datacheckError#|#",""),check); return null; }else if(Xml.indexOf("pushError#|#")==0){//推送出错返回 var str=Xml.split("#|#"); this.showMsgAlert(str[1]); if(str.length==3){//有单号才能刷新,新单确认时刷新会清空页面数据 location.href=document.URL; } }else{ this.showMsgAlert(Xml); this.callback(false,false);//去掉加载层 } }else{ this.showMsgAlert(Xml); } } return null; } Xml = ReplaceEntities(fr?Xml.slice(fr):Xml); Xml = Xml.replace(/\<\!\-\-([^\-]|\-[^\-]|\-+[^\-\>])*\-{2,}\>/g,""); fr = 0; } return Xml.slice(fr); } // ----------------------------------------------------------------------------------------------------------- // Parses only tag from XML TGP.AddDataIO = function(Xml){ if(!Xml) return; this.IO = {}; MS.JsonIn; if(typeof(Xml)=="object"){ var X = Xml.IO; if(!X || typeof(X)!="object") return; this.IO = X; return; } ME.JsonIn; MS.XmlIn; var A = Xml.match(/\/g); if(!A) return; var B = A[0].match(CNodeAttrsRegExp); this.SetNodeAttrs(this.IO,B); ME.XmlIn; } // ----------------------------------------------------------------------------------------------------------- // Main function for loading XML to grid. Parses Xml in string and add it to grid. DataIO is data source just for debug prints TGP.AddDataFromSource = function(Xml, DataIO){ if(!Xml) return false; this.IO = {}; this.AllCols = 0; if(typeof(Xml)=="object") { MS.JsonIn; if(!this.AddDataFromJson(Xml,DataIO)) return false; ME.JsonIn; } else { MS.XmlIn; if(!this.AddDataFromXml(Xml,DataIO)) return false; ME.XmlIn; } if(this.Reset&&typeof(this.Reset)=="number"){ var r = this.Reset, R = {}; this.Reset = R; if(r&1) { R.Style = this.Style; R.CSS = this.CSS; R.DialogCSS = this.DialogCSS; } if(r&2) { R.GanttStyle = this.GanttStyle; R.GanttCSS = this.GanttCSS; } if(r&4) { R.Language = this.Language; } } // --- IO Session --- if(this.IO.Session!=null) this.SetSession(this.IO.Session); // --- Bonus --- if(DataIO && DataIO.Bonus){ MS.Debug; this.Debug(4,"Loading XML data from ",DataIO.Name+"_Bonus"); if(DataIO.Debug["in"]) this.DebugData(DataIO,DataIO.Bonus,"a bonus XML added:"); ME.Debug; var B = {Name:DataIO.Name, Debug:DataIO.Debug, Bonus:""}; this.AddDataFromSource(this.PrepareData(DataIO.Bonus,B),B); } return true; } // ----------------------------------------------------------------------------------------------------------- // For API only, returns true for ok, false for error MS.Api; TGP.AddDataFromServer = function(xml,DataIO){ var prep = this.PrepareData(xml,DataIO?DataIO:{ }); if(!prep) return false; this.AddDataFromSource(prep,DataIO?DataIO:{ }); this.Update(); return true; } ME.Api; // ----------------------------------------------------------------------------------------------------------- // Sets Session to session and saves it TGP.SetSession = function(session){ if(session=="") session = null; this.Source.Session = session; if(session==null) session = ""; if(this.SaveSession==1 && Grids.SetCfg) Grids.SetCfg(this.id+"&"+(this.SessionId?this.SessionId:"Session"),session?escape(session):""); else { var sid = this.SaveSession ? this.SaveSession : this.id+"_"+(this.SessionId?this.SessionId:"Session"); var E = GetElem(sid); if(!E) { E = document.createElement("input"); E.type = "hidden"; E.id = sid; AppendTag(E); } E.value = session; } } // ----------------------------------------------------------------------------------------------------------- TGP.UpdateLangFormat = function(){ return this.Lang.Format.Init(); } // ----------------------------------------------------------------------------------------------------------- TGP.MoveColData = function(C,next,sec){ var CX = this.ColNames[C.Sec]; for(var i=C.Pos+1;i