1)子系统下显示树
eform/TreeAction.do?actionType=tree&systemid=nongyezhi&subsysid=nongyezhi&treeid=nyzmulu
果要显示树,链接为:eform/TreeAction.do?actionType=tree&systemid=系统号&subsysid=子系统号&treeid=树号&target=mainFrame,如果要在主内容区显示,必须注明链接的target为mainFrame。
异步定制树脚本例子:
1:
1 if (parentid==""){
2 var sql="select SNO ,MINGCHENG from OA_NYZ_SHU Where SHANGJIID is null or SHANGJIID=‘‘ order by sno";
3 var list = appBo.query(sql);
4 if(list!=null && list.size()>0){
5 for (var i=0;i<list.size();i++) {
6 var map = list.get(i);
7 var typeid = map.get("SNO");
8 var typename= map.get("MINGCHENG");
9 tree.addAsyncTreeNode(typeid,typename,"../eform/DataAction.do?actionType=query&systemid=nongyezhi&subsysid=nongyezhi&modid=nyzlb&tagid="+typeid,"mainFrame");
10 }
11 }
12
13 }else{
14 var sql="select SNO,MINGCHENG from OA_NYZ_SHU Where SHANGJIID =‘"+parentid+"‘ order by sno";
15 list = appBo.query(sql);
16 if(list!=null && list.size()>0){
17 for (var i=0;i<list.size();i++) {
18 var map = list.get(i);
19 var typeid = map.get("SNO");
20 var typename= map.get("MINGCHENG"); tree.addAsyncTreeNode(typeid,typename,"../eform/DataAction.do?actionType=query&systemid=nongyezhi&subsysid=nongyezhi&modid=nyzlb&tagid="+typeid,"mainFrame");
21 }
22 }
23 }
2:
1 if (parentid==""){
2 if(login.id.equals("admin")||login.id.equals("nwadmin")){
3 tree.setTreeRootNode("数据目录","../eform/DataAction.do?actionType=query&systemid=nongyezhi&subsysid=nongyezhilmgl&modid=nyzlmgl&") ;
4 }else{
5 tree.setTreeRootNode("数据目录","") ;
6 }
7 }
8 if (parentid==""){
9 var sql="select SNO ,MINGCHENG from OA_NYZ_SHU Where (SHANGJIID is null or SHANGJIID=‘‘) and shouquanrenid like ‘%"+login.id+"%‘ order by sno";
10 if(login.id.equals("admin")||login.id.equals("nwadmin"))
11 sql="select SNO ,MINGCHENG from OA_NYZ_SHU Where (SHANGJIID is null or SHANGJIID=‘‘) order by sno";
12
13 var list = appBo.query(sql);
14 if(list!=null && list.size()>0){
15 for (var i=0;i<list.size();i++) {
16 var map = list.get(i);
17 var typeid = map.get("SNO");
18 var typename= map.get("MINGCHENG");
19 if(login.id.equals("admin")||login.id.equals("nwadmin"))
20 tree.addAsyncTreeNode(typeid,typename,"../eform/DataAction.do?actionType=query&systemid=nongyezhi&subsysid=nongyezhilmgl&modid=nyzlmgl&tagid="+typeid,"mainFrame");
21 else
22 tree.addAsyncTreeNode(typeid,typename,"","mainFrame");
23
24 }
25 }
26
27 }else{
28 var sql="select SNO,MINGCHENG from OA_NYZ_SHU Where SHANGJIID =‘"+parentid+"‘ order by sno";
29 if(tongji(parentid)==1){
30 if(!login.id.equals("admin")&&!login.id.equals("nwadmin"))
31 sql="select SNO ,MINGCHENG from OA_NYZ_SHU Where SHANGJIID =‘"+parentid+"‘ and shouquanrenid like ‘%"+login.id+"%‘ order by sno";
32 }
33 list = appBo.query(sql);
34 if(list!=null && list.size()>0){
35 for (var i=0;i<list.size();i++) {
36 var map = list.get(i);
37 var typeid = map.get("SNO");
38 var typename= map.get("MINGCHENG");
39 tree.addAsyncTreeNode(typeid,typename,"../eform/DataAction.do?actionType=query&systemid=nongyezhi&subsysid=nongyezhilmgl&modid=nyzlmgl&tagid="+typeid,"mainFrame");
40
41
42 }
43 }
44 }
45
46
47 function tongji(snos1){
48 var level="";
49 var list = appBo.query("select LANMULEVEL from oa_nyz_shu Where SNO =‘"+snos1+"‘ order by SNO desc");
50 for(var i=0;i<list.size();i++){
51 level=list.get(i).get("LANMULEVEL");
52 }
53 return level;
54 }
定制查询脚本(根据树的ID查询出数据显示在左侧)
1 var tagid=request.getParameter("tagid");
2 var sql ="select g.* from oa_nyz_content g where shenhestate=‘1‘ ";
3 var snos="";
4
5 var title=request.getParameter("title0");
6 var laiyuan=request.getParameter("laiyuan1");
7 var start=request.getParameter("zhailuriqi2");
8 var end=request.getParameter("zhailuriqi3");
9 if(title!=null&&title!="null"&&title!=""){
10 sql=sql+" and g.title like ‘%"+title+"%‘";
11 }
12 if(laiyuan!=null&&laiyuan!="null"&&laiyuan!=""){
13 sql=sql+" and g.laiyuan like ‘%"+laiyuan+"%‘";
14 }
15 if(start!=null&&start!="null"&&start!=""){
16 sql=sql+" and g.zhailuriqi >=‘"+start+"‘";
17 }
18 if(end!=null&&end!="null"&&end!=""){
19 sql=sql+" and g.zhailuriqi <= ‘"+end+"‘";
20 }
21
22 if(tagid!=null&&tagid!="null"&&tagid!=""){
23 snos="‘"+tagid+"‘";
24 tongji(tagid);
25 out.println("+++++++++++++++++++"+snos);
26 sql=sql+" and g.lanmuid in ("+snos+")";
27
28 }
29 var eformorderby=request.getParameter("eformorderby");
30 out.println("eformorderby++++"+eformorderby);
31 if(eformorderby != null && eformorderby != "" && eformorderby != "null"){
32 eformorderby=eformorderby.substring(0,eformorderby.length()-1);
33 eformorderby=eformorderby.replaceAll(‘,‘,‘ ‘);
34 eformorderby=eformorderby.replaceAll(‘;‘,‘,‘);
35
36 sql = sql +" order by "+eformorderby;
37 }else{
38 sql = sql + " order by zhailuriqi desc";
39 }
40
41 runtime.setSQL(sql);
42
43 function tongji(snos1){
44 var list = appBo.query("select SNO from oa_nyz_shu Where SHANGJIID =‘"+snos1+"‘ order by SNO desc");
45
46 for(var i=0;i<list.size();i++){
47 var sno=list.get(i).get("SNO");
48 snos=snos+‘,‘+"‘"+sno+"‘";
49 tongji(sno);
50 }
51 //return snos;
52
53 }
节点下新增时,表单运行的脚本
1 var tagid=runtime.getDoKey();
2 if(tagid!=null&&tagid!="null"&&tagid!=""){
3
4 var sql="select * from OA_NYZ_SHU where SNO="+tagid;
5 var list=appBo.query(sql);
6 if(list!=null&&list.size()>0){
7 var sno=list.get(0).get("SNO");
8 var name=list.get(0).get("MINGCHENG");
9 var level=list.get(0).get("LANMULEVEL");
10 // out.println((parseInt(level)+1)+"");
11 objTable.put("lanmulevel",(parseInt(level)+1)+"");
12 objTable.put("shangjiid",sno);
13 objTable.put("shangjiname",name);
14
15 }
16
17 }
弹出树的脚本-给表单赋值上级的节点(ajax脚本)
1 importClass(Packages.cn.com.chx.bo.AppBo);
2 var id=request.getParameter("retvalue");
3 if(id!=null&&id!=""){
4 var ss = id.split("\2");
5 var list=appBo.query("select * from oa_nyz_shu where sno=‘"+ss[0]+"‘");
6 if(list.size()>0){
7 var level=list.get(0).get("LANMULEVEL");
8 runtime.setMessage("document.forms[0].lanmulevel.value=‘"+level+"‘\r\n");
9 }
10 runtime.setMessage("document.forms[0].lanmuid.value=‘"+ss[0]+"‘\r\n");
11 runtime.setMessage("document.forms[0].lanmu.value=‘"+ss[1]+"‘\r\n");
12
13 }
表单树
时间: 2024-10-10 16:27:35