展示2

展示

在这里插入图片描述

新增

在这里插入图片描述

修改

在这里插入图片描述

删除

在这里插入图片描述

导出

在这里插入图片描述

jsp页面

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>采集设备管理</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="" name="description" />
<meta content="" name="author" />
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>easyui/themes/icon.css">
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>easyui/themes/default/easyui.css">
<link
	href="<%=basePath%>assets/global/plugins/font-awesome/css/font-awesome.min.css"
	rel="stylesheet" type="text/css" />
<link
	href="<%=basePath%>assets/global/plugins/simple-line-icons/simple-line-icons.min.css"
	rel="stylesheet" type="text/css" />
<link
	href="<%=basePath%>assets/global/plugins/bootstrap/css/bootstrap.min.css"
	rel="stylesheet" type="text/css" />
<link
	href="<%=basePath%>assets/global/plugins/uniform/css/uniform.default.css"
	rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" />
<link href="<%=basePath%>assets/global/css/components.min.css"
	rel="stylesheet" id="style_components" type="text/css" />
<link href="<%=basePath%>assets/global/css/plugins.min.css"
	rel="stylesheet" type="text/css" />
<link href="<%=basePath%>assets/apps/css/inbox.min.css" rel="stylesheet"
	type="text/css" />
<link href="<%=basePath%>assets/layouts/layout4/css/layout.min.css"
	rel="stylesheet" type="text/css" />
<link
	href="<%=basePath%>assets/layouts/layout4/css/themes/light.min.css"
	rel="stylesheet" type="text/css" id="style_color" />
<link href="<%=basePath%>assets/layouts/layout4/css/custom.min.css"
	rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="favicon.ico" />
<!-- 表格的样式信息lxy -->
<link rel="stylesheet" href="<%=basePath%>css/bootstrap/bootstrap-table.min.css" />

<!--核心样式-->
<link href="<%=basePath%>css/ySelect.css" rel="stylesheet"
	type="text/css">
<script src="<%=basePath%>js/jquery-1.11.3.min.js"></script>
<script src="<%=basePath%>js/bootstrap.min.js"></script>
<script src="<%=basePath%>js/ySelect.js"></script>
<link href="<%=basePath%>easyui/themes/default/easyui.css"
	rel="stylesheet" type="text/css">
<link href="<%=basePath%>jeDate/skin/jedate.css" type="text/css"
	rel="stylesheet">
<script src="<%=basePath%>jeDate/src/jedate.js" type="text/javascript"></script>
<script src="<%=basePath%>js/bootstrap/center-loader.js"></script>
<script src="<%=basePath%>js/bootstrap/bootstrap-table.min.js"></script>
<script src="<%=basePath%>js/bootstrap/bootstrap-table-zh-CN.min.js"></script>

<!-- 导出表格 -->
<script src="<%=basePath%>js/bootstrap/bootstrap-table-export.js"
	type="text/javascript"></script>
<script src="<%=basePath%>js/bootstrap/tableExport.min.js"
	type="text/javascript"></script>
<script type="text/javascript" src="<%=basePath%>js/FileSaver.js"></script>
<script type="text/javascript" src="<%=basePath%>js/jszip.js"></script>
<script type="text/javascript" src="<%=basePath%>js/excel-gen.js"></script>

<!-- 开始时间和结束时间 -->
<link type="text/css" rel="stylesheet"
	href="<%=basePath%>jeDate/skin/jedate.css">
<script type="text/javascript" src="<%=basePath%>jeDate/src/jedate.js"></script>

</head>
<style>
* {
	font-family: "微软雅黑";
	font-size: 14px;
	letter-spacing: 2px;
}
</style>
<body class="page-container-bg-solid page-header-fixed page-sidebar-closed-hide-logo">
<div class="clearfix"></div>
	<div class="page-content">

<!-- 		<ul class="page-breadcrumb breadcrumb"> -->
<!-- 			<li class="active"><span -->
<!-- 				style="color: #5e738b; font-size: 16px;">系统管理</span>  -->
<!-- 				<i class="fa fa-circle"></i></li> -->
<!-- 			<li><span class="active" style="font-size: 16px;">采集设备管理</span></li> -->
<!-- 		</ul> -->

	<!-- 	<ul class="page-breadcrumb breadcrumb">
			<li class="active"><span
				style="color: #5e738b; font-size: 16px;">系统管理</span> 
				<i class="fa fa-circle"></i></li>
			<li><span class="active" style="font-size: 16px;">采集设备管理</span></li>
		</ul> -->

		
	<div class="row">
		<div class="col-md-12">
			<div class="portlet light bordered">
				<div class="portlet-body">
					<ul class="nav nav-tabs">
						<c:forEach items="${allPollutantDeliveryBtn}" var="allBtn">
							<li class="active">
							<a href="#tab_1_1" data-toggle="tab"
								style="font-size: 16px;">${allBtn.FBI_NAME }</a></li>
						</c:forEach>
					</ul>
					<div class="tab-content">
						<div class="tab-pane fade active in" id="tab_1_1">
							<div class="col-md-12 column">
							<table style="margin-bottom: 10px;width: 100%;">
								<div class="row clearfix" style="margin-top: 15px">
									<div class="form-group col-md-1 col-sm-1 col-lg-1 control-label">
										<label class="control-label">开始时间</label>
									</div>
									<div class="form-group col-md-3 col-sm-3 col-lg-3 control-label" >
										<input type="text" class="form-control" style="width: 100%;"
											name="STARTIME" id="STARTIME" readonly="readonly"> 
									</div>
									<div class="form-group col-md-1 col-sm-1 col-lg-1 control-label">
										<label class="control-label">结束时间</label>
									</div>
									<div class="form-group col-md-3 col-sm-3 col-lg-3 control-label" >
										<input type="text" class="form-control" style="width: 100%;"
										name="ENDTIME" id="ENDTIME"  readonly="readonly">
									</div>
								<div class="form-group col-md-1 col-sm-1 col-lg-1 control-label" >
										<label class="control-label">监测种类</label>
									</div>
									<div class="form-group col-md-3 col-sm-3 col-lg-3 control-label">
										<select class="form-control m-b input-inline" style="width: 100%;"
											name="EMI_MONITOR_TYPE" id="EMI_MONITOR_TYPE"
											onchange="initxialakuang()">
											<option value="">请选择</option>
											<c:forEach var="list" items="${list}">
												<option value="${list.MT_FID}">${list.MT_NAME}</option>
											</c:forEach>
										</select>
									</div>
								
								</div>
								<div class="row clearfix"  style="margin-top: 10px">
									<div class="form-group col-md-1 col-sm-1 col-lg-1 control-label">
										<label class="control-label">设备类型</label>
									</div>
									<div class="form-group col-md-3 col-sm-3 col-lg-3 control-label">
										<select class="form-control m-b input-inline" name="EMI_TYPE"
											 style="width: 100%;" id="EMI_TYPE">
											<option value="">请选择 </option>
										</select>
									</div>
									<div class="form-group col-md-1 col-sm-1 col-lg-1 control-label" >
										<label class="control-label" style="width: 100%;">设备型号</label>
									</div>
									<div class="form-group col-md-3 col-sm-3 col-lg-3 control-label">
										<select class="demo form-control m-b input-inline" style="width: 100%;"
										name="EMI_MODEL_LIST" id="EMI_MODEL_LIST" multiple="multiple">
												<c:forEach items="${epiList}" var="epi" >
													   <option value="${epi.EMI_FID}">${epi.EMI_MODEL}</option>
												</c:forEach>
										</select> 
<!-- 										<input type="text" class="form-control"  id="EMI_MODEL_LIST" name="EMI_MODEL_LIST"/> -->
									</div>
									
									<div class="form-group col-md-1 col-sm-1 col-lg-1 control-label">
										<label class="control-label">创建人</label>
									</div>
									<div class="form-group col-md-3 col-sm-3 col-lg-3 control-label" >
										<input type="text" class="form-control"  id="EMI_ESTABLISH_PEOPLE_LIST" name="EMI_ESTABLISH_PEOPLE_LIST"/>
									</div>
								</div>
								<div class="row clearfix" style="margin-top: 10px">
										<div style="margin-left: 10px; float:right;" >
											<c:forEach var="pdBtnSecond0"
												items="${pollutantDeliverySecondtab_1_1}">
												<c:if test="${pdBtnSecond0.FBI_TYPE==1}">
													<a href="javascript:;" id="searchBtn" class="btn green"  onclick="initEquipmentInfo()"
														style="font-size: 16px; font-family: '微软雅黑';">${pdBtnSecond0.FBI_NAME}
														<i class="fa fa-search"></i>
													</a>
												</c:if>
											</c:forEach>
											<c:forEach var="pdBtnSecond0"
												items="${pollutantDeliverySecondtab_1_1}">
												<c:if test="${pdBtnSecond0.FBI_TYPE==2}">
													<a href="javascript:;" id="addBtn" class="btn yellow"
														style="font-size: 16px; font-family: '微软雅黑';">${pdBtnSecond0.FBI_NAME}
														<i class="fa fa-plus"></i>
													</a>
												</c:if>
											</c:forEach>
										
											<c:forEach var="pdBtnSecond0"
												items="${pollutantDeliverySecondtab_1_1}">
												<c:if test="${pdBtnSecond0.FBI_TYPE==3}">
													<a href="javascript:;" id="updateBtn" class="btn blue"
														style="font-size: 16px; font-family: '微软雅黑';">${pdBtnSecond0.FBI_NAME}
														<i class="fa fa-edit"></i>
													</a>
												</c:if>
											</c:forEach>
											<c:forEach var="pdBtnSecond0"
												items="${pollutantDeliverySecondtab_1_1}">
												<c:if test="${pdBtnSecond0.FBI_TYPE==4}">
													<a href="javascript:;" id="deleteBtn" class="btn red"
														style="font-size: 16px; font-family: '微软雅黑';">${pdBtnSecond0.FBI_NAME}
														<i class="fa fa-close"></i>
													</a>
												</c:if>
											</c:forEach>
											<c:forEach var="pdBtnSecond0" items="${pollutantDeliverySecondtab_1_1}">
												<c:if test="${pdBtnSecond0.FBI_TYPE==8}">
													<a href="javascript:;" id="exportExcel" class="btn purple"
														style="font-size: 16px; font-family: '微软雅黑';">${pdBtnSecond0.FBI_NAME}
														<i class="fa fa-file-o"></i>
													</a>
												</c:if>
											</c:forEach>
											</div>
								</div>
							</table>
							</div>
						</div>
						<div class="row">
							<div class="col-md-12">
								<div class="portlet-body" style="height: 600px;">
									<div class="table-scrollable table-responsive">
										<table id="initEquipmentInfo"
											class="table table-striped table-bordered table-hover table-checkable order-column table text-nowrap">
										</table>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="clearfix margin-bottom-20"></div>
	</div>
