387 lines
14 KiB
Plaintext
387 lines
14 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;
|
|||
|
|
padding-right: 30px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.DDD{
|
|||
|
|
list-style: none;
|
|||
|
|
line-height: 30px;
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
var fileList = []
|
|||
|
|
|
|||
|
|
$(function () {
|
|||
|
|
jobTypeDropDownInit(); // 作业类型
|
|||
|
|
|
|||
|
|
//初始化 开始时间
|
|||
|
|
$("#projectBeginDate").datepicker({
|
|||
|
|
format: 'yyyy-mm-dd',
|
|||
|
|
autoclose: true,
|
|||
|
|
minView: 0,
|
|||
|
|
language : 'zh-CN',
|
|||
|
|
minuteStep:1
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
//初始化 结束时间
|
|||
|
|
$("#projectEndDate").datepicker({
|
|||
|
|
format: 'yyyy-mm-dd',
|
|||
|
|
autoclose: true,
|
|||
|
|
minView: 0,
|
|||
|
|
language : 'zh-CN',
|
|||
|
|
minuteStep:1
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
// 作业类型
|
|||
|
|
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,
|
|||
|
|
templateResult: function formatRepo(repo) {
|
|||
|
|
return repo.text;
|
|||
|
|
}, // 函数用来渲染结果
|
|||
|
|
templateSelection: function formatRepoSelection(repo) {
|
|||
|
|
return repo.text;
|
|||
|
|
} // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var fileinput = function () {
|
|||
|
|
$('#file').click();
|
|||
|
|
};
|
|||
|
|
var filedel = function (index) {
|
|||
|
|
fileList.splice(index,1)
|
|||
|
|
$('#test').html(initFileInputView())
|
|||
|
|
};
|
|||
|
|
var fileSelected = function () {
|
|||
|
|
fileList.push(...$('#file')[0].files)
|
|||
|
|
$('#test').html(initFileInputView())
|
|||
|
|
};
|
|||
|
|
var initFileInputView = function () {
|
|||
|
|
let button = (index) => {
|
|||
|
|
return `<button type="button" class="btn btn-default btn-file" style="position: fixed;right: 193px;height: 24px;width:24px;padding-top:2px;margin-top: 3px"
|
|||
|
|
id="btn_save1" onclick="filedel(`+index+`)">
|
|||
|
|
<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" id="fileName" class="form-control" name="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 saveFun() {
|
|||
|
|
$("#addForm").data("bootstrapValidator").updateStatus("competentDeptName","NOT_VALIDATED", null).validateField("competentDeptName");
|
|||
|
|
$("#addForm").data("bootstrapValidator").updateStatus("projectBeginDate","NOT_VALIDATED", null).validateField("projectBeginDate");
|
|||
|
|
$("#addForm").data("bootstrapValidator").updateStatus("projectEndDate","NOT_VALIDATED", null).validateField("projectEndDate");
|
|||
|
|
$("#addForm").data("bootstrapValidator").updateStatus("dutyUserName","NOT_VALIDATED", null).validateField("dutyUserName");
|
|||
|
|
|
|||
|
|
$("#addForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
var formData = new FormData($("#addForm")[0]);
|
|||
|
|
$.ajax({
|
|||
|
|
url: ext.contextPath + "/safety/SafetyJobOutside/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/SafetyJobOutside/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) {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
$("#addForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
jobType: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '作业类型不能为空。'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
jobLocation: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '作业地点不能为空。'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
jobCompany: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '作业单位不能为空。'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
competentDeptName: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '主管部门不能为空。'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
projectBeginDate: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '开始时间不能为空。'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
projectEndDate: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '结束时间不能为空。'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
dutyUserName: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '作业负责人不能为空。'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
contact: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '联系方式不能为空。'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
jobContent: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '作业内容不能为空。'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
competentAdvice: {
|
|||
|
|
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">
|
|||
|
|
<!-- 新增界面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 select2" 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="请选择.." readonly 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">
|
|||
|
|
<input type="text" id="projectBeginDate" name="projectBeginDate" class="form-control"
|
|||
|
|
placeholder="请选择..">
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<label class="col-sm-2 control-label ">*结束时间</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" id="projectEndDate" name="projectEndDate" class="form-control"
|
|||
|
|
placeholder="请选择..">
|
|||
|
|
</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="请选择.." readonly 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">
|
|||
|
|
<textarea class="form-control" id="jobContent" name="jobContent" laceholder="请输入"></textarea>
|
|||
|
|
</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-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-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>
|