255 lines
11 KiB
Plaintext
255 lines
11 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;
|
||
}
|
||
</style>
|
||
<script type="text/javascript">
|
||
var key = ''
|
||
var old = ''
|
||
$(function () {
|
||
var selelct_3Data = jQuery.parseJSON('${periodTypeList}');
|
||
var selelct_3 = $("#status2").select2({
|
||
data: selelct_3Data,
|
||
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'})
|
||
selelct_3.val('').trigger("change");
|
||
|
||
var selelct_4Data = jQuery.parseJSON('${positionTypeList}');
|
||
var selelct_4 = $("#status3").select2({
|
||
data: selelct_4Data,
|
||
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'})
|
||
selelct_4.val('').trigger("change");
|
||
|
||
|
||
//TODO 代码有冲突
|
||
key = setInterval(() => {
|
||
// console.log(document.getElementById('objUserName'))
|
||
if ($('#objUserId').val() != old) {
|
||
onValueChange()
|
||
old = $('#objUserId').val()
|
||
}
|
||
|
||
if ($('#subModal').is(':hidden')) {
|
||
clearInterval(key)
|
||
}
|
||
}, 500)
|
||
});
|
||
|
||
|
||
function saveFun() {
|
||
//console.log($("#addForm").serialize());
|
||
$("#addForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#addForm").data('bootstrapValidator').isValid()) {
|
||
//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/kpi/kpiPlan/save.do", $("#addForm").serialize() + "&check=1", function (data) {
|
||
if (data.code == -1) {
|
||
showAlert('d', data.msg, 'mainAlertdiv');
|
||
} else if (data.code == 0) {
|
||
showAlert('d', '用户信息保存失败', 'mainAlertdiv');
|
||
} else if (data.code == 2) {
|
||
swal({
|
||
text: data.creater + "已为该考核对象创建了考核方案,是否继续添加该考核对象",
|
||
dangerMode: true,
|
||
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
|
||
}
|
||
}
|
||
}).then(willCreate => {
|
||
if (willCreate) {
|
||
$.post(ext.contextPath + "/kpi/kpiPlan/save.do", $("#addForm").serialize() + "&check=0", function (data) {
|
||
if (data.code == 0) {
|
||
showAlert('d', '保存失败', 'mainAlertdiv');
|
||
} else {
|
||
$("#table").bootstrapTable('refresh');
|
||
closeModal('subModal');
|
||
}
|
||
})
|
||
}
|
||
})
|
||
} else {
|
||
$("#table").bootstrapTable('refresh');
|
||
closeModal('subModal');
|
||
}
|
||
}, 'json');
|
||
}
|
||
}
|
||
|
||
$("#addForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
objUserName: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
jobId: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '周期类型不能为空'
|
||
}
|
||
}
|
||
},
|
||
periodType: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '周期类型不能为空'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
function showUser4OneSelectFun() {
|
||
$.post(ext.contextPath + '/user/userForOneSelect.do',
|
||
{formId: "addForm", hiddenId: "objUserId", textId: "objUserName"},
|
||
function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal('user4SelectModal');
|
||
});
|
||
}
|
||
|
||
function onValueChange() {
|
||
// console.log($('#objUserId').val())
|
||
$.post(ext.contextPath + "/user/getJsonJobByUser.do?userId=" + $('#objUserId').val(), function (data) {
|
||
$("#jobId").select2({
|
||
data: 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;
|
||
} // 函数用于呈现当前的选择
|
||
});
|
||
},'json');
|
||
}
|
||
|
||
function positionSelect() {
|
||
$.post(ext.contextPath + '/kpi/kpiPlan/positionSelect.do',
|
||
{formId: "addForm", hiddenId: "position", textId: "position"},
|
||
function (data) {
|
||
$("#position4Select").html(data);
|
||
openModal('position4Select');
|
||
});
|
||
}
|
||
|
||
</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强制为addForm -->
|
||
<form class="form-horizontal" id="addForm">
|
||
<input type="hidden" name="unitId" value="${unitId}" />
|
||
<div id="alertDiv"></div>
|
||
<div id="mainAlertdiv"></div>
|
||
<%-- <input type="hidden" name="id" value="${user.id }" />--%>
|
||
<!-- 界面提醒div强制id为alertdiv -->
|
||
<div class="col-md-12">
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">* 姓名:</label>
|
||
<div class="col-sm-9">
|
||
<input type="text" id="objUserName" name="objUserName" class="form-control"
|
||
placeholder="请输入文本" onclick="showUser4OneSelectFun();"
|
||
onchange="onValueChange()"/>
|
||
<input type="hidden" id="objUserId" name="objUserId" class="form-control"/>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">* 岗位:</label>
|
||
<div class="col-sm-9">
|
||
<select class="form-control" id="jobId" name="jobId"></select>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-3 control-label">* 周期类型:</label>
|
||
<div class="col-sm-9">
|
||
<select class="form-control" name="periodType" id="status2" style="width: 100%;">
|
||
<%-- <option value="1">启用</option>--%>
|
||
<%-- <option value="0">停用</option>--%>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
||
<security:authorize buttonUrl="kpi/kpiPlan/save.do">
|
||
<button type="button" class="btn btn-primary" onclick="saveFun()">保存</button>
|
||
</security:authorize>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div> |