first commit
This commit is contained in:
346
WebRoot/jsp/maintenance/abnormityAdd_new.jsp
Normal file
346
WebRoot/jsp/maintenance/abnormityAdd_new.jsp
Normal file
@ -0,0 +1,346 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8" %>
|
||||
<%@page import="com.sipai.entity.maintenance.Abnormity" %>
|
||||
<%request.setAttribute("Type_Run", Abnormity.Type_Run); %>
|
||||
<%request.setAttribute("Type_Equipment", Abnormity.Type_Equipment); %>
|
||||
<%request.setAttribute("Type_Facilities", Abnormity.Type_Facilities); %>
|
||||
|
||||
<%@ page import="com.sipai.entity.activiti.ProcessType" %>
|
||||
<%request.setAttribute("Workorder_Abnormity_Run", ProcessType.Workorder_Abnormity_Run); %>
|
||||
<%request.setAttribute("Workorder_Abnormity_Equipment", ProcessType.Workorder_Abnormity_Equipment); %>
|
||||
<%request.setAttribute("Workorder_Abnormity_Facilities", ProcessType.Workorder_Abnormity_Facilities); %>
|
||||
|
||||
<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 = 'maintenance';//保存文件夹
|
||||
var bucketName = 'maintenance';
|
||||
var previews = new Array();
|
||||
var previewConfigs = new Array();
|
||||
|
||||
function dosave() {
|
||||
$('#subForm').data('bootstrapValidator')
|
||||
.updateStatus('solvername', 'NOT_VALIDATED', null)
|
||||
.validateField('solvername');
|
||||
$('#subForm').data('bootstrapValidator')
|
||||
.updateStatus('equipmentNames', 'NOT_VALIDATED', null)
|
||||
.validateField('equipmentNames');
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/maintenance/abnormity/start.do", $("#subForm").serialize(), function (data) {
|
||||
if (data.res == 1) {
|
||||
showAlert('s', '保存成功');
|
||||
closeModal('subModalAbnorm')
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else if (data.res == 0) {
|
||||
showAlert('d', '保存失败');
|
||||
} else {
|
||||
showAlert('d', data.res);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
type: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '异常类型不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
processSectionId: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '工艺段不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
abnormityDescription: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '异常描述不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
equipmentNames: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '异常设备不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
solvername: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '接收人员不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(function () {
|
||||
//加载文件
|
||||
getFileListMinioPic('abnormityFileId', 'edit', '${id}', previews, previewConfigs);
|
||||
|
||||
//选择工艺段
|
||||
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId: '${param.unitId}'}, 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('${param.processSectionCode}').trigger("change");
|
||||
selelct_.on('change', function () {
|
||||
//工艺段选择后,清空原有工艺段选择的设备
|
||||
$("#equipmentIds").val("");
|
||||
$("#equipmentNames").val("");
|
||||
})
|
||||
}, 'json');
|
||||
|
||||
var selelct_type = $("#type").select2({
|
||||
placeholder: '请选择',
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
selelct_type.on('change', function () {
|
||||
var type = $('#type').val();
|
||||
if ('${Type_Equipment}' == type) {
|
||||
$("#equipmentIdsDiv").attr("style", "display:block;");
|
||||
// $("#processSectionDiv").attr("style", "display:none;");
|
||||
} else {
|
||||
$("#equipmentIdsDiv").attr("style", "display:none;");
|
||||
// $("#processSectionDiv").attr("style", "display:block;");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//选择设备弹窗
|
||||
var showEquipment4SelectsFun = function (formId, hiddenId, textId) {
|
||||
// var equipmentIds = $('#' + hiddenId).val();
|
||||
var processSectionId = $("#processSectionId").val();
|
||||
$.post(ext.contextPath + '/equipment/selectEquipmentCard4Choice.do', {
|
||||
formId: formId,
|
||||
hiddenId: hiddenId,
|
||||
textId: textId,
|
||||
unitId: '${param.unitId}',
|
||||
equipmentIds: '',
|
||||
processSectionId: processSectionId
|
||||
}, function (data) {
|
||||
$("#equ4SelectDiv").html(data);
|
||||
openModal("equipment4SelectModal");
|
||||
});
|
||||
};
|
||||
|
||||
//保存选择设备 datas为id
|
||||
var doFinishSelectEquipment = function (datas_id, datas_name) {
|
||||
if (datas_id.indexOf(",") != -1 || datas_id.indexOf(",") != -1) {
|
||||
alert('无法选择多台设备!');
|
||||
} else {
|
||||
|
||||
$.get(ext.contextPath + '/equipment/getEquipmentSimple.do', {
|
||||
id: datas_id
|
||||
}, function (data) {
|
||||
var obj = $.parseJSON(data);
|
||||
var processSectionId = $("#processSectionId").val();
|
||||
//如果选择的设备工艺段和外面的工艺段不一样的话 给与提示 然后将外面的工艺段修改掉
|
||||
if (obj.processsectionid != unitId + '_' + processSectionId) {
|
||||
layer.open({
|
||||
title: '提示'
|
||||
, content: '已修改为设备所在工艺段!'
|
||||
});
|
||||
//由于设备台账关联的是工艺段的id 这边关联的是工艺段的code 如果需要处理下
|
||||
var processCode = obj.processsectionid.replace(unitId + "_", "")
|
||||
//修改外面选择的工艺段
|
||||
$("#processSectionId").select2().val(processCode).trigger("change");
|
||||
}
|
||||
$('#equipmentIds').val(datas_id);
|
||||
$('#equipmentNames').val(datas_name);
|
||||
closeModal("equipment4SelectModal");
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//选择故障库
|
||||
var showFaultLibrary = function (formId, hiddenId, textId) {
|
||||
var libraryId = $('#' + hiddenId).val();
|
||||
var equipmentIds = $("#equipmentIds").val();
|
||||
|
||||
var type = $('#type').val();
|
||||
//设备故障才弹窗故障库
|
||||
if ('${Type_Equipment}' == type) {
|
||||
if ('${param.unitId}' == "" || equipmentIds == "" || '${param.unitId}' == null || equipmentIds == null) {
|
||||
showAlert('d', '未选择设备');
|
||||
} else {
|
||||
$.post(ext.contextPath + '/maintenance/libraryFaultBloc/showFaultLibrary4Equpment.do', {
|
||||
libraryId: libraryId,
|
||||
companyId: '${param.unitId}',
|
||||
equipmentIds: equipmentIds
|
||||
}, function (data) {
|
||||
$("#library4SelectDiv").html(data);
|
||||
openModal('library4SelectModal');
|
||||
});
|
||||
}
|
||||
//其余故障类型没有弹窗列表
|
||||
} else {
|
||||
showAlert('d', '仅设备故障可选择故障库');
|
||||
}
|
||||
};
|
||||
|
||||
//选人
|
||||
var showUser4SelectsFun = function () {
|
||||
var userIds = $("#solver").val();
|
||||
var type = $("#type").val();
|
||||
var typeId = '';
|
||||
if(type == 'run'){
|
||||
typeId = '${Workorder_Abnormity_Run}';
|
||||
}
|
||||
if(type == 'equipment'){
|
||||
typeId = '${Workorder_Abnormity_Equipment}';
|
||||
}
|
||||
$.post(ext.contextPath + '/user/layerUser.do', {
|
||||
formId: "subForm",
|
||||
hiddenId: "solver",
|
||||
textId: "solvername",
|
||||
userIds: userIds,
|
||||
unitId: unitId, //获取右上角的厂id
|
||||
type: typeId
|
||||
}, function (data) {
|
||||
$("#user4SelectDiv").html(data);
|
||||
openModal("user4SelectModal");
|
||||
});
|
||||
};
|
||||
|
||||
</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">×</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-4">
|
||||
<input name="bizId" id="bizId" type="hidden" value="${company.id}"/>
|
||||
<p class="form-control-static">${company.name}</p>
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">上报人</label>
|
||||
<div class="col-sm-4">
|
||||
<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-10">
|
||||
<select class="form-control select2" id="type" name="type" style="width: 470px;">
|
||||
<option value="run">运行异常</option>
|
||||
<option value="equipment">设备异常</option>
|
||||
<%--<option value="facilities">设施异常</option>--%>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="processSectionDiv">
|
||||
<label class="col-sm-2 control-label">*工艺段</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control select2" id="processSectionId" name="processSectionId"
|
||||
style="width: 470px;" value="${processSectionId}">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="equipmentIdsDiv" style="display: none;">
|
||||
<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="equipmentNames" name="equipmentNames"
|
||||
onclick="showEquipment4SelectsFun('subForm','equipmentIds','equipmentNames');" autocomplete="off">
|
||||
</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" autocomplete="off"
|
||||
ondblclick="showFaultLibrary('subForm','libraryId','abnormityDescription');"
|
||||
placeholder="异常描述">${param.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">${param.remark}</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="solvername" name="solvername"
|
||||
placeholder="请选择接收人员" onclick="showUser4SelectsFun();" autocomplete="off">
|
||||
<input id="solver" name="receiveUserId" type="hidden"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin:8px">
|
||||
<button type="button" class="btn btn-default btn-file" onclick="fileinputPic('abnormityFileId')"
|
||||
id="btn_save"><i
|
||||
class="fa fa-paperclip"></i>上传图片
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin:8px;">
|
||||
<input type="file" name="abnormityFileId" id="abnormityFileId" 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>
|
||||
Reference in New Issue
Block a user