您的位置:首页 > Web前端 > JavaScript

Ext调用规则返回json数据到页面

2014-03-19 10:59 197 查看
function formonload(){}

var store,grid;

Ext.onReady(function(){
   var url="WF_RunRule?openagent&RuleNum=RUK001_005";

   store =
new Ext.data.JsonStore({
   url:url,
   root:'root',
   fields:['FEEDBACK_ID','FEEDBACK_NUM','DEPT_NAME','SUBMITED_EMP','STAGE_CODE','SOURCE_CODE','EMERGENCY_LEVEL','CONTACT_EMP','CONTACTER_NUMBER','FEEDBACK_DATE','REQUIRE_COMPLETE_DATE']
   });
  
   store.load();
   var cm
= new Ext.grid.ColumnModel([
     new Ext.grid.RowNumberer(),
     {header:"反馈单编号",dataIndex:'FEEDBACK_NUM',sortable:true},
     {header:"提交部门",dataIndex:'DEPT_NAME',sortable:true},
     {header:"提交人",dataIndex:'SUBMITED_EMP',sortable:true},
     {header:"产生环节",dataIndex:'STAGE_CODE',sortable:true},
     {header:"来源类型",dataIndex:'SOURCE_CODE',sortable:true},
      {header:"紧急程度",dataIndex:'EMERGENCY_LEVEL',width:120},
     {header:"问题联系人",dataIndex:'CONTACT_EMP',sortable:true,width:120},
     {header:"联系电话",dataIndex:'CONTACTER_NUMBER',sortable:true,width:120},
     {header:"反馈时间",dataIndex:'FEEDBACK_DATE',sortable:true},
     {header:"要求解决时间",dataIndex:'REQUIRE_COMPLETE_DATE',sortable:true},
        
     {header:"headid",dataIndex:'FEEDBACK_ID',sortable:true,hidden:true},

     {header:"操作",dataIndex:'',renderer:function(){return
"<input type='button' value='启动流程' onclick='redirectToDoingPage()'>";}}

     ]);
 var pagingBar
= new Ext.PagingToolbar({displayMsg:
'当前显示 {0} - {1} 总计 {2}',emptyMsg:
"未找到符合条件的文档",pageSize:
30,store:
store,displayInfo:
true});
  
   grid =
new Ext.grid.GridPanel({
     store:store,
     cm:cm,
     bbar:pagingBar,
     width:document.body.clientWidth,
     height:document.body.clientHeight
   });
                 
 var vp
= new Ext.Viewport({
       layout:'border',
       items:[{region:'center',items:[grid]}],
       renderTo:Ext.getDom("grid")
 });

})

function redirectToDoingPage(){
   var id=grid.getSelectionModel().getSelected().id;
   var kid=store.getById(id).get("FEEDBACK_ID");
     var url
= "/bpm/linkey_workflow_engine.nsf/workflow_doc?readform&WF_ProcessUNID=01337B82B1F244CE48257C8A002B0C26&kyid="+kid;
   window.location.href=url;
  //window.location.href="/bpm/linkey_workflow_engine.nsf/workflow_doc?readform&WF_ProcessUNID=FF5978D4F51D6CA348257C89000D707B&kyid="+kid;
 // window.open(url,'left=0,top=0,width='+ (screen.availWidth - 10) +',height='+ (screen.availHeight-50) +',scrollbars,resizable=yes,toolbar=no');
 }

function params(paras){

var url =
location.href;  
var paraString
= url.substring(url.indexOf("?")+1,url.length).split("&");  
var paraObj =
{}  
for (i=0;
j=paraString[i];
i++){  
paraObj[j.substring(0,j.indexOf("=")).toLowerCase()]
= j.substring(j.indexOf("=")+1,j.length);  
}  
var returnValue
= paraObj[paras.toLowerCase()];  
if(typeof(returnValue)=="undefined"){  
return "";  
}else{  
return returnValue;

}
}

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

RUK001_005规则

Sub Initialize
On Error Goto errormsg

Dim mycon As Lcconnection
Dim fldLst As New lcfieldList
Dim sql As String
Dim json As String
Set mycon= New LCConnection("oracle")
mycon.server="ERPDEV"
mycon.UserID="apps"
mycon.Password="apps"
mycon.Connect

         
Dim Parms As New Lcfieldlist
Dim Parm As LCField
sql=|SELECT FEEDBACK_ID,FEEDBACK_NUM,DEPT_NAME,SUBMITED_EMP,STAGE_CODE,SOURCE_CODE,CONTACT_EMP,CONTACTER_NUMBER,FEEDBACK_DATE  FROM CUX_SVC_FEEDBACKS_V WHERE (rownum<5) |
Set Parm = Parms.Append ("p_appl_short_name", LCTYPE_TEXT)
Parm.text = "CUX"   

             

mycon.Procedure="mo_global.init"
Call mycon.Call (Parms, 1, Nothing)
mycon.Procedure=""

     

      call mycon.Execute ( sql ,fldLst )
while mycon.fetch(fldLst)
       json = json + |{"FEEDBACK_NUM":"|+fldLst.lookup("FEEDBACK_NUM").text(0)+|",|
       json = json + |"FEEDBACK_ID":"|+fldLst.lookup("FEEDBACK_ID").text(0)+|",|

                              
json = json + |"DEPT_NAME":"|+fldLst.lookup("DEPT_NAME").text(0)+|",|
json = json + |"SUBMITED_EMP":"|+fldLst.lookup("SUBMITED_EMP").text(0)+|",|

json = json + |"STAGE_CODE":"|+fldLst.lookup("STAGE_CODE").text(0)+|",|

json = json + |"SOURCE_CODE":"|+fldLst.lookup("SOURCE_CODE").text(0)+|",|

'json = json + |"EMERGENCY_LEVEL":"|+fldLst.lookup("EMERGENCY_LEVEL").text(0)+|",|

json = json + |"CONTACT_EMP":"|+fldLst.lookup("CONTACT_EMP").text(0)+|",|

json = json + |"CONTACTER_NUMBER":"|+fldLst.lookup("CONTACTER_NUMBER").text(0)+|",|

json = json + |"FEEDBACK_DATE":"|+fldLst.lookup("FEEDBACK_DATE").text(0)+|"},|
wend
json = |{"root":[|+left(json,len(json)-1) +|]}|

print "content-type:application/text;charset=utf-8"
print json

Call mycon.disconnect()

Exit Sub

errormsg:
Msgbox "Rule Error:" & Str(Erl) & "  " & Error

End Sub
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