392 lines
17 KiB
Plaintext
392 lines
17 KiB
Plaintext
<%@ taglib prefix="c" uri="/jodd" %>
|
||
<%@ page language="java" pageEncoding="UTF-8" %>
|
||
|
||
<%@page import="com.sipai.tools.CommString" %>
|
||
<%request.setAttribute("Active_False", CommString.Active_False); %>
|
||
<%request.setAttribute("Active_True", CommString.Active_True); %>
|
||
|
||
<%@ page import="com.sipai.entity.maintenance.EquipmentPlan" %>
|
||
<%request.setAttribute("Status_NoStart", EquipmentPlan.Status_NoStart); %>
|
||
<%request.setAttribute("Status_Start", EquipmentPlan.Status_Start); %>
|
||
<%request.setAttribute("Status_Finish", EquipmentPlan.Status_Finish); %>
|
||
|
||
<%@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">
|
||
|
||
</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() {
|
||
//保存前先赋值班组
|
||
var val = $('#_groupDetailId').val();
|
||
var rolestr = "";
|
||
if (val != null && val != '') {
|
||
$.each(val, function (index, value, array) {
|
||
if (rolestr != "") {
|
||
rolestr += ","
|
||
}
|
||
rolestr += value;
|
||
})
|
||
$('#groupDetailId').val(rolestr);//赋值班组
|
||
}
|
||
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {
|
||
//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/maintenance/equipmentPlan/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');
|
||
}
|
||
}
|
||
|
||
//保养计划提交审核
|
||
function dosubmit() {
|
||
$("#status").val('${SUBMIT}');
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('auditMan', 'NOT_VALIDATED', null)
|
||
.validateField('auditMan');
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
//setTimeout(function(){
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/maintenance/equipmentPlan/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: '计划编号不能为空'
|
||
}
|
||
}
|
||
},
|
||
cycle: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '周期不能为空'
|
||
}
|
||
}
|
||
},
|
||
planDate: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '计划日期不能为空'
|
||
}
|
||
}
|
||
},
|
||
planTypeName: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '请选择计划类型'
|
||
}
|
||
}
|
||
},
|
||
unitId: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '厂区不能为空'
|
||
}
|
||
}
|
||
},
|
||
planContents: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '保养内容不能为空'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
$(function () {
|
||
//初始化班组
|
||
refreshSelect('');
|
||
//初始化文件显示
|
||
getFileList_process();
|
||
//下发日期选择
|
||
$('#planDate').datepicker({
|
||
format: 'yyyy-mm',
|
||
language: "zh-CN",
|
||
autoclose: true,
|
||
startView: 1,
|
||
minViewMode: 1,
|
||
}).on('hide', function (e) {
|
||
//当日期选择框关闭时,执行刷新校验
|
||
$('#subForm').data('bootstrapValidator')
|
||
.updateStatus('planDate', 'NOT_VALIDATED', null)
|
||
.validateField('planDate');
|
||
});
|
||
|
||
var selectType = $("#planTypeBigName").select2({
|
||
minimumResultsForSearch: 10
|
||
})
|
||
var selectType = $("#planTypeSmallName").select2({
|
||
minimumResultsForSearch: 10
|
||
})
|
||
|
||
$.post(ext.contextPath + "/maintenance/equipmentPlanType/getSelectList4Code.do", {code: 'by'}, function (data) {
|
||
$("#planTypeSmallName").empty();
|
||
var selelct_ = $("#planTypeSmallName").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(data[0].id).trigger("change");
|
||
$('#planTypeSmall').val(data[0].id);
|
||
|
||
selelct_.on('change', function (e) {
|
||
$('#planTypeSmall').val(e.target.value);
|
||
})
|
||
}, 'json');
|
||
});
|
||
|
||
//选择审核人
|
||
var showUser4AuditSelectsFun = function () {
|
||
var userIds = $("#auditId").val();
|
||
// $.post(ext.contextPath + '/user/userForSelect.do', {
|
||
$.post(ext.contextPath + '/user/userForSelectByCompany.do', {
|
||
formId: "subForm",
|
||
hiddenId: "auditId",
|
||
textId: "auditMan",
|
||
userIds: userIds,
|
||
jobIds: '${jobIds}'
|
||
}, function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
|
||
//初始化 任务班组
|
||
function refreshSelect(groupTypeId) {
|
||
$.post(ext.contextPath + "/work/groupDetail/getlistForSelect2.do", {
|
||
unitId: unitId,
|
||
grouptype: groupTypeId
|
||
}, function (data) {
|
||
//先清空下拉选项 避免数据叠加
|
||
$("#_groupDetailId").empty();
|
||
//加载下拉选项
|
||
var selelct = $("#_groupDetailId").select2({
|
||
data: data,
|
||
placeholder: '请选择',//默认文字提示
|
||
allowClear: false,//允许清空
|
||
escapeMarkup: function (markup) {
|
||
return markup;
|
||
}, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||
multiple: true,
|
||
formatResult: function formatRepo(repo) {
|
||
return repo.text;
|
||
}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo) {
|
||
return repo.text;
|
||
} // 函数用于呈现当前的选择
|
||
});
|
||
/*var roleitems = new Array();
|
||
var roles = JSON.parse(decodeURIComponent(''));
|
||
for (var i = 0; i < roles.length; i++) {
|
||
roleitems.push(roles[i].id);
|
||
}
|
||
selelct.val(roleitems).trigger("change");*/
|
||
}, 'json');
|
||
};
|
||
|
||
//初始化 班组类型
|
||
var selectType = $("#sheetName").select2({minimumResultsForSearch: 10});
|
||
$.post(ext.contextPath + "/work/groupType/getGroupTypeTree.do", {unitId: unitId}, function (data) {
|
||
$("#groupTypeName").empty();
|
||
var selelct_ = $("#groupTypeName").select2({
|
||
data: data,
|
||
placeholder: '请选择',//默认文字提示
|
||
allowClear: false,//允许清空
|
||
escapeMarkup: function (markup) {
|
||
return markup;
|
||
}, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 5,//数据超过5个启用搜索框
|
||
formatResult: function formatRepo(repo) {
|
||
return repo.text;
|
||
}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo) {
|
||
return repo.text;
|
||
} // 函数用于呈现当前的选择
|
||
});
|
||
selelct_.val('${equipmentPlan.groupTypeId}').trigger("change");
|
||
selelct_.on('change', function (e) {
|
||
$('#groupTypeId').val(e.target.value);
|
||
|
||
|
||
$('#groupDetailId').val('');
|
||
$('#_groupDetailId').val('');
|
||
refreshSelect(e.target.value);
|
||
})
|
||
}, 'json');
|
||
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog modal-lg">
|
||
<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">
|
||
<input type="hidden" name="planTypeBig" id="planTypeBig" value="${param.type}"/>
|
||
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<input name="status" id="status" type="hidden" value="${Status_NoStart}"/>
|
||
<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-4">
|
||
<input name="unitId" id="unitId" type="hidden" value="${company.id}"/>
|
||
<p class="form-control-static">${company.sname}</p>
|
||
</div>
|
||
<label class="col-sm-2 control-label">计划编号</label>
|
||
<div class="col-sm-4">
|
||
<input name="planNumber" id="planNumber" type="hidden" value="${detailNumber}"/>
|
||
<p class="form-control-static">${detailNumber}</p>
|
||
</div>
|
||
</div>
|
||
|
||
<c:if test="${param.type == Code_Type_By}">
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*类别</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2" id="planTypeSmallName" name="planTypeSmallName"
|
||
style="width: 100%;"></select>
|
||
<input type="hidden" class="form-control" id="planTypeSmall" name="planTypeSmall"
|
||
value=""/>
|
||
</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="groupTypeName" name="groupTypeName"
|
||
style="width: 100%;">
|
||
</select>
|
||
<input type="hidden" name="groupTypeId" id="groupTypeId">
|
||
</div>
|
||
<label class="col-sm-2 control-label">任务班组</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2" id="_groupDetailId" name="_groupDetailId" style="width: 100%;">
|
||
</select>
|
||
<input type="hidden" name="groupDetailId" id="groupDetailId" value="">
|
||
</div>
|
||
</div>
|
||
</c:if>
|
||
|
||
<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" autocomplete="off">
|
||
</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="planDate" name="planDate"
|
||
style="width: 230px;" placeholder="请选择" autocomplete="off"/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*计划内容</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control " id="planContents" name="planContents" 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="" autocomplete="off">
|
||
<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()"
|
||
><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>
|