Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/maintenance/abnormityAdd.jsp
2026-01-16 14:13:44 +08:00

323 lines
14 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page language="java" pageEncoding="UTF-8" %>
<%@page import="com.sipai.entity.maintenance.MaintenanceDetail" %>
<%request.setAttribute("Wait", MaintenanceDetail.Status_Wait); %>
<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();
function showFileInput(ctrlName) {
var control = $('#' + ctrlName);
control.fileinput('destroy');
control.fileinput({
language: 'zh', //设置语言
showUpload: false, //是否显示上传按钮
allowedFileExtensions: ['jpg', 'png', 'gif', 'pdf', 'doc', 'xls', 'docx', 'ppt', 'pptx', 'xlsx'],
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 dosave() {
$("#subForm").bootstrapValidator('validate');//提交验证
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/maintenance/abnormity/dosave.do", $("#subForm").serialize(), function (data) {
if (data.code == 1) {
showAlert('s', '保存成功');
closeModal('subModalAbnorm')
$("#table").bootstrapTable('refresh');
} else if (data.code == 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 companyId = "${company.id}";
$(function () {
getFileList();
//选择工艺段
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId: companyId}, function (data) {
$("#processSectionId").empty();
var selelct_ = $("#processSectionId").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 () {
//工艺段选择后,清空原有工艺段选择的设备
$("#equipmentIds").val("");
$("#equipname").val("");
})
}, 'json');
});
//选择设备根据厂区id和工艺段id选择厂内设备可多选
var showEquipment4SelectsFun = function (formId, hiddenId, textId) {
var equipmentIds = $('#' + hiddenId).val();
var pSectionId = $("#processSectionId").val();
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="subModalAbnorm">
<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="subForm">
<!-- 界面提醒div强制id为alertDiv -->
<div id="alertDiv"></div>
<input type="hidden" class="form-control" id="id" name="id" value="${id}">
<input type="hidden" name="status" value="${Wait}"/>
<div class="form-group">
<label class="col-sm-2 control-label">*所属厂区</label>
<div class="col-sm-6">
<input name="bizId" id="bizId" type="hidden" value="${company.id}"/>
<p class="form-control-static">${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="processSectionId" name="processSectionId"
style="width: 270px;" value="${processSectionId}">
</select>
</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="type" name ="type" style="width: 270px;">
<option value="0">设备异常</option>
<option value="1">非设备异常</option>
</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=""/>
<input class="form-control" id="equipname" name="equipname"
onclick="showEquipment4SelectsFun('subForm','equipmentIds','equipname');"
placeholder="请先选择厂区和工艺段">
</div>
<!-- <div class="col-sm-2" style="padding-left:0;">
<button type="button" class="btn btn-primary" onclick="inputEquFun()" >手输设备</button>
</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=""/>
<textarea class="form-control " id="abnormityDescription" name="abnormityDescription"
rows="2"
ondblclick="showFaultLibrary('subForm','libraryId','abnormityDescription');"
placeholder="异常描述"></textarea>
<%-- <textarea class="form-control " id="abnormityDescription" name="abnormityDescription" rows="2" ondblclick="showFaultLibrary('subForm','libraryId','abnormityDescription');" placeholder="异常描述"></textarea>--%>
</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="" />
<input class="form-control" id="abnormityDescription" name ="abnormityDescription" onclick="showFaultLibrary('subForm','libraryId','abnormityDescription');" placeholder="请先选择设备">
</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>
<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="dosave()">保存</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>