fs-danaus
2022-07-30 4c5cb4b08f5ba3749c9ce3ae15d5ed7031a51888
增加处理下一单功能
3个文件已添加
7个文件已修改
7357 ■■■■■ 已修改文件
Grid/Data.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Grid/Data.js.bak 903 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Grid/DataIn.js 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Grid/DataIn.js.bak 238 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Grid/Filter.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Grid/Paste.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Words/EAPIGlobals.txt 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Words/EAPIProperties.txt 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
core.js 291 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
core.js.bak 5835 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Grid/Data.js
@@ -80,7 +80,8 @@
   }
if(code<0){ 
   if(IO.AlertError) alert("TreeeGrid communication error \r\n\r\nURL: "+(IO.Script?IO.Script:IO.Url)+" \r\n\r\n"+code+" : "+mess);
   if(IO.AlertError) top.$.messager.alert("\u63d0\u793a\u4fe1\u606f",code+" : "+mess,"error");//****
   $("#loading").hide();//****出错需要关闭层
   if(Func) Func(code);
   return;
   }
Grid/Data.js.bak
New file
@@ -0,0 +1,903 @@
// -------------------------------------------------------------------------------------------------
// Base functions for AJAX communication
// -------------------------------------------------------------------------------------------------
MS.Ajax;
// -------------------------------------------------------------------------------------------------
// Updates Url according to cfg
TGP.UpdateUrl = function(D){
var u = D.OrigUrl, uu = D.Jsonp ? D.Jsonp : D.Url;
if(!u || D.ZalUrl && D.ZalUrl!=uu) u = uu;
if(u && (u+"").search(/\*/)>=0 && D.Row){
   D.OrigUrl = u;
   var row = D.Row, rr = row.SPage ? row.parentNode : row, rep = rr.Copy!=null?rr.Copy:(rr.id!=null?rr.id:""); if(BIEA&&(rep+"").indexOf("$")>=0) rep = rep.replace(/\$/g,"$$$");
   u = u.replace(/\*Pos/g,row.Pos!=null?row.Pos:"").replace(/\*id/g,rep).replace(/\*Rows/g,row.Rows!=null?row.Rows:"");
   if(u.indexOf("Sort")>=0){
      var S = this.GetSort();
      for(var i=0;i<3;i++){
         var rs = new RegExp("\\*Sort"+i,"g"), rsc = new RegExp("\\*SortCols"+i,"g"), rst = new RegExp("\\*SortTypes"+i,"g");
         u = u.replace(rsc,S&&S[i*2]?S[i*2]:"").replace(rst,S&&S[i*2]?(S[i*2+1]?"1":"0"):"").replace(rs,S&&S[i*2]?(S[i*2+1]?"-":"")+S[i*2]:"");
         }
      }
   if(D.Jsonp) D.Jsonp = u;
   else D.Url = u;
   D.ZalUrl = u;
   }
return D;
}
// -------------------------------------------------------------------------------------------------
// Downloads data from server and adds it to the grid
// IO is part of this.Source, for example Source.Layout
// Data are sent to server as request
// After finish calls function Func(result), where result is server error code or IO.Result, >=0 is OK
// Displays error alerts
// Continues asynchronously in function AjaxCallFinish
TGP.AjaxCall = function(IO, Data, Func){
var T = this, Ret = null;
if(typeof(IO)=="string") IO = {Url:IO};
if(!Func && IO.Sync){ Func = function(err) { Ret = err; } }
if(Grids.OnDataSend){
   var v = Grids.OnDataSend(this,IO,Data,Func);
   if(typeof(v)=="string") Data = v;
   else if(v) return;
   }
if(IO.Static){
   var n = IO.Static;
   if(Grids[n+"Data"]) { this.AjaxFinish(Grids[n+"Data"]?0:-1,Grids[n+"Data"],IO,Func); return; }
   else if(Grids[n+"Requests"]==null) Grids[n+"Requests"] = [];
   else { Grids[n+"Requests"][Grids[n+"Requests"].length] = [this,IO,Func]; return; }
   }
var D = {};
for(var o in IO) D[o] = IO[o];
if(IO.Param) for(var o in IO.Param) D.Param[o] = IO.Param[o];
D.Grid = this;
if(this.Json==2 && D.Url && D.Method.toLowerCase()=="get"){ D.Jsonp = D.Url; D.Url = null; }
if(this.Lang.Alert) {
   D.RepeatText = this.GetAlert(IO==this.Source.Upload ? "AskUploadTimeout" : "AskTimeout");
   D.RepeatError = this.GetAlert(IO==this.Source.Upload ? "UploadTimeout" : "ErrTimeout");
   }
function Finish(code,mess){ if(!T.Cleared) T.AjaxFinish(code,mess,D,Func); };
if(!Grids.OnCustomAjax || !Grids.OnCustomAjax(this,D,Data,Finish)) AjaxCall(D,Data,Finish);
return Ret;
}
// -------------------------------------------------------------------------------------------------
// AjaxCall finalization
TGP.AjaxFinish = function(code,mess,IO,Func,noxlsx){
    //****start***
    var cm=mess!=undefined?mess.match(/;\#\^\#;/):mess;
    if(cm) {
      IO.Grid.Cpd=1;
        mess=mess.replace(cm,"");
    }
    if (IO.isGt) {//**增加一个isGt参数,表明需要返回直接处理,不然回车ajax取数不成功
        if (Func) Func(code,mess);
        return mess;
    }
    //***end***
if(IO.Static && Grids[IO.Static+"Requests"]) {
   Grids[IO.Static+"Data"] = code<0 ? "" : mess;
   var A = Grids[IO.Static+"Requests"]; Grids[IO.Static+"Requests"] = null;
   for(var i=0;i<A.length;i++) A[i][0].AjaxFinish(code,mess,A[i][1],A[i][2]);
   }
if(code<0){
   if(IO.AlertError) top.$.messager.alert("TreeeGrid communication error \r\n\r\n "+" \r\n\r\n"+code+" : "+mess);//****
   $("#loading").hide();//****出错需要关闭层
   if(Func) Func(code);
   return;
   }
if(IO.Xlsx&&!noxlsx){
   NoModule("Import","Sheet");
   }
if(Grids.OnDataParse) {
   var v = Grids.OnDataParse(this,IO,mess);
   if(v!=null) mess = v;
   }
var prep = this.PrepareData(mess,IO);
if(prep==null) {
   if(Func) Func(-4);
   return;
   }
this.AddDataIO(prep);
var Q = this.IO;
if(!Q) Q = {};
Grids.Alert = 1;
if(Grids.OnDataGet) {
   var v = Grids.OnDataGet(this,IO,mess,Q);
   if(typeof(v)=="string") { prep = this.PrepareData(v,IO); if(prep==null) { if(Func) Func(-4); return; } }
   }
var T = this;
function finish(ret){
   if(Grids.OnDataReceive) Grids.OnDataReceive(T,IO);
   Grids.Alert = 0;
   var err = Q.Result<0 ? Q.Result : 0;
   MS.Debug; if(err) T.Debug(1,"Error result '",err,"' received from server from ",IO.Name+(IO.Script?"_Script='"+IO.Script+"'":"_Url='"+IO.Url+"'")); ME.Debug;
   if(Q.HtmlMessage&&T.SuppressMessage<4) {
      if(T.Loading) { T.HtmlMessage = Q.HtmlMessage; Q.HtmlMessage = null; }
      else { T.ShowMessageTime(Q.HtmlMessage,Q.HtmlMessageTime,function(){ if(!err && Q.Reload==1) T.ReloadBody(null,0,"Reload"); if(Func) Func(err); }); return ret ? err : null; }
      }
   if(!err && Q.Reload==1) T.ReloadBody(null,0,"Reload");
   else if(ret) return err;
   else if(Func) Func(err);
   }
function htmlmess(but) {
   if(but==2||but==3) Q.Reload = 0;
   if(but==3) { T.Source.Check.Interval = 0; T.SaveCfg(); }
   finish();
   }
if(Q.Message) alert(Q.Message);
if(Q.UpdateHtmlMessage && !(this.SuppressMessage>=4)){
   this.ShowMessageTime(Q.UpdateHtmlMessage,0,function(but){
      if(but==1) T.AddDataFromSource(prep,IO);
      if(but==3) { T.Source.Check.Interval = 0; T.SaveCfg(); }
      if(IO.JavaScript) eval(IO.JavaScript);
      if(Q.ReloadHtmlMessage && !(T.SuppressMessage>=4)) T.ShowMessageTime(Q.ReloadHtmlMessage,0,htmlmess,IO.Name=="Check"?["Yes","No","Never"]:["Yes","No"]);
      else finish();
      },IO.Name=="Check"?["Yes","No","Never"]:["Yes","No"]);
   return;
   }
if(!Q.UpdateMessage || confirm(Q.UpdateMessage)) this.AddDataFromSource(prep,IO);
if(IO.JavaScript) eval(IO.JavaScript);
if(Q.ReloadHtmlMessage && !(this.SuppressMessage>=4)) { this.ShowMessageTime(Q.ReloadHtmlMessage,0,htmlmess,IO.Name=="Check"?["Yes","No","Never"]:["Yes","No"]); return; }
if(Q.ReloadMessage && !confirm(Q.ReloadMessage)) Q.Reload = 0;
var err = finish(1);
if(Func&&!Q.HtmlMessage) Func(err);
}
// -------------------------------------------------------------------------------------------------
// Backward compatibility
TGP.Communicate = AjaxCall;
TGP.Communicate2 = TGP.AjaxCall;
// -------------------------------------------------------------------------------------------------
ME.Ajax;
// -----------------------------------------------------------------------------------------------------------
// Reads data to grid, returns true for ok
// DataIO is part of this.Source, for example Source.Layout
// After finish calls function Func(result), where result is server error code or IO.Result, >=0 is OK
TGP.ReadData = function(DataIO, Func){
MS.Debug;this.Debug(4,"Loading XML data from ",this.DebugDataGetName(DataIO));ME.Debug;
if(Grids.OnReadData && Grids.OnReadData(this, DataIO, Func)) return;
// --- Sheet z this.File ---
// --- Url ---
MS.Ajax;
if(DataIO.Url || DataIO.Jsonp || DataIO.Script){
   var req = "", F = this.GetUploadFormat(DataIO);
   if(this.ColNames[1] && this.ColNames[1].length) req = this.GetCfgRequest(F,"");
   if(req || this.Source.Session!=null) req = this.GetRequestIO(F,1);
   this.AjaxCall(this.UpdateUrl(DataIO),req,Func);
   return;
   }
ME.Ajax;
// --- Input ---
MS.Submit;
if(DataIO.Tag){
   var I = this.GetInput(DataIO.Tag), ret;
   if(!I){ ret = -3; MS.Debug; this.Debug(1,"Missing input tag named '",DataIO.Tag,"' from data source ",DataIO.Name+"_Tag"); ME.Debug; }
   else if(!I.value){ ret = -4; MS.Debug; this.Debug(1,"Empty xml in tag named '",DataIO.Tag,"' from data source ",DataIO.Name+"_Tag"); ME.Debug; }
   else {
      MS.Debug;
      this.Debug(4,"Loading data from tag named '",DataIO.Tag,"' from data source ",DataIO.Name+"_Tag");
      if(DataIO.Debug["in"]) this.DebugData(DataIO,I.value,"a XML loaded:");
      ME.Debug;
      var prep = this.PrepareData(I.value,DataIO);
      if(prep) this.AddDataFromSource(prep,DataIO);
      ret = prep ? 0 : -4;
      }
   if(Func) Func(ret);
   return;
   }
ME.Submit;
// --- Data ---
if(DataIO.Data){
   MS.Debug;
   this.Debug(4,"Loading data from data source ",DataIO.Name+"_Data");
   if(DataIO.Debug["in"]) this.DebugData(DataIO,DataIO.Data,"a XML loaded:");
   ME.Debug;
   var prep = this.PrepareData(DataIO.Data,DataIO);
   if(prep) this.AddDataFromSource(prep,DataIO);
   var ret = prep ? 0 : -4;
   if(Func) Func(ret);
   return;
   }
// --- Script ---
// --- Error ---
MS.Debug; this.Debug(1,"No data source defined for ",DataIO.Name); ME.Debug; if(Func) Func(-3);
}
// -----------------------------------------------------------------------------------------------------------
TGP.GetRequestIO = function(F,end){
return (F.Json?"{":"<Grid>") + this.GetCfgRequest(F) + (F.Json?"\"IO\":{":"<IO") + (this.Source.Session!=null?F.Spc1+"Session"+F.Sep+"\""+this.Source.Session+"\"":"") + (end?(F.Json?"}}":"/></Grid>"):F.End);
}
// -------------------------------------------------------------------------------------------------
// Downloads data for given page or row
// After finish calls function Func(result), where result is server error code or IO.Result, >=0 is OK
MS.Paging;
TGP.DownloadPage = function(row, Func){
row = this.UpdateTagName(row);
this.Source.Page.Row = row;
if(Grids.OnDownloadPage && Grids.OnDownloadPage(this,row,Func)) return;
if(row.State>1){ if(Func) Func(0); return; }
if(!this.Source.Page.Url&&!this.Source.Page.Script){
   MS.Debug; this.Debug(1,"No Page_Url/Script set in <treegrid> tag"); ME.Debug;
   if(Func) Func(-1); return;
   }
var A = [], p = 0, F = this.GetUploadFormat(this.Source.Page);
A[p++] = this.GetRequestIO(F);
//***加载列表时需要传回后台的参数
 //**增加传递字段列表[fieldsName] by 11-4-21
    A[p++] = F.Json ? "\"Fields\":{\"" : "<Fields ";
    A[p++] ="FieldsName\":\""+this.getFileds() + "\"";
    A[p++] = F.Json ? " }," : "/> ";
    //**增加三表过滤条件 by 11-6-3
    A[p++] = F.Json ? "\"CutFilter\":{\"" : "<CutFilter ";
    A[p++] ="Filter\":\""+this.filters + "\"";
    A[p++] = F.Json ? " }," : "/> ";
    //**增加权限表达式控制 by 11-6-3 修改 by13-3-8
    A[p++] = F.Json ? "\"Exprs\":{\"" : "<Exprs ";
    A[p++] ="expr\":\""+this.getExprs(this.expr) + "\"";
    A[p++] = F.Json ? " }," : "/> ";
      //**增加css by 14-11-13
    A[p++] = F.Json ? "\"CssExprs\":{\"" : "<CssExprs ";
    A[p++] ="cssexpr\":\""+this.getExprs(this.csspr) + "\"";
    A[p++] = F.Json ? " }," : "/> ";
    //**增加复单从后台进行,所以把需要排除的传回去 by 2013-10-9
    A[p++] = F.Json ? "\"Cps\":{\"" : "<Cps ";
    A[p++] ="cp\":\""+this.getRowcopyfields()+ "\"";
    A[p++] = F.Json ? " }," : "/> ";
    //**增加合并行
     A[p++] = F.Json ? "\"rowspan\":\"" : "<rowspan ";
     A[p++] = F.Json ? this.ycRowSpan+"\"" : "";
     A[p++] = F.Json ? "," : "/>";
     //**增加把需要导出excel时动态标题传回后台写入excel by 2014-4-2
     A[p++] = F.Json ? "\"excelTitle\":\"" : "<excelTitle ";
     A[p++] = F.Json ? this.excelTitle+"\"" : "";
     A[p++] = F.Json ? "," : "/>";
A[p++] = F.Json ? "\"Body\":[{" : "<Body><B";
var pp = p, rr = row.SPage ? row.parentNode : row;
if(rr.Copy) A[p++] = F.Spc+"id"+F.Sep+"\""+rr.Copy+"\"";
else if(rr.id||rr.id=="0") A[p++] = F.Spc+"id"+F.Sep+"\""+rr.id+"\"";
if(row.Rows) A[p++] = F.Spc+"Rows"+F.Sep+"\""+F.Str(row.Rows)+"\"";
if(row.Page||row.SPage) A[p++] = F.Spc+"Pos"+F.Sep+"\""+row.Pos+"\"";
if(F.Json && A[pp] && A[pp].charAt(0)==',') A[pp] = A[pp].slice(1);
A[p++] = F.Json ?"}]}" :"/></Body></Grid>";
var url = this.UpdateUrl(this.Source.Page);
MS.Debug;
if(this.DebugFlags["page"]) {
   this.StartTimer("Page"+(row.Page?row.Pos:row.id));
   this.Debug(3,"Downloading ",row.Page?"page "+row.Pos:"children "+row.id," from ",this.DebugDataGetName(url));
   }
ME.Debug;
this.AjaxCall(url,A.join(""),Func);
}
ME.Paging;
// -------------------------------------------------------------------------------------------------
// Downloads data for cell
// After finish calls function Func(result), where result is server error code or IO.Result, >=0 is OK
MS.Ajax;
MS.Edit$Defaults;
TGP.DownloadCell = function(row,col,Func,val){
var A = [], p = 0, F = this.GetUploadFormat(this.Source.Cell);
A[p++] = this.GetRequestIO(F);
A[p++] = F.Json ? "\"Body\":[{" : "<Body><B ";
var pp = p;
if(row.Copy) A[p++] = F.Spc1+"id"+F.Sep+"\""+row.Copy+"\"";
else if(row.id||row.id=="0") A[p++] = F.Spc1+"id"+F.Sep+"\""+row.id+"\"";
A[p++] = F.Spc+"Col"+F.Sep+"\""+col+"\"";
A[p++] = F.Spc+"Val"+F.Sep+"\""+PFormat.Escape(val)+"\"";
A[p++] = F.Json ?"}]}" :"/></Body></Grid>";
MS.Debug;
if(this.DebugFlags["page"]) {
   this.StartTimer("Cell"+row.id+"_"+col);
   this.Debug(3,"Downloading cell [",row.id,",",col,"] (",val,") from ",this.DebugDataGetName(this.Source.Cell));
   }
ME.Debug;
this.Source.Cell.Row = row;
this.Source.Cell.Col = col;
this.Source.Cell.Value = val;
this.AjaxCall(this.UpdateUrl(this.Source.Cell),A.join(""),Func);
}
ME.Edit$Defaults;
ME.Ajax;
// -------------------------------------------------------------------------------------------------
// Uploads changes to server and downloads new
// Accepts all changes and displays them
// If row is set, uploads only changes in the row
// returns 0 OK, -1 browser does not support the function, -2 bad URL, -3 URL not found, -4 bad document format
TGP.UploadChanges = function(row, Func, notest){
MS.Upload;
MS.Ajax;
if(row && (this.CalculatedChanges||(","+this.Source.Upload.Type+",").toLowerCase().indexOf("selected")>=0)) row = null;
MS.Master; if(this.MasterGrid) return this.MasterGrid.UploadChanges(row?row.MasterRow:null,Func); ME.Master;
if(!this.AutoUpdate&&!notest || row && (!row.id&&row.id!="0" || Is(row,"NoUpload") || row.Kind=="Filter"&&Is(row,"NoUpload")!=0) || this.Locked["save"]){ if(Func) Func(0); return; }
MS.Pivot; if(this.PivotGrid) return this.PivotGrid.UploadChanges(null,Func,1); ME.Pivot;
if(row && this.Validate && !this.ActionValidate(null,0,row)) return;
if(Grids.OnSave && Grids.OnSave(this,row,true)) { if(Func) Func(0); return; }
var val = this.GetXmlData(null,null,null,null,row);
if(!val) return;
var D = this.Source.Upload, T = this;
if(Grids.OnUpload){ var v = Grids.OnUpload(this,val,row,true); if(v!=null) val = v; }
this.ReloadReason = "Upload";
var hasundo = this.Undo&&this.OUndo;
D.Row = row;
function finish(result){
   if(result>=0) {
      T.AcceptChanges(row);
      MS.Undo;
      if(hasundo){
         if(T.Undo&32 && T.OUndo && T.OUndo.Pos) { T.AddUndo({Type:"Accept",Row:row},2); T.OUndo.Rev = 0; }
         else if(!T.MasterGrid) T.ClearUndo(1);
         }
      ME.Undo;
      }
   T.ReloadReason = null;
   if(Grids.OnAfterSave) Grids.OnAfterSave(T,result,true);
   if(Func) Func(result);
   };
if(!D.Url && !D.Script && D.Data && D.Data.search(/^\s*[\<{]/)>=0){
   this.AddDataFromSource(this.PrepareData(D.Data,D),D);
   var Q = this.IO;
   if(Q && Q.Message) this.Alert(Q.Message);
   if(!Q || Q.Result==null || Q.Result>=0) finish(0);
   if(Q && Q.HtmlMessage) this.ShowMessageTime(Q.HtmlMessage,Q.HtmlMessageTime);
   return 0;
   }
MS.Debug;
if(!D.Url && !D.Script && D.Tag && (D.Tag+"").toLowerCase()=="debug" && !this.GetInput(D.Tag)){
   this.Debug(1,"Upload_Tag is set to \"Debug\", so the data are not uploaded, just printed here");
   this.DebugData(D,val,":");
   finish(0);
   return 0;
   }
ME.Debug;
this.AjaxCall(D,val,finish);
return 0;
ME.Ajax;
ME.Upload;
}
// -----------------------------------------------------------------------------------------------------------
MS.Reload;
// -----------------------------------------------------------------------------------------------------------
// Reloads all data and displays the grid
// Returns false if user canceled the action
TGP.Reload = function(D,id,type,mess,file){
if(this.Rendering || this.Loading) return false;
if(Grids.OnReload && Grids.OnReload(this)) return false;
if(!D) D = this.Source;
if(!D) return;
if(this.EditMode && this.EndEdit(1)==-1) return false;
MS.Animate; this.FinishAnimations(); ME.Animate;
if(type==null) type = 1;
if(type&1 && this.CanReload && !this.CanReload(1)) return false;
MS.Debug; this.Debug(4,"Reloading grid"); ME.Debug;
this.Loading = 1;
this.SelectingFocus = 0; this.Focus();
if(this.RefreshDetail) this.RefreshDetail(null,1);
Grids.CacheVersion = Math.floor(Math.random()*1e8);
if(type&14) { D.Data.Bonus = this.GetXmlData(type&8 ? "ConfigXlsx" : type&4 ? "Settings" : "Config"); D.Data.BonusTemp = 1; }
var oid = this.id, tag = this.MainTag, idx = this.Index, ridx = this.ReloadIndex, mwidth = this.MessageWidth;
if(id!=null) if(id==oid) id = null; else { delete Grids[oid]; oid = null; }
if(!file&&!(type&8)) file = this.File;
if((file||this.File) && typeof(file||this.File)=="object") for(var i=0;i<Grids.length;i++) { var G = Grids[i]; if(G&&G.Hidden&&G.FSheet&&G.id.indexOf(this.id+"$")==0) G.Dispose(); }
if(D.Json==null) D.Json = this.Json;
this.Clear(1);
this.Enable();
if(this.LimitWidth!=null) tag.style.width = this.LimitStyleWidth;
if(this.LimitHeight!=null) tag.style.height = this.LimitStyleHeight;
var PR = this.KeepReload, PR2 = this.KeepReload2, P = {KeepReload:1,KeepReload2:1};
if(PR){ if(typeof(PR)!="object") PR = PR.split(","); for(var i=0;i<PR.length;i++) P[PR[i]] = 1; }
if(PR2){ if(typeof(PR2)!="object") PR2 = PR2.split(","); for(var i=0;i<PR2.length;i++) P[PR2[i]] = 1; }
for(var n in this) if(TGP[n]==null&&!P[n]) delete this[n];
this.Init();
this.id = oid; this.Index = idx; this.ReloadIndex = ridx?ridx+1:1; this.File = file; this.MainTag = tag;
if(file) D.Data.Format = "xlsx";
if(!mess&&D.Text&&D.Text.Start) mess = D.Text.Start;
if(mess!=null) ShowMessageCenter(mess,tag,"GridMessage",null,mwidth);
return TreeGrid(D,tag,id,this);
}
// -----------------------------------------------------------------------------------------------------------
// Calls Reload
TGP.ActionReload = function(dummy,T){
if(this.Locked["reload"]) return false;
if(T) return !this.Detail;
if(!this.EndEditAll()) return false;
return this.Reload();
}
// -----------------------------------------------------------------------------------------------------------
// Calls Reload
TGP.ActionReloadCfg = function(dummy,T){
if(this.Locked["reload"]) return false;
if(T) return !this.Detail;
if(!this.EndEditAll()) return false;
return this.Reload(null,null,3);
}
// -----------------------------------------------------------------------------------------------------------
// Calls Reload
TGP.ActionReloadSettings = function(dummy,T){
if(this.Locked["reload"]) return false;
if(T) return !this.Detail;
if(!this.EndEditAll()) return false;
return this.Reload(null,null,7);
}
// -----------------------------------------------------------------------------------------------------------
ME.Reload;
MS.ReloadBody;
// -----------------------------------------------------------------------------------------------------------
// Tests changes before body reloading, lets user to confirm updating changes before body reloading
TGP.CanReload = function(cancel){
MS.Upload;
var chg = this.HasChanges ? this.HasChanges() : 0;
if(Grids.OnCanReload) { var tmp = Grids.OnCanReload(this,chg,cancel); if(tmp!=null) return tmp; }
var v = this.ReloadChanged;
if(!(v&4)) chg&=~2;
if(chg){
   v&=3;
   if(v==3) v = this.Confirm(this.GetAlert("CanReloadStart") + (chg&1 ? this.GetAlert(cancel?"CanCancelChanges":"CanReloadChanges") : "")
      + ((chg&3)==3 ? this.GetAlert("And") : "") + (chg&2 ? this.GetAlert("CanReloadSelect") : "")
      + this.GetAlert("CanReloadEnd")) ? 1 : 0;
   //**if(v==1 && chg&1 && !cancel && this.Save) this.Save();
   if(v==1 && chg&1 && !cancel && this.Save) {
   if(!confirm(this.GetText("isConfirm"))){return;};}//***排序先确认是否要保存 by 11-8-2
   return !!v;
   }
ME.Upload;
return true;
}
// -----------------------------------------------------------------------------------------------------------
// Reloads and displays body (variable rows)
// After finish calls function Func(result), where result is server error code or IO.Result, >=0 is OK
TGP.ReloadBody = function(Func,rerender,reason,empty){
if(this.Loading || this.Rendering || this.EditMode && this.EndEdit(1)==-1) return;
MS.Animate; this.FinishAnimations(); ME.Animate;
this.ReloadReason = reason ? reason : "Reload";
MS.Debug; this.Debug(4,"++++++++++ Reloading body rows due ",reason?reason:"API"," ++++++++++"); this.StartTimer("ReloadBody"); ME.Debug;
if(this.Focused==null) this.SetFocused();
if(this.PreserveReload&1){
   for(var s="",r=this.GetFirst();r;r=this.GetNext(r)) if(this.CanSelect(r) && r.Selected&1 && r.id) s+=(s?"&":"") + r.id;
   this.ToSelect = "&"+s+"&";
   }
if(this.PreserveReload&2){
   for(var e="",c="",r=this.GetFirst();r;r=this.GetNext(r)){
      if(Is(r,"CanExpand") && (r.firstChild || r.State<=1&&r.Count) && r.Expanded!=r.Def.Expanded && !(r.Expanded&2) && r.id){
         if(r.Expanded) e += (e?"&":"") + r.id; else c += (c?"&":"") + r.id;
         }
      }
   this.ToExpand = "&"+e+"&"; this.ToCollapse = "&"+c+"&";
   }
this.FRow = null; this.FCol = null;
this.Clear(4);
if(this.RefreshDetail) this.RefreshDetail(null,1);
ClearChildren(this.XB);
this.LoadedCount = 0;
this.RemovedPages = null;
MS.Group; if(this.Grouping && this.Grouped && this.Group) { this.Root.CDef = this.RootCDef; this.Root.AcceptDef = this.RootAcceptDef; } ME.Group;
if(!this.MasterGrid) this.ClearUndo();
this.Loading = 1;
Grids.CacheVersion = Math.floor(Math.random()*1e8);
if(empty) { this.AddBody(); this.ReloadBodyFinish(0,Func,rerender); }
else {
   var D = this.Source;
   var S = D.Source.split(";"), dpos = S[S.length-1].split(",").length;
   S = D.Source.split(/[,;]/); dpos = S.length - dpos;
   var O = {G:this,D:D,S:S,Pos:dpos,Cnt:1,Func:Func,rerender:rerender};
   function run(result){
      if(this!=window) O = this;
      if(!O.G.Loading || --O.Cnt) return;
      while(!O.D[O.S[O.Pos]] && i<O.S.length) O.Pos++;
      if(O.Pos==O.S.length||result<0){ O.Cnt = 1000; O.G.ReloadBodyFinish(result,O.Func,O.rerender); return; }
      var SS = O.S[O.Pos++].split("+"); O.Cnt = SS.length;
      for(var i=0;i<SS.length;i++) O.G.ReadData(O.D[SS[i]],O.run);
      }
   if(run.bind) O.run = run.bind(O);
   O.run = run;
   O.run();
   }
}
// -----------------------------------------------------------------------------------------------------------
TGP.ClearBody = function(Func){ return this.ReloadBody(Func,1,"Clear",1);}
// -----------------------------------------------------------------------------------------------------------
// ReloadBody finalization
TGP.ReloadBodyFinish = function(result,Func,rerender){
var D = this.Source.Data;
if(result<0){
   this.Loading = 0;
   MS.Debug; this.Debug(1,"Reloading body failed with result ",result); ME.Debug;
   this.HideMessage();
   ClearChildren(this.XB);
   if(!this.XB.firstChild) this.AddBody();
   this.Render();
   if(Func) Func(result);
   this.setTotalCols(1);
   return;
   }
if(!this.XB.firstChild){
   MS.Debug; if(!this.AutoPages) this.Debug(2,"No page (tag <B>) defined in input XML"); ME.Debug;
   this.AddBody();
   }
// --- Update ---
if(!this.Paging){
   for(var F=this.XB.firstChild,B=F.nextSibling;B;B=F.nextSibling){
      for(var r=B.firstChild;r;r=B.firstChild) F.appendChild(r);
      this.XB.removeChild(B);
      }
   }
MS.Tree; this.CreateTree(); ME.Tree;
this.UpdatePagesValues();
MS.RowSpan; this.InitRowSpan(); ME.RowSpan;
MS.Gantt; if(this.Gantt) this.InitGanttCols(); ME.Gantt;
MS.Gantt; this.GanttZal = this.Gantt; this.Gantt = 0; ME.Gantt;
MS.Calc; this.UpdateGridCalc(); ME.Calc;
if(this.Paging==3) this.UpdateGridPaging();
else {
   MS.Group; this.UpdateGridGroup(); ME.Group;
   MS.Filter; this.UpdateGridFilter(); ME.Filter;
   this.UpdateGridSort();
   }
this.UpdateGridTree();
MS.Tree; this.CalcTreeWidth(); ME.Tree;
MS.Gantt;
this.Gantt = this.GanttZal;
if(this.Gantt){
   this.RefreshGantt(58);
   this.CalculateSpaces();
   }
ME.Gantt;
this.UpdateGridFinish(1);
MS.Cfg; this.LoadCfg(null,2); ME.Cfg;
this.ExpandAndSelect();
if(rerender){
   this.Render();
   }
else {
   this.RenderBody();
   var F = this.GetFixedRows(); for(var i=0;i<F.length;i++) {
      if(typeof(F[i].Def)=="string") {
         var D = this.Def[F[i].Def];
         if(!D) D = this.Def["R"];
         F[i].Def = D;
         }
      this.RefreshRow(F[i]);
      }
   for(var r=this.XS.firstChild;r;r=r.nextSibling) this.RefreshRow(r);
   MS.Gantt;
   if(this.Gantt){
      for(var col in this.Cols) if(this.Cols[col].Type=="Gantt") {
         var c = this.Cols[col];
         if(c.Visible && !c.Hidden) { c.Visible = 0; c.Hidden = 1; this.ShowCol(col); }
         if(this.GanttPaging) this.SetGanttHeader(col,1,1);
         }
      }
   ME.Gantt;
   this.HideMessage();
   if(BIEA) { var T = this; setTimeout(function(){ T.ShowPages(); },10); }
   MS.Debug; this.Debug(4,"Reloading body finished in ",this.EndTimer("ReloadBody")," ms"); ME.Debug;
   }
this.setTotalCols(1);//****重新计算汇总列
this.ReloadReason = null;
if(Func) Func(result);
}
// -----------------------------------------------------------------------------------------------------------
ME.ReloadBody;
MS.Upload;
// -----------------------------------------------------------------------------------------------------------
MS.EditMask;
// Validates all ResultMasks before save changes
TGP.ActionValidate = function(dummy,T,row){
if(T) return !!this.Validate;
if(!this.Validate) return true;
MS.Animate; this.FinishAnimations(); ME.Animate;
if(this.EditMode) this.EndEdit(1);
T = this;
var R = [], C = [], p = 0, V = this.Validate, F = "added,changed,all,confirm,focus,edit,text,noerror,deleted,error,messages";
if(V-0+""==V) {
   V = this.BitArrayToFlags(V,F);
   if(V["all"]) delete V["added"];
   }
else V = this.ConvertFlags(V,F);
var all = V["all"], del = V["deleted"], chg = V["changed"], E = this.GetErrors("Validate"), Err = [];
function validate(r,cols){
   if(!del && r.Deleted || r.NoUpload) return;
   var chgc = 0, chgonly = !all && !r.Added;
   for(var i=0;i<cols.length;i++){
      var c = cols[i];
      if(chgonly&&!r[c+"Changed"]||T.Cols[c]&&T.Cols[c].NoUpload) continue;
      var ov = T.GetString(r,c,7), err = 0, error = r[c+"Error"]; r[c+"Error"] = null;
      var v = T.CheckMask(r,c,ov,E);
      if(v!=ov) err = 1;
      else if(error && V["error"]) { err = 1; E.Errors.push([error,r,c,v]); }
      if(Grids.OnValidate) { var tmp = Grids.OnValidate(T,r,c,err,E); if(tmp!=null) err = tmp; }
      if(error && !r[c+"Error"] && !V["clearerror"]) r[c+"Error"] = error;
      if(err) { R[p] = r; C[p] = c; Err[p] = error;  p++; }
      }
   if(chgc) T.UpdateRowHeight(r);
   }
if(row) {
   if(all || row.Added || chg&&row.Changed) for(var j=0;j<this.ColNames.length;j++) validate(row,this.ColNames[j]);
   }
else {
   for(var r = this.GetFirst();r;r=this.GetNext(r)){
      if(all || r.Added || chg&&r.Changed) for(var j=0;j<this.ColNames.length;j++) validate(r,this.ColNames[j]);
      }
   if(all||chg){
      var F = this.GetFixedRows();
      for(var i=0;i<F.length;i++) if(F[i].Kind=="Data" && (all||F[i].Changed)) for(var j=0;j<this.ColNames.length;j++) validate(F[i],this.ColNames[j]);
      for(var r = this.XS.firstChild;r;r=r.nextSibling) if(r.Kind=="Space" && (all||r.Changed)) validate(r,r.Cells);
      }
   }
if(!p) return true;
if((V["focus"]||V["edit"]||V["confirm"]) && !this.EndEditAll()) return false;
var err = true;
if(Grids.OnValidateError){
   var rr = Grids.OnValidateError(this,R,C);
   if(rr==1) return false;
   if(rr==2) err = false;
   }
if(err&&!this.AutoUpdate){
   if(V["messages"]) {
      var txt = this.ProcessErrors(E), txt2 = this.ValidateMessage; if(!txt2) txt2 = this.ValidateText;
      txt = txt&&txt2 ? txt2+"<br>"+txt : (txt2?txt2:txt);
      if(txt){
         txt = txt.replace("%1",p);
         if(V["confirm"]){
            txt = txt.replace(/<br\s*\/?>/gi,"\n").replace(/&nbsp;/gi," ").replace(/<\/?\w+[^>]*>/g,"");
            if(this.Confirm(txt)) err = false;
            }
         else {
            var time = this.ValidateMessageTime; if(time==null) time = this.EditErrorsMessageTime;
            this.ShowMessageTime(txt,E.MessageTime==null?time:E.MessageTime,function(){
               if(V["focus"]||V["edit"]) T.Focus(R[0],C[0],null,null,1);
               if(V["edit"]) T.StartEdit();
               });
            }
         }
      }
   else {
      var text = "", html = "";
      if(V["text"]) { text = this.GetAttr(R[0],C[0],"ResultText"); html = this.GetAttr(R[0],C[0],"ResultMessage"); }
      text = text ? (this.ValidateText?this.ValidateText+"\n":"") + text : this.ValidateText;
      html = html ? (this.ValidateMessage?this.ValidateMessage+(V["confirm"]?"\n":"<br/>"):"") + html : this.ValidateMessage;
      if(text) text = text.replace("%1",p);
      if(html) html = html.replace("%1",p);
      if(V["confirm"] && !text) { text = html; html = null; }
      if(html) {
         var time = this.ValidateMessageTime; if(time==null && V["text"]) time = this.GetAttr(R[0],C[0],"ResultMessageTime");
         this.ShowMessageTime(html,time,function(){
            if(V["focus"]||V["edit"]) T.Focus(R[0],C[0],null,null,1);
            if(V["edit"]) T.StartEdit();
            });
         }
      else if(text){
         if(!V["confirm"]) this.Alert(text);
         else if(this.Confirm(text)) err = false;
         }
      }
   }
if(err && !V["noerror"]){
   for(var i=0;i<p;i++) if(!Err[i]){
      var e = this.GetAttr(R[i],C[i],"ResultText");
      if(!e) e = this.GetAlert("Invalid");
      R[i][C[i]+"Error"] = e;
      this.RefreshCell(R[i],C[i]);
      }
   }
MS.Undo;
if(this.Undo&1 && !V["noerror"]) {
   var us = 0;
   for(var i=0;i<p;i++) if(err?R[i][C[i]+"Error"]!=Err[i]:Err[i]) {
      if(!us) { this.UndoStart(); us = 1; }
      this.AddUndo({Type:"Error",Row:R[i],Col:C[i],OldVal:Err[i],NewVal:err?R[i][C[i]+"Error"]:null},2);
      }
   if(us) { this.UndoEnd(); this.CalculateSpaces(1); }
   }
ME.Undo;
if(!err){
   if(!V["noerror"]) for(var i=0;i<p;i++) if(R[i][C[i]+"Error"]) { R[i][C[i]+"Error"] = null; this.RefreshCell(R[i],C[i]); }
   return true;
   }
if(this.AutoUpdate) {
   setTimeout(function(){
      if(V["focus"]) T.Focus(R[0],C[0],null,null,1);
      if(V["edit"] && T.Focus(R[0],C[0],null,null,1)!=null) T.StartEdit();
      },10);
   }
else if(!html) {
   if(V["focus"]) this.Focus(R[0],C[0],null,null,1);
   if(V["edit"] && this.Focus(R[0],C[0],null,null,1)!=null) this.StartEdit();
   }
return false;
}
ME.EditMask;
// -----------------------------------------------------------------------------------------------------------
// Saves data according chosen upload type
TGP.Save = function(event){
var D = this.Source.Upload;
if(this.Locked["save"] || this.EditMode && this.EndEdit(1)==-1) {
   if(event) CancelEvent(event);
   return false;
   }
MS.Pivot; if(this.PivotGrid) return this.PivotGrid.Save(event); ME.Pivot;
MS.Master$Pivot;
for(var i=0;i<Grids.length;i++){
   var G = Grids[i];
   if(G && G!=this && (G.MasterGrid==this||G.PivotGrid==this) && G.EditMode && G.EndEdit(1)==-1){
      if(event) CancelEvent(event);
      return false;
      }
   }
ME.Master$Pivot;
if(event && this.ActionValidate && !this.ActionValidate()) return false;
if(Grids.OnSave && Grids.OnSave(this)){ this.HideMessage(); return false; }
MS.Animate; this.FinishAnimations(); ME.Animate;
MS.Gantt; if(this.GanttDependency&&!this.AutoUpdate) this.RemoveDeletedDependencies(); ME.Gantt;
MS.Ajax;
if(D.Url||D.Script){
   MS.Debug; this.StartTimer("Save"); this.Debug(4,"Saving data to server to ",this.DebugDataGetName(D)); ME.Debug;
   var T = this, val = this.GetXmlData();
   if(Grids.OnUpload){ var v = Grids.OnUpload(this,val); if(v!=null) val = v; }
   this.ReloadReason = "Upload";
   this.AjaxCall(D,val,function(result){
      if(result>=0) T.AcceptChanges();
      T.HideMessage();
      T.ReloadReason = null;
      if(Grids.OnAfterSave) Grids.OnAfterSave(T,result);
      //***if(result>=-9 && result<=-2) T.ShowMessageTime(T.GetText("ErrorSave"),0);//**去掉自带出错提示
      else {
         MS.Paging; if(!T.Cleared) T.ShowPages(); ME.Paging;
         MS.Debug; T.Debug(4,"Data saved to server sucessfully in ",T.EndTimer("Save")," ms"); ME.Debug;
         }
      });
   return;
   }
ME.Ajax;
MS.Submit;
if(D.Tag){
   var I = this.GetInput(D.Tag);
   MS.Debug;
   if(!I && (D.Tag+"").toLowerCase()=="debug"){
       var val = this.GetXmlData();
      if(Grids.OnUpload){ var v = Grids.OnUpload(this,val); if(v!=null) val = v; }
      this.Debug(1,"Upload_Tag is set to \"Debug\", so the data are not uploaded, just printed here");
      this.DebugData(D,val,":");
      this.AcceptChanges();
      if(Grids.OnAfterSave) Grids.OnAfterSave(this,0);
      MS.Paging; if(!this.Cleared) this.ShowPages(); ME.Paging;
      return false;
      }
   ME.Debug;
   if(I) {
      if(this.Focused==null) this.SetFocused();
      var val = this.GetXmlData();
      if(Grids.OnUpload){ var v = Grids.OnUpload(this,val); if(v!=null) val = v; }
      I.value = D.Xml-0 ? val : val.replace(/\&/g,"&amp;").replace(/\</g,"&lt;").replace(/>/g,"&gt;");
      }
   var F = this.GetForm(I);
   if(F){
      F.method = "POST";
      if(this.FormSubmit && !this.FormSubmit(event)){ this.HideMessage(); return false; }
      if(!event) F.submit();
      return true;
      }
   else {
      MS.Debug; this.Debug(1,"Cannot submit data to server, no <form> tag found"); ME.Debug;
      this.HideMessage();
      return false;
      }
   }
ME.Submit;
if(D.Data){
   this.AddDataFromSource(this.PrepareData(D.Data,D),D);
   var Q = this.IO;
   if(Q && Q.Message) this.Alert(Q.Message);
   if(!Q || Q.Result==null || Q.Result>=0) this.AcceptChanges();
   if(Q && Q.HtmlMessage) this.ShowMessageTime(Q.HtmlMessage,Q.HtmlMessageTime);
   else this.HideMessage();
   return;
   }
this.HideMessage();
}
// -------------------------------------------------------------------------------------------------
TGP.ActionSave = function(dummy,T){
if(!this.Source.Upload.Url&&!this.Source.Upload.Script&&!this.Source.Upload.Tag&&!this.Source.Upload.Data||this.Detail||this.Locked["save"]) return false;
if(T) return true;
if(!this.EndEditAll()) return false;
return this.Save();
}
// -------------------------------------------------------------------------------------------------
ME.Upload;
MS.Check;
// -------------------------------------------------------------------------------------------------
// Called in interval for all Check_Url
function GridsCheck(){
for(var i=0;i<Grids.length;i++){
   var G = Grids[i];
   if(G && !G.Cleared && (G.Source.Check.Url||G.Source.Check.Script) && G.Source.Check.Interval && !G.Loading && !G.Rendering && !G.Disabled && G.CheckInterval!=null) {
      if(++G.CheckInterval>=G.Source.Check.Interval) {
         G.CheckInterval = 0;
         G.CheckForUpdates();
         }
      }
   }
}
// -----------------------------------------------------------------------------------------------------------
// Checks if server contains some changes, uses Check_Url
TGP.CheckForUpdates = function(Func){
if(this.CheckingForUpdates || this.ReloadReason) return;
var T = this, D = this.Source.Check, req;
this.CheckingForUpdates = 1; this.ReloadReason = "Check";
if(D.Format.toLowerCase()=="json") req = "{\"IO\":{"+(this.Source.Session!=null?"\"Session\":\""+this.Source.Session+"\"":"")+"}}";
else req = "<Grid><IO"+(this.Source.Session!=null?" Session=\""+this.Source.Session+"\"":"")+"/></Grid>";
this.AjaxCall(D,req,function(result){
   T.CheckingForUpdates = 0; T.ReloadReason = null;
   if(result<0) {
      if(T.Repeat==3 || T.Repeat==2 && T.Confirm(T.GetAlert("ErrCheck"))) T.CheckForUpdates(Func);
      else {
         if(T.Repeat==0) T.Alert("ErrCheckEnd");
         T.Source.Check.Interval = 0;
         }
      }
   if(Func) Func(result);
   });
}
// -----------------------------------------------------------------------------------------------------------
ME.Check;
// -----------------------------------------------------------------------------------------------------------
// Returns updated url for basic treegrid data sources, adds also ? for caching
TGP.GetUrl = function(url,cache){
if(cache==null) cache = this.Cache;
if(cache==3 || !url || (url+"").search(/\#|^javascript\:/i)>=0) return url;
var v =null;//**** by 2014-12-6 去掉刷新,保留缓存。 cache==1 ? Component.Version.replace(/\s/g,"") : (cache==2 ? this.CacheVersion : Grids.CacheVersion);
 if(this.Data.fileTime!=undefined){//*** 增加时间刷新
 if(url.indexOf("Defaults.xml")>-1){
     v=this.Data.fileTime.d;
}else if(url.indexOf("Text_cnzh")>-1){
    v=this.Data.fileTime.t;
}else if(url.indexOf("grid_")>-1){
    v=this.Data.fileTime.c;
}
}
if(v==null) return url;
return url + ((url+"").indexOf('?')>=0 ? "&" : "?") + "tgc="+escape(v);
}
// -----------------------------------------------------------------------------------------------------------
Grid/DataIn.js
@@ -39,6 +39,33 @@
                   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<pageUrl.length;i++){
                         if(i==pageUrl.length-3){
                             pageUrl[i]=formInfo[0];
                         }else if(i==pageUrl.length-2){
                             pageUrl[i]=formInfo[1];
                         }else if(i==pageUrl.length-1){
                             pageUrl[i]="index.jsp?"+(new Base64().encode("where=doccode='"+formInfo[2]+"'"));
                         }
                    }
                   parent.jQuery(parent.jQuery("#home-tabs").find("li.tabs-selected > a > span.tabs-title")).html(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)
@@ -61,9 +88,9 @@
                      else{
                           type="commit";
                       }
                  OpenPayAndRefund(new Base64().decode(data[0]),type,this.formid);
                  OpenPayAndRefund(new Base64().decode(tempDoccode[0]),type,this.formid);
                  }else{
                    this.tempCode=data[0];
                    this.tempCode=tempDoccode[0];
                    fl=data[2];
                  if(this.aflg==3){//由于确定时先调用保存,所以在这里作判断
                    this.doccode=this.tempCode;
@@ -76,7 +103,7 @@
                        if(procCallBack){
                        procCallBack(data[5],1,0);
                    }else{
                        alert(data[5]);
                        this.showMsgAlert(data[5]);
                    }
                    }
                    this.cM1(data[3],fl);
@@ -94,7 +121,7 @@
                        // by 2015-10-16最新修改,不需要这样了,保存和确认合并一起操作。by 2015-4-27 表示确认出错,需要刷新当前页面,避免还是新单状态,再确认时会生成重复单的问题
                        // this.cM1(Xml.split("#|#")[4],2);
                         tsr=Xml.split("#|#")[1];
                          alert(tsr);
                                            this.showMsgAlert(tsr);
                           this.callback(false,false);//执行成功失败
                    }else if(Xml.indexOf("datacheckError#|#")==0){//数据范围检查返回
                        var check=2;
@@ -105,14 +132,14 @@
                        this.callback(Xml.replace("datacheckError#|#",""),check);
                        return null;
                    }else if(Xml.indexOf("pushError#|#")==0){//推送出错返回
                        alert(Xml.split("#|#")[1]);
                        this.showMsgAlert(Xml.split("#|#")[1]);
                      location.href=document.URL;
                        }else{
                    alert(Xml);
                    this.showMsgAlert(Xml);
                    this.callback(false,false);//去掉加载层
                  }
                 }else{
                     alert(Xml);
                     this.showMsgAlert(Xml);
                }
          }
      return null; 
