339 lines
15 KiB
Plaintext
339 lines
15 KiB
Plaintext
|
|
<%@ 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').data('bootstrapValidator')
|
|||
|
|
.updateStatus('equipname', 'NOT_VALIDATED',null)
|
|||
|
|
.validateField('equipname'); */
|
|||
|
|
$("#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(){
|
|||
|
|
$("#active").val('${SUBMIT}');
|
|||
|
|
$('#subForm').data('bootstrapValidator')
|
|||
|
|
.updateStatus('auditMan', 'NOT_VALIDATED',null)
|
|||
|
|
.validateField('auditMan');
|
|||
|
|
/* $('#subForm').data('bootstrapValidator')
|
|||
|
|
.updateStatus('equipname', 'NOT_VALIDATED',null)
|
|||
|
|
.validateField('equipname'); */
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
//setTimeout(function(){
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/equipment/maintenancePlan/startPlanAudit.do", $("#subForm").serialize(), function(data) {
|
|||
|
|
if (data.res == 1) {
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
closeModal('subModal');
|
|||
|
|
}else if(data.res == 0){
|
|||
|
|
showAlert('d','保存失败');
|
|||
|
|
}else if(data.res == 2){
|
|||
|
|
showAlert('d','未检测到保养计划审核流程,请先部署流程!');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.res);
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
}
|
|||
|
|
//}, 100);
|
|||
|
|
}
|
|||
|
|
//提交时先验证审核人不能为空,保存时审核人可以为空
|
|||
|
|
function submitFun(){
|
|||
|
|
//新增的输入框添加验证
|
|||
|
|
$("#subForm").data('bootstrapValidator').addField('auditMan',{
|
|||
|
|
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();
|
|||
|
|
//$("#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");
|
|||
|
|
|
|||
|
|
//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= $("#auditId").val();
|
|||
|
|
$.post(ext.contextPath + '/user/userForSelect.do', {formId:"subForm",hiddenId:"auditId",textId:"auditMan",userIds:userIds} , function(data) {
|
|||
|
|
$("#user4SelectDiv").html(data);
|
|||
|
|
openModal("user4SelectModal");
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
</script>
|
|||
|
|
<div class="modal fade" id="subModal">
|
|||
|
|
<div class="modal-dialog">
|
|||
|
|
<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">
|
|||
|
|
<!-- 新增界面formid强制为subForm -->
|
|||
|
|
<form class="form-horizontal" id="subForm">
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<input type="hidden" id="id" name ="id" value="${maintenancePlan.id}" >
|
|||
|
|
<input name="active" id="active" type="hidden" value="${maintenancePlan.active}"/>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*部门名称</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<input name="bizId" id="bizId" type="hidden" value="${maintenancePlan.company.id}"/>
|
|||
|
|
<p class="form-control-static" >${maintenancePlan.company.name}</p>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*计划编号</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<input type="text" class="form-control" id="planNumber" name ="planNumber" placeholder="计划编号"
|
|||
|
|
value="${maintenancePlan.planNumber}" readonly>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*设备名称</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<input id="equipid" name="equipmentId" type="hidden" value="${maintenancePlan.equipmentId}" />
|
|||
|
|
<input class="form-control" id="equipname" autocomplete="off"
|
|||
|
|
value="${maintenancePlan.equipmentCard.equipmentname}" onclick="selectEquipmentCard()" readonly>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*工艺段</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<input id="processSectionId" name="processSectionId" type="hidden"
|
|||
|
|
value="${maintenancePlan.processSectionId}" />
|
|||
|
|
<input type="text" class="form-control" id="processectionname"
|
|||
|
|
placeholder="工艺段" value="${maintenancePlan.processSection.name}" disabled="disabled">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">保养类型</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select class="form-control select2" id="planType" name ="planType" style="width: 170px;">
|
|||
|
|
<option value="${MAINTAIN_MONTH}" selected="selected">月度保养</option>
|
|||
|
|
<option value="${MAINTAIN_YEAR}">年度保养</option>
|
|||
|
|
<option value="${MAINTAIN_HALFYEAR}">半年保养</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<!-- <div id="issueDate"> -->
|
|||
|
|
<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="initialDate" name="initialDate"
|
|||
|
|
style="width: 132px;" placeholder="请选择" value="${maintenancePlan.initialDate.substring(0,10)}"/>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- </div> -->
|
|||
|
|
</div>
|
|||
|
|
<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" value="${maintenancePlan.planMoney}" step="50.01" placeholder="计划费用" >
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">保养方式</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select class="form-control select2" id="maintenanceWay" name ="maintenanceWay" style="width: 170px;">
|
|||
|
|
<option value="${INTER_MAINTENANCE}" selected="selected">内部保养</option>
|
|||
|
|
<option value="${EXTERANL_MAINTENANCE}">外部保养</option>
|
|||
|
|
<option value="${COMMON_MAINTENANCE}">联合保养</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*保养内容</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<textarea class="form-control " id="content" name="content" rows="2" >${maintenancePlan.content}</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="${maintenancePlan.auditMan}">
|
|||
|
|
<input id="auditId" name="auditId" type="hidden" value="${maintenancePlan.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()" id="btn_save"><i class="fa fa-paperclip"></i>上传文件</button>
|
|||
|
|
</div>
|
|||
|
|
<div class="file-border" id="fileArea">
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
</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>
|