Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/workorder/overhaulAdd.jsp

424 lines
18 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); %>
<% request.setAttribute("PlanType_IN", Overhaul.PlanType_IN);%>
<% request.setAttribute("PlanType_OUT", Overhaul.PlanType_OUT);%>
<% request.setAttribute("Maintain_IN", MaintainCommStr.Maintain_IN);%>
<% request.setAttribute("Maintain_OUT", MaintainCommStr.Maintain_OUT);%>
<%@ 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">
var masterId = '${id}';
var tbName = 'tb_maintenance_problem_fille'; //数据表
var nameSpace = 'MaintenanceProblem';//保存文件夹
var previews = new Array();
var previewConfigs = new Array();
/* var student = {
"caption":"lilei",
}
previewConfigs[0]=student; */
//初始化fileinput控件第一次初始化
function showFileInput(ctrlName) {
var control = $('#' + ctrlName);
control.fileinput('destroy');
control.fileinput({
language: 'zh', //设置语言
showUpload: false, //是否显示上传按钮
showRemove: false,
showCaption: false,//是否显示标题
showBrowse: false,//选择按钮
showClose: false,//右上角关闭按钮
dropZoneEnabled: false,//是否显示拖拽区域
fileActionSettings: {
showDrag: false
},
browseClass: "btn btn-primary", //按钮样式
maxFileCount: 10, //表示允许同时上传的最大文件个数
enctype: 'multipart/form-data',
validateInitialCount: true,
previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
initialPreviewAsData: true,
initialPreview: previews,
initialPreviewConfig: previewConfigs,
layoutTemplates: {
actionUpload: ''
},
deleteUrl: ext.contextPath + "/base/deleteInputFile.do",
deleteExtraData: function () { //传参
var data = {
"tbName": tbName
};
return data;
}
});
$('#kvFileinputModal').on("hidden.bs.modal", function () {
$(this).removeData("bs.modal");
//modal重复打开会导致前面的滚动条失去作用
$('.modal').css("overflow", "auto");
});
}
//名称定义不可修改
var getFileList = function () {
$.post(ext.contextPath + '/base/getInputFileList.do', {masterId: masterId, tbName: tbName}, function (data) {
//console.info(data)
if (data.length > 0) {
previews = new Array();
$('#maintenancefile').show();
for (var i = 0; i < data.length; i++) {
var previewConfig = new Object();
var path = data[i].abspath;
path = path.substring(path.indexOf('webapps') + 7, path.length);
path = ext.basePath.replace(ext.contextPath, '') + path.replace(/\\/g, "\/");
;
previews.push(path);
previewConfig['width'] = '50px';
previewConfig['caption'] = data[i].filename;
previewConfig['key'] = data[i].id;
previewConfigs.push(previewConfig);
}
showFileInput("maintenanceDetailFile");
} else {
$('#maintenanceDetailFile').hide();
}
}, 'json');
};
var fileinput = function () {
//var url='/maintenance/updateProblemFile.do';//保存数据表方法
$.post(ext.contextPath + '/base/fileinput.do', {
masterId: masterId,
tbName: tbName,
nameSpace: nameSpace
}, function (data) {
$("#fileInputDiv").html(data);
openModal('fileInputModal');
});
};
var showUser4SelectsFun = function () {
var userIds = $("#solver").val();
$.post(ext.contextPath + '/user/userForSelect.do', {
formId: "subForm",
hiddenId: "solver",
textId: "solvername",
userIds: userIds
}, function (data) {
$("#user4SelectDiv").html(data);
openModal("user4SelectModal");
});
};
/* function dolaunch() {
$('#status').val('${Status_Launch}')
dosave();
} */
function dosave() {
$('#subForm').data('bootstrapValidator')
.updateStatus('equipname', 'NOT_VALIDATED', null)
.validateField('equipname');
$("#subForm").bootstrapValidator('validate');//提交验证
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/workorder/overhaul/dosave.do", $("#subForm").serialize(), function (data) {
if (data.res == 1) {
showAlert('s', '保存成功');
closeModal('subModal')
$("#table").bootstrapTable('refresh');
} else if (data.res == 0) {
showAlert('d', '保存失败');
} else {
showAlert('d', data.res);
}
}, 'json');
}
}
$("#subForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
projectName: {
validators: {
notEmpty: {
message: '项目名称不能为空'
}
}
},
planDate: {
validators: {
notEmpty: {
message: '计划日期不能为空'
}
}
},
equipname: {
validators: {
notEmpty: {
message: '设备不能为空'
}
}
},
cycleQuota: {
validators: {
notEmpty: {
message: '大修周期定额不能为空'
}
}
},
budgetCost: {
validators: {
notEmpty: {
message: '预算金额不能为空'
}
}
},
projectTypeName: {
validators: {
notEmpty: {
message: '大修类型不能为空'
}
}
}
}
});
//流程审核文件上传所需参数
var masterId_process = '${id}';//业务Id
var tbName_process = 'TB_Process_UploadFile'; //数据表
var nameSpace_process = 'ProcessUploadFile';//保存文件夹
var status = 'delete';//有删除权限
$(function () {
$('#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');
});
$('#planDate').datepicker('setDate', '${nowDate.substring(0, 10)}');
getFileList();
//getFileList_process();
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');
//是否委外
$("#outsourcingType").select2({minimumResultsForSearch: 10});
$("#budgetType").select2({minimumResultsForSearch: 10});
})
//选择设备根据厂区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");
});
};
</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">&times;</span></button>
<h4 class="modal-title">新增大修计划</h4>
</div>
<div class="modal-body">
<!-- 新增界面formid强制为subForm -->
<form class="form-horizontal" id="subForm" enctype="multipart/form-data">
<!-- 界面提醒div强制id为alertDiv -->
<div id="alertDiv"></div>
<input type="hidden" class="form-control" name="id" value="${id}">
<input type="hidden" class="form-control" id="jobNumber" name="jobNumber" value="${jobNumber}"
readonly>
<p style="display: none" class="form-control-static">${jobNumber}</p>
<!-- <input type="hidden" id="unitId" name ="unitId" value="${param.unitId}" > -->
<div class="form-group">
<label class="col-sm-2 control-label">*项目名称</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="projectName" name="projectName"
value="${overhaul.projectName}" autocomplete="off" placeholder="项目名称">
<%-- <input type="hidden" class="form-control" id="jobNumber" name="jobNumber"--%>
<%-- value="${jobNumber}" readonly>--%>
</div>
<label class="col-sm-2 control-label">项目负责人</label>
<div class="col-sm-4">
<input type="hidden" class="form-control" id="sendUserId" name="sendUserId"
value="${userId}">
<p class="form-control-static">${userName}</p>
</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="projectTypeName" name="projectTypeName"
style="width: 270px;"></select>
<input type="hidden" class="form-control" id="projectType" name="projectType" value=""/>
</div>
<label class="col-sm-2 control-label">厂区</label>
<div class="col-sm-4">
<input type="hidden" id="unitId" name="unitId" value="${param.unitId}"/>
<p class="form-control-static">${companyName}</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">预算类型</label>
<div class="col-sm-4">
<select id="budgetType" name="budgetType" class="form-control select2"
style="width: 270px;">
<option value="${PlanType_IN}" selected>预算内</option>
<option value="${PlanType_OUT}">预算外</option>
</select>
<%-- <input type="hidden" class="form-control" id="budgetType" name="budgetType"--%>
<%-- value="${PlanType_OUT}">--%>
<%-- <p class="form-control-static">预算外</p>--%>
</div>
<label class="col-sm-2 control-label">*预算金额(元)</label>
<div class="col-sm-4">
<input type="number" class="form-control" id="budgetCost" name="budgetCost"
value="${overhaul.budgetCost}" autocomplete="off" placeholder="预算金额">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">*是否委外</label>
<div class="col-sm-4">
<select id="outsourcingType" name="outsourcingType" class="form-control select2"
style="width: 270px;">
<option value="${Maintain_IN}" selected>自修</option>
<option value="${Maintain_OUT}">委外</option>
</select>
</div>
<label class="col-sm-2 control-label">*大修周期定额(元)</label>
<div class="col-sm-4">
<input type="number" class="form-control" id="cycleQuota" name="cycleQuota"
value="${overhaul.budgetCost}" 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="planDate" name="planDate"
style="width: 232px;" autocomplete="off" placeholder="点击选择">
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">项目描述</label>
<div class="col-sm-10">
<input class="form-control" style="width: 100%" id="projectDescribe"
name="projectDescribe" value=""/>
</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="solvername" name ="solvername" placeholder="请选择接收人员" onclick="showUser4SelectsFun();">
<input id="solver" name="solver" type="hidden" />
</div>
</div> -->
<!-- <div class="form-group" style="margin:8px">
<button type="button" class="btn btn-default btn-file" onclick="fileinput()" id="btn_save"><i class="fa fa-paperclip"></i>上传图片</button>
</div>
<div class="form-group" style="margin:8px;">
<input type="file" name="maintenanceDetailFile" id="maintenanceDetailFile" multiple class="file-loading" />
</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 class="file-border" id="fileArea">
</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>