452 lines
18 KiB
Plaintext
452 lines
18 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||
<%@page import="com.sipai.entity.maintenance.MaintainCommStr"%>
|
||
<%request.setAttribute("Maintain_Week", MaintainCommStr.Maintain_Week);%>
|
||
<%request.setAttribute("Maintain_TenDays", MaintainCommStr.Maintain_TenDays);%>
|
||
<%request.setAttribute("Maintain_Month", MaintainCommStr.Maintain_Month);%>
|
||
<%request.setAttribute("Maintain_Quarter", MaintainCommStr.Maintain_Quarter);%>
|
||
<%request.setAttribute("Maintain_HalfYear", MaintainCommStr.Maintain_HalfYear);%>
|
||
<%request.setAttribute("Maintain_Year", MaintainCommStr.Maintain_Year);%>
|
||
|
||
<script type="text/javascript">
|
||
/*
|
||
* 通用和仪表库附表
|
||
*/
|
||
function getWorkContentMaintain(pid,unitId){
|
||
$("#table_library_maintain").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/maintenance/workorderLibraryMaintain/getListMaintain.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,
|
||
pid: pid
|
||
}
|
||
},
|
||
sortName: 'id', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
columns: [
|
||
{
|
||
checkbox: true, // 显示一个勾选框
|
||
}, {
|
||
field: '', // 返回json数据中的name
|
||
title: '维保部位', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '14%',
|
||
formatter: function (value, row, index) {
|
||
if(row.libraryMaintenanceCommon!=null && row.libraryMaintenanceCommon!=''){
|
||
if(row.libraryMaintenanceCommon.equipmentClass!=null && row.libraryMaintenanceCommon.equipmentClass!=''){
|
||
return row.libraryMaintenanceCommon.equipmentClass.name;
|
||
}
|
||
}
|
||
}
|
||
},{
|
||
field: '', // 返回json数据中的name
|
||
title: '周期', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '8%',
|
||
formatter: function (value, row, index) {
|
||
if(row.libraryMaintenanceCommon!=null && row.libraryMaintenanceCommon!=''){
|
||
if(row.libraryMaintenanceCommon.cycle == '${Maintain_Week}'){
|
||
return '周';
|
||
}
|
||
if(row.libraryMaintenanceCommon.cycle == '${Maintain_TenDays}'){
|
||
return '旬';
|
||
}
|
||
if(row.libraryMaintenanceCommon.cycle == '${Maintain_Month}'){
|
||
return '月度';
|
||
}
|
||
if(row.libraryMaintenanceCommon.cycle == '${Maintain_Quarter}'){
|
||
return '季度';
|
||
}
|
||
if(row.libraryMaintenanceCommon.cycle == '${Maintain_HalfYear}'){
|
||
return '半年度';
|
||
}
|
||
if(row.libraryMaintenanceCommon.cycle == '${Maintain_Year}'){
|
||
return '年度';
|
||
}
|
||
}
|
||
}
|
||
},{
|
||
field: '', // 返回json数据中的name
|
||
title: '项目代码', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '9%',
|
||
formatter: function (value, row, index) {
|
||
if(row.libraryMaintenanceCommon!=null && row.libraryMaintenanceCommon!=''){
|
||
return row.libraryMaintenanceCommon.code;
|
||
}
|
||
}
|
||
},{
|
||
field: '', // 返回json数据中的name
|
||
title: '维保项目', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '21%',
|
||
formatter: function (value, row, index) {
|
||
if(row.libraryMaintenanceCommon!=null && row.libraryMaintenanceCommon!=''){
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.libraryMaintenanceCommon.name + "'>" + row.libraryMaintenanceCommon.name + "</span>";
|
||
}
|
||
}
|
||
},{
|
||
field: '', // 返回json数据中的name
|
||
title: '工时定额(小时)', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '14%',
|
||
formatter: function (value, row, index) {
|
||
if(row.libraryMaintenanceCommon!=null && row.libraryMaintenanceCommon!=''){
|
||
return row.libraryMaintenanceCommon.insideRepairTime;
|
||
}
|
||
}
|
||
},{
|
||
field: '', // 返回json数据中的name
|
||
title: '实际工时(小时)', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '14%',
|
||
formatter: function (value, row, index) {
|
||
return row.actualWorkTime;
|
||
}
|
||
},{
|
||
field: '', // 返回json数据中的name
|
||
title: '工时差异分析', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '14%',
|
||
formatter: function (value, row, index) {
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.differences + "'>" + row.differences + "</span>";
|
||
}
|
||
},{
|
||
title: "操作",
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: '6%', // 定义列的宽度,单位为像素px
|
||
formatter: function (value, row, index) {
|
||
var buts = '';
|
||
buts += '<button class="btn btn-default btn-sm" onclick="doLibraryMainEditTy(\'' + 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="deleteLibraryMainFun(\'' + 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 () { //加载成功时执行
|
||
adjustBootstrapTableView("table_library_maintain");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
});
|
||
}
|
||
|
||
/*
|
||
* 通用和仪表库附表
|
||
*/
|
||
function getWorkContentLubrication(pid,unitId){
|
||
$("#table_library_maintain").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/maintenance/workorderLibraryMaintain/getListLubrication.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,
|
||
pid: pid
|
||
}
|
||
},
|
||
sortName: 'id', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
columns: [
|
||
{
|
||
checkbox: true, // 显示一个勾选框
|
||
}, {
|
||
field: '', // 返回json数据中的name
|
||
title: '维保部位', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '14%',
|
||
formatter: function (value, row, index) {
|
||
if(row.libraryMaintenanceLubrication!=null && row.libraryMaintenanceLubrication!=''){
|
||
if(row.libraryMaintenanceLubrication.equipmentClass!=null && row.libraryMaintenanceLubrication.equipmentClass!=''){
|
||
return row.libraryMaintenanceLubrication.equipmentClass.name;
|
||
}
|
||
}
|
||
}
|
||
},{
|
||
field: '', // 返回json数据中的name
|
||
title: '周期', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '8%',
|
||
formatter: function (value, row, index) {
|
||
if(row.libraryMaintenanceLubrication!=null && row.libraryMaintenanceLubrication!=''){
|
||
if(row.libraryMaintenanceLubrication.cycle == '${Maintain_Week}'){
|
||
return '周';
|
||
}
|
||
if(row.libraryMaintenanceLubrication.cycle == '${Maintain_TenDays}'){
|
||
return '旬';
|
||
}
|
||
if(row.libraryMaintenanceLubrication.cycle == '${Maintain_Month}'){
|
||
return '月度';
|
||
}
|
||
if(row.libraryMaintenanceLubrication.cycle == '${Maintain_Quarter}'){
|
||
return '季度';
|
||
}
|
||
if(row.libraryMaintenanceLubrication.cycle == '${Maintain_HalfYear}'){
|
||
return '半年度';
|
||
}
|
||
if(row.libraryMaintenanceLubrication.cycle == '${Maintain_Year}'){
|
||
return '年度';
|
||
}
|
||
}
|
||
}
|
||
},{
|
||
field: '', // 返回json数据中的name
|
||
title: '项目代码', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '9%',
|
||
formatter: function (value, row, index) {
|
||
if(row.libraryMaintenanceLubrication!=null && row.libraryMaintenanceLubrication!=''){
|
||
return row.libraryMaintenanceLubrication.code;
|
||
}
|
||
}
|
||
},{
|
||
field: '', // 返回json数据中的name
|
||
title: '维保项目', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '21%',
|
||
formatter: function (value, row, index) {
|
||
if(row.libraryMaintenanceLubrication!=null && row.libraryMaintenanceLubrication!=''){
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.libraryMaintenanceLubrication.contents + "'>" + row.libraryMaintenanceLubrication.contents + "</span>";
|
||
}
|
||
}
|
||
},{
|
||
field: '', // 返回json数据中的name
|
||
title: '工时定额(小时)', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '14%',
|
||
formatter: function (value, row, index) {
|
||
if(row.libraryMaintenanceLubrication!=null && row.libraryMaintenanceLubrication!=''){
|
||
return row.libraryMaintenanceLubrication.insideRepairTime;
|
||
}
|
||
}
|
||
},{
|
||
field: '', // 返回json数据中的name
|
||
title: '实际工时(小时)', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '14%',
|
||
formatter: function (value, row, index) {
|
||
return row.actualWorkTime;
|
||
}
|
||
},{
|
||
field: '', // 返回json数据中的name
|
||
title: '工时差异分析', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '14%',
|
||
formatter: function (value, row, index) {
|
||
return row.differences;
|
||
}
|
||
},{
|
||
title: "操作",
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: '6%', // 定义列的宽度,单位为像素px
|
||
formatter: function (value, row, index) {
|
||
var buts = '';
|
||
buts += '<button class="btn btn-default btn-sm" onclick="doLibraryMainEditRh(\'' + 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="deleteLibraryMainFun(\'' + 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 () { //加载成功时执行
|
||
adjustBootstrapTableView("table_library_maintain");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
});
|
||
}
|
||
|
||
/*
|
||
* 单删
|
||
*/
|
||
var deleteLibraryMainFun = 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(willDelete =>{
|
||
if (willDelete) {
|
||
$.post(ext.contextPath + '/maintenance/workorderLibraryMaintain/dodelete.do', {id : id}, function(data) {
|
||
var datastr = eval('(' + data + ')');
|
||
if (datastr.code == 1) {
|
||
$("#table_library_maintain").bootstrapTable('refresh');
|
||
}else{
|
||
showAlert('d','删除失败','mainAlertdiv2');
|
||
}
|
||
});
|
||
|
||
}
|
||
});
|
||
};
|
||
|
||
/*
|
||
* 多删
|
||
*/
|
||
var deleteLibraryMainsFun = function () {
|
||
var checkedItems = $("#table_library_maintain").bootstrapTable('getSelections');
|
||
var datas = "";
|
||
$.each(checkedItems, function (index, item) {
|
||
datas += item.id + ",";
|
||
});
|
||
if (datas == "") {
|
||
showAlert('d', '请先选择记录', 'mainAlertdiv2');
|
||
} else {
|
||
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 + '/maintenance/workorderLibraryMaintain/dodeletes.do', { ids: datas }, function (data) {
|
||
var datastr = eval('(' + data + ')');
|
||
if (datastr.code == 1) {
|
||
$("#table_library_maintain").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '删除失败', 'mainAlertdiv2');
|
||
}
|
||
});
|
||
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
|
||
//导入通用/仪表页面
|
||
var doLibraryMainAdd = function (equipmentId,unitId,equipmentType) {
|
||
var tableData = $("#table_library_maintain").bootstrapTable('getData');
|
||
var libraryIds = "";
|
||
$.each(tableData, function (index, item) {
|
||
if (libraryIds != "") {
|
||
libraryIds += ",";
|
||
}
|
||
libraryIds += item.libraryMaintenanceCommon.id;//维保库id
|
||
})
|
||
$.post(ext.contextPath + '/maintenance/libraryMaintenanceCommon/library4Select.do', {
|
||
libraryIds: libraryIds,
|
||
equipmentId: equipmentId,
|
||
unitId: unitId,
|
||
equipmentType: equipmentType
|
||
}, function (data) {
|
||
$("#subDiv_library").html(data);
|
||
openModal('libraryModal');
|
||
});
|
||
}
|
||
|
||
//导入润滑页面
|
||
var doLibraryLubricationAdd = function (equipmentId,unitId,equipmentType) {
|
||
var tableData = $("#table_library_maintain").bootstrapTable('getData');
|
||
var libraryIds = "";
|
||
$.each(tableData, function (index, item) {
|
||
if (libraryIds != "") {
|
||
libraryIds += ",";
|
||
}
|
||
libraryIds += item.libraryMaintenanceLubrication.id;//维保库id
|
||
})
|
||
$.post(ext.contextPath + '/maintenance/libraryMaintenanceLubrication/library4Select.do', {
|
||
libraryIds: libraryIds,
|
||
equipmentId: equipmentId,
|
||
unitId: unitId,
|
||
equipmentType: equipmentType
|
||
}, function (data) {
|
||
$("#subDiv_library").html(data);
|
||
openModal('libraryModal');
|
||
});
|
||
}
|
||
|
||
//选择对应的库内容
|
||
var doFinishSelectLibraryMain = function (data,type){
|
||
$.post(ext.contextPath + '/maintenance/workorderLibraryMaintain/updateLibraryMaintains.do', {
|
||
id: '${maintain.id}',
|
||
libraryIds: data,
|
||
type: type
|
||
}, function (data) {
|
||
if (data.code == '1') {
|
||
$("#table_library_maintain").bootstrapTable('refresh');
|
||
}
|
||
}, 'json');
|
||
}
|
||
|
||
var doLibraryMainEditTy = function(id){
|
||
$.post(ext.contextPath + '/maintenance/workorderLibraryMaintain/doeditTy.do', {id:id} , function(data) {
|
||
$("#subDiv_library").html(data);
|
||
openModal('libraryModal');
|
||
});
|
||
}
|
||
|
||
var doLibraryMainEditRh = function(id){
|
||
$.post(ext.contextPath + '/maintenance/workorderLibraryMaintain/doeditRh.do', {id:id} , function(data) {
|
||
$("#subDiv_library").html(data);
|
||
openModal('libraryModal');
|
||
});
|
||
}
|
||
|
||
</script> |