Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/equipment/maintenancePlanHandle.jsp

461 lines
19 KiB
Plaintext
Raw Permalink Normal View History

2026-01-16 14:13:44 +08:00
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@page import="com.sipai.tools.CommString"%>
<%@page import="com.sipai.entity.maintenance.MaintenanceCommString"%>
<%request.setAttribute("Active_False", CommString.Active_False); %>
<%request.setAttribute("Active_True", CommString.Active_True); %>
<%request.setAttribute("MAINTAIN",MaintenanceCommString.MAINTENANCE_TYPE_MAINTAIN); %>
<%request.setAttribute("INTER_MAINTENANCE",MaintenanceCommString.INTER_MAINTENANCE); %>
<%request.setAttribute("EXTERANL_MAINTENANCE",MaintenanceCommString.EXTERANL_MAINTENANCE); %>
<%request.setAttribute("COMMON_MAINTENANCE",MaintenanceCommString.COMMON_MAINTENANCE); %>
<%request.setAttribute("MAINTAIN_YEAR",MaintenanceCommString.MAINTAIN_YEAR); %>
<%request.setAttribute("MAINTAIN_MONTH",MaintenanceCommString.MAINTAIN_MONTH); %>
<%request.setAttribute("MAINTAIN_HALFYEAR",MaintenanceCommString.MAINTAIN_HALFYEAR); %>
<%request.setAttribute("START",MaintenanceCommString.PLAN_START); %>
<%request.setAttribute("SUBMIT",MaintenanceCommString.PLAN_SUBMIT); %>
<style type="text/css">
.select2-container .select2-selection--single{
height:34px;
line-height: 34px;
}
.select2-selection__arrow{
margin-top:3px;
}
/* .file-border{
padding-top :10px;
padding-bottom :1px;
margin-left :17%;
padding-right :0px;
padding-left :0px;
border-color :#D2D6DE;
border-style: solid;
border-width: 1px 1px 1px 1px;
border-top-left-radius:10px;
border-top-right-radius:10px;
border-bottom-left-radius:10px;
border-bottom-right-radius:10px;
} */
</style>
<script type="text/javascript">
//流程审核文件上传所需参数
var masterId_process = '${maintenancePlan.id}';//业务Id
var tbName_process = 'TB_Process_UploadFile'; //数据表
var nameSpace_process ='ProcessUploadFile';//保存文件夹
var status = 'delete';//有删除权限
function doupdate() {
$("#subForm").bootstrapValidator('validate');//提交验证
//setTimeout(function(){
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/equipment/maintenancePlan/doupdate.do", $("#subForm").serialize(), function(data) {
if (data.res == 1){
$("#table").bootstrapTable('refresh');
closeModal("subModal");
}else if(data.res == 0){
showAlert('d','保存失败');
}else{
showAlert('d',data.res);
}
},'json');
}
//}, 100);
}
//保养计划提交审核
function dosubmit(){
$('#subUnitForm').data('bootstrapValidator')
.updateStatus('targetUsersName', 'NOT_VALIDATED',null)
.validateField('targetUsersName');
$("#subForm").bootstrapValidator('validate');//提交验证
$("#subUnitForm").bootstrapValidator('validate');//提交验证
//setTimeout(function(){
if ($("#subForm").data('bootstrapValidator').isValid() && $("#subUnitForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/equipment/maintenancePlan/doupdate.do", $("#subForm").serialize(), function(data) {
var routeNum = $("#routeNum").val();
if (data.res == 1){
$.post(ext.contextPath + "/equipment/maintenancePlan/submitAuditAgain.do", $("#subUnitForm").serialize()+"&routeNum="+routeNum, function(unitdata) {
if (unitdata.res == 1) {
closeModal('subModal')
$("#table").bootstrapTable('refresh');
}else if(unitdata.res == 0){
showAlert('d','保存失败');
}else{
showAlert('d',data.res);
}
},'json');
}else if(data.res == 0){
showAlert('d','保存失败');
}else{
showAlert('d',data.res);
}
},'json');
}
//}, 100);
}
//提交时先验证审核人不能为空,保存时审核人可以为空
function submitFun(){
//新增的输入框添加验证
$("#subUnitForm").data('bootstrapValidator').addField('targetUsersName',{
validators: {
notEmpty: {
message: '审核人不能为空'
},
}
});
dosubmit();
}
$("#subForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
planNumber: {
validators: {
notEmpty: {
message: '计划编号不能为空'
},
/* remote: {//ajax验证。server result:{"valid",true or false} 向服务发送当前input name值获得一个json数据。例表示正确{"valid",true}
url: ext.contextPath + '/equipment/maintenancePlan/checkExist.do',//验证地址
message: '计划编号已存在',//提示消息
type: 'POST',//请求方式
data: function(validator) {
return {
planNumber: $('#planNumber').val(),
id : $('#id').val()
};
}
}, */
}
},
bizId: {
validators: {
notEmpty: {
message: '厂区不能为空'
}
}
},
equipmentId: {
validators: {
notEmpty: {
message: '设备名称不能为空'
}
}
},
initialDate: {
validators: {
notEmpty: {
message: '初始日期不能为空'
}
}
},
content: {
validators: {
notEmpty: {
message: '保养内容不能为空'
}
}
},
}
});
var companyId = "${maintenancePlan.bizId}";
//根据保养类型显示下发日期
/* var selectTypeFun = function(planType){
switch(planType){
case'${MAINTAIN_MONTH}':
$("#issueDate").hide();
$("#initialDate").attr("disabled",true);
break;
case'${MAINTAIN_YEAR}':
$("#issueDate").show();
$("#initialDate").attr("disabled",false);
break;
default:
$("#issueDate").hide();
$("#initialDate").attr("disabled",true);
break;
}
} */
$(function() {
//初始化文件显示
getFileList_process();
//初始化选择框方法在workflow.js里
processSelectNodeForHandle("${businessUnitHandle.taskid}");
//初始化subUnitForm输入框验证
$("#subUnitForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
targetUsersName: {
validators: {
notEmpty: {
message: '审核人员不能为空'
}
}
},
}
});
//加载维修流程
$.post(ext.contextPath + '/maintenance/equipmentPlan/showProcessView.do', {
id: '${equipmentPlan.id}',
inModal: 'inModal'
}, function (data) {
$("#showView").html(data);
});
//$("#active").select2({minimumResultsForSearch: 10}).val("${maintenancePlan.active}").trigger("change");
$("#maintenanceWay").select2({minimumResultsForSearch: 10}).val("${maintenancePlan.maintenanceWay}").trigger("change");
//计划保养费用保留两位小数
$("#planMoney").val(parseFloat('${maintenancePlan.planMoney}').toFixed(2))
//选择时间
$('#initialDate').datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format:'yyyy-mm-dd',
}).on('hide',function(e) {
//当日期选择框关闭时,执行刷新校验
$('#subForm').data('bootstrapValidator')
.updateStatus('initialDate', 'NOT_VALIDATED',null)
.validateField('initialDate');
});
//选择保养类型
var selectType = $("#planType").select2({
minimumResultsForSearch: 10
})
selectType.val('${maintenancePlan.planType}').trigger("change");
$("#table_equipmentCard").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/maintenance/equipmentPlanEqu/getList.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [300, 5000], // 设置页面可以显示的数据条数
pageSize: 300, // 页面数据条数
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: '${equipmentPlan.id}'
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
columns: [
{
checkbox: true, // 显示一个勾选框
width: '40px'
}, {
field: 'equipmentcardid', // 返回json数据中的name
title: '设备编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '35%',
formatter: function (value, row, index) {
if (row.equipmentCard != null && row.equipmentCard != '') {
// return row.equipmentCard.equipmentcardid;
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentCard.equipmentcardid + "'>" + row.equipmentCard.equipmentcardid + "</span>";
}
}
}, {
field: 'equipmentname', // 返回json数据中的name
title: '设备名称', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '35%',
formatter: function (value, row, index) {
if (row.equipmentCard != null && row.equipmentCard != '') {
// return row.equipmentCard.equipmentname;
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentCard.equipmentname + "'>" + row.equipmentCard.equipmentname + "</span>";
}
}
},
/*{
field: 'nr', // 返回json数据中的name
title: '内容', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '25%',
formatter: function (value, row, index) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.contents + "'>" + row.contents + "</span>";
}
}, */
{
field: 'ys', // 返回json数据中的name
title: '预算(元)', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
width: '15%',
formatter: function (value, row, index) {
return row.planMoney;
}
}, {
title: "操作",
align: 'center',
valign: 'middle',
width: '15%', // 定义列的宽度单位为像素px
formatter: function (value, row, index) {
var buts = '';
//if (row.status == '${Status_NoStart}') {
buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="editEquFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteEquFun(\'' + row.id + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button';
/*} else {
buts += '<button class="btn btn-default btn-sm" onclick="processDetailViewFun(\'' + row.id + '\')" data-toggle="tooltip" title="查看详情"><i class="fa fa-history"></i><span class="hidden-md hidden-lg"> 查看详情</span></button>'
}*/
buts = '<div class="btn-group" >' + buts + '</div>';
return buts;
}
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("table_equipmentCard");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
})
//selectTypeFun($("#planType").val());
/* selectType.on("change",function(e){
selectTypeFun($(this).val());
}); */
});
//选择设备根据厂区id选择厂内设备
var selectEquipmentCard = function() {
$.post(ext.contextPath + '/equipment/showEquipmentCardForSelect.do', {companyId:companyId, equipmentId:$("#equipid").val()} , function(data) {
$("#emSubDiv").html(data);
openModal('emSubModal');
});
};
//选择审核人
var showUser4AuditSelectsFun = function() {
var userIds= $("#targetusers").val();
var jobIds= $("#targetjobs").val();
$.post(ext.contextPath + '/user/userForSelectByCompany.do', {formId:"subUnitForm",hiddenId:"targetusers",textId:"targetUsersName",userIds:userIds,jobIds:jobIds} , function(data) {
$("#user4SelectDiv").html(data);
openModal("user4SelectModal");
});
};
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog modal-xlg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">调整保养计划</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-7 col-xs-12">
<!-- 新增界面formid强制为subForm -->
<form class="form-horizontal" id="subForm">
<!-- 界面提醒div强制id为alertDiv -->
<div id="alertDiv"></div>
<input name="status" id="status" type="hidden" value="${Status_NoStart}"/>
<input name="id" id="id" type="hidden" value="${equipmentPlan.id}"/>
<input name="planTypeBig" id="planTypeBig" type="hidden" value="${equipmentPlan.planTypeBig}"/>
<div class="form-group">
<label class="col-sm-2 control-label">*所属厂区</label>
<div class="col-sm-4">
<input name="unitId" id="unitId" type="hidden" value="${equipmentPlan.unitId}"/>
<p class="form-control-static">${companyName}</p>
</div>
<label class="col-sm-2 control-label">*计划编号</label>
<div class="col-sm-4">
<p class="form-control-static">${equipmentPlan.planNumber}</p>
<input type="hidden" class="form-control" id="planNumber" name="planNumber"
placeholder="计划编号" value="${equipmentPlan.planNumber}" readonly>
</div>
</div>
<c:if test="${param.type == Code_Type_By}">
<div class="form-group">
<label class="col-sm-2 control-label">*类别</label>
<div class="col-sm-4">
<p class="form-control-static">${planTypeSmallName}</p>
<input type="hidden" name="planTypeSmall" value="${equipmentPlan.planTypeSmall}">
</div>
</div>
</c:if>
<div class="form-group">
<label class="col-sm-2 control-label">预算 (元)</label>
<div class="col-sm-4">
<input type="number" class="form-control" id="planMoney" name="planMoney" placeholder="计划费用"
min="0" step="50.01" value="${equipmentPlan.planMoney}" autocomplete="off">
</div>
<label class="col-sm-2 control-label">*计划日期</label>
<div class="col-sm-4">
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control" id="planDate" name="planDate"
style="width: 130px;" placeholder="请选择"
value="${equipmentPlan.planDate.substring(0,7)}" autocomplete="off"/>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">*计划内容</label>
<div class="col-sm-10">
<textarea class="form-control " id="planContents" name="planContents"
rows="2">${equipmentPlan.planContents}</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">审核人</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="auditMan" name="auditMan" placeholder="点击选择"
onclick="showUser4AuditSelectsFun();" value="${userName}" autocomplete="off">
<input id="auditId" name="auditId" type="hidden" value="${equipmentPlan.auditId}"/>
</div>
</div>
<!-- 文件上传,显示 -->
<%--<div class="form-group" style="margin:8px">
<label class="col-sm-2 control-label"></label>
<button type="button" class="btn btn-default btn-file" onclick="fileinput_process()"
><i class="fa fa-paperclip"></i>上传文件
</button>
</div>
<div id="fileArea"></div>--%>
</form>
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">关联设备</h3>
<div class="box-tools pull-right">
<a onclick="doEditEquipment()" class="btn btn-box-tool" data-toggle="tooltip"
title="新增"><i class="fa fa-plus"></i></a>
<a onclick="deletesEquipment()" 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_equipmentCard" style="table-layout:fixed;"></table>
</div>
</div>
</div>
<div class="col-md-5 col-xs-12" id="showView"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" onclick="doupdate()" id="btn_update">保存</button>
<button type="button" class="btn btn-primary" onclick="submitFun()" id="btn_submit">提交审核</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>