first commit
This commit is contained in:
358
WebRoot/jsp/timeefficiency/showAllPatrolRiskLevelForSelect.jsp
Normal file
358
WebRoot/jsp/timeefficiency/showAllPatrolRiskLevelForSelect.jsp
Normal file
@ -0,0 +1,358 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<script type="text/javascript">
|
||||
var riskLevelIdsString = '${riskLevelIds}';
|
||||
var doSearchPatrolRiskLevel = function () {
|
||||
$("#table_patrolRiskLevel4Select").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
function doSelect(dialog, grid) {
|
||||
//var checkedItems = $("#table_user").bootstrapTable('getAllSelections');
|
||||
var datas = "";
|
||||
datas_name = "";
|
||||
$.each(selectionIds, function (index, item) {
|
||||
if (datas != "") {
|
||||
datas += ",";
|
||||
}
|
||||
datas += item;
|
||||
});
|
||||
//调用上一界面方法完成选择
|
||||
doFinishSelectPatrolRiskLevel(datas);
|
||||
closeModal("patroRiskLevelModal");
|
||||
};
|
||||
|
||||
var $table;
|
||||
var switchStatus = false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds() {
|
||||
var check_array = riskLevelIdsString.split(",");
|
||||
if (check_array != null && check_array.length > 0) {
|
||||
selectionIds = new Array(check_array.length);
|
||||
for (var i = 0; i < check_array.length; i++) {
|
||||
selectionIds[i] = check_array[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//初始化 安全任务记录的 状态
|
||||
function refreshRecordStatus() {
|
||||
var data = [];
|
||||
var statusAll = {
|
||||
"id": "-1",
|
||||
"text": "所有类型"
|
||||
}
|
||||
data.push(statusAll);
|
||||
var status1 = {
|
||||
"id": "2",
|
||||
"text": "任务超时报警"
|
||||
}
|
||||
data.push(status1);
|
||||
var status2 = {
|
||||
"id": "3",
|
||||
"text": "任务不合格报警"
|
||||
}
|
||||
data.push(status2);
|
||||
// var status3 = {
|
||||
// "id": "${STATUS_OUTOFTIME}",
|
||||
// "text": "已超时"
|
||||
// }
|
||||
// data.push(status3);
|
||||
|
||||
|
||||
var selelct = $("#chooseType").select2({
|
||||
data: data, // 选项里看的
|
||||
// placeholder: '请选择任务类型',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||||
multiple: false, // 不启用多选
|
||||
// selectOnClose: true, // 结果显示高亮
|
||||
// formatResult 格式化结果 成为 自己想要的格式
|
||||
formatResult: function formatRepo(repo) {
|
||||
return repo.text;
|
||||
}, // 函数用来渲染结果 repo.text;
|
||||
formatSelection: function formatRepoSelection(repo) {
|
||||
return repo.id;
|
||||
} // 函数用于呈现当前的选择 repo.id;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
function queryParams(params) {
|
||||
var temp = {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_name').val(),
|
||||
// unitId:'${patrolPlanunitId}',
|
||||
// patrolType:$('#patrolType').val(),
|
||||
chooseType: $('#chooseType').val(),
|
||||
processSectionId: '${param.processSectionId}'
|
||||
};
|
||||
// var status =$('#switchBtn').bootstrapSwitch('state')
|
||||
// if(status){
|
||||
// temp.checkedIds = riskLevelIdsString;
|
||||
// }
|
||||
return temp;
|
||||
}
|
||||
|
||||
$(function () {
|
||||
refreshRecordStatus();
|
||||
//jquery html()方法加载,导致box无法执行boxwidget(),手动初始化
|
||||
$('#searchBox').boxWidget();
|
||||
$('#switchBtn').bootstrapSwitch({
|
||||
onText: '是',
|
||||
offText: '否',
|
||||
size: "small",
|
||||
})
|
||||
|
||||
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});
|
||||
initialSelectionIds();
|
||||
|
||||
$("#chooseType").on("change", function (e) {
|
||||
$("#table_patrolRiskLevel4Select").bootstrapTable('refresh');
|
||||
// doSearchPatrolRiskLevel();
|
||||
});
|
||||
|
||||
|
||||
$table = $("#table_patrolRiskLevel4Select").bootstrapTable({ // 对应table标签的id
|
||||
// url: ext.contextPath + '/timeEfficiency/patrolPoint/getList.do', // 获取表格数据的url
|
||||
url: ext.contextPath + '/timeEfficiency/patrolRiskLevel/getList.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect: true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 20, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
clickToSelect: true,
|
||||
responseHandler: responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'morder', // id 要排序的字段
|
||||
sortOrder: 'asc', // 排序规则 desc
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
//formatter: stateFormatter
|
||||
formatter: function (i, row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if ($.inArray(row.id, Array.from(selectionIds)) != -1) { // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked: true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
, {
|
||||
field: 'securitycontent',
|
||||
title: "安全项内容",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '35%'
|
||||
}
|
||||
, {
|
||||
field: 'safetyinspectionname',
|
||||
title: "安全检测类型",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '25%'
|
||||
}
|
||||
, {
|
||||
field: 'alarmLevelsConfig.level',
|
||||
title: "风险等级",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '10%'
|
||||
}
|
||||
// ,{
|
||||
// field: 'accidentcategory',
|
||||
// title: "潜在的事故类别",
|
||||
// align: 'center',
|
||||
// valign: 'middle',
|
||||
// width: '15%'
|
||||
// }
|
||||
, {
|
||||
field: 'place',
|
||||
title: "地点",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '30%'
|
||||
}
|
||||
// ,{
|
||||
// field: 'consequences',
|
||||
// title: "主要后果",
|
||||
// align: 'center',
|
||||
// valign: 'middle',
|
||||
// width: '5%'
|
||||
// }
|
||||
// ,{
|
||||
// field: 'actionstaken',
|
||||
// title: "行动",
|
||||
// align: 'center',
|
||||
// valign: 'middle',
|
||||
// width: '10%'
|
||||
// }
|
||||
|
||||
// ,{
|
||||
// field: '_pname',
|
||||
// title: "工艺段",
|
||||
// align: 'center',
|
||||
// valign: 'middle',
|
||||
// width: '50%',
|
||||
// formatter:function(value,row,index){
|
||||
// return row.processSection==null?"":row.processSection.name;
|
||||
// }
|
||||
// }
|
||||
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_patrolRiskLevel4Select");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e, rows, obj) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
if ('check' == e.type) {
|
||||
obj.parent().addClass("checked");
|
||||
} else {
|
||||
obj.parent().removeClass("checked");
|
||||
}
|
||||
//adjustBootstrapTableView("table_user");
|
||||
});
|
||||
});
|
||||
//选中事件操作数组
|
||||
var union = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
if ($.inArray(id, array) == -1) {
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//取消选中事件操作数组
|
||||
var difference = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id, array);
|
||||
if (index != -1) {
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union": union, "difference": difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="patroRiskLevelModal">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<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 " style="width:100%">
|
||||
<div id="alertDiv"></div>
|
||||
|
||||
<div style="display: none;" class="box box-primary box-solid collapsed-box" id="searchBox" collapsed>
|
||||
<div class="box-header">
|
||||
<div class="pull-right box-tools">
|
||||
<button type="button" class="btn btn-primary btn-sm pull-right" data-widget="collapse"
|
||||
style="margin-right: 5px;">
|
||||
<i class="fa fa-plus"></i></button>
|
||||
</div>
|
||||
<i class="fa fa-search"></i>
|
||||
</div>
|
||||
<div class="box-body ">
|
||||
<form class="form-horizontal ">
|
||||
<div style="display:flex;">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">类型</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control select2 " id="chooseType2" name="chooseType"
|
||||
style="width: 150px;">
|
||||
</select>
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">名称</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="text" id="search_name2" name="search_name"
|
||||
class="form-control input-sm"
|
||||
placeholder="名称" style="width:130px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-left: 20px;">
|
||||
<div class=" col-sm-offset-6 button-group" style="padding: 0;">
|
||||
<button type="button" class="btn btn-default btn-sm pull-right"
|
||||
onclick="doSearchPatrolRiskLevel();"><i class="fa fa-search"> 搜索</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display:flex;height:50px; line-height:50px;">
|
||||
<div class="form-group">
|
||||
<label style="height:34px; line-height:34px;padding-right: 0px;padding-left: 0px;width: 38px;"
|
||||
class="col-sm-2 control-label">类型</label>
|
||||
<div class="col-sm-4"
|
||||
style=" height:34px; line-height:34px;padding-left: 0px; padding-right: 0px; ">
|
||||
<select class="form-control select2 " id="chooseType" name="chooseType"
|
||||
style="width: 150px;">
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label style="height:34px; line-height:34px;padding-left: 33px;padding-right: 0px;"
|
||||
class="col-sm-2 control-label">名称</label>
|
||||
<div class="col-sm-3" style=" padding-left: 5px; height:34px; line-height:34px;">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control"
|
||||
placeholder="名称" style="width:130px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-left: 1px;">
|
||||
<div class=" col-sm-offset-6 button-group" style="padding: 0;">
|
||||
<button type="button" class="btn btn-default btn-sm pull-right"
|
||||
onclick="doSearchPatrolRiskLevel();"><i class="fa fa-search"> 搜索</i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div id="table_patrolRiskLevel4Select" style="height:230px;overflow:auto;width:100%"></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="doSelect()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user