522 lines
25 KiB
Plaintext
522 lines
25 KiB
Plaintext
<%@page import="com.sipai.entity.scada.MPoint" %>
|
||
<%@page import="com.sipai.tools.CommString" %>
|
||
<%@ page language="java" import="java.util.*" 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" %>
|
||
<%request.setAttribute("Active_False", CommString.Active_False); %>
|
||
<%request.setAttribute("Active_True", CommString.Active_True); %>
|
||
<%request.setAttribute("Flag_Enable", MPoint.Flag_Enable);%>
|
||
<%request.setAttribute("Flag_Disable", MPoint.Flag_Disable);%>
|
||
|
||
<%request.setAttribute("Flag_Sql", MPoint.Flag_Sql);%>
|
||
<%request.setAttribute("Flag_Modbus", MPoint.Flag_Modbus);%>
|
||
<%request.setAttribute("Flag_Type_KPI", MPoint.Flag_Type_KPI);%>
|
||
<%request.setAttribute("Flag_Type_Hand", MPoint.Flag_Type_Hand);%>
|
||
<%request.setAttribute("Flag_Type_Data", MPoint.Flag_Type_Data);%>
|
||
<%request.setAttribute("Flag_BizType_Hand", MPoint.Flag_BizType_Hand);%>
|
||
<%request.setAttribute("Flag_BizType_Auto", MPoint.Flag_BizType_Auto);%>
|
||
|
||
<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">
|
||
|
||
$(function () {
|
||
$("#formulaTable").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/work/mPointProp/getPropSourceList.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||
pageSize: 50, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order,
|
||
companyId: $('#bizId').val(),
|
||
pid: $('#pid').val()
|
||
}
|
||
},
|
||
sortName: 'morder', // 要排序的字段
|
||
sortOrder: 'asc', // 排序规则
|
||
onClickRow: function (row) {//单击行事件,执行查看功能
|
||
//viewFun(row.mpointcode);
|
||
},
|
||
columns: [
|
||
{
|
||
field: 'indexDetails', // 返回json数据中的name
|
||
title: '元素名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
}, {
|
||
field: 'mpid', // 返回json数据中的name
|
||
title: '测量点', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
}, {
|
||
field: 'valueType', // 返回json数据中的name
|
||
title: '取值方式', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
formatter: function (value, row, index) {
|
||
switch (value) {
|
||
case 'first':
|
||
return "首值";
|
||
case 'last':
|
||
return "末值";
|
||
case 'avg':
|
||
return "均值";
|
||
case 'diff':
|
||
return "差值";
|
||
case 'sum':
|
||
return "累加";
|
||
case 'max':
|
||
return "最大值";
|
||
case 'min':
|
||
return "最小值";
|
||
case 'nowTime':
|
||
return "当前值";
|
||
case 'mark':
|
||
return "唯一标识";
|
||
default:
|
||
return value;
|
||
}
|
||
}
|
||
}, {
|
||
field: 'calRangeUnit', // 返回json数据中的name
|
||
title: '频率类型', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
formatter: function (value, row, index) {
|
||
switch (value) {
|
||
case 'minute':
|
||
return "分钟";
|
||
case 'hour':
|
||
return "小时";
|
||
case 'day':
|
||
return "日";
|
||
case 'month':
|
||
return "月";
|
||
case 'year':
|
||
return "年";
|
||
default:
|
||
return value;
|
||
}
|
||
}
|
||
}, {
|
||
field: 'calRange', // 返回json数据中的name
|
||
title: '采样频率', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
}, {
|
||
field: 'calculationType', // 返回json数据中的name
|
||
title: '时间偏移', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
}, {
|
||
field: 'deadline', // 返回json数据中的name
|
||
title: '截止时间', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
formatter: function (value, row, index) {
|
||
switch (value) {
|
||
case 'closing_time':
|
||
return "期末时间";
|
||
case 'now_time':
|
||
return "当前时间";
|
||
default:
|
||
return value;
|
||
}
|
||
}
|
||
|
||
}, {
|
||
field: 'morder', // 返回json数据中的name
|
||
title: '排序', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
}, {
|
||
title: "操作",
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: 100, // 定义列的宽度,单位为像素px
|
||
formatter: function (value, row, index) {
|
||
var buts = "";
|
||
buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFormulaFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
||
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFormulaFun(\'' + row.id + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button';
|
||
buts = '<div class="btn-group" >' + buts + '</div>';
|
||
return buts;
|
||
//return '<i class="fa fa-edit" onclick="editFun()(\'' + row.id + '\')></i>';
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("formulaTable");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
|
||
});
|
||
|
||
// $("#formulaDenominatorTable").bootstrapTable({ // 对应table标签的id
|
||
// url: ext.contextPath + '/work/mPointFormulaDenominator/getList.do', // 获取表格数据的url
|
||
// cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
// striped: true, //表格显示条纹,默认为false
|
||
// pagination: true, // 在表格底部显示分页组件,默认false
|
||
// pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||
// pageSize: 50, // 页面数据条数
|
||
// pageNumber: 1, // 首页页码
|
||
// sidePagination: 'server', // 设置为服务器端分页
|
||
// queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
// return {
|
||
// rows: params.limit, // 每页要显示的数据条数
|
||
// page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||
// sort: params.sort, // 要排序的字段
|
||
// order: params.order,
|
||
// bizid: $('#bizId').val(),
|
||
// pmpid: $('#id').val()
|
||
// }
|
||
// },
|
||
// sortName: 'denominatorName', // 要排序的字段
|
||
// sortOrder: 'asc', // 排序规则
|
||
// onClickRow: function (row) {//单击行事件,执行查看功能
|
||
// //viewFun(row.mpointcode);
|
||
// },
|
||
// columns: [
|
||
// {
|
||
// field: 'denominatorname', // 返回json数据中的name
|
||
// title: '分母元素名称', // 表格表头显示文字
|
||
// align: 'center', // 左右居中
|
||
// valign: 'middle' // 上下居中
|
||
// },{
|
||
// field: 'moleculename', // 返回json数据中的name
|
||
// title: '分子元素名称', // 表格表头显示文字
|
||
// align: 'center', // 左右居中
|
||
// valign: 'middle' // 上下居中
|
||
// },{
|
||
// title: "操作",
|
||
// align: 'center',
|
||
// valign: 'middle',
|
||
// width: 100, // 定义列的宽度,单位为像素px
|
||
// formatter: function (value, row, index) {
|
||
// var buts="";
|
||
// buts+= '<button class="btn btn-default btn-sm" title="编辑" onclick="editFormulaDenominatorFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
||
// buts+='<button class="btn btn-default btn-sm" title="删除" onclick="deleteFormulaDenominatorFun(\''+row.id+'\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button';
|
||
// buts='<div class="btn-group" >'+buts+'</div>';
|
||
// return buts;
|
||
// //return '<i class="fa fa-edit" onclick="editFun()(\'' + row.id + '\')></i>';
|
||
// }
|
||
// }
|
||
// ],
|
||
// onLoadSuccess: function(){ //加载成功时执行
|
||
// adjustBootstrapTableView("formulaTable");
|
||
// },
|
||
// onLoadError: function(){ //加载失败时执行
|
||
// console.info("加载数据失败");
|
||
// }
|
||
//
|
||
// });
|
||
});
|
||
|
||
function updateFormula() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/work/mPointProp/dosave2.do", $("#subForm").serialize(), function (data) {
|
||
if (data.res == 1) {
|
||
$("#subMainForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subMainForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/work/mpoint/update2.do", $("#subMainForm").serialize(), function (data) {
|
||
closeModal('subModal')
|
||
}, 'json');
|
||
}
|
||
// $("#table").bootstrapTable('refresh');
|
||
} else if (data.res == 0) {
|
||
showAlert('d', '保存失败');
|
||
} else {
|
||
showAlert('d', data.res);
|
||
}
|
||
}, 'json');
|
||
}
|
||
|
||
}
|
||
|
||
// $("#subForm").bootstrapValidator({
|
||
// live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
// fields: {
|
||
// exp: {
|
||
// validators: {
|
||
// notEmpty: {
|
||
// message: '计算公式'
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// }
|
||
// });
|
||
|
||
var addFormulaFun = function () {
|
||
let exp = $('#evaluationFormula').val();
|
||
if (exp != '') {
|
||
$.post(ext.contextPath + '/work/mPointFormula/doadd.do', {
|
||
pmpid: '${mPointProp.pid}',
|
||
bizid: $('#bizId').val()
|
||
}, function (data) {
|
||
$("#formulasubDiv").html(data);
|
||
openModal('formulaModal');
|
||
});
|
||
} else {
|
||
showAlert('d', '请先保存公式!', 'formulaAlert');
|
||
}
|
||
|
||
};
|
||
|
||
var addFormulaDenominatorFun = function () {
|
||
$.post(ext.contextPath + '/work/mPointFormulaDenominator/doadd.do', {
|
||
pmpid: '${mPoint.id}',
|
||
bizid: $('#bizId').val()
|
||
}, function (data) {
|
||
$("#formulaDenominatorsubDiv").html(data);
|
||
openModal('formulaDenominatorModal');
|
||
});
|
||
};
|
||
|
||
var editFormulaFun = function (id) {
|
||
$.post(ext.contextPath + '/work/mPointFormula/doedit.do', {id: id, bizid: $('#bizId').val()}, function (data) {
|
||
$("#formulasubDiv").html(data);
|
||
openModal('formulaModal');
|
||
});
|
||
};
|
||
|
||
var editFormulaDenominatorFun = function (id) {
|
||
$.post(ext.contextPath + '/work/mPointFormulaDenominator/doedit.do', {
|
||
id: id,
|
||
bizid: $('#bizId').val()
|
||
}, function (data) {
|
||
$("#formulaDenominatorsubDiv").html(data);
|
||
openModal('formulaDenominatorModal');
|
||
});
|
||
};
|
||
|
||
var deleteFormulaFun = 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(function (willDelete) {
|
||
if (willDelete) {
|
||
$.post(ext.contextPath + '/work/mPointProp/dodelete2.do', {
|
||
id: id,
|
||
companyId: $('#bizId').val()
|
||
}, function (data) {
|
||
if (data == 1) {
|
||
$("#formulaTable").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||
}
|
||
});
|
||
|
||
}
|
||
});
|
||
};
|
||
|
||
var deleteFormulaDenominatorFun = 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(function (willDelete) {
|
||
if (willDelete) {
|
||
$.post(ext.contextPath + '/work/mPointFormulaDenominator/dodelete.do', {
|
||
id: id,
|
||
bizid: $('#bizId').val()
|
||
}, function (data) {
|
||
if (data == 1) {
|
||
$("#formulaDenominatorTable").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||
}
|
||
});
|
||
|
||
}
|
||
});
|
||
};
|
||
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog modal-xlg">
|
||
<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">
|
||
<div id="formulaAlert"></div>
|
||
<!-- 新增界面formid强制为subForm -->
|
||
<form class="form-horizontal" id="subMainForm">
|
||
|
||
<input id="id" name="id" type="hidden" value="${mPoint.id}"/>
|
||
<input id="bizid" name="bizid" type="hidden" value="${mPoint.bizid}"/>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">计算类型</label>
|
||
<div class="col-sm-4">
|
||
<select id="frequnit" name="frequnit" class="form-control select2"
|
||
style="width: 100%">
|
||
<option value="nowTime"
|
||
<c:if test="${mPoint.frequnit=='nowTime'}">selected</c:if> >实时值
|
||
</option>
|
||
<option value="hour"
|
||
<c:if test="${mPoint.frequnit=='hour'}">selected</c:if> >小时
|
||
</option>
|
||
<option value="day"
|
||
<c:if test="${mPoint.frequnit=='day'}">selected</c:if> >日
|
||
</option>
|
||
<option value="month"
|
||
<c:if test="${mPoint.frequnit=='month'}">selected</c:if> >月
|
||
</option>
|
||
<option value="mark"
|
||
<c:if test="${mPoint.frequnit=='mark'}">selected</c:if> >唯一标识
|
||
</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
|
||
<form class="form-horizontal" id="subForm">
|
||
|
||
<input id="bizId" name="bizId" type="hidden" value="${param.bizId}"/>
|
||
<input id="id" name="id" type="hidden" value="${mPointProp.id}"/>
|
||
<input id="pid" name="pid" type="hidden" value="${param.id}"/>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">计算公式</label>
|
||
<div class="col-sm-10">
|
||
<input type="text" class="form-control" id="evaluationFormula" name="evaluationFormula"
|
||
placeholder="公式..." value="${mPointProp.evaluationFormula }">
|
||
</div>
|
||
</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="starthour" name="starthour"
|
||
value="<c:if test="${mPointProp.starthour!=null}">${mPointProp.starthour}</c:if><c:if test="${mPointProp.starthour==null}">8</c:if>">
|
||
</div>
|
||
<label class="col-sm-2 control-label">月起始日期</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="startday" name="startday"
|
||
value="<c:if test="${mPointProp.startday!=null}">${mPointProp.startday}</c:if><c:if test="${mPointProp.startday==null}">1</c:if>">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">存储类型</label>
|
||
<div class="col-sm-4">
|
||
<select id="saveType" name="saveType" class="form-control select2"
|
||
style="width: 100%">
|
||
<option value="nowTime"
|
||
<c:if test="${mPointProp.saveType=='nowTime'}">selected</c:if> >实时值
|
||
</option>
|
||
<option value="hour"
|
||
<c:if test="${mPointProp.saveType=='hour'}">selected</c:if> >小时
|
||
</option>
|
||
<option value="day"
|
||
<c:if test="${mPointProp.saveType=='day'}">selected</c:if> >日
|
||
</option>
|
||
<option value="month"
|
||
<c:if test="${mPointProp.saveType=='month'}">selected</c:if> >月
|
||
</option>
|
||
<option value="year"
|
||
<c:if test="${mPointProp.saveType=='year'}">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="saveTimeShifting" name="saveTimeShifting"
|
||
value="<c:if test="${mPointProp.saveTimeShifting!=null}">${mPointProp.saveTimeShifting}</c:if><c:if test="${mPointProp.saveTimeShifting==null}">0</c:if>">
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="box-header with-border">
|
||
<h3 class="box-title">公式元素配置</h3>
|
||
<div class="box-tools pull-right">
|
||
<button type="button" class="btn btn-box-tool" onclick="addFormulaFun();"><i
|
||
class="fa fa-plus"></i></button>
|
||
</div>
|
||
</div>
|
||
<div class="box-body ">
|
||
<div>
|
||
<table id="formulaTable"></table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<%-- <div class="modal-body">--%>
|
||
<%-- <div class="box-header with-border">--%>
|
||
<%-- <h3 class="box-title">动态分母配置</h3>--%>
|
||
<%-- <div class="box-tools pull-right">--%>
|
||
<%-- <button type="button" class="btn btn-box-tool" onclick="addFormulaDenominatorFun();"><i class="fa fa-plus"></i></button>--%>
|
||
<%-- </div>--%>
|
||
<%-- </div>--%>
|
||
<%-- <div class="box-body ">--%>
|
||
<%-- <div >--%>
|
||
<%-- <table id="formulaDenominatorTable"></table>--%>
|
||
<%-- </div>--%>
|
||
<%-- </div>--%>
|
||
<%-- </div>--%>
|
||
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
||
<button type="button" class="btn btn-primary" onclick="updateFormula()" id="btn_save">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|