</div>

<script type="text/javascript">

//开始时间和结束时间
function timeFormat(date) {
    	   if (!date || typeof(date) === "string") {
    	          this.error("参数异常,请检查...");
    	     }
    	    var y = date.getFullYear(); //年
    	    var m = date.getMonth() + 1; //月
    	    var d = date.getDate(); //日
    		
    	    return y + "-" + m + "-" + (d<10? ('0'+d) :d);
    	 }
//     	 获取当月第一天
    function getFirstDayOfMonth (date) {
    	    date.setDate(1);
    	return timeFormat(date);
    	}
    	
    $(function(){
  //蓝色主题色
	jeDate("#STARTIME", {
		theme : {
			bgcolor : "#00A1CB",
			color : "#ffffff",
			pnColor : "#00CCFF"
		},
		format : "YYYY-MM-DD "
	});
   
    
    if($("#STARTIME").val()=="")
	$("#STARTIME").val("")
	//蓝色主题色
	jeDate("#ENDTIME", {
		theme : {
			bgcolor : "#00A1CB",
			color : "#ffffff",
			pnColor : "#00CCFF"
		},
		format : "YYYY-MM-DD "
	});
  if($("#ENDTIME").val()=="")
	$("#ENDTIME").val("")
	
    });
	
    
    		var search_monitor_type;//监测种类
    		var search_type;//设备类型
    		var search_model;//设备型号
    		var search_establish_people;//创建人
    		
    		var search_starttime;//开始时间
    		var search_endtime;//结束时间
    		

		initEquipmentInfo();
		function initEquipmentInfo(){
			//防止表单重复提交
	        $('body').loader('show','<img src="<%=basePath%>images/loading1.gif">');
	  		$('#initEquipmentInfo').bootstrapTable('destroy');
		    $('#initEquipmentInfo').bootstrapTable({
		    	method: 'post',
		        contentType: "application/x-www-form-urlencoded",
		    	url : '<%=basePath%>equipmentInfo/initEquipmentInfo.te',
		        cache: false,
		        pagination: true,
			    paginationHAlign:'right',
			    queryParamsType:'', //默认值为 'limit' ,在默认情况下 传给服务端的参数为:offset,limit,sort
		                               // 设置为 ''  在这种情况下传给服务器的参数为:pageSize,pageNumber
		        queryParams:queryParams,//带参数查询
		        singleSelect: false,
			    pageSize: 10, 
			    pageList: [10, 20,30],
			    search: false, //不显示 搜索框
			    showColumns: false, //不显示下拉框(选择显示的列)
			    sidePagination: "server", //服务端请求
			    striped:true, //隔行变色
		        clickToSelect:true, //整行点击
		        
// 		        showExport: false,  //是否显示导出按钮
// 		        buttonsAlign:"right",  //按钮位置
// 		        exportTypes:['excel'],  //导出文件类型
// 		        Icons:'glyphicon-export',
// 		        exportOptions:{
// 		            ignoreColumn: [0],  //忽略某一列的索引
// 		            fileName: '湿温度监测',  //文件名称设置
// 		            worksheetName: 'sheet1',  //表格工作区名称
// 		            tableName: '湿温度监测',
// 		            excelstyles: ['background-color', 'color', 'font-size', 'font-weight'],
// 		        },
// 		        uniqueId:'rownum_',
		        
		        columns: [{	
                    checkbox: true,  
                    visible: true                  //是否显示复选框  
                }, 
                {
			    	field: 'emi_FID',
			        visible:false,
	                valign:'middle',
	                align: 'center',
// 	                formatter:function(value,row,index){
// 				    	var temp=value;
// 						if( value != null && value.length>5){
// 							value=value.substring(0,5)+"..";
// 						}
// 						return '<div title="'+temp+'">'+value+'</div>' ;
// 					}
			    },
					{
				    field: 'rownum_',
				    title: '序号',
				    //sortable: true,
				    align: 'center',
				    width: 40,
				},			 				   
				{
				    field: 'emi_MONITOR_TYPE',
				    title: '监测种类',
				    valign:'middle',
				    align: 'center',
// 				    formatter:function(value,row,index){
// 				    	var temp=value;
// 						if( value != null && value.length>5){
// 							value=value.substring(0,5)+"..";
// 						}
// 						return '<div title="'+temp+'">'+value+'</div>' ;
// 					}
				  /*   formatter:function(value,row,index){
				    	var temp=value;
				    	if(value==null || value.length<=0){
				    		value="";
				    	}
						if( value != null && value.length>5){
							value=value.substring(0,5)+"..";
						}
						return '<div title="'+temp+'">'+value+'</div>' ;
					} */
				},
				{
				    field: 'emi_TYPE',
				    title: '设备类型',
				    valign:'middle',
				    align: 'center',
// 				    formatter:function(value,row,index){
// 				    	var temp=value;
// 						if( value != null && value.length>5){
// 							value=value.substring(0,5)+"..";
// 						}
// 						return '<div title="'+temp+'">'+value+'</div>' ;
// 					}
				  /*   formatter:function(value,row,index){
				    	var temp=value;
				    	if(value==null || value.length<=0){
				    		value="";
				    	}
						if( value != null && value.length>8){
							value=value.substring(0,8)+"..";
						}
						return '<div title="'+temp+'">'+value+'</div>' ;
					} */
				},			    			    
				{
				    field: 'emi_NUMBER',
				    title: '设备编号',
				    valign:'middle',
				    align: 'center',	 
// 				    formatter:function(value,row,index){
// 				    	var temp=value;
// 						if( value != null && value.length>5){
// 							value=value.substring(0,5)+"..";
// 						}
// 						return '<div title="'+temp+'">'+value+'</div>' ;
// 					}
				},		
				{
				    field: 'emi_MODEL',
				    title: '设备型号',
				    valign:'middle',
				    align: 'center',	 
// 				    formatter:function(value,row,index){
// 				    	var temp=value;
// 						if( value != null && value.length>5){
// 							value=value.substring(0,5)+"..";
// 						}
// 						return '<div title="'+temp+'">'+value+'</div>' ;
// 					}
				},		
				{
				    field: 'emi_NAME',
				    title: '设备名称',
				    valign:'middle',
				    align: 'center',	 
// 				    formatter:function(value,row,index){
// 				    	var temp=value;
// 						if( value != null && value.length>5){
// 							value=value.substring(0,5)+"..";
// 						}
// 						return '<div title="'+temp+'">'+value+'</div>' ;
// 					}
				},
				{
				    field: 'emi_ESTABLISH_PEOPLE',
				    title: '创建人',
				    valign:'middle',
				    align: 'center',	 
// 				    formatter:function(value,row,index){
// 				    	var temp=value;
// 						if( value != null && value.length>5){
// 							value=value.substring(0,5)+"..";
// 						}
// 						return '<div title="'+temp+'">'+value+'</div>' ;
// 					}
				},
				{		
					field:'emi_ESTABLISH_TIME',
					title:'创建时间',
				    valign: 'middle',	               
				    align: 'center',
// 				    formatter:function(value,row,index){
// 				    	var temp=value;
// 						if( value != null && value.length>5){
// 							value=value.substring(0,5)+"..";
// 						}
// 						return '<div title="'+temp+'">'+value+'</div>' ;
// 					}
				}
// 				{			       
// 			        title: '操作',	               
// 	                align: 'center',	
// 	            	formatter:function(value,row,index){	         		    
// 	        		 	      return '<a οnclick="updateEquipment(\''+row.emi_FID+'\')"><span class="label label-sm"  style="font-family: \'微软雅黑\';color: cornflowerblue" >修改</span></a>'
// 	        			}	               
// 			    }
				],
		        onLoadSuccess:function(){
		        	//防止表单重复提交(查询出数据之后把遮罩进行隐藏)
		        	$('body').loader('hide');
		        	
		        	search_monitor_type=$("#EMI_MONITOR_TYPE").val();//监测种类
		    		search_type=$("#EMI_TYPE").val();//设备类型
		    		search_model=$("#EMI_MODEL_LIST").val();//设备型号
		    		search_establish_people=$("#EMI_ESTABLISH_PEOPLE_LIST").val();//创建人
		        	
				},
			    onLoadError: function () {
	//		            bootbox.alert("数据加载失败!");
		            window.parent.modalOutError("数据加载失败!");
		        }
		    });
		};
		
		
		function queryParams(params){
			var STARTIME=$("#STARTIME").val();
	  		var ENDTIME=$("#ENDTIME").val();
	  		
	  		var EMI_MONITOR_TYPE=$("#EMI_MONITOR_TYPE").val();
	  		var EMI_TYPE=$("#EMI_TYPE").val();
	  		var EMI_MODEL_LIST=$("#EMI_MODEL_LIST").ySelectedValues(",");
	  		var EMI_ESTABLISH_PEOPLE_LIST=$("#EMI_ESTABLISH_PEOPLE_LIST").val();

	 		
	 		
	  		var temp = {
	  			pageSize:params.pageSize,
	  			pageNumber:params.pageNumber,
	  			//查询条件
	  			STARTIME:STARTIME,//开始时间
	  			ENDTIME:ENDTIME,//结束时间
	  			
	  			EMI_MONITOR_TYPE:EMI_MONITOR_TYPE,
				//后台的值      :前台的值
	  			EMI_TYPE:EMI_TYPE,
	  			EMI_MODEL_LIST:EMI_MODEL_LIST,
	  			EMI_ESTABLISH_PEOPLE_LIST:EMI_ESTABLISH_PEOPLE_LIST,
	  			
	  		};
	  		return temp;
	  	} 
		
		//导出
		$('#exportExcel').bind('click', function () {
		    tableExport2()
		})
		function tableExport2(){
		    $('#initEquipmentInfo').tableExport(
		        { 
		            type: 'excel',//导出excel
		            escape: 'false' ,                          
		            ignoreColumn: [0],  //忽略某一列的索引
		            fileName: '采购设备管理',  //文件名称设置
		            worksheetName: 'sheet1',  //表格工作区名称
		            tableName: '采购设备管理',
		            excelstyles: ['background-color', 'color', 'font-size', 'font-weight']
		        }
		    )
		}
		//查询
		initEquipmentInfo();
	  	$("#searchBtn").click(function(){
	  		var STARTIME=$("#STARTIME").val();
	  		var ENDTIME=$("#ENDTIME").val();
	  		var startTmp=STARTIME.split("-");
            var endTmp=ENDTIME.split("-");
            var sd=new Date(startTmp[0],startTmp[1],startTmp[2]);
            var ed=new Date(endTmp[0],endTmp[1],endTmp[2]);
            if(sd.getTime()>ed.getTime()){ 
            	window.parent.modalOutError("开始日期不能大于结束日期");   
                return; 		
             }
	  		initEquipmentInfo();
	  	});
	  	
		//添加
	  	$("#addBtn").on("click",function(){
	  		window.parent.modalOut('<%=basePath%>equipmentInfo/insertEquipmentInfo.te?auditFid=${auditFid}');
	  	})
	  	
	  	//修改
