279 lines
13 KiB
Plaintext
279 lines
13 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("OVERHAUL",MaintenanceCommString.MAINTENANCE_TYPE_OVERHAUL); %>
|
||
<%request.setAttribute("INTER_MAINTENANCE",MaintenanceCommString.INTER_MAINTENANCE); %>
|
||
<%request.setAttribute("EXTERANL_MAINTENANCE",MaintenanceCommString.EXTERANL_MAINTENANCE); %>
|
||
<%request.setAttribute("COMMON_MAINTENANCE",MaintenanceCommString.COMMON_MAINTENANCE); %>
|
||
<style type="text/css">
|
||
.select2-container .select2-selection--single{
|
||
height:34px;
|
||
line-height: 34px;
|
||
}
|
||
.select2-selection__arrow{
|
||
margin-top:3px;
|
||
}
|
||
</style>
|
||
<script type="text/javascript">
|
||
|
||
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);
|
||
}
|
||
|
||
$("#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: '设备名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
planDate: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '计划日期不能为空'
|
||
}
|
||
}
|
||
},
|
||
planConsumeTime: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '计划耗时不能为空'
|
||
}
|
||
}
|
||
},
|
||
content: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '检修内容不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
var companyId = "${maintenancePlan.bizId}";
|
||
$(function() {
|
||
//选择厂区
|
||
$.post(ext.contextPath + "/user/getSearchBizsByUserId4Select.do", {}, function(data) {
|
||
//选择厂区为一个厂时隐藏选择框
|
||
if(data.length == 1){
|
||
$("#bizId").css("display", "none");
|
||
$("#input_bizId").val(data[0].text);
|
||
$("#hidden_bizId").val(data[0].id);
|
||
companyId = data[0].id;
|
||
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
|
||
$("#processsectionid").empty();
|
||
var selelct_ =$("#processsectionid").select2({
|
||
data: data,
|
||
cache : false,
|
||
placeholder:'请选择',//默认文字提示
|
||
allowClear: false,//允许清空
|
||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
|
||
});
|
||
if(data!=null && data.length>0){
|
||
selelct_.val(data[0].id).trigger("change");
|
||
}
|
||
},'json');
|
||
}else{
|
||
$("#hidden_bizId").attr("disabled","disabled");
|
||
$("#input_bizId").css("display", "none");
|
||
var selelct =$("#bizId").select2({
|
||
data: data,
|
||
placeholder:'请选择',//默认文字提示
|
||
allowClear: false,//允许清空
|
||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
|
||
});
|
||
|
||
selelct.on("change",function(e){
|
||
companyId = $(this).val();
|
||
//重新选择厂区后清空设备和工艺段数据
|
||
if(companyId != "${maintenancePlan.bizId}"){
|
||
$("#equipname").val("");
|
||
$("#equipid").val("");
|
||
$("#processSectionId").val("");
|
||
$("#processectionname").val("");
|
||
}
|
||
});
|
||
selelct.val('${maintenancePlan.bizId}').trigger("change");
|
||
}
|
||
},'json');
|
||
$("#active").select2({minimumResultsForSearch: 10}).val("${maintenancePlan.active}").trigger("change");
|
||
$("#maintenanceWay").select2({minimumResultsForSearch: 10}).val("${maintenancePlan.maintenanceWay}").trigger("change");
|
||
//选择时间
|
||
$('#planDate').datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format:'yyyy-mm-dd',
|
||
}).on('hide',function(e) {
|
||
//当日期选择框关闭时,执行刷新校验
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('planDate', 'NOT_VALIDATED',null)
|
||
.validateField('planDate');
|
||
});
|
||
});
|
||
//选择设备,根据厂区id选择厂内设备
|
||
var selectEquipmentCard = function() {
|
||
$.post(ext.contextPath + '/equipment/showEquipmentCardForSelect.do', {companyId:companyId, equipmentId:$("#equipid").val()} , function(data) {
|
||
$("#emSubDiv").html(data);
|
||
openModal('emSubModal');
|
||
});
|
||
};
|
||
</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="planType" name ="planType" value="${OVERHAUL}" >
|
||
<input type="hidden" id="id" name ="id" value="${maintenancePlan.id}" >
|
||
<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}" >
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*部门名称</label>
|
||
<div class="col-sm-6">
|
||
<select class="form-control select2" id="bizId" name ="bizId" style="width: 270px;">
|
||
</select>
|
||
<input class="form-control" id="input_bizId" style="border: none;background: transparent;">
|
||
<input type="hidden" id="hidden_bizId" name ="bizId">
|
||
</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" style="width: 270px;" value="${equipmentName}" onclick="selectEquipmentCard()">
|
||
</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="${processectionname}" disabled="disabled">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*计划日期</label>
|
||
<div class="col-sm-10">
|
||
<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: 230px;" placeholder="请选择" value="${maintenancePlan.planDate.substring(0,10)}"/>
|
||
</div>
|
||
</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="planConsumeTime" name ="planConsumeTime" placeholder="计划耗时" value="${maintenancePlan.planConsumeTime}" >
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">检修方式</label>
|
||
<div class="col-sm-6">
|
||
<select class="form-control select2" id="maintenanceWay" name ="maintenanceWay" style="width: 270px;">
|
||
<option value="${INTER_MAINTENANCE}">内部检修</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-6">
|
||
<input type="text" class="form-control" id="planMoney" name ="planMoney" placeholder="计划费用" value="${maintenancePlan.planMoney}">
|
||
</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-6">
|
||
<select class="form-control select2" id="active" name ="active" style="width: 270px;">
|
||
<option value= "${Active_True}" selected = "selected">启用</option>
|
||
<option value= "${Active_False}">禁用</option>
|
||
</select>
|
||
</div>
|
||
</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>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|