181 lines
6.6 KiB
Plaintext
181 lines
6.6 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" import="java.util.*" 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">
|
|||
|
|
function saveUserFun() {
|
|||
|
|
//console.log($("#addForm").serialize());
|
|||
|
|
$("#addForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/user/saveUser.do", $("#addForm").serialize(), function (data) {
|
|||
|
|
if (data.res == 1) {
|
|||
|
|
//保存权限
|
|||
|
|
var val = $('#_roles').val();
|
|||
|
|
console.log("val", val);
|
|||
|
|
var rolestr = "";
|
|||
|
|
if (val != null) {
|
|||
|
|
$.each(val, function (index, value, array) {
|
|||
|
|
if (rolestr != "") {
|
|||
|
|
rolestr += ","
|
|||
|
|
}
|
|||
|
|
rolestr += value;
|
|||
|
|
});
|
|||
|
|
$.post(ext.contextPath + "/user/updateRoleUser.do", { rolestr: rolestr, userid: data.id }, function (data1) {
|
|||
|
|
if (data1 < 0) {
|
|||
|
|
showAlert('d', '权限保存失败');
|
|||
|
|
} else {
|
|||
|
|
closeModal('subModal');
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
closeModal('subModal');
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
}
|
|||
|
|
} else if (data.res == 0) {
|
|||
|
|
showAlert('d', '用户信息保存失败');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', data.res);
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$("#addForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
name: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '登陆名不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
_pname: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '公司/部门不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
_roles: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '权限不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
var showUnit4SelectFun = function () {
|
|||
|
|
$.post(ext.contextPath + '/user/showUnit4Select_Limited.do', { formId: "addForm", hiddenId: "pid", textId: "_pname" }, function (data) {
|
|||
|
|
$("#unit4SelectDiv").html(data);
|
|||
|
|
openModal("unit4SelectModal_Limited");
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function loadUser() {
|
|||
|
|
$.post(ext.contextPath + "/user/selectUserForMsgAlarmlevel.do", function (data) {
|
|||
|
|
var select = $("#_powers").select2({
|
|||
|
|
data: data,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
allowClear: false,//允许清空
|
|||
|
|
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; } // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
}, 'json');
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
$(function () {
|
|||
|
|
$.fn.modal.Constructor.prototype.enforceFocus = function () { }
|
|||
|
|
$.get(ext.contextPath + "/process/dataVisualFrame/getJson.do",function(data){
|
|||
|
|
var select = $("#pid").select2({
|
|||
|
|
data: data,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
allowClear: true,//允许清空
|
|||
|
|
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: -1,//数据超过十个启用搜索框
|
|||
|
|
multiple: false,
|
|||
|
|
formatResult: function formatRepo(repo) {return repo.text; }, // 函数用来渲染结果
|
|||
|
|
formatSelection: function formatRepoSelection(repo) {console.log(repo); return repo.text; } // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
},'json');
|
|||
|
|
loadUser();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
/*function showPositionSystemUsers(){
|
|||
|
|
|
|||
|
|
}*/
|
|||
|
|
</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">
|
|||
|
|
<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">
|
|||
|
|
<input type="text" class="form-control" id="name" name="name" placeholder="区域名称" value="" style="border-radius:4px">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*所属画面</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<select class="form-control select2" id="pid" name="pid" style="width: 100%;">
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">权限</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<select class="form-control select2" id="_powers" name="powerids" 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" rows="2" id ="remarks" name ="remarks" placeholder="备注...">${areaManage.remarks}</textarea> </select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-footer">
|
|||
|
|
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
|||
|
|
<button type="button" class="btn btn-primary" onclick="saveUserFun()">保存</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|