347 lines
16 KiB
Plaintext
347 lines
16 KiB
Plaintext
|
|
<%@ page language="java" pageEncoding="UTF-8"%>
|
|||
|
|
<%@page import="com.sipai.entity.maintenance.Maintenance"%>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
|||
|
|
<%request.setAttribute("Status_Confirm_Maintainer",Maintenance.Status_Confirm_Maintainer);%>
|
|||
|
|
<%request.setAttribute("Status_Cancel_Maintainer",Maintenance.Status_Cancel_Maintainer);%>
|
|||
|
|
<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">
|
|||
|
|
|
|||
|
|
function doConfirm() {
|
|||
|
|
$('#status').val('${Status_Confirm_Maintainer}')
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/maintenance/update.do", $("#subForm").serialize(), function(data) {
|
|||
|
|
if (data.res == 1) {
|
|||
|
|
$(".modal").modal("hide");
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
}else if(data.res == 0){
|
|||
|
|
showAlert('d','保存失败');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.res);
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
function doupdate() {
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/maintenance/updateDate.do", $("#subForm").serialize(), function(data) {
|
|||
|
|
if (data.res == 1) {
|
|||
|
|
$(".modal").modal("hide");
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
}else if(data.res == 0){
|
|||
|
|
showAlert('d','保存失败');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.res);
|
|||
|
|
}
|
|||
|
|
},'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 masterId=$('#maintenanceId').val();
|
|||
|
|
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:'',
|
|||
|
|
actionDelete:''
|
|||
|
|
},
|
|||
|
|
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("maintenancefile");
|
|||
|
|
}else{
|
|||
|
|
$('#maintenancefile').hide();
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
var doCancelFun = function(id) {
|
|||
|
|
swal({
|
|||
|
|
title: "退回!",
|
|||
|
|
text: "请输入退回理由:",
|
|||
|
|
buttons: {
|
|||
|
|
cancel: {
|
|||
|
|
text: "取消",
|
|||
|
|
value: null,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-default btn-sm",
|
|||
|
|
closeModal: true,
|
|||
|
|
},
|
|||
|
|
confirm: {
|
|||
|
|
text: "确定",
|
|||
|
|
value: true,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-danger btn-sm",
|
|||
|
|
closeModal: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
content: {
|
|||
|
|
element: "input",
|
|||
|
|
attributes: {
|
|||
|
|
placeholder: "驳回理由...",
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
})
|
|||
|
|
.then((value) => {
|
|||
|
|
if(value){
|
|||
|
|
$.post(ext.contextPath + "/maintenance/updateStatus.do", {id:id,status:'${Status_Cancel_Maintainer}',cancelreason:value}, function(data) {
|
|||
|
|
if (data.res == 1) {
|
|||
|
|
$(".modal").modal("hide");
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
|
|||
|
|
}else if(data.res == 0){
|
|||
|
|
showAlert('d','驳回失败');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.res);
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
}
|
|||
|
|
});;
|
|||
|
|
};
|
|||
|
|
// var data = [{ id: 0, text: 'enhancement' }, { id: 1, text: 'bug' }, { id: 2, text: 'duplicate' }, { id: 3, text: 'invalid' }, { id: 4, text: 'wontfix' }];
|
|||
|
|
$(function() {
|
|||
|
|
$.post(ext.contextPath + "/maintenance/maintainerType/geList4Select.do", {}, function(data) {
|
|||
|
|
|
|||
|
|
var selelct =$("#maintainertypeid").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.on("change",function(e){
|
|||
|
|
var type= $(this).val(); ;
|
|||
|
|
$.post(ext.contextPath + "/maintenance/maintainer/geList4Select.do", {type:type}, function(data) {
|
|||
|
|
$("#maintainerid").empty();
|
|||
|
|
var selelct_ =$("#maintainerid").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;} // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
selelct_.val('${maintenance.maintainerid}').trigger("change");
|
|||
|
|
},'json');
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
selelct.val('${maintenance.maintainertypeid}').trigger("change");
|
|||
|
|
},'json');
|
|||
|
|
|
|||
|
|
$.post(ext.contextPath + "/maintenance/getMaintenanceMethod4Select.do", {}, function(data) {
|
|||
|
|
|
|||
|
|
var selelct =$("#maintenancemethod").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('${maintenance.maintenancemethod}').trigger("change");
|
|||
|
|
},'json');
|
|||
|
|
|
|||
|
|
getFileList();
|
|||
|
|
|
|||
|
|
$('#maintenancedt').datepicker({
|
|||
|
|
language: 'zh-CN',
|
|||
|
|
autoclose: true,
|
|||
|
|
todayHighlight: true,
|
|||
|
|
format:'yyyy-mm-dd',
|
|||
|
|
}).on('hide',function(e) {
|
|||
|
|
//当日期选择框关闭时,执行刷新校验
|
|||
|
|
$('#subForm').data('bootstrapValidator')
|
|||
|
|
.updateStatus('maintenancedt', 'NOT_VALIDATED',null)
|
|||
|
|
.validateField('maintenancedt');
|
|||
|
|
});
|
|||
|
|
//日期格式需对齐,不然会不准
|
|||
|
|
$('#maintenancedt').datepicker('setDate','${maintenance.maintenancedt.substring(0, 10)}');
|
|||
|
|
|
|||
|
|
$("#subForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
maintenancemethod: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '维护方式不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
maintenancedt: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '维护时间不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
})
|
|||
|
|
</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" id ="maintenanceId" name ="id" value="${maintenance.id}">
|
|||
|
|
<input type="hidden" class="form-control" id ="status" name ="status" value="${maintenance.status}">
|
|||
|
|
<div class="form-group " >
|
|||
|
|
<label class="control-label col-sm-2">*维护方式</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<select class="form-control select2" id="maintenancemethod" name ="maintenancemethod" style="width: 220px;" >
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group " >
|
|||
|
|
<label class="control-label col-sm-2">*维护时间</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<div class="input-group date">
|
|||
|
|
<div class="input-group-addon">
|
|||
|
|
<i class="fa fa-calendar"></i>
|
|||
|
|
</div>
|
|||
|
|
<input type="text" class="form-control" id="maintenancedt" name="maintenancedt" style="width: 182px;">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group " >
|
|||
|
|
<label class="control-label col-sm-2">发布类型</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<select class="form-control select2" id="maintainertypeid" name ="maintainertypeid" style="width: 220px;" disabled="disabled"></select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group " >
|
|||
|
|
<label class="control-label col-sm-2">运维商</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<select class="form-control select2" id="maintainerid" name ="maintainerid" style="width: 220px;" disabled="disabled"></select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group " >
|
|||
|
|
<label class="control-label col-sm-2">问题厂区</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<input type="text" class="form-control" id="company" name ="company" placeholder="问题厂区" value='${maintenance.company.name}' disabled="disabled" style="width: 220px;"></input>
|
|||
|
|
</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="problem" name ="problem" placeholder="问题描述..." disabled="disabled">${maintenance.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="maintenancefile" id="maintenancefile" multiple class="file-loading" />
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-footer">
|
|||
|
|
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
|||
|
|
<c:if test='${Status_Confirm_Maintainer eq maintenance.status}'>
|
|||
|
|
<button type="button" class="btn btn-danger" onclick="doCancelFun('${maintenance.id}')" >退回</button>
|
|||
|
|
</c:if>
|
|||
|
|
<button type="button" class="btn btn-primary" onclick="doConfirm()" >确认</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|
|||
|
|
|