// 	  	function updateEquipment(emi_FID){
<%-- 			window.parent.modalOut('<%=basePath%>equipmentInfo/updateEquipmentInfo.te?fid='+emi_FID); --%>
// 		};
		$("#updateBtn").click(function(){
	  		var row=$("#initEquipmentInfo").bootstrapTable('getSelections');
  			if(row==null || row=='' ||  row.length>1){
				window.parent.modalOutError("请选择一条修改记录。");
			}else{
				window.parent.modalOut('<%=basePath%>equipmentInfo/updateEquipmentInfo.te?fid='+row[0].emi_FID);
			}
		});
		
	  //是否删除成功
		function delEquipmentInfo(){
			var rows=$('#initEquipmentInfo').bootstrapTable("getSelections");
			var INEM_ID="";
			$.each(rows,function(i,n){
				if(i==0){
					INEM_ID+="'"+n.emi_FID+"'";
				}else{
					INEM_ID+=",'"+n.emi_FID+"'";
				}
			})
			 $.ajax({
				 cache: true,
		         type: "POST",
		         url:"<%=basePath%>equipmentInfo/delEquipment.te",
		     	 data : {
		     		INEM_ID:INEM_ID
		     	 },
		         success: function(data) {
		        	 console.log(data.result);
		        	 if(data.result=='success'){
						 window.parent.modalOutError("删除成功");
						 initEquipmentInfo();//删除完成功之后调用再次调用查询方法刷新页面。
		        	 }else {
						 window.parent.modalOutError("删除数据产生错误!!");
		        	 }
		         },
		         error: function(request) {
					 window.parent.modalOutError("操作超时,请重新登录!!");
		         }
			});		
		}
		//删除
			$("#deleteBtn").on("click",function(){
				var rowarray = $('#initEquipmentInfo').bootstrapTable('getSelections');
				if(rowarray==null || rowarray==''){
					window.parent.modalOutError("至少选中一条需要删除的信息。");
				}else{
					var showInfo ="";
					for(var i=0;i<rowarray.length;i++){
				    var tempstr=rowarray[i].emi_FID;
					    if(tempstr!=null && tempstr!=''){
					    	showInfo = showInfo+tempstr+",";
					    }
					}
					$("#initEquipmentInfo").val(showInfo);
					window.parent.modalDeleteInfoShow('7');
				}
			});
		
			function initxialakuang(){
				 $("#EMI_TYPE").empty();
				 $.ajax({
				         type: "POST",
				         url:"<%=basePath%>equipmentInfo/initEquipmentTwo.te",
						 dataType : "json",
						 data : {
							 MI_TYPE : $("#EMI_MONITOR_TYPE").val(), //所属单位	
						 },
						success : function(data) {
							var aatype = ""
							if (data.total != null && data.total.length > 0) {
								aatype = "<option value=''>请选择</option>";
								for ( var y = 0; y < data.total.length; y++) {
									var CODE = data.total[y].mt_FID;
									var CNAME = data.total[y].mt_NAME;
									aatype += '<option value='+CODE+'>' + CNAME
											+ '</option>'
								}
							} else {
								aatype = "<option value=''>请选择</option>";
							}
							$("#EMI_TYPE").empty().append(aatype);
		
						},
						error : function(request) {
							window.parent.modalOutError("操作超时,请重新登录!!");
						}
					});
				};
				
				$(function() {
					 $(".demo").ySelect();
				        $(".demo1").ySelect(
				          {
				            placeholder: '请先选择',
				            searchText: '搜索',
				            showSearch: true,
				            numDisplayed: 4,
				            overflowText:"的撒大",
				            isCheck:false
				          }
				        );
				        $(".dropdown-menu").width("100%")  
				});	
	</script>
</body>
</html>

新增

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>新增</title>
<link type="text/css" rel="stylesheet" href="<%=basePath%>jeDate/skin/jedate.css">
<link type="text/css" rel="stylesheet" href="<%=basePath%>css/bootstrap/bootstrap-select.css">
<script type="text/javascript" src="<%=basePath%>jeDate/src/jedate.js"></script>
<script src="<%=basePath %>js/bootstrap/center-loader.js"></script>
<script src="<%=basePath%>js/bootstrap/bootstrap-select.js"></script>
</head>
<style>
* {
	font-family: "微软雅黑";
	font-size: 16px;
	letter-spacing: 2px;
}
</style>
<body class="page-container-bg-solid page-header-fixed page-sidebar-closed-hide-logo">
	
     	  <div class="row">
     	  		 <form class="form-horizontal" role="form" id="initFormUserAdd">
                        <div class="col-md-12">
                            <div class="portlet light bordered">
                           
                                <div class="portlet-body">
                                    <ul class="nav nav-tabs" id="allTab">
                                        <li class="active">
                                            <a href="#tab_1_1" id="t_1" data-toggle="tab" lang="0" style="font-size: 16px;">新增采集设备管理</a>
                                        </li>
                                    </ul>
                                    <div class="tab-content">
                    <div class="tab-pane fade active in" id="tab_1_1">                              
					<div class="row">
                        <div class="col-md-12">
                      		  <div class="portlet-body form">
                                 <div class="form-body">
                                    <div class="form-group">
                                        <label class="col-md-3 control-label">监测种类</label>
                                        <div class="col-md-9" id="temp">
											<select name="EMI_MONITOR_TYPE" id="EMI_MONITOR_TYPE" class="form-control m-b input-inline input-medium" onchange="initxialakuang()">
														<option value="">请选择</option>
													<c:forEach var="list" items="${list}">
														<option  value="${list.MT_FID}">${list.MT_NAME}</option>
													</c:forEach>
							                 </select>
											<span style="color: red" >*</span>
	                                    </div>
	                                </div>
                                    <div class="form-group">
                                        <label class="col-md-3 control-label">设备类型</label>
                                        <div class="col-md-9">
											<select id="EMI_TYPE" name="EMI_TYPE" class="form-control input-inline input-medium" onchange="initxialakuangTwo()">
								                       <option value="">请选择</option>
							                 </select>
											<span style="color: red" >*</span>
                                        </div>
                                    </div>
                                    <div class="form-group" id="displacement" style="display: none">
                                        <label class="col-md-3 control-label">位移监测</label>
                                        <div class="col-md-9">
											<select id="EMI_DISPLACEMENT" name="EMI_DISPLACEMENT" class="form-control input-inline input-medium" maxlength="50">
								                       <option value="">请选择</option>
							                 </select>
											<span style="color: red" >*</span>   
                                        </div>
                                    </div> 
                                    
                                    <div class="form-group">
                                        <label class="col-md-3 control-label">设备型号</label>
                                        <div class="col-md-9">
												<input type="text" name="EMI_MODEL" id="EMI_MODEL" class="form-control input-inline input-medium" maxlength="50">
											<span style="color: red" >*</span>   
                                        </div>
                                    </div>
                                   
                                     <div class="form-group">
                                        <label class="col-md-3 control-label">设备名称</label>
                                        <div class="col-md-9">
							                 <input type="text" name="EMI_NAME" id="EMI_NAME" class="form-control input-inline input-medium" maxlength="50">
											<span style="color: red" >*</span>   
                                        </div>
                                    </div>
                                     <div class="form-group">
                                        <label class="col-md-3 control-label">设备编号</label>
                                        <div class="col-md-9">
							                 <input type="text" name="EMI_NUMBER" id="EMI_NUMBER" class="form-control input-inline input-medium" maxlength="50">
											<span style="color: red" >*</span>   
                                        </div>
                                    </div>
                                    
                                  
                                     </div>
                                        <div class="form-actions">
                                            <div class="row">
                                                <div class="col-md-offset-3 col-md-9">
                                                   <button type="button" class="btn green" id="saveUserInfo">保存</button>
                                                </div>
                                            </div>
                                        </div>
                                </div>	
                        </div>
                    </div>                  
                   </div>   
                 </div>
                 <div class="clearfix margin-bottom-20"> </div>
             </div>
        </div>
    </div>
    <!-- END PAGE BASE CONTENT -->
