first commit
This commit is contained in:
343
src/main/webapp/jsp/accident/roastEdit.jsp
Normal file
343
src/main/webapp/jsp/accident/roastEdit.jsp
Normal file
@ -0,0 +1,343 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8" %>
|
||||
<%@page import="com.sipai.entity.accident.AccidentCommString" %>
|
||||
<%request.setAttribute("START", AccidentCommString.STATUS_RA_START); %>
|
||||
<%request.setAttribute("AUDIT", AccidentCommString.STATUS_RA_AUDIT); %>
|
||||
<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 masterId1 = '${roast.id}';
|
||||
var tbName1 = 'TB_Process_UploadFile'; //数据表
|
||||
var nameSpace1 = 'ProcessUploadFile';//保存文件夹
|
||||
var previews = new Array();
|
||||
var previewConfigs = new Array();
|
||||
|
||||
function doupdate() {
|
||||
$('#subForm').data('bootstrapValidator')
|
||||
.updateStatus('solvername', 'NOT_VALIDATED', null)
|
||||
.validateField('happenDate');
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/accident/roast/doupdate.do", $("#subForm").serialize(), function (data) {
|
||||
if (data.code == 1) {
|
||||
showAlert('s', '保存成功');
|
||||
closeModal('subModal')
|
||||
$("#table").bootstrapTable('refresh');
|
||||
//刷新app页面
|
||||
initAPP();
|
||||
} else if (data.code == 0) {
|
||||
showAlert('d', '保存失败');
|
||||
} else {
|
||||
showAlert('d', data.msg);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function dosubmit() {
|
||||
$("#takeFlag").val('${AUDIT}');
|
||||
$('#subForm').data('bootstrapValidator')
|
||||
.updateStatus('auditManName', 'NOT_VALIDATED', null)
|
||||
.validateField('auditManName');
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/accident/roast/startProcess.do", $("#subForm").serialize(), function (data) {
|
||||
if (data.res == 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
closeModal('subModal');
|
||||
} else if (data.res == 0) {
|
||||
showAlert('d', '保存失败');
|
||||
} else if (data.res == 2) {
|
||||
showAlert('d', '未检测到吐槽大会审核流程,请先部署吐槽大会审核流程!');
|
||||
} else {
|
||||
showAlert('d', data.res);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
|
||||
//提交时先验证审核人不能为空,保存时审核人可以为空
|
||||
function submitFun() {
|
||||
//新增的输入框添加验证
|
||||
$("#subForm").data('bootstrapValidator').addField('auditManName', {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '审核人不能为空'
|
||||
},
|
||||
}
|
||||
});
|
||||
dosubmit();
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
solvername: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '吐槽人不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var showUser4SelectsFun = function () {
|
||||
var userIds = $("#userLead").val();
|
||||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {
|
||||
formId: "subForm",
|
||||
hiddenId: "userLead",
|
||||
textId: "solvername",
|
||||
userIds: userIds
|
||||
}, function (data) {
|
||||
$("#user4SelectDiv").html(data);
|
||||
openModal("user4SelectModal");
|
||||
});
|
||||
};
|
||||
|
||||
/*var showUser4SelectsFun1 = function () {
|
||||
var userIds = $("#usersHelp").val();
|
||||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {
|
||||
formId: "subForm",
|
||||
hiddenId: "usersHelp",
|
||||
textId: "solvername1",
|
||||
userIds: userIds
|
||||
}, function (data) {
|
||||
$("#user4SelectDiv").html(data);
|
||||
openModal("user4SelectModal");
|
||||
});
|
||||
};*/
|
||||
|
||||
//以下为上传图片
|
||||
//名称定义不可修改
|
||||
var getFileList = function () {
|
||||
$.post(ext.contextPath + '/base/getInputFileList.do', {masterId: masterId1, tbName: tbName1}, 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;
|
||||
console.log(data[i].filename)
|
||||
previewConfig['key'] = data[i].id;
|
||||
previewConfigs.push(previewConfig);
|
||||
}
|
||||
showFileInput("maintenanceDetailFile");
|
||||
} else {
|
||||
$('#maintenanceDetailFile').hide();
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
};
|
||||
|
||||
//初始化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": tbName1
|
||||
};
|
||||
return data;
|
||||
}
|
||||
});
|
||||
$('#kvFileinputModal').on("hidden.bs.modal", function () {
|
||||
$(this).removeData("bs.modal");
|
||||
//modal重复打开会导致前面的滚动条失去作用
|
||||
$('.modal').css("overflow", "auto");
|
||||
});
|
||||
}
|
||||
|
||||
var fileinput1 = function () {
|
||||
//var url='/maintenance/updateProblemFile.do';//保存数据表方法
|
||||
$.post(ext.contextPath + '/base/fileinput.do', {
|
||||
masterId: masterId1,
|
||||
tbName: tbName1,
|
||||
nameSpace: nameSpace1
|
||||
}, function (data) {
|
||||
$("#fileInputDiv").html(data);
|
||||
openModal('fileInputModal');
|
||||
});
|
||||
};
|
||||
|
||||
//选择审核人
|
||||
var showUser4AuditSelectsFun = function () {
|
||||
var userIds = $("#auditManId").val();
|
||||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {
|
||||
formId: "subForm",
|
||||
hiddenId: "auditManId",
|
||||
textId: "auditManName",
|
||||
userIds: userIds
|
||||
}, function (data) {
|
||||
$("#user4SelectDiv").html(data);
|
||||
openModal("user4SelectModal");
|
||||
});
|
||||
};
|
||||
|
||||
var selelct_type = $("#anonymous").select2({
|
||||
placeholder: '请选择',
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
selelct_type.on('change', function () {
|
||||
var anonymous = $('#anonymous').val();
|
||||
if ('0' == anonymous) {//不匿名
|
||||
$("#userLeadDiv").attr("style", "display:block;");
|
||||
} else {//匿名
|
||||
$("#userLeadDiv").attr("style", "display:none;");
|
||||
$('#solvername').val("");
|
||||
$('#userLead').val("");
|
||||
}
|
||||
})
|
||||
|
||||
$(function () {
|
||||
getFileList();
|
||||
|
||||
var anonymous = '${roast.anonymous}';
|
||||
$("#anonymous").val(anonymous).trigger("change");
|
||||
});
|
||||
</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="${roast.id}">
|
||||
<input type="hidden" class="form-control" id="unitId" name="unitId" value="${roast.unitId}">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">*吐槽名称</label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" id="name" name="name" placeholder="名称"
|
||||
value="${roast.name}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">吐槽类型</label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" id="adviceType" name="adviceType" placeholder="类型"
|
||||
value="${roast.adviceType}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">吐槽内容</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" rows="5" id="content" name="content"
|
||||
placeholder="不超过500字">${roast.content}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">是否匿名</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control select2" id="anonymous" name="anonymous">
|
||||
<option value="0">否</option>
|
||||
<option value="1">是</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="userLeadDiv">
|
||||
<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();" value="${solvername}">
|
||||
<input id="userLead" name="userLead" type="hidden" value="${roast.userLead}"/>
|
||||
</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="solvername1" name ="solvername1" placeholder="请选择辅议人" onclick="showUser4SelectsFun1();" value="${solvername1}">
|
||||
<input id="usersHelp" name="usersHelp" type="hidden" value="${roast.usersHelp}"/>
|
||||
</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="auditManName" name="auditManName"
|
||||
placeholder="点击选择" value="${roast.auditManName}"
|
||||
onclick="showUser4AuditSelectsFun();">
|
||||
<input id="auditManId" name="auditManId" type="hidden" value="${roast.auditManId}"/>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" class="form-control" id="takeFlag" name="takeFlag" value="${roast.takeFlag}">
|
||||
|
||||
<%--<div class="form-group" style="margin:8px">
|
||||
<button type="button" class="btn btn-default btn-file" onclick="fileinput1()" 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>
|
||||
<button type="button" class="btn btn-primary" onclick="submitFun()" id="btn_submit">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user