348 lines
15 KiB
Plaintext
348 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); %>
|
||
|
||
<%@page import="com.sipai.entity.maintenance.EquipmentPlanType" %>
|
||
<%request.setAttribute("Code_Type_Wx", EquipmentPlanType.Code_Type_Wx); %>
|
||
<%request.setAttribute("Code_Type_By", EquipmentPlanType.Code_Type_By); %>
|
||
<%request.setAttribute("Code_Type_Dx", EquipmentPlanType.Code_Type_Dx); %>
|
||
|
||
<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">
|
||
//流程审核文件上传所需参数
|
||
var masterId_process = '${id}';//业务Id
|
||
var tbName_process = 'TB_Process_UploadFile'; //数据表
|
||
var nameSpace_process = 'ProcessUploadFile';//保存文件夹
|
||
var status = 'delete';//有删除权限
|
||
|
||
function dosave() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('equipmentNumber', 'NOT_VALIDATED', null)
|
||
.validateField('equipmentNumber');
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('equipname', 'NOT_VALIDATED', null)
|
||
.validateField('equipname');
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('particularYear', 'NOT_VALIDATED', null)
|
||
.validateField('particularYear');
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/maintenance/equipmentPlanMainYear/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 + "/maintenance/equipmentPlanMainYear/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);
|
||
}*/
|
||
|
||
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
equipmentNumber: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '设备编号不能为空'
|
||
}
|
||
}
|
||
},
|
||
equipname: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '设备名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
particularYear: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '计划日期不能为空'
|
||
}
|
||
}
|
||
},
|
||
type: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '类型不能为空'
|
||
}
|
||
}
|
||
},
|
||
contents: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '计划内容不能为空'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
//厂区ID
|
||
var companyId = unitId;
|
||
|
||
$(function () {
|
||
//初始化文件显示
|
||
getFileList_process();
|
||
//下发日期选择
|
||
$('#particularYear').datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format: 'yyyy',
|
||
minViewMode: 2,
|
||
maxViewMode: 2
|
||
}).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");
|
||
|
||
$.post(ext.contextPath + "/maintenance/equipmentPlanType/getSelectList4Code.do", {code: '${param.planType}'}, function (data) {
|
||
$("#type").empty();
|
||
var selelct_ = $("#type").select2({
|
||
data: data,
|
||
cache: false,
|
||
placeholder: '请选择',//默认文字提示
|
||
allowClear: true,//允许清空
|
||
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(data[0].id).trigger("change");
|
||
selelct_.on("change", function (e) {
|
||
// dosearchTab();
|
||
});
|
||
}, 'json');
|
||
|
||
});
|
||
|
||
//选择保养的设备,根据厂区id选择厂内设备
|
||
var selectEquipmentCard = function () {
|
||
/*$.post(ext.contextPath + '/equipment/showEquipmentCardForSelect2.do', {
|
||
companyId: unitId,
|
||
equipmentId: $("#equipid").val()
|
||
},
|
||
function (data) {
|
||
$("#emSubDiv").html(data);
|
||
openModal('emSubModal');
|
||
});*/
|
||
$.post(ext.contextPath + '/equipment/selectEquipmentCard4Choice.do', {
|
||
unitId: unitId,
|
||
equPlanId: '${id}',
|
||
choiceType: 'main'//通过保养模块过来的,需要筛选近期需要保养的功能
|
||
}, function (data) {
|
||
$("#emSubDiv").html(data);
|
||
openModal("equipment4SelectModal");
|
||
});
|
||
};
|
||
|
||
//保存选择设备 datas为id
|
||
var doFinishSelectEquipment = function (datas_id, datas_name, datas_cardId) {
|
||
var array = datas_id.split(',');
|
||
if(array.length>1){
|
||
alert('只能选择一台设备');
|
||
}else{
|
||
$('#equipmentId').val(datas_id);
|
||
$('#equipname').val(datas_name);
|
||
$('#equipmentNumber').val(datas_cardId);
|
||
closeModal("equipment4SelectModal");
|
||
}
|
||
}
|
||
|
||
//选择审核人
|
||
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");
|
||
});
|
||
};
|
||
|
||
//弹出人员列表
|
||
var showUser4Handle = function () {
|
||
var userIds = $("#receiveUserId").val();
|
||
var jobIds = $("#targetjobs").val();
|
||
$.post(ext.contextPath + '/user/userForSelectByCompany.do', {
|
||
formId: "subForm",
|
||
hiddenId: "receiveUserId",
|
||
textId: "targetUsersName",
|
||
userIds: userIds,
|
||
jobIds: jobIds
|
||
}, 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}"/>
|
||
<input name="unitId" id="unitId" type="hidden" value="${unitId}"/>
|
||
<input name="planType" id="planType" type="hidden" value="${param.planType}"/>
|
||
|
||
<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=""/>
|
||
<input class="form-control" id="equipname" name="equipname" autocomplete="off"
|
||
onclick="selectEquipmentCard()" placeholder="请点击选择" cursor="pointer" readonly>
|
||
</div>
|
||
<label class="col-sm-2 control-label">*设备编号</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="equipmentNumber" name="equipmentNumber"
|
||
cursor="pointer" readonly>
|
||
</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" placeholder="计划费用"
|
||
min="0" value=0.00 step="50.01">
|
||
</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="particularYear" name="particularYear"
|
||
style="width: 132px;" placeholder="请选择"/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<%-- <c:if test="${param.planType == Code_Type_By}">--%>
|
||
<label class="col-sm-2 control-label">*类型</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2" id="type" name="type" style="width: 170px;">
|
||
</select>
|
||
</div>
|
||
<%-- </c:if>--%>
|
||
|
||
<label class="col-sm-2 control-label">实施人员</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="targetUsersName" name="targetUsersName"
|
||
placeholder="请选择实施人员" onclick="showUser4Handle();" autocomplete="off">
|
||
<input id="receiveUserId" name="receiveUserId" type="hidden"/>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*计划内容</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control " id="contents" name="contents" rows="2"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">备注</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control " id="remark" name="remark" rows="2"></textarea>
|
||
</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="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>
|