423 lines
18 KiB
Plaintext
423 lines
18 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" %>
|
||
<!-- 引入daterangepicker-->
|
||
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.css"/>
|
||
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/moment.min.js"
|
||
charset="utf-8"></script>
|
||
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.js"
|
||
charset="utf-8"></script>
|
||
<style type="text/css">
|
||
.select2-container .select2-selection--single {
|
||
height: 34px;
|
||
line-height: 34px;
|
||
}
|
||
|
||
.select2-selection__arrow {
|
||
margin-top: 3px;
|
||
}
|
||
|
||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||
background-color: white;
|
||
}
|
||
|
||
.form-horizontal {
|
||
padding-top: 20px;
|
||
}
|
||
|
||
.right {
|
||
margin-left: 50px;
|
||
}
|
||
|
||
.DDD {
|
||
list-style: none;
|
||
line-height: 30px;
|
||
}
|
||
</style>
|
||
<script type="text/javascript">
|
||
var fileList = []
|
||
$(function () {
|
||
$('#test').outerHTML = initFileInputView()
|
||
jobTypeDropDownInit();
|
||
initDate1();
|
||
});
|
||
|
||
function jobTypeDropDownInit() {
|
||
var select_Data = jQuery.parseJSON('${jobTypeList}');
|
||
var select_3 = $("#jobType").select2({
|
||
data: select_Data,
|
||
cache: false,
|
||
placeholder: '请选择',//默认文字提示
|
||
// allowClear: true,//允许清空
|
||
escapeMarkup: function (markup) {
|
||
return markup;
|
||
}, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||
multiple: true,
|
||
formatResult: function formatRepo(repo) {
|
||
return repo.text;
|
||
}, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo) {
|
||
return repo.text;
|
||
} // 函数用于呈现当前的选择
|
||
});
|
||
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});
|
||
|
||
}
|
||
|
||
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 selectdutyUser() {
|
||
$.post(ext.contextPath + '/user/userForOneSelect.do',
|
||
{formId: "addForm", hiddenId: "dutyUserId", textId: "dutyUserName"},
|
||
function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal('user4SelectModal');
|
||
});
|
||
};
|
||
|
||
//选择部门
|
||
var showUnit4SelectFun = function () {
|
||
$.post(ext.contextPath + '/user/showUnit4Select_Limited.do', {
|
||
formId: "addForm",
|
||
hiddenId: "competentDeptId",
|
||
textId: "competentDeptName"
|
||
}, function (data) {
|
||
$("#unit4SelectDiv").html(data);
|
||
openModal("unit4SelectModal_Limited");
|
||
});
|
||
};
|
||
|
||
function selectCheckUser() {
|
||
$.post(ext.contextPath + '/user/userForOneSelect.do',
|
||
{formId: "addForm", hiddenId: "checkerId", textId: "checkerName"},
|
||
function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal('user4SelectModal');
|
||
});
|
||
};
|
||
$(function () {
|
||
//开始日期
|
||
$("#projectBeginDate").datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format: 'yyyy-mm-dd',
|
||
});
|
||
//结束日期
|
||
$("#projectEndDate").datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format: 'yyyy-mm-dd',
|
||
});
|
||
});
|
||
|
||
|
||
function saveFun() {
|
||
|
||
$("#addForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
var formData = new FormData($("#addForm")[0]);
|
||
$.ajax({
|
||
url: ext.contextPath + "/safety/SafetyJobInside/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]);
|
||
$.ajax({
|
||
url: ext.contextPath + "/safety/SafetyJobInside/saveApply.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 selectDutyUser() {
|
||
$.post(ext.contextPath + '/user/userForOneSelectByStructure.do', {
|
||
formId: "addForm",
|
||
hiddenId: "dutyUserId",
|
||
textId: "dutyUserName",
|
||
bean: "dutyUserBean"
|
||
}, function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal('user4SelectModal');
|
||
});
|
||
|
||
}
|
||
|
||
function copyUserSelectsFun() {
|
||
$.post(ext.contextPath + '/user/userForSelectByCompany.do',
|
||
{
|
||
formId: "addForm",
|
||
hiddenId: "copyUserId",
|
||
textId: "copyUserName"
|
||
}, function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
|
||
function countersignUserSelectsFun() {
|
||
$.post(ext.contextPath + '/user/userForSelectByCompany.do',
|
||
{
|
||
formId: "addForm",
|
||
hiddenId: "userId",
|
||
textId: "userName"
|
||
}, function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
$("#addForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
// projectEndDate: {
|
||
// validators: {
|
||
// notEmpty: {
|
||
// message: '请输入正确的结束日期。'
|
||
// }
|
||
// }
|
||
// }
|
||
}
|
||
});
|
||
|
||
</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">
|
||
<div class="row">
|
||
<div class="col-md-12 col-xs-13">
|
||
<!-- 新增界面formid强制为addForm -->
|
||
<form class="form-horizontal" id="addForm" enctype="multipart/form-data">
|
||
<div id="alertDiv"></div>
|
||
<%-- <input type="hidden" name="id" value="${user.id }" />--%>
|
||
<!-- 界面提醒div强制id为alertdiv -->
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*作业类型</label>
|
||
<div class="col-sm-10 ">
|
||
<select class="form-control" name="jobType" id="jobType" style="width: 100%">
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label "> *作业地点</label>
|
||
<div class="col-sm-4 ">
|
||
<input type="text" class="form-control" id="jobLocation" name="jobLocation"
|
||
placeholder="请输入.."/>
|
||
</div>
|
||
|
||
<label class="col-sm-2 control-label">*作业单位</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" id="jobCompany" name="jobCompany" class="form-control"
|
||
placeholder="请输入..">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label ">*主管部门</label>
|
||
<div class="col-sm-10">
|
||
<input type="text" id="competentDeptName" name="competentDeptName"
|
||
class="form-control"
|
||
placeholder="请选择.." onclick="showUnit4SelectFun();">
|
||
<input type="hidden" id="competentDeptId" name="competentDeptId"
|
||
class="form-control"
|
||
placeholder="请选择..">
|
||
</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" id="projectBeginDate" name="projectBeginDate"
|
||
class="form-control"
|
||
placeholder="请选择..">
|
||
</div>
|
||
|
||
|
||
</div>
|
||
<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" id="projectEndDate" name="projectEndDate"
|
||
class="form-control"
|
||
placeholder="请选择..">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group" id="accord">
|
||
<label class="col-sm-2 control-label">*作业负责人</label>
|
||
<div class="col-sm-4 ">
|
||
<input type="text" id="dutyUserName" name="dutyUserName" class="form-control"
|
||
placeholder="请选择.." onclick="selectdutyUser()">
|
||
<input type="hidden" id="dutyUserId" name="dutyUserId" class="form-control"
|
||
placeholder="请选择..">
|
||
</div>
|
||
<label class="col-sm-2 control-label">*联系方式</label>
|
||
<div class="col-sm-4 ">
|
||
<input type="text" id="contact" name="contact" class="form-control"
|
||
placeholder="请选择..">
|
||
</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="jobContent" name="jobContent"
|
||
/>
|
||
</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="competentAdvice" name="competentAdvice"
|
||
placeholder="请选择.."/>
|
||
</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="userName" name="countersignUserName"
|
||
placeholder="点击选择.." onclick="countersignUserSelectsFun()" readonly>
|
||
|
||
<input id="userId" name="countersignUserId" type="hidden" value=""/>
|
||
|
||
|
||
</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>
|
||
|
||
<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>
|
||
|
||
</div>
|
||
<div class="modal-footer">
|
||
<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" class="btn btn-primary " style="margin-left: 10px" onclick="submitFun()">
|
||
提交
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|