</form>
</div>
<script type="text/javascript">

                        $("#saveUserInfo").click(function(){
                        	//增加相应的表单验证,否则无法进行保存处理
                        	//增加相应的验证信息
//                         	var serviceCompany = $("#RR_SERVICE_COMPANY").ySelectedValues(",");
	                       	
	                       	var search_monitor_type = $("#EMI_MONITOR_TYPE").val();//监测种类
	                		var search_type = $("#EMI_TYPE").val();//设备类型
	                		var search_displacement = $("#EMI_DISPLACEMENT").val();//位移监测
	                		var search_model = $("#EMI_MODEL").val();//设备型号
	                		var search_name = $("#EMI_NAME").val();//设备名称
	                		var search_number = $("#EMI_NUMBER").val();//设备编号
	                		
	                     	 if(search_monitor_type==null || search_monitor_type.length== 0 || search_monitor_type.trim() == null || search_monitor_type.trim().length==0 ||search_monitor_type=="请选择"){
	                       		 window.parent.modalOutError("监测种类不能为空!");
	                       		 return;
	                       	 }
							 if(search_type==null || search_type.length== 0 || search_type.trim() == null || search_type.trim().length==0 || search_type=="请选择"){
								 window.parent.modalOutError("设备类型不能为空!");
                       			 return;
	                       	 }
	                       	 if(search_model==null || search_model.length== 0 || search_model.trim() == null || search_model.trim().length==0){
	                       		 window.parent.modalOutError("设备型号不能为空!");
	                       		 return;
	                       	 }	 
	                       	 
	                       	 if(search_name==null || search_name.length== 0 || search_name.trim() == null || search_name.trim().length==0){
	                       		 window.parent.modalOutError("设备名称不能为空!");
	                       		 return;
	                       	 }	
	                       	 
	                       	 if(search_number==null || search_number.length== 0 || search_number.trim() == null || search_number.trim().length==0){
	                       		 window.parent.modalOutError("设备编号不能为空!");
	                       		 return;
	                       	 }	
	                        	$.ajax({
	       						 cache: true,
	       				         type: "POST",
	       				         url:"<%=basePath%>equipmentInfo/PanduanInsertEquipment.te",
	       				     	 data :  $("#initFormUserAdd").serialize(),
	       				      beforeSend:function(){
	       			            //防止表单重复提交
	       			           $('.form-horizontal').loader('show','<img src="<%=basePath%>images/loading1.gif">');
	       			                    },
	       				         success: function(data) {
	       				        	if(data.result==0){
	       				        		window.parent.modalOutError("该设备编号已有数据"); 
	       				        		$('.form-horizontal').loader('hide');
	       				        		window.parent.modalOutClose();
	       				        	 }else if(data.result==1){
	       				        		$.ajax({
	       	       						 cache: true,
	       	       				         type: "POST",
	       	       				         url:"<%=basePath%>equipmentInfo/insertEquipment.te",
	       	       				     	 data :  $("#initFormUserAdd").serialize(),
	       	       				      beforeSend:function(){
	       	       			            //防止表单重复提交
	       	       			           $('.form-horizontal').loader('show','<img src="<%=basePath%>images/loading1.gif">');
	       	       			                    },
	       	       				         success: function(data) {
	       	       				        	 if(data.result==0){
	       	       				        		window.parent.modalOutError("插入成功"); 
	       	       				        	 	window.parent.modalOutClose();
	       	       				         		 document.getElementById("mainiframe").contentWindow.initEquipmentInfo();
	       	       				        	 }else if(data.result==1){
	       	       				        		window.parent.modalOutError("插入失败");
	       	       				      			window.parent.modalOutClose();	 
	       	       				      	 		 document.getElementById("mainiframe").contentWindow.initEquipmentInfo();
	       	       				        	 }
	       	       				        	 $('.form-horizontal').loader('hide');
	       	       				        	 window.parent.modalOutClose();
	       	       				         },
	       	       				         error: function(request) {
	       	       				        	 $('.form-horizontal').loader('hide');
	       	       				        	 window.parent.modalOutErrorClose();//关闭添加谈框
	       	       							 window.parent.modalOutError("操作超时,请重新登录!!");
	       	       				         }
	       	       					});
	       				        	 }	 
	       				         },
	       				         error: function(request) {
	       				        	 $('.form-horizontal').loader('hide');
	       				        	 window.parent.modalOutErrorClose();//关闭添加谈框
	       							 window.parent.modalOutError("操作超时,请重新登录!!");
	       				         }
	       					});
                        });

 			function initxialakuang(){
				 $("#EMI_TYPE").empty();
				 $("#EMI_DISPLACEMENT").empty();
					 $.ajax({
				         type: "POST",
				         url:"<%=basePath%>equipmentInfo/initEquipmentTwo.te",
				         dataType:"json",
				  	 data : {
				  		MI_TYPE:$("#EMI_MONITOR_TYPE").val(),	 	//所属单位	
				 	 },
				     success: function(data){
				    	var aatype="";
				    	if(data.total != null && data.total.length > 0){
				    		aatype = "<option value=''>请选择</option>";
					    	for(var y=0;y<data.total.length;y++){
					    		var CODE=data.total[y].mt_FID;
					    		var CNAME=data.total[y].mt_NAME;	    		
					    		aatype+='<option value='+CODE+'>'+CNAME+'</option>' 
					    	}
				    	}else{
				    		aatype = "<option value=''>请选择</option>";
				    	}
				    		$("#EMI_TYPE").empty().append(aatype);
				    		bbtype = "<option value=''>请选择</option>";
							$("#EMI_DISPLACEMENT").empty().append(bbtype);
							if(data.total != null && data.total.length > 0){
								$("#displacement")[0].style.display='none';
							}
				     },
				     error: function(request) {
						 window.parent.modalOutError("操作超时,请重新登录!!");
				     }
				});
		 	}
            	
 			function initxialakuangTwo(){
 				$("#EMI_DISPLACEMENT").empty();
					 $.ajax({
				         type: "POST",
				         url:"<%=basePath%>equipmentInfo/initEquipmentTwoInfo.te",
				         dataType:"json",
//					  	 data :  $("#insertFaka").serialize(),
				  	 data : {
				  		MI_TYPE:$("#EMI_TYPE").val(),	 	//所属单位	
				  		
				 	 },
				     success: function(data){
				    	var aatype="";
				    	if(data.total != null && data.total.length > 0){
					    	for(var y=0;y<data.total.length;y++){
					    		var CODE=data.total[y].mt_FID;
					    		var CNAME=data.total[y].mt_NAME;	    		
					    		aatype+='<option value='+CODE+'>'+CNAME+'</option>' 
					    	}
				    	}else{
								aatype = "<option value=''>请选择</option>";
				    	}
		    			$("#EMI_DISPLACEMENT").empty().append(aatype);
						if(data.total != null && data.total.length > 0){
							$("#displacement")[0].style.display='block';
						}else{
							$("#displacement")[0].style.display='none';
						}
				     },
				     error: function(request) {
						 window.parent.modalOutError("操作超时,请重新登录!!");
				     }
				});
			 } 
			 
</script>
</body>
</html>

修改

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改</title>
<link type="text/css" rel="stylesheet" href="<%=basePath%>jeDate/skin/jedate.css">
<link type="text/css" rel="stylesheet" href="<%=basePath%>css/bootstrap/bootstrap-select.css">
<script type="text/javascript" src="<%=basePath%>jeDate/src/jedate.js"></script>
<script src="<%=basePath %>js/bootstrap/center-loader.js"></script>
<script src="<%=basePath%>js/bootstrap/bootstrap-select.js"></script>
</head>
<style>
* {
	font-family: "微软雅黑";
	font-size: 16px;
	letter-spacing: 2px;
}
</style>
<body class="page-container-bg-solid page-header-fixed page-sidebar-closed-hide-logo">

<div class="row">
	<form class="form-horizontal" role="form" id="initFormUserAdd">
		<input type="hidden" name="fid" value="${fid}">
	<div class="col-md-12">
		<div class="portlet light bordered">
			<div class="portlet-body">
				<ul class="nav nav-tabs" id="allTab">
					<li class="active"><a href="#tab_1_1" id="t_1"
						data-toggle="tab" lang="0" style="font-size: 16px;">修改采集设备管理</a>
					</li>
				</ul>
				<div class="tab-content">
					<div class="tab-pane fade active in" id="tab_1_1">
						<div class="row">
							<div class="col-md-12">
								<div class="portlet-body form">
									<div class="form-body">
										<div class="form-group">
											<label class="col-md-3 control-label">监测种类</label>
											<div class="col-md-9" id="temp">
												<input value="${emi.monitor_type}" id="EMI_MONITOR_TYPE"
													name="EMI_MONITOR_TYPE"
													class="form-control input-inline input-medium"  onchange="fun()"
													readonly="readonly" maxlength="50">
<!-- 											<select name="EMI_MONITOR_TYPE" id="EMI_MONITOR_TYPE"  -->
<!-- 											class="form-control m-b input-inline input-medium" onchange="fun()"> -->
<!-- 												<option value="">请选择</option> -->
<%-- 												<c:forEach var="list" items="${list}"> --%>
<%-- 													<option  value="${list.MT_FID}">${list.MT_NAME}</option> --%>
<%-- 												</c:forEach> --%>
<!-- 							                 </select> -->
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-3 control-label">设备类型</label>
											<div class="col-md-9">
												<select id="EMI_TYPE" name="EMI_TYPE"
														class="form-control input-inline input-medium" onchange="funTwo()">
<%-- 													<option value="${emi.EMI_TYPE}">${emi.type}</option> --%>
													<c:forEach items="${emiFid}" var="emiFid">
														<option value="${emiFid.MT_FID}"
															<c:if test='${emiFid.MT_FID == emi.EMI_TYPE}'>selected='selected'</c:if>>${emiFid.MT_NAME}</option>
													</c:forEach>
												</select> 
												<span style="color: red">*</span>
											</div>
										</div>
										<div class="form-group" id="displacement"
											style="display: none" >
											<label class="col-md-3 control-label">位移监测</label>
											<div class="col-md-9">
												<select id="EMI_DISPLACEMENT" name="EMI_DISPLACEMENT"
													class="form-control input-inline input-medium"
													maxlength="50">
													<c:forEach items="${dispFid}" var="dispFid">
														<option value="${dispFid.MT_FID}"
															<c:if test='${dispFid.MT_FID == emi.EMI_DISPLACEMENT}'>selected='selected'</c:if>>${dispFid.MT_NAME}</option>
													</c:forEach>
<%-- 													<option value="${emi.EMI_DISPLACEMENT}">${emi.displacement}</option> --%>
												</select> <span style="color: red">*</span>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-3 control-label">设备型号</label>
											<div class="col-md-9">
												<input type="text" name="EMI_MODEL" id="EMI_MODEL"
													class="form-control input-inline input-medium"
													maxlength="50" value="${emi.EMI_MODEL}"> <span
													style="color: red">*</span>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-3 control-label">设备名称</label>
											<div class="col-md-9">
												<input type="text" name="EMI_NAME" id="EMI_NAME"
													class="form-control input-inline input-medium"
													maxlength="50" value="${emi.EMI_NAME}"> <span
													style="color: red">*</span>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-3 control-label">设备编号</label>
											<div class="col-md-9">
												<input type="text" name="EMI_NUMBER" id="EMI_NUMBER"
													class="form-control input-inline input-medium"
													maxlength="50" value="${emi.EMI_NUMBER}"> <span
													style="color: red">*</span>
												</div>
											</div>
										</div>
										<div class="form-actions">
											<div class="row">
												<div class="col-md-offset-3 col-md-9">
													<button type="button" class="btn green" id="saveUserInfo">保存</button>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="clearfix margin-bottom-20"></div>
				</div>
			</div>
		</div>
	</form>
</div>
<script type="text/javascript">
$("#displacement").ready(function(){
	
	var aa = $("#EMI_DISPLACEMENT").val();
// 	alert(aa.length)
	if(aa.length>0){
		var div=document.getElementById("displacement");
		div.style.display="block";
	}

});
                        $("#saveUserInfo").click(function(){
                        	//增加相应的表单验证,否则无法进行保存处理
                        	//增加相应的验证信息
//                         	var serviceCompany = $("#RR_SERVICE_COMPANY").ySelectedValues(",");
	                       	
                        	var search_monitor_type = $("#EMI_MONITOR_TYPE").val();//监测种类
	                		var search_type = $("#EMI_TYPE").val();//设备类型
	                		var search_displacement = $("#EMI_DISPLACEMENT").val();//位移
	                		var search_model = $("#EMI_MODEL").val();//设备型号
	                		var search_name = $("#EMI_NAME").val();//设备名称
	                		var search_number = $("#EMI_NUMBER").val();//设备编号
	                       	 
							 if(search_type==null || search_type.length== 0 || search_type.trim() == null || search_type.trim().length==0 || search_type=="请选择"){
								 window.parent.modalOutError("设备类型不能为空!");
                       			 return;
	                       	 }
// 							 if(search_displacement==null ||search_displacement=="" || search_displacement=="请选择"){
// 								 window.parent.modalOutError("位移不能为空!");
//                        			 return;
// 	                       	 }
	                       	 if(search_model==null || search_model.length== 0 || search_model.trim() == null || search_model.trim().length==0){
	                       		 window.parent.modalOutError("设备型号不能为空!");
	                       		 return;
	                       	 }	 
	                       	 
	                       	 if(search_name==null || search_name.length== 0 || search_name.trim() == null || search_name.trim().length==0){
	                       		 window.parent.modalOutError("设备名称不能为空!");
	                       		 return;
	                       	 }	
	                       	 
	                       	 if(search_number==null || search_number.length== 0 || search_number.trim() == null || search_number.trim().length==0){
	                       		 window.parent.modalOutError("设备编号不能为空!");
	                       		 return;
	                       	 }		

	                        	$.ajax({
	       						 cache: true,
	       				         type: "POST",
	       				         url:"<%=basePath%>equipmentInfo/updateEquipment.te",
	       				     	 data :  $("#initFormUserAdd").serialize(),
	       				      beforeSend:function(){
	       			            //防止表单重复提交
	       			           $('.form-horizontal').loader('show','<img src="<%=basePath%>images/loading1.gif">');
	       			                    },
	       				         success: function(data) {
	       				        	 $('.form-horizontal').loader('hide');
	       				        	 window.parent.modalOutClose();
	              		        	 $(".modal-backdrop").remove();
	       				        	 if(data.result==0){
	       				        		window.parent.modalOutError("修改成功"); 
   	       				        	 	window.parent.modalOutClose();
   	       				        		document.getElementById("mainiframe").contentWindow.initEquipmentInfo();
// 	       				        		window.parent.modalOutError("该单位该类型已有数据"); 
	       				        	 $('.form-horizontal').loader('hide');
	       				        	 }else if(data.result==1){
	       				        		window.parent.modalOutError("修改失败!!");
	       				        	 }	       				        	 	       				        	   				        	 	       				        	 
	       				         },
	       				         error: function(request) {
	       				        	 $('.form-horizontal').loader('hide');
	       				        	 window.parent.modalOutErrorClose();//关闭添加谈框
	       							 window.parent.modalOutError("操作超时,请重新登录!!");
	       				         }
	       					});
                        });
                        
                  function fun(){
           				 $("#EMI_TYPE").empty();
           				 $("#EMI_DISPLACEMENT").empty();
           					 $.ajax({
           				         type: "POST",
           				         url:"<%=basePath%>equipmentInfo/initEquipmentTwo.te",
           				         dataType:"json",
           				  	 data : {
           				  		MI_TYPE:$("#EMI_MONITOR_TYPE").val(),	 	//所属单位	
           				 	 },
           				     success: function(data){
           				    	
           				    	var aatype="";
           				    	if(data.total != null && data.total.length > 0){
           				    		aatype += "<option value=''>请选择</option>";
           					    	for(var y=0;y<data.total.length;y++){
           					    		var CODE=data.total[y].mt_FID;
           					    		var CNAME=data.total[y].mt_NAME;	    		
           					    		aatype+='<option value='+CODE+'>'+CNAME+'</option>' 
           					    	}
           				    	}else{
           				    		aatype = "<option value=''>请选择</option>";
           				    	}
           				    		$("#EMI_TYPE").empty().append(aatype);
           				    		bbtype = "<option value=''>请选择</option>";
           							$("#EMI_DISPLACEMENT").empty().append(bbtype);
           				     },
           				     error: function(request) {
           						 window.parent.modalOutError("操作超时,请重新登录!!");
           				     }
           				});
           		 	}   

 	 	  	  function funTwo(){
  				$("#EMI_DISPLACEMENT").empty();
					 $.ajax({
				         type: "POST",
				         url:"<%=basePath%>equipmentInfo/initEquipmentTwoInfo.te",
				         dataType:"json",
				  	 data : {
				  		MI_TYPE:$("#EMI_TYPE").val(),	 	//所属单位	
				 	 },
				
				     success: function(data){
					    	var aatype="";
					    	if(data.total != null && data.total.length > 0){
						    	for(var y=0;y<data.total.length;y++){
						    		var CODE=data.total[y].mt_FID;
						    		var CNAME=data.total[y].mt_NAME;	    		
						    		aatype+='<option value='+CODE+'>'+CNAME+'</option>' 
						    	}
					    	}else{
									aatype = "<option value=''>请选择</option>";
					    	}
			    			$("#EMI_DISPLACEMENT").empty().append(aatype);
							if(data.total != null && data.total.length > 0){
								$("#displacement")[0].style.display='block';
							}else{
								$("#displacement")[0].style.display='none';
							}
					     },
					     error: function(request) {
							 window.parent.modalOutError("操作超时,请重新登录!!");
					     }
				});
			 }  
            	  	 
