Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/workorder/overhaulItemEquipment.jsp

269 lines
11 KiB
Plaintext
Raw Normal View History

2026-01-16 14:13:44 +08:00
<%@ page language="java" pageEncoding="UTF-8" %>
<%@page import="com.sipai.entity.maintenance.EquipmentPlanType" %>
<%@page import="com.sipai.entity.workorder.Overhaul" %>
<%@page import="com.sipai.entity.maintenance.MaintainCommStr" %>
<%request.setAttribute("Code_Type_Dx", EquipmentPlanType.Code_Type_Dx); %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<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 dosave() {
$("#subForm3").bootstrapValidator('validate');//提交验证
if ($("#subForm3").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
if ('${overhaulItemEquipment.id}') {
$.post(ext.contextPath + "/workorder/overhaulItemEquipment/doupdate.do", $("#subForm3").serialize(), function (data) {
if (data.res == 1) {
showAlert('s', '保存成功');
closeModal('subModaloverhaulItemProject')
$("#table_overhaul_item_device").bootstrapTable('refresh');
} else if (data.res == 0) {
showAlert('d', '保存失败');
} else {
showAlert('d', data.res);
}
}, 'json');
} else {
$.post(ext.contextPath + "/workorder/overhaulItemEquipment/dosave.do", $("#subForm3").serialize(), function (data) {
if (data.res == 1) {
showAlert('s', '保存成功');
closeModal('subModaloverhaulItemProject')
$("#table_overhaul_item_device").bootstrapTable('refresh');
} else if (data.res == 0) {
showAlert('d', '保存失败');
} else {
showAlert('d', data.res);
}
}, 'json');
}
}
}
$("#subForm3").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
equipmentId: {
validators: {
notEmpty: {
message: '设备编号不能为空'
}
}
},
quotaHour: {
validators: {
notEmpty: {
message: '定额工时不能为空'
}
}
},
quotaFee: {
validators: {
notEmpty: {
message: '定额费用不能为空'
}
}
},
planStartDate: {
validators: {
notEmpty: {
message: '计划开始时间不能为空'
}
}
},
planEndDate: {
validators: {
notEmpty: {
message: '计划完成时间不能为空'
}
}
}
}
});
$(function () {
if('${edit}'=='0'){
$('#equipmentId').attr('readonly', 'readonly');
$('#equipname').attr('readonly', 'readonly');
$('#equipname').css('pointer-events', 'none');
$('#quotaHour').attr('readonly', 'readonly');
$('#quotaFee').attr('readonly', 'readonly');
$('#planStartDate').attr('readonly', 'readonly');
$('#planStartDate').css('pointer-events', 'none');
$('#planEndDate').attr('readonly', 'readonly');
$('#planEndDate').css('pointer-events', 'none');
// $('#fileupbt').css('display','none');
}
initDatepicker('planStartDate')
initDatepicker('planEndDate')
if ('${overhaulItemEquipment.equipmentId}') {
$('#planStartDate').datepicker('setDate', '${overhaulItemEquipment.planStartDate.substring(0, 10)}');
$('#planEndDate').datepicker('setDate', '${overhaulItemEquipment.planEndDate.substring(0, 10)}');
}
var selectType = $("#projectTypeName").select2({minimumResultsForSearch: 10});
$.post(ext.contextPath + "/maintenance/equipmentPlanType/getSelectList4Code.do", {code: '${Code_Type_Dx}'}, function (data) {
$("#projectTypeName").empty();
var selelct_ = $("#projectTypeName").select2({
data: data,
placeholder: '请选择',//默认文字提示
allowClear: false,//允许清空
escapeMarkup: function (markup) {
return markup;
}, // 自定义格式化防止xss注入
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过10个启用搜索框
formatResult: function formatRepo(repo) {
return repo.text;
}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo) {
return repo.text;
} // 函数用于呈现当前的选择
});
selelct_.val('').trigger("change");
selelct_.on('change', function (e) {
$('#projectType').val(e.target.value);
})
}, 'json');
})
//选择设备根据厂区id和工艺段id选择厂内设备可多选
var showEquipment4SelectsFun = function (formId, hiddenId, textId) {
var equipmentIds = $('#' + hiddenId).val();
var companyId = $('#unitId').val();
if (null == companyId || '' == companyId) {
showAlert('d', "请先选择厂区!");
return;
}
$.post(ext.contextPath + '/equipment/showEquipmentCardForAbnormitySelects.do', {
formId: formId,
hiddenId: hiddenId,
textId: textId,
companyId: companyId,
equipmentIds: equipmentIds
}, function (data) {
$("#equ4SelectDiv").html(data);
openModal("equipment4SelectModal");
});
};
//初始化时间选择器
function initDatepicker(idName) {
$('#' + idName).datepicker({
language: 'zh-CN',
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
}).on('hide', function (e) {
// $('#subForm2').data('bootstrapValidator')
// .updateStatus(idName, 'NOT_VALIDATED', null)
// .validateField(idName);
});
$('#' + idName).datepicker('setDate', '${nowDate.substring(0, 10)}');
}
</script>
<div class="modal fade" id="subModaloverhaulItemProject">
<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">&times;</span></button>
<h4 class="modal-title">新增设备</h4>
</div>
<div class="modal-body">
<!-- 新增界面formid强制为subForm -->
<form class="form-horizontal" id="subForm3" enctype="multipart/form-data">
<!-- 界面提醒div强制id为alertDiv -->
<div id="alertDiv"></div>
<input type="hidden" class="form-control" name="id" value="${overhaulItemEquipment.id}">
<input type="hidden" class="form-control" name="pid" value="${pid}">
<div class="form-group">
<label class="col-sm-2 control-label">*设备名称</label>
<div class="col-sm-4">
<input id="equipmentId" name="equipmentId" type="hidden"
value="${overhaulItemEquipment.equipmentId}"/>
<input class="form-control" id="equipname" name="equipname"
onclick="showEquipment4SelectsFun('subForm3','equipmentId','equipname');"
placeholder="点击选择" value="${equipmentName}" autocomplete="off">
</div>
<label class="col-sm-2 control-label">*额定工时</label>
<div class="col-sm-4">
<input type="number" class="form-control" id="quotaHour" name="quotaHour"
value="${overhaulItemEquipment.quotaHour}" autocomplete="off" placeholder="额定工时">
</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="quotaFee" name="quotaFee"
value="${overhaulItemEquipment.quotaFee}" autocomplete="off" placeholder="定额费用">
</div>
</div>
<div class="form-group">
<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="planStartDate" name="planStartDate"
style="width: 132px;" autocomplete="off" placeholder="点击选择">
</div>
</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="planEndDate" name="planEndDate"
style="width: 132px;" autocomplete="off" placeholder="点击选择">
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" onclick="dosave()">保存</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>