`
lgstarzkhl
  • 浏览: 329782 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
社区版块
存档分类
最新评论

dwr实现三级联动菜单

    博客分类:
  • java
阅读更多
<td class="Title2">
					执法单位类别
				</td>
				<td class="valueStyle" colspan="2">
					<html:select property="danweitype" styleClass="jump3" disabled="true" 
					onchange="selectAllType(this)">
						<html:option value="">--请选择--</html:option>
						<html:options collection="dingjifenleiList" property="value"
							labelProperty="label" />
					</html:select>
				</td>
				<td class="Title2">
					执法单位大类
				</td>
				<td class="valueStyle">
					<html:select property="danweibigtype" styleClass="jump3" disabled="true"
					onchange="selectBigType(this)">
						<html:option value="">--请选择--</html:option>
						<html:options collection="zhifadaleiList" property="value"
							labelProperty="label" />
					</html:select>
				</td>
				<td class="Title2">
					执法单位小类
				</td>
				<td class="valueStyle">
					<html:select property="danweismalltype" styleClass="jump3" disabled="true"
					onchange="selectSmallType(this)">
						<html:option value="">--请选择--</html:option>
						<html:options collection="zhifaxiaoleiList" property="value"
							labelProperty="label" />
					</html:select>
				</td>

这里是html页面的内容
		    //责任单位的总的类别,选择完之后会出现数字化城管大类
		    function selectAllType(obj){
		    	var st = obj.value;
		    	if(st!=''){
		    		document.getElementById('danweibigtype').disabled = false;
		    		linkageService.getAllType(st,changeBigType);
		    		
		    	}
		    }
		    //改变大类的内容
		    function changeBigType(obj){
		    	var ot = document.getElementById('danweibigtype');
		    	if(ot.length>1){
		    		DWRUtil.removeAllOptions('danweibigtype');
		    		DWRUtil.addOptions('danweibigtype',{'':'--请选择--'});
		    		DWRUtil.addOptions(ot,obj);
		    	}
		    }
		    //大类选小类
		    function selectBigType(obj){
		    	var st = obj.value;
		    	if(st!=''){
		    		document.getElementById('danweismalltype').disabled = false;
		    		linkageService.getSmalltypeinfo(st,changeSmallType);
		    	}
		    }
		    //小类的内容
		    function changeSmallType(obj){
		    	var ot = document.getElementById('danweismalltype');
		    	if(ot.length>1){
		    		DWRUtil.removeAllOptions('danweismalltype');
		    		DWRUtil.addOptions('danweismalltype',{'':'--请选择--'});
		    		DWRUtil.addOptions(ot,obj);
		    	}
		    }
		    //小类选择业务类型
		    function selectSmallType(obj){
		    	var st = obj.value;
		    	if(st!=''){
		    		linkageService.getYewuType(st,changeYewuType);
		    	}
		    }
		    //改变业务类型
		    function changeYewuType(obj){
		    	var ot = document.getElementById('operationtype');
		    	DWRUtil.removeAllOptions('operationtype');
		    	DWRUtil.addOptions('operationtype',{'':'--请选择--'});
		    	DWRUtil.addOptions(ot,obj);
		    }

这部分是js文件的内容
	//根据小类ID得到业务类型
	public Map getYewuinfo(String yewuType) {
		// TODO Auto-generated method stub
		Map<String, String> map = new HashMap<String, String>();
		if(yewuType!=null&&!"".equals(yewuType)){
			
			EtSysTreebase est = (EtSysTreebase)dao.loadEntity(EtSysTreebase.class, yewuType);
			String id = est.getId();
			String bigType = est.getNickname();
			
			StringBuffer hql = new StringBuffer();
			hql.append("select est from EtSysTreebase est where est.nickname like '"+bigType+"%' and est.id <> '"+id+"'");
			MyQuery mq=new MyQueryImpl();	
			mq.setHql(hql.toString());
			
			Object[] obj = dao.findEntity(mq);
			for (int i = 0; i < obj.length; i++) {
				EtSysTreebase e = (EtSysTreebase)obj[i];
				map.put(e.getId(), e.getName());
			}
			
		}
		return map;
	}

这里是java文件内部的内容,其它的级联道理同上
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics