435 lines
25 KiB
Plaintext
435 lines
25 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8" %>
|
||
<%@page import="com.sipai.entity.scada.MPointProp" %>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
||
<%request.setAttribute("Flag_Cal_Range_Hour_1", MPointProp.Flag_Cal_Range_Hour_1);%>
|
||
<%request.setAttribute("Flag_Cal_Range_Hour_8", MPointProp.Flag_Cal_Range_Hour_8);%>
|
||
<%request.setAttribute("Flag_Cal_Range_Day_1", MPointProp.Flag_Cal_Range_Day_1);%>
|
||
<%request.setAttribute("Flag_Cal_Range_Month_1", MPointProp.Flag_Cal_Range_Month_1);%>
|
||
<%request.setAttribute("Flag_Cal_Range_Year_1", MPointProp.Flag_Cal_Range_Year_1);%>
|
||
<%request.setAttribute("Flag_Cal_Range_Day_7", MPointProp.Flag_Cal_Range_Day_7);%>
|
||
<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 doFormulaDupdate() {
|
||
$("#subFormulaForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subFormulaForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/work/mPointProp/doupdatePropSource.do", $("#subFormulaForm").serialize(), function (data) {
|
||
if (data.res == 1) {
|
||
closeModal('formulaModal');
|
||
$("#formulaTable").bootstrapTable('refresh');
|
||
} else if (data.res == 0) {
|
||
showAlert('d', '保存失败');
|
||
} else {
|
||
showAlert('d', data.res);
|
||
}
|
||
}, 'json');
|
||
}
|
||
}
|
||
|
||
//输入框验证
|
||
$("#subFormulaForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
formulaname: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '元素名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
|
||
$(function () {
|
||
changeDatatype();
|
||
|
||
<%--$("#autoHourTable").bootstrapTable({ // 对应table标签的id--%>
|
||
<%-- url: ext.contextPath + '/work/mPointFormulaAutoHour/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: '${param.bizid}',--%>
|
||
<%-- pid: '${mPointFormula.id}'--%>
|
||
<%-- }--%>
|
||
<%-- },--%>
|
||
<%-- sortName: 'sdt', // 要排序的字段--%>
|
||
<%-- sortOrder: 'asc', // 排序规则--%>
|
||
<%-- onClickRow: function (row) {//单击行事件,执行查看功能--%>
|
||
<%-- //viewFun(row.mpointcode);--%>
|
||
<%-- },--%>
|
||
<%-- columns: [--%>
|
||
<%-- {--%>
|
||
<%-- field: 'sdt', // 返回json数据中的name--%>
|
||
<%-- title: '起始小时', // 表格表头显示文字--%>
|
||
<%-- align: 'center', // 左右居中--%>
|
||
<%-- valign: 'middle' // 上下居中--%>
|
||
<%-- }, {--%>
|
||
<%-- field: 'edt', // 返回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="editFormulaAutoHourFun(\'' + 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="deleteFormulaAutoHourFun(\'' + 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("autoHourTable");--%>
|
||
<%-- },--%>
|
||
<%-- onLoadError: function () { //加载失败时执行--%>
|
||
<%-- console.info("加载数据失败");--%>
|
||
<%-- }--%>
|
||
|
||
<%--});--%>
|
||
|
||
})
|
||
|
||
function addAutoHourFun() {
|
||
$.post(ext.contextPath + '/work/mPointFormulaAutoHour/doadd.do', {
|
||
pid: '${mPointFormula.id}',
|
||
bizid: '${param.bizid}'
|
||
}, function (data) {
|
||
$("#mPointFormulaAutoHourDiv").html(data);
|
||
openModal('mPointFormulaAutoHourModal');
|
||
});
|
||
}
|
||
|
||
function editFormulaAutoHourFun(id) {
|
||
$.post(ext.contextPath + '/work/mPointFormulaAutoHour/doedit.do', {
|
||
id: id,
|
||
bizid: '${param.bizid}',
|
||
}, function (data) {
|
||
$("#mPointFormulaAutoHourDiv").html(data);
|
||
openModal('mPointFormulaAutoHourModal');
|
||
});
|
||
};
|
||
|
||
function deleteFormulaAutoHourFun(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/mPointFormulaAutoHour/dodelete.do', {
|
||
id: id,
|
||
bizid: '${param.bizid}',
|
||
}, function (data) {
|
||
if (data == 1) {
|
||
$("#autoHourTable").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||
}
|
||
});
|
||
|
||
}
|
||
});
|
||
}
|
||
|
||
// $.post(ext.contextPath + "/achievement/acceptanceModelMPoint/getValueTypeJson.do", {}, function(data) {
|
||
// var selelct =$("#mode").select2({
|
||
// data: data,
|
||
// placeholder:'请选择',//默认文字提示
|
||
// allowClear: false,//允许清空
|
||
// 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;} // 函数用于呈现当前的选择
|
||
// });
|
||
|
||
// if(data.length>=1){
|
||
// selelct.val('${mPointFormula.mode}').trigger("change");
|
||
// }else{
|
||
// // selelct.val(data[0].id).trigger("change");
|
||
// }
|
||
// },'json');
|
||
|
||
function doClose() {
|
||
closeModal('formulaModal');
|
||
}
|
||
|
||
var selectMPint = function () {
|
||
$.post(ext.contextPath + '/work/mpoint/showlistForSelect.do', {
|
||
formId: 'subFormulaForm',
|
||
hiddenId: 'hiddenId',
|
||
codeId: 'mpid',
|
||
unitId: 'unitId',
|
||
textId: 'txt',
|
||
valueId: 'value',
|
||
mpid: $("#mpid").val()
|
||
}, function (data) {
|
||
$("#mpSubDiv").html(data);
|
||
openModal('mpSubModal');
|
||
});
|
||
};
|
||
|
||
function changeDatatype() {
|
||
let datatype = $('#datatype').val();
|
||
if (datatype == 'autoHour') {
|
||
$('#autoHourShow').css('display', 'block');
|
||
} else {
|
||
$('#autoHourShow').css('display', 'none');
|
||
}
|
||
}
|
||
|
||
</script>
|
||
<div class="modal fade" id="formulaModal">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h4 class="modal-title">编辑公式元素</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<!-- 新增界面formid强制为subFormulaForm -->
|
||
<form class="form-horizontal" id="subFormulaForm">
|
||
<input name="id" type="hidden" value="${mPointPropSource.id}"/>
|
||
<input name="unitId" type="hidden" value="${param.bizid}"/>
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></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="indexDetails" name="indexDetails"
|
||
placeholder="元素名称" value="${mPointPropSource.indexDetails}">
|
||
</div>
|
||
<label class="col-sm-2 control-label">测量点</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="mpid" name="mpid" placeholder="点击选择"
|
||
value="${mPointPropSource.mpid}" onclick="selectMPint();" readonly>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">取值方式</label>
|
||
<div class="col-sm-4">
|
||
<select id="valueType" name="valueType" class="form-control select2" style="width: 100%">
|
||
<option value="first"
|
||
<c:if test="${mPointPropSource.valueType=='first'}">selected</c:if> >首值
|
||
</option>
|
||
<option value="last"
|
||
<c:if test="${mPointPropSource.valueType=='last'}">selected</c:if> >末值
|
||
</option>
|
||
<option value="avg"
|
||
<c:if test="${mPointPropSource.valueType=='avg'}">selected</c:if> >均值
|
||
</option>
|
||
<option value="diff"
|
||
<c:if test="${mPointPropSource.valueType=='diff'}">selected</c:if> >差值
|
||
</option>
|
||
<option value="sum"
|
||
<c:if test="${mPointPropSource.valueType=='sum'}">selected</c:if> >累加
|
||
</option>
|
||
<option value="max"
|
||
<c:if test="${mPointPropSource.valueType=='max'}">selected</c:if> >最大值
|
||
</option>
|
||
<option value="min"
|
||
<c:if test="${mPointPropSource.valueType=='min'}">selected</c:if> >最小值
|
||
</option>
|
||
<option value="nowTime"
|
||
<c:if test="${mPointPropSource.valueType=='nowTime'}">selected</c:if> >当前值
|
||
</option>
|
||
<option value="mark"
|
||
<c:if test="${mPointPropSource.valueType=='mark'}">selected</c:if> >唯一标识
|
||
</option>
|
||
|
||
</select>
|
||
</div>
|
||
<label class="col-sm-2 control-label">频率类型</label>
|
||
<div class="col-sm-4">
|
||
<select id="calRangeUnit" name="calRangeUnit" class="form-control select2"
|
||
style="width: 100%">
|
||
<option value="minute"
|
||
<c:if test="${mPointPropSource.calRangeUnit=='minute'}">selected</c:if> >分钟
|
||
</option>
|
||
<option value="hour"
|
||
<c:if test="${mPointPropSource.calRangeUnit=='hour'}">selected</c:if> >小时
|
||
</option>
|
||
<option value="day"
|
||
<c:if test="${mPointPropSource.calRangeUnit=='day'}">selected</c:if> >日
|
||
</option>
|
||
<option value="month"
|
||
<c:if test="${mPointPropSource.calRangeUnit=='month'}">selected</c:if> >月
|
||
</option>
|
||
<option value="year"
|
||
<c:if test="${mPointPropSource.calRangeUnit=='year'}">selected</c:if> >年
|
||
</option>
|
||
</select>
|
||
</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="calRange" name="calRange"
|
||
value="${mPointPropSource.calRange}">
|
||
</div>
|
||
<label class="col-sm-2 control-label">时间偏移</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="calculationType" name="calculationType"
|
||
value="${mPointPropSource.calculationType}">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">截止时间</label>
|
||
<div class="col-sm-4">
|
||
<select id="deadline" name="deadline" class="form-control select2"
|
||
style="width: 100%">
|
||
<option value="closing_time"
|
||
<c:if test="${mPointPropSource.deadline=='closing_time'}">selected</c:if> >期末时间
|
||
</option>
|
||
<option value="now_time"
|
||
<c:if test="${mPointPropSource.deadline=='now_time'}">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"
|
||
value="${mPointPropSource.morder}">
|
||
</div>
|
||
</div>
|
||
<%-- <div class="form-group">--%>
|
||
<%-- <label class="col-sm-2 control-label">采集方式</label>--%>
|
||
<%-- <div class="col-sm-4">--%>
|
||
<%-- <select id="mode" name="mode" class="form-control select2" style="width: 100%">--%>
|
||
<%-- <option value="first"--%>
|
||
<%-- <c:if test="${mPointFormula.mode=='first'}">selected</c:if> >first--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="last"--%>
|
||
<%-- <c:if test="${mPointFormula.mode=='last'}">selected</c:if> >last--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="sum"--%>
|
||
<%-- <c:if test="${mPointFormula.mode=='sum'}">selected</c:if> >sum--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="avg"--%>
|
||
<%-- <c:if test="${mPointFormula.mode=='avg'}">selected</c:if> >avg--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="diff"--%>
|
||
<%-- <c:if test="${mPointFormula.mode=='diff'}">selected</c:if> >diff--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="tomorrowlast"--%>
|
||
<%-- <c:if test="${mPointFormula.mode=='tomorrowlast'}">selected</c:if> >tomorrowlast--%>
|
||
<%-- </option>--%>
|
||
<%-- </select>--%>
|
||
<%-- </div>--%>
|
||
<%-- <label class="col-sm-2 control-label">计算时间</label>--%>
|
||
<%-- <div class="col-sm-4">--%>
|
||
<%-- <input type="text" class="form-control" id="starthour" name="starthour"--%>
|
||
<%-- value="${mPointFormula.starthour}">--%>
|
||
<%-- </div>--%>
|
||
<%-- </div>--%>
|
||
<%-- <div class="form-group">--%>
|
||
<%-- <label class="col-sm-2 control-label">时间类型</label>--%>
|
||
<%-- <div class="col-sm-4">--%>
|
||
<%-- <select id="datatype" name="datatype" class="form-control select2" style="width: 100%"--%>
|
||
<%-- onchange="changeDatatype();">--%>
|
||
<%-- <option value="day"--%>
|
||
<%-- <c:if test="${mPointFormula.datatype=='day'}">selected</c:if> >day--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="hour"--%>
|
||
<%-- <c:if test="${mPointFormula.datatype=='hour'}">selected</c:if> >hour--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="today"--%>
|
||
<%-- <c:if test="${mPointFormula.datatype=='today'}">selected</c:if> >today--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="yesterday"--%>
|
||
<%-- <c:if test="${mPointFormula.datatype=='yesterday'}">selected</c:if> >yesterday--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="week"--%>
|
||
<%-- <c:if test="${mPointFormula.datatype=='week'}">selected</c:if> >week--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="month"--%>
|
||
<%-- <c:if test="${mPointFormula.datatype=='month'}">selected</c:if> >month--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="year"--%>
|
||
<%-- <c:if test="${mPointFormula.datatype=='year'}">selected</c:if> >year--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="lastmonth"--%>
|
||
<%-- <c:if test="${mPointFormula.datatype=='lastmonth'}">selected</c:if> >lastmonth--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="nowTime"--%>
|
||
<%-- <c:if test="${mPointFormula.datatype=='nowTime'}">selected</c:if> >nowTime--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="autoHour"--%>
|
||
<%-- <c:if test="${mPointFormula.datatype=='autoHour'}">selected</c:if> >autoHour--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="8hour"--%>
|
||
<%-- <c:if test="${mPointFormula.datatype=='8hour'}">selected</c:if> >8hour--%>
|
||
<%-- </option>--%>
|
||
<%-- <option value="mainFormDay"--%>
|
||
<%-- <c:if test="${mPointFormula.datatype=='mainFormDay'}">selected</c:if> >--%>
|
||
<%-- mainFormDay--%>
|
||
<%-- </option>--%>
|
||
<%-- </select>--%>
|
||
<%-- </div>--%>
|
||
<%-- </div>--%>
|
||
</form>
|
||
</div>
|
||
<%-- <div id="autoHourShow" class="modal-body" style="display: block;">--%>
|
||
<%-- <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="addAutoHourFun();"><i--%>
|
||
<%-- class="fa fa-plus"></i></button>--%>
|
||
<%-- </div>--%>
|
||
<%-- </div>--%>
|
||
<%-- <div class="box-body ">--%>
|
||
<%-- <div>--%>
|
||
<%-- <table id="autoHourTable"></table>--%>
|
||
<%-- </div>--%>
|
||
<%-- </div>--%>
|
||
<%-- </div>--%>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default pull-left" onclick="doClose()">关闭</button>
|
||
<button type="button" class="btn btn-primary" onclick="doFormulaDupdate()" id="btn_save">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|