主页面事件(数据接收事件)
Model.prototype.windowDialog2Receive = function(event){ // var TE_ProjectInfo = this.comp("TE_ProjectInfo"); //声明data var mainData = this.comp("mainData"); var detailData = this.comp("detailData"); var params = new biz.Request.ActionParam(); params.setString("sIDs", event.data); params.setString("currID",mainData.getCurrentRowID()); // 调用动作 var me = this; biz.Request.sendBizRequest({ "context" : this.getContext(), "action" : "Insertselectmaterialinformation", "parameters" : params, "callback" : function(data) { // data.ignoreError 是否忽略默认的异常处理,默认值true data.ignoreError = false; // data.state 请求返回状态,标识请求是否执行成功 if (data.state) { debugger; mainData.saveData(); detailData.refreshData(); } } }); };
弹出框确定事件(选中的传到主页面)
Model.prototype.result = function(){ //实现返回的逻辑 var dialogData = this.comp("dialogData"); var grid1 = this.comp("grid1"); var sIDs = grid1.getCheckeds(); for(var i=0;i<sIDs.length;i++){ var parent = dialogData.getValueByID("fParent",sIDs[i]); if(parent){ grid1.setRowChecked(parent,true); } } var sIDs = grid1.getCheckeds(); debugger; return sIDs; }; Model.prototype.OKBtnClick = function(event){ this.comp('wReceiver').windowEnsure(this.result()); };
sql语句实现
public static void Insertselectmaterialinformation(String currID,String sIDs){ System.out.println(sIDs); String uuid = CommonUtils.createGUID(); String strKsql = "select m,m.fParent as fParent,m.fMaterialType as fMaterialType,m.fNodeKind as fNodeKind,m.fTypeCode as fTypeCode from MaterCodeTable m where m in ('"+sIDs.replaceAll(",","','")+"')"; System.out.println(strKsql); Table table = KSQL.select(strKsql, null, "/SceneTeam/ClassDoor/data", null); Iterator<Row> rows = table.iterator(); while (rows.hasNext()) { Row row = rows.next(); String m = row.getString("m"); String fParent = row.getString("fParent"); String fMaterialType = row.getString("fMaterialType"); String fNodeKind = row.getString("fNodeKind"); String fTypeCode = row.getString("fTypeCode"); String isExist = "select m from MasterList m where m.fZBID='"+currID+"' and m like '%"+m+"%'"; Table t = KSQL.select(isExist, null, "/SceneTeam/ClassDoor/data", null); Iterator<Row> tRow = t.iterator(); if(tRow.hasNext()){ Row r = tRow.next(); String fid = r.getString("m"); uuid = fid.substring(0, 32); }else{ String inKsql = ""; if("".equals(fNodeKind) || fNodeKind=="" ||fNodeKind==null|| fNodeKind=="null"){ if("".equals(fParent) || fParent=="" || fParent==null || fParent =="null"){ inKsql = "insert into MasterList t (t,t.version,t.fMaterialType,t.fParent,t.fNodeKind,t.fTypeCode,t.fZBID,t.fListType) values('"+uuid+m+"',0,'"+fMaterialType+"','','"+fNodeKind+"','"+fTypeCode+"','"+currID+"','物资发放')"; }else{ inKsql = "insert into MasterList t (t,t.version,t.fMaterialType,t.fParent,t.fNodeKind,t.fTypeCode,t.fZBID,t.fListType) values('"+uuid+m+"',0,'"+fMaterialType+"','"+uuid+fParent+"','"+fNodeKind+"','"+fTypeCode+"','"+currID+"','物资发放')"; } }else{ if("".equals(fParent) || fParent=="" || fParent==null || fParent =="null"){ inKsql = "insert into MasterList t (t,t.version,tfMaterName,t.fParent,t.fNodeKind,t.fTypeCode,t.fZBID,t.fListType) values('"+uuid+m+"',0,'"+fMaterialType+"','','"+fNodeKind+"','"+fTypeCode+"','"+currID+"','物资发放')"; }else{ inKsql = "insert into MasterList t (t,t.version,t.fMaterName,t.fParent,t.fNodeKind,t.fTypeCode,t.fZBID,t.fListType) values('"+uuid+m+"',0,'"+fMaterialType+"','"+uuid+fParent+"','"+fNodeKind+"','"+fTypeCode+"','"+currID+"','物资发放')"; } } System.out.println(inKsql); KSQL.executeUpdate(inKsql, null, "/SceneTeam/ClassDoor/data", null); } } } }