175 lines
6.8 KiB
Plaintext
175 lines
6.8 KiB
Plaintext
<%--
|
||
Created by IntelliJ IDEA.
|
||
User: limo
|
||
Date: 2021/10/19
|
||
Time: 上午9:17
|
||
To change this template use File | Settings | File Templates.
|
||
--%>
|
||
<!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 old = ''
|
||
function jobList() {
|
||
$.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 saveFun() {
|
||
//console.log($("#addForm").serialize());
|
||
$("#addForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/kpi/kpiPlan/copySave.do", $("#addForm").serialize(), function (data) {
|
||
if (data.res == 0) {
|
||
showAlert('d', '用户信息保存失败');
|
||
} else {
|
||
$("#table").bootstrapTable('refresh');
|
||
closeModal('subModal');
|
||
}
|
||
}, 'json');
|
||
}
|
||
}
|
||
|
||
$("#addForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
objUserName: {
|
||
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 positionSelect() {
|
||
$.post(ext.contextPath + '/kpi/kpiPlan/positionSelect.do',
|
||
{formId: "addForm", hiddenId: "position", textId: "position"},
|
||
function (data) {
|
||
$("#position4Select").html(data);
|
||
openModal('position4Select');
|
||
});
|
||
}
|
||
|
||
$(function (){
|
||
var key = setInterval(()=>{
|
||
if ($('#objUserId').val()!=old){
|
||
jobList()
|
||
old = $('#objUserId').val()
|
||
}
|
||
if ($('#subModal').is(':hidden')){
|
||
clearInterval(key)
|
||
}
|
||
},500)
|
||
})
|
||
|
||
</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="id" value="${kpiPlan.id}"/>
|
||
|
||
<div id="alertDiv"></div>
|
||
<%--
|
||
<input type="hidden" name="id" value="${String.id }" />
|
||
--%>
|
||
<!-- 界面提醒div强制id为alertdiv -->
|
||
<div class="col-md-12">
|
||
<%-- <span id="userInfo">--%>
|
||
<%-- </span>--%>
|
||
<%-- <div class="form-group">--%>
|
||
<%-- <label class="col-sm-3 control-label">* 复制对象:</label>--%>
|
||
<%-- <div class="col-sm-9">--%>
|
||
<%-- <input type="text" id="caption" name="caption" class="form-control" placeholder=""--%>
|
||
<%-- value="${kpiPlan.caption}">--%>
|
||
<%-- <input type="hidden" id="id" name="id" class="form-control"/>--%>
|
||
<%-- </div>--%>
|
||
<%-- </div>--%>
|
||
<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="jobList()"/>
|
||
<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>
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
||
<security:authorize buttonUrl="kpi/kpiPlan/copySave.do">
|
||
<button type="button" class="btn btn-primary" onclick="saveFun()">保存</button>
|
||
</security:authorize>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|
||
|