</script>
</body>
</html>

controller

package enytek.com.cn.controller.equipmentInfo;

import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.collections.set.CompositeSet.SetMutator;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.google.zxing.qrcode.decoder.Mode;

import enytek.com.cn.annotation.LogRecord;
import enytek.com.cn.model.equipmentInfo.EquipmentInfoEntity;
import enytek.com.cn.model.functionbuttoninfo.FunctionButtonInfoModel;
import enytek.com.cn.model.holdingcopany.HoldingCompanyModel;
import enytek.com.cn.model.ltemType.ItemTypeEntity;
import enytek.com.cn.model.menuinfo.MenuInfoModel;
import enytek.com.cn.model.monitorType.MonitorTypeEntity;
import enytek.com.cn.model.sysDataDictionary.SysDataDictionayModel;
import enytek.com.cn.model.userInfo.UserInfoEntity;
import enytek.com.cn.service.Userinfo.UserInfoService;
import enytek.com.cn.service.dataAnalysis.DataAnalysisService;
import enytek.com.cn.service.equipmentAlarm.EquipmentAlarmService;
import enytek.com.cn.service.equipmentInfo.EquipmentInfoService;
import enytek.com.cn.service.ltemType.ItemTypeService;
import enytek.com.cn.service.monitorType.MonitorTypeService;
import enytek.com.cn.service.sysDataDictionary.SysDataDictionaryService;
import enytek.com.cn.util.CommonUtil;
import enytek.com.cn.util.LogType;
import enytek.com.cn.util.echecomap.EhcacheMapUtil;
import enytek.com.cn.util.userlimit.AllLimitUtil;

@Controller
@RequestMapping("equipmentInfo")
public class EquipmentInfoController {
	@Autowired
	private EquipmentInfoService equipmentInfoService;
	@Autowired
	private UserInfoService userInfoService;
	@Autowired
	private SysDataDictionaryService sysDataDictionaryService;
	@Autowired
	private MonitorTypeService monitorTypeService;
	@Autowired
	private DataAnalysisService dataAnalysisService;
	@Autowired
	private ItemTypeService itemTypeService;
	
	/**
	 * 字典表内容
	 * @param dic
	 * @return
	 */
	public List<SysDataDictionayModel> getDataDic(String dic){
		SysDataDictionayModel sysData = new SysDataDictionayModel();
		sysData.setSDD_DICTIONARY(dic);
		List<SysDataDictionayModel> sysDataList = sysDataDictionaryService.findDicInfo(sysData);
		return sysDataList;
	}
	
	public List<MonitorTypeEntity> getDataMonitor(String mon){
		MonitorTypeEntity monitor = new MonitorTypeEntity();
		monitor.setMT_GRADE_TYPE(mon);
		List<MonitorTypeEntity> mteList = monitorTypeService.selectMonitorTypeInfo(monitor);
		return mteList;
	}
	/**
	 * 查询初始化
	 * @param equipmentInfo
	 * @param session
	 * @param noChangeFid
	 * @param model
	 * @param auditFid
	 * @return
	 */
	@RequestMapping("showEquipmentInfo")
	public String showEquipmentInfo(EquipmentInfoEntity equipmentInfo,HttpSession session,String noChangeFid,Model model,String auditFid ){
		UserInfoEntity userInfo = (UserInfoEntity) session.getAttribute("LoginUserInfo");

		List<SysDataDictionayModel> sysRtdType = getDataDic("0100");
		model.addAttribute("sys", sysRtdType);
		
		//下拉列表设备型号
		EquipmentInfoEntity modelOne=new EquipmentInfoEntity();
		//String emi_MODEL = equipmentInfo.getEMI_MODEL();
		//CommonUtil.getString("EMI_MODEL", emi_MODEL);
		List<EquipmentInfoEntity> selectEquipInfo = equipmentInfoService.selectEquipInfo(modelOne);
		model.addAttribute("epiList", selectEquipInfo);
		
		
		MonitorTypeEntity mte = new MonitorTypeEntity();
		mte.setMT_GRADE_TYPE("0");
		String[] aaa={"btn blue","btn yellow","btn green","btn white"};
		List<MonitorTypeEntity> mteList = monitorTypeService.selectMonitorTypeInfo(mte);
		
		MonitorTypeEntity mte1 = new MonitorTypeEntity();
		mte1.setMT_GRADE_TYPE("1");
		List<MonitorTypeEntity> selectMonitorTypeInfo = monitorTypeService.selectMonitorTypeInfo(mte1);
		for (int i = 0; i < mteList.size(); i++) {
			if (mteList.get(i).getMT_TYPE() != null && mteList.get(i).getMT_TYPE().equals("1")) {
				mteList.get(i).setMT_DELFLAG(aaa[0]);
			}else if (mteList.get(i).getMT_TYPE() != null && mteList.get(i).getMT_TYPE().equals("2")) {
				mteList.get(i).setMT_DELFLAG(aaa[1]);
			}else if (mteList.get(i).getMT_TYPE() != null && mteList.get(i).getMT_TYPE().equals("3")) {
				mteList.get(i).setMT_DELFLAG(aaa[2]);
			}else{
				mteList.get(i).setMT_DELFLAG(aaa[3]);
			}
			List<MonitorTypeEntity> list = new ArrayList<>();
			for (int j = 0; j < selectMonitorTypeInfo.size(); j++) {
				if (mteList.get(i).getMT_FID().equals(selectMonitorTypeInfo.get(j).getMT_SUPERIOR())) {
					list.add(selectMonitorTypeInfo.get(j));
				}
			}
		}
		model.addAttribute("list", mteList);
		
		
		
		Object obj = EhcacheMapUtil.getObject("btn"+userInfo.getUI_FID());
		if(obj!=null){
			List<FunctionButtonInfoModel> tempList = (List<FunctionButtonInfoModel>)obj;
			//获取一级按钮的信息start
			List<FunctionButtonInfoModel> resultList = new ArrayList<FunctionButtonInfoModel>();
			AllLimitUtil.getButtonListInfoFromFid(noChangeFid, tempList, resultList);
			model.addAttribute("allPollutantDeliveryBtn",resultList);
			//获取一级按钮的信息end
			if(resultList!=null && resultList.size()>0){
				for (int j = 0; j < resultList.size(); j++) {
					List<FunctionButtonInfoModel> resultListErJi = new ArrayList<FunctionButtonInfoModel>();
					FunctionButtonInfoModel tempFunctionButtonInfoModel=resultList.get(j);
					String erJiFId = tempFunctionButtonInfoModel.getFBI_FID();
					AllLimitUtil.getButtonListInfoFromFid(erJiFId, tempList, resultListErJi);
					model.addAttribute("pollutantDeliverySecond"+resultList.get(j).getFBI_URL(),resultListErJi);
				}
			}
			
			model.addAttribute("auditFid", auditFid);
		}else{
			return "permissionDenied";
		}	
		
		return "equipmentInfo/showEquipmentInfo";
	}
	/**
	 * 分页查询
	 * @param equipmentInfo
	 * @param session
	 * @param pageSize
	 * @param pageNumber
	 * @param model
	 * @return initEquipmentInfo
	 * @throws Exception
	 */
	@RequestMapping("initEquipmentInfo")
	@ResponseBody
	public Map<String, Object> initEquipmentInfo(EquipmentInfoEntity equipmentInfo,HttpSession session,
			@RequestParam Integer pageSize,@RequestParam Integer pageNumber,Model model) throws Exception{
 		UserInfoEntity userInfo = (UserInfoEntity)session.getAttribute("LoginUserInfo");
		Map<String, Object> result = new HashMap<String, Object>();
		
		if (userInfo!=null && userInfo.getLoginHoldIngCompany()!=null) {
			 	
			if (equipmentInfo != null ) {
				if(equipmentInfo.getEMI_MODEL_LIST()!=null && !"".equals(equipmentInfo.getEMI_MODEL_LIST())) {
//					equipmentInfo.setEMI_MODEL(CommonUtil.getString("EMI_MODEL", Arrays.asList(equipmentInfo.getEMI_MODEL().split(","))));
					String[] splitNum = equipmentInfo.getEMI_MODEL_LIST().split(",");
					String connectListString = CommonUtil.connectListString(splitNum);
					equipmentInfo.setEMI_MODEL_LIST(null);
					equipmentInfo.setEMI_MODEL_LIST(connectListString);
				}
				//创建人
				String companyFid = "";
				UserInfoEntity user =new UserInfoEntity();
				user.setUI_NAME(equipmentInfo.getEMI_ESTABLISH_PEOPLE_LIST());
				List<UserInfoEntity> findAllUserInfo = userInfoService.selectUserInfo(user);
				if (findAllUserInfo!=null && findAllUserInfo.size()>0) {
					List<String> sti = new ArrayList<String>();
					for (int j = 0; j < findAllUserInfo.size(); j++) {
						sti.add(findAllUserInfo.get(j).getUI_FID());
					}
					companyFid = CommonUtil.getString("EMI_ESTABLISH_PEOPLE", sti);
//					equipmentInfo.setEMI_ESTABLISH_PEOPLE_LIST(companyFid);
				}
				if(equipmentInfo.getEMI_ESTABLISH_PEOPLE_LIST()!=null && !"".equals(equipmentInfo.getEMI_ESTABLISH_PEOPLE_LIST())){
					if(companyFid!=null && !"".equals(companyFid) && companyFid.length()>0){
						equipmentInfo.setEMI_ESTABLISH_PEOPLE_LIST(companyFid);
					}else{
						equipmentInfo.setEMI_ESTABLISH_PEOPLE_LIST("EMI_ESTABLISH_PEOPLE = '0'");
					}
				}
				//创建设备
				/*EquipmentInfoEntity userOne =new EquipmentInfoEntity();
				userOne.setEMI_MODEL(equipmentInfo.getEMI_MODEL_LIST()); 
				List<EquipmentInfoEntity> findMonInfo =equipmentInfoService.selectEquipInfo(userOne);
				if (findMonInfo!=null && findMonInfo.size()>0) {
					List<String> mon =new ArrayList<String>();
					for (int z = 0; z < findMonInfo.size(); z++) {
						mon.add(findMonInfo.get(z).getEMI_FID());
					}
					String modelOne = CommonUtil.getString("EMI_MODEL", mon);
					equipmentInfo.setEMI_MODEL_LIST(modelOne);
				}else{
					equipmentInfo.setEMI_MODEL_LIST("");
				}*/
			}
        
			
			List<EquipmentInfoEntity> selectEquipmentInfoPaging = equipmentInfoService.selectEquipmentInfoPaging(equipmentInfo, pageNumber, pageSize);
			Integer selectEquipmentInfoCount = equipmentInfoService.selectEquipmentInfoCount(equipmentInfo);
			
			if (equipmentInfo.getEMI_MONITOR_TYPE() ==null && equipmentInfo.getEMI_MONITOR_TYPE()== "") {
				equipmentInfo.setEMI_MONITOR_TYPE_LIST(CommonUtil.getString("EMI_MONITOR_TYPE", userInfo.getCompanyList()));
			}
			result.put("total", selectEquipmentInfoCount);
			result.put("rows", selectEquipmentInfoPaging);
		}
		return result;
	}

