327 lines
15 KiB
Plaintext
327 lines
15 KiB
Plaintext
<%@ 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" %>
|
||
<%@page import="com.sipai.entity.alarm.AlarmMoldCodeEnum" %>
|
||
<% request.setAttribute("LimitValue_Pro", AlarmMoldCodeEnum.LimitValue_Pro.getKey());%>
|
||
<% request.setAttribute("ValueMutation_Pro", AlarmMoldCodeEnum.ValueMutation_Pro.getKey());%>
|
||
|
||
<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 () {
|
||
var alarmInformationJson = jQuery.parseJSON('${alarmInformationJson}');
|
||
var selelct_ = $("#informationCode").select2({
|
||
data: alarmInformationJson,
|
||
cache: false,
|
||
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;
|
||
} // 函数用于呈现当前的选择
|
||
});
|
||
selelct_.val('${alarmPoint.informationCode}').trigger("change");
|
||
// selelct_.on("change", function (e) {
|
||
// var value = $(this).val();
|
||
// });
|
||
if (1 == '${alarmConfigType}') {
|
||
$('#levelTable').show()
|
||
// 获取 任务计划关联的风险等级评估项 的表格
|
||
$("#table_patrolRiskLevel").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/alarm/alarmPointRiskLevel/getList.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||
pageSize: 50, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
paginationDetailHAlign: ' hidden',//去除分页的显示
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order,
|
||
pid: '${alarmPoint.id}'
|
||
}
|
||
},
|
||
// onClickRow: function (row) {//单击行事件,执行查看功能
|
||
// viewFun(row.id);
|
||
// },
|
||
sortName: 'morder', // 要排序的字段
|
||
sortOrder: 'asc', // 排序规则
|
||
columns: [
|
||
{
|
||
field: 'id', // 返回json数据中的name
|
||
title: '安全项内容', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '20%',
|
||
formatter: function (value, row, index) {
|
||
return row.riskLevel.securitycontent;
|
||
}
|
||
}, {
|
||
field: 'id', // 返回json数据中的name
|
||
title: '安全检测类型', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '20%',
|
||
formatter: function (value, row, index) {
|
||
return row.riskLevel.safetyinspectionname
|
||
// if (row.riskLevel.safetyinspection == "1")
|
||
// return "实时报警";
|
||
// else if (row.riskLevel.safetyinspection == "2")
|
||
// return "任务超时报警";
|
||
// else if (row.riskLevel.safetyinspection == "3")
|
||
// return "任务不合格报警";
|
||
}
|
||
}, {
|
||
field: 'id', // 返回json数据中的name
|
||
title: '风险等级', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '20%',
|
||
formatter: function (value, row, index) {
|
||
// return row.riskLevel.risklevel;
|
||
if (row.riskLevel.alarmLevelsConfig != null) {
|
||
return row.riskLevel.alarmLevelsConfig.level;
|
||
} else {
|
||
return "-";
|
||
}
|
||
}
|
||
}, {
|
||
field: 'id', // 返回json数据中的name
|
||
title: '区域', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '20%',
|
||
formatter: function (value, row, index) {
|
||
return row.areaText;
|
||
}
|
||
}, {
|
||
title: "操作",
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: '16%', // 定义列的宽度,单位为像素px
|
||
formatter: function (value, row, index) {
|
||
var buts = '';
|
||
buts += '<button class="btn btn-default btn-sm" onclick="edit_RiskLevelFun(\'' + row.id + '\')" data-toggle="tooltip" title="删除"><i class="fa fa-edit "></i><span class="hidden-md hidden-lg"> 删除</span></button>';
|
||
buts += '<button class="btn btn-default btn-sm" onclick="delete_RiskLevelFun(\'' + row.id + '\')" data-toggle="tooltip" title="删除"><i class="fa fa-trash-o "></i><span class="hidden-md hidden-lg"> 删除</span></button>';
|
||
buts = '<div class = "btn-group">' + buts + '</div>';
|
||
return buts;
|
||
}
|
||
}
|
||
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
console.log("table_patrolRiskLevel 加载数据成功!!!");
|
||
adjustBootstrapTableView("table_patrolRiskLevel");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
console.log("table_patrolRiskLevel 加载数据失败");
|
||
}
|
||
})
|
||
} else {
|
||
$('#levelTable').hide()
|
||
}
|
||
|
||
|
||
})
|
||
|
||
function dosaveD() {
|
||
$("#subFormD").bootstrapValidator('validate');//提交验证
|
||
setTimeout(function () {
|
||
if ($("#subFormD").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/alarm/alarmPoint/doupdate.do", $("#subFormD").serialize() + "&unitId=" + unitId, function (data) {
|
||
if (data.code == 1) {
|
||
closeModal('subModal');
|
||
$("#pointTable").bootstrapTable('refresh');
|
||
} else if (data.code == 0) {
|
||
showAlert('d', data.msg);
|
||
} else {
|
||
showAlert('d', data.msg);
|
||
}
|
||
}, 'json');
|
||
}
|
||
}, 100);
|
||
|
||
}
|
||
|
||
var selectMPint = function () {
|
||
$.post(ext.contextPath + '/achievement/acceptanceModelMPoint/showlistForSelect.do', {
|
||
formId: 'subFormD',
|
||
hiddenId: 'alarmPoint',
|
||
textId: 'alarmPointName'
|
||
}, function (data) {
|
||
$("#mpSubDiv").html(data);
|
||
openModal('mpSubModal');
|
||
});
|
||
};
|
||
|
||
function doAdd_RiskLevel() {
|
||
$.post(ext.contextPath + '/alarm/alarmPointRiskLevel/add.do', {alarmpointId: '${alarmPoint.id}'}, function (data) {
|
||
$("#riskLevelDiv").html(data);
|
||
openModal('riskLevelModal');
|
||
});
|
||
}
|
||
function edit_RiskLevelFun(id) {
|
||
$.post(ext.contextPath + '/alarm/alarmPointRiskLevel/edit.do', {id: id}, function (data) {
|
||
$("#riskLevelDiv").html(data);
|
||
openModal('riskLevelEditModal');
|
||
});
|
||
}
|
||
|
||
var delete_RiskLevelFun = 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 + '/alarm/alarmPointRiskLevel/dodel.do', {id : id}, function(data) {
|
||
if(data.code==1){
|
||
$("#table_patrolRiskLevel").bootstrapTable('refresh');
|
||
}else{
|
||
showAlert('d',data.msg,'mainAlertdiv');
|
||
}
|
||
},'json');
|
||
|
||
}
|
||
});
|
||
};
|
||
|
||
|
||
</script>
|
||
<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="subFormD">
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<input id="id" name="id" type="hidden" value="${alarmPoint.id}"/>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*报警点</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="alarmPointName" name="alarmPointName"
|
||
placeholder="报警点" onclick="selectMPint();" value="${alarmPoint.alarmPointName}"
|
||
readonly>
|
||
<input type="hidden" id="alarmPoint" name="alarmPoint" value="${alarmPoint.alarmPoint}">
|
||
</div>
|
||
<label class="col-sm-2 control-label">*信息标识</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2" id="informationCode" name="informationCode"
|
||
style="width:170px;"></select>
|
||
</div>
|
||
</div>
|
||
|
||
<c:if test="${fn:contains(alarmPoint.informationCode,ValueMutation_Pro)}">
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">基础值</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="baseValue" name="baseValue"
|
||
placeholder="基础值" value="${alarmPoint.baseValue}">
|
||
</div>
|
||
</div>
|
||
</c:if>
|
||
|
||
<c:if test="${fn:contains(alarmPoint.informationCode,LimitValue_Pro)}">
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">上限</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="alarmmax" name="alarmmax" placeholder="上限"
|
||
value="${alarmPoint.mPoint.alarmmax}">
|
||
</div>
|
||
<label class="col-sm-2 control-label">下限</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="alarmmin" name="alarmmin" placeholder="下限"
|
||
value="${alarmPoint.mPoint.alarmmin}">
|
||
</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="halarmmax" name="halarmmax"
|
||
placeholder="上极限" value="${alarmPoint.mPoint.halarmmax}">
|
||
</div>
|
||
<label class="col-sm-2 control-label">下极限</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="lalarmmin" name="lalarmmin"
|
||
placeholder="下极限" value="${alarmPoint.mPoint.lalarmmin}">
|
||
</div>
|
||
</div>
|
||
</c:if>
|
||
|
||
</form>
|
||
</div>
|
||
<div class="modal-body" id="levelTable">
|
||
<div class="box box-primary">
|
||
<div class="box-header with-border">
|
||
<h4 class="box-title" style="font-size: 15px">关联风险等级评估</h4>
|
||
<div class="box-tools pull-right">
|
||
<a onclick="doAdd_RiskLevel()" class="btn btn-box-tool" data-toggle="tooltip" title="新增"><i
|
||
class="fa fa-plus"></i></a>
|
||
<%-- <a onclick="doDelete_RiskLevel()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i--%>
|
||
<%-- class="fa fa-minus"></i></a>--%>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="box-body ">
|
||
<table id="table_patrolRiskLevel"></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="dosaveD()" id="btn_save">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|