452 lines
19 KiB
Plaintext
452 lines
19 KiB
Plaintext
|
|
<!DOCTYPE html
|
|||
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|||
|
|
<%@ page language="java" pageEncoding="utf-8" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
|
|||
|
|
<style type="text/css">
|
|||
|
|
.select2-container .select2-selection--single {
|
|||
|
|
height: 34px;
|
|||
|
|
line-height: 34px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.select2-selection__arrow {
|
|||
|
|
margin-top: 3px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.form-horizontal {
|
|||
|
|
padding-top: 20px;
|
|||
|
|
}
|
|||
|
|
.DDD{
|
|||
|
|
list-style: none;
|
|||
|
|
line-height: 30px;
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
var fileList = []
|
|||
|
|
// 初始化
|
|||
|
|
$(function () {
|
|||
|
|
$('#test').outerHTML = initFileInputView()
|
|||
|
|
//初始化 检查日期
|
|||
|
|
$("#checkDate").datepicker({
|
|||
|
|
language: 'zh-CN',
|
|||
|
|
autoclose: true,
|
|||
|
|
todayHighlight: true,
|
|||
|
|
format: 'yyyy-mm-dd',
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 检查类型
|
|||
|
|
$('#checkTypePrefix').attr("disabled", "disabled");
|
|||
|
|
$('input[type=radio][name=checkType]').change(function () {
|
|||
|
|
if (this.value == '月度检查') {
|
|||
|
|
$('#checkTypePrefix').val('');
|
|||
|
|
$('#checkTypePrefix').attr("disabled", "disabled");
|
|||
|
|
} else {
|
|||
|
|
$('#checkTypePrefix').removeAttr("disabled");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 初始化‘提交’按钮
|
|||
|
|
$("#submitBt").hide();
|
|||
|
|
$("#checkResult").change(function () {
|
|||
|
|
var type = $("#checkResult option:selected").val();
|
|||
|
|
if (type == "1") {
|
|||
|
|
$("#unAccord").hide();
|
|||
|
|
$("#unAccord1").hide();
|
|||
|
|
$("#submitBt").hide();
|
|||
|
|
$('#checkResultDetail').val('');
|
|||
|
|
$('#dutyDeptId').val('');
|
|||
|
|
$('#dutyDeptName').val('');
|
|||
|
|
$('#dutyUserName').val('');
|
|||
|
|
$('#dutyUserId').val('');
|
|||
|
|
}
|
|||
|
|
if (type == "2") {
|
|||
|
|
$("#unAccord").show();
|
|||
|
|
$("#unAccord1").show();
|
|||
|
|
$("#submitBt").show();
|
|||
|
|
$('#confirmUserName').val('');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 初始化 检查结果下拉
|
|||
|
|
checkResultDropDownInit()
|
|||
|
|
|
|||
|
|
// 初始化 检查项目下拉
|
|||
|
|
checkItemDropDownInit()
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 点击文件
|
|||
|
|
var fileinput = function () {
|
|||
|
|
$('#file').click();
|
|||
|
|
};
|
|||
|
|
// 清空文件
|
|||
|
|
var filedel = function () {
|
|||
|
|
fileList.splice(index,1)
|
|||
|
|
$('#test').html(initFileInputView())
|
|||
|
|
};
|
|||
|
|
// 选中文件
|
|||
|
|
var fileSelected = function () {
|
|||
|
|
var filename = $('#file').val();
|
|||
|
|
fileList.push(...$('#file')[0].files)
|
|||
|
|
$('#test').html(initFileInputView())
|
|||
|
|
};
|
|||
|
|
function initFileInputView() {
|
|||
|
|
let button = (index) => {
|
|||
|
|
return `<button type="button" class="btn btn-default btn-file" onclick="filedel(`+index+`)"
|
|||
|
|
style="position: fixed;right: 193px;height: 24px;width:24px;padding-top:2px;margin-top: 3px" id="btn_save1"><i class="fa fa-trash-o" style="margin-left: -5px"></i></button>`
|
|||
|
|
}
|
|||
|
|
let temp = `<ul class="DDD">`
|
|||
|
|
fileList.forEach((item, index) => {
|
|||
|
|
temp += `<li>`+item.name+button(index)+`</li>`
|
|||
|
|
})
|
|||
|
|
temp += `<ul>`
|
|||
|
|
temp += `<input type="hidden" class="form-control" name="fileName" id="fileName" readonly
|
|||
|
|
style="width:650px;border:none;background-color: white"/>`
|
|||
|
|
return temp
|
|||
|
|
}
|
|||
|
|
// 处理 检查类型 前缀拼接
|
|||
|
|
function handleCheckType(formData) {
|
|||
|
|
let checktype = $('input[type=radio][name=checkType]:checked').val();
|
|||
|
|
if (checktype != '月度检查') {
|
|||
|
|
let checkTypePrefix = $('#checkTypePrefix').val();
|
|||
|
|
formData.set('checkType', checkTypePrefix + checktype);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 保存
|
|||
|
|
function saveFun() {
|
|||
|
|
$("#addForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
var formData = new FormData($("#addForm")[0]);
|
|||
|
|
this.handleCheckType(formData);
|
|||
|
|
$.ajax({
|
|||
|
|
url: ext.contextPath + "/safety/SafetyCheckComprehensive/save.do",
|
|||
|
|
type: 'POST',
|
|||
|
|
data: formData,
|
|||
|
|
async: false,
|
|||
|
|
cache: false,
|
|||
|
|
contentType: false,
|
|||
|
|
processData: false,
|
|||
|
|
dataType: 'json',
|
|||
|
|
success: function (data) {
|
|||
|
|
// console.log(data)
|
|||
|
|
if (data.code == 1) {
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
closeModal('subModal');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', '保存失败!' + data.msg);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error: function (data) {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 提交
|
|||
|
|
function submitFun() {
|
|||
|
|
$("#addForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
var formData = new FormData($("#addForm")[0]);
|
|||
|
|
this.handleCheckType(formData);
|
|||
|
|
$.ajax({
|
|||
|
|
url: ext.contextPath + "/safety/SafetyCheckComprehensive/saveApply.do",
|
|||
|
|
type: 'POST',
|
|||
|
|
data: formData,
|
|||
|
|
async: false,
|
|||
|
|
cache: false,
|
|||
|
|
contentType: false,
|
|||
|
|
processData: false,
|
|||
|
|
dataType: 'json',
|
|||
|
|
success: function (data) {
|
|||
|
|
if (data.code == 1) {
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
closeModal('subModal');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', '保存失败!' + data.msg);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error: function (data) {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 表单验证
|
|||
|
|
$("#addForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
educationCode: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '培训记录编号不能为空。'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 检查结果
|
|||
|
|
function checkResultDropDownInit() {
|
|||
|
|
var select_Data = jQuery.parseJSON('${checkResultList}');
|
|||
|
|
var select_3 = $("#checkResult").select2({
|
|||
|
|
data: select_Data,
|
|||
|
|
cache: false,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
// allowClear: true,//允许清空
|
|||
|
|
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;
|
|||
|
|
} // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 检查项目
|
|||
|
|
function checkItemDropDownInit() {
|
|||
|
|
var select_Data = jQuery.parseJSON('${checkItemList}');
|
|||
|
|
var select_3 = $("#checkResultDetail").select2({
|
|||
|
|
data: select_Data,
|
|||
|
|
cache: false,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
allowClear: true,//允许清空
|
|||
|
|
escapeMarkup: function (markup) {
|
|||
|
|
return markup;
|
|||
|
|
}, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
|||
|
|
multiple: true,
|
|||
|
|
templateResult: function formatRepo(repo) {
|
|||
|
|
return "【" + repo.group + "】 " + repo.text;
|
|||
|
|
}, // 函数用来渲染结果
|
|||
|
|
templateSelection: function formatRepoSelection(repo) {
|
|||
|
|
return "【" + repo.group + "】 " + repo.text;
|
|||
|
|
} // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 检查人员
|
|||
|
|
function selectCheckUser() {
|
|||
|
|
$.post(ext.contextPath + '/user/userForSelectByCompany.do',
|
|||
|
|
{
|
|||
|
|
formId: "addForm",
|
|||
|
|
hiddenId: "checkerId",
|
|||
|
|
textId: "checkerName"
|
|||
|
|
}, function (data) {
|
|||
|
|
$("#user4SelectDiv").html(data);
|
|||
|
|
openModal("user4SelectModal");
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
// 整改负责人
|
|||
|
|
function selectDutyUser() {
|
|||
|
|
$.post(ext.contextPath + '/user/userForOneSelectByStructure.do', {
|
|||
|
|
formId: "addForm",
|
|||
|
|
hiddenId: "dutyUserId",
|
|||
|
|
textId: "dutyUserName",
|
|||
|
|
bean: "dutyUserBean"
|
|||
|
|
}, function (data) {
|
|||
|
|
$("#user4SelectDiv").html(data);
|
|||
|
|
openModal('user4SelectModal');
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 整改负责人 改变事件
|
|||
|
|
function userInfoChage() {
|
|||
|
|
var userInfo = JSON.parse($('#dutyUserBean').val());
|
|||
|
|
var userInfo2;
|
|||
|
|
$('#dutyDeptId').val(userInfo.pid);
|
|||
|
|
// if (userInfo.sex == '1') {
|
|||
|
|
// $('#gender').val('男');
|
|||
|
|
// } else {
|
|||
|
|
// $('#gender').val('女');
|
|||
|
|
// }
|
|||
|
|
$.post(ext.contextPath + '/user/findUserByIds.do?userIdsStr=' + userInfo.id + ',', function (res) {
|
|||
|
|
userInfo2 = res[0];
|
|||
|
|
$('#dutyDeptName').val(userInfo2.deptName);
|
|||
|
|
}, 'json')
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 抄送人
|
|||
|
|
var copyUserSelectsFun = function () {
|
|||
|
|
$.post(ext.contextPath + '/user/userForSelectByCompany.do',
|
|||
|
|
{
|
|||
|
|
formId: "addForm",
|
|||
|
|
hiddenId: "copyUserId",
|
|||
|
|
textId: "copyUserName"
|
|||
|
|
}, function (data) {
|
|||
|
|
$("#user4SelectDiv").html(data);
|
|||
|
|
openModal("user4SelectModal");
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
</script>
|
|||
|
|
<div class="modal fade" id="subModal">
|
|||
|
|
<div class="modal-dialog modal-lg">
|
|||
|
|
<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强制为addForm -->
|
|||
|
|
<form class="form-horizontal" id="addForm" enctype="multipart/form-data">
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">检查类型</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<label class="radio-inline">
|
|||
|
|
<input type="radio" name="checkType" id="monthCheck"
|
|||
|
|
value="月度检查" checked>月度检查
|
|||
|
|
</label>
|
|||
|
|
<label class="radio-inline" style="margin-left: 30px;">
|
|||
|
|
<input type="radio" name="checkType" id="otherCheck" value="(节前)检查">
|
|||
|
|
<input type="text" id="checkTypePrefix" name="checkTypePrefix"
|
|||
|
|
style="width: 200px;"> <%--disabled="disabled"--%>
|
|||
|
|
(节前)检查
|
|||
|
|
</label>
|
|||
|
|
</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="checkDate" name="checkDate"
|
|||
|
|
placeholder="请选择.."/>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<label class="col-sm-2 control-label">检查地点</label>
|
|||
|
|
<div class="col-sm-4 ">
|
|||
|
|
<input type="text" id="checkPlace" name="checkPlace" class="form-control"
|
|||
|
|
placeholder="请输入..">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">检查人员</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" id="checkerName" name="checkerName" class="form-control"
|
|||
|
|
placeholder="请选择.." readonly onclick="selectCheckUser()"
|
|||
|
|
style="background-color: white">
|
|||
|
|
<input type="hidden" id="checkerId" name="checkerId" class="form-control"
|
|||
|
|
placeholder="请选择..">
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<label class="col-sm-2 control-label">记录人</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" id="recorderName" name="recorderName" class="form-control"
|
|||
|
|
placeholder="请输入.." readonly value="${currUser.caption}"
|
|||
|
|
style="background-color: white">
|
|||
|
|
<input type="hidden" id="recorderId" name="recorderId" class="form-control"
|
|||
|
|
placeholder="请选择.." readonly value="${currUser.id}">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label ">检查结果</label>
|
|||
|
|
<div class="col-sm-4 ">
|
|||
|
|
<select class="form-control select2" name="checkResult" id="checkResult"
|
|||
|
|
style="width: 100%">
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group" id="unAccord" style="display: none">
|
|||
|
|
<label class="col-sm-2 control-label">不相符内容</label>
|
|||
|
|
<div class="col-sm-10 ">
|
|||
|
|
<select class="form-control select2" name="checkResultDetail" id="checkResultDetail"
|
|||
|
|
style="width: 100%">
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label ">附加说明</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<textarea class="form-control" id="checkRemark" name="checkRemark"
|
|||
|
|
placeholder="请选择"/>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group" id="unAccord1" style="display: none">
|
|||
|
|
<label class="col-sm-2 control-label ">整改负责部门</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="hidden" class="form-control" id="dutyDeptId" name="dutyDeptId"
|
|||
|
|
readonly />
|
|||
|
|
<input type="text" class="form-control" id="dutyDeptName" name="dutyDeptName"
|
|||
|
|
placeholder="请选择.." readonly onclick="selectDutyUser()" style="background-color: white"/>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<label class="col-sm-2 control-label ">整改负责人</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="dutyUserName" name="dutyUserName"
|
|||
|
|
placeholder="请选择.." readonly onclick="selectDutyUser()"
|
|||
|
|
style="background-color: white">
|
|||
|
|
<input type="hidden" class="form-control" id="dutyUserId" name="dutyUserId"
|
|||
|
|
placeholder="请选择"/>
|
|||
|
|
<input type="hidden" class="form-control" id="dutyUserBean" name="dutyUserBean"
|
|||
|
|
placeholder="请选择" onchange="userInfoChage()"/>
|
|||
|
|
</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="copyUserName" name="copyUserName"
|
|||
|
|
placeholder="点击选择.." onclick="copyUserSelectsFun()" readonly
|
|||
|
|
style="background-color: white">
|
|||
|
|
<input id="copyUserId" name="copyUserId" type="hidden" value=""/>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label ">附件资料:</label>
|
|||
|
|
<div class="col-sm-1" style="display: flex">
|
|||
|
|
<button type="button" class="btn btn-default btn-file" onclick="fileinput()"
|
|||
|
|
id="btn_save"><i class="fa fa-paperclip"></i></button>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<div id="test" ></div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group" style="margin:8px;">
|
|||
|
|
<input type="file" name="file" id="file" multiple class="file-loading"
|
|||
|
|
onchange="fileSelected()"/>
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-foo
|
|||
|
|
|
|||
|
|
ter">
|
|||
|
|
<button type="button" class="btn btn-default " data-dismiss="modal">关闭</button>
|
|||
|
|
<button type="button" class="btn btn-primary " style="margin-left: 10px" onclick="saveFun()">
|
|||
|
|
保存
|
|||
|
|
</button>
|
|||
|
|
<button type="button" id="submitBt" class="btn btn-primary " style="margin-left: 10px"
|
|||
|
|
onclick="submitFun()">
|
|||
|
|
提交
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|