329 lines
13 KiB
Plaintext
329 lines
13 KiB
Plaintext
|
|
<%@ page language="java" pageEncoding="UTF-8" %>
|
|||
|
|
<%@ 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();
|
|||
|
|
|
|||
|
|
//初始化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/userForSelectByStructure.do', {
|
|||
|
|
formId: "subForm",
|
|||
|
|
hiddenId: "solver",
|
|||
|
|
textId: "solvername",
|
|||
|
|
userIds: userIds
|
|||
|
|
}, function (data) {
|
|||
|
|
$("#user4SelectDiv").html(data);
|
|||
|
|
openModal("user4SelectModal");
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
var showContacts4SelectsFun = function () {
|
|||
|
|
var userIds = $("#contactids").val();
|
|||
|
|
var companyId = $("#companyid").val();
|
|||
|
|
//alert(companyId)
|
|||
|
|
if (null == companyId || '' == companyId) {
|
|||
|
|
showAlert('d', "请先选择厂区!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
$.post(ext.contextPath + '/user/userForSelect.do', {
|
|||
|
|
formId: "subForm",
|
|||
|
|
hiddenId: "contactids",
|
|||
|
|
textId: "contactname",
|
|||
|
|
userIds: userIds,
|
|||
|
|
companyId: companyId
|
|||
|
|
}, function (data) {
|
|||
|
|
$("#user4SelectDiv").html(data);
|
|||
|
|
openModal("user4SelectModal");
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function dosave() {
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
$('#subForm').data('bootstrapValidator')
|
|||
|
|
.updateStatus('actualFinishDate', 'NOT_VALIDATED', null)
|
|||
|
|
.validateField('actualFinishDate');
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
var serialData = $("#subForm").serialize();
|
|||
|
|
$.post(ext.contextPath + "/maintenance/saveDetail.do", serialData, function (data) {
|
|||
|
|
if (data.res == 1) {
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
closeModal('subModal')
|
|||
|
|
} else if (data.res == 0) {
|
|||
|
|
showAlert('d', '保存失败');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', data.res);
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$("#subForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
solvername: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '维护人员不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
actualFinishDate: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '完成日期不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
problemcontent: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '问题详情不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
equipname: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '故障设备不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
$(function () {
|
|||
|
|
|
|||
|
|
//初始化日期控件
|
|||
|
|
createDatetimepicker('actualFinishDate', 'H');
|
|||
|
|
|
|||
|
|
//选择工艺段
|
|||
|
|
$.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId: "${company.id}"}, function (data) {
|
|||
|
|
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;
|
|||
|
|
} // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
}, 'json');
|
|||
|
|
|
|||
|
|
getFileList();
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
//选择设备,根据厂区id和工艺段id选择厂内设备,可多选
|
|||
|
|
var showEquipment4SelectsFun = function (formId, hiddenId, textId) {
|
|||
|
|
var equipmentIds = $('#' + hiddenId).val();
|
|||
|
|
var pSectionId = $("#processSectionId").val();
|
|||
|
|
var companyId = '${company.id}';
|
|||
|
|
if (null == companyId || '' == companyId || null == pSectionId || '' == pSectionId) {
|
|||
|
|
showAlert('d', "请先选择厂区和工艺段!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
$.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 showProblemType4SelectsFun = function (formId, hiddenId, textId) {
|
|||
|
|
var problemTypeIds = $('#' + hiddenId).val();
|
|||
|
|
$.post(ext.contextPath + '/maintenance/faultLibrary/showFaultTypeForSelects.do', {
|
|||
|
|
formId: formId,
|
|||
|
|
hiddenId: hiddenId,
|
|||
|
|
textId: textId,
|
|||
|
|
problemTypeIds: problemTypeIds
|
|||
|
|
}, function (data) {
|
|||
|
|
$("#problemTyp4SelectDiv").html(data);
|
|||
|
|
openModal("problemTyp4SelectModal");
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
</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" 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" name="type" value="${type}">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">所属公司</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input name="companyid" 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 id="processSectionId" name="processSectionId" class="form-control select2"
|
|||
|
|
style="width: 270px;" value="">
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">工单号</label>
|
|||
|
|
<div class="col-sm-6">
|
|||
|
|
<input class="form-control" id="detailNumber" name="detailNumber" type="hidden"
|
|||
|
|
value="${detailNumber}" readonly>
|
|||
|
|
<p class="form-control-static">${detailNumber}</p>
|
|||
|
|
</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="actualFinishDate" name="actualFinishDate"
|
|||
|
|
style="width: 232px;">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*异常详情</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<textarea class="form-control" rows="3" id="problemcontent" name="problemcontent"
|
|||
|
|
placeholder="异常详情...">${problem }</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>
|