290 lines
13 KiB
Plaintext
290 lines
13 KiB
Plaintext
|
|
<%@page import="com.sipai.entity.report.TemplateType"%>
|
|||
|
|
<%@ page language="java" pageEncoding="UTF-8"%>
|
|||
|
|
<%request.setAttribute("day",TemplateType.REPORT_DAY); %>
|
|||
|
|
<%request.setAttribute("month",TemplateType.REPORT_MONTH); %>
|
|||
|
|
<head>
|
|||
|
|
<!-- 拖拽排序-->
|
|||
|
|
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-table/jquery.tablednd.js" charset="utf-8"></script>
|
|||
|
|
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.js" charset="utf-8"></script>
|
|||
|
|
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.css"/>
|
|||
|
|
<style type="text/css">
|
|||
|
|
.select2-container .select2-selection--single{
|
|||
|
|
height:34px;
|
|||
|
|
line-height: 34px;
|
|||
|
|
}
|
|||
|
|
.select2-selection__arrow{
|
|||
|
|
margin-top:3px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.modal-dialog{
|
|||
|
|
width: 1000px;
|
|||
|
|
}
|
|||
|
|
.hidden{display:none;}
|
|||
|
|
</style>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
function dosave() {
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/report/drainageDataomprehensiveTableMainconfigure/doupdate.do", $("#subForm").serialize(), function(data) {
|
|||
|
|
if (data == 1){
|
|||
|
|
closeModal('subModal');
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
}else if(data == 0){
|
|||
|
|
showAlert('d','保存失败');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data);
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//输入框验证
|
|||
|
|
$("#subForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
name: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '名称不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
var addDetailFun = function() {
|
|||
|
|
var id=$('#id').val();
|
|||
|
|
$.post(ext.contextPath + '/report/drainageDataomprehensiveTableMainconfigureDetail/doadd.do' ,{pid:id}, function(data) {
|
|||
|
|
$("#subDetailDiv").html(data);
|
|||
|
|
openModal('subDetailModal');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var editDetailFun = function(id) {
|
|||
|
|
stopBubbleDefaultEvent();
|
|||
|
|
$.post(ext.contextPath + '/report/drainageDataomprehensiveTableMainconfigureDetail/doedit.do', {id:id} , function(data) {
|
|||
|
|
$("#subDetailDiv").html(data);
|
|||
|
|
openModal('subDetailModal');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var deleteDetailFun = function(id) {
|
|||
|
|
stopBubbleDefaultEvent();
|
|||
|
|
if(confirm("信息删除后不能恢复,请问要执行删除操作吗?")){
|
|||
|
|
$.post(ext.contextPath + '/report/drainageDataomprehensiveTableMainconfigureDetail/dodel.do', {id : id}, function(data) {
|
|||
|
|
if(data==1){
|
|||
|
|
$("#table_Detail").bootstrapTable('refresh');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d','删除失败','mainAlertDetaildiv');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
/*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(function(willDelete){
|
|||
|
|
if (willDelete) {
|
|||
|
|
$.post(ext.contextPath + '/report/drainageDataomprehensiveTableMainconfigureDetail/dodel.do', {id : id}, function(data) {
|
|||
|
|
if(data==1){
|
|||
|
|
$("#table_Detail").bootstrapTable('refresh');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d','删除失败','mainAlertDetaildiv');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});*/
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
var deletesDetailFun = function() {
|
|||
|
|
var checkedItems = $("#table_Detail").bootstrapTable('getSelections');
|
|||
|
|
var datas="";
|
|||
|
|
$.each(checkedItems, function(index, item){
|
|||
|
|
datas+=item.id+",";
|
|||
|
|
});
|
|||
|
|
if(datas==""){
|
|||
|
|
showAlert('d','请先选择记录','mainAlertDetaildiv');
|
|||
|
|
}else{
|
|||
|
|
if(confirm("信息删除后不能恢复,请问要执行删除操作吗?")){
|
|||
|
|
$.post(ext.contextPath + '/report/drainageDataomprehensiveTableMainconfigureDetail/deletes.do', {ids:datas} , function(data) {
|
|||
|
|
if(data>0){
|
|||
|
|
$("#table_Detail").bootstrapTable('refresh');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d','删除失败','mainAlertDetaildiv');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
$(function() {
|
|||
|
|
var id=$('#id').val();
|
|||
|
|
$("#table_Detail").bootstrapTable({ // 对应table标签的id
|
|||
|
|
url: ext.contextPath + '/report/drainageDataomprehensiveTableMainconfigureDetail/getList.do', // 获取表格数据的url
|
|||
|
|
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
|||
|
|
striped: true, //表格显示条纹,默认为false
|
|||
|
|
pagination: true, // 在表格底部显示分页组件,默认false
|
|||
|
|
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
|||
|
|
pageSize: 5, // 页面数据条数
|
|||
|
|
pageNumber: 1, // 首页页码
|
|||
|
|
paginationDetailHAlign:' hidden',//去除分页的显示
|
|||
|
|
sidePagination: 'server', // 设置为服务器端分页
|
|||
|
|
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
|||
|
|
return {
|
|||
|
|
rows: params.limit, // 每页要显示的数据条数
|
|||
|
|
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
|||
|
|
sort: "dr."+params.sort, // 要排序的字段
|
|||
|
|
order: params.order,
|
|||
|
|
id: id,
|
|||
|
|
search_name: $('#search_name').val()
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
sortName: 'id', // 要排序的字段
|
|||
|
|
sortOrder: 'desc', // 排序规则
|
|||
|
|
onClickRow: function (row) {//单击行事件,执行查看功能
|
|||
|
|
//viewFun(row.id);
|
|||
|
|
},
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
checkbox: true, // 显示一个勾选框
|
|||
|
|
},{
|
|||
|
|
field: 'name', // 返回json数据中的name
|
|||
|
|
title: '名称', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
width: 500
|
|||
|
|
},{
|
|||
|
|
field: 'targetValue', // 返回json数据中的name
|
|||
|
|
title: '目标值', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle' // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: '_insuser', // 返回json数据中的name
|
|||
|
|
title: '最后更新人', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle' // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'insdt', // 返回json数据中的name
|
|||
|
|
title: '最后更新时间', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle',// 上下居中
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
return row.insdt.substring(0,10);
|
|||
|
|
}
|
|||
|
|
},{
|
|||
|
|
title: "操作",
|
|||
|
|
align: 'center',
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: 160, // 定义列的宽度,单位为像素px
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
var buts= '';
|
|||
|
|
buts+= '<security:authorize buttonUrl="report/drainageDataomprehensiveTableMainconfigureDetail/doedit.do">';
|
|||
|
|
buts+= '<button class="btn btn-default btn-sm" title="编辑" onclick="editDetailFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
|||
|
|
buts+= '</security:authorize>';
|
|||
|
|
|
|||
|
|
buts+= '<security:authorize buttonUrl="report/drainageDataomprehensiveTableMainconfigureDetail/dodel.do">';
|
|||
|
|
buts+='<button class="btn btn-default btn-sm" title="删除" onclick="deleteDetailFun(\''+row.id+'\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button';
|
|||
|
|
buts+= '</security:authorize>';
|
|||
|
|
|
|||
|
|
buts='<div class="btn-group" >'+buts+'</div>';
|
|||
|
|
return buts;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
onLoadSuccess: function(){ //加载成功时执行
|
|||
|
|
adjustBootstrapTableView("table_Detail");
|
|||
|
|
},
|
|||
|
|
onLoadError: function(){ //加载失败时执行
|
|||
|
|
console.info("加载数据失败");
|
|||
|
|
},
|
|||
|
|
onReorderRow: function (newData) {
|
|||
|
|
//这里的newData是整个表格数据,数组形式
|
|||
|
|
//console.log(newData); //调试用代码
|
|||
|
|
$.post(ext.contextPath + '/report/drainageDataomprehensiveTableMainconfigureDetail/dosort.do',{ jsondata: JSON.stringify(newData) },//将整张表数据 不能分页
|
|||
|
|
function(data) {
|
|||
|
|
if (data == 1) {
|
|||
|
|
//$("#table_Detail").bootstrapTable('refresh');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d','数据错误','mainAlertdiv');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
$(document).ready(function() {
|
|||
|
|
$("#table_Detail").tableDnD();
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
</script>
|
|||
|
|
</head>
|
|||
|
|
<div class="modal fade" id="subModal">
|
|||
|
|
<div class="modal-dialog">
|
|||
|
|
<div class="modal-content">
|
|||
|
|
<div class="modal-header">
|
|||
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|||
|
|
<span aria-hidden="true">×</span></button>
|
|||
|
|
<h4 class="modal-title">编辑</h4>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-body">
|
|||
|
|
<!-- 新增界面formid强制为subForm -->
|
|||
|
|
<form class="form-horizontal" id="subForm">
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<input type="hidden" id="id" name="id" value ="${drainageDataomprehensiveTableMainconfigure.id}">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*名称</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<input type="text" class="form-control" id="name" name ="name" placeholder="名称" value ="${drainageDataomprehensiveTableMainconfigure.name}" autocomplete="off">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">说明</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<textarea class="form-control" rows="2" id ="remark" name ="remark" placeholder="说明...">${drainageDataomprehensiveTableMainconfigure.remark}</textarea>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
<div class="box box-primary" >
|
|||
|
|
<div id="mainAlertDetaildiv"></div>
|
|||
|
|
<div class="box-header with-border">
|
|||
|
|
<h3 class="box-title">明细</h3>
|
|||
|
|
<div class="box-tools pull-right">
|
|||
|
|
<a onclick="addDetailFun()" class="btn btn-box-tool" data-toggle="tooltip" title="新增"><i class="glyphicon glyphicon-plus"></i></a>
|
|||
|
|
<a onclick="deletesDetailFun()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i class="glyphicon glyphicon-minus"></i></a>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.box-header -->
|
|||
|
|
<div class="box-body ">
|
|||
|
|
<table id="table_Detail" data-use-row-attr-func="true" data-reorderable-rows="true"></table>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-footer">
|
|||
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
|||
|
|
<button type="button" class="btn btn-primary" onclick="dosave()" id="btn_save">保存</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|