355 lines
16 KiB
Plaintext
355 lines
16 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%@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 = '${id}';//业务Id
|
||
var tbName_process = 'TB_Process_UploadFile'; //数据表
|
||
var nameSpace_process ='ProcessUploadFile';//保存文件夹
|
||
var status = 'delete';//有删除权限
|
||
|
||
function dosave() {
|
||
$('#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/dosave.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()
|
||
};
|
||
}
|
||
}, */
|
||
}
|
||
},
|
||
bizId: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '厂区不能为空'
|
||
}
|
||
}
|
||
},
|
||
initialDate: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '初始日期不能为空'
|
||
}
|
||
}
|
||
},
|
||
equipname: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '设备名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
content: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '保养内容不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
|
||
//厂区ID
|
||
var companyId = "${company.id}";
|
||
|
||
$(function() {
|
||
//初始化文件显示
|
||
getFileList_process();
|
||
//下发日期选择
|
||
$('#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');
|
||
});
|
||
|
||
//$("#active").select2({minimumResultsForSearch: 10}).val('${Active_True}').trigger("change");
|
||
|
||
//保养方式
|
||
$("#maintenanceWay").select2({
|
||
minimumResultsForSearch: 10
|
||
}).val('${INTER_MAINTENANCE}').trigger("change");
|
||
|
||
//初始化下发日期隐藏
|
||
/* $("#issueDate").hide();
|
||
$("#initialDate").attr("disabled",true); */
|
||
//选择保养类型
|
||
var selectType = $("#planType").select2({
|
||
minimumResultsForSearch: 10
|
||
})
|
||
selectType.val('${MAINTAIN_MONTH}').trigger("change");
|
||
//根据保养类型显示下发日期,月计划隐藏,年计划显示
|
||
/* selectType.on("change",function(e){
|
||
var planType = $(this).val();
|
||
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;
|
||
}
|
||
}); */
|
||
});
|
||
|
||
//选择保养的设备,根据厂区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 name="active" id="active" type="hidden" value="${START}"/>
|
||
<input name="id" id="id" type="hidden" value="${id}"/>
|
||
<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="${company.id}"/>
|
||
<p class="form-control-static" >${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="${detailNumber}" 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="" />
|
||
<input class="form-control" id="equipname" name ="equipname" autocomplete="off"
|
||
onclick="selectEquipmentCard()" placeholder="请点击选择" cursor= "pointer" readonly>
|
||
</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="equipmentNumber" name ="equipmentNumber" placeholder="设备编号" 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="" />
|
||
<input type="text" class="form-control" id="processectionname" placeholder="工艺段" 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="请选择"/>
|
||
</div>
|
||
</div> -->
|
||
<!-- </div> -->
|
||
</div>
|
||
<div class="form-group">
|
||
|
||
<!-- <label class="col-sm-2 control-label">*间隔周期(天)</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="intervalPeriod" name ="intervalPeriod" placeholder="间隔周期" >
|
||
</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="planConsumeTime" name ="planConsumeTime" placeholder="计划耗时" >
|
||
</div>
|
||
</div> -->
|
||
<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" value=0.00 step="50.01" >
|
||
</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" ></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="">
|
||
<input id="auditId" name="auditId" type="hidden" value="" />
|
||
</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 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="dosave()" id="btn_save">保存</button>
|
||
<button type="button" class="btn btn-primary" onclick="submitFun()" id="btn_submit">提交审核</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|