299 lines
13 KiB
Plaintext
299 lines
13 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<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='${abnormity.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');
|
||
});
|
||
};
|
||
function doupdate() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/maintenance/abnormity/doupdate.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: {
|
||
bizId: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '厂区不能为空'
|
||
}
|
||
}
|
||
},
|
||
processSectionId: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '工艺段不能为空'
|
||
}
|
||
}
|
||
},
|
||
/* type: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '异常类型不能为空'
|
||
}
|
||
}
|
||
}, */
|
||
abnormityDescription: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '异常描述不能为空'
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
//初始化工艺段
|
||
var refreshSelect = function(companyId) {
|
||
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
|
||
$("#pSectionId").empty();
|
||
var selelct_ =$("#pSectionId").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_.val('${abnormity.processSectionId}').trigger("change");
|
||
},'json');
|
||
};
|
||
var companyId = "${abnormity.bizId}";
|
||
$(function(){
|
||
getFileList();
|
||
|
||
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:companyId}, function(data) {
|
||
$("#pSectionId").empty();
|
||
var selelct_ =$("#pSectionId").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('${abnormity.processSectionId}').trigger("change");
|
||
}
|
||
selelct_.on('change',function(){
|
||
//工艺段选择后,清空原有工艺段选择的设备
|
||
$("#equipmentIds").val("");
|
||
$("#equipname").val("");
|
||
})
|
||
},'json');
|
||
|
||
})
|
||
//选择设备,根据厂区id和工艺段id选择厂内设备,可多选
|
||
var showEquipment4SelectsFun = function(formId,hiddenId,textId) {
|
||
var equipmentIds=$('#'+hiddenId).val();
|
||
var pSectionId = $("#pSectionId").val();
|
||
console.info(companyId)
|
||
console.info(pSectionId)
|
||
if(companyId == "" || pSectionId == "" || companyId == null || pSectionId == null){
|
||
showAlert('d','请先选择厂区和工艺段');
|
||
}else{
|
||
$.post(ext.contextPath + '/equipment/showEquipmentCardForAbnormitySelects.do', {formId:formId,hiddenId:hiddenId,textId:textId,companyId:companyId,equipmentIds:equipmentIds,pSectionId:pSectionId} , function(data) {
|
||
$("#equ4SelectDiv").html(data);
|
||
openModal("equipment4SelectModal");
|
||
});
|
||
}
|
||
};
|
||
|
||
//选择故障库
|
||
var showFaultLibrary = function(formId,hiddenId,textId) {
|
||
var libraryId=$('#'+hiddenId).val();
|
||
var equipmentIds = $("#equipmentIds").val();
|
||
if(companyId == "" || equipmentIds == "" || companyId == null || equipmentIds == null){
|
||
showAlert('d','请先选择设备');
|
||
}else{
|
||
$.post(ext.contextPath + '/maintenance/libraryFaultBloc/showFaultLibrary4Equpment.do', {libraryId:libraryId,companyId:companyId,equipmentIds:equipmentIds} , function(data) {
|
||
$("#library4SelectDiv").html(data);
|
||
openModal('library4SelectModal');
|
||
});
|
||
}
|
||
};
|
||
|
||
</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" class="form-control" id="id" name ="id" value ="${abnormity.id}">
|
||
|
||
<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;"> -->
|
||
<div class="col-sm-6">
|
||
<input type="hidden" id="bizId" name ="bizId" value="${abnormity.bizId}">
|
||
<p class="form-control-static" >${abnormity.company.name}</p>
|
||
</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="pSectionId" name ="processSectionId" style="width: 270px;">
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">异常设备</label>
|
||
<div class="col-sm-10">
|
||
<input id="equipmentIds" name="equipmentIds" type="hidden" value="${abnormity.equipmentIds}" />
|
||
<input class="form-control" id="equipname" name ="equipname" value="${abnormity.equipmentNames}" onclick="showEquipment4SelectsFun('subForm','equipmentIds','equipname');" placeholder="请先选择厂区和工艺段">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*异常描述</label>
|
||
<div class="col-sm-10">
|
||
<input id="libraryId" name="libraryId" type="hidden" value="${abnormity.libraryId}" />
|
||
<textarea class="form-control " id="abnormityDescription" name="abnormityDescription" rows="2" ondblclick="showFaultLibrary('subForm','libraryId','abnormityDescription');" placeholder="双击可选择故障库">${abnormity.abnormityDescription}</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">${abnormity.remark}</textarea>
|
||
</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>
|
||
</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_save">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|