first commit
This commit is contained in:
239
WebRoot/jsp/equipment/equipmentCardListForSelect2.jsp
Normal file
239
WebRoot/jsp/equipment/equipmentCardListForSelect2.jsp
Normal file
@ -0,0 +1,239 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@page import="java.util.Date" %>
|
||||
<%@page import="java.text.SimpleDateFormat" %>
|
||||
<%@ page import="com.sipai.tools.SessionManager"%>
|
||||
<%
|
||||
SessionManager sessionManager = new SessionManager();
|
||||
%>
|
||||
|
||||
<script type="text/javascript">
|
||||
var checkedItem="";
|
||||
function doselect() {
|
||||
if(checkedItem!= null && checkedItem!=""){
|
||||
// console.info(checkedItem)
|
||||
$('#equipmentId' ).val(checkedItem.id);
|
||||
$('#equipname').val(checkedItem.equipmentname);
|
||||
$('#equipmentNumber').val(checkedItem.equipmentcardid);
|
||||
$('#equipmentmodelname').val(checkedItem.equipmentmodelname);
|
||||
$('#processSectionId' ).val(checkedItem.processsectionid);
|
||||
if(checkedItem.processSection != null && checkedItem.processSection!=""){
|
||||
$('#processectionname').val(checkedItem.processSection.name);
|
||||
}else{
|
||||
$('#processectionname').val("");
|
||||
}
|
||||
closeModal("emSubModal");
|
||||
var isone = $('#isone').val();
|
||||
if(isone=='1'){
|
||||
isOneDevice();
|
||||
}
|
||||
}else{
|
||||
showAlert('d','尚未选择设备台账!','alertDiv_MaintainPlanSelect');
|
||||
}
|
||||
};
|
||||
var $table;
|
||||
//显示已经勾选的数据
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag=false;
|
||||
if(row.id=='${equipmentId}'){
|
||||
flag=true;
|
||||
checkedItem = row;
|
||||
}
|
||||
if (flag)
|
||||
return {
|
||||
checked : true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
var dosearchTable_equ = function() {
|
||||
$("#table_equ").bootstrapTable('refresh');
|
||||
console.info($('#searchEqu_name').val())
|
||||
};
|
||||
|
||||
var companyId = '${companyId}';
|
||||
|
||||
$("#searchEqu_name").keyup(function(){
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车查询
|
||||
dosearchTable_equ();
|
||||
event.stopPropagation();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$("#processSection1").empty();
|
||||
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'});
|
||||
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
|
||||
$("#processSection1").empty();
|
||||
var selelct_ =$("#processSection1").select2({
|
||||
data: data,
|
||||
cache : false,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: true,//允许清空
|
||||
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;} // 函数用于呈现当前的选择
|
||||
});
|
||||
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
|
||||
selelct_.val('').trigger("change");
|
||||
selelct_.on("change",function(e){
|
||||
dosearchTable_equ();
|
||||
});
|
||||
},'json');
|
||||
|
||||
$('#table_equ').bootstrapTable('destroy');
|
||||
$table = $("#table_equ").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/equipment/getList.do', // 获取表格数据的url
|
||||
clickToSelect:true,
|
||||
singleSelect:true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
//responseHandler:responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
equipmentName : $('#searchEqu_name').val(),
|
||||
unitId: companyId,
|
||||
pSectionId: $("#processSection1").val(),
|
||||
checkedIds:'${param.ids}'
|
||||
}
|
||||
},
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* onClickRow: function (row) {//单击行事件,执行查看功能
|
||||
viewFun(row.id);
|
||||
}, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
formatter: stateFormatter
|
||||
},{
|
||||
field: 'equipmentcardid', // 返回json数据中的name
|
||||
title: '设备编号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'equipmentname', // 返回json数据中的name
|
||||
title: '设备名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},/* {
|
||||
field: 'company.name', // 返回json数据中的name
|
||||
title: '所属厂区', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, */{
|
||||
field: 'processSection.name', // 返回json数据中的name
|
||||
title: '工艺段', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'equipmentClass.name', // 返回json数据中的name
|
||||
title: '设备类型', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
},{
|
||||
field: 'equipmentTypeNumber.name', // 返回json数据中的name
|
||||
title: '设备型号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
}/* ,{
|
||||
field: 'equipmentLevel.levelname', // 返回json数据中的name
|
||||
title: '设备等级', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
},{
|
||||
field: 'equipmentstatus', // 返回json数据中的name
|
||||
title: '状态', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
switch (value){
|
||||
case '0' :
|
||||
return "禁用";
|
||||
case '1' :
|
||||
return "启用";
|
||||
default :
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}, */
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table_equ");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e,rows, obj) {
|
||||
if('check'==e.type){
|
||||
$('#table_equ .checked').removeClass("checked");
|
||||
obj.parent().addClass("checked");
|
||||
checkedItem = rows;
|
||||
}else{
|
||||
obj.parent().removeClass("checked");
|
||||
checkedItem = "";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="emSubModal" >
|
||||
<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">
|
||||
<input type="hidden" id="isone" name="isone" value="${isone}">
|
||||
<div id="alertDiv_MaintainPlanSelect"></div>
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="menu4SelectDiv"></div>
|
||||
<div id="modal-body">
|
||||
<div class="form-group form-inline" >
|
||||
<div class="form-group form-inline">
|
||||
<div class="form-group ">
|
||||
<label class="form-label">工艺段</label>
|
||||
<select class="form-control select2 " id="processSection1" name ="processSection1" style="width: 220px;"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group pull-right" >
|
||||
<div class="input-group input-group-sm pull-left" style="width: 220px;margin-left:10px">
|
||||
<input type="text" id="searchEqu_name" name="searchEqu_name" class="form-control pull-right" placeholder="设备名称">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="dosearchTable_equ();"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-scrollable">
|
||||
<table class="table table-bordered table-striped" style="overflow:auto;width:100%" id="table_equ"></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="doselect()" id="btn_save">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user