first commit
This commit is contained in:
433
WebRoot/jsp/sparepart/sewageInputList.jsp
Normal file
433
WebRoot/jsp/sparepart/sewageInputList.jsp
Normal file
@ -0,0 +1,433 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<!-- 文件上传-->
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css"/>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js" charset="utf-8"></script>
|
||||
<!-- 引入daterangepicker-->
|
||||
<link rel="stylesheet"
|
||||
href="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.css" />
|
||||
<script type="text/javascript"
|
||||
src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/moment.min.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript"
|
||||
src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
var beginTimeStore = '';
|
||||
var endTimeStore = '';
|
||||
function initDate() {
|
||||
//定义locale汉化插件
|
||||
beginTimeStore = moment().subtract(6, 'days').format('YYYY-MM-DD');
|
||||
endTimeStore = moment().subtract(-1, 'days').format('YYYY-MM-DD');
|
||||
var locale = {
|
||||
"format" : 'YYYY-MM-DD',
|
||||
"separator" : " ~ ",
|
||||
"applyLabel" : "确定",
|
||||
"cancelLabel" : "取消",
|
||||
"fromLabel" : "起始时间",
|
||||
"toLabel" : "结束时间'",
|
||||
"customRangeLabel" : "自定义",
|
||||
"weekLabel" : "W",
|
||||
"daysOfWeek" : [ "日", "一", "二", "三", "四", "五", "六" ],
|
||||
"monthNames" : [ "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月",
|
||||
"九月", "十月", "十一月", "十二月" ],
|
||||
"firstDay" : 1
|
||||
};
|
||||
$('#reservationtime').daterangepicker({
|
||||
"timePicker" : false,
|
||||
"timePicker24Hour" : false,
|
||||
"linkedCalendars" : false,
|
||||
"autoUpdateInput" : false,
|
||||
"timePickerIncrement" : 10,
|
||||
"locale" : locale,
|
||||
//汉化按钮部分
|
||||
ranges : {
|
||||
'今日' : [ moment(), moment().subtract(-1, 'days') ],
|
||||
'昨日' : [ moment().subtract(1, 'days'), moment() ],
|
||||
'最近7日' : [ moment().subtract(6, 'days'),
|
||||
moment().subtract(-1, 'days') ],
|
||||
'本月' : [ moment().startOf('month'),
|
||||
moment().endOf('month').subtract(-1, 'days') ],
|
||||
'上月' : [
|
||||
moment().subtract(1, 'month').startOf('month'),
|
||||
moment().subtract(1, 'month').endOf('month')
|
||||
.subtract(-1, 'days') ]
|
||||
},
|
||||
startDate : beginTimeStore,
|
||||
endDate : endTimeStore
|
||||
},
|
||||
function(start, end, label) {
|
||||
beginTimeStore = start.format(this.locale.format);
|
||||
endTimeStore = end.format(this.locale.format);
|
||||
if (!this.startDate) {
|
||||
this.element.val('');
|
||||
|
||||
} else {
|
||||
this.element.val(this.startDate
|
||||
.format(this.locale.format)
|
||||
+ this.locale.separator
|
||||
+ this.endDate.format(this.locale.format));
|
||||
}
|
||||
});
|
||||
$('#reservationtime').val(
|
||||
beginTimeStore + locale.separator + endTimeStore);
|
||||
};
|
||||
var getList = function(id,type,text) {
|
||||
//销毁表格
|
||||
$('#table').bootstrapTable('destroy');
|
||||
$("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/sparepart/sewageInput/getList.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
sdt : beginTimeStore,
|
||||
edt : endTimeStore,
|
||||
input_userid: $('#input_userid').val(),
|
||||
search_name: $('#search_name').val(),
|
||||
select_id: id,
|
||||
type: type,
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* onClickRow: function (row) {//单击行事件,执行查看功能
|
||||
viewFun(row.id);
|
||||
}, */
|
||||
columns: [
|
||||
{
|
||||
field: 'sewage.name', // 返回json数据中的name
|
||||
title: '排污源', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: 180, // 定义列的宽度,单位为像素px
|
||||
},{
|
||||
field: 'inputDt', // 返回json数据中的name
|
||||
title: '采样时间', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: 120, // 定义列的宽度,单位为像素px
|
||||
formatter:function (value, row, index){
|
||||
if(row.id!=null && row.id!=undefined && row.id!='' ){
|
||||
return value.substring(0,16);
|
||||
}else{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'inputUser.caption', // 返回json数据中的name
|
||||
title: '填报人', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: 90, // 定义列的宽度,单位为像素px
|
||||
},
|
||||
{
|
||||
field: 'inputCod', // 返回json数据中的name
|
||||
title: 'COD', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
{
|
||||
field: 'inputPh', // 返回json数据中的name
|
||||
title: 'PH', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
{
|
||||
field: 'inputAmmoniaNitrogen', // 返回json数据中的name
|
||||
title: '氨氮', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
},
|
||||
{
|
||||
field: 'inputPhosphorus', // 返回json数据中的name
|
||||
title: '总磷', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
{
|
||||
field: 'inputNitrogen', // 返回json数据中的name
|
||||
title: '总氮', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
{
|
||||
field: 'inputSs', // 返回json数据中的name
|
||||
title: 'SS', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
{
|
||||
field: 'inputBod', // 返回json数据中的name
|
||||
title: 'BOD', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
{
|
||||
field: 'inputChroma', // 返回json数据中的name
|
||||
title: '色度', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 90, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts= '';
|
||||
if(row.id!=null){
|
||||
buts+= '<security:authorize buttonUrl="sparepart/sewage/edit.do">';
|
||||
buts+= '<a class="btn btn-default btn-sm" title="编辑" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></a>';
|
||||
buts+= '</security:authorize>';
|
||||
|
||||
buts+= '<security:authorize buttonUrl="sparepart/sewage/delete.do">';
|
||||
buts+='<a class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\''+row.id+'\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></a';
|
||||
buts+= '</security:authorize>';
|
||||
}else{
|
||||
buts+= '<security:authorize buttonUrl="sparepart/sewage/new.do">';
|
||||
buts+= '<a class="btn btn-default btn-sm" title="添加" onclick="newFun()"><i class="fa fa-plus"></i><span class="hidden-md hidden-lg"> 添加</span></a>';
|
||||
buts+= '</security:authorize>';
|
||||
}
|
||||
buts='<div class="btn-group" >'+buts+'</div>';
|
||||
return buts;
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
var newData = [{
|
||||
'sewage.name': '<input id="sewageId" name="sewageId" type="text" class="form-control" value="" />',
|
||||
'inputDt': '<input id="inputDt" name="inputDt" type="text" placeholder="点击选择" class="form-control" value="" readonly/>',
|
||||
'inputUser.caption':'${cu.caption}',
|
||||
'inputCod': '<input id="inputCod" name="inputCod" type="text" class="form-control" value="" />',
|
||||
'inputPh': '<input id="inputPh" name="inputPh" type="text" class="form-control" value="" />',
|
||||
'inputAmmoniaNitrogen': '<input id="inputAmmoniaNitrogen" name="inputAmmoniaNitrogen" type="text" class="form-control" value="" />',
|
||||
'inputPhosphorus': '<input id="inputPhosphorus" name="inputPhosphorus" type="text" class="form-control" value="" />',
|
||||
'inputNitrogen': '<input id="inputNitrogen" name="inputNitrogen" type="text" class="form-control" value="" />',
|
||||
'inputSs': '<input id="inputSs" name="inputSs" type="text" class="form-control" value="" />',
|
||||
'inputBod': '<input id="inputBod" name="inputBod" type="text" class="form-control" value="" />',
|
||||
'inputChroma': '<input id="inputChroma" name="inputChroma" type="text" class="form-control" value="" />',
|
||||
}];
|
||||
$('#table').bootstrapTable('prepend', newData);
|
||||
/* $("#inputDt").datepicker({
|
||||
language: 'zh-CN',
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'yyyy-mm-dd',
|
||||
}); */
|
||||
|
||||
$("#inputDt").datetimepicker({
|
||||
language:'zh-CN',
|
||||
format: 'yyyy-mm-dd hh:ii',
|
||||
dateFormat: 'yyyy-mm-dd',//日期显示格式
|
||||
timeFormat: 'HH:mm',//时间显示格式
|
||||
startView: "month", //初始化视图是‘年’
|
||||
minView: 0,
|
||||
maxView: "year",
|
||||
minuteStep: 1,//分钟间隔1分钟
|
||||
autoclose: true
|
||||
}).on('changeDate', function () {
|
||||
|
||||
});
|
||||
var NowTime = getNowTime();
|
||||
$("#inputDt").val(NowTime.substring(0,10));
|
||||
|
||||
//选择工艺段
|
||||
$.post(ext.contextPath + "/sparepart/sewage/getSewage4Select.do", {}, function(data) {
|
||||
$("#sewageId").empty();
|
||||
var selelct_ =$("#sewageId").select2({
|
||||
data: data,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: true,//允许清空
|
||||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||||
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
|
||||
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
|
||||
});
|
||||
selelct_.val(id).trigger("change");
|
||||
},'json');
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
//添加数据
|
||||
var newFun = function() {
|
||||
var sewageId = $("#subForm #sewageId").val();
|
||||
var inputDt = $("#subForm #inputDt").val();
|
||||
if(sewageId!=null && sewageId!=undefined && sewageId!='' && inputDt!=null && inputDt!=undefined && inputDt!=''){
|
||||
$.post(ext.contextPath + '/sparepart/sewageInput/save.do', $("#subForm").serialize() , function(data) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
},'json');
|
||||
}else{
|
||||
alert('添加失败');
|
||||
}
|
||||
};
|
||||
|
||||
//编辑
|
||||
var editFun = function (id) {
|
||||
stopBubbleDefaultEvent();
|
||||
$.post(ext.contextPath + '/sparepart/sewageInput/edit.do', { id: id }, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
//删除一条设备类型数据
|
||||
var deleteFun = function (id) {
|
||||
stopBubbleDefaultEvent();
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(willDelete => {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/sparepart/sewageInput/delete.do', { id: id }, function (data) {
|
||||
if (data == 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
var select_id = "";
|
||||
var select_type = "";
|
||||
var initTreeView = function() {
|
||||
$.post(ext.contextPath + '/sparepart/sewage/getTreeJson.do', {unitId:unitId} , function(data) {
|
||||
$("#tree").empty();
|
||||
var treeData = data.result;
|
||||
$('#tree').treeview({data: treeData,levels: 2});
|
||||
$('#tree').on('nodeSelected', function(event, treeData) {
|
||||
$("#box-title").html(treeData.text);
|
||||
initDate();
|
||||
getList(treeData.id,treeData.type,treeData.text);
|
||||
select_id = treeData.id;
|
||||
select_type = treeData.type;
|
||||
});
|
||||
},'json');
|
||||
};
|
||||
|
||||
//导出
|
||||
function downloadExcelFun() {
|
||||
var sdt = beginTimeStore;
|
||||
var edt = endTimeStore;
|
||||
//var input_userid = $('#input_userid').val();"&input_userid="+input_userid+
|
||||
var search_name = $('#search_name').val();
|
||||
var select_id = select_id;
|
||||
var type = select_type;
|
||||
window.open(ext.contextPath + "/sparepart/sewageInput/downloadExcelFun.do?sdt="+sdt+"&edt="+edt+
|
||||
"&search_name="+search_name+"&select_id="+select_id+"&type="+type);
|
||||
}
|
||||
var dosearch = function() {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
$(function() {
|
||||
var height = $(window).height();
|
||||
if(height<(global_height*0.1)){
|
||||
height = global_height;
|
||||
}
|
||||
$('#tree').height(height-100);
|
||||
$('#menuBox').height(height-100);
|
||||
$('#box-body').height(height-120);
|
||||
initTreeView();
|
||||
initDate();
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<div class="content-wrapper">
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="user4SelectDiv"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">排污源</h3>
|
||||
<div class="box-tools"></div>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<div id="tree" style="overflow:auto; ">
|
||||
<img src="<%=request.getContextPath()%>/IMG/loading.gif" id="loading" class="center-block"/></div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9" id="menuBox">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"></h3>
|
||||
<div class="box-tools pull-right" id="toolbar">
|
||||
<a class="btn btn-default pull-right" onclick="downloadExcelFun();" ><i class="fa fa-cloud-download"></i> 导出</a>
|
||||
<a class="btn btn-default pull-right" onclick="dosearch();" ><i class="fa fa-search"></i> 搜索</a>
|
||||
<input type="text" class="form-control pull-right" id="reservationtime" style="width:190px;">
|
||||
<label style="padding-top:6px;" class=" pull-right">时间范围:</label>
|
||||
<input type="text" class="form-control pull-right" id="search_name" style="width:190px;">
|
||||
<label style="padding-top:6px;" class=" pull-right">单位名称:</label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body " id="box-body" style="overflow: auto;">
|
||||
<form class="form-horizontal " id="subForm" >
|
||||
<table id="table" class="table table-condensed"></table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user