first commit
This commit is contained in:
312
WebRoot/jsp/equipment/equipmentFittingsList4Facility.jsp
Normal file
312
WebRoot/jsp/equipment/equipmentFittingsList4Facility.jsp
Normal file
@ -0,0 +1,312 @@
|
||||
<%@page import="com.sipai.tools.CommString"%>
|
||||
<%@ 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"%>
|
||||
<% request.setAttribute("Active_True", CommString.Active_True); %>
|
||||
<% request.setAttribute("Active_False", CommString.Active_False); %>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- bootstrap switch -->
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css"/>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
$("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/equipment/equipmentFittings/getList4Facility.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,
|
||||
classId: '${param.classId}',
|
||||
search_name: $('#search_name_Listeq').val()
|
||||
}
|
||||
},
|
||||
sortName: 'f.goods_id', // 要排序的字段
|
||||
sortOrder: 'asc', // 排序规则
|
||||
detailView: true,//父子表
|
||||
/* onClickRow: function (row) {//单击行事件,执行查看功能
|
||||
viewFun(row.id);
|
||||
}, */
|
||||
columns: [
|
||||
// {
|
||||
// checkbox: true, // 显示一个勾选框
|
||||
// },
|
||||
{
|
||||
field: 'equipmentCardID', // 返回json数据中的name
|
||||
title: '设施编号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
},
|
||||
{
|
||||
field: 'equipmentName', // 返回json数据中的name
|
||||
title: '设施名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'equipmentClassName', // 返回json数据中的name
|
||||
title: '设施类别', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
},
|
||||
{
|
||||
field: 'goodsId', // 返回json数据中的name
|
||||
title: '物品编号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
}, {
|
||||
field: 'goodsName', // 返回json数据中的name
|
||||
title: '物品名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
}, {
|
||||
field: 'goodsModel', // 返回json数据中的name
|
||||
title: '规格型号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
}, {
|
||||
field: 'num', // 返回json数据中的name
|
||||
title: '数量', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter:function(value,row,index){
|
||||
if(row.stock!=null){
|
||||
return row.stock.nowNumber;
|
||||
}
|
||||
}
|
||||
},{
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 90, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts="";
|
||||
buts+= '<button class="btn btn-default btn-sm" title="替代备件" onclick="addFittingsDFun(\'' + row.id + '\',\'' + row.equipmentId + '\')"><i class="fa fa-tag"></i><span class="hidden-md hidden-lg">替代备件</span></button>';
|
||||
buts+='<button class="btn btn-default btn-sm" title="删除" onclick="deleteFittingsDFun(\''+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;
|
||||
}
|
||||
}
|
||||
],
|
||||
//注册加载子表的事件。index:父表当前行的行索引,row:父表当前行的Json数据对象,$detail:当前行下面创建的新行里面的td对象。
|
||||
onExpandRow: function (index, row, $detail) {
|
||||
initFittingsDetailTable(index, row, $detail);
|
||||
//存入sessionStorage
|
||||
sessionStorage.setItem("index", index);
|
||||
},
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//初始化子表
|
||||
var initFittingsDetailTable = function (index, row, $detail) {
|
||||
var pid = row.id;
|
||||
var detailFittingsTable = $detail.html('<table></table>').find('table');
|
||||
$(detailFittingsTable).bootstrapTable({
|
||||
url: ext.contextPath + '/equipment/equipmentFittings/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:pid,
|
||||
}
|
||||
},
|
||||
sortName: 'goods_id', // 要排序的字段
|
||||
sortOrder: 'asc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'goodsId', // 返回json数据中的name
|
||||
title: '物品编号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
}, {
|
||||
field: 'goodsName', // 返回json数据中的name
|
||||
title: '物品名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
}, {
|
||||
field: 'goodsModel', // 返回json数据中的name
|
||||
title: '规格型号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
}, {
|
||||
field: 'num', // 返回json数据中的name
|
||||
title: '数量', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter:function(value,row,index){
|
||||
if(row.stock!=null){
|
||||
return row.stock.nowNumber;
|
||||
}
|
||||
}
|
||||
},{
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 60, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts="";
|
||||
buts+='<button class="btn btn-default btn-sm" title="删除" onclick="deleteFittingsDFun(\''+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;
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("detailFittingsTable");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//添加替代备件
|
||||
var addFittingsDFun = function(pid,equipmentId) {
|
||||
$.post(ext.contextPath + '/sparepart/subscribe/selectGoodsForSubscribeDetail.do', {pid:pid,equipmentId:equipmentId} , function(data) {
|
||||
$("#FittingsDiv").html(data);
|
||||
openModal('subDetailModal');
|
||||
});
|
||||
};
|
||||
|
||||
//通过sessionStorage自动展开
|
||||
var doExpend = function () {
|
||||
if (sessionStorage.getItem("index") != null) {
|
||||
$("#table").bootstrapTable('expandRow', sessionStorage.getItem("index"));
|
||||
}
|
||||
};
|
||||
var refresh = function () {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
//打开已打开的子表
|
||||
setTimeout(doExpend, 500);
|
||||
};
|
||||
|
||||
var doFinishSelectSubscribeDetail = function(data,pid,equipmentId) {//equipmentId
|
||||
$.post(ext.contextPath + '/equipment/importEquipmentFittings.do', {goodsIds:data,equipmentId:equipmentId,pid:pid} , function(data) {
|
||||
if(data.res){
|
||||
refresh();
|
||||
// $("#table").bootstrapTable('refresh');
|
||||
}
|
||||
},'json');
|
||||
};
|
||||
//删除设备配件
|
||||
var deleteFittingsDFun = function(id) {
|
||||
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 + '/equipment/deleteEquipmentFittings.do', {id:id} , function(data) {
|
||||
if(data.code==1){
|
||||
refresh();
|
||||
// $("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d',data.msg);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function addFun(){
|
||||
$.post(ext.contextPath + '/equipment/equipmentFittings/doadd4Facility.do',function(data) {
|
||||
$("#FittingsDiv").html(data);
|
||||
openModal('4SelectModal');
|
||||
});
|
||||
}
|
||||
|
||||
function doSearchList(){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<input type="hidden" id="classId" name="classId" value="${param.classId}">
|
||||
<input type="hidden" id="faultId" name="faultId" value="">
|
||||
|
||||
<!-- <input type="text" id="search_name" name="search_name" value="${param.search_name}"> -->
|
||||
|
||||
<div class="box box-solid">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">设施专用备件</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-default" onclick="addFun();"><i class="fa fa-plus"></i> 新增</button>
|
||||
<!-- <button type="button" class="btn btn-default" onclick="deletesFun();"><i class="fa fa-trash-o"></i> 删除</button> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-inline" >
|
||||
<div class="form-group form-inline pull-right" style="padding-bottom: 5px;">
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name_Listeq" name="search_name_Listeq" class="form-control pull-right" placeholder="设施信息">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchList();"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body">
|
||||
<div>
|
||||
<div id="alertDiv"></div>
|
||||
<div id="eq4SelectDiv"></div>
|
||||
<div id="goods4SelectDiv"></div>
|
||||
|
||||
<table id="table" ></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</html>
|
||||
Reference in New Issue
Block a user