	/**
	 * 二级联动查表
	 */
	@RequestMapping("initEquipmentTwo")
	@ResponseBody
	public Map<String, Object> initEquipmentTmo(HttpSession session,String MI_TYPE,String MT_FID,String EMI_TYPE,Model model) throws Exception{
		Map<String, Object> result = new HashMap<String, Object>();
		if(MI_TYPE!=null && !"".equals(MI_TYPE) && MI_TYPE.length()>0){
			MonitorTypeEntity Entity=new MonitorTypeEntity();
			Entity.setMT_SUPERIOR(MI_TYPE);
			List<MonitorTypeEntity> selectMonitorTypeInfo = monitorTypeService.selectMonitorTypeInfo(Entity);
			result.put("total", selectMonitorTypeInfo);
		}
//		if(EMI_TYPE!=null && !"".equals(EMI_TYPE) && EMI_TYPE.length()>0){
//			EquipmentInfoEntity EntityOne=new EquipmentInfoEntity();
//			EntityOne.setEMI_TYPE(EMI_TYPE);
//			List<EquipmentInfoEntity> equipmentList1 = dataAnalysisService.equipmentList1(EntityOne);
//			result.put("total", equipmentList1);
//		}
		return result;
	}
	/**
	 * 三级联动查表
	 * @param session
	 * @param MI_TYPE
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("initEquipmentTwoInfo")
	@ResponseBody
	public Map<String, Object> initEquipmentTwoInfo(HttpSession session,String MI_TYPE,Model model) throws Exception{
		Map<String, Object> result = new HashMap<String, Object>();
		
		if (MI_TYPE!=null && !"".equals(MI_TYPE) && MI_TYPE.length()>0) {
			MonitorTypeEntity monitor = new MonitorTypeEntity();
			monitor.setMT_SUPERIOR(MI_TYPE);
			List<MonitorTypeEntity> selectMonitorTypeInfo2 = monitorTypeService.selectMonitorTypeInfo(monitor);
			result.put("total", selectMonitorTypeInfo2);
		}
	return result;
	}
	
	/**
	 * 创建用户下面有多少设备
	 * @param session
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public Map<String, Object> userEquipment(HttpSession session,Model model) throws Exception{
		UserInfoEntity userInfo = (UserInfoEntity)session.getAttribute("LoginUserInfo");
		Map<String, Object> result = new HashMap<String, Object>();
		
		EquipmentInfoEntity equipment = new EquipmentInfoEntity();
		equipment.setEMI_ESTABLISH_PEOPLE(userInfo.getUI_FID());
		Integer selectEquipmentInfoCount = equipmentInfoService.selectEquipmentInfoCount(equipment);
		result.put("total", selectEquipmentInfoCount);
	return result;
	}
	
	/**
	 * 创建用户登录下面有多少项目
	 * @param session
	 * @param model
	 * @return
	 */
	public Map<String ,Object> loginEquipment(HttpSession session,Model model){
		UserInfoEntity userInfo = (UserInfoEntity)session.getAttribute("LoginUserInfo");
		Map<String, Object> result = new HashMap<String, Object>();
		
		ItemTypeEntity itemType = new ItemTypeEntity();
		itemType.setLT_ESTABLISH_PEOPLE(userInfo.getUI_FID());
		Integer selectItemTypeCount = itemTypeService.selectItemTypeCount(itemType);
		result.put("total", selectItemTypeCount);
		return result;
	}
	
	/**
	 * 初始化跳转新增页面
	 * @param equipmentInfo
	 * @param session
	 * @param model
	 * @param noChangeFid
	 * @param auditFid
	 * @return
	 */
	@RequestMapping("insertEquipmentInfo")
	public String insertEquipmentInfo(EquipmentInfoEntity equipmentInfo,HttpSession session,Model model,String noChangeFid,String auditFid){
		UserInfoEntity userInfo = (UserInfoEntity) session.getAttribute("LoginUserInfo");
		
		
		
		MonitorTypeEntity mte = new MonitorTypeEntity();
		mte.setMT_GRADE_TYPE("0");
		List<MonitorTypeEntity> mteList = monitorTypeService.selectMonitorTypeInfo(mte);
		model.addAttribute("list", mteList);
		
		model.addAttribute("auditFid",auditFid);
		return "equipmentInfo/insertEquipmentInfo";
	}
	/**
	 * 新增模块信息该单位该类型已有数据
	 * 
	 */
	@RequestMapping("PanduanInsertEquipment")
	@ResponseBody
	public Map<String , Object> insertResearchReport(HttpSession session,EquipmentInfoEntity equipmentInfo) throws Exception{
		UserInfoEntity userInfo = (UserInfoEntity)session.getAttribute("LoginUserInfo");
		Map<String, Object> result = new HashMap<String, Object>();
		try {
			EquipmentInfoEntity equ =new EquipmentInfoEntity();
			equ.setEMI_MODEL(equipmentInfo.getEMI_MODEL());
			equ.setEMI_NUMBER(equipmentInfo.getEMI_NUMBER());
			List<EquipmentInfoEntity> selectEquipInfo = equipmentInfoService.selectEquipInfo(equ);
			
			if (selectEquipInfo.size()>0) {
				boolean ofNot = false;
				for (int i = 0; i < selectEquipInfo.size(); i++) {
					if (userInfo.getUI_FID().equals(selectEquipInfo.get(i).getEMI_ESTABLISH_PEOPLE())) {
						ofNot = true;
					}
				}
				if (ofNot) {
					result.put("result", "0");
				}else{
					result.put("result", "1");
				}
			}else{
				result.put("result", "1");
			}
		} catch (Exception e) {
			e.printStackTrace();
			result.put("result", "1");
		}
		return result;
		
	}
	/**
	 * 新增模块信息
	 * @return
	 */
	@LogRecord(option=LogType.INSERT,module="采集设备管理",description="执行新增操作")
	@RequestMapping("insertEquipment")
	@ResponseBody
	public Map<String, Object> insertEquipment(HttpSession session,EquipmentInfoEntity equipmentInfo){
		UserInfoEntity userInfo = (UserInfoEntity) session.getAttribute("LoginUserInfo");
		Map<String, Object> result = new HashMap<String, Object>();
		
//		MonitorTypeEntity monitorType= new MonitorTypeEntity();
//		monitorType.setMT_GRADE_TYPE("1");
//		List<MonitorTypeEntity> MonitorTypeInfo = monitorTypeService.selectMonitorTypeInfo(monitorType);
//		if (monitorType.getMT_FID() != null && !monitorType.getMT_FID().equals("")) {
//			equipmentInfo.setEMI_DISPLACEMENT(monitorType.getMT_FID());
//		}
		
		try {
			String ui_fid = userInfo.getUI_FID();
			String emi_fid = CommonUtil.getRandomNum("EMI");
			equipmentInfo.setEMI_FID(emi_fid);
			equipmentInfo.setEMI_ESTABLISH_PEOPLE(ui_fid);
			equipmentInfoService.insertEquipInfo(equipmentInfo);
			result.put("result", "0");
		} catch (Exception e) {
			e.printStackTrace();
			result.put("result", "1");
		}
		return result;
	}
	