Grid/DataIn.js.bak
New file
@@ -0,0 +1,238 @@
// -----------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------
var CNodeSec = {"LeftCols":0,"Cols":1,"RightCols":2};
// -----------------------------------------------------------------------------------------------------------
// Updates XML to begin with <Grid>, optionaly replaces entities, if it was coded
// Return null for error (no tag <Grid>)
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(/<!--[\s\S]*?-->/g,"");
var fr = Xml.search(/\<Grid\s*\>/);
if(fr<0) {
   fr = Xml.search(/\&lt\;Grid(\>|\&gt\;)/);
   if(fr<0) {
      MS.Debug;
      this.Debug(1,"No tag <Grid> 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;
                   console.log("data[0]:"+data[0]);
                   var tempDoccode=data[0].split(",");
                   if(tempDoccode[1]!=undefined&&tempDoccode[1]!=""){
                     //linkDocInfo,表示有返回下一单的审核内容,保存到全局变量中
                     try{
                     top.approvedDoc.nextDoc=new Base64().decode(tempDoccode[1]);
                     }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){//推送出错返回
                        this.showMsgAlert(Xml.split("#|#")[1]);
                      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 <IO> 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(/\<IO(\s+\w+\s*\=\s*(\'[^\']*\'|\"[^\"]*\"))*\s*\/?\>/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<CX.length;i++) this.Cols[CX[i]].Pos--;
CX.splice(C.Pos,1);
if(next){
   var N = this.Cols[next];
   C.Pos = N.Pos; C.Sec = N.Sec;
   CX = this.ColNames[N.Sec];
   CX.splice(C.Pos,0,C.Name);
   for(var i=C.Pos+1;i<CX.length;i++) this.Cols[CX[i]].Pos++;
   }
else {
   CX = this.ColNames[sec!=null?sec:C.Sec];
   C.Pos = CX.length;
   CX[CX.length] = C.Name;
   }
}
// -----------------------------------------------------------------------------------------------------------
Grid/Filter.js
@@ -199,12 +199,14 @@
//if(!this.Filtered) return;//****去掉限制
/***去掉客户端过滤代码
MS.Paging;
if(this.MainCol!=undefined&&this.MainCol!=""){
if(this.Paging==3 && (!(this.OnePage&2) || this.AllPages)){  
   if(Grids.OnCanFilter && !Grids.OnCanFilter(this,0) || Grids.OnFilter && Grids.OnFilter(this,0)) return;
    if(!this.AllPages) this.FPage = 0;
     this.ReloadBody(null,0,"Filter"); 
     return; 
   }
}
ME.Paging;
*/
this.BuildFilter();
Grid/Paste.js
@@ -55,7 +55,13 @@
   }
if(Grids.OnGetRowText) { var tmp = Grids.OnGetRowText(this,row,cols,txt,sel); if(tmp!=null) txt = tmp; }
if(this.CopyPasteTree) for(var r=row.parentNode;r&&!r.Page;r=r.parentNode) ch = (ch?ch:"") + CVoidChar;
txt = (ch?ch:"") + txt + "\r\n";
  //***表明是选中一行的情况,需要回车换行符
if(row.Selected==1){
   txt = (ch?ch:"") + txt+ "\r\n";
}else{
   txt = (ch?ch:"") + txt;//*****去掉\r\n + "\r\n");
}
if(this.CopyPasteTree && this.CopyPasteTree!=4 && row.firstChild && (row.Expanded||this.CopyPasteTree>=2)){
   ch = (ch?ch:"") + CVoidChar;
   for(var r=row.firstChild;r;r=r.nextSibling) if(r.Visible||this.CopyPasteTree==3) txt += this.GetRowText(r,cols,sel,ch);
Words/EAPIGlobals.txt
@@ -1,4 +1,22 @@
; ======= Global properties =======
excludeDocs
title
href
tab
options
html
frameName
T_Grid
tabs
is31
inThisFrame
approvedDoc
nextDoc
hide
redirect
messager
val
noItemShow
setcolorby46
istran
refkeyDelValue
Words/EAPIProperties.txt
@@ -1,4 +1,22 @@
; ======= Global properties =======
excludeDocs
title
href
tab
options
html
frameName
T_Grid
tabs
is31
inThisFrame
approvedDoc
nextDoc
hide
redirect
messager
val
noItemShow
setcolorby46
istran
refkeyDelValue
core.js
@@ -229,7 +229,9 @@
                var tempArray=[]; 
                for(var j=0;j<items.length;j++){
                        var it=items[j];
                        if(it.Name!="Panel"&&
                        var col=grid.Cols[it.Name];
                        var flag=(col!=undefined&&col.noItemShow!=undefined&&col.noItemShow==1)?false:true;//隐藏字段不需要显示
                        if(flag&&it.Name!="Panel"&&
                        it.Name!="RowAR1"&&
                        it.Name!="RowHeader"&&
                        it.Name!="RowFilter1"&&
@@ -395,7 +397,16 @@
    }
};
//---------------------------------------------------------------------------------------------------------相关功能实现----------------------------------
TGP.showMsgAlert = function (str) {
            if(str==undefined||str=="") return;
            $("#loading").hide();//****出错需要关闭层
         var info=str.split("@p@");
        top.$.messager.alert("\u63d0\u793a\u4fe1\u606f", '<div style="line-height: 18px;">'+info[0]+"</div>","warning",function(){
            if(info.length>1){
        top.redirect(info[1]);
        }
            });
};
TGP.getCookie = function () {
    //从服务器加载cookie
    var g = this;
@@ -479,6 +490,35 @@
    this.SetAttribute(row, null, "Color", "yellow", 1);
};
TGP.processType46=function(row,col){
                var keys=null;
                var Orgkeys=null;
                var values=null;
                var newValues="";
                if(row[col + "EnumKeys"]!=undefined){
                 keys=row[col + "EnumKeys"].split("|");
                 values=row[col + "Enum"].split("|");
                 Orgkeys=row[col + "EnumKeys"];
                }else{
                    keys=this.Cols[col].EnumKeys.split("|");
                    values=this.Cols[col].Enum.split("|");
                    Orgkeys=this.Cols[col].EnumKeys;
                }
                for(var i=0;i<keys.length;i++){
                    if(keys[i]==" "){
                        newValues+="| ";
                    }else if(keys[i]!=""){
                    newValues+="|<div style=background:"+keys[i]+">&nbsp;</div>";
                    }
                }
                if(newValues!=""){
                row[col + "Enum"]=newValues;
                row[col + "EnumKeys"]=Orgkeys;
                this.Cols[col].EnumKeys=Orgkeys;
                this.Cols[col].Enum=newValues;
                }
};
TGP.initDysql = function (y, x, val, flg) {
    var g = this;
    if (g.Cols[x].dySql == undefined) return;
@@ -500,9 +540,12 @@
                y[x + "Defaults"] = P[1];
            } else {
                g.Cols[x].EnumKeys = P[0];
                g.Cols[x].Enum = P[1];
                y[x + "EnumKeys"] = P[0];
                g.Cols[x].Enum = P[1];
                y[x + "Enum"] = P[1];
                if(g.Cols[x].colType==46){
                    this.processType46(y,x);
                }
                if (flg == undefined && val != undefined) y[x] = val;
            }
            g.RefreshCell(y, x);
@@ -535,6 +578,9 @@
                    y[x + "EnumKeys"] = P[0];
                    y[x + "Enum"] = P[1];
                    // if(val!=undefined) y[x]=val;
                    if(K.Cols[x].colType==46){
                        K.processType46(y,x);
                    }
                }
                g.dyarryValue[Cd] = O;//保存当前的数据,以便查询相同的时候直接返回
                K.RefreshCell(y, x);
@@ -770,6 +816,13 @@
    }
    */
    B["disableDuplicateSubmitUUID"]=this.uuid;
    try{
    if(top.approvedDoc&&top.approvedDoc.excludeDocs!=""){
    B["excludeSelectNextDocument"]=top.approvedDoc.excludeDocs;
    }
   }catch(e){
    console.log(e);
   }
    B["btnId"] = this.btnId;
    B["dcFlag"] = this.flag;
    B["masterCode"] = gridInt.mastercode;//by 11-12-30 10类型参数转换关键字
@@ -952,12 +1005,15 @@
                            var c = this.Cols[e];
                            if (c.Type == "Bool" && (r[c.Name + "CanEdit"] == 1) && c.Name != 'hasiconpermission') {
                                //是checkbox且不为只读的,by 2014-8-27 排除大图标全选或全不选功能,by2015-5-11  增加大图标全选或全不选功能&&c.Name!='hasiconpermission'
                                var t = (y.formnameChecked == 1 || y.formnameChecked == 2) ? 0 : 1;
                                if(t==1){
                                    //全取消时,需要把这几个值也清空,全选则跳过
                                if (c.Name == "iscopyrow" || c.Name == "iscopydoc"
                                    || c.Name == "isimport" || c.Name == "isexport"
                                    || c.Name == "isreportdesign") {
                                    continue;
                                }
                                var t = (y.formnameChecked == 1 || y.formnameChecked == 2) ? 0 : 1;
                            }
                                this.SetValue(r, c.Name, t, true);
                                this.SetValue(r, "isopen", t, true);
                            }
@@ -1059,6 +1115,9 @@
                    T.Cols[x].Enum = s[1];
                    row[x + "EnumKeys"] = s[0];//"|a|b|c";
                    row[x + "Enum"] = s[1];//"|a|b|c"; 
                    if(T.Cols[x].colType==46){
                    T.processType46(row,x);
                    }
                }
                if (this.dyarryValue == undefined) this.dyarryValue = [];
                this.dyarryValue[Cd] = R;
@@ -1129,6 +1188,7 @@
            }
        }
    }
    if (this.gType == 4 || this.gType == 3 || this.gType == 30 || this.gType == 301 || this.gType == 1) {//4类型
        for (var i in this.Cols) {
            var $ = this.Cols[i].Name;
@@ -1192,9 +1252,13 @@
        if (!$) { continue; }
        if (this.RowCount == 0 && (this.defaultRowCount == undefined || this.defaultRowCount == 0)) {
            //清除旧的统计内容 by 2021-10-19
            try{
            this.Rows["Fix1"][$.Name]="";
            this.RefreshCell(this.Rows["Fix1"],$.Name);
             continue; 
            }catch(e){
                continue;
            }
            }
        if (this.Cols[this.totalColsID[j] + "_expr"] != undefined) {
            var exid = this.totalColsID[j] + "_expr";
@@ -1301,6 +1365,7 @@
            types = "";
            flg = true;
            ftype = null;
            this.RefreshRow(this.Rows["Fix1"]);
        }
    }
    if (this.Data && this.Data.foot2) {
@@ -1309,6 +1374,7 @@
            this.Rows["Fix1"][foot[i]] = "\n";
            this.RefreshCell(this.Rows["Fix1"], foot[i]);
        }
        this.RefreshRow(this.Rows["Fix1"]);
    }
    if (this.cp == 1) {//表示复单操作,需要作为Added=1 by2013-10-18
        var A = this.Rows;
@@ -1380,8 +1446,11 @@
    }
};
TGP.dbPopCont = function (record, col, fl) {
    if (!fl && (record.Kind != "Data" || record.id == "Fix1" || (typeof inChangFrame == "undefined"))) { return; }
    var p_frame = parent.frames[inChangFrame];
    if (!fl && (record.Kind != "Data" || record.id == "Fix1" )) { return; }
    //tabindex为当前页卡索引,每次切换回来都会取到当前的索引
    var p_frame= parent.frames[parent.jQuery(parent.jQuery(parent.jQuery('#home-tabs').tabs('getSelected')).find('iframe')[0]).attr("pframe")];
    var Cl_Grid=parent.jQuery(parent.jQuery(parent.jQuery('#home-tabs').tabs('getSelected')).find('iframe')[0]).attr("t_grid");
    //var p_frame = parent.frames[inThisFrame];//inChangFrame
    if (this.isNine != 'null' && p_frame == null) {//单据类型窗体表头弹出新页面
        if (!top.addTab) {
            window.open(this.isNine + "?isNew=iew&doccode='" + record["doccode"] + "'");
@@ -1394,8 +1463,8 @@
        var _ = this.Cols[col];
        this.popAttr(_, record, col, 2);
        if (p_frame) {
            if (C_Grid != "") {
                var gr = eval('(' + C_Grid + ')');//弹出的父页面传过来的信息
            if (Cl_Grid != "") {
                var gr = eval('(' + Cl_Grid + ')');//弹出的父页面传过来的信息
                var pa = p_frame.Grids[gr.gridID];//得到grid
                if (pa && gr.clickGrid) {
                    pa.clickDb = true;
@@ -1777,7 +1846,9 @@
                            }
                        }
                        if (indexd) {
                            V[id] = keys[indexd];
                            //V[id] = keys[indexd];
                            //直接给值会造成修改状态不会变化,所以换成SetValue方法,会增加Orig标记
                            this.SetValue(V, s, keys[indexd], flg);
                        } else {//什么都不是,则把这个值作为下拉的实际值和显示值
                            var ss = this.getGoalValue(vl);
                            var temp = ((ss == 'null' || ss == undefined) ? vl : ss);
@@ -1908,8 +1979,8 @@
                var s = {};
                s.formParm = st[2];
                s.toParm = "cv" + fl + ";cv" + fl + "name";
                gt.setGridInfoTOPop(s, gt, row);
                parent.addTab("", st[0], st[1], "", path + sf);
                var data=gt.setGridInfoTOPop(s, gt, row);
                parent.addTab("", st[0], st[1], "", path + sf,null,null,data);
            } else {
                if (row[col] != "") {
                    alert(row[gt.glcodefield.toLowerCase()] + gt.GetText("GLcheckEmy") + row[col] + gt.GetText("GLcheckEmy1"));
@@ -1919,6 +1990,8 @@
                    to.push("cv" + fl + "name");
                    gt.threePop(va, to, row);
                    gt.EndEdit(0);
                }else{
                    alert(row[gt.glcodefield.toLowerCase()] + gt.GetText("GLcheckEmy") + row[col] + gt.GetText("GLcheckEmy1"));
                }
            }
        });
@@ -1964,8 +2037,8 @@
                        var s = {};
                        s.formParm = st[2];
                        s.toParm = "cv" + fl + ";cv" + fl + "name";
                        gt.setGridInfoTOPop(s, gt, row);
                        parent.addTab("", st[0], st[1], "", path + sf);
                        var data=gt.setGridInfoTOPop(s, gt, row);
                        parent.addTab("", st[0], st[1], "", path + sf,null,null,data);
                    } else {//一条记录
                        va = $.split(",");
                        var to = [];
@@ -2050,9 +2123,9 @@
                    var st = "";
                    if ($ == "#") {//不止一条记录
                        temp = temp != '' ? "?" + encodeText("where=" + temp) : "";
                        t.setGridInfoTOPop(_, t, row);
                        var data=t.setGridInfoTOPop(_, t, row);
                        _.path = _.path.replace("#spellPath#", spellPath);
                        parent.addTab("", _.formid, _.wtype, "", _.path + temp);
                        parent.addTab("", _.formid, _.wtype, "", _.path + temp,null,null,data);
                    } else {
                        if ($ == undefined) $ = "";
                        st = $.split("@p@");
@@ -2086,10 +2159,34 @@
    gr.gridID = t.Index + "";//当前页面Grid的id
    gr.clickGrid = "1";
    gr.is31 = this.is31;
    // if(parent.T_Grid!=undefined&&parent.T_Grid==GT.$json(gr)){
    //     return false;
    // }
    parent.T_Grid = GT.$json(gr);
    parent.changFrame = inThisFrame;
    this.is31 = false;
    var data={};
    data.T_Grid = GT.$json(gr);
    data.frameName =parent.jQuery(parent.jQuery(parent.jQuery('#home-tabs').tabs('getSelected'))).attr("id");//当前页卡名称,用于弹出窗返回值处理
    return data;
};
TGP.unicode=function(str){
    console.log("unicode:"+str);
    var value='';
    for (var i = 0; i < str.length; i++) {
        value += '\\u' + this.left_zero_4(parseInt(str.charCodeAt(i)).toString(16));
    }
    console.log("unicode2:"+value);
    return value;
 }
 TGP.left_zero_4=function(str) {
    if (str != null && str != '' && str != 'undefined') {
        if (str.length == 2) {
            return '00' + str;
        }
    }
    return str;
 }
TGP.popClick = function (row, col) {//点三点
    //    if(this.checkSeesionJs()){return ;}
    var _ = this.Cols[col];
@@ -2106,14 +2203,21 @@
            alue = rec[col].replace(/'/g, "''");//处理值是数字会出错的情况
        } catch (e) { }
        var sf = GT.threePop.setupParms(to, tep, df, filter, _.id, alue, _.formParm, rec, " like", false, false, true, false, this.Data.seInfo, null, null, null, null, this);
        this.setGridInfoTOPop(_, this, row);
        var data=this.setGridInfoTOPop(_, this, row);
        // if(this.hasPopFrame==data.T_Grid){
        //     return;
        // }else{
        //     this.hasPopFrame=data.T_Grid;
        // }
            _.path = _.path.replace("#spellPath#", spellPath);
            parent.addTab("", _.formid, _.wtype, "", _.path + sf);
            parent.addTab("", _.formid, _.wtype, "", _.path + sf,null,null,data);
    } else {
        this.popAttr(_, row, col, 1);
    }
};
//TGP.hasPopFrame="";//保存三点弹出的数据,避免重复打开
TGP.setcolorby46 = function (id) {
//id为颜色控件引用id
//console.log("id>>>"+id.id+","+id.value);
@@ -2367,19 +2471,46 @@
                    val = false;
                }
                if (temp != undefined && temp != null && (temp + "").match(/\s/)) {
                if (temp != undefined && temp != null && (temp + "").trim().length==0) {
                    //输入空格表示查询为空的内容
                    str += "(" + col + " is null or " + col + "=''" + ")"
                } else {
                    switch (row[col + "Filter"]) {//是用什么比较符,由于页面这里确定不了数值和字符,只能判断当前值是否为数值作为依据
                    var value="";
                    if((temp + "").trim().match(/\s+/)==null){
                        //不是以空格分隔
                    value=(temp+"").trim().replace(/,|;/g," ").split(/\s+/);
                    }else{
                        //以空格分隔
                        value=(temp+"").trim().split(/\s+/);
                    }
                    var index=row[col + "Filter"];
                    if(value.length>1){
                      index=1;
                    }
                    switch (index) {//是用什么比较符,由于页面这里确定不了数值和字符,只能判断当前值是否为数值作为依据
                        case 0:
                            break;
                        case 1:
                            var falg="";
                            if (val) {
                                str += col + " ='" + temp + "'";
                            } else {
                                str += col + " =" + temp;
                                falg="'";
                            }
                                if(value.length>1){
                                    str +="(";
                                    var arrayStr="";
                                    for(var i=0;i<value.length;i++){
                                        if(i==0){
                                            arrayStr+= col+"="+falg+(value[i]+"").replace(/'/g,"''")+falg;
                                        }else{
                                            arrayStr+= " or "+col+"="+falg+(value[i]+"").replace(/'/g,"''")+falg;
                                        }
                                    }
                                    str+=arrayStr.replace()+")";
                                }else{
                                     str += col + " ="+falg+ (temp+"").replace(/'/g,"''") + falg;
                                }
                            break;
                        case 2:
                            if (val) {
@@ -3099,13 +3230,15 @@
    //增加46控件的显示
    for (var c in this.Cols) {
        if(this.Cols[c].colType==46){
            if(this.Cols[c].Enum==undefined&&this.Cols[c].dysql==undefined){//弹出颜色拾取器
            V[c+"CanEdit"]=0;
            V[c+"HtmlPrefix"]="<div style=\"background:#ffffff\"><input title=\"&#x53CC;&#x51FB;&#x9009;&#x53D6;&#x989C;&#x8272;\" type=\"color\"  style=\"width: 100%;height:25;border: none;\" value=\"#ffffff\" id=\""+c+"_color\" onchange=\"Grids["+this.Index+"].setcolorby46(this);\"/>";
            V[c+"HtmlPrefix"]="<div style=\"background:#cccccc\"><input title=\"&#x53CC;&#x51FB;&#x9009;&#x53D6;&#x989C;&#x8272;\" type=\"color\"  style=\"width: 100%;height:25;border: none;\" value=\"#cccccc\" id=\""+c+"_color\" onchange=\"Grids["+this.Index+"].setcolorby46(this);\"/>";
            V[c+"HtmlPostfix"]="</div>";
            }
        }
        if(this.Cols[c].colType==47){
            V[c+"CanEdit"]=0;
            V[c+"HtmlPrefix"]="<div class=\"progress\" style=\"height: 25;\"><div class=\"progress-bar\" style=\"width:0%\"></div>";
            V[c+"HtmlPrefix"]="<div class=\"progress\" style=\"background:#ccc;position: relative;height: 18;\"><div class=\"progress-bar\" style=\"width:0%\"></div><div style=\"color:#fff;line-height: 18px;position: absolute;float: left;left: 50%;transform: translateX(-50%);\">0%</div>";
            V[c+"HtmlPostfix"]="</div>";
        }
    }
@@ -3586,6 +3719,32 @@
        //if(cl.Name=="")
        //console.log(cl.Name+">>"+cl.CanEdit+","+cl.Fformid+","+cl.Fwtype+","+A.Kind);
        if (A[cl.Name] == "null") { A[cl.Name] = ""; }
        if(cl.colType==47){
            var progress=0;
            if(A[cl.Name]!=""){
                progress=A[cl.Name];
                if(isNaN(parseFloat(progress))){//不是数值的情况
                    progress=0;
                }
            }
            progress=progress>1?1:progress;
            progress=progress<0?0:progress;
            A[cl.Name]=null;
            A[cl.Name+"CanEdit"]=0;
            progress=(progress*100);
            if((progress+"").indexOf(".")>0){
                progress=progress.toFixed(2);
            }
            var htmlperfix="<div class=\"progress\" style=\"background:#ccc;position: relative;height: 18;\"><div class=\"progress-bar\" style=\"background-color: rgb(102, 153, 204);width:"+progress+"%\"></div>";
                htmlperfix+="<div style=\"color:#fff;line-height: 18px;position: absolute;float: left;left: 50%;transform: translateX(-50%);\">"+progress+"%</div>";
            A[cl.Name + "HtmlPrefix"]=htmlperfix;
            A[cl.Name+"HtmlPostfix"]="</div>";
            if(cl.Fformid && cl.Fformid !== "" && cl.Fwtype && cl.Fwtype !== "" && A.Kind == "Data"){
            A[cl.Name+"HtmlBy47"]=htmlperfix+"</div>";//保存47的内容,如果设置了超链接需要用到
            A[cl.Name + "HtmlPrefix"]=null;
            A[cl.Name+"HtmlPostfix"]=null;
            }
        }
        if (cl.CanEdit != undefined && cl.CanEdit == 0 && cl.Fformid && cl.Fformid !== "" && cl.Fwtype && cl.Fwtype !== "" && A.Kind == "Data") {//只读且有弹出内容需要转换为<a>....</a>
            //定义需要传递给弹出窗口的参数
            //console.log("aaaaa>>");
@@ -3628,13 +3787,16 @@
                sf = sf.replace(/@P@/g, "").replace(/\s+/g, "%20");
                //console.log(sf);
            } catch (e) { }
            var htmlBy47="";
            if(A[cl.Name+"HtmlBy47"]!=undefined){
                htmlBy47=A[cl.Name+"HtmlBy47"];
            }
            if (eq === "@p@") {//表示是22类型 
                //Fop 0表示没界面弹出, 1表示正常的页卡,3表示弹出层显示  
                //Fref表示刷新方法:1表示刷新整页,2表示刷新表体(表格),3表示刷新表头
                if (A[cl.Name] != undefined&& A[cl.Name] != "") {
                if (htmlBy47!=""||(A[cl.Name] != undefined&& A[cl.Name] != "")) {
                    if (cl.Fop != undefined && cl.Fop == 3) {
                        A[cl.Name + "HtmlPrefix"] = "<a  href=\"javascript:void(0);\"  onclick=showLayerGrid(\"" + path + "?where=" + sf + "\"," + cl.Fref + ")>";
                        A[cl.Name + "HtmlPrefix"] = "<a  href=\"javascript:void(0);\"  onclick=showLayerGrid(\"" + path + "?where=" + sf + "\"," + cl.Fref + ")>"+htmlBy47;
                        A[cl.Name + "HtmlPostfix"] = "</a>";
                        //A[cl.Name]="<a href=\"javascript:void(0);\"  onclick=showLayerGrid(\"" +path+ "?where=" + sf  + "\",2)>"+A[cl.Name]+"</a>";    
                        //console.log(cl.Name+"cl.Name>>>>"+A[cl.Name+"Link"]);    
@@ -3644,7 +3806,7 @@
                        //console.log("2222>>>>"+sf)
                        str = formid + "," + type + ",\"" + sf + "\"," + "\"" + cl.FdField + "\",'" + cl.Fop + "',\"\",\"\",\"\",\"\",\"\",'" + (cl.Fref) + "',\"\"," + cl.Fsave + ",\"\",'" + exec + "'";
                        //A[cl.Name] = "<a style=\"cursor: pointer\" href=\"javascript:void(0);\"  onclick=parent.topFrame.funcLink(" +  this.Escape(str) + ")>" + A[cl.Name] + "</a>"
                        A[cl.Name + "HtmlPrefix"] = "<a  href=\"javascript:void(0);\"  onclick=parent.topFrame.funcLink(" + this.Escape(str) + ")>";
                        A[cl.Name + "HtmlPrefix"] = "<a  href=\"javascript:void(0);\"  onclick=parent.topFrame.funcLink(" + this.Escape(str) + ")>"+htmlBy47;
                        A[cl.Name + "HtmlPostfix"] = "</a>";
                        //console.log(cl.Name+"cl.Name>>>>"+A[cl.Name+"Link"]);
                    }
@@ -3654,17 +3816,17 @@
            } else {
                str = "\"\"," + formid + "," + type + ",\"" + "where=" + sf + "\"";
                //console.log("333>>>>"+str)
                if (A[cl.Name] != undefined && A[cl.Name] != "") {
                if (htmlBy47!=""||(A[cl.Name] != undefined && A[cl.Name] != "")) {
                    try {
                        if (A[cl.Name] != null && !(A[cl.Name] + "").match(/<("[^"]*"|'[^']*'|[^'">])*>/g)) {
                        if (htmlBy47!=""||(A[cl.Name] != null && (cl.colType==47||!(A[cl.Name] + "").match(/<("[^"]*"|'[^']*'|[^'">])*>/g)))) {
                            if (cl.Fop != undefined && cl.Fop == 3) {
                                //A[cl.Name]="<a href=\"javascript:void(0);\"  onclick=showLayerGrid(\"" +path+ "?where=" + sf  + "\",2)>"+A[cl.Name]+"</a>";
                                A[cl.Name + "HtmlPrefix"] = "<a href=\"javascript:void(0);\"  onclick=showLayerGrid(\"" + path + "?where=" + sf + "\",2)>";
                                A[cl.Name + "HtmlPrefix"] = "<a href=\"javascript:void(0);\"  onclick=showLayerGrid(\"" + path + "?where=" + sf + "\",2)>"+htmlBy47;
                                A[cl.Name + "HtmlPostfix"] = "</a>";
                                //console.log(cl.Name+"cl.Name>>>>"+A[cl.Name+"Link"]);
                            } else {
                                //A[cl.Name]="<a href=\"javascript:void(0);\"  onclick=top.addTab("+this.Escape(str.replace("%20",""))+")>"+A[cl.Name]+"</a>";
                                A[cl.Name + "HtmlPrefix"] = "<a  href=\"javascript:void(0);\"  onclick=top.addTab(" + this.Escape(str) + ")>";
                                A[cl.Name + "HtmlPrefix"] = "<a  href=\"javascript:void(0);\"  onclick=top.addTab(" + this.Escape(str) + ")>"+htmlBy47;
                                A[cl.Name + "HtmlPostfix"] = "</a>";
                                //console.log(cl.Name+"cl.Name>>>>"+A[cl.Name+"Link"]);
                            }
@@ -3841,6 +4003,7 @@
            }
        }
        if(cl.colType==46){
            if(cl.Enum==undefined&&cl.dysql==undefined){//弹出颜色拾取器
            var color="#ffffff";
            if(A[cl.Name]!=""){
                color=A[cl.Name];
@@ -3862,25 +4025,8 @@
                A[cl.Name+"HtmlPostfix"]="</div>";
            }
        }
        if(cl.colType==47){
            var progress=0;
            if(A[cl.Name]!=""){
                progress=A[cl.Name];
                if(isNaN(parseFloat(progress))){//不是数值的情况
                    progress=0;
                }
            }
            progress=progress>1?1:progress;
            progress=progress<0?0:progress;
            A[cl.Name]=null;
            A[cl.Name+"CanEdit"]=0;
            var htmlperfix="<div class=\"progress\" style=\"position: relative;height: 25;\"><div class=\"progress-bar\" style=\"width:"+(progress*100)+"%\"></div>";
            if(progress>0){
                htmlperfix+="<div style=\"line-height: 25px;position: absolute;float: left;left: 50%;\">"+(progress*100)+"%</div>";
            }
            A[cl.Name + "HtmlPrefix"]=htmlperfix;
            A[cl.Name+"HtmlPostfix"]="</div>";
        }
        //处理超链接问题,手机端和PC端需要用不同的方式
        if (this.browserRedirect()) {
            this.processPlatform(A, cl);
@@ -5140,6 +5286,31 @@
    }
};
GT.getElementByIdValue = function (el,id){
    if(el){
        var value=null;
        try{
     value=el.val();
     if(value==undefined){
         var ele=document.getElementById(id);
         if(ele!=null){
             value=ele.value;
         }else{
             value=null;
         }
             }
        }catch(e){
       value=document.getElementById(id).value;
       //console.log("elvalue="+value);
        }
    if(value!=null&&value!=""){
        if(value instanceof Array){
            value=value.join(";");
        }
    }
    return value;
}
};
GT.filterStr = function (filter, info, rec, grid) {
    var flg = false;
    if (filter instanceof Array) { flg = true; filter = filter.join(";"); }//因为有存在是数组的情况,转为字符串
@@ -5149,14 +5320,19 @@
            var va = temp[t];
            var vas = va.toLowerCase().replace("&", "").replace("&", "");
            var flgs = false;
            var vt = document.getElementById(vas);
        var vt = document.getElementById(vas);
            if (vt) {//只要存在有,则取里面的值,不然才需要找格线里面的值 by 2014-725 &&vt.value&&vt.value!=''&&vt.value!=='0'
                filter = filter.replace(new RegExp(va, "gm"), vt.value);
                if((vas+"").indexOf("@")<0){
                vt= jQuery("#"+vas);
            }else{
                vt=document.getElementById(vas);
            }
            var value=GT.getElementByIdValue(vt,vas);
                filter = filter.replace(new RegExp(va, "gm"), value);
                flgs = true;
            }
            if (!flgs) {
                var filterValue = GT.formatDateBy5(grid, rec, vas);
                filter = filter.replace(va, filterValue);
@@ -5232,11 +5408,10 @@
                }
                if (!GT.threePop.oneGrid) {
                    var f = document;
                    var v = f.getElementById(vts);
                    var v =f.getElementById(vts); 因为面板存在多选控件,原方法只会取到第一个值,而不是全部值
                    if (v) {//从上面开始向下查找,如果没这个字段定义才需要向格线找,不然是什么值就传什么,去掉&&v.value&&v.value!=''&&v.value!=='0'
                        if (m != 0) sf += "@P@" + eqs + "@P@";
                        var vt = v.value;
                        var vt =v.value;
                        try {
                            vt = isNaN(vt) ? vt.replace(/'/g, "''").replace(/\s/g, "") : vt;
                        } catch (e) {
core.js.bak
New file
Diff too large