展示
新增
修改
删除
导出
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:'',
queryParams:queryParams,
singleSelect: false,
pageSize: 10,
pageList: [10, 20,30],
search: false,
showColumns: false,
sidePagination: "server",
striped:true,
clickToSelect:true,
columns: [{
checkbox: true,
visible: true
},
{
field: 'emi_FID',
visible:false,
valign:'middle',
align: 'center',
},
{
field: 'rownum_',
title: '序号',
align: 'center',
width: 40,
},
{
field: 'emi_MONITOR_TYPE',
title: '监测种类',
valign:'middle',
align: 'center',
},
{
field: 'emi_TYPE',
title: '设备类型',
valign:'middle',
align: 'center',
},
{
field: 'emi_NUMBER',
title: '设备编号',
valign:'middle',
align: 'center',
},
{
field: 'emi_MODEL',
title: '设备型号',
valign:'middle',
align: 'center',
},
{
field: 'emi_NAME',
title: '设备名称',
valign:'middle',
align: 'center',
},
{
field: 'emi_ESTABLISH_PEOPLE',
title: '创建人',
valign:'middle',
align: 'center',
},
{
field:'emi_ESTABLISH_TIME',
title:'创建时间',
valign: 'middle',
align: 'center',
}
],
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 () {
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',
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}');
})
<%-- 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 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 : {
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();
if(aa.length>0){
var div=document.getElementById("displacement");
div.style.display="block";
}
});
$("#saveUserInfo").click(function(){
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_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();
$('.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;
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;
}
@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();
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;
List<FunctionButtonInfoModel> resultList = new ArrayList<FunctionButtonInfoModel>();
AllLimitUtil.getButtonListInfoFromFid(noChangeFid, tempList, resultList);
model.addAttribute("allPollutantDeliveryBtn",resultList);
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";
}
@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())) {
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);
}
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'");
}
}
}
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);
}
return result;
}
@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;
}
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;
}
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;
}
@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;
}
@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>();
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;
}
@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>();
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;
}
@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());
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);
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);
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();
}
}
}