	/**
	 * 修改前展示模块信息
	 * @throws Exception 
	 */
	@RequestMapping("updateEquipmentInfo")
	public String updateEquipmentInfo(HttpSession session,String noChanggeFid,Model model,String fid,String anditFid){
		if (fid!=null && fid!="") {
			model.addAttribute("fid",fid);
			EquipmentInfoEntity equipmentInfo =new EquipmentInfoEntity();
			equipmentInfo.setEMI_FID(fid);
			List<EquipmentInfoEntity> listEMI = equipmentInfoService.selectEquipInfo(equipmentInfo);
			if (listEMI!=null && listEMI.size()>0) {
				EquipmentInfoEntity emi = listEMI.get(0);
				model.addAttribute("emi",emi);
				//二级联动
				String monitor = listEMI.get(0).getEMI_MONITOR_TYPE();
				MonitorTypeEntity Entity1=new MonitorTypeEntity();
				Entity1.setMT_SUPERIOR(monitor);
				List<MonitorTypeEntity> selectMonitorTypeInfo = monitorTypeService.selectMonitorTypeInfo(Entity1);
				model.addAttribute("emiFid",selectMonitorTypeInfo);

				String typeOne = emi.getEMI_TYPE();
				MonitorTypeEntity typeTwo = new MonitorTypeEntity();
				typeTwo.setMT_SUPERIOR(typeOne);
				List<MonitorTypeEntity> selectMonitorTypeInfo2 = monitorTypeService.selectMonitorTypeInfo(typeTwo);
				model.addAttribute("dispFid",selectMonitorTypeInfo2);
			}
			model.addAttribute("anditFid",anditFid);
		}
		
		List<MonitorTypeEntity> mteList = getDataMonitor("0");
		model.addAttribute("list", mteList);
		
		
		List<MonitorTypeEntity> mteList1 = getDataMonitor("1");
		model.addAttribute("list1", mteList1);
		
		return "equipmentInfo/updateEquipmentInfo";
	}
	
	/**
	 * 修改模块信息
	 * 
	 */
	@LogRecord(option=LogType.UPDATE,module="采集设备管理",description="执行修改操作")
	@RequestMapping("updateEquipment")
	@ResponseBody
	public Map<String, Object> updateEquipment(String fid,HttpSession session,EquipmentInfoEntity equipmentInfo){
		UserInfoEntity userInfo = (UserInfoEntity)session.getAttribute("LoginUserInfo");
		Map<String, Object> result = new HashMap<String, Object>();
		
//		if (equipmentInfo.getEMI_DISPLACEMENT() != null && !equipmentInfo.getEMI_DISPLACEMENT().equals("")) {
//			equipmentInfo.setEMI_TYPE(equipmentInfo.getEMI_DISPLACEMENT());
//		}
		try {
			String ui_fid = userInfo.getUI_FID();
			
			equipmentInfo.setEMI_FID(fid);
			equipmentInfo.setEMI_ESTABLISH_PEOPLE(ui_fid);
			equipmentInfo.setEMI_MONITOR_TYPE(userInfo.getHC_FID());
			
			equipmentInfoService.updateEquipInfo(equipmentInfo);
			
			result.put("result", "0");
		} catch (Exception e) {
			e.printStackTrace();
			result.put("result", "1");
		}
		return result;
	}
	
	/**
	 * 删除模块信息
	 * 
	 */
	@LogRecord(option=LogType.DELETE,module="采集设备管理",description="执行删除操作")
	@RequestMapping("delEquipment")
	@ResponseBody
	public Map<String, Object> delEquipment(EquipmentInfoEntity equipmentInfo,HttpSession session,String fid){
		Map<String, Object> result = new HashMap<String, Object>();
		//创建数组
		String inem_ID = equipmentInfo.getINEM_ID();
		String[] split = inem_ID.split(",");
		//循环判断多条要删除数据
		for(int i=0;i<split.length;i++){
			EquipmentInfoEntity rec=new EquipmentInfoEntity();
			
			rec.setEMI_FID(split[i]);
			equipmentInfoService.deleteEquipInfo(rec);
		}
		result.put("result", "success");
		return result;
	}
	
	/**
	 * 导出EXCEL
	 * @param response
	 * @return 
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("deprecation")//主要用在取消一些编译器产生的警告对代码左侧行列的遮挡
	@RequestMapping(value="exportExcel")
	@ResponseBody
	public void exportExcelFile(HttpServletResponse response,EquipmentInfoEntity equipmentInfo,HttpSession session) throws Exception{
		UserInfoEntity userInfo = (UserInfoEntity)session.getAttribute("LoginUserInfo");
		Object obj = EhcacheMapUtil.getObject("btn"+userInfo.getUI_FID());
		
		//创建一个Excel文件 
		 HSSFWorkbook wb=new HSSFWorkbook();
		 HSSFSheet sheet = wb.createSheet("采购设备管理");
	        sheet.setColumnWidth(0, 20 * 256);
	        sheet.setColumnWidth(1, 20 * 256);
	        sheet.setColumnWidth(2, 20 * 256);
	        sheet.setColumnWidth(3, 20 * 256);
	        sheet.setColumnWidth(4, 20 * 256);
	        sheet.setColumnWidth(5, 20 * 256);
	        sheet.setColumnWidth(6, 20 * 256);
	        sheet.setColumnWidth(7, 20 * 256);
	        sheet.setColumnWidth(8, 20 * 256);
	        sheet.setColumnWidth(9, 20 * 256);
	        sheet.setColumnWidth(10, 20 * 256);
	        sheet.setColumnWidth(11, 20 * 256);
	        sheet.setColumnWidth(12, 20 * 256);
	        // 第三步,在sheet中添加表头第0行,注意老版本poi对Excel的行数列数有限制short  
	        HSSFRow row = sheet.createRow((int) 0);  
	        // 第四步,创建单元格,并设置值表头 设置表头居中  
	        HSSFCellStyle style = wb.createCellStyle();
			HSSFCell cell = row.createCell((short) 0);  
	        cell.setCellValue("序号");  
	        cell.setCellStyle(style);  
	        cell = row.createCell((short) 1);  
	        cell.setCellValue("监测种类");  
	        cell.setCellStyle(style);  
	        cell = row.createCell((short) 2);
	        cell.setCellValue("设备类型");  
	        cell.setCellStyle(style);  
	        cell = row.createCell((short) 3);  
	        cell.setCellValue("设备编号");  
	        cell.setCellStyle(style);  
	        cell = row.createCell((short) 4);
	        cell.setCellValue("创建人");  
	        cell.setCellStyle(style);  
	        cell = row.createCell((short) 5);  
	        cell.setCellValue("创建时间");  
	        cell.setCellStyle(style);  
	        
//	        equipmentInfo.setENDTIME(equipmentInfo.getENDTIME()+" 23:59:59");
	        List<EquipmentInfoEntity> equipment =equipmentInfoService.selectEquipInfoExcel(equipmentInfo);
	        for(int i=0;i<equipment.size();i++){
	        	row = sheet.createRow((int) i + 1);
	        	EquipmentInfoEntity tcharge = (EquipmentInfoEntity)equipment.get(i);
	        	//放入相应的数据
	        	row.createCell((short) 0).setCellValue(i+1);
	        	row.createCell((short) 1).setCellValue(tcharge.getEMI_MONITOR_TYPE());
	        	row.createCell((short) 2).setCellValue(tcharge.getEMI_TYPE());
	        	row.createCell((short) 3).setCellValue(tcharge.getEMI_NUMBER());
	        	row.createCell((short) 4).setCellValue(tcharge.getEMI_ESTABLISH_PEOPLE());
	        	row.createCell((short) 5).setCellValue(tcharge.getEMI_ESTABLISH_TIME());
	        }
	        	//存放位置
	        	 try  
	             {  
	        		    response.setContentType("application/x-download");//客户端浏览器
		        		String fileName = "采购设备管理.xlsx";
		         		fileName = URLEncoder.encode(fileName, "UTF-8");//客户端在进行网页请求的时
		         		response.addHeader("Content-Disposition", "attachment;filename=" + fileName);//下载后的文件名
		         		OutputStream out = response.getOutputStream();//输出的对象
		    			wb.write(out);
		    			out.close();
	             }  
	             catch (Exception e)  
	             {  
	                 e.printStackTrace();
	             }
	        
	}
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值