344 lines
14 KiB
Plaintext
344 lines
14 KiB
Plaintext
|
|
<%@ page language="java" pageEncoding="UTF-8"%>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
|||
|
|
<%@page import="com.sipai.entity.report.CustomReport"%>
|
|||
|
|
<% request.setAttribute("Type_group", CustomReport.Type_group);%>
|
|||
|
|
<% request.setAttribute("Type_sys", CustomReport.Type_sys);%>
|
|||
|
|
<% request.setAttribute("Type_user", CustomReport.Type_user);%>
|
|||
|
|
<% request.setAttribute("frequencyType_min", CustomReport.frequencyType_min);%>
|
|||
|
|
<% request.setAttribute("frequencyType_hour", CustomReport.frequencyType_hour);%>
|
|||
|
|
<% request.setAttribute("frequencyType_day", CustomReport.frequencyType_day);%>
|
|||
|
|
<% request.setAttribute("frequencyType_month", CustomReport.frequencyType_month);%>
|
|||
|
|
<style type="text/css">
|
|||
|
|
.select2-container .select2-selection--single{
|
|||
|
|
height:34px;
|
|||
|
|
line-height: 34px;
|
|||
|
|
}
|
|||
|
|
.select2-selection__arrow{
|
|||
|
|
margin-top:3px;
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
var unitId = '${param.unitId}'
|
|||
|
|
var showMenu4SelectFun = function() {
|
|||
|
|
$.post(ext.contextPath + '/user/showMenu4Select.do', {formId:"subForm",hiddenId:"pid",textId:"_pname"} , function(data) {
|
|||
|
|
$("#menu4SelectDiv").html(data);
|
|||
|
|
openModal("menu4SelectModal")
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function dosave() {
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/report/customReport/update.do", $("#subForm").serialize(), function(result) {
|
|||
|
|
var data= $.parseJSON(result);
|
|||
|
|
if (data.code == 1) {
|
|||
|
|
initTreeView();
|
|||
|
|
//showAlert('s','保存成功');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.msg);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//输入框验证
|
|||
|
|
$("#subForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
name: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '名称不能为空'
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function dodel() {
|
|||
|
|
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/customReport/delete.do', $("#subForm").serialize(), function(result) {
|
|||
|
|
// var data= $.parseJSON(result);
|
|||
|
|
if(result.code==1){
|
|||
|
|
initTreeView();
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',result.msg);
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function delMpointFun(id) {
|
|||
|
|
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/customReportMPoint/delete.do', {id:id}, function(data) {
|
|||
|
|
if(data.code==1){
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d','删除失败','alertDiv');
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
var addMpointFun = function() {
|
|||
|
|
$.post(ext.contextPath + '/report/customReportMPoint/add.do', {pid:'${customReport.id}'} , function(data) {
|
|||
|
|
$("#subDiv").html(data);
|
|||
|
|
openModal('addsubModal');
|
|||
|
|
//ComponentsDateTimePickers.init();
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
var editMpointFun = function(id) {
|
|||
|
|
$.post(ext.contextPath + '/report/customReportMPoint/edit.do', {unitId:unitId,id:id,pid:'${customReport.id}'} , function(data) {
|
|||
|
|
$("#subDiv").html(data);
|
|||
|
|
openModal('subModal');
|
|||
|
|
//ComponentsDateTimePickers.init();
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function addProgrammeFun(){
|
|||
|
|
$.post(ext.contextPath + '/report/customReportMPoint/addSYScustomReport.do', {unitId:unitId,pid:'${customReport.id}'} , function(data) {
|
|||
|
|
$("#subDiv").html(data);
|
|||
|
|
openModal('programmeSubModal');
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
var addMpointFuns = function(pid) {
|
|||
|
|
$.post(ext.contextPath + '/report/customReportMPoint/showlistForSelects.do',{pid:'${customReport.id}'},function(data) {
|
|||
|
|
$("#mpSubDiv").html(data);
|
|||
|
|
openModal('mpSubModal');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
$(function() {
|
|||
|
|
$("#table").bootstrapTable({ // 对应table标签的id
|
|||
|
|
url: ext.contextPath + '/report/customReportMPoint/getList.do', // 获取表格数据的url
|
|||
|
|
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
|||
|
|
striped: true, //表格显示条纹,默认为false
|
|||
|
|
pagination: true, // 在表格底部显示分页组件,默认false
|
|||
|
|
pageList: [5, 10,15], // 设置页面可以显示的数据条数
|
|||
|
|
pageSize: 5, // 页面数据条数
|
|||
|
|
pageNumber: 1, // 首页页码
|
|||
|
|
sidePagination: 'server', // 设置为服务器端分页
|
|||
|
|
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
|||
|
|
return {
|
|||
|
|
rows: params.limit, // 每页要显示的数据条数
|
|||
|
|
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
|||
|
|
sort: params.sort, // 要排序的字段
|
|||
|
|
order: params.order, // 排序规则
|
|||
|
|
pid:'${customReport.id}',
|
|||
|
|
unitId:unitId
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
sortName: 'morder', // 要排序的字段
|
|||
|
|
sortOrder: 'asc', // 排序规则
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
field: 'mPoint', // 返回json数据中的name
|
|||
|
|
title: '测量点编号', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
formatter: function(value,row,index){
|
|||
|
|
return value==null?'':value.mpointcode;
|
|||
|
|
},
|
|||
|
|
},{
|
|||
|
|
field: 'mPoint', // 返回json数据中的name
|
|||
|
|
title: '测量点名称', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
formatter: function(value,row,index){
|
|||
|
|
return value==null?'':value.parmname;
|
|||
|
|
},
|
|||
|
|
},{
|
|||
|
|
field: 'eName', // 返回json数据中的name
|
|||
|
|
title: '别名', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
},{
|
|||
|
|
field: 'morder', // 返回json数据中的name
|
|||
|
|
title: '顺序', // 表格表头显示文字
|
|||
|
|
align: 'center', // 左右居中
|
|||
|
|
valign: 'middle', // 上下居中
|
|||
|
|
|
|||
|
|
},{
|
|||
|
|
title: "操作",
|
|||
|
|
align: 'center',
|
|||
|
|
valign: 'middle',
|
|||
|
|
width: 100, // 定义列的宽度,单位为像素px
|
|||
|
|
formatter: function (value, row, index) {
|
|||
|
|
return '<div class="btn-group"><button class="btn btn-default btn-sm" onclick="editMpointFun(\'' + row.id + '\')"><i class="fa fa-edit"></i></button>'+
|
|||
|
|
'<button class="btn btn-default btn-sm" onclick="delMpointFun(\'' + row.id + '\')"><i class="fa fa-trash-o"></i></button></div>';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
onLoadSuccess: function(){ //加载成功时执行
|
|||
|
|
$(".bs-checkbox").css({'text-align':'center','vertical-align':'middle'})
|
|||
|
|
},
|
|||
|
|
onLoadError: function(){ //加载失败时执行
|
|||
|
|
console.info("加载数据失败");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function doTypeChange(){
|
|||
|
|
var value=$('#type').val();
|
|||
|
|
if(value=='0'){
|
|||
|
|
$('#frequencyShow').hide();
|
|||
|
|
}else{
|
|||
|
|
$('#frequencyShow').show();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$(function() {
|
|||
|
|
var type='${customReport.type}';
|
|||
|
|
if(type==0){
|
|||
|
|
$('#frequencyShow').hide();
|
|||
|
|
}else{
|
|||
|
|
$('#frequencyShow').show();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
</script>
|
|||
|
|
<div class="box box-primary" >
|
|||
|
|
<div class="box-header with-border">
|
|||
|
|
<h3 class="box-title">详情</h3>
|
|||
|
|
|
|||
|
|
<div class="box-tools pull-right">
|
|||
|
|
<a onclick="dosave()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i class="glyphicon glyphicon-floppy-disk"></i></a>
|
|||
|
|
<a onclick="dodel()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i class="glyphicon glyphicon-trash"></i></a>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.box-header -->
|
|||
|
|
<div class="box-body ">
|
|||
|
|
<form class="form-horizontal " id="subForm">
|
|||
|
|
<input id="id" name="id" type="hidden" value="${customReport.id}"/>
|
|||
|
|
<input id="unitId" name="unitId" type="hidden" value="${customReport.unitId}"/>
|
|||
|
|
<input id="pid" name="pid" type="hidden" value="${customReport.pid}"/>
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<div id="menu4SelectDiv"></div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">名称</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="name" name ="name" placeholder="名称" value="${customReport.name}">
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">类型</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<c:if test="${customReport.type==Type_group}"><span style="line-height: 34px;">节点</span></c:if>
|
|||
|
|
<c:if test="${customReport.type!=Type_group}">
|
|||
|
|
<select id ="type" name="type" class="form-control select2" onchange="doTypeChange()">
|
|||
|
|
<%-- <option value="${Type_group}" <c:if test="${customReport.type==Type_group }">selected</c:if>>节点</option>--%>
|
|||
|
|
<option value="${Type_sys}" <c:if test="${customReport.type==Type_sys }">selected</c:if>>系统方案</option>
|
|||
|
|
<option value="${Type_user}" <c:if test="${customReport.type==Type_user }">selected</c:if>>个人方案</option>
|
|||
|
|
</select>
|
|||
|
|
</c:if>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group" id="frequencyShow">
|
|||
|
|
<label class="col-sm-2 control-label">频率类型</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select id ="frequencytype" name="frequencytype" class="form-control select2">
|
|||
|
|
<option value="${frequencyType_min}" <c:if test="${customReport.frequencytype==frequencyType_min }">selected</c:if>>分钟</option>
|
|||
|
|
<option value="${frequencyType_hour}" <c:if test="${customReport.frequencytype==frequencyType_hour }">selected</c:if>>小时</option>
|
|||
|
|
<option value="${frequencyType_day}" <c:if test="${customReport.frequencytype==frequencyType_day }">selected</c:if>>天</option>
|
|||
|
|
<option value="${frequencyType_month}" <c:if test="${customReport.frequencytype==frequencyType_month }">selected</c:if>>月</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">频率数值</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="number" class="form-control" id="frequency" name ="frequency" value="${customReport.frequency}">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<c:if test="${customReport.type!=Type_group}">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">计算方式</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select id ="calculation" name="calculation" class="form-control select2">
|
|||
|
|
<option value="first" <c:if test="${customReport.calculation=='first' }">selected</c:if>>首值</option>
|
|||
|
|
<option value="avg" <c:if test="${customReport.calculation=='avg' }">selected</c:if>>均值</option>
|
|||
|
|
<option value="max" <c:if test="${customReport.calculation=='max' }">selected</c:if>>最大值</option>
|
|||
|
|
<option value="min" <c:if test="${customReport.calculation=='min' }">selected</c:if>>最小值</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">顺序</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="morder" name ="morder" placeholder="顺序" value="${customReport.morder}">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</c:if>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="box box-solid">
|
|||
|
|
<div class="box-header with-border">
|
|||
|
|
<h3 class="box-title">测量点配置</h3>
|
|||
|
|
|
|||
|
|
<div class="box-tools pull-right">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="box-body ">
|
|||
|
|
<div >
|
|||
|
|
<div id="alertDiv_power"></div>
|
|||
|
|
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
|||
|
|
<c:if test="${customReport.type==Type_user||customReport.type==Type_sys}">
|
|||
|
|
<!-- <button type="button" class="btn btn-default" onclick="addMpointFun();"><i class="fa fa-plus"></i> 新增</button> -->
|
|||
|
|
<button type="button" class="btn btn-default" style="margin-left: 10px;" onclick="addMpointFuns();"><i class="fa fa-plus"></i> 新增</button>
|
|||
|
|
</c:if>
|
|||
|
|
</div>
|
|||
|
|
<div id="powerDiv"></div>
|
|||
|
|
<div id="menu4SelectDiv_func"></div>
|
|||
|
|
<br>
|
|||
|
|
<table id="table"></table>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|