first commit
This commit is contained in:
85
WebRoot/jsp/user/bonusPointList.jsp
Normal file
85
WebRoot/jsp/user/bonusPointList.jsp
Normal file
@ -0,0 +1,85 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
$("#table_bonusPoints").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/bonuspoint/getBonusPoints.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_pid: '${param.maintenanceId}'
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'reason', // 返回json数据中的name
|
||||
title: '内容', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
},{
|
||||
field: 'insdt', // 返回json数据中的name
|
||||
title: '获得时间', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter:function(value,row,index){
|
||||
return row.insdt.substring(0,16)
|
||||
}
|
||||
},{
|
||||
field: 'point', // 返回json数据中的name
|
||||
title: '值', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter:function(value,row,index){
|
||||
if(row.point>0){
|
||||
return '+'+row.point
|
||||
}else if(row.point<0){
|
||||
return row.point
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
// adjustBootstrapTableView("table_bonusPoints");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<div class="modal fade" id="bonusPointModal">
|
||||
<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">
|
||||
<table id="table_bonusPoints"></table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
52
WebRoot/jsp/user/company4select.jsp
Normal file
52
WebRoot/jsp/user/company4select.jsp
Normal file
@ -0,0 +1,52 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<script type="text/javascript">
|
||||
var selectcompany = function () {
|
||||
alert('${param.hiddenId}' + '${param.textId}');
|
||||
}
|
||||
$(function () {
|
||||
$.post(ext.contextPath + '/user/getUnitForTree.do', { ng: '' }, function (data) {
|
||||
// console.info(data);
|
||||
if (data.length > 0) {
|
||||
$('#company_select_tree').treeview({
|
||||
data: data,
|
||||
});
|
||||
$('#company_select_tree').on('nodeSelected', function (event, data) {
|
||||
$('#${param.formId} #${param.hiddenId}').val(data.id);
|
||||
$('#${param.formId} #${param.textId}').val(data.text);
|
||||
//更新权限选择框
|
||||
if ($('#_roles').length > 0) {
|
||||
$('#_roles').empty();
|
||||
showRoleSelectFun();
|
||||
}
|
||||
//更新工艺段选择框
|
||||
if ($('#_process').length > 0) {
|
||||
$('#_process').empty();
|
||||
showProcessSelectFun();
|
||||
}
|
||||
closeModal("company4SelectModal");
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="company4SelectModal">
|
||||
<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">
|
||||
<div id="company_select_tree" style="height:430px;overflow:auto;width:100%"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<!-- <button type="button" class="btn btn-primary" onclick="selectcompany()">保存</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
187
WebRoot/jsp/user/companyAdd.jsp
Normal file
187
WebRoot/jsp/user/companyAdd.jsp
Normal file
@ -0,0 +1,187 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
|
||||
<%request.setAttribute("UNIT_TYPE_BIZ",com.sipai.tools.CommString.UNIT_TYPE_BIZ);%>
|
||||
<%request.setAttribute("UNIT_TYPE_DEPT",com.sipai.tools.CommString.UNIT_TYPE_DEPT);%>
|
||||
<%request.setAttribute("Flag_Active",com.sipai.tools.CommString.Flag_Active);%>
|
||||
<%request.setAttribute("Flag_Unactive",com.sipai.tools.CommString.Flag_Unactive);%>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title></title>
|
||||
<script type="text/javascript">
|
||||
function doSaveCompany() {
|
||||
$("#companyAddForm").data('bootstrapValidator').resetForm();
|
||||
$("#companyAddForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#companyAddForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/saveCompany.do", $("#companyAddForm").serialize(), function (data) {
|
||||
//console.log("data",data);
|
||||
if (data.res == "1") {
|
||||
initTreeView();
|
||||
} else {
|
||||
showAlert('d', '保存失败');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
|
||||
$("#companyAddForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
longitude: {
|
||||
validators: {
|
||||
regexp: {
|
||||
regexp: /^(([^0][0-9]+|0)\.([0-9]{1,2}))$/,
|
||||
message: '请输入正确的经度'
|
||||
}
|
||||
}
|
||||
},
|
||||
latitude: {
|
||||
validators: {
|
||||
regexp: {
|
||||
regexp: /^(([^0][0-9]+|0)\.([0-9]{1,2}))$/,
|
||||
message: '请输入正确的纬度'
|
||||
}
|
||||
}
|
||||
},
|
||||
ename: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '英文编码不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
morder: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '顺序不能为空'
|
||||
},
|
||||
regexp: {
|
||||
regexp: /^[0-9]*$/,
|
||||
message: '顺序必须为数字'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var showCompanySelectFun = function () {
|
||||
$.post(ext.contextPath + '/user/showCompany4Select.do', { formId: "companyAddForm", hiddenId: "pid", textId: "_pname" }, function (data) {
|
||||
$("#company4SelectDiv").html(data);
|
||||
openModal('company4SelectModal');//待加
|
||||
});
|
||||
};
|
||||
|
||||
$(function () {
|
||||
$("#active").select2({ minimumResultsForSearch: 10 }).val("${Flag_Active}").trigger("change");
|
||||
fixSelect2ToForm("active");
|
||||
//若要添加水厂 id手动输入
|
||||
if ("${type}" == "${UNIT_TYPE_BIZ}") {
|
||||
document.getElementById('biz_id').style.display = 'block';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">新增</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<a onclick="doSaveCompany()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
||||
class="glyphicon glyphicon-floppy-disk"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body ">
|
||||
<form class="form-horizontal " id="companyAddForm">
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div id="company4SelectDiv"></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="name" name="name" placeholder="名称" value=""
|
||||
style="border-radius:4px">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*上级</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="_pname" name="_pname" placeholder="上级"
|
||||
style="border-radius:4px;background-color: white;" readonly onclick="showCompanySelectFun();"
|
||||
value="${pname}">
|
||||
<input id="pid" name="pid" type="hidden" value="${param.pid}" />
|
||||
</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="sname" name="sname" placeholder="简称" value=""
|
||||
style="border-radius:4px" />
|
||||
<input id="type" name="type" type="hidden" value="${type}" />
|
||||
</div>
|
||||
<div id="biz_id" style="display:none;">
|
||||
<label class="col-sm-2 control-label">水厂编号</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="id" name="id" placeholder="编号" value=""
|
||||
style="border-radius:4px" />
|
||||
</div>
|
||||
</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="longitude" name="longitude" placeholder="经度"
|
||||
style="border-radius:4px" value="">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">纬度</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="latitude" name="latitude" placeholder="纬度"
|
||||
style="border-radius:4px;" 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="address" name="address" placeholder="地址" value=""
|
||||
style="border-radius:4px">
|
||||
</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="ename" name="ename" placeholder="规则编码"
|
||||
style="border-radius:4px" value="">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*城市</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="city" name="city" placeholder="城市"
|
||||
style="border-radius:4px" value="">
|
||||
</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="morder" name="morder" placeholder="顺序" value=""
|
||||
style="border-radius:4px">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">启用</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="active" name="active" class="form-control select2">
|
||||
<option value="${Flag_Active}">启用</option>
|
||||
<option value="${Flag_Unactive}">禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
627
WebRoot/jsp/user/companyEdit.jsp
Normal file
627
WebRoot/jsp/user/companyEdit.jsp
Normal file
@ -0,0 +1,627 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
|
||||
<%request.setAttribute("UNIT_TYPE_BIZ",com.sipai.tools.CommString.UNIT_TYPE_BIZ);%>
|
||||
<%request.setAttribute("UNIT_TYPE_DEPT",com.sipai.tools.CommString.UNIT_TYPE_DEPT);%>
|
||||
<%request.setAttribute("Flag_Active",com.sipai.tools.CommString.Flag_Active);%>
|
||||
<%request.setAttribute("Flag_Unactive",com.sipai.tools.CommString.Flag_Unactive);%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<script type="text/javascript">
|
||||
/*** 上半部分 */
|
||||
var showCompany4SelectFun = function () {
|
||||
$.post(ext.contextPath + '/user/showCompany4Select.do', { formId: "companyForm", hiddenId: "pid", textId: "_pname" }, function (data) {
|
||||
$("#company4SelectDiv").html(data);
|
||||
openModal("company4SelectModal");
|
||||
});
|
||||
};
|
||||
|
||||
var showCompany4Library = function () {
|
||||
$.post(ext.contextPath + '/user/showCompany4Select.do', { formId: "companyForm", hiddenId: "libraryBizid", textId: "_bizid" }, function (data) {
|
||||
$("#company4SelectDiv").html(data);
|
||||
openModal("company4SelectModal");
|
||||
});
|
||||
};
|
||||
|
||||
var floorTbName = "TB_TimeEfficiency_PatrolArea_Floor_file";
|
||||
var showUnit4SelectCopyFun = function () {
|
||||
$.post(ext.contextPath + '/user/showUnit4Select_Limited.do', { formId: "companyForm", hiddenId: "copyId", textId: "copyName" }, function (data) {
|
||||
$("#unit4SelectCopyDiv").html(data);
|
||||
openModal("unit4SelectModal_Limited");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$("#companyForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
longitude: {
|
||||
validators: {
|
||||
/*notEmpty: {
|
||||
message: '经度不能为空'
|
||||
},*/
|
||||
regexp: {
|
||||
regexp: /^(([^0][0-9]+|0)\.([0-9]{1,10})$)|^([^0][0-9]+|0)$/,
|
||||
message: '请输入正确的经度'
|
||||
}
|
||||
}
|
||||
},
|
||||
latitude: {
|
||||
validators: {
|
||||
/*notEmpty: {
|
||||
message: '纬度不能为空'
|
||||
},*/
|
||||
regexp: {
|
||||
regexp: /^(([^0][0-9]+|0)\.([0-9]{1,10})$)|^([^0][0-9]+|0)$/,
|
||||
message: '请输入正确的纬度'
|
||||
}
|
||||
}
|
||||
},
|
||||
ename: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '英文编码不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
morder: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '顺序不能为空'
|
||||
},
|
||||
regexp: {
|
||||
regexp: /^[0-9]*$/,
|
||||
message: '顺序必须为数字'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function doSaveCompany() {
|
||||
$("#companyForm").data('bootstrapValidator').resetForm();
|
||||
$("#companyForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#companyForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/updateCompany.do", $("#companyForm").serialize(), function (data) {
|
||||
if (data.res == "1") {
|
||||
initTreeView();
|
||||
} else {
|
||||
showAlert('d', '保存失败');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
|
||||
function delCompany() {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(willDelete => {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/deleteCompany.do', $("#companyForm").serialize(), function (data) {
|
||||
if (data.res > 0) {
|
||||
showAlert('s', '删除成功');
|
||||
initTreeView();
|
||||
} else {
|
||||
showAlert('d', '删除失败');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//文件导入
|
||||
var fileinput = function () {
|
||||
//var url='/maintenance/updateProblemFile.do';//保存数据表方法
|
||||
$.post(ext.contextPath + '/base/fileinput.do', { masterId: masterId, tbName: tbName, nameSpace: nameSpace }, function (data) {
|
||||
$("#fileInputDiv").html(data);
|
||||
openModal('fileInputModal');
|
||||
});
|
||||
};
|
||||
var masterId = $('#id').val();
|
||||
var tbName = 'tb_company_file'; //数据表
|
||||
var nameSpace = 'CompanyFile';//保存文件夹
|
||||
var previews = new Array();
|
||||
var previewConfigs = new Array();
|
||||
/* var student = {
|
||||
"caption":"lilei",
|
||||
|
||||
}
|
||||
previewConfigs[0]=student; */
|
||||
//初始化fileinput控件(第一次初始化)
|
||||
function showFileInput(ctrlName) {
|
||||
var control = $('#' + ctrlName);
|
||||
|
||||
control.fileinput('destroy');
|
||||
control.fileinput({
|
||||
language: 'zh', //设置语言
|
||||
showUpload: false, //是否显示上传按钮
|
||||
showRemove: false,
|
||||
showCaption: false,//是否显示标题
|
||||
showBrowse: false,//选择按钮
|
||||
showClose: false,//右上角关闭按钮
|
||||
dropZoneEnabled: false,//是否显示拖拽区域
|
||||
fileActionSettings: {
|
||||
showDrag: false
|
||||
},
|
||||
browseClass: "btn btn-primary", //按钮样式
|
||||
maxFileCount: 10, //表示允许同时上传的最大文件个数
|
||||
enctype: 'multipart/form-data',
|
||||
validateInitialCount: true,
|
||||
previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
|
||||
initialPreviewAsData: true,
|
||||
initialPreview: previews,
|
||||
initialPreviewConfig: previewConfigs,
|
||||
layoutTemplates: {
|
||||
actionUpload: ''
|
||||
},
|
||||
deleteUrl: ext.contextPath + "/base/deleteInputFile.do",
|
||||
deleteExtraData: function () { //传参
|
||||
var data = {
|
||||
"tbName": tbName
|
||||
};
|
||||
return data;
|
||||
}
|
||||
});
|
||||
$('#kvFileinputModal').on("hidden.bs.modal", function () {
|
||||
$(this).removeData("bs.modal");
|
||||
//modal重复打开会导致前面的滚动条失去作用
|
||||
$('.modal').css("overflow", "auto");
|
||||
});
|
||||
}
|
||||
//名称定义不可修改
|
||||
var getFileList = function () {
|
||||
$.post(ext.contextPath + '/base/getInputFileList.do', { masterId: masterId, tbName: tbName }, function (data) {
|
||||
//console.info(data)
|
||||
previews = new Array();
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var path = data[i].abspath;
|
||||
path = path.substring(path.indexOf('webapps') + 7, path.length);
|
||||
path = ext.basePath.replace(ext.contextPath, '') + path.replace(/\\/g, "\/");;
|
||||
if (data[i].type.indexOf("audio") != -1) {
|
||||
var id = data[i].id;
|
||||
var blob = path;
|
||||
//console.info(blob)
|
||||
if ($("#" + id).length > 0) {
|
||||
continue;
|
||||
}
|
||||
recblob[id] = { blob: blob, rec: rec };
|
||||
|
||||
reclog('<div class="form-group" id=' + id + '> ' + data[i].insdt.substring(0, 16) + '录制 ' +
|
||||
'<div class="btn-group">' +
|
||||
'<button class="btn btn-primary btn-sm" onclick="recplay(\'' + id + '\')" type="button"><i class="fa fa-play " ></i></button>' +
|
||||
'<button class="btn btn-danger btn-sm" onclick="deleteFIleInput(\'' + id + '\')" type="button"><i class="fa fa-remove "></i></button>' +
|
||||
'</div>' +
|
||||
'</div>');
|
||||
} else {
|
||||
var previewConfig = new Object();
|
||||
|
||||
previews.push(path);
|
||||
previewConfig['width'] = '50px';
|
||||
previewConfig['caption'] = data[i].filename;
|
||||
previewConfig['key'] = data[i].id;
|
||||
previewConfigs.push(previewConfig);
|
||||
}
|
||||
|
||||
}
|
||||
if (previews.length > 0) {
|
||||
$('#companyfile').show();
|
||||
showFileInput("companyfile");
|
||||
} else {
|
||||
$('#companyfile').hide();
|
||||
}
|
||||
|
||||
}, 'json');
|
||||
|
||||
};
|
||||
|
||||
/*** 下半部分 */
|
||||
var addUserFun = function () {
|
||||
$.post(ext.contextPath + '/user/addUser.do', {}, function (data) {
|
||||
$("#userDiv").html(data + "<div id='unit4SelectDiv'></div> ");
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
var delUserFun = function () {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||||
} else {
|
||||
swal({
|
||||
text: "您确定要禁用这些用户吗?",
|
||||
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(willDelete => {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/deleteUsers.do', { ids: datas }, function (data) {
|
||||
if (data > 0) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '禁用失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var editUserFun = function (id) {
|
||||
$.post(ext.contextPath + '/user/editUser.do', { id: id }, function (data) {
|
||||
$("#userDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
//重置密码
|
||||
var pwdFun = function (id) {
|
||||
swal({
|
||||
text: "您确定要重置密码吗?",
|
||||
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(willDelete => {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/resetPassword.do', { id: id }, function (data) {
|
||||
if (data == 1) {
|
||||
showAlert('s', '重置成功', 'mainAlertdiv');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '重置失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$("#copyPatrolForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
copyName: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '复制模板不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$('#saveBtn').on('click', function () {
|
||||
$("#copyPatrolForm").data('bootstrapValidator').resetForm();
|
||||
$("#copyPatrolForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#copyPatrolForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
var $btn = $(this).button('loading');
|
||||
$.post(ext.contextPath + '/timeEfficiency/patrolModel/setDefaultPatrol.do', { oldCompanyId: $('#copyId').val(), newCompanyId: "${company.id}", tbName: floorTbName }, function (data) {
|
||||
if (data.res == 1) {
|
||||
$btn.button('reset');
|
||||
showAlert('s', '模板巡检复制成功');
|
||||
} else {
|
||||
$btn.button('reset');
|
||||
showAlert('d', '模板巡检复制失败');
|
||||
}
|
||||
|
||||
}, 'json');
|
||||
}
|
||||
})
|
||||
$("#active").select2({ minimumResultsForSearch: 10 }).val("${company.active}").trigger("change");
|
||||
fixSelect2ToForm("active");
|
||||
$("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUsersById.do?id=${company.id}', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order // 排序规则
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [/*{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
},*/
|
||||
{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '登录名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'caption', // 返回json数据中的name
|
||||
title: '姓名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'sex', // 返回json数据中的name
|
||||
title: '性别', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
if (value == '0') {
|
||||
return '女';
|
||||
} else {
|
||||
return '男';
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: '_pname', // 返回json数据中的name
|
||||
title: '公司/部门', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'active', // 返回json数据中的name
|
||||
title: '状态', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
switch (value) {
|
||||
case '0':
|
||||
return '禁用';
|
||||
case '1':
|
||||
return '启用';
|
||||
case '2':
|
||||
return '退休';
|
||||
case '3':
|
||||
return '离职';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
}/*,{
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
// width: 60, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var str = '';
|
||||
str+='<button class="btn btn-default btn-sm" title="编辑" onclick="editUserFun(\'' + row.id + '\')"><i class="fa fa-edit"></i></button>';
|
||||
str+='<button class="btn btn-default btn-sm" title="重置密码" onclick="pwdFun(\'' + row.id + '\')"><i class="fa fa-repeat"></i></button>';
|
||||
str='<div class="btn-group" >'+str+'</div>';
|
||||
return str;
|
||||
/* return '<i class="fa fa-edit" onclick="editFun()(\'' + row.id + '\')></i>';
|
||||
}
|
||||
}*/
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
$(".bs-checkbox").css({ 'text-align': 'center', 'vertical-align': 'middle' })
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
getFileList();
|
||||
|
||||
});
|
||||
</script>
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">详情</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<a onclick="doSaveCompany()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
||||
class="glyphicon glyphicon-floppy-disk"></i></a>
|
||||
<security:authorize buttonUrl="user/deleteCompany.do">
|
||||
<a onclick="delCompany()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i
|
||||
class="glyphicon glyphicon-trash"></i></a>
|
||||
</security:authorize>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<form class="form-horizontal " id="companyForm">
|
||||
<input id="id" name="id" type="hidden" value="${company.id}" />
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div id="company4SelectDiv"></div>
|
||||
<div id="unit4SelectCopyDiv"></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="name" name="name" placeholder="名称"
|
||||
style="border-radius:4px" value="${company.name }">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*上级</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="_pname" name="_pname" placeholder="上级"
|
||||
style="border-radius:4px;background-color: white;" onclick="showCompany4SelectFun();"
|
||||
value="${pname}" readonly>
|
||||
<input id="pid" name="pid" type="hidden" value="${company.pid}" />
|
||||
</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="sname" name="sname" placeholder="简称"
|
||||
style="border-radius:4px" value="${company.sname}">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*所属标准库层级</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="_bizid" name="_bizid" placeholder="所属标准库层级"
|
||||
style="border-radius:4px;background-color: white;" onclick="showCompany4Library();"
|
||||
value="${_bizid}" readonly>
|
||||
<input id="libraryBizid" name="libraryBizid" type="hidden" value="${company.libraryBizid}" />
|
||||
</div>
|
||||
<!-- <div id="biz_id" style="display:none;">
|
||||
<label class="col-sm-2 control-label">水厂编号</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="id" name ="id" placeholder="编号" value="" />
|
||||
</div>
|
||||
</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="longitude" name="longitude" placeholder="经度"
|
||||
style="border-radius:4px" value="${company.longitude}">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">纬度</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="latitude" name="latitude" placeholder="纬度"
|
||||
style="border-radius:4px;" value="${company.latitude}">
|
||||
</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="address" name="address" placeholder="地址"
|
||||
style="border-radius:4px" value="${company.address}">
|
||||
</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="ename" name="ename" placeholder="规则编码"
|
||||
style="border-radius:4px" value="${company.ename}">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*城市</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="city" name="city" placeholder="城市"
|
||||
style="border-radius:4px" value="${company.city}">
|
||||
</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="morder" name="morder" placeholder="顺序"
|
||||
style="border-radius:4px" value="${company.morder}">
|
||||
</div>
|
||||
<security:authorize buttonUrl="user/deleteCompany.do">
|
||||
<label class="col-sm-2 control-label">启用</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="active" name="active" class="form-control select2">
|
||||
<!-- <option value="${Flag_Issued}" <c:if test="${prodtask.runstatus==Flag_Issued}">selected</c:if>>下达</option> -->
|
||||
<option value="${Flag_Active}">启用</option>
|
||||
<option value="${Flag_Unactive}">禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</security:authorize>
|
||||
</div>
|
||||
|
||||
<%--<div class="form-group">
|
||||
<security:authorize buttonUrl="timeEfficiency/patrolModel/setDefaultPatrol.do">
|
||||
<label class="col-sm-2 control-label">巡检配置复制</label>
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="copyName" name="copyName" placeholder="复制对象公司"
|
||||
style="border-radius:4px;background-color:white;width:100%"
|
||||
onclick="showUnit4SelectCopyFun();" value="" readonly />
|
||||
<span class="input-group-btn">
|
||||
<button type="button" id="saveBtn" data-loading-text="加载中..." class="btn btn-primary"
|
||||
autocomplete="off">保存</button></span>
|
||||
</div>
|
||||
<input id="copyId" name="copyId" type="hidden" value="" />
|
||||
</div>
|
||||
</security:authorize>
|
||||
</div>--%>
|
||||
</form>
|
||||
<form class="form-horizontal " id="copyPatrolForm">
|
||||
<div class="form-group" style="margin:8px">
|
||||
<label class="col-sm-2 control-label"></label>
|
||||
<button type="button" class="btn btn-default btn-file btn-sm" onclick="fileinput()" id="btn_save"><i
|
||||
class="fa fa-paperclip"></i> 上传图片</button>
|
||||
</div>
|
||||
<div class="form-group" style="margin:8px;">
|
||||
<input type="file" name="companyfile" id="companyfile" multiple class="file-loading" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-solid">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">人员</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<div>
|
||||
<div id="alertDiv_user"></div>
|
||||
<!--
|
||||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<button type="button" class="btn btn-default" onclick="addUserFun();"><i class="fa fa-plus"></i> 新增</button>
|
||||
<button type="button" class="btn btn-default" onclick="delUserFun();"><i class="fa fa-plus-square"></i> 删除</button>
|
||||
|
||||
</div>-->
|
||||
<div id="userDiv"></div>
|
||||
<div id="user4SelectDiv_func"></div>
|
||||
<br>
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
214
WebRoot/jsp/user/companyManage.jsp
Normal file
214
WebRoot/jsp/user/companyManage.jsp
Normal file
@ -0,0 +1,214 @@
|
||||
<%@ 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"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<%request.setAttribute("UNIT_TYPE_BIZ",com.sipai.tools.CommString.UNIT_TYPE_BIZ);%>
|
||||
<%request.setAttribute("UNIT_TYPE_COMPANY",com.sipai.tools.CommString.UNIT_TYPE_COMPANY);%>
|
||||
<%request.setAttribute("UNIT_TYPE_DEPT",com.sipai.tools.CommString.UNIT_TYPE_DEPT);%>
|
||||
|
||||
<%request.setAttribute("Flag_Active",com.sipai.tools.CommString.Flag_Active);%>
|
||||
<%request.setAttribute("Flag_Unactive",com.sipai.tools.CommString.Flag_Unactive);%>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<!-- 文件上传-->
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css" />
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
var nodeid = "-1";//树指针的全局变量
|
||||
var addCompanyFun = function (type) {
|
||||
/*var node=$('#companytree').treeview('getSelected');
|
||||
var pid="";
|
||||
if(node!=null && node.length>0){
|
||||
pid=node[0].id;
|
||||
}*/
|
||||
$.post(ext.contextPath + '/user/showCompanyAdd.do', { pid: nodeid, type: type }, function (data) {
|
||||
$("#companyBox").html(data);
|
||||
});
|
||||
};
|
||||
var addDeptFun = function (type) {
|
||||
/*var node=$('#companytree').treeview('getSelected');
|
||||
var pid="";
|
||||
if(node!=null && node.length>0){
|
||||
pid=node[0].id;
|
||||
}*/
|
||||
$.post(ext.contextPath + '/user/showDeptAdd.do', { pid: nodeid }, function (data) {
|
||||
$("#companyBox").html(data);
|
||||
});
|
||||
};
|
||||
var editFun = function (id) {
|
||||
//console.log("id",id);
|
||||
|
||||
};
|
||||
var deleteFun = function (id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(willDelete => {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/work/group/delete.do', { id: id }, function (data) {
|
||||
if (data == 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
var deletesFun = function () {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||||
} else {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(willDelete => {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/work/group/deletes.do', { ids: datas }, function (data) {
|
||||
if (data > 0) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var initTreeView = function () {
|
||||
//console.log("0");
|
||||
$.post(ext.contextPath + '/user/getUnitForTree_Dept_All.do', { ng: '' }, function (data) {
|
||||
//console.info("yes");
|
||||
$('#companytree').treeview({
|
||||
data: data,
|
||||
showBorder: true,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companytree').on('nodeSelected', function (event, data) {
|
||||
nodeid = data.id;
|
||||
if (data.type == '${UNIT_TYPE_DEPT}') {
|
||||
$.post(ext.contextPath + '/user/showDeptEdit.do', { id: data.id }, function (data1) {
|
||||
$("#companyBox").html(data1);
|
||||
});
|
||||
} else {
|
||||
$.post(ext.contextPath + '/user/showCompanyEdit.do', { id: data.id }, function (data1) {
|
||||
$("#companyBox").html(data1);
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 'json');
|
||||
$("#companyBox").html("");
|
||||
};
|
||||
$(function () {
|
||||
initTreeView();
|
||||
});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<%-- <!-- 引用top --> --%>
|
||||
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
|
||||
<!-- 菜单栏 -->
|
||||
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
|
||||
<div class="content-wrapper">
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="alertDiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="fileInputDiv"></div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="box box-solid">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">公司列表</h3>
|
||||
|
||||
<div class="box-tools">
|
||||
<button type="buttonC" class="btn btn-box-tool" onclick="addCompanyFun('${UNIT_TYPE_COMPANY}');">
|
||||
<i class="fa fa-plus"></i> 公司
|
||||
</button>
|
||||
|
||||
<button type="buttonB" class="btn btn-box-tool" onclick="addCompanyFun('${UNIT_TYPE_BIZ}');">
|
||||
<i class="fa fa-plus"></i> 水厂
|
||||
</button >
|
||||
|
||||
<button type="buttonB" class="btn btn-box-tool" onclick="addDeptFun();">
|
||||
<i class="fa fa-plus"></i> 部门
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<div id="companytree" style="height:550px;overflow:auto; "></div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9" id="companyBox">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
|
||||
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
93
WebRoot/jsp/user/companySelectTree.jsp
Normal file
93
WebRoot/jsp/user/companySelectTree.jsp
Normal file
@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
|
||||
<script>
|
||||
//简易公司combotree(只有公司和水厂版本)
|
||||
// $.post(ext.contextPath + '/user/getUnitForTree_Selected.do', { ng: '' }, function (data) {
|
||||
$.post(ext.contextPath + '/user/getUnitForTreeFromTop.do', { unitId: unitId }, function (data) {
|
||||
//console.log("data",data);
|
||||
if (data.length == 1 && !data[0].hasOwnProperty("nodes")) {
|
||||
//当登陆者的pid以下没有子节点时显示单独一个span
|
||||
$("#company_id").val(data[0].id);
|
||||
$("#companyselect").hide();
|
||||
$("#companyName").text("公司:" + data[0].text);
|
||||
companyId = data[0].id;
|
||||
initFun();
|
||||
} else if ((data.length == 1 && data.node != "") || data.length > 1) {
|
||||
//第一次加载时赋值
|
||||
$("#company_id").val(data[0].id);
|
||||
$("#cname_input").val(data[0].text);
|
||||
companyId = data[0].id;
|
||||
initFun();
|
||||
//$table.bootstrapTable('refresh');//异步加载重新刷新,待修改
|
||||
$('#companytree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companytree').on('nodeSelected', function (event, data) {
|
||||
$("#company_id").val(data.id);
|
||||
$("#cname_input").val(data.text);
|
||||
companyId = data.id;
|
||||
// console.log("tree",data.id);
|
||||
//存储参数
|
||||
localStorage.setItem("companyKey", data.id);
|
||||
document.getElementById('ul_tree').style.display = "none";
|
||||
dosearch();
|
||||
});
|
||||
|
||||
//展开locaStroage中存储原先选中节点
|
||||
if(localStorage.getItem("companyKey") != ""){
|
||||
var treenode = $('#companytree').treeview('getEnabled');
|
||||
for (j = 0, len = treenode.length; j < len; j++) {
|
||||
if (treenode[j].id == localStorage.getItem("companyKey")) {
|
||||
$('#companytree').treeview('selectNode', [treenode[j], { }]);
|
||||
$('#companytree').treeview('revealNode', [treenode[j], { silent: true }]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//待完善
|
||||
};
|
||||
}, 'json');
|
||||
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#ul_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#ul_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="form-group form-inline" style="padding:0;margin-bottom: 0px;margin-bottom: 0px;height:40px">
|
||||
<ul id="companyselect" style="list-style-type:none;padding-left:0px;width:300px;margin-bottom: 0px;">
|
||||
<li class="dropdown" style="width:300px;">
|
||||
<!-- Menu toggle button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="width:300px;"
|
||||
onclick="document.getElementById('ul_tree').style.display = 'block';">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"
|
||||
style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
||||
<input class="form-control " id="cname_input" name="cname_input"
|
||||
style="height:31px;width: 220px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;cursor:pointer;"
|
||||
readonly />
|
||||
</div><!-- /input-group -->
|
||||
</a>
|
||||
<ul id="ul_tree" class="dropdown-menu" data-stopPropagation="true" style="border-color:#ccc;">
|
||||
<li class="header">
|
||||
<div id="companytree" style="width: 275px;height:400px;overflow-y:scroll;overflow-x:hidden;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="form-group " style="margin-bottom:10px;">
|
||||
<!-- -->
|
||||
<input id="company_id" name="company_id" type="hidden" />
|
||||
<span id="companyName" style="width:220px;border: none;background: transparent;"></span>
|
||||
</div>
|
||||
</div>
|
||||
92
WebRoot/jsp/user/companySelectTree_Dept.jsp
Normal file
92
WebRoot/jsp/user/companySelectTree_Dept.jsp
Normal file
@ -0,0 +1,92 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
|
||||
<script>
|
||||
//简易公司combotree(只有公司和水厂版本)
|
||||
$.post(ext.contextPath + '/user/getUnitForTree_Dept.do', { ng: '' }, function (data) {
|
||||
//console.log("data",data);
|
||||
if (data.length == 1 && !data[0].hasOwnProperty("nodes")) {
|
||||
//当登陆者的pid以下没有子节点时显示单独一个span
|
||||
$("#company_id").val(data[0].id);
|
||||
$("#companyselect").hide();
|
||||
$("#companyName").text("公司:" + data[0].text);
|
||||
companyId = data[0].id;
|
||||
initFun();
|
||||
} else if ((data.length == 1 && data.node != "") || data.length > 1) {
|
||||
//第一次加载时赋值
|
||||
$("#company_id").val(data[0].id);
|
||||
$("#cname_input").val(data[0].text);
|
||||
companyId = data[0].id;
|
||||
initFun();
|
||||
//$table.bootstrapTable('refresh');//异步加载重新刷新,待修改
|
||||
$('#companytree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companytree').on('nodeSelected', function (event, data) {
|
||||
$("#company_id").val(data.id);
|
||||
$("#cname_input").val(data.text);
|
||||
companyId = data.id;
|
||||
console.log("tree",data.id);
|
||||
//存储参数
|
||||
localStorage.setItem("companyKey", data.id);
|
||||
document.getElementById('ul_tree').style.display = "none";
|
||||
dosearch();
|
||||
});
|
||||
|
||||
//展开locaStroage中存储原先选中节点
|
||||
if(localStorage.getItem("companyKey") != ""){
|
||||
var treenode = $('#companytree').treeview('getEnabled');
|
||||
for (j = 0, len = treenode.length; j < len; j++) {
|
||||
if (treenode[j].id == localStorage.getItem("companyKey")) {
|
||||
$('#companytree').treeview('selectNode', [treenode[j], { }]);
|
||||
$('#companytree').treeview('revealNode', [treenode[j], { silent: true }]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//待完善
|
||||
};
|
||||
}, 'json');
|
||||
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#ul_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#ul_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="form-group form-inline" style="padding:0;margin-bottom: 0px;margin-bottom: 0px;height:40px">
|
||||
<ul id="companyselect" style="list-style-type:none;padding-left:0px;width:300px;margin-bottom: 0px;">
|
||||
<li class="dropdown" style="width:300px;">
|
||||
<!-- Menu toggle button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="width:300px;"
|
||||
onclick="document.getElementById('ul_tree').style.display = 'block';">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"
|
||||
style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
||||
<input class="form-control " id="cname_input" name="cname_input"
|
||||
style="height:31px;width: 220px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;cursor:pointer;"
|
||||
readonly />
|
||||
</div><!-- /input-group -->
|
||||
</a>
|
||||
<ul id="ul_tree" class="dropdown-menu" data-stopPropagation="true" style="border-color:#ccc;">
|
||||
<li class="header">
|
||||
<div id="companytree" style="width: 275px;height:400px;overflow-y:scroll;overflow-x:hidden;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="form-group " style="margin-bottom:10px;">
|
||||
<!-- -->
|
||||
<input id="company_id" name="company_id" type="hidden" />
|
||||
<span id="companyName" style="width:220px;border: none;background: transparent;"></span>
|
||||
</div>
|
||||
</div>
|
||||
92
WebRoot/jsp/user/companySelectTree_Dept_All.jsp
Normal file
92
WebRoot/jsp/user/companySelectTree_Dept_All.jsp
Normal file
@ -0,0 +1,92 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
|
||||
<script>
|
||||
//简易公司combotree(只有公司和水厂版本)
|
||||
$.post(ext.contextPath + '/user/getUnitForTree_Dept_All.do', { ng: '' }, function (data) {
|
||||
//console.log("data",data);
|
||||
if (data.length == 1 && !data[0].hasOwnProperty("nodes")) {
|
||||
//当登陆者的pid以下没有子节点时显示单独一个span
|
||||
$("#company_id").val(data[0].id);
|
||||
$("#companyselect").hide();
|
||||
$("#companyName").text("公司:" + data[0].text);
|
||||
companyId = data[0].id;
|
||||
initFun();
|
||||
} else if ((data.length == 1 && data.node != "") || data.length > 1) {
|
||||
//第一次加载时赋值
|
||||
$("#company_id").val(data[0].id);
|
||||
$("#cname_input").val(data[0].text);
|
||||
companyId = data[0].id;
|
||||
initFun();
|
||||
//$table.bootstrapTable('refresh');//异步加载重新刷新,待修改
|
||||
$('#companytree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companytree').on('nodeSelected', function (event, data) {
|
||||
$("#company_id").val(data.id);
|
||||
$("#cname_input").val(data.text);
|
||||
companyId = data.id;
|
||||
console.log("tree",data.id);
|
||||
//存储参数
|
||||
localStorage.setItem("companyKey", data.id);
|
||||
document.getElementById('ul_tree').style.display = "none";
|
||||
dosearch();
|
||||
});
|
||||
|
||||
//展开locaStroage中存储原先选中节点
|
||||
if(localStorage.getItem("companyKey") != ""){
|
||||
var treenode = $('#companytree').treeview('getEnabled');
|
||||
for (j = 0, len = treenode.length; j < len; j++) {
|
||||
if (treenode[j].id == localStorage.getItem("companyKey")) {
|
||||
$('#companytree').treeview('selectNode', [treenode[j], { }]);
|
||||
$('#companytree').treeview('revealNode', [treenode[j], { silent: true }]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//待完善
|
||||
};
|
||||
}, 'json');
|
||||
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#ul_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#ul_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="form-group form-inline" style="padding:0;margin-bottom: 0px;margin-bottom: 0px;height:40px">
|
||||
<ul id="companyselect" style="list-style-type:none;padding-left:0px;width:300px;margin-bottom: 0px;">
|
||||
<li class="dropdown" style="width:300px;">
|
||||
<!-- Menu toggle button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="width:300px;"
|
||||
onclick="document.getElementById('ul_tree').style.display = 'block';">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"
|
||||
style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
||||
<input class="form-control " id="cname_input" name="cname_input"
|
||||
style="height:31px;width: 220px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;cursor:pointer;"
|
||||
readonly />
|
||||
</div><!-- /input-group -->
|
||||
</a>
|
||||
<ul id="ul_tree" class="dropdown-menu" data-stopPropagation="true" style="border-color:#ccc;">
|
||||
<li class="header">
|
||||
<div id="companytree" style="width: 275px;height:400px;overflow-y:scroll;overflow-x:hidden;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="form-group " style="margin-bottom:10px;">
|
||||
<!-- -->
|
||||
<input id="company_id" name="company_id" type="hidden" />
|
||||
<span id="companyName" style="width:220px;border: none;background: transparent;"></span>
|
||||
</div>
|
||||
</div>
|
||||
359
WebRoot/jsp/user/dataManageDetail.jsp
Normal file
359
WebRoot/jsp/user/dataManageDetail.jsp
Normal file
@ -0,0 +1,359 @@
|
||||
<%@page import="com.sipai.tools.CommString"%>
|
||||
<%@ 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"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<% request.setAttribute("UNIT_TYPE_COMPANY", CommString.UNIT_TYPE_COMPANY); %>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
//initTreeView();
|
||||
$('#removea').click(function () {
|
||||
$('#search_pname').val("");
|
||||
$('#search_pid').val("");
|
||||
refreshSelect();
|
||||
})
|
||||
refreshSelect();
|
||||
//document.getElementById("search_pname").addEventListener("change", function (event) {alert();});
|
||||
});
|
||||
function refreshSelect(domId){
|
||||
var pid =$('#'+domId).val();
|
||||
var selelct=$("#search_code").select2({
|
||||
ajax: {
|
||||
type:'POST',
|
||||
url: ext.contextPath +"/user/getDataManageALLBizs.do",
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
data : function(params) {
|
||||
return {
|
||||
pid : pid,
|
||||
search_name : params.term,
|
||||
};
|
||||
},
|
||||
processResults: function (data) {
|
||||
return {
|
||||
results: data
|
||||
}
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
placeholder:'企业/水厂',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
templateResult: function formatRepo(repo){
|
||||
if(repo.syncFlag==false){
|
||||
return repo.text+' <i class="fa fa-circle text-danger"></i> ';
|
||||
}
|
||||
return repo.text;
|
||||
}, // 函数用来渲染结果
|
||||
templateSelection: function formatRepoSelection(repo){
|
||||
if(repo.syncFlag==false){
|
||||
return repo.text+' <i class="fa fa-circle text-danger"></i> ';
|
||||
}
|
||||
return repo.text;
|
||||
} // 函数用于呈现当前的选择
|
||||
});
|
||||
selelct.val('').trigger("change");
|
||||
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
|
||||
selelct.on("change",function(e){
|
||||
var companyId= $(this).val();
|
||||
if(companyId==null || companyId==""){
|
||||
return;
|
||||
}
|
||||
$('#search_name_equ').val('');
|
||||
$('#search_name_mpoint').val('');
|
||||
chosePSection();
|
||||
|
||||
$("#psection").empty();
|
||||
$.post(ext.contextPath + "/work/mpoint/getProcessSectionList4Select.do", {companyId:companyId}, function(data) {
|
||||
$.each(data, function(index, item){
|
||||
console.info(item)
|
||||
var str ='<li id ="'+item.id+'"><a onclick="chosePSection(\''+item.id+'\')"> '+item.text+'</a></li>';
|
||||
$("#psection").append(str);
|
||||
});
|
||||
},'json');
|
||||
});
|
||||
|
||||
}
|
||||
var chosePSection = function(pSectionId) {
|
||||
$("#psection").children("li").removeClass("active");
|
||||
$('#'+pSectionId).addClass('active');
|
||||
getEquipList(pSectionId);
|
||||
getMpointList(pSectionId);
|
||||
};
|
||||
var getEquipList = function(pSectionId) {
|
||||
$("#table_equ").bootstrapTable('destroy');
|
||||
$("#table_equ").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/equipment/getAllEquipmentCard.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||||
pageSize: 20, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
|
||||
companyId: $("#search_code").val(),
|
||||
pSectionId: pSectionId,
|
||||
search_name : $('#search_name_equ').val(),
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'equipmentName', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'equipmentCardID', // 返回json数据中的name
|
||||
title: '厂内编号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'id', // 返回json数据中的name
|
||||
title: '统一编号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'equipmentModel', // 返回json数据中的name
|
||||
title: '设备型号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
},{
|
||||
field: 'factory', // 返回json数据中的name
|
||||
title: '厂家名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table_equ");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
};
|
||||
var getMpointList = function(pSectionId) {
|
||||
$("#table_mpoint").bootstrapTable('destroy');
|
||||
$("#table_mpoint").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/work/mpoint/getAllMPoints.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||||
pageSize: 20, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
|
||||
companyId: $("#search_code").val(),
|
||||
pSectionId: pSectionId,
|
||||
search_name : $('#search_name_mpoint').val(),
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'parmname', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'mpointcode', // 返回json数据中的name
|
||||
title: '编号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'parmvalue', // 返回json数据中的name
|
||||
title: '值', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'measuredt', // 返回json数据中的name
|
||||
title: '采集时间', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
return value.substring(0,19);
|
||||
/* return '<i class="fa fa-edit" onclick="editFun()(\'' + row.id + '\')></i>'; */
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table_mpoint");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
})
|
||||
};
|
||||
var showUnit4SelectFun_ = function() {
|
||||
$.post(ext.contextPath + '/user/showUnit4Select.do', {formId:"searchForm",hiddenId:"search_pid",textId:"search_pname",type:'${UNIT_TYPE_COMPANY}'} , function(data) {
|
||||
$("#unit4SelectDiv").html(data);
|
||||
openModal("unit4SelectModal");
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<!-- 引用top -->
|
||||
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
|
||||
<!-- 菜单栏 -->
|
||||
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1 id ="head_title"></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a id ='head_firstlevel' href="#"><i class="fa fa-dashboard"></i> </a></li>
|
||||
<!-- <li class="active">Here</li> -->
|
||||
</ol>
|
||||
</section>
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="menu4SelectDiv"></div>
|
||||
<div id="unit4SelectDiv"></div>
|
||||
<div >
|
||||
<form class="form-group " style="padding:0;" id="searchForm">
|
||||
<!-- <label class="col-sm-2 control-label">公司/部门</label> -->
|
||||
<div class="form-group form-inline " >
|
||||
<div class="form-group has-feedback ">
|
||||
<input type="text" class="form-control " id="search_pname" name ="search_pname" placeholder="集团/公司" onclick="showUnit4SelectFun_();" style="height:30px">
|
||||
<a class="glyphicon glyphicon-remove form-control-feedback btn-sm" id="removea" style="padding-top:6px;pointer-events: auto"></a>
|
||||
</input>
|
||||
<input id="search_pid" class="form-control" name="search_pid" type="hidden" onchange="refreshSelect(this.id)"/>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="input-group input-group-sm" >
|
||||
<select class="form-control select2 " id="search_code" name ="search_code" style="width: 100%;min-width:500px;"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
|
||||
<div class="box box-solid">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">工艺段</h3>
|
||||
|
||||
<div class="box-tools">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<ul id ="psection" class="nav nav-pills nav-stacked">
|
||||
</ul>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
<!-- /. box -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<div class="col-md-9">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">设备</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||
</div>
|
||||
<!-- /.box-tools -->
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body no-padding">
|
||||
<div class="mailbox-controls">
|
||||
<div class="pull-right">
|
||||
<div class="input-group input-group-sm" style="width: 250px;padding-bottom:5px">
|
||||
<input type="text" id="search_name_equ" name="search_name_equ" class="form-control pull-right" placeholder="设备名称">
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-default" onclick="getEquipList();"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="padding:10px">
|
||||
<table id="table_equ"></table>
|
||||
</div>
|
||||
<!-- /.mail-box-messages -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /. box -->
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">测量点</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||
</div>
|
||||
<!-- /.box-tools -->
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body no-padding">
|
||||
<div class="mailbox-controls">
|
||||
<div class="pull-right">
|
||||
<div class="input-group input-group-sm" style="width: 250px;padding-bottom:5px">
|
||||
<input type="text" id="search_name_mpoint" name="search_name_mpoint" class="form-control pull-right" placeholder="测量点名称">
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-default" onclick="getMpointList();"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="padding:10px">
|
||||
<table id="table_mpoint"></table>
|
||||
</div>
|
||||
<!-- /.mail-box-messages -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
|
||||
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
236
WebRoot/jsp/user/deptAdd.jsp
Normal file
236
WebRoot/jsp/user/deptAdd.jsp
Normal file
@ -0,0 +1,236 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
|
||||
<%request.setAttribute("UNIT_TYPE_DEPT",com.sipai.tools.CommString.UNIT_TYPE_DEPT);%>
|
||||
<%request.setAttribute("Flag_Active",com.sipai.tools.CommString.Flag_Active);%>
|
||||
<%request.setAttribute("Flag_Unactive",com.sipai.tools.CommString.Flag_Unactive);%>
|
||||
<script type="text/javascript">
|
||||
function doSaveDept() {
|
||||
$("#deptAddForm").data('bootstrapValidator').resetForm();
|
||||
$("#deptAddForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#deptAddForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/saveDept.do", $("#deptAddForm").serialize(), function (data) {
|
||||
//console.log("data",data);
|
||||
if (data.res == "1") {
|
||||
//若是小组则添加小组权限和工艺段
|
||||
//保存权限
|
||||
var valrole = $('#_roles').val();
|
||||
var rolestr = "";
|
||||
if (valrole != null) {
|
||||
$.each(valrole, function (index, value, array) {
|
||||
if (rolestr != "") {
|
||||
rolestr += ",";
|
||||
}
|
||||
rolestr += value;
|
||||
});
|
||||
}
|
||||
$.post(ext.contextPath + "/user/updateRoleDept.do", { deptid: data.id, rolestr_new: rolestr, rolestr_old: "" }, function (data1) {
|
||||
if (data1 < 0) {
|
||||
showAlert('d', '权限保存失败,请至编辑页面重新保存');
|
||||
}
|
||||
});
|
||||
|
||||
//保存区域
|
||||
var valarea = $('#_area').val();
|
||||
var areastr = "";
|
||||
if (valarea != null) {
|
||||
$.each(valarea, function (index, value, array) {
|
||||
if (areastr != "") {
|
||||
areastr += ",";
|
||||
}
|
||||
areastr += value;
|
||||
});
|
||||
}
|
||||
|
||||
$.post(ext.contextPath + "/user/updateDeptArea.do", { deptid: data.id, areastr: areastr }, function (data1) {
|
||||
if (data1 < 0) {
|
||||
showAlert('d', '区域保存失败,请至编辑页面重新保存');
|
||||
}
|
||||
})
|
||||
initTreeView();
|
||||
} else {
|
||||
showAlert('d', '保存失败');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
|
||||
$("#deptAddForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
_pname: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '上级不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
morder: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '顺序不能为空'
|
||||
},
|
||||
regexp: {
|
||||
regexp: /^[0-9]*$/,
|
||||
message: '顺序必须为数字'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var showCompanySelectFun = function () {
|
||||
$.post(ext.contextPath + '/user/showCompany4Select.do', { formId: "deptAddForm", hiddenId: "pid", textId: "_pname" }, function (data) {
|
||||
$("#company4SelectDiv").html(data);
|
||||
openModal('company4SelectModal');//待加
|
||||
});
|
||||
};
|
||||
|
||||
var showRoleSelectFun = function () {
|
||||
$.post(ext.contextPath + "/user/getJsonRoleByBizid.do", { bizid: $('#pid').val() }, function (data) {
|
||||
var select = $("#_roles").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; } // 函数用于呈现当前的选择
|
||||
});
|
||||
var items = new Array();
|
||||
/* $.each(JSON.parse(roles),function(index,value,array){
|
||||
items.put(value.id);
|
||||
}); */
|
||||
select.val(items).trigger("change");
|
||||
}, 'json');
|
||||
};
|
||||
|
||||
var showAreaSelectFun = function () {
|
||||
$.post(ext.contextPath + "/timeEfficiency/patrolArea/getPatrolArea4Select.do", { bizId: $('#pid').val() }, function (data) {
|
||||
var select = $("#_area").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; } // 函数用于呈现当前的选择
|
||||
});
|
||||
var items = new Array();
|
||||
/* $.each(JSON.parse(roles),function(index,value,array){
|
||||
items.put(value.id);
|
||||
}); */
|
||||
select.val(items).trigger("change");
|
||||
}, 'json');
|
||||
};
|
||||
|
||||
|
||||
$(function () {
|
||||
$("#active").select2({ minimumResultsForSearch: 10 }).val("${Flag_Active}").trigger("change");
|
||||
fixSelect2ToForm("active");
|
||||
showRoleSelectFun();
|
||||
showAreaSelectFun();
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">新增部门</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<a onclick="doSaveDept()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
||||
class="glyphicon glyphicon-floppy-disk"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body ">
|
||||
<form class="form-horizontal " id="deptAddForm">
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div id="company4SelectDiv"></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="name" name="name" placeholder="名称" value=""
|
||||
style="border-radius:4px">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*上级</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="_pname" name="_pname" placeholder="上级"
|
||||
onclick="showCompanySelectFun();" style="border-radius:4px;background-color: white"
|
||||
value="${pname}">
|
||||
<input id="pid" name="pid" type="hidden" value="${param.pid}" />
|
||||
</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="code" name ="code" placeholder="编号" value="" />
|
||||
</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="sname" name ="sname" placeholder="简称" value="" />
|
||||
<input id="type" name="type" type="hidden" value="${UNIT_TYPE_DEPT}"/>
|
||||
</div>
|
||||
<div id="biz_id" style="display:none;">
|
||||
<label class="col-sm-2 control-label">水厂编号</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="id" name ="id" placeholder="编号" value="" />
|
||||
</div>
|
||||
</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="office" name ="office" placeholder="办公室" value="">
|
||||
</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="morder" name="morder" placeholder="顺序" value=""
|
||||
style="border-radius:4px">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">启用</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="active" name="active" class="form-control select2">
|
||||
<option value="${Flag_Active}">启用</option>
|
||||
<option value="${Flag_Unactive}">禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="dept_unique" class="form-group">
|
||||
<label class="col-sm-2 control-label">权限</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control select2" id="_roles" name="_roles">
|
||||
</select>
|
||||
</div>
|
||||
<!-- <label class="col-sm-2 control-label">编码</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="code" name="code" placeholder="编码" value="" style="border-radius:4px">
|
||||
</div> -->
|
||||
<label class="col-sm-2 control-label">区域</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control select2" id="_area" name="_area">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
508
WebRoot/jsp/user/deptEdit.jsp
Normal file
508
WebRoot/jsp/user/deptEdit.jsp
Normal file
@ -0,0 +1,508 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
|
||||
<%request.setAttribute("Flag_Active",com.sipai.tools.CommString.Flag_Active);%>
|
||||
<%request.setAttribute("Flag_Unactive",com.sipai.tools.CommString.Flag_Unactive);%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<script type="text/javascript">
|
||||
/*** 上半部分 */
|
||||
var showCompany4SelectFun = function () {
|
||||
$.post(ext.contextPath + '/user/showCompany4Select.do', { formId: "deptForm", hiddenId: "pid", textId: "_pname" }, function (data) {
|
||||
$("#company4SelectDiv").html(data);
|
||||
openModal("company4SelectModal");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
function doSaveDept() {
|
||||
$("#deptForm").data('bootstrapValidator').resetForm();
|
||||
$("#deptForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#deptForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/updateDept.do", $("#deptForm").serialize(), function (data) {
|
||||
if (data.res == "1") {
|
||||
//若是小组则添加小组权限和工艺段
|
||||
//保存权限
|
||||
var valrole = $('#_roles').val();
|
||||
var rolestr = "";
|
||||
if (valrole != null) {
|
||||
$.each(valrole, function (index, value, array) {
|
||||
if (rolestr != "") {
|
||||
rolestr += ",";
|
||||
}
|
||||
rolestr += value;
|
||||
});
|
||||
}
|
||||
$.post(ext.contextPath + "/user/updateRoleDept.do", { deptid: data.id, rolestr_new: rolestr, rolestr_old: $('#_roles_old').val() }, function (data1) {
|
||||
if (data1 < 0) {
|
||||
showAlert('d', '权限保存失败,请至编辑页面重新保存');
|
||||
}
|
||||
});
|
||||
|
||||
//保存区域
|
||||
var valarea = $('#_area').val();
|
||||
var areastr = "";
|
||||
if (valarea != null) {
|
||||
$.each(valarea, function (index, value, array) {
|
||||
if (areastr != "") {
|
||||
areastr += ",";
|
||||
}
|
||||
areastr += value;
|
||||
});
|
||||
}
|
||||
|
||||
$.post(ext.contextPath + "/user/updateDeptArea.do", { deptid: data.id, areastr: areastr }, function (data1) {
|
||||
if (data1 < 0) {
|
||||
showAlert('d', '区域保存失败,请至编辑页面重新保存');
|
||||
}
|
||||
})
|
||||
initTreeView();
|
||||
} else {
|
||||
showAlert('d', '保存失败');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
|
||||
$("#deptForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
_pname: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '上级不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
morder: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '顺序不能为空'
|
||||
},
|
||||
regexp: {
|
||||
regexp: /^[0-9]*$/,
|
||||
message: '顺序必须为数字'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function delDept() {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/deleteDept.do', $("#deptForm").serialize(), function (data) {
|
||||
if (data.res > 0) {
|
||||
showAlert('s', '删除成功');
|
||||
initTreeView();
|
||||
} else {
|
||||
showAlert('d', '删除失败');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
}
|
||||
var showRoleSelectFun = function () {
|
||||
$.post(ext.contextPath + "/user/getJsonRoleByBizid.do", { bizid: $('#pid').val() }, function (data) {
|
||||
var select = $("#_roles").select2({
|
||||
data: data,
|
||||
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; } // 函数用于呈现当前的选择
|
||||
});
|
||||
var items = new Array();
|
||||
/* $.each(JSON.parse(roles),function(index,value,array){
|
||||
items.put(value.id);
|
||||
}); */
|
||||
}, 'json');
|
||||
};
|
||||
|
||||
var initSelectFun = function () {
|
||||
var roleitems = new Array();
|
||||
var rolestr_old = "";
|
||||
var roles = JSON.parse('${roles}');
|
||||
for (var i = 0; i < roles.length; i++) {
|
||||
roleitems.push(roles[i].id);
|
||||
rolestr_old += roles[i].id + ",";
|
||||
}
|
||||
//console.log("roles", roles);
|
||||
$("#_roles").val(roleitems).trigger("change");
|
||||
$("#_roles_old").val(rolestr_old);
|
||||
|
||||
var areaitems = new Array();
|
||||
var areas = JSON.parse('${areas}');
|
||||
for (var i = 0; i < areas.length; i++) {
|
||||
areaitems.push(areas[i].id);
|
||||
}
|
||||
//console.log("areas", areas);
|
||||
$("#_area").val(areaitems).trigger("change");
|
||||
}
|
||||
|
||||
var showAreaSelectFun = function () {
|
||||
$.post(ext.contextPath + "/timeEfficiency/patrolArea/getPatrolArea4Select.do", { bizId: $('#pid').val() }, function (data) {
|
||||
var select = $("#_area").select2({
|
||||
data: data,
|
||||
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; } // 函数用于呈现当前的选择
|
||||
});
|
||||
}, 'json');
|
||||
};
|
||||
|
||||
/*** 下半部分 */
|
||||
var addUserFun = function () {
|
||||
$.post(ext.contextPath + '/user/addUser.do', {}, function (data) {
|
||||
$("#userDiv").html(data + "<div id='unit4SelectDiv'></div> ");
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
var delUserFun = function () {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||||
} else {
|
||||
swal({
|
||||
text: "您确定要禁用这些用户吗?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/deleteDept.do', { ids: datas }, function (data) {
|
||||
if (data > 0) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '禁用失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var editUserFun = function (id) {
|
||||
$.post(ext.contextPath + '/user/editUser.do', { id: id }, function (data) {
|
||||
$("#userDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
//重置密码
|
||||
var pwdFun = function (id) {
|
||||
swal({
|
||||
text: "您确定要重置密码吗?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/resetPassword.do', { id: id }, function (data) {
|
||||
if (data == 1) {
|
||||
showAlert('s', '重置成功', 'mainAlertdiv');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '重置失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$(function () {
|
||||
$("#active").select2({ minimumResultsForSearch: 10 }).val("${dept.active}").trigger("change");
|
||||
//$("#active").select2({ minimumResultsForSearch: 10 }).val("${dept.active}");
|
||||
fixSelect2ToForm("active");
|
||||
$("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUsersById.do?id=${dept.id}', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order // 排序规则
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [/*{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
},*/
|
||||
{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '登录名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'caption', // 返回json数据中的name
|
||||
title: '姓名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'sex', // 返回json数据中的name
|
||||
title: '性别', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
if (value == '0') {
|
||||
return '女';
|
||||
} else {
|
||||
return '男';
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: '_pname', // 返回json数据中的name
|
||||
title: '公司/部门', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'active', // 返回json数据中的name
|
||||
title: '状态', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
switch (value) {
|
||||
case '0':
|
||||
return '禁用';
|
||||
case '1':
|
||||
return '启用';
|
||||
case '2':
|
||||
return '退休';
|
||||
case '3':
|
||||
return '离职';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
}/*,{
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
// width: 60, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var str = '';
|
||||
str+='<button class="btn btn-default btn-sm" title="编辑" onclick="editUserFun(\'' + row.id + '\')"><i class="fa fa-edit"></i></button>';
|
||||
str+='<button class="btn btn-default btn-sm" title="重置密码" onclick="pwdFun(\'' + row.id + '\')"><i class="fa fa-repeat"></i></button>';
|
||||
str='<div class="btn-group" >'+str+'</div>';
|
||||
return str;
|
||||
/* return '<i class="fa fa-edit" onclick="editFun()(\'' + row.id + '\')></i>';
|
||||
}
|
||||
}*/
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
$(".bs-checkbox").css({ 'text-align': 'center', 'vertical-align': 'middle' })
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
|
||||
showRoleSelectFun();
|
||||
showAreaSelectFun();
|
||||
setTimeout("initSelectFun()", "1000"); //延迟执行
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">详情</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<a onclick="doSaveDept()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
||||
class="glyphicon glyphicon-floppy-disk"></i></a>
|
||||
<security:authorize buttonUrl="user/deleteCompany.do">
|
||||
<a onclick="delDept()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i
|
||||
class="glyphicon glyphicon-trash"></i></a>
|
||||
</security:authorize>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<form class="form-horizontal " id="deptForm">
|
||||
<input id="id" name="id" type="hidden" value="${dept.id}" />
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div id="company4SelectDiv"></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="name" name="name" placeholder="名称"
|
||||
style="border-radius:4px" value="${dept.name }">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*上级</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="_pname" name="_pname" placeholder="上级"
|
||||
style="border-radius:4px;background-color: white" readonly onclick="showCompany4SelectFun();"
|
||||
value="${pname}">
|
||||
<input id="pid" name="pid" type="hidden" value="${dept.pid}" />
|
||||
</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="code" name ="code" placeholder="编号" value="${dept.code}" />
|
||||
</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="sname" name ="sname" placeholder="简称" value="${dept.sname}">
|
||||
</div>
|
||||
<div id="biz_id" style="display:none;">
|
||||
<label class="col-sm-2 control-label">水厂编号</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="id" name ="id" placeholder="编号" value="" />
|
||||
</div>
|
||||
</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="office" name ="office" placeholder="地址" value="${dept.office}">
|
||||
</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="morder" name="morder" placeholder="顺序"
|
||||
style="border-radius:4px" value="${dept.morder}">
|
||||
</div>
|
||||
<security:authorize buttonUrl="user/deleteCompany.do">
|
||||
<label class="col-sm-2 control-label">启用</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="active" name="active" class="form-control select2">
|
||||
<option value="${Flag_Active}">启用</option>
|
||||
<option value="${Flag_Unactive}">禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</security:authorize>
|
||||
</div>
|
||||
|
||||
<div id="dept_unique" class="form-group">
|
||||
<label class="col-sm-2 control-label">权限</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control select2" id="_roles" name="_roles"></select>
|
||||
<input id="_roles_old" name="_roles_old" type="hidden" />
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">区域</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control select2" id="_area" name="_area">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-solid">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">人员</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<div>
|
||||
<div id="alertDiv_user"></div>
|
||||
<!--
|
||||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<button type="button" class="btn btn-default" onclick="addUserFun();"><i class="fa fa-plus"></i> 新增</button>
|
||||
<button type="button" class="btn btn-default" onclick="delUserFun();"><i class="fa fa-plus-square"></i> 删除</button>
|
||||
|
||||
</div>-->
|
||||
<div id="userDiv"></div>
|
||||
<div id="user4SelectDiv_func"></div>
|
||||
<br>
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
179
WebRoot/jsp/user/extSystemAdd.jsp
Normal file
179
WebRoot/jsp/user/extSystemAdd.jsp
Normal file
@ -0,0 +1,179 @@
|
||||
<%@page import="com.sipai.entity.user.ExtSystem"%>
|
||||
<%@ 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"%>
|
||||
<% request.setAttribute("RequestMode", ExtSystem.RequestMode); %>
|
||||
<% request.setAttribute("SystemType", ExtSystem.SystemType); %>
|
||||
<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() {
|
||||
var type= $(this).val();
|
||||
var unitId='${extSystem.workshopid}';
|
||||
$.post(ext.contextPath + "/work/workshop/geList4Select.do", {type:type,unitId:unitId}, function(data) {
|
||||
|
||||
var selelct =$("#workshopid").select2({
|
||||
data: data,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
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;} // 函数用于呈现当前的选择
|
||||
});
|
||||
|
||||
selelct.val('${extSystem.workshopid}').trigger("change");
|
||||
},'json');
|
||||
|
||||
//getFileList();
|
||||
})
|
||||
function dosave() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
setTimeout(function(){
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/extsystem/save.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1) {
|
||||
$("#subModal").modal("hide");
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
//输入框验证
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
},
|
||||
},
|
||||
},
|
||||
url: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '请求链接不能为空'
|
||||
},
|
||||
},
|
||||
},
|
||||
mode: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '请求模式不能为空'
|
||||
},
|
||||
},
|
||||
},
|
||||
type: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '系统类型不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
status: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '启用状态不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
</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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm">
|
||||
<div id="alertDiv"></div>
|
||||
<input id ="id" name="id" type="hidden" value="${extSystem.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="${extSystem.name}">
|
||||
</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="url" name ="url" placeholder="请求链接" value="${extSystem.url}">
|
||||
</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="mode" name ="mode" style="width: 220px;">
|
||||
<c:forEach var="item" items="${RequestMode}" >
|
||||
<option value='${item}' <c:if test='${item == extSystem.mode}'> selected</c:if> >${item}</option>
|
||||
</c:forEach>
|
||||
</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="type" name ="type" style="width: 220px;">
|
||||
<c:forEach var="item" items="${SystemType}" >
|
||||
<option value='${item}' <c:if test='${item == extSystem.type}'> selected</c:if> >${item}</option>
|
||||
</c:forEach>
|
||||
</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="workshopid" name ="workshopid" style="width: 220px;">
|
||||
|
||||
</select>
|
||||
</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="namespace" name ="namespace" placeholder="命名空间" value="${extSystem.namespace}">
|
||||
</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="status" name ="status" style="width: 220px;">
|
||||
<option value="true" <c:if test="${extSystem.status=='true'}">selected</c:if>">启用</option>
|
||||
<option value="false" <c:if test="${extSystem.status=='false'}">selected</c:if>">停用</option>
|
||||
</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="dosave()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
196
WebRoot/jsp/user/extSystemEdit.jsp
Normal file
196
WebRoot/jsp/user/extSystemEdit.jsp
Normal file
@ -0,0 +1,196 @@
|
||||
<%@page import="com.sipai.entity.user.ExtSystem"%>
|
||||
<%@ 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"%>
|
||||
<% request.setAttribute("RequestMode", ExtSystem.RequestMode); %>
|
||||
<% request.setAttribute("SystemType", ExtSystem.SystemType); %>
|
||||
<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() {
|
||||
$.post(ext.contextPath + "/work/workshop/getlist4Combo.do", {}, function(data) {
|
||||
|
||||
var selelct =$("#workshopid").select2({
|
||||
data: data,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
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;} // 函数用于呈现当前的选择
|
||||
});
|
||||
|
||||
selelct.val('${extsystem.workshopid}').trigger("change");
|
||||
},'json'); }); */
|
||||
$(function() {
|
||||
var type= $(this).val();
|
||||
var unitId='${extSystem.workshopid}';
|
||||
$.post(ext.contextPath + "/work/workshop/geList4Select.do", {type:type,unitId:unitId}, function(data) {
|
||||
|
||||
var selelct =$("#workshopid").select2({
|
||||
data: data,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
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;} // 函数用于呈现当前的选择
|
||||
});
|
||||
|
||||
selelct.val('${extSystem.workshopid}').trigger("change");
|
||||
},'json');
|
||||
|
||||
//getFileList();
|
||||
})
|
||||
function doupdate() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
setTimeout(function(){
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
$.post(ext.contextPath + "/user/extsystem/update.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1) {
|
||||
$("#subModal").modal("hide");
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
//输入框验证
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
},
|
||||
},
|
||||
},
|
||||
url: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '请求链接不能为空'
|
||||
},
|
||||
},
|
||||
},
|
||||
mode: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '请求模式不能为空'
|
||||
},
|
||||
},
|
||||
},
|
||||
type: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '系统类型不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
status: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '启用状态不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
</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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm">
|
||||
<div id="alertDiv"></div>
|
||||
<input id ="id" name="id" type="hidden" value="${extSystem.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="${extSystem.name}">
|
||||
</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="url" name ="url" placeholder="请求链接" value="${extSystem.url}">
|
||||
</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="mode" name ="mode" style="width: 220px;">
|
||||
<c:forEach var="item" items="${RequestMode}" >
|
||||
<option value='${item}' <c:if test='${item == extSystem.mode}'> selected</c:if> >${item}</option>
|
||||
</c:forEach>
|
||||
</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="type" name ="type" style="width: 220px;">
|
||||
<c:forEach var="item" items="${SystemType}" >
|
||||
<option value='${item}' <c:if test='${item == extSystem.type}'> selected</c:if> >${item}</option>
|
||||
</c:forEach>
|
||||
</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="workshopid" name ="workshopid" style="width: 220px;">
|
||||
|
||||
</select>
|
||||
</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="namespace" name ="namespace" placeholder="命名空间" value="${extSystem.namespace}">
|
||||
</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="status" name ="status" style="width: 220px;">
|
||||
<option value="true" <c:if test="${extSystem.status=='true'}">selected</c:if>">启用</option>
|
||||
<option value="false" <c:if test="${extSystem.status=='false'}">selected</c:if>">停用</option>
|
||||
</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="doupdate()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
347
WebRoot/jsp/user/extSystemList.jsp
Normal file
347
WebRoot/jsp/user/extSystemList.jsp
Normal file
@ -0,0 +1,347 @@
|
||||
<%@ 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"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
|
||||
<script type="text/javascript">
|
||||
var addFun = function() {
|
||||
$.post(ext.contextPath + '/user/extsystem/add.do', {} , function(data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
var editFun = function(id) {
|
||||
$.post(ext.contextPath + '/user/extsystem/edit.do', {id:id} , function(data) {
|
||||
$("#subDiv").html(data);
|
||||
|
||||
openModal('subModal');
|
||||
/* $.post(ext.contextPath + '/work/workshop/getlist4Combo.do', {} , function(data) {
|
||||
//console.info(data)
|
||||
if(data.length>0){
|
||||
for(var i=0;i<data.length;i++){
|
||||
console.info("<option value='"+data[i].id+"' >"+data[i].name+"</option>");
|
||||
$("#workshopid").append("<option value='"+data[i].id+"' >"+data[i].name+"</option>");
|
||||
}
|
||||
|
||||
}
|
||||
},'json');*/
|
||||
});
|
||||
};
|
||||
var deleteFun = function(id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/extsystem/delete.do', {id : id}, function(data) {
|
||||
if(data==1){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
var deletesFun = function() {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas="";
|
||||
$.each(checkedItems, function(index, item){
|
||||
datas+=item.id+",";
|
||||
});
|
||||
if(datas==""){
|
||||
showAlert('d','请先选择记录','mainAlertdiv');
|
||||
}else{
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/extsystem/deletes.do', {ids:datas} , function(data) {
|
||||
if(data>0){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
var init = function() {
|
||||
$.post(ext.contextPath + '/user/extsystem/showlistForSelect.do', {} , function(data) {
|
||||
//console.info(data)
|
||||
if(data.length>0){
|
||||
for(var i=0;i<data.length;i++){
|
||||
console.info(data)
|
||||
$("#search_code").append("<option value='"+data[i].id+"'>"+data[i].text+"</option>");
|
||||
}
|
||||
/* $("#search_code").select2({
|
||||
placeholder: "请选择班组",
|
||||
language: "zh-CN",
|
||||
allowClear: true,
|
||||
data: data
|
||||
}); */
|
||||
}
|
||||
},'json');
|
||||
|
||||
};
|
||||
var dosearch = function() {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
};
|
||||
$(function() {
|
||||
//initTreeView();
|
||||
//init();
|
||||
/* $("#search_pid").select2({
|
||||
ajax: {
|
||||
type:'POST',
|
||||
url: ext.contextPath +'/user/getUnitsJson.do?random=' + Math.random(),
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
processResults: function (data) {
|
||||
return {
|
||||
results: data
|
||||
}
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
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'}) */
|
||||
|
||||
$("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/extsystem/getlist.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order, // 排序规则
|
||||
search_name: $('#search_name').val()
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
},{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '系统名称', // 表格表头显示文字
|
||||
sortable : true,
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}/* ,{
|
||||
field: 'workshopid', // 返回json数据中的name
|
||||
title: '所属车间', // 表格表头显示文字
|
||||
sortable : true,
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
formatter : function(value, row) {
|
||||
if(row.workShop!=null){
|
||||
return row.workShop.name;
|
||||
}else{
|
||||
return "所有车间";
|
||||
}
|
||||
}
|
||||
} */,{
|
||||
field: 'mode', // 返回json数据中的name
|
||||
title: '通讯方式', // 表格表头显示文字
|
||||
sortable : true,
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'type', // 返回json数据中的name
|
||||
title: '系统类型', // 表格表头显示文字
|
||||
sortable : true,
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'url', // 返回json数据中的name
|
||||
title: '通讯链接', // 表格表头显示文字
|
||||
sortable : true,
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'status', // 返回json数据中的name
|
||||
title: '状态', // 表格表头显示文字
|
||||
sortable : true,
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter : function(value, row) {
|
||||
if(value){
|
||||
return '启用';
|
||||
}else{
|
||||
return '停用';
|
||||
}
|
||||
|
||||
} // 上下居中
|
||||
},{
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 60, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
return '<button class="btn btn-default btn-sm" onclick="editFun(\'' + row.id + '\')" data-toggle="tooltip" title="编辑"><i class="fa fa-edit"></i></button>';
|
||||
/* return '<i class="fa fa-edit" onclick="editFun()(\'' + row.id + '\')></i>'; */
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
var initTreeView = function() {
|
||||
$.post(ext.contextPath + '/user/getUnitsJson.do?random=' + Math.random(), {ng:''} , function(data) {
|
||||
//console.info(data)
|
||||
$('#search_pid').treeview({data: data
|
||||
});
|
||||
$('#search_pid').on('nodeSelected', function(event, data) {
|
||||
editFun(data.id);
|
||||
//var node=$('#tree').treeview('getSelected');
|
||||
});
|
||||
},'json');
|
||||
$("#search_pid").html("");
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<!-- 引用top -->
|
||||
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
|
||||
<!-- 菜单栏 -->
|
||||
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1 id ="head_title"></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a id ='head_firstlevel' href="#"><i class="fa fa-dashboard"></i> </a></li>
|
||||
<!-- <li class="active">Here</li> -->
|
||||
</ol>
|
||||
</section>
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="menu4SelectDiv"></div>
|
||||
<div >
|
||||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<security:authorize buttonUrl="plan/dailyplan/add.do">
|
||||
<button type="button" class="btn btn-default" onclick="addFun();"><i class="fa fa-plus"></i> 新增</button>
|
||||
</security:authorize>
|
||||
<!-- <button type="button" class="btn btn-default" onclick="editFun();"><i class="fa fa-edit"></i> 编辑</button> -->
|
||||
<button type="button" class="btn btn-default" onclick="deletesFun();"><i class="fa fa-trash-o"></i> 删除</button>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="form-group " style="padding:0;">
|
||||
<!-- <label class="form-label pull-left">所属车间</label>
|
||||
<select class="form-control select2 pull-left" id="search_pid" name ="search_pid" style="width: 220px;">
|
||||
|
||||
</select> -->
|
||||
<div class="form-group pull-right" >
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right" placeholder="系统名称">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group " style="padding:0;">
|
||||
<label class="form-label">班组</label>
|
||||
<select class="form-control select2 " id="search_code" name ="search_code" style="width: 220px;"></select>
|
||||
<div class="form-group pull-right" >
|
||||
<div class="input-group input-group-sm" style="width: 500px;">
|
||||
<input type="text" id="search_pid" name="search_pid" class="form-control pull-right" style="width: 200px;" placeholder="所属车间">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right" style="width: 200px;margin-right:10px" placeholder="系统名称">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> -->
|
||||
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
|
||||
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
112
WebRoot/jsp/user/extSystemListForSelect.jsp
Normal file
112
WebRoot/jsp/user/extSystemListForSelect.jsp
Normal file
@ -0,0 +1,112 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.sipai.tools.SessionManager"%>
|
||||
<%
|
||||
SessionManager sessionManager = new SessionManager();
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
function selectFun() {
|
||||
var checkedItems = $('#grid1').datagrid('getChecked');
|
||||
var datas="";
|
||||
$.each(checkedItems, function(index, item){
|
||||
datas += '{"userid":"'+item.userid +'","usertype":"'+item.usertype +'","username":"'+item.username +'"},';
|
||||
});
|
||||
return $.parseJSON('{"result":['+datas.replace(/,$/g,"")+']}');
|
||||
}
|
||||
|
||||
var grid;
|
||||
$(function() {
|
||||
grid = $('#grid').datagrid({
|
||||
title : '班组选择',
|
||||
url : ext.contextPath + '/work/group/getlist.do?querytype=select',
|
||||
striped : true,
|
||||
rownumbers : true,
|
||||
pagination : true,
|
||||
singleSelect: true,
|
||||
idField : 'id',
|
||||
height:300,
|
||||
pageSize : 20,
|
||||
pageList : [ 20, 50, 100],
|
||||
columns : [ [
|
||||
{width : '100', title : '班组名称', field : 'name', sortable : true, halign:'center'},
|
||||
{width : '180', title : '所属车间', field : 'deptname', sortable : true, halign:'center'},
|
||||
{width : '180', title : '备注', field : 'remark', sortable : true, halign:'center'}
|
||||
] ],
|
||||
toolbar : '#toolbar',
|
||||
onSelect:function(index,row){
|
||||
loadMembers(row.id);
|
||||
}
|
||||
});
|
||||
|
||||
$('#search_pid').combotree({
|
||||
url : ext.contextPath + '/user/getUnitsJson.do?random=' + Math.random(),
|
||||
parentField : 'pid',
|
||||
method:'get',
|
||||
width:200,
|
||||
editable:false
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function loadMembers(groupid){
|
||||
$('#grid1').datagrid({
|
||||
title : '人员选择',
|
||||
url : ext.contextPath + '/work/group/getMemberListByGroupId.do?groupid='+groupid,
|
||||
height:400,
|
||||
striped : true,
|
||||
pagination : true,
|
||||
singleSelect: false,
|
||||
ctrlSelect:true,
|
||||
selectOnCheck: false,
|
||||
checkOnSelect: false,
|
||||
idField : 'id',
|
||||
pageSize : 20,
|
||||
pageList : [ 20, 50, 100],
|
||||
columns : [ [
|
||||
{checkbox:true , field : 'ck'},
|
||||
{width : '100', title : '人员类型', field : 'usertype', sortable : false, halign:'center',formatter:function(value){
|
||||
if(value=='leader'){
|
||||
return "组长";
|
||||
}else{
|
||||
return "组员";
|
||||
}
|
||||
}},
|
||||
{width : '180', title : '人员名称', field : 'username', sortable : false, halign:'center'}
|
||||
] ]
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body class="easyui-layout" data-options="fit:true,border:false" style="padding:5px;">
|
||||
<table id="toolbar" style="display: none;width:100%">
|
||||
<tr>
|
||||
<td>
|
||||
<form id="searchForm">
|
||||
<table class="tooltable">
|
||||
<tr>
|
||||
<td>班组名称</td>
|
||||
<td><input name="search_name" class="easyui-textbox" /></td>
|
||||
<td>所属车间</td>
|
||||
<td><input id="search_pid" name="search_pid" class="easyui-combotree"/></td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-search',plain:true"
|
||||
onclick="grid.datagrid('load',ext.serializeObject($('#searchForm')));">搜索</a>
|
||||
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true"
|
||||
onclick="$('#searchForm').form('clear');grid.datagrid('load',{});">重置</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="grid"></table>
|
||||
<div style="height:10px"></div>
|
||||
<table id="grid1"></table>
|
||||
</body>
|
||||
</html>
|
||||
77
WebRoot/jsp/user/fileinputHeadPortrait.jsp
Normal file
77
WebRoot/jsp/user/fileinputHeadPortrait.jsp
Normal file
@ -0,0 +1,77 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<script type="text/javascript">
|
||||
|
||||
//初始化fileinput控件(第一次初始化)
|
||||
function initFileInput(ctrlName, uploadUrl) {
|
||||
var control = $('#' + ctrlName);
|
||||
control.fileinput({
|
||||
language: 'zh', //设置语言
|
||||
uploadUrl: uploadUrl, //上传的地址
|
||||
uploadAsync:true,
|
||||
allowedFileExtensions : ['jpg', 'png','gif'],//接收的文件后缀
|
||||
showUpload: false, //是否显示上传按钮
|
||||
showRemove: false,
|
||||
showCaption: false,//是否显示标题
|
||||
showClose:false,//右上角关闭按钮
|
||||
browseClass: "btn btn-primary", //按钮样式
|
||||
maxFileCount: 1, //表示允许同时上传的最大文件个数
|
||||
enctype: 'multipart/form-data',
|
||||
validateInitialCount:true,
|
||||
maxFileSize:2000, //图片最大为2M
|
||||
dropZoneEnabled: false,
|
||||
autoReplace:true,//是否自动替换当前图片
|
||||
previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
|
||||
uploadExtraData:function (previewId, index) { //传参
|
||||
var data = {
|
||||
/* "masterId": '${masterId}', //此处自定义传参
|
||||
"tbName": '${tbName}',
|
||||
"nameSpace": 'HeadPortrait' */
|
||||
};
|
||||
return data;
|
||||
},
|
||||
layoutTemplates:{
|
||||
//图片缩略图上的删除,上传按钮
|
||||
actionDelete:'',
|
||||
actionUpload:''
|
||||
},
|
||||
});
|
||||
control.on("filebatchselected", function (event, data, previewId, index) {
|
||||
$(this).fileinput("upload");
|
||||
});
|
||||
//导入文件上传完成之后的事件
|
||||
control.on("fileuploaded", function (event, data, previewId, index) {
|
||||
if(data.response.suc) {
|
||||
closeModal('fileinputHeadPortraitModal');
|
||||
closeModal('subPasswordModal');
|
||||
goToMainPage();
|
||||
}
|
||||
});
|
||||
}
|
||||
$(function() {
|
||||
initFileInput("filelist",ext.contextPath+ "/user/inputHeadPortrait.do");
|
||||
})
|
||||
</script>
|
||||
<div class="modal fade" id="fileinputHeadPortraitModal">
|
||||
<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强制为subForm -->
|
||||
<form class="form-horizontal" id="fileInputModalForm" style="padding:10px">
|
||||
<div class="form-group" >
|
||||
<input type="file" name="filelist" id="filelist" multiple class="file-loading" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
399
WebRoot/jsp/user/findUser.jsp
Normal file
399
WebRoot/jsp/user/findUser.jsp
Normal file
@ -0,0 +1,399 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<script type="text/javascript">
|
||||
//var companyId = "";
|
||||
|
||||
var doSearchUser = function() {
|
||||
$("#table_user").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
/* function doSelect(dialog,grid) {
|
||||
//var checkedItems = $("#table_user").bootstrapTable('getAllSelections');
|
||||
var datas="";
|
||||
datas_name="";
|
||||
$.each(selectionIds, function(index, item){
|
||||
if(datas!=""){
|
||||
datas+=",";
|
||||
}
|
||||
datas+=item;
|
||||
});
|
||||
$.post(ext.contextPath + '/user/getUsersByIds.do', {userIds : datas}, function(resp) {
|
||||
$.each(resp, function(index, item){
|
||||
if(datas_name!=""){
|
||||
datas_name+=",";
|
||||
}
|
||||
datas_name+=item.caption;
|
||||
});
|
||||
//$('#${param.formId} #${param.hiddenId}' ).val(datas);
|
||||
//$('#${param.formId} #${param.textId}').val(datas_name);
|
||||
closeModal("user4SelectModal")
|
||||
},'json');
|
||||
|
||||
|
||||
}; */
|
||||
|
||||
/* function doSelect(){
|
||||
|
||||
var checkedItems = $("#table_user").bootstrapTable('getAllSelections');
|
||||
//console.log(checkedItems);
|
||||
|
||||
var id="";
|
||||
var name="";
|
||||
$.each(checkedItems,function(index,value){
|
||||
name+=checkedItems[index].name+",";
|
||||
id+=checkedItems[index].id+",";
|
||||
})
|
||||
//console.log("name如下============");
|
||||
//console.log(name);
|
||||
$('#userName').text(name);
|
||||
$('#userId').val(id);
|
||||
closeModal("user4SelectModal");
|
||||
$('#companySelectTreeSecond').html('');
|
||||
} */
|
||||
|
||||
function doSelect(){
|
||||
//console.log("doSelect selectionIds==================="+selectionIds);
|
||||
var ids="";
|
||||
if(selectionIds.length>0){
|
||||
for(var i=0;i<selectionIds.length;i++){
|
||||
//console.log(i+"================"+selectionIds[i]);
|
||||
ids+=selectionIds[i]+",";
|
||||
}
|
||||
} else{
|
||||
closeModal("user4SelectModal");
|
||||
return;
|
||||
}
|
||||
//console.log("ids selectionIds==================="+ids);
|
||||
var id="";
|
||||
var name="";
|
||||
$.post(ext.contextPath + "/user/findUserByIds.do", {userIdsStr:ids}, function (data) {
|
||||
console.log({data});
|
||||
$.each(data,function(index,value){
|
||||
id+=data[index].id+",";
|
||||
name+=data[index].caption+",";
|
||||
})
|
||||
//console.log({id});
|
||||
//console.log({name});
|
||||
$('#userName').text(name);
|
||||
$('#userId').val(id);
|
||||
closeModal("user4SelectModal");
|
||||
$('#companySelectTreeSecond').html('');
|
||||
},'json');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag=false;
|
||||
$.each(eval('${users}'), function(index, item){
|
||||
if(row.id==item.id){
|
||||
flag=true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked : true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
var $table;
|
||||
var switchStatus=false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds(){
|
||||
var userIds='${users}';
|
||||
var check_array='';
|
||||
if(userIds.length>0){
|
||||
check_array=userIds.split(",");
|
||||
}
|
||||
|
||||
//console.log("userIds=============================="+userIds);
|
||||
|
||||
if(''!=check_array && check_array!=null && check_array.length>0){
|
||||
selectionIds =new Array(check_array.length);
|
||||
for(var i=0;i<check_array.length;i++){
|
||||
selectionIds[i]=check_array[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
/* function getCheckedIds(){
|
||||
var ids="";
|
||||
var check_array =eval('${users}');
|
||||
$.each(check_array, function(index, item){
|
||||
if(ids!=""){
|
||||
ids+=",";
|
||||
}
|
||||
ids+=item.id;
|
||||
});
|
||||
return ids;
|
||||
} */
|
||||
function queryParams(params) {
|
||||
|
||||
var temp={
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_userName').val(),
|
||||
search_pid:companyId,
|
||||
//pid:companyId,
|
||||
jobIds:$('#jobIds').val()
|
||||
};
|
||||
return temp;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + "/user/showCompanySelectTree.do", {}, function (data) {
|
||||
$('#companySelectTreeSecond').html(data);
|
||||
|
||||
});
|
||||
|
||||
$("#search_userName").keyup(function(){
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车查询
|
||||
doSearchUser();
|
||||
event.stopPropagation();
|
||||
}
|
||||
})
|
||||
/* //简易公司combotree
|
||||
$.post(ext.contextPath + '/user/getAllCompanyForTree.do', { ng: '' }, function (data) {
|
||||
if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
||||
$('#companiestree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companiestree').on('nodeSelected', function (event, data) {
|
||||
$("#search_userPid").val(data.id);
|
||||
$("#coname_input").val(data.text);
|
||||
document.getElementById('user_tree').style.display = "none";
|
||||
companyId= data.id;
|
||||
doSearchUser();
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#user_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#user_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
}) */
|
||||
|
||||
initialSelectionIds();
|
||||
|
||||
//20200416 start==============================================
|
||||
$table=$("#table_user").bootstrapTable({ // 对应table标签的id
|
||||
//url: ext.contextPath + '/user/getUserForSelects.do', // 获取表格数据的url
|
||||
url: ext.contextPath + '/user/getUsers.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect:true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 20, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
clickToSelect:true,
|
||||
//responseHandler:responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
formatter: function (i,row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if($.inArray(row.id,Array.from(selectionIds))!=-1){ // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked : true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
},{
|
||||
field: 'caption',
|
||||
title: "姓名",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '30%'
|
||||
},{
|
||||
field: '_pname',
|
||||
title: "公司/部门",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '70%'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table_user");
|
||||
|
||||
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
},
|
||||
|
||||
/**
|
||||
jQuery 事件: click-row.bs.table
|
||||
|
||||
参数: row, $element, field
|
||||
|
||||
详情:
|
||||
|
||||
用户点击一行时触发,参数包含:
|
||||
|
||||
row: 与单击的行对应的记录。
|
||||
$element: tr元素。
|
||||
field:与单击的单元格对应的字段名称。
|
||||
*/
|
||||
onCheck:function(row, $element, field){
|
||||
//console.log("selectionIds onClickRow========1=========="+row.id);
|
||||
//console.log("selectionIds onClickRow========1=========="+selectionIds);
|
||||
if(selectionIds.length >0 && ''!=selectionIds ){
|
||||
|
||||
var num=$.inArray(row.id,selectionIds);
|
||||
if(num == -1){
|
||||
//console.log("=======调用了我1=======");
|
||||
selectionIds.push(row.id);
|
||||
}
|
||||
}else if(selectionIds.length <=0 || ''==selectionIds){
|
||||
//console.log("=======调用了我2=======");
|
||||
selectionIds.push(row.id);
|
||||
}
|
||||
//console.log("selectionIds onClickRow========2=========="+selectionIds);
|
||||
},
|
||||
|
||||
/**
|
||||
jQuery 事件: uncheck.bs.table
|
||||
|
||||
参数: row, $element
|
||||
|
||||
详情:
|
||||
|
||||
当用户取消选中一行时触发,参数包含:
|
||||
|
||||
row: 与单击的行对应的记录。
|
||||
$element: 未选中DOM元素。
|
||||
*/
|
||||
onUncheck:function(row, $element){
|
||||
var num=$.inArray( row.id, selectionIds );
|
||||
if(num!=-1){
|
||||
selectionIds.splice(num,1);
|
||||
}
|
||||
//console.log("selectionIds onUncheck===================="+selectionIds);
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
/* $table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e,rows, obj) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
if('check'==e.type){
|
||||
obj.parent().addClass("checked");
|
||||
}else{
|
||||
obj.parent().removeClass("checked");
|
||||
}
|
||||
//adjustBootstrapTableView("table_user");
|
||||
}); */
|
||||
//20200416 end==============================================
|
||||
});
|
||||
|
||||
|
||||
//选中事件操作数组
|
||||
/* var union = function(array,ids){
|
||||
$.each(ids, function (i, id) {
|
||||
if($.inArray(id,array)==-1){
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
}; */
|
||||
//取消选中事件操作数组
|
||||
/* var difference = function(array,ids){
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id,array);
|
||||
if(index!=-1){
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
}; */
|
||||
//var _ = {"union":union,"difference":difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
/* function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
} */
|
||||
|
||||
var initFun = function(){
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="user4SelectModal">
|
||||
<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 " style="width:100%">
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="jobIds"name="jobIds" class="form-control" placeholder="职位Ids" value="${jobIds }">
|
||||
<!-- <ul id="companyForUserSelect" style="list-style-type:none;padding-left:0px;width:260px;">
|
||||
<li class="dropdown" style="width:260px;">
|
||||
Menu toggle button
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
||||
style="width:260px;" onclick="document.getElementById('user_tree').style.display = 'block';">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"
|
||||
style="height:34px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
||||
<input class="form-control " id="coname_input" name="coname_input" placeholder="请选择"
|
||||
style="height:34px;width: 200px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
|
||||
readonly />
|
||||
</div>/input-group
|
||||
</a>
|
||||
<ul id="user_tree" class="dropdown-menu" data-stopPropagation="true">
|
||||
<li class="header">
|
||||
<div id="companiestree" style="width: 250px;height:300px; overflow:auto;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul> -->
|
||||
<div id="companySelectTreeSecond"></div>
|
||||
</div>
|
||||
<div class="input-group input-group-sm pull-right" style="width: 250px;">
|
||||
<input type="text" id="search_userName" autocomplete="off" name="search_userName" class="form-control" style="height:34px" placeholder="姓名">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchUser();" style="height:34px"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table_user"></table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" onclick="doSelect()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
78
WebRoot/jsp/user/importUsers.jsp
Normal file
78
WebRoot/jsp/user/importUsers.jsp
Normal file
@ -0,0 +1,78 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>导入人员</title>
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script>
|
||||
var uploader,state;
|
||||
$(function() {
|
||||
var $ = jQuery,
|
||||
$list = $('#thelist'),
|
||||
state = 'pending';
|
||||
|
||||
uploader = WebUploader.create({
|
||||
// swf文件路径
|
||||
swf: ext.contextPath+'/JS/webuploader-0.1.5/Uploader.swf',
|
||||
// 文件接收服务端。
|
||||
server: ext.contextPath+'/user/importUsers.do',
|
||||
// 选择文件的按钮。可选。
|
||||
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
|
||||
pick: {
|
||||
id: '#picker',
|
||||
multiple: false
|
||||
},
|
||||
// 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
|
||||
resize: false,
|
||||
accept: {
|
||||
title: 'Excel',
|
||||
extensions: 'xls,xlsx',
|
||||
mimeTypes: 'excel/*'
|
||||
}
|
||||
});
|
||||
//当有文件被添加进队列的时候
|
||||
uploader.on( 'fileQueued', function( file ) {
|
||||
$list.append( '<div id="' + file.id + '" class="item">' +
|
||||
'<h4 class="info">' + file.name + '</h4>' +
|
||||
'<p class="state">等待上传...</p>' +
|
||||
'</div>' );
|
||||
});
|
||||
});
|
||||
|
||||
var doimport = function(dialog, grid){
|
||||
//执行上传功能
|
||||
if ( state === 'uploading' ) {
|
||||
alert("文件正在上传中,请稍等");
|
||||
} else {
|
||||
uploader.upload();
|
||||
}
|
||||
|
||||
uploader.on( 'uploadError', function( file ) {
|
||||
$( '#'+file.id ).find('p.state').text('上传出错');
|
||||
});
|
||||
|
||||
uploader.on( 'uploadSuccess', function( file,response ) {
|
||||
$( '#'+file.id ).find('p.state').text('已上传');
|
||||
if(response.feedback!=null&&response.feedback!=""){
|
||||
alert(response.feedback);
|
||||
grid.datagrid('reload');
|
||||
dialog.dialog('destroy');
|
||||
}else{
|
||||
alert("导入未完成!");
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="uploader" class="wu-example">
|
||||
<div class="btns">
|
||||
<div id="picker">选择文件</div>
|
||||
</div>
|
||||
<!--用来存放文件信息-->
|
||||
<div id="thelist" class="uploader-list"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
78
WebRoot/jsp/user/importUsers2.jsp
Normal file
78
WebRoot/jsp/user/importUsers2.jsp
Normal file
@ -0,0 +1,78 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>导入人员</title>
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script>
|
||||
var uploader,state;
|
||||
$(function() {
|
||||
var $ = jQuery,
|
||||
$list = $('#thelist'),
|
||||
state = 'pending';
|
||||
|
||||
uploader = WebUploader.create({
|
||||
// swf文件路径
|
||||
swf: ext.contextPath+'/JS/webuploader-0.1.5/Uploader.swf',
|
||||
// 文件接收服务端。
|
||||
server: ext.contextPath+'/user/importUsers2.do',
|
||||
// 选择文件的按钮。可选。
|
||||
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
|
||||
pick: {
|
||||
id: '#picker',
|
||||
multiple: false
|
||||
},
|
||||
// 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
|
||||
resize: false,
|
||||
accept: {
|
||||
title: 'Excel',
|
||||
extensions: 'xls,xlsx',
|
||||
mimeTypes: 'excel/*'
|
||||
}
|
||||
});
|
||||
//当有文件被添加进队列的时候
|
||||
uploader.on( 'fileQueued', function( file ) {
|
||||
$list.append( '<div id="' + file.id + '" class="item">' +
|
||||
'<h4 class="info">' + file.name + '</h4>' +
|
||||
'<p class="state">等待上传...</p>' +
|
||||
'</div>' );
|
||||
});
|
||||
});
|
||||
|
||||
var doimport = function(dialog, grid){
|
||||
//执行上传功能
|
||||
if ( state === 'uploading' ) {
|
||||
alert("文件正在上传中,请稍等");
|
||||
} else {
|
||||
uploader.upload();
|
||||
}
|
||||
|
||||
uploader.on( 'uploadError', function( file ) {
|
||||
$( '#'+file.id ).find('p.state').text('上传出错');
|
||||
});
|
||||
|
||||
uploader.on( 'uploadSuccess', function( file,response ) {
|
||||
$( '#'+file.id ).find('p.state').text('已上传');
|
||||
if(response.feedback!=null&&response.feedback!=""){
|
||||
alert(response.feedback);
|
||||
grid.datagrid('reload');
|
||||
dialog.dialog('destroy');
|
||||
}else{
|
||||
alert("导入未完成!");
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="uploader" class="wu-example">
|
||||
<div class="btns">
|
||||
<div id="picker">选择文件</div>
|
||||
</div>
|
||||
<!--用来存放文件信息-->
|
||||
<div id="thelist" class="uploader-list"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
201
WebRoot/jsp/user/improveUserInformation.jsp
Normal file
201
WebRoot/jsp/user/improveUserInformation.jsp
Normal file
@ -0,0 +1,201 @@
|
||||
<%@page import="com.sipai.tools.CommString"%>
|
||||
<%@ 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"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<%-- <% request.setAttribute("VisitWeChatLogin", CommString.VisitWeChatLogin); %> --%>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<script src="JS/module/login/login.js" type="text/javascript"></script>
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
var doupdate = function() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
$('#registerbut').attr('disabled',"true");
|
||||
setTimeout(function(){
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/updateUserInformation.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1) {
|
||||
showAlert('s','注册成功,系统即将自动登录...');
|
||||
$('#registerbut').attr('disabled',"true");
|
||||
var wechatid = '${user.wechatid}';
|
||||
var url=ext.contextPath+"/j_spring_security_check";
|
||||
$.post(url , {weChatId:wechatid}, function(result) {
|
||||
location.replace(ext.contextPath);
|
||||
},'json');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','注册失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
$('#registerbut').removeAttr("disabled");
|
||||
}, 500);
|
||||
};
|
||||
|
||||
$(function() {
|
||||
var result = '${result}';
|
||||
if(result=='1'){
|
||||
$("#successed").attr("style","display:none;");//隐藏div
|
||||
}else if(result=='0'){
|
||||
$("#successful").attr("style","display:none;");//隐藏div
|
||||
}
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
caption: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '用户名不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
mobile: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '手机号不能为空'
|
||||
},
|
||||
stringLength: {//检测长度
|
||||
min: 11,
|
||||
max: 11,
|
||||
message: '请输入中国大陆11位手机号'
|
||||
},
|
||||
remote: {//ajax验证。server result:{"valid",true or false} 向服务发送当前input name值,获得一个json数据。例表示正确:{"valid",true}
|
||||
url: ext.contextPath + '/user/checkExist.do',//验证地址
|
||||
message: '用户已存在',//提示消息
|
||||
type: 'POST',//请求方式
|
||||
data: function(validator) {
|
||||
return {
|
||||
mobile: $('#mobile').val()
|
||||
};
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
verificationcode: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '验证码不能为空'
|
||||
},
|
||||
stringLength: {//检测长度
|
||||
min: 6,
|
||||
max: 6,
|
||||
message: '请输入6位验证码'
|
||||
},
|
||||
remote: {//ajax验证。server result:{"valid",true or false} 向服务发送当前input name值,获得一个json数据。例表示正确:{"valid",true}
|
||||
url: ext.contextPath + '/user/checkVerificationCode.do',//验证地址
|
||||
message: '验证码不正确',//提示消息
|
||||
type: 'POST',//请求方式
|
||||
data: function(validator) {
|
||||
return {
|
||||
mobile: $('#mobile').val(),
|
||||
verificationcode: $('#verificationcode').val()
|
||||
};
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
//微信授权一键登录
|
||||
var dologin = function(){
|
||||
var wechatid = '${user.wechatid}';
|
||||
var url=ext.contextPath+"/j_spring_security_check";
|
||||
$.post(url , {weChatId:wechatid}, function(result) {
|
||||
location.replace(ext.contextPath);
|
||||
},'json');
|
||||
};
|
||||
//发送验证码
|
||||
var sendVerificationCode = function(){
|
||||
//验证手机号码
|
||||
$("#subForm").data("bootstrapValidator").validateField("mobile");
|
||||
//延迟加载,避免出现手机号第一次验证全为false现象
|
||||
setTimeout(function(){
|
||||
if($("#subForm").data("bootstrapValidator").isValidField("mobile")){
|
||||
//验证码倒计时,发送验证码按钮不可用
|
||||
$("#sendButton").attr("disabled","true");
|
||||
$("#sendButton").html('重新发送<b id="countdown">(60s)</b>');
|
||||
var countdown = document.getElementById("countdown");
|
||||
var i = 60;
|
||||
var timer = setInterval(function(){
|
||||
i--;
|
||||
countdown.innerHTML = "("+i+"s)";
|
||||
if(i==0){
|
||||
$("#sendButton").removeAttr("disabled");
|
||||
$("#sendButton").html("发送验证码");
|
||||
}
|
||||
},1000);
|
||||
$.post(ext.contextPath + "/user/sendVerificationCode.do", {mobile:$("#mobile").val()}, function(data) {
|
||||
/* if (data.result == "true") {
|
||||
}else if(data.result == "false"){
|
||||
} */
|
||||
},'json');
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body class="hold-transition register-page">
|
||||
<div class="register-box">
|
||||
<div class="register-logo">
|
||||
<a href="../../index2.html"><b>运维平台</b></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 账号已存在 -->
|
||||
<div class="register-box-body" id="successed">
|
||||
<p class="login-box-msg">你的微信授权账户已经被注册过</p>
|
||||
<p class="login-box-msg">是否直接授权登录</p>
|
||||
<button type="button" class="btn btn-primary btn-block btn-flat" onclick="dologin();">授权登录</button>
|
||||
</div>
|
||||
<!--首次注册,完善信息 -->
|
||||
<div class="register-box-body" id="successful">
|
||||
<p class="login-box-msg">已授权成功</p>
|
||||
<p class="login-box-msg">请继续完善你的个人信息</p>
|
||||
<form id ="subForm">
|
||||
<div id="alertDiv"></div>
|
||||
<input id ="id" name="id" type="hidden" value="${user.id}"/>
|
||||
<input id ="wechatid" name="wechatid" type="hidden" value="${user.wechatid}"/>
|
||||
<input id ="sex" name="sex" type="hidden" value="${user.sex}"/>
|
||||
<input id ="pid" name="pid" type="hidden" value="${user.pid}"/>
|
||||
<div class="form-group has-feedback">
|
||||
<input type="text" class="form-control" id="caption" name="caption" placeholder="请输入真实姓名">
|
||||
<span class="glyphicon glyphicon-user form-control-feedback"></span>
|
||||
</div>
|
||||
<div class="form-group has-feedback">
|
||||
<input type="tel" class="form-control" id ="mobile" name="mobile" placeholder="手机">
|
||||
<span class="glyphicon glyphicon-earphone form-control-feedback"></span>
|
||||
</div>
|
||||
<div class="form-group ">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id ="verificationcode" name="verificationcode" placeholder="验证码">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" id="sendButton" class="btn btn-info btn-flat" onclick="sendVerificationCode();">发送验证码</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-xs-4 pull-right">
|
||||
<button type="button" id='registerbut' class="btn btn-primary btn-block btn-flat" onclick="doupdate();">保存</button>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
</form>
|
||||
<text class="text-center">保存后,将自动登录系统</text><br>
|
||||
<text class="text-center">初始用户名为手机号,密码为123456<br>登录后请尽快修改个人密码</text>
|
||||
</div>
|
||||
<!-- /.form-box -->
|
||||
</div>
|
||||
<!-- /.register-box -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
347
WebRoot/jsp/user/job4selects.jsp
Normal file
347
WebRoot/jsp/user/job4selects.jsp
Normal file
@ -0,0 +1,347 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var doSearchUser = function () {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
function dosave(dialog, grid) {
|
||||
//var checkedItems = $("#table_user").bootstrapTable('getAllSelections');
|
||||
var datas = "";
|
||||
$.each(selectionIds, function (index, item) {
|
||||
if (typeof (item) != "undefined") {
|
||||
datas += item + ",";
|
||||
}
|
||||
|
||||
});
|
||||
$.post(ext.contextPath + '/user/updateModelNodeJob.do', {
|
||||
jobids: datas,
|
||||
resourceid: "${resourceId}",
|
||||
modelid: "${modelId}"
|
||||
}, function (data) {
|
||||
if (data >= 0) {
|
||||
closeModal('roleUserModal');
|
||||
$("#table1").bootstrapTable("refresh");
|
||||
} else {
|
||||
showAlert('d', '保存失败');
|
||||
}
|
||||
});
|
||||
closeModal('jobModal');
|
||||
$("#table1").bootstrapTable("refresh");
|
||||
};
|
||||
|
||||
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag = false;
|
||||
$.each(eval('${jobs}'), function (index, item) {
|
||||
if (row.id == item.empid) {
|
||||
flag = true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked: true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
|
||||
var $table;
|
||||
var switchStatus = false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds() {
|
||||
var check_array = eval('${jobs}');
|
||||
if (check_array != null && check_array.length > 0) {
|
||||
selectionIds = new Array(check_array.length);
|
||||
for (var i = 0; i < check_array.length; i++) {
|
||||
selectionIds[i] = check_array[i].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getCheckedIds() {
|
||||
var ids = "";
|
||||
var check_array = eval('${jobs}');
|
||||
$.each(check_array, function (index, item) {
|
||||
if (ids != "") {
|
||||
ids += ",";
|
||||
}
|
||||
ids += item.id;
|
||||
});
|
||||
return ids;
|
||||
}
|
||||
|
||||
function queryParams(params) {
|
||||
var temp = {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_name_user').val(),
|
||||
search_pid: companyId
|
||||
};
|
||||
var status = $('#switchBtn').bootstrapSwitch('state')
|
||||
if (status) {
|
||||
temp.checkedIds = getCheckedIds();
|
||||
console.log("temp.checkedIds is ", temp.checkedIds)
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
var companyId = unitId;
|
||||
$(function () {
|
||||
$("#searchForm_User").attr("onsubmit", "return false;");
|
||||
$("#search_name_user").keyup(function () {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车执行查询
|
||||
doSearchUser();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
//jquery html()方法加载,导致box无法执行boxwidget(),手动初始化
|
||||
$('#searchBox').boxWidget();
|
||||
/* $("#search_pid").select2({
|
||||
ajax: {
|
||||
type:'POST',
|
||||
url: ext.contextPath +"/user/getJobs.do",
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
processResults: function (data) {
|
||||
return {
|
||||
results: data
|
||||
}
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
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;} // 函数用于呈现当前的选择
|
||||
}); */
|
||||
//$("#active").select2({minimumResultsForSearch: 10}).val("${menu.active}").trigger("change");
|
||||
$('#switchBtn').bootstrapSwitch({
|
||||
onText: '是',
|
||||
offText: '否',
|
||||
size: "small",
|
||||
})
|
||||
$(".select2-selection--single").css({'height': '30px', 'paddingTop': '4px'});
|
||||
|
||||
/* $.post(ext.contextPath + "/user/showCompanySelectTree.do", {}, function (data) {
|
||||
$('#companySelectTree').html(data);
|
||||
|
||||
}); */
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + '/user/getAllCompanyForTree.do', {ng: ''}, function (data) {
|
||||
if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
||||
$('#companiestree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companiestree').on('nodeSelected', function (event, data) {
|
||||
$("#search_userPid").val(data.id);
|
||||
$("#coname_input").val(data.text);
|
||||
document.getElementById('user_tree').style.display = "none";
|
||||
companyId = data.id;
|
||||
doSearchUser();
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#user_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#user_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
});
|
||||
initialSelectionIds();
|
||||
|
||||
$table = $("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getJobs.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect: true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 20, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
responseHandler: responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
//formatter: stateFormatter
|
||||
formatter: function (i, row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if ($.inArray(row.id, Array.from(selectionIds)) != -1) { // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked: true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
}, /* {
|
||||
field: 'serial', // 返回json数据中的name
|
||||
title: '流程组id', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
width: '30%'
|
||||
}, */{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '职位名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
width: '30%'
|
||||
}, {
|
||||
field: 'user', // 返回json数据中的name
|
||||
title: '人员', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width: '70%',
|
||||
formatter: function (value, row, index) {
|
||||
var res = "";
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
if (value[i] != null) {
|
||||
if (i == value.length - 1) {
|
||||
res += value[i].caption;
|
||||
} else {
|
||||
res += value[i].caption + ","
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
|
||||
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e, rows) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
});
|
||||
});
|
||||
|
||||
//选中事件操作数组
|
||||
var union = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
if ($.inArray(id, array) == -1) {
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//取消选中事件操作数组
|
||||
var difference = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id, array);
|
||||
if (index != -1) {
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union": union, "difference": difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<div class="modal fade" id="jobModal">
|
||||
<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 " style="width:100%">
|
||||
<div id="alertDiv"></div>
|
||||
<input type="hidden" id="modelId" value="${modelId }">
|
||||
<input type="hidden" id="resourceId" value="${resourceId }">
|
||||
<div class="form-group" style="display: inline-block">
|
||||
<ul id="companyForUserSelect" style="list-style-type:none;padding-left:0px;width:260px;">
|
||||
<li class="dropdown" style="width:260px;">
|
||||
<!-- Menu toggle button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
||||
style="width:260px;"
|
||||
onclick="document.getElementById('user_tree').style.display = 'block';">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"
|
||||
style="height:34px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
||||
<input class="form-control " id="coname_input" name="coname_input"
|
||||
placeholder="请选择"
|
||||
style="height:34px;width: 200px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
|
||||
readonly/>
|
||||
</div><!-- /input-group -->
|
||||
</a>
|
||||
<ul id="user_tree" class="dropdown-menu" data-stopPropagation="true">
|
||||
<li class="header">
|
||||
<div id="companiestree" style="width: 250px;height:300px; overflow:auto;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="input-group input-group-sm pull-right">
|
||||
<%-- <div style="display: inline-block">
|
||||
<input type="text" id="search_name_user" autocomplete="off" name="search_name_user"
|
||||
class="form-control pull-right" style="height:34px;" placeholder="职位">
|
||||
</div>
|
||||
<div class="input-group-btn pull-right" style="margin-right: 20px; z-index: 99999">
|
||||
<button class="btn btn-default" onclick="doSearchUser();" style="height:34px"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>--%>
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name_user" name="search_name_user"
|
||||
class="form-control pull-right" placeholder="职位">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchUser();"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div id="table" style="height:250px;width:100%"></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" onclick="dosave()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
175
WebRoot/jsp/user/jobAdd.jsp
Normal file
175
WebRoot/jsp/user/jobAdd.jsp
Normal file
@ -0,0 +1,175 @@
|
||||
<!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 () {
|
||||
var selelct_3Data = jQuery.parseJSON('${positionTypeList}');
|
||||
var selelct_3 = $("#levelType0").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");
|
||||
});
|
||||
|
||||
function dosave() {
|
||||
$("#addForm").bootstrapValidator('validate');//提交验证
|
||||
setTimeout(function () {
|
||||
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/saveJob.do", $("#addForm").serialize(), function (data) {
|
||||
if (data.res >= 1) {
|
||||
companyId = $("#pid").val();
|
||||
$("#table").bootstrapTable('refresh');
|
||||
closeModal("subModal");
|
||||
} else {
|
||||
showAlert('d', '保存失败');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
||||
$("#addForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
positionName: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '职位名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
userName: {
|
||||
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");
|
||||
});
|
||||
};
|
||||
|
||||
var showUser4SelectsFun = function () {
|
||||
var userIds = $("#userId").val();
|
||||
$.post(ext.contextPath + '/user/layerUser.do', {
|
||||
formId: "addForm",
|
||||
hiddenId: "userId",
|
||||
textId: "userName",
|
||||
userIds: userIds
|
||||
// fucname: 'aa'
|
||||
}, function (data) {
|
||||
$("#user4SelectDiv").html(data);
|
||||
openModal("user4SelectModal");
|
||||
});
|
||||
};
|
||||
|
||||
</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>
|
||||
<!-- 界面提醒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="_pname" name="_pname" placeholder="公司/部门"
|
||||
style="border-radius:4px;background-color:white"
|
||||
onclick="showUnit4SelectFun();" value="${unit.name}" readonly/>
|
||||
<input id="pid" name="pid" type="hidden" value="${unit.id}"/>
|
||||
</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="positionID" name="positionID"
|
||||
value="${positionID}" style="border-radius:4px" readonly/>
|
||||
</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="positionName" name="positionName"
|
||||
placeholder="职位" 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="levelType0" name="levelType"
|
||||
style="width:200px;"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">*人员</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control " id="userName" name="userName" rows="3" placeholder="点击选择"
|
||||
onclick="showUser4SelectsFun();"></textarea>
|
||||
<input id="userId" name="userId" type="hidden" value=""/>
|
||||
</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="dosave()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
166
WebRoot/jsp/user/jobEdit.jsp
Normal file
166
WebRoot/jsp/user/jobEdit.jsp
Normal file
@ -0,0 +1,166 @@
|
||||
<!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 () {
|
||||
var selelct_3Data = jQuery.parseJSON('${positionTypeList}');
|
||||
var selelct_3 = $("#levelType1").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('${jobList[0].levelType}').trigger("change");
|
||||
});
|
||||
|
||||
function doupdate() {
|
||||
$("#addForm").bootstrapValidator('validate');//提交验证
|
||||
setTimeout(function () {
|
||||
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/updateJob.do", $("#addForm").serialize(), function (data) {
|
||||
if (data.res >= 1) {
|
||||
companyId = $("#pid").val();
|
||||
$("#table").bootstrapTable('refresh');
|
||||
closeModal("subModal");
|
||||
} else {
|
||||
showAlert('d', '保存失败');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
||||
$("#addForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
positionName: {
|
||||
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");
|
||||
});
|
||||
};
|
||||
|
||||
//选人
|
||||
var showUser4SelectsFun = function () {
|
||||
var userIds = $("#userId").val();
|
||||
$.post(ext.contextPath + '/user/layerUser.do', {
|
||||
formId: "addForm",
|
||||
hiddenId: "userId", //输入框的id
|
||||
textId: "userName", //输入框的name
|
||||
userIds: userIds, //已选的人员id
|
||||
unitId: unitId //获取右上角的厂id
|
||||
// fucname: 'funcname'
|
||||
}, function (data) {
|
||||
$("#user4SelectDiv").html(data);
|
||||
openModal("user4SelectModal");
|
||||
});
|
||||
};
|
||||
|
||||
</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">
|
||||
<form class="form-horizontal" id="addForm">
|
||||
<div id="alertDiv"></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="_pname" name="_pname" placeholder="公司/部门"
|
||||
style="border-radius:4px;background-color:white"
|
||||
onclick="showUnit4SelectFun();" value="${unit.name}" readonly/>
|
||||
<input id="pid" name="pid" type="hidden" value="${unit.id}"/>
|
||||
</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="positionID" name="positionID"
|
||||
value="${jobList[0].id}" style="border-radius:4px" readonly/>
|
||||
</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="positionName" name="positionName"
|
||||
value="${jobList[0].name}" placeholder="职位" 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="levelType1" name="levelType"
|
||||
style="width:200px;"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">*人员</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control " id="userName" name="userName" rows="4" placeholder="点击选择"
|
||||
onclick="showUser4SelectsFun();"><c:forEach items="${jobList[0].user}"
|
||||
var="item">${item.caption},</c:forEach>
|
||||
</textarea>
|
||||
<input id="userId" name="userId" type="hidden" value="${userIds}"/>
|
||||
</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="doupdate()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
256
WebRoot/jsp/user/jobForSelectByStructure.jsp
Normal file
256
WebRoot/jsp/user/jobForSelectByStructure.jsp
Normal file
@ -0,0 +1,256 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<script type="text/javascript">
|
||||
var doSearchJob = function() {
|
||||
$("#table_job").bootstrapTable('refresh');
|
||||
};
|
||||
function doSelect(dialog,grid) {
|
||||
//var checkedItems = $("#table_job").bootstrapTable('getAllSelections');
|
||||
var datas="";
|
||||
datas_name="";
|
||||
$.each(selectionIds, function(index, item){
|
||||
if(datas!=""){
|
||||
datas+=",";
|
||||
}
|
||||
datas+=item;
|
||||
});
|
||||
$.post(ext.contextPath + '/user/getJobsByIds.do', {jobIds : datas}, function(resp) {
|
||||
$.each(resp, function(index, item){
|
||||
if(datas_name!=""){
|
||||
datas_name+=",";
|
||||
}
|
||||
datas_name+=item.name;
|
||||
});
|
||||
$('#${param.formId} #${param.hiddenId}' ).val(datas);
|
||||
$('#${param.formId} #${param.textId}').val(datas_name);
|
||||
closeModal("job4SelectModal")
|
||||
},'json');
|
||||
};
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag=false;
|
||||
$.each(eval('${jobs}'), function(index, item){
|
||||
if(row.id==item.id){
|
||||
flag=true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked : true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
var $table;
|
||||
var switchStatus=false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds(){
|
||||
var check_array =eval('${jobs}');
|
||||
if(check_array!=null&& check_array.length>0){
|
||||
selectionIds =new Array(check_array.length);
|
||||
for(var i=0;i<check_array.length;i++){
|
||||
selectionIds[i]=check_array[i].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getCheckedIds(){
|
||||
var ids="";
|
||||
var check_array =eval('${jobs}');
|
||||
$.each(check_array, function(index, item){
|
||||
if(ids!=""){
|
||||
ids+=",";
|
||||
}
|
||||
ids+=item.id;
|
||||
});
|
||||
return ids;
|
||||
}
|
||||
function queryParams(params) {
|
||||
|
||||
var temp={
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_jobName').val(),
|
||||
search_pid:checkedid,
|
||||
// jobIds:$('#jobIds').val()
|
||||
};
|
||||
return temp;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$("#search_jobName").keyup(function(){
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车查询
|
||||
doSearchJob();
|
||||
event.stopPropagation();
|
||||
}
|
||||
})
|
||||
|
||||
initTreeViewOnlyByJob();
|
||||
|
||||
initialSelectionIds();
|
||||
|
||||
$table=$("#table_job").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getJobs.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect:true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
clickToSelect:true,
|
||||
responseHandler:responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
//formatter: stateFormatter
|
||||
formatter: function (i,row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if($.inArray(row.id,Array.from(selectionIds))!=-1){ // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked : true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
},{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '职位名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
}, {
|
||||
field: 'user', // 返回json数据中的name
|
||||
title: '人员', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
formatter: function (value, row, index) {
|
||||
var res = "";
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
if (value[i]!=null) {
|
||||
if(i==value.length-1){
|
||||
res+=value[i].caption;
|
||||
}else{
|
||||
res+=value[i].caption+","
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table_job");
|
||||
|
||||
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e,rows, obj) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
if('check'==e.type){
|
||||
obj.parent().addClass("checked");
|
||||
}else{
|
||||
obj.parent().removeClass("checked");
|
||||
}
|
||||
//adjustBootstrapTableView("table_job");
|
||||
});
|
||||
});
|
||||
//选中事件操作数组
|
||||
var union = function(array,ids){
|
||||
$.each(ids, function (i, id) {
|
||||
if($.inArray(id,array)==-1){
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//取消选中事件操作数组
|
||||
var difference = function(array,ids){
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id,array);
|
||||
if(index!=-1){
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union":union,"difference":difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
var checkedid="";
|
||||
function initTreeViewOnlyByJob() {
|
||||
$.post(ext.contextPath + '/user/getAllParentByUnitId.do', {unitId:unitId}, function (data) {
|
||||
$('#companytree').treeview({
|
||||
data: data,
|
||||
showBorder: true,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companytree').on('nodeSelected', function (event, data) {
|
||||
checkedid=data.id;
|
||||
doSearchJob();
|
||||
});
|
||||
}, 'json');
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="job4SelectModal">
|
||||
<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 id="alertDiv"></div>
|
||||
<div class="col-sm-5">
|
||||
<div class="col-sm-12" >
|
||||
<div class="input-group input-group-sm pull-left" style="width: 250px;">
|
||||
<input type="text" id="search_jobName" autocomplete="off" name="search_jobName" class="form-control" style="height:34px" placeholder="岗位">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchJob();" style="height:34px"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12" style="padding-top: 5px;">
|
||||
<div id="companytree" style="height:100%;overflow:auto;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<table id="table_job"></table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" onclick="doSelect()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
317
WebRoot/jsp/user/jobList.jsp
Normal file
317
WebRoot/jsp/user/jobList.jsp
Normal file
@ -0,0 +1,317 @@
|
||||
<%@page import="com.sipai.tools.CommString" %>
|
||||
<%@ 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" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject" %>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%>
|
||||
</title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<!-- bootstrap switch -->
|
||||
<link rel="stylesheet"
|
||||
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css"/>
|
||||
<script type="text/javascript"
|
||||
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
var companyId = unitId;
|
||||
var addFun = function () {
|
||||
$.post(ext.contextPath + '/user/addJob.do', {companyId: companyId}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
var editFun = function (id) {
|
||||
stopBubbleDefaultEvent();
|
||||
$.post(ext.contextPath + '/user/editJob.do', {id: id, companyId: companyId}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
//删除一条数据
|
||||
var deleteFun = function (id) {
|
||||
stopBubbleDefaultEvent();
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(willDelete => {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/deleteJob.do', {id: id}, function (data) {
|
||||
if (data >= 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
//删除多条数据
|
||||
var deletesFun = function () {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||||
} else {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/deletesJob.do', {ids: datas}, function (data) {
|
||||
if (data >= 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//模糊查询列表中的数据
|
||||
var dosearch = function () {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
$(function () {
|
||||
|
||||
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + "/user/showCompanySelectTree.do", {}, function (data) {
|
||||
$('#companySelectTree').html(data);
|
||||
});
|
||||
|
||||
|
||||
$('#removea').click(function () {
|
||||
$('#search_name').val("");
|
||||
})
|
||||
});
|
||||
|
||||
var initFun = function () {
|
||||
$("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getListJob.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_name').val(),
|
||||
bizId: companyId,
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/*
|
||||
onClickRow: function (row) {//单击行事件,执行查看功能
|
||||
viewFun(row.id);
|
||||
},
|
||||
*/
|
||||
|
||||
/*
|
||||
responseHandler: function(res) {
|
||||
return {
|
||||
"rows": res.rows.user, //数据
|
||||
|
||||
};
|
||||
},
|
||||
*/
|
||||
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
},
|
||||
/*
|
||||
{
|
||||
field: 'companyName', // 返回json数据中的name
|
||||
title: '所属公司', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
*/
|
||||
{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '职位名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
|
||||
}, {
|
||||
field: 'user', // 返回json数据中的name
|
||||
title: '人员', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
formatter: function (value, row, index) {
|
||||
var res = "";
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
if (i == value.length - 1) {
|
||||
if (value[i] != null) {
|
||||
res += value[i].caption;
|
||||
}
|
||||
} else {
|
||||
if (value[i] != null) {
|
||||
res += value[i].caption + ","
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
}, {
|
||||
field: 'levelTypeName',
|
||||
title: "职位类型",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 120,// 定义列的宽度,单位为像素px
|
||||
// formatter: function (value, row, index) {
|
||||
// if (value === 0) {
|
||||
// return "基层";
|
||||
// } else if (value === 1) {
|
||||
// return "主办";
|
||||
// } else if (value === 2) {
|
||||
// return "中层";}
|
||||
// // } else if (value === 9) {
|
||||
// // return "其他";
|
||||
// // }
|
||||
// }
|
||||
}, {
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 120, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts = '';
|
||||
buts += '<security:authorize buttonUrl="user/edit.do">';
|
||||
buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
||||
buts += '</security:authorize>';
|
||||
|
||||
buts += '<security:authorize buttonUrl="user/delete.do">';
|
||||
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\'' + row.id + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button';
|
||||
buts += '</security:authorize>';
|
||||
|
||||
buts = '<div class="btn-group" >' + buts + '</div>';
|
||||
return buts;
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<!-- 引用top -->
|
||||
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
|
||||
<!-- 菜单栏 -->
|
||||
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
|
||||
<div class="content-wrapper">
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="unit4SelectDiv"></div>
|
||||
<div id="user4SelectDiv"></div>
|
||||
<div>
|
||||
<input type="hidden" id="companySelectTree" value="">
|
||||
<div>
|
||||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<security:authorize buttonUrl="user/add.do">
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i
|
||||
class="fa fa-plus"></i> 新增
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i
|
||||
class="fa fa-trash-o"></i> 删除
|
||||
</button>
|
||||
</security:authorize>
|
||||
</div>
|
||||
|
||||
<div class="form-group pull-right">
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right"
|
||||
placeholder="职位">
|
||||
<a class="glyphicon glyphicon-remove form-control-feedback btn-sm" id="removea"
|
||||
style="padding-top:6px;pointer-events: auto"></a>
|
||||
</input>
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="form-group " style="padding:0;"></div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
<table id="table"></table>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
|
||||
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
43
WebRoot/jsp/user/menu4select.jsp
Normal file
43
WebRoot/jsp/user/menu4select.jsp
Normal file
@ -0,0 +1,43 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<script type="text/javascript">
|
||||
var selectMenu = function() {
|
||||
|
||||
alert('${param.hiddenId}'+'${param.textId}');
|
||||
}
|
||||
$(function() {
|
||||
$.post(ext.contextPath + '/user/getMenusJson.do', {ng:''} , function(data) {
|
||||
console.info(data);
|
||||
if(data.length>0){
|
||||
$('#menu_select_tree').treeview({
|
||||
data: data,
|
||||
});
|
||||
$('#menu_select_tree').on('nodeSelected', function(event, data) {
|
||||
$('#${param.formId} #${param.hiddenId}' ).val(data.id);
|
||||
$('#${param.formId} #${param.textId}').val(data.text);
|
||||
closeModal("menu4SelectModal")
|
||||
});
|
||||
}
|
||||
},'json');
|
||||
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="menu4SelectModal">
|
||||
<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">
|
||||
<div id="menu_select_tree" style="height:430px;overflow:auto;width:100%"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<!-- <button type="button" class="btn btn-primary" onclick="selectMenu()">保存</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
173
WebRoot/jsp/user/menuAdd.jsp
Normal file
173
WebRoot/jsp/user/menuAdd.jsp
Normal file
@ -0,0 +1,173 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<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 showMenu4SelectFun = function () {
|
||||
$.post(ext.contextPath + '/user/showMenu4Select.do', { formId: "subForm", hiddenId: "pid", textId: "_pname" }, function (data) {
|
||||
$("#menu4SelectDiv").html(data);
|
||||
openModal('menu4SelectModal');
|
||||
});
|
||||
};
|
||||
function dosave() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/saveMenu.do", $("#subForm").serialize(), function (result) {
|
||||
if (result == 1) {
|
||||
initTreeView();
|
||||
//showAlert('s','保存成功');
|
||||
} else {
|
||||
showAlert('d', '保存失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
// _pname: {
|
||||
// validators: {
|
||||
// notEmpty: {
|
||||
// message: '上级菜单不能为空'
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
morder: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '顺序不能为空'
|
||||
},
|
||||
regexp: {
|
||||
regexp: /^[0-9]*$/,
|
||||
message: '顺序必须为数字'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// function saveDefault() {
|
||||
// if($("#location").val()==''){
|
||||
// top.$.messager.alert('提示','请先填写菜单地址','info');
|
||||
// }else{
|
||||
// if ($(".form").form('validate')) {
|
||||
// $.post(ext.contextPath + "/user/saveDefaultFunc.do", $(".form").serialize(), function(result) {
|
||||
// if (result > 0) {
|
||||
// top.$.messager.alert('提示', "保存成功", 'info', function() {
|
||||
// $('#grid').datagrid('reload');
|
||||
// });
|
||||
// } else {
|
||||
// top.$.messager.alert('提示', "保存失败", 'info');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// function dodel() {
|
||||
// top.$.messager.confirm('提示', '确定删除此菜单?', function(r) {
|
||||
// if (r) {
|
||||
// $.post(ext.contextPath + "/user/deleteMenu.do", $(".form").serialize(), function(result) {
|
||||
// if (result.res > 0) {
|
||||
// top.$.messager.alert('提示', "删除成功", 'info', function() {
|
||||
// //刷新树
|
||||
// parent.reloadTree();
|
||||
// parent.$("#mainFrame").attr("src",ext.contextPath+"/user/showMenuAdd.do?pid="+$("#pid").val());
|
||||
// });
|
||||
// } else {
|
||||
// top.$.messager.alert('提示', result.msg, 'info');
|
||||
// }
|
||||
// },'json');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
$(function () {
|
||||
//var active=$("#active").select2();
|
||||
$("#active").select2({ minimumResultsForSearch: 10 }).val("启用").trigger("change");
|
||||
//$("#target").select2({ minimumResultsForSearch: 10 }).val("${menu.target}").trigger("change");
|
||||
});
|
||||
</script>
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">新增</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<a onclick="dosave()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
||||
class="glyphicon glyphicon-floppy-disk"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<form class="form-horizontal " id="subForm">
|
||||
<input id="id" name="id" type="hidden" value="${menu.id}" />
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div id="menu4SelectDiv"></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="name" name="name" placeholder="名称"
|
||||
value="${menu.name }">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">上级菜单</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="_pname" name="_pname" placeholder="上级菜单"
|
||||
onclick="showMenu4SelectFun();" value="${pname}">
|
||||
<input id="pid" name="pid" type="hidden" value="${param.pid}" />
|
||||
</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="location" name="location" placeholder="地址"
|
||||
value="${menu.location}">
|
||||
</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="morder" name="morder" placeholder="顺序"
|
||||
value="${morder}">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">启用</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="active" name="active" class="form-control select2">
|
||||
<option value="启用">启用</option>
|
||||
<option value="禁用">禁用</option>
|
||||
</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="image" name="image" placeholder="fa图片" value="${menu.image}">
|
||||
</div>
|
||||
<!-- <label class="col-sm-2 control-label">目标</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="target" name="target" class="form-control select2">
|
||||
<option value="inside">内部</option>
|
||||
<option value="external">外部</option>
|
||||
</select>
|
||||
</div>-->
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
322
WebRoot/jsp/user/menuEdit.jsp
Normal file
322
WebRoot/jsp/user/menuEdit.jsp
Normal file
@ -0,0 +1,322 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<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 showMenu4SelectFun = function () {
|
||||
$.post(ext.contextPath + '/user/showMenu4Select.do', { formId: "subForm", hiddenId: "pid", textId: "_pname" }, function (data) {
|
||||
$("#menu4SelectDiv").html(data);
|
||||
openModal("menu4SelectModal")
|
||||
});
|
||||
};
|
||||
function dosave() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/updateMenu.do", $("#subForm").serialize(), function (result) {
|
||||
if (result == 1) {
|
||||
showAlert('s', '保存成功');
|
||||
} else {
|
||||
showAlert('d', '保存失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
_pname: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '上级菜单不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
morder: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '顺序不能为空'
|
||||
},
|
||||
regexp: {
|
||||
regexp: /^[0-9]*$/,
|
||||
message: '顺序必须为数字'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function saveDefault() {
|
||||
if ($("#location").val() == '') {
|
||||
showAlert('i', '请先填写菜单地址')
|
||||
} else {
|
||||
//if ($(".form").form('validate')) {
|
||||
$.post(ext.contextPath + "/user/saveDefaultFunc.do", $("#subForm").serialize(), function (result) {
|
||||
if (result > 0) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '默认权限添加失败', 'alertDiv_power');
|
||||
}
|
||||
});
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
function dodel() {
|
||||
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/deleteMenu.do', $("#subForm").serialize(), function (data) {
|
||||
if (data.res > 0) {
|
||||
initTreeView();
|
||||
} else {
|
||||
showAlert('d', '删除失败');
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
function delPowerFun(id) {
|
||||
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/deleteMenu.do', { id: id }, function (data) {
|
||||
if (data.res > 0) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'alertDiv_power');
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
var addPowerFun = function () {
|
||||
$.post(ext.contextPath + '/user/showFuncAdd.do', { pid: "${menu.id}" }, function (data) {
|
||||
$("#powerDiv").html(data);
|
||||
openModal('powerModal')
|
||||
});
|
||||
};
|
||||
var editPowerFun = function (id) {
|
||||
$.post(ext.contextPath + '/user/showFuncEdit.do', { id: id }, function (data) {
|
||||
$("#powerDiv").html(data);
|
||||
openModal('powerModal')
|
||||
});
|
||||
};
|
||||
$(function () {
|
||||
$("#active").select2({ minimumResultsForSearch: 10 }).val("${menu.active}").trigger("change");
|
||||
//$("#target").select2({ minimumResultsForSearch: 10 }).val("${menu.target}").trigger("change");
|
||||
$("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getFuncJson.do?id=${menu.id}', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order // 排序规则
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'location', // 返回json数据中的name
|
||||
title: '路径', // 表格表头显示文字
|
||||
align: 'left', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'pid', // 返回json数据中的name
|
||||
title: '所属菜单', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
formatter: function (value, row, index) {
|
||||
return row._pname;
|
||||
},
|
||||
}, {
|
||||
field: 'active', // 返回json数据中的name
|
||||
title: '状态', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 100, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
return '<div class="btn-group"><button class="btn btn-default btn-sm" onclick="editPowerFun(\'' + row.id + '\')"><i class="fa fa-edit"></i></button>' +
|
||||
'<button class="btn btn-default btn-sm" onclick="delPowerFun(\'' + row.id + '\')"><i class="fa fa-trash-o"></i></button></div>';
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
$(".bs-checkbox").css({ 'text-align': 'center', 'vertical-align': 'middle' })
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">详情</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<a onclick="dosave()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
||||
class="glyphicon glyphicon-floppy-disk"></i></a>
|
||||
<a onclick="dodel()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i
|
||||
class="glyphicon glyphicon-trash"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<form class="form-horizontal " id="subForm">
|
||||
<input id="id" name="id" type="hidden" value="${menu.id}" />
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div id="menu4SelectDiv"></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="name" name="name" placeholder="名称" value="${menu.name }">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">上级菜单</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="_pname" name="_pname" placeholder="上级菜单"
|
||||
onclick="showMenu4SelectFun();" value="${menu._pname}">
|
||||
<input id="pid" name="pid" type="hidden" value="${menu.pid}" />
|
||||
</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="location" name="location" placeholder="地址"
|
||||
value="${menu.location}">
|
||||
</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="morder" name="morder" placeholder="顺序" value="${menu.morder}">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">启用</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="active" name="active" class="form-control select2">
|
||||
<option value="启用">启用</option>
|
||||
<option value="禁用">禁用</option>
|
||||
</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="image" name="image" placeholder="fa图片" value="${menu.image}">
|
||||
</div>
|
||||
<!--<label class="col-sm-2 control-label">目标</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="target" name="target" class="form-control select2">
|
||||
<option value="inside">内部</option>
|
||||
<option value="external">外部</option>
|
||||
</select>
|
||||
</div>-->
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-solid">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">按钮及数据权限</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<div>
|
||||
<div id="alertDiv_power"></div>
|
||||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<button type="button" class="btn btn-default" onclick="addPowerFun();"><i class="fa fa-plus"></i> 新增</button>
|
||||
<button type="button" class="btn btn-default" onclick="saveDefault();"><i class="fa fa-plus-square"></i>
|
||||
默认</button>
|
||||
|
||||
</div>
|
||||
<div id="powerDiv"></div>
|
||||
<div id="menu4SelectDiv_func"></div>
|
||||
<br>
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
108
WebRoot/jsp/user/menuFuncAdd.jsp
Normal file
108
WebRoot/jsp/user/menuFuncAdd.jsp
Normal file
@ -0,0 +1,108 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<!-- <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 showMenu4SelectFun_func = function() {
|
||||
$.post(ext.contextPath + '/user/showMenu4Select.do', {formId:"subForm_func",hiddenId:"pid",textId:"_pname"} , function(data) {
|
||||
$("#menu4SelectDiv_func").html(data);
|
||||
openModal('menu4SelectModal');
|
||||
});
|
||||
};
|
||||
function dosave_func() {
|
||||
$("#subForm_func").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm_func").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/saveFunc.do", $("#subForm_func").serialize(), function(result) {
|
||||
if (result.res == 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
closeModal('powerModal');
|
||||
}else{
|
||||
showAlert('d','保存失败','alertDiv_func');
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
$("#subForm_func").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
$(function() {
|
||||
//var active=$("#active").select2();
|
||||
$("#active_func").select2({minimumResultsForSearch: 10}).val("启用").trigger("change");
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="powerModal">
|
||||
<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强制为subForm -->
|
||||
<form class="form-horizontal " id="subForm_func">
|
||||
<input id="id" name="id" type="hidden" value="${id}"/>
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv_func"></div>
|
||||
<!-- <div id="menu4SelectDiv_func"></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="name" name ="name" placeholder="名称" value="${name }">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">上级菜单</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="_pname" name ="_pname" placeholder="上级菜单" onclick="showMenu4SelectFun_func();" value="${_pname}">
|
||||
<input id="pid" name="pid" type="hidden" value="${pid}"/>
|
||||
</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="location" name ="location" placeholder="地址" value="${location}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<label class="col-sm-2 control-label">启用</label>
|
||||
<div class="col-sm-10">
|
||||
<select id ="active_func" name="active" class="form-control select2">
|
||||
<option value="启用" >启用</option>
|
||||
<option value="禁用" >禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
</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="dosave_func()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
95
WebRoot/jsp/user/menuFuncEdit.jsp
Normal file
95
WebRoot/jsp/user/menuFuncEdit.jsp
Normal file
@ -0,0 +1,95 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<!-- <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 showMenu4SelectFun_func = function() {
|
||||
$.post(ext.contextPath + '/user/showMenu4Select.do', {formId:"subForm_func",hiddenId:"pid",textId:"_pname"} , function(data) {
|
||||
$("#menu4SelectDiv_func").html(data);
|
||||
openModal('menu4SelectModal');
|
||||
});
|
||||
};
|
||||
function dosave_func() {
|
||||
//if ($("#subForm").form('validate')) {
|
||||
$.post(ext.contextPath + "/user/updateFunc.do", $("#subForm_func").serialize(), function(result) {
|
||||
if (result.res == 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
closeModal('powerModal');
|
||||
}else{
|
||||
showAlert('d','保存失败','alertDiv_func');
|
||||
}
|
||||
},'json');
|
||||
//}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
//var active=$("#active").select2();
|
||||
$("#active_func").select2({minimumResultsForSearch: 10}).val("${menu.active }").trigger("change");
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="powerModal">
|
||||
<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强制为subForm -->
|
||||
<form class="form-horizontal " id="subForm_func">
|
||||
<input id="id" name="id" type="hidden" value="${menu.id}"/>
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv_func"></div>
|
||||
<!-- <div id="menu4SelectDiv_func"></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="name" name ="name" placeholder="名称" value="${menu.name }">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">上级菜单</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="_pname" name ="_pname" placeholder="上级菜单" onclick="showMenu4SelectFun_func();" value="${menu._pname}">
|
||||
<input id="pid" name="pid" type="hidden" value="${menu.pid}"/>
|
||||
</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="location" name ="location" placeholder="地址" value="${menu.location}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<label class="col-sm-2 control-label">启用</label>
|
||||
<div class="col-sm-10">
|
||||
<select id ="active_func" name="active" class="form-control select2">
|
||||
<option value="启用" >启用</option>
|
||||
<option value="禁用" >禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
</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="dosave_func()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
178
WebRoot/jsp/user/menuManage.jsp
Normal file
178
WebRoot/jsp/user/menuManage.jsp
Normal file
@ -0,0 +1,178 @@
|
||||
<%@ 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"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
var addFun = function() {
|
||||
var node=$('#tree').treeview('getSelected');
|
||||
var pid="";
|
||||
if(node!=null && node.length>0){
|
||||
pid=node[0].id;
|
||||
}
|
||||
$.post(ext.contextPath + '/user/showMenuAdd.do', {pid:pid} , function(data) {
|
||||
$("#menuBox").html(data);
|
||||
});
|
||||
};
|
||||
var editFun = function(id) {
|
||||
$.post(ext.contextPath + '/user/showMenuEdit.do', {id:id} , function(data) {
|
||||
$("#menuBox").html(data);
|
||||
});
|
||||
};
|
||||
var deleteFun = function(id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/work/group/delete.do', {id : id}, function(data) {
|
||||
if(data==1){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
var deletesFun = function() {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas="";
|
||||
$.each(checkedItems, function(index, item){
|
||||
datas+=item.id+",";
|
||||
});
|
||||
if(datas==""){
|
||||
showAlert('d','请先选择记录','mainAlertdiv');
|
||||
}else{
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/work/group/deletes.do', {ids:datas} , function(data) {
|
||||
if(data>0){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
var initTreeView = function() {
|
||||
var search_name = $('#search_name').val();
|
||||
$.post(ext.contextPath + '/user/getMenusJson.do', {ng:'',search_name:search_name} , function(data) {
|
||||
//console.info(data)
|
||||
$('#tree').treeview({data: data,
|
||||
});
|
||||
$('#tree').on('nodeSelected', function(event, data) {
|
||||
editFun(data.id);
|
||||
//var node=$('#tree').treeview('getSelected');
|
||||
});
|
||||
},'json');
|
||||
$("#menuBox").html("");
|
||||
};
|
||||
$(function() {
|
||||
initTreeView();
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<!-- 引用top -->
|
||||
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
|
||||
<!-- 菜单栏 -->
|
||||
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="box box-solid">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">菜单列表</h3>
|
||||
|
||||
<div class="box-tools">
|
||||
<div class="input-group input-group-sm" style="width: 200px;">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right" placeholder="名称">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="initTreeView();"><i class="fa fa-search"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" onclick="addFun();"><i class="fa fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<div id="tree" style="height:550px;overflow:auto; "></div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9" id="menuBox">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
|
||||
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
162
WebRoot/jsp/user/mobileManagementAdd.jsp
Normal file
162
WebRoot/jsp/user/mobileManagementAdd.jsp
Normal file
@ -0,0 +1,162 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<style type="text/css">
|
||||
.select2-container .select2-selection--single{
|
||||
height:34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
.select2-selection__arrow{
|
||||
margin-top:3px;
|
||||
}
|
||||
/* .file-border{
|
||||
padding-top :10px;
|
||||
padding-bottom :1px;
|
||||
margin-left :17%;
|
||||
padding-right :0px;
|
||||
padding-left :0px;
|
||||
border-color :#D2D6DE;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 1px 1px;
|
||||
border-top-left-radius:10px;
|
||||
border-top-right-radius:10px;
|
||||
border-bottom-left-radius:10px;
|
||||
border-bottom-right-radius:10px;
|
||||
} */
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
|
||||
function dosave() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/mobileManagement/saveMobileManagement.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
closeModal("subModal");
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '设备名称不能为空'
|
||||
},
|
||||
/* remote: {//ajax验证。server result:{"valid",true or false} 向服务发送当前input name值,获得一个json数据。例表示正确:{"valid",true}
|
||||
url: ext.contextPath + '/equipment/maintenancePlan/checkExist.do',//验证地址
|
||||
message: '计划编号已存在',//提示消息
|
||||
type: 'POST',//请求方式
|
||||
data: function(validator) {
|
||||
return {
|
||||
planNumber: $('#planNumber').val()
|
||||
};
|
||||
}
|
||||
}, */
|
||||
}
|
||||
},
|
||||
deviceid: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '设备编号不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
status: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '启用不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$("#unitId").val(unitId);
|
||||
$("#status").select2({
|
||||
minimumResultsForSearch: 10
|
||||
}).val('${mobileManagement.status}').trigger("change");
|
||||
});
|
||||
|
||||
|
||||
//选择审核人
|
||||
var showUser4AuditSelectsFun = function() {
|
||||
var userIds= $("#userId").val();
|
||||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"userId",textId:"auditMan",userIds:userIds} , function(data) {
|
||||
$("#user4SelectDiv").html(data);
|
||||
openModal("user4SelectModal");
|
||||
});
|
||||
};
|
||||
</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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm">
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<input name="id" id="id" type="hidden" value="${mobileManagement.id}"/>
|
||||
<input name="unitId" id="unitId" type="hidden" value="${mobileManagement.unitId}"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">*设备名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="name" name ="name" placeholder="设备名称" value="${mobileManagement.name}">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*设备编号</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="deviceid" name ="deviceid" placeholder="设备编号" value="${mobileManagement.deviceid}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">*启用</label>
|
||||
<div class="col-sm-4">
|
||||
<select type="text" id="status" class="form-control pull-right" name="status" >
|
||||
<option value="启用">启用</option>
|
||||
<option value="禁用">禁用</option>
|
||||
</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 ="remark" name ="remark" placeholder="备注">${mobileManagement.remark}</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="auditMan" name="auditMan" placeholder="点击选择" onclick="showUser4AuditSelectsFun();" value="">
|
||||
<input id="userId" name="userId" type="hidden" value="" />
|
||||
</div>
|
||||
</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" onclick="dosave()" id="btn_save">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
162
WebRoot/jsp/user/mobileManagementEdit.jsp
Normal file
162
WebRoot/jsp/user/mobileManagementEdit.jsp
Normal file
@ -0,0 +1,162 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<style type="text/css">
|
||||
.select2-container .select2-selection--single{
|
||||
height:34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
.select2-selection__arrow{
|
||||
margin-top:3px;
|
||||
}
|
||||
/* .file-border{
|
||||
padding-top :10px;
|
||||
padding-bottom :1px;
|
||||
margin-left :17%;
|
||||
padding-right :0px;
|
||||
padding-left :0px;
|
||||
border-color :#D2D6DE;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 1px 1px;
|
||||
border-top-left-radius:10px;
|
||||
border-top-right-radius:10px;
|
||||
border-bottom-left-radius:10px;
|
||||
border-bottom-right-radius:10px;
|
||||
} */
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
|
||||
function dosave() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/mobileManagement/updateMobileManagement.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
closeModal("subModal");
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '设备名称不能为空'
|
||||
},
|
||||
/* remote: {//ajax验证。server result:{"valid",true or false} 向服务发送当前input name值,获得一个json数据。例表示正确:{"valid",true}
|
||||
url: ext.contextPath + '/equipment/maintenancePlan/checkExist.do',//验证地址
|
||||
message: '计划编号已存在',//提示消息
|
||||
type: 'POST',//请求方式
|
||||
data: function(validator) {
|
||||
return {
|
||||
planNumber: $('#planNumber').val()
|
||||
};
|
||||
}
|
||||
}, */
|
||||
}
|
||||
},
|
||||
deviceid: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '设备编号不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
status: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '启用不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$("#unitId").val(unitId);
|
||||
$("#status").select2({
|
||||
minimumResultsForSearch: 10
|
||||
}).val('${mobileManagement.status}').trigger("change");
|
||||
});
|
||||
|
||||
|
||||
//选择审核人
|
||||
var showUser4AuditSelectsFun = function() {
|
||||
var userIds= $("#userId").val();
|
||||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"userId",textId:"auditMan",userIds:userIds} , function(data) {
|
||||
$("#user4SelectDiv").html(data);
|
||||
openModal("user4SelectModal");
|
||||
});
|
||||
};
|
||||
</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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm">
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<input name="id" id="id" type="hidden" value="${mobileManagement.id}"/>
|
||||
<input name="unitId" id="unitId" type="hidden" value="${mobileManagement.unitId}"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">*设备名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="name" name ="name" placeholder="设备名称" value="${mobileManagement.name}">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*设备编号</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="deviceid" name ="deviceid" placeholder="设备编号" value="${mobileManagement.deviceid}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">*启用</label>
|
||||
<div class="col-sm-4">
|
||||
<select type="text" id="status" class="form-control pull-right" name="status" >
|
||||
<option value="启用">启用</option>
|
||||
<option value="禁用">禁用</option>
|
||||
</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 ="remark" name ="remark" placeholder="备注">${mobileManagement.remark}</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="auditMan" name="auditMan" placeholder="点击选择" onclick="showUser4AuditSelectsFun();" value="${mobileManagement.auditMan}">
|
||||
<input id="userId" name="userId" type="hidden" value="${mobileManagement.userId}" />
|
||||
</div>
|
||||
</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" onclick="dosave()" id="btn_save">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
255
WebRoot/jsp/user/mobileManagementList.jsp
Normal file
255
WebRoot/jsp/user/mobileManagementList.jsp
Normal file
@ -0,0 +1,255 @@
|
||||
<%@page import="com.sipai.tools.CommString"%>
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@page import="com.sipai.entity.maintenance.MaintenanceCommString"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<%request.setAttribute("MAINTAIN",MaintenanceCommString.MAINTENANCE_TYPE_MAINTAIN); %>
|
||||
<%request.setAttribute("Response_StartProcess_NoProcessDef",MaintenanceCommString.Response_StartProcess_NoProcessDef); %>
|
||||
<%request.setAttribute("Response_StartProcess_NoUser",MaintenanceCommString.Response_StartProcess_NoUser); %>
|
||||
<%request.setAttribute("Response_StartProcess_PlanIssued",MaintenanceCommString.Response_StartProcess_PlanIssued); %>
|
||||
<%request.setAttribute("MAINTAIN_YEAR",MaintenanceCommString.MAINTAIN_YEAR); %>
|
||||
<%request.setAttribute("MAINTAIN_MONTH",MaintenanceCommString.MAINTAIN_MONTH); %>
|
||||
<%request.setAttribute("MAINTAIN_HALFYEAR",MaintenanceCommString.MAINTAIN_HALFYEAR); %>
|
||||
<%request.setAttribute("START",MaintenanceCommString.PLAN_START); %>
|
||||
<%request.setAttribute("SUBMIT",MaintenanceCommString.PLAN_SUBMIT); %>
|
||||
<%request.setAttribute("FINISH",MaintenanceCommString.PLAN_FINISH); %>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<!-- bootstrap switch -->
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css"/>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.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;
|
||||
}
|
||||
.table-hover>tbody>tr:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
var addFun = function() {
|
||||
$.post(ext.contextPath + '/user/mobileManagement/addMobileManagement.do', {} , function(data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
var editFun = function(id) {
|
||||
stopBubbleDefaultEvent();
|
||||
$.post(ext.contextPath + '/user/mobileManagement/editMobileManagement.do', {id:id} , function(data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
var deleteFun = function(id) {
|
||||
stopBubbleDefaultEvent();
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function(willDelete){
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/mobileManagement/deleteMobileManagement.do', {id : id}, function(data) {
|
||||
if(data==1){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
var deletesFun = function() {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas="";
|
||||
$.each(checkedItems, function(index, item){
|
||||
datas+=item.id+",";
|
||||
});
|
||||
if(datas==""){
|
||||
showAlert('d','请先选择记录','mainAlertdiv');
|
||||
}else{
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/mobileManagement/deletesMobileManagement.do', {ids:datas} , function(data) {
|
||||
if(data>0){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
},'json');
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var dosearchTab = function(){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}
|
||||
//表格查询参数
|
||||
function queryParamsFun(params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
unitId : unitId,
|
||||
search_name:$('#search_name').val(),
|
||||
}
|
||||
};
|
||||
//厂区选择后,初始化工艺段,加载表格
|
||||
var initFun = function(){
|
||||
$("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/mobileManagement/getMobileManagement.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
singleSelect:true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: queryParamsFun,
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
onClickRow: function (row) {//单击行事件,执行查看功能
|
||||
viewFun(row.id);
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
},{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '设备名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
},{
|
||||
field: 'deviceid', // 返回json数据中的name
|
||||
title: '设备编号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
},{
|
||||
field: 'status', // 返回json数据中的name
|
||||
title: '是否启用', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
},{
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 120, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var str='';
|
||||
str += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i></button>';
|
||||
str += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\'' + row.id + '\')"><i class="fa fa-trash-o"></i></button>';
|
||||
str = '<div class="btn-group" >' + str + '</div>';
|
||||
return str;
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
$(function() {
|
||||
initFun();
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<!-- 引用top -->
|
||||
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
|
||||
<!-- 菜单栏 -->
|
||||
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
|
||||
<div class="content-wrapper">
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv" style="width: 220px;height:10px;"></div>
|
||||
<div id="roleUserDiv"></div>
|
||||
<div id="emSubDiv"></div>
|
||||
<div id="traceDiv"></div>
|
||||
<div id="subDetailDiv"></div>
|
||||
<div id="user4SelectDiv"></div>
|
||||
<div id="fileInputDiv"></div>
|
||||
<form id="searchForm">
|
||||
<div id="companySelectTree"></div>
|
||||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i class="fa fa-plus"></i> 新增</button>
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i class="fa fa-trash-o"></i> 删除</button>
|
||||
</div>
|
||||
<div class="form-group pull-right form-inline" >
|
||||
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name" autocomplete="off" name="search_name" class="form-control pull-right" style="height:34px" placeholder="设备名称">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="dosearchTab();" style="height:34px"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table id="table"></table>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
|
||||
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
151
WebRoot/jsp/user/processSectionAdd.jsp
Normal file
151
WebRoot/jsp/user/processSectionAdd.jsp
Normal file
@ -0,0 +1,151 @@
|
||||
<%@page import="com.sipai.entity.user.ExtSystem"%>
|
||||
<%@ 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"%>
|
||||
<% request.setAttribute("RequestMode", ExtSystem.RequestMode); %>
|
||||
<% request.setAttribute("SystemType", ExtSystem.SystemType); %>
|
||||
<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() {
|
||||
$.post(ext.contextPath + "/user/processSection/getProcessSectionType4Selectall.do", {companyId:'${company.id}'}, function(data) {
|
||||
$("#processSectionTypeId").empty();
|
||||
var selelct_ =$("#processSectionTypeId").select2({
|
||||
data: data,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
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;} // 函数用于呈现当前的选择
|
||||
});
|
||||
selelct_.val('').trigger("change");
|
||||
},'json');
|
||||
})
|
||||
function dosave() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/processSection/save.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1) {
|
||||
$("#subModal").modal("hide");
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//输入框验证
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
sname: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '简称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
code: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '编号不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
</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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm" autocomplete="off">
|
||||
<div id="alertDiv"></div>
|
||||
<input id ="id" name="id" type="hidden" value="${processSection.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="${processSection.name}">
|
||||
</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="sname" name ="sname" placeholder="名称" value="${processSection.sname}">
|
||||
</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="code" name ="code" placeholder="编号" value="${processSection.code}">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group">
|
||||
<label class="col-sm-2 control-label">所属公司</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="pid" type="hidden" value="${company.id}"/>
|
||||
<p class="form-control-static" >${company.name}</p>
|
||||
</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="processSectionTypeId" name ="processSectionTypeId" style="width: 220px;">
|
||||
</select>
|
||||
</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="morder" name ="morder" placeholder="顺序" style="width: 220px;" value="${processSection.morder}">
|
||||
</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="active" name ="active" style="width: 220px;">
|
||||
<option value="true" >启用</option>
|
||||
<option value="false" >停用</option>
|
||||
</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="dosave()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
152
WebRoot/jsp/user/processSectionEdit.jsp
Normal file
152
WebRoot/jsp/user/processSectionEdit.jsp
Normal file
@ -0,0 +1,152 @@
|
||||
<%@page import="com.sipai.entity.user.ExtSystem"%>
|
||||
<%@ 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"%>
|
||||
<% request.setAttribute("RequestMode", ExtSystem.RequestMode); %>
|
||||
<% request.setAttribute("SystemType", ExtSystem.SystemType); %>
|
||||
<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() {
|
||||
$.post(ext.contextPath + "/user/processSection/getProcessSectionType4Selectall.do", {companyId:'${company.id}'}, function(data) {
|
||||
$("#processSectionTypeId").empty();
|
||||
var selelct_ =$("#processSectionTypeId").select2({
|
||||
data: data,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
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;} // 函数用于呈现当前的选择
|
||||
});
|
||||
selelct_.val('${processSection.processSectionTypeId}').trigger("change");
|
||||
},'json');
|
||||
})
|
||||
function doupdate() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/processSection/update.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1) {
|
||||
$("#subModal").modal("hide");
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
|
||||
//输入框验证
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
sname: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '简称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
code: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '编号不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
});
|
||||
</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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm" autocomplete="off">
|
||||
<div id="alertDiv"></div>
|
||||
<input id ="id" name="id" type="hidden" value="${processSection.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="${processSection.name}">
|
||||
</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="sname" name ="sname" placeholder="名称" value="${processSection.sname}">
|
||||
</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="code" name ="code" placeholder="编号" value="${processSection.code}">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group">
|
||||
<label class="col-sm-2 control-label">所属公司</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="pid" type="hidden" value="${company.id}"/>
|
||||
<p class="form-control-static" >${company.name}</p>
|
||||
</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="processSectionTypeId" name ="processSectionTypeId" style="width: 220px;">
|
||||
</select>
|
||||
</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="morder" name ="morder" placeholder="顺序" style="width: 220px;" value="${processSection.morder}">
|
||||
</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="active" name ="active" style="width: 220px;">
|
||||
<option value="true" <c:if test="${processSection.active}">selected</c:if>>启用</option>
|
||||
<option value="false" <c:if test="${!processSection.active}">selected</c:if>>停用</option>
|
||||
</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="doupdate()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
134
WebRoot/jsp/user/processSectionLibraryAdd.jsp
Normal file
134
WebRoot/jsp/user/processSectionLibraryAdd.jsp
Normal file
@ -0,0 +1,134 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<% request.setAttribute("Maintain_Week", com.sipai.entity.maintenance.MaintainCommStr.Maintain_Week); %>
|
||||
<% request.setAttribute("Maintain_TenDays", com.sipai.entity.maintenance.MaintainCommStr.Maintain_TenDays); %>
|
||||
<% request.setAttribute("Maintain_Month", com.sipai.entity.maintenance.MaintainCommStr.Maintain_Month); %>
|
||||
<% request.setAttribute("Maintain_Quarter", com.sipai.entity.maintenance.MaintainCommStr.Maintain_Quarter); %>
|
||||
<% request.setAttribute("Maintain_HalfYear", com.sipai.entity.maintenance.MaintainCommStr.Maintain_HalfYear); %>
|
||||
<% request.setAttribute("Maintain_Year", com.sipai.entity.maintenance.MaintainCommStr.Maintain_Year); %>
|
||||
|
||||
<% request.setAttribute("Maintain_IN", com.sipai.entity.maintenance.MaintainCommStr.Maintain_IN); %>
|
||||
<% request.setAttribute("Maintain_OUT", com.sipai.entity.maintenance.MaintainCommStr.Maintain_OUT); %>
|
||||
|
||||
<!-- bootstrap switch -->
|
||||
<link rel="stylesheet"
|
||||
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css" />
|
||||
<script type="text/javascript"
|
||||
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function dosave() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/processSection/save.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1) {
|
||||
closeModal('subDivLibrary');
|
||||
$("#table_Library").bootstrapTable('refresh');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
sname: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '简称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
code: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '编号不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(function () {
|
||||
|
||||
})
|
||||
</script>
|
||||
<div class="modal fade" id="subDivLibrary">
|
||||
<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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm" autocomplete="off">
|
||||
<div id="alertDiv"></div>
|
||||
<input id ="id" name="id" type="hidden" value="${processSection.id}"/>
|
||||
<input id ="unitId" name="unitId" type="hidden" value="sys"/>
|
||||
<!-- 界面提醒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="${processSection.name}">
|
||||
</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="sname" name ="sname" placeholder="名称" value="${processSection.sname}">
|
||||
</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="code" name ="code" placeholder="编号" value="${processSection.code}">
|
||||
</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="processSectionTypeId" name ="processSectionTypeId" style="width: 220px;">
|
||||
</select>
|
||||
</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="morder" name ="morder" placeholder="顺序" style="width: 220px;" value="${processSection.morder}">
|
||||
</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="active" name ="active" style="width: 220px;">
|
||||
<option value="true" >启用</option>
|
||||
<option value="false" >停用</option>
|
||||
</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="dosave()" id="btn_save">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
134
WebRoot/jsp/user/processSectionLibraryEdit.jsp
Normal file
134
WebRoot/jsp/user/processSectionLibraryEdit.jsp
Normal file
@ -0,0 +1,134 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<% request.setAttribute("Maintain_Week", com.sipai.entity.maintenance.MaintainCommStr.Maintain_Week); %>
|
||||
<% request.setAttribute("Maintain_TenDays", com.sipai.entity.maintenance.MaintainCommStr.Maintain_TenDays); %>
|
||||
<% request.setAttribute("Maintain_Month", com.sipai.entity.maintenance.MaintainCommStr.Maintain_Month); %>
|
||||
<% request.setAttribute("Maintain_Quarter", com.sipai.entity.maintenance.MaintainCommStr.Maintain_Quarter); %>
|
||||
<% request.setAttribute("Maintain_HalfYear", com.sipai.entity.maintenance.MaintainCommStr.Maintain_HalfYear); %>
|
||||
<% request.setAttribute("Maintain_Year", com.sipai.entity.maintenance.MaintainCommStr.Maintain_Year); %>
|
||||
|
||||
<% request.setAttribute("Maintain_IN", com.sipai.entity.maintenance.MaintainCommStr.Maintain_IN); %>
|
||||
<% request.setAttribute("Maintain_OUT", com.sipai.entity.maintenance.MaintainCommStr.Maintain_OUT); %>
|
||||
|
||||
<!-- bootstrap switch -->
|
||||
<link rel="stylesheet"
|
||||
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css" />
|
||||
<script type="text/javascript"
|
||||
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function dosave() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/processSection/update.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1) {
|
||||
closeModal('subDivLibrary');
|
||||
$("#table_Library").bootstrapTable('refresh');
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
sname: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '简称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
code: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '编号不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(function () {
|
||||
|
||||
})
|
||||
</script>
|
||||
<div class="modal fade" id="subDivLibrary">
|
||||
<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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm" autocomplete="off">
|
||||
<div id="alertDiv"></div>
|
||||
<input id ="id" name="id" type="hidden" value="${processSection.id}"/>
|
||||
<input id ="unitId" name="unitId" type="hidden" value="sys"/>
|
||||
<!-- 界面提醒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="${processSection.name}">
|
||||
</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="sname" name ="sname" placeholder="名称" value="${processSection.sname}">
|
||||
</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="code" name ="code" placeholder="编号" value="${processSection.code}">
|
||||
</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="processSectionTypeId" name ="processSectionTypeId" style="width: 220px;">
|
||||
</select>
|
||||
</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="morder" name ="morder" placeholder="顺序" style="width: 220px;" value="${processSection.morder}">
|
||||
</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="active" name ="active" style="width: 220px;">
|
||||
<option value="true" <c:if test="${processSection.active}">selected</c:if>>启用</option>
|
||||
<option value="false" <c:if test="${!processSection.active}">selected</c:if>>停用</option>
|
||||
</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="dosave()" id="btn_save">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
190
WebRoot/jsp/user/processSectionLibraryList.jsp
Normal file
190
WebRoot/jsp/user/processSectionLibraryList.jsp
Normal file
@ -0,0 +1,190 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8" %>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
||||
<% request.setAttribute("PatrolPlan_Weekly", com.sipai.entity.timeefficiency.TimeEfficiencyCommStr.PatrolPlan_Weekly); %>
|
||||
<% request.setAttribute("PatrolPlan_Daily", com.sipai.entity.timeefficiency.TimeEfficiencyCommStr.PatrolPlan_Daily); %>
|
||||
<% request.setAttribute("PatrolPlan_Monthly", com.sipai.entity.timeefficiency.TimeEfficiencyCommStr.PatrolPlan_Monthly); %>
|
||||
<!-- bootstrap switch -->
|
||||
<link rel="stylesheet"
|
||||
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css"/>
|
||||
<script type="text/javascript"
|
||||
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
$("#table_Library").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/processSection/getlist.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order, // 排序规则
|
||||
unitId: 'sys'
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
}, {
|
||||
field: 'code', // 返回json数据中的name
|
||||
title: '编号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'sname', // 返回json数据中的name
|
||||
title: '简称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
// {
|
||||
// field: 'type', // 返回json数据中的name
|
||||
// title: '工艺段类型', // 表格表头显示文字
|
||||
// align: 'center', // 左右居中
|
||||
// valign: 'middle',
|
||||
// formatter: function (value, row) {
|
||||
// if (row.processSectionType != null) {
|
||||
// return row.processSectionType.name;
|
||||
// } else {
|
||||
// return '';
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
{
|
||||
field: 'active', // 返回json数据中的name
|
||||
title: '状态', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row) {
|
||||
if (value) {
|
||||
return '启用';
|
||||
} else {
|
||||
return '停用';
|
||||
}
|
||||
}
|
||||
}, {
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 60, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
return '<button class="btn btn-default btn-sm" onclick="doEdit_Library(\'' + row.id + '\')" data-toggle="tooltip" title="编辑"><i class="fa fa-edit"></i></button>';
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_Library");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
function doAdd_Library() {
|
||||
stopBubbleDefaultEvent();
|
||||
$.post(ext.contextPath + '/user/processSection/doAdd_Library.do', {}, function (data) {
|
||||
$("#subDiv_Library").html(data);
|
||||
openModal('subDivLibrary');
|
||||
});
|
||||
}
|
||||
|
||||
function doEdit_Library(id) {
|
||||
stopBubbleDefaultEvent();
|
||||
$.post(ext.contextPath + '/user/processSection/doEdit_Library.do', {id: id}, function (data) {
|
||||
$("#subDiv_Library").html(data);
|
||||
openModal('subDivLibrary');
|
||||
});
|
||||
}
|
||||
|
||||
var doDelete_Library = function () {
|
||||
var checkedItems = $("#table_Library").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'mainAlertdivLibrary');
|
||||
} else {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/processSection/deletes.do', {ids: datas}, function (data) {
|
||||
if (data > 0) {
|
||||
$("#table_Library").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdivLibrary');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<div class="modal fade" id="subModal">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div id="mainAlertdivLibrary"></div>
|
||||
<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="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"></h3>
|
||||
<div class="box-tools pull-right">
|
||||
<a onclick="doAdd_Library()" class="btn btn-box-tool" data-toggle="tooltip" title="新增"><i
|
||||
class="fa fa-plus"></i></a>
|
||||
<a onclick="doDelete_Library()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i
|
||||
class="fa fa-minus"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body ">
|
||||
<table id="table_Library"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
348
WebRoot/jsp/user/processSectionList.jsp
Normal file
348
WebRoot/jsp/user/processSectionList.jsp
Normal file
@ -0,0 +1,348 @@
|
||||
<%@ 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" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject" %>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%>
|
||||
</title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var addFun = function () {
|
||||
// var companyId = $('#company_id').val();
|
||||
var companyId = unitId;
|
||||
$.post(ext.contextPath + '/user/processSection/add.do', {companyId: companyId}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
var editFun = function (id) {
|
||||
$.post(ext.contextPath + '/user/processSection/edit.do', {id: id}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
//工艺段库--维护页面
|
||||
var libraryFun = function (id) {
|
||||
$.post(ext.contextPath + '/user/processSection/libraryList.do', {companyId: unitId}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
//从工艺库里同步数据
|
||||
var refreshFun = function () {
|
||||
$.post(ext.contextPath + '/user/processSection/refresh.do', {unitId: unitId}, function (data) {
|
||||
// showAlert('s', '同步成功!从工艺段库更新:' + data + '条数据');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
});
|
||||
}
|
||||
|
||||
var deleteFun = function (id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/processSection/delete.do', {id: id}, function (data) {
|
||||
if (data == 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
var deletesFun = function () {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||||
} else {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/processSection/deletes.do', {ids: datas}, function (data) {
|
||||
if (data > 0) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
/* var init = function() {
|
||||
$.post(ext.contextPath + '/user/processSection/showlistForSelect.do', {} , function(data) {
|
||||
if(data.length>0){
|
||||
for(var i=0;i<data.length;i++){
|
||||
console.info(data)
|
||||
$("#search_code").append("<option value='"+data[i].id+"'>"+data[i].text+"</option>");
|
||||
}
|
||||
$("#search_code").select2({
|
||||
placeholder: "请选择班组",
|
||||
language: "zh-CN",
|
||||
allowClear: true,
|
||||
data: data
|
||||
});
|
||||
}
|
||||
},'json');
|
||||
|
||||
}; */
|
||||
|
||||
|
||||
var dosearch = function () {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
var initFun = function () {
|
||||
}
|
||||
$(function () {
|
||||
/* $.post(ext.contextPath + "/user/getSearchBizsByUserId4Select.do", {}, function(data) {
|
||||
var selelct =$("#search_code").select2({
|
||||
data: data,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
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;} // 函数用于呈现当前的选择
|
||||
});
|
||||
selelct.on("change",function(e){
|
||||
dosearch();
|
||||
});
|
||||
if(data.length==1){
|
||||
//选择厂区为一个厂时隐藏选择框
|
||||
selelct.val(data[0].id).trigger("change");
|
||||
$("#search_code").next().css("display", "none");
|
||||
$("#companyName").text($("#search_code").text());
|
||||
}else{
|
||||
selelct.val("").trigger("change");
|
||||
$("#companyName").css("display", "none");
|
||||
};
|
||||
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'});
|
||||
},'json'); */
|
||||
|
||||
//2020-07-07 start
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + "/user/showCompanySelectTree.do", {}, function (data) {
|
||||
$('#companySelectTree').html(data);
|
||||
});
|
||||
//2020-07-07 end
|
||||
|
||||
|
||||
$("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/processSection/getlist.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order, // 排序规则
|
||||
//search_code: $('#search_code').val(),
|
||||
search_code: unitId,
|
||||
unitId: unitId,
|
||||
search_name: $('#search_name').val()
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
}, {
|
||||
field: 'code', // 返回json数据中的name
|
||||
title: '编号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'sname', // 返回json数据中的name
|
||||
title: '简称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
|
||||
/*{
|
||||
field: 'type', // 返回json数据中的name
|
||||
title: '工艺段类型', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row) {
|
||||
if (row.processSectionType != null) {
|
||||
return row.processSectionType.name;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
} // 上下居中
|
||||
},*/
|
||||
|
||||
{
|
||||
field: 'active', // 返回json数据中的name
|
||||
title: '状态', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row) {
|
||||
if (value) {
|
||||
return '启用';
|
||||
} else {
|
||||
return '停用';
|
||||
}
|
||||
|
||||
} // 上下居中
|
||||
}
|
||||
,
|
||||
{
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 60, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
return '<button class="btn btn-default btn-sm" onclick="editFun(\'' + row.id + '\')" data-toggle="tooltip" title="编辑"><i class="fa fa-edit"></i></button>';
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<%-- <!-- 引用top -->
|
||||
<jsp:include page="/jsp/top.jsp"></jsp:include>
|
||||
<!-- 菜单栏 -->
|
||||
<jsp:include page="/jsp/left.jsp"></jsp:include> --%>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1 id="head_title"></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a id='head_firstlevel' href="#"><i class="fa fa-dashboard"></i> </a></li>
|
||||
<!-- <li class="active">Here</li> -->
|
||||
</ol>
|
||||
</section>
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="subDiv_Configure"></div>
|
||||
<div id="subDiv_PatroPoint"></div>
|
||||
<div id="subDiv_Equipment"></div>
|
||||
|
||||
<div id="subDiv_Library"></div>
|
||||
|
||||
<form id="searchForm">
|
||||
<div>
|
||||
<div id="companySelectTree" style="display: none"></div>
|
||||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<%--<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i
|
||||
class="fa fa-plus"></i> 新增
|
||||
</button>--%>
|
||||
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="libraryFun();"><i
|
||||
class="fa fa-database"></i> 工艺段库
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="refreshFun();"><i
|
||||
class="fa fa-refresh"></i> 同步
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i
|
||||
class="fa fa-trash-o"></i> 删除
|
||||
</button>
|
||||
</div>
|
||||
<div class="form-group pull-right form-inline">
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right"
|
||||
placeholder="名称">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
|
||||
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include>
|
||||
<jsp:include page="/jsp/side.jsp"></jsp:include> --%>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
384
WebRoot/jsp/user/processSectionListForSystem.jsp
Normal file
384
WebRoot/jsp/user/processSectionListForSystem.jsp
Normal file
@ -0,0 +1,384 @@
|
||||
<%@ 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"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var addFun = function() {
|
||||
// var companyId = $('#company_id').val();
|
||||
var companyId = unitId;
|
||||
$.post(ext.contextPath + '/user/processSection/add.do', {companyId:companyId} , function(data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
var editFun = function(id) {
|
||||
$.post(ext.contextPath + '/user/processSection/edit.do', {id:id} , function(data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
var deleteFun = function(id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/processSection/delete.do', {id : id}, function(data) {
|
||||
if(data==1){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
var deletesFun = function() {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas="";
|
||||
$.each(checkedItems, function(index, item){
|
||||
datas+=item.id+",";
|
||||
});
|
||||
if(datas==""){
|
||||
showAlert('d','请先选择记录','mainAlertdiv');
|
||||
}else{
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/processSection/deletes.do', {ids:datas} , function(data) {
|
||||
if(data>0){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
/* var init = function() {
|
||||
$.post(ext.contextPath + '/user/processSection/showlistForSelect.do', {} , function(data) {
|
||||
if(data.length>0){
|
||||
for(var i=0;i<data.length;i++){
|
||||
console.info(data)
|
||||
$("#search_code").append("<option value='"+data[i].id+"'>"+data[i].text+"</option>");
|
||||
}
|
||||
$("#search_code").select2({
|
||||
placeholder: "请选择班组",
|
||||
language: "zh-CN",
|
||||
allowClear: true,
|
||||
data: data
|
||||
});
|
||||
}
|
||||
},'json');
|
||||
|
||||
}; */
|
||||
|
||||
|
||||
var dosearch = function() {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
var initFun = function () {
|
||||
}
|
||||
$(function() {
|
||||
/* $.post(ext.contextPath + "/user/getSearchBizsByUserId4Select.do", {}, function(data) {
|
||||
var selelct =$("#search_code").select2({
|
||||
data: data,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
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;} // 函数用于呈现当前的选择
|
||||
});
|
||||
selelct.on("change",function(e){
|
||||
dosearch();
|
||||
});
|
||||
if(data.length==1){
|
||||
//选择厂区为一个厂时隐藏选择框
|
||||
selelct.val(data[0].id).trigger("change");
|
||||
$("#search_code").next().css("display", "none");
|
||||
$("#companyName").text($("#search_code").text());
|
||||
}else{
|
||||
selelct.val("").trigger("change");
|
||||
$("#companyName").css("display", "none");
|
||||
};
|
||||
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'});
|
||||
},'json'); */
|
||||
|
||||
//2020-07-07 start
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + "/user/showCompanySelectTree.do", {}, function (data) {
|
||||
$('#companySelectTree').html(data);
|
||||
});
|
||||
//2020-07-07 end
|
||||
|
||||
|
||||
$("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/processSection/getlistForSystem.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'client', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order, // 排序规则
|
||||
//search_code: $('#search_code').val(),
|
||||
search_code: unitId,
|
||||
search_name: $('#search_name').val(),
|
||||
unitId: unitId,
|
||||
}
|
||||
},
|
||||
detailView: true,//父子表
|
||||
columns: [
|
||||
// {
|
||||
// checkbox: true, // 显示一个勾选框
|
||||
// },
|
||||
{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'sname', // 返回json数据中的name
|
||||
title: '简称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: '_score', // 返回json数据中的name
|
||||
title: '系统稳定性得分', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
// sortable : true
|
||||
},
|
||||
{
|
||||
field: '_alarmcontent', // 返回json数据中的name
|
||||
title: '警示', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
}
|
||||
// ,{
|
||||
// title: "操作",
|
||||
// align: 'center',
|
||||
// valign: 'middle',
|
||||
// width: 60, // 定义列的宽度,单位为像素px
|
||||
// formatter: function (value, row, index) {
|
||||
// return '<button class="btn btn-default btn-sm" onclick="editFun(\'' + row.id + '\')" data-toggle="tooltip" title="编辑"><i class="fa fa-edit"></i></button>';
|
||||
// /* return '<i class="fa fa-edit" onclick="editFun()(\'' + row.id + '\')></i>'; */
|
||||
// }
|
||||
// }
|
||||
],
|
||||
//注册加载子表的事件。index:父表当前行的行索引,row:父表当前行的Json数据对象,$detail:当前行下面创建的新行里面的td对象。
|
||||
onExpandRow: function (index, row, $detail) {
|
||||
initFittingsDetailTable(index, row, $detail);
|
||||
//存入sessionStorage
|
||||
sessionStorage.setItem("index", index);
|
||||
},
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//初始化子表
|
||||
var initFittingsDetailTable = function (index, row, $detail) {
|
||||
var processSectionId = row.id;
|
||||
var detailTable = $detail.html('<table></table>').find('table');
|
||||
$(detailTable).bootstrapTable({
|
||||
url: ext.contextPath + '/equipment/getlistForSystem.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
paginationDetailHAlign: ' hidden',//去除分页的显示
|
||||
sidePagination: 'client', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
processSectionId: processSectionId,
|
||||
unitId:unitId
|
||||
}
|
||||
},
|
||||
sortName: 'equipmentCardID', // 要排序的字段
|
||||
sortOrder: 'asc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'equipmentname', // 返回json数据中的name
|
||||
title: '设备名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'equipmentCardProp.isBackup', // 返回json数据中的name
|
||||
title: '是否备用', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
formatter: function (value, row, index) {
|
||||
if (value == '1') {
|
||||
return "是";
|
||||
} else {
|
||||
return "否";
|
||||
}
|
||||
},
|
||||
}, {
|
||||
field: 'equipmentCardProp.keynum', // 返回json数据中的name
|
||||
title: '关键性指标', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
formatter: function (value, row, index) {
|
||||
if (value == 1) {
|
||||
return "无";
|
||||
} else if(value == 2) {
|
||||
return "低";
|
||||
}else if(value == 3) {
|
||||
return "高";
|
||||
}else if(value == 4) {
|
||||
return "极高";
|
||||
}
|
||||
},
|
||||
},{
|
||||
field : 'equipmentCardProp._state',
|
||||
title : '是否故障',
|
||||
align:'center',
|
||||
valign: 'middle', // 上下居中
|
||||
formatter : function(value,row){
|
||||
var pic;
|
||||
if(value == 0){
|
||||
pic = '<img src= "' + ext.contextPath + '/IMG/mpoint_pic/lg.png" style="width:20px;height:20px;" ></img>';
|
||||
}else{
|
||||
pic = '<img src= "' + ext.contextPath + '/IMG/mpoint_pic/lr.png" style="width:20px;height:20px;" ></img>';
|
||||
}
|
||||
return pic;
|
||||
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("detailTable");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<%-- <!-- 引用top -->
|
||||
<jsp:include page="/jsp/top.jsp"></jsp:include>
|
||||
<!-- 菜单栏 -->
|
||||
<jsp:include page="/jsp/left.jsp"></jsp:include> --%>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1 id="head_title"></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a id='head_firstlevel' href="#"><i class="fa fa-dashboard"></i> </a></li>
|
||||
<!-- <li class="active">Here</li> -->
|
||||
</ol>
|
||||
</section>
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="subDiv_Configure"></div>
|
||||
<div id="subDiv_PatroPoint"></div>
|
||||
<div id="subDiv_Equipment"></div>
|
||||
<form id="searchForm" >
|
||||
<div>
|
||||
<div id="companySelectTree" style="display: none"></div>
|
||||
<!-- <div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i class="fa fa-plus"></i> 新增</button>
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i class="fa fa-trash-o"></i> 删除</button>
|
||||
</div> -->
|
||||
<div class="form-group pull-right form-inline">
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right" placeholder="名称">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
|
||||
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include>
|
||||
<jsp:include page="/jsp/side.jsp"></jsp:include> --%>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
90
WebRoot/jsp/user/processSectionScoreAdd.jsp
Normal file
90
WebRoot/jsp/user/processSectionScoreAdd.jsp
Normal file
@ -0,0 +1,90 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<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 dosave() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/processSectionScore/dosave.do", $("#subForm").serialize(), function (data) {
|
||||
if (data.res == 1) {
|
||||
closeModal('subModal')
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else if (data.res == 0) {
|
||||
showAlert('d', '保存失败');
|
||||
} else {
|
||||
showAlert('d', data.res);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$(function () {
|
||||
|
||||
})
|
||||
</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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm" enctype="multipart/form-data">
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">区间上限</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="number" id="upper" name="upper" class="form-control" placeholder="区间上限">
|
||||
</div>
|
||||
|
||||
<label class="col-sm-2 control-label">区间下限</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="number" id="lower" name="lower" 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="alarmcontent" name="alarmcontent" class="form-control"
|
||||
placeholder="警示信息">
|
||||
</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="dosave()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
86
WebRoot/jsp/user/processSectionScoreEdit.jsp
Normal file
86
WebRoot/jsp/user/processSectionScoreEdit.jsp
Normal file
@ -0,0 +1,86 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function doupdate() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/processSectionScore/doupdate.do", $("#subForm").serialize(), function (data) {
|
||||
if (data.res == 1) {
|
||||
closeModal('subModal');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else if (data.res == 0) {
|
||||
showAlert('d', '更新失败');
|
||||
} else {
|
||||
showAlert('d', data.res);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(function () {
|
||||
|
||||
})
|
||||
</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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm">
|
||||
<div id="alertDiv"></div>
|
||||
<input id="id" name="id" type="hidden" value="${processSectionScore.id}" />
|
||||
<!-- 界面提醒div强制id为alertdiv -->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">区间上限</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="number" id="upper" name="upper" class="form-control" placeholder="区间上限" value="${processSectionScore.upper}">
|
||||
</div>
|
||||
|
||||
<label class="col-sm-2 control-label">区间下限</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="number" id="lower" name="lower" class="form-control" placeholder="区间下限" value="${processSectionScore.lower}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">警示信息</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" id="alarmcontent" name="alarmcontent" class="form-control"
|
||||
placeholder="警示信息" value="${processSectionScore.alarmcontent}">
|
||||
</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="doupdate()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
192
WebRoot/jsp/user/processSectionScoreList.jsp
Normal file
192
WebRoot/jsp/user/processSectionScoreList.jsp
Normal file
@ -0,0 +1,192 @@
|
||||
<%@page import="com.sipai.entity.maintenance.Maintenance"%>
|
||||
<%@ 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"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
var addFun = function () {
|
||||
$.post(ext.contextPath + '/user/processSectionScore/doadd.do', {}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
var editFun = function (id) {
|
||||
$.post(ext.contextPath + '/user/processSectionScore/doedit.do', { id: id }, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
var forwardFun = function(website){
|
||||
window.open(website);
|
||||
}
|
||||
var deleteFun = function (id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/processSectionScore/dodelete.do', { id: id }, function (data) {
|
||||
if (data == 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var dosearch = function () {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
};
|
||||
var initFun = function () {
|
||||
$("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/processSectionScore/getList.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
//showFooter: true,//添加页脚
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_name').val(),
|
||||
}
|
||||
},
|
||||
sortName: 'upper', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
/* {
|
||||
checkbox: true, // 显示一个勾选框
|
||||
}, */{
|
||||
field: 'upper', // 返回json数据中的name
|
||||
title: '区间上限', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
}, {
|
||||
field: 'lower', // 返回json数据中的name
|
||||
title: '区间下限', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
{
|
||||
field: 'alarmcontent', // 返回json数据中的name
|
||||
title: '警示信息', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 120, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts = '';
|
||||
buts += '<button class="btn btn-default btn-sm" onclick="editFun(\'' + row.id + '\')" data-toggle="tooltip" title="编辑"><i class="fa fa-edit "></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
||||
buts += '<button class="btn btn-default btn-sm" onclick="deleteFun(\'' + row.id + '\')" data-toggle="tooltip" title="删除"><i class="fa fa-trash-o "></i><span class="hidden-md hidden-lg"> 删除</span></button>';
|
||||
buts = '<div class = "btn-group">' + buts + '</div>';
|
||||
return buts;
|
||||
}
|
||||
}
|
||||
],
|
||||
//注册加载子表的事件。index:父表当前行的行索引,row:父表当前行的Json数据对象,$detail:当前行下面创建的新行里面的td对象。
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
initFun();
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1 id="head_title"></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a id='head_firstlevel' href="#"><i class="fa fa-dashboard"></i> </a></li>
|
||||
<!-- <li class="active">Here</li> -->
|
||||
</ol>
|
||||
</section>
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div>
|
||||
<form id="searchForm">
|
||||
<div class="form-group form-inline" style="padding:0;">
|
||||
<div class="form-group pull-right">
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name" name="search_name"
|
||||
class="form-control pull-right" placeholder="名称">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="dosearch();"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i
|
||||
class="fa fa-plus"></i> 新增</button>
|
||||
|
||||
<!-- <button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i
|
||||
class="fa fa-trash-o"></i> 删除</button> -->
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
166
WebRoot/jsp/user/registerQrcode.jsp
Normal file
166
WebRoot/jsp/user/registerQrcode.jsp
Normal file
@ -0,0 +1,166 @@
|
||||
<%@ 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"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<%String contextPath = request.getContextPath();%>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<!-- 引入comm.js-->
|
||||
<script type="text/javascript" src="<%= request.getContextPath()%>/plugins/qrcode/qrcode.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%= request.getContextPath()%>/plugins/qrcode/jquery.qrcode.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
//二维码转格式
|
||||
function utf16to8(str) {
|
||||
var out, i, len, c;
|
||||
out = "";
|
||||
len = str.length;
|
||||
for (i = 0; i < len; i++) {
|
||||
c = str.charCodeAt(i);
|
||||
if ((c >= 0x0001) && (c <= 0x007F)) {
|
||||
out += str.charAt(i);
|
||||
} else if (c > 0x07FF) {
|
||||
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
|
||||
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
|
||||
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
|
||||
} else {
|
||||
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
|
||||
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
var select =$("#search_code").select2({
|
||||
ajax: {
|
||||
type:'POST',
|
||||
url: ext.contextPath +"/user/getUnitsByUserId4Select.do",
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
processResults: function (data) {
|
||||
return {
|
||||
results: data
|
||||
}
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
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'})
|
||||
select.on("change",function(e){
|
||||
var companyid=$(this).val();
|
||||
var url=ext.basePath+"/Login/register.do?unitId="+companyid;
|
||||
var cidd2 = utf16to8(url);
|
||||
$('#qrcodeTable2').empty();
|
||||
$('#qrcodeTable2').qrcode({
|
||||
render : "canvas",
|
||||
width : 150, //设置宽度
|
||||
height : 150, //设置高度
|
||||
typeNumber : -1, //计算模式
|
||||
correctLevel : QRErrorCorrectLevel.H,//纠错等级
|
||||
background : "#ffffff",//背景颜色
|
||||
foreground : "#000000", //前景颜色
|
||||
text : cidd2
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
$(function() {
|
||||
$.post(ext.contextPath + "/user/getUnitsByUserId4Select.do", {}, function(data) {
|
||||
|
||||
/* var selelct =$("#search_code").select2({
|
||||
data: data,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
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;} // 函数用于呈现当前的选择
|
||||
}); */
|
||||
|
||||
if(data.length==1){
|
||||
//选择厂区为一个厂时隐藏选择框
|
||||
//selelct.val(data[0].id).trigger("change");
|
||||
//selelct.attr("disabled","disabled");
|
||||
$("#search_code").next().css("display", "none");
|
||||
$("#company").text(data[0].text);
|
||||
$("#companylabel").html("公司:");
|
||||
// $("#companyname").val(data[0].id);
|
||||
var companyid=data[0].id;
|
||||
var url=ext.basePath+"/Login/register.do?unitId="+companyid;
|
||||
var cidd2 = utf16to8(url);
|
||||
$('#qrcodeTable2').empty();
|
||||
$('#qrcodeTable2').qrcode({
|
||||
render : "canvas",
|
||||
width : 150, //设置宽度
|
||||
height : 150, //设置高度
|
||||
typeNumber : -1, //计算模式
|
||||
correctLevel : QRErrorCorrectLevel.H,//纠错等级
|
||||
background : "#ffffff",//背景颜色
|
||||
foreground : "#000000", //前景颜色
|
||||
text : cidd2
|
||||
});
|
||||
}else{
|
||||
//selelct.val("").trigger("change");
|
||||
// $("#companyname").attr("disabled","disabled");
|
||||
$("#company").css("display", "none");
|
||||
}
|
||||
},'json');
|
||||
})
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<!-- 引用top -->
|
||||
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
|
||||
<!-- 菜单栏 -->
|
||||
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1 id ="head_title"></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a id ='head_firstlevel' href="#"><i class="fa fa-dashboard"></i> </a></li>
|
||||
<!-- <li class="active">Here</li> -->
|
||||
</ol>
|
||||
</section>
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv" style="width: 220px;height:10px;"></div>
|
||||
<div id="menu4SelectDiv"></div>
|
||||
<div >
|
||||
<div class="form-group " style="padding:0;">
|
||||
<label class="form-label" id="companylabel">公司</label>
|
||||
<select class="form-control select2 " id="search_code" name ="search_code" style="width: 220px;"></select>
|
||||
<span class="select2-selection select2-selection--single" id="company" style="width:220px;border: none;background: transparent;" ></span>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div id="qrcodeTable2" style="display:block;margin: 0 auto;text-align:center; width:150px"></div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
|
||||
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
124
WebRoot/jsp/user/roleAdd.jsp
Normal file
124
WebRoot/jsp/user/roleAdd.jsp
Normal file
@ -0,0 +1,124 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<script type="text/javascript">
|
||||
|
||||
function dosave() {
|
||||
/* $("#baseForm").validate({
|
||||
rules: {
|
||||
name: "required"
|
||||
},
|
||||
messages: {
|
||||
name: "请输入用户名"
|
||||
},
|
||||
// 校验全部通过
|
||||
submitHandler: function () {
|
||||
alert("校验全部通过!")
|
||||
$.post(ext.contextPath + "/work/group/save.do", $("#baseForm").serialize(), function(data) {
|
||||
if (data.res == 1) {
|
||||
alert("保存成功")
|
||||
}else if(data.res == 0){
|
||||
alert("保存失败")
|
||||
}else{
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}); */
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + '/user/saveRole.do', $("#subForm").serialize(), function (data) {
|
||||
if (data.res == 1) {
|
||||
closeModal('subModal')
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else if (data.res == 0) {
|
||||
showAlert('d', '保存失败');
|
||||
} else {
|
||||
showAlert('d', data.res);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
bizname: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '厂区不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var showUnit4SelectFun = function () {
|
||||
$.post(ext.contextPath + '/user/showUnit4Select_Limited.do', { formId: "subForm", hiddenId: "bizid", textId: "bizname" }, function (data) {
|
||||
$("#unit4SelectDiv").html(data);
|
||||
openModal("unit4SelectModal_Limited");
|
||||
});
|
||||
};
|
||||
</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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm">
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></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="name" name="name" placeholder="名称" style="border-radius:4px">
|
||||
</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="bizname" name="bizname" placeholder="负责厂区" readonly--%>
|
||||
<%-- onclick="showUnit4SelectFun();" value="${company.name}"--%>
|
||||
<%-- style="border-radius:4px;background-color: white">--%>
|
||||
<%-- <input id="bizid" name="bizid" type="hidden" value="${company.id}" />--%>
|
||||
<%-- </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="serial" name="serial" placeholder="编号"
|
||||
style="border-radius:4px">
|
||||
</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="description" name="description" placeholder="描述"
|
||||
style="border-radius:4px">
|
||||
</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="dosave()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
127
WebRoot/jsp/user/roleEdit.jsp
Normal file
127
WebRoot/jsp/user/roleEdit.jsp
Normal file
@ -0,0 +1,127 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<script type="text/javascript">
|
||||
var showUnit4SelectFun = function () {
|
||||
$.post(ext.contextPath + '/user/showUnit4Select_Limited.do', { formId: "subForm", hiddenId: "bizid", textId: "bizname" }, function (data) {
|
||||
$("#unit4SelectDiv").html(data);
|
||||
openModal("unit4SelectModal");
|
||||
});
|
||||
};
|
||||
function doupdate() {
|
||||
/* $("#baseForm").validate({
|
||||
rules: {
|
||||
name: "required"
|
||||
},
|
||||
messages: {
|
||||
name: "请输入用户名"
|
||||
},
|
||||
// 校验全部通过
|
||||
submitHandler: function () {
|
||||
alert("校验全部通过!")
|
||||
$.post(ext.contextPath + "/work/group/save.do", $("#baseForm").serialize(), function(data) {
|
||||
if (data.res == 1) {
|
||||
alert("保存成功")
|
||||
}else if(data.res == 0){
|
||||
alert("保存失败")
|
||||
}else{
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}); */
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/updateRole.do", $("#subForm").serialize(), function (data) {
|
||||
if (data.res == 1) {
|
||||
$(".modal").modal("hide");
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else if (data.res == 0) {
|
||||
showAlert('d', '保存失败');
|
||||
} else {
|
||||
showAlert('d', data.res);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
bizname: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '厂区不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
var showUnit4SelectFun = function () {
|
||||
$.post(ext.contextPath + '/user/showUnit4Select_Limited.do', { formId: "subForm", hiddenId: "bizid", textId: "bizname" }, function (data) {
|
||||
$("#unit4SelectDiv").html(data);
|
||||
openModal("unit4SelectModal_Limited");
|
||||
});
|
||||
};
|
||||
</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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm">
|
||||
<div id="alertDiv"></div>
|
||||
<input id="id" name="id" type="hidden" value="${role.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="${role.name}" style="border-radius:4px">
|
||||
</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="bizname" name="bizname" readonly placeholder="负责厂区" style="border-radius:4px;background-color: white"--%>
|
||||
<%-- onclick="showUnit4SelectFun();" value="${role.bizname}">--%>
|
||||
<%-- <input id="bizid" name="bizid" type="hidden" value="${role.bizid}" />--%>
|
||||
<%-- </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="serial" name="serial" placeholder="编号" value="${role.serial}" style="border-radius:4px">
|
||||
</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="description" name="description" placeholder="描述" style="border-radius:4px"
|
||||
value="${role.description}">
|
||||
</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="doupdate()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
95
WebRoot/jsp/user/roleForSelect.jsp
Normal file
95
WebRoot/jsp/user/roleForSelect.jsp
Normal file
@ -0,0 +1,95 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
var grid;
|
||||
function selectOK() {
|
||||
var rolenames="";
|
||||
var roleids="";
|
||||
var checkedItems = $('#grid').datagrid('getChecked');
|
||||
$.each(checkedItems, function(index, item){
|
||||
roleids+=item.id+",";
|
||||
rolenames+=item.name+",";
|
||||
});
|
||||
if(roleids.length>1){
|
||||
roleids = roleids.substring(0, roleids.length-1);
|
||||
}
|
||||
if(rolenames.length>1){
|
||||
rolenames = rolenames.substring(0, rolenames.length-1);
|
||||
}
|
||||
var retn= roleids+")"+rolenames;
|
||||
return retn;
|
||||
}
|
||||
$(function() {
|
||||
grid = $('#grid').datagrid({
|
||||
title : '',
|
||||
url : ext.contextPath + '/user/getRolesForSelect.do',
|
||||
striped : true,
|
||||
rownumbers : true,
|
||||
pagination : true,
|
||||
singleSelect: false,
|
||||
selectOnCheck: true,
|
||||
checkOnSelect: true,
|
||||
idField : 'id',
|
||||
pageSize : 50,
|
||||
pageList : [ 20, 50, 100],
|
||||
columns : [ [
|
||||
{checkbox:true , field : 'ck'},
|
||||
{width : '100', title : '名称', field : 'name', sortable : true, editor:'textbox',halign:'center'},
|
||||
{width : '280', title : '描述', field : 'description', sortable : true, editor:'textbox',halign:'center'}
|
||||
] ],
|
||||
toolbar : '#toolbar',
|
||||
onLoadSuccess:function(data){
|
||||
if(data){
|
||||
$.each(data.rows, function(index, item){
|
||||
//$.each(eval('${json}'), function(index1, item1){
|
||||
if('${roleids}'!=null){
|
||||
var roleidstr='${roleids}';
|
||||
var roleidarr=roleidstr.split(",");
|
||||
for(var i=0;i<roleidarr.length;i++){
|
||||
if(item.id==roleidarr[i]){
|
||||
$('#grid').datagrid('checkRow', index);
|
||||
}
|
||||
}
|
||||
}
|
||||
//});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body class="easyui-layout" data-options="fit:true,border:false">
|
||||
<div id="toolbar" style="display: none;">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<form id="searchForm">
|
||||
<table>
|
||||
<tr>
|
||||
<td>权限名称</td>
|
||||
<td><input name="search_name" class="easyui-textbox" style="width: 180px;" /></td>
|
||||
|
||||
<td>
|
||||
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-search',plain:true"
|
||||
onclick="grid.datagrid('load',ext.serializeObject($('#searchForm')));">搜索</a>
|
||||
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true"
|
||||
onclick="$('#searchForm').form('clear');grid.datagrid('load',{});">重置</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div data-options="region:'center',fit:true,border:false">
|
||||
<table id="grid" data-options="fit:true,border:false"></table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
107
WebRoot/jsp/user/roleFuncForSelect.jsp
Normal file
107
WebRoot/jsp/user/roleFuncForSelect.jsp
Normal file
@ -0,0 +1,107 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<script type="text/javascript">
|
||||
function dosave(dialog,parent) {
|
||||
var checkedItems = $("#table_func").bootstrapTable('getSelections');
|
||||
var datas="";
|
||||
$.each(checkedItems, function(index, item){
|
||||
datas+=item.id+",";
|
||||
});
|
||||
//alert(datas);
|
||||
$.post(ext.contextPath + '/user/updateFuncByRoleMenu.do', {funcstr:datas,roleid:"${param.roleid}",menuid:"${param.menuid}"} , function(data) {
|
||||
if(data >= 0){
|
||||
initialTree();
|
||||
closeModal('roleFunc4SelectModal');
|
||||
|
||||
}else{
|
||||
showAlert('d','保存失败','alertDiv_func');
|
||||
}
|
||||
});
|
||||
}
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag=false;
|
||||
$.each(eval('${json}'), function(index, item){
|
||||
if(row.id==item.menuid){
|
||||
flag=true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked : true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
$(function() {
|
||||
$("#table_func").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getFuncByMenuid.do', // 获取表格数据的urwl
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order, // 排序规则
|
||||
menuid:'${param.menuid}'
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
formatter:stateFormatter
|
||||
}, {
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
width:'100%',
|
||||
},
|
||||
/*
|
||||
{
|
||||
field: 'location',
|
||||
title: '地址',
|
||||
align: 'left',
|
||||
valign: 'middle',
|
||||
width:'70%'
|
||||
}
|
||||
*/
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table_func");
|
||||
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
||||
<div class="modal fade" id="roleFunc4SelectModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" data-target="#roleFunc4SelectModal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">选择按钮和数据权限</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="alertDiv_func"></div>
|
||||
<div id="table_func"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-target="#roleFunc4SelectModal" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" onclick="dosave()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
235
WebRoot/jsp/user/roleList.jsp
Normal file
235
WebRoot/jsp/user/roleList.jsp
Normal file
@ -0,0 +1,235 @@
|
||||
<%@ 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"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
|
||||
<head>
|
||||
<title>
|
||||
<%= ServerObject.atttable.get("TOPTITLE")%>
|
||||
</title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<!-- bootstrap switch -->
|
||||
<link rel="stylesheet"
|
||||
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css" />
|
||||
<script type="text/javascript"
|
||||
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
// var companyId;//全局水厂id变量 给人员筛选
|
||||
var addFun = function () {
|
||||
$.post(ext.contextPath + '/user/addRole.do', { companyId : unitId}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
var editFun = function (id) {
|
||||
/* var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
if(checkedItems==null ||checkedItems.length!=1){
|
||||
showAlert('i','请选择一条记录进行编辑','mainAlertdiv');
|
||||
}else{ */
|
||||
$.post(ext.contextPath + '/user/editRole.do', { id: id }, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
/* } */
|
||||
};
|
||||
//编辑权限信息
|
||||
var editPowerFun = function (roleid) {
|
||||
$.post(ext.contextPath + '/user/showRoleMenu.do', { roleid: roleid }, function (data) {
|
||||
$("#subDiv_Menu").html(data);
|
||||
openModal('menuFuncModal');
|
||||
});
|
||||
};
|
||||
//编辑权限信息
|
||||
var editAppPowerFun = function (roleid) {
|
||||
$.post(ext.contextPath + '/app/appMenuitem/showRoleMenu.do', { roleid: roleid }, function (data) {
|
||||
$("#subDiv_Menu").html(data);
|
||||
openModal('menuFuncModal');
|
||||
});
|
||||
};
|
||||
|
||||
//编辑用户信息
|
||||
var editUserFun = function (roleid, bizid) {
|
||||
$.post(ext.contextPath + '/user/showRoleUser.do', { roleid: roleid }, function (data) {
|
||||
$("#subDiv_User").html(data);
|
||||
openModal('roleUserModal');
|
||||
});
|
||||
};
|
||||
var deleteFun = function (id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/deleteRole.do', { id: id }, function (data) {
|
||||
if (data == 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
var $table;
|
||||
var initFun = function () {
|
||||
$table = $("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getListRole.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 20, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_name').val(),
|
||||
// search_pid: companyId
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
{
|
||||
field: 'serial', // 返回json数据中的name
|
||||
title: '编码', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
// {
|
||||
// field: 'bizname', // 返回json数据中的name
|
||||
// title: '厂区名称', // 表格表头显示文字
|
||||
// align: 'center', // 左右居中
|
||||
// valign: 'middle' // 上下居中
|
||||
// },
|
||||
{
|
||||
field: 'description', // 返回json数据中的name
|
||||
title: '描述', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 250, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts = '<button class="btn btn-default btn-sm" title="平台权限" onclick="editPowerFun(\'' + row.id + '\')"><i class="fa fa-cog"></i></button>';
|
||||
buts += '<button class="btn btn-default btn-sm" title="app权限" onclick="editAppPowerFun(\'' + row.id + '\')"><i class="fa fa-whatsapp"></i></button>';
|
||||
buts += '<button class="btn btn-default btn-sm" title="选择人员" onclick="editUserFun(\'' + row.id + '\',\'' + row.bizid + '\')"><i class="fa fa-users"></i></button>';
|
||||
buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i></button>';
|
||||
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\'' + row.id + '\')"><i class="fa fa-trash-o"></i></button>';
|
||||
buts = '<div class="btn-group" >' + buts + '</div>';
|
||||
return buts;
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
var dosearch = function () {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
};
|
||||
$(function () {
|
||||
initFun();
|
||||
//init();
|
||||
//简易公司combotree
|
||||
// $.post(ext.contextPath + "/user/showCompanySelectTree.do", {}, function (data) {
|
||||
// $('#companySelectTree').html(data);
|
||||
// });
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<!-- 引用top -->
|
||||
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
|
||||
<!-- 菜单栏 -->
|
||||
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="subDiv_Menu"></div>
|
||||
<div id="subDiv_User"></div>
|
||||
<div id="subDiv_func"></div>
|
||||
<div id='unit4SelectDiv'></div>
|
||||
<%-- <div id="companySelectTree"></div>--%>
|
||||
|
||||
<div>
|
||||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i
|
||||
class="fa fa-plus"></i>
|
||||
新增</button>
|
||||
</div>
|
||||
<div class="form-group pull-right">
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right"
|
||||
placeholder="名称">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="$table.bootstrapTable('refresh');"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
|
||||
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
112
WebRoot/jsp/user/roleMenu.jsp
Normal file
112
WebRoot/jsp/user/roleMenu.jsp
Normal file
@ -0,0 +1,112 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8" %>
|
||||
<script type="text/javascript">
|
||||
function doSaveMainRole() {
|
||||
var checkedtree = $('#menu_func_tree').treeview('getChecked');
|
||||
var datas = "";
|
||||
var lis = $('[data-nodeid]');
|
||||
for (var i = 0; i < lis.length; i++) {
|
||||
if (lis[i].dataset.nodeid.split('.').length == 4) {
|
||||
var lis_element = $('#' + lis[i].id);
|
||||
if (lis_element.hasClass('node-checked')) {
|
||||
var span = lis_element.children('.check-icon');
|
||||
if (span.hasClass('glyphicon-check')) {
|
||||
datas += lis[i].id + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*$.each(checkedtree,function(index,item){
|
||||
datas+=item.id+",";
|
||||
});*/
|
||||
$.post(ext.contextPath + "/user/updateRoleMenu.do", {menustr: datas, roleid: "${roleid}"}, function (result) {
|
||||
if (result >= 0) {
|
||||
closeModal('menuFuncModal');
|
||||
} else {
|
||||
showAlert('d', '保存失败')
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
function selectNode() {
|
||||
console.log('${json}')
|
||||
|
||||
console.log(eval('${json}'), "json")
|
||||
$.each(eval('${json}'), function (index, item) {
|
||||
var node = $('#menu_func_tree').treeview('findNodes', [item.menuid, 'id']);
|
||||
$('#menu_func_tree').treeview('toggleNodeChecked', [node, {silent: true}]);
|
||||
});
|
||||
}
|
||||
|
||||
// List<RoleMenu> list = menuService.getFinalMenuByRoleId(roleid);
|
||||
// JSONArray json=JSONArray.fromObject(list);
|
||||
// model.addAttribute("json",json);
|
||||
function initialTree() {
|
||||
$.post(ext.contextPath + '/user/getMenusJsonWithFuncByRoleID.do', {roleid: '${roleid}'}, function (data) {
|
||||
// console.info(data)
|
||||
if (data.length > 0) {
|
||||
$('#menu_func_tree').treeview({
|
||||
data: data,
|
||||
showCheckbox: true,
|
||||
showTags: true,
|
||||
showBorder: false,
|
||||
hierarchicalCheck: true,//级联勾选
|
||||
onInitialized: function (event, nodes) {
|
||||
},
|
||||
//无点击事件,通过节点选择实现
|
||||
onNodeSelected: function (event, node) {
|
||||
/* $('#roleFunc4SelectModal').modal({
|
||||
remote: '/user/roleFuncForSelect.do?menuid='+node.id+'&roleid=
|
||||
|
||||
${roleid}',
|
||||
backdrop: 'static',
|
||||
keyboard: false
|
||||
}); */
|
||||
|
||||
$.post(ext.contextPath + '/user/roleFuncForSelect.do', {
|
||||
menuid: node.id,
|
||||
roleid: "${roleid}"
|
||||
}, function (result) {
|
||||
$('#subDiv_func').html(result)
|
||||
openModal('roleFunc4SelectModal');
|
||||
|
||||
});
|
||||
},
|
||||
onRendered: function (event, nodes) {
|
||||
setTimeout("selectNode();", "10");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
$(function () {
|
||||
initialTree();
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<div class="modal fade" id="menuFuncModal">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" data-target="#menuFuncModal"
|
||||
aria-label="Close">
|
||||
<span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">${rolename }——权限树</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="alertDiv"></div>
|
||||
<div id="menu_func_tree" style="height:400px;overflow:auto; "></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" data-target="#menuFuncModal">关闭
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" onclick="doSaveMainRole()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
289
WebRoot/jsp/user/roleUser.jsp
Normal file
289
WebRoot/jsp/user/roleUser.jsp
Normal file
@ -0,0 +1,289 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<script type="text/javascript">
|
||||
var doSearchUser = function() {
|
||||
$("#table_user").bootstrapTable('refresh');
|
||||
};
|
||||
function dosave(dialog,grid) {
|
||||
//var checkedItems = $("#table_user").bootstrapTable('getAllSelections');
|
||||
var datas="";
|
||||
$.each(selectionIds, function(index, item){
|
||||
datas+=item+",";
|
||||
});
|
||||
//alert(datas);
|
||||
$.post(ext.contextPath + '/user/updateUserRole.do', {userstr:datas,roleid:"${roleid}"} , function(data) {
|
||||
if(data >= 0){
|
||||
closeModal('roleUserModal');
|
||||
}else{
|
||||
showAlert('d','保存失败');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag=false;
|
||||
$.each(eval('${json}'), function(index, item){
|
||||
if(row.id==item.empid){
|
||||
flag=true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked : true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
var $table;
|
||||
var switchStatus=false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds(){
|
||||
var check_array =eval('${json}');
|
||||
if(check_array!=null&& check_array.length>0){
|
||||
selectionIds =new Array(check_array.length);
|
||||
for(var i=0;i<check_array.length;i++){
|
||||
selectionIds[i]=check_array[i].empid;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getCheckedIds(){
|
||||
var ids="";
|
||||
var check_array =eval('${json}');
|
||||
$.each(check_array, function(index, item){
|
||||
if(ids!=""){
|
||||
ids+=",";
|
||||
}
|
||||
ids+=item.empid;
|
||||
});
|
||||
return ids;
|
||||
}
|
||||
function queryParams(params) {
|
||||
var temp={
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_name_user').val(),
|
||||
search_pid:unitId
|
||||
};
|
||||
var status =$('#switchBtn').bootstrapSwitch('state')
|
||||
if(status){
|
||||
temp.checkedIds=getCheckedIds();
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
$(function() {
|
||||
$("#searchForm_User").attr("onsubmit", "return false;");
|
||||
$("#search_name_user").keyup(function () {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车执行查询
|
||||
doSearchUser();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
//jquery html()方法加载,导致box无法执行boxwidget(),手动初始化
|
||||
$('#searchBox').boxWidget();
|
||||
$("#search_pid").select2({
|
||||
ajax: {
|
||||
type:'POST',
|
||||
url: ext.contextPath +"/work/group/getListForSelect.do",
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
processResults: function (data) {
|
||||
return {
|
||||
results: data
|
||||
}
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
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;} // 函数用于呈现当前的选择
|
||||
});
|
||||
//$("#active").select2({minimumResultsForSearch: 10}).val("${menu.active}").trigger("change");
|
||||
$('#switchBtn').bootstrapSwitch({
|
||||
onText:'是',
|
||||
offText:'否',
|
||||
size:"small",
|
||||
})
|
||||
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'});
|
||||
|
||||
initialSelectionIds();
|
||||
|
||||
$table=$("#table_user").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUsers.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect:true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 20, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
responseHandler:responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
//formatter: stateFormatter
|
||||
formatter: function (i,row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if($.inArray(row.id,Array.from(selectionIds))!=-1){ // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked : true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '登录名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'caption',
|
||||
title: "姓名",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '30%'
|
||||
},{
|
||||
field: '_pname',
|
||||
title: "部门",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '50%'
|
||||
},{
|
||||
field: 'sex',
|
||||
title: "性别",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
formatter : function(value, row, index) {
|
||||
switch (value) {
|
||||
case '0':
|
||||
return '女';
|
||||
case '1':
|
||||
return '男';
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table_user");
|
||||
|
||||
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e, rows) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
});
|
||||
});
|
||||
//选中事件操作数组
|
||||
var union = function(array,ids){
|
||||
$.each(ids, function (i, id) {
|
||||
if($.inArray(id,array)==-1){
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//取消选中事件操作数组
|
||||
var difference = function(array,ids){
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id,array);
|
||||
if(index!=-1){
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union":union,"difference":difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
<div class="modal fade" id="roleUserModal">
|
||||
<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 " style="width:100%">
|
||||
<div id="alertDiv"></div>
|
||||
|
||||
<div class="box box-primary box-solid collapsed-box" id="searchBox" collapsed>
|
||||
<div class="box-header">
|
||||
<!-- tools box -->
|
||||
<div class="pull-right box-tools">
|
||||
<button type="button" class="btn btn-primary btn-sm pull-right" data-widget="collapse"
|
||||
style="margin-right: 5px;">
|
||||
<i class="fa fa-plus"></i></button>
|
||||
</div>
|
||||
<!-- /. tools -->
|
||||
<i class="fa fa-search"></i>
|
||||
</div>
|
||||
<div class="box-body collapse" >
|
||||
<form class="form-horizontal " id="searchForm_User">
|
||||
<div class="form-group" style="margin-right: 20px;">
|
||||
<label class="col-sm-2 control-label">部门</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control select2 " id="search_pid" name ="search_pid" style="width:170px;"></select>
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">姓名</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" id="search_name_user" name="search_name_user" class="form-control input-sm" placeholder="姓名" style="width:170px;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-right: 20px;">
|
||||
<label class="col-sm-2 control-label">只看选中</label>
|
||||
<div class="col-sm-4">
|
||||
<div class="switch" data-on="primary" data-off="info">
|
||||
<input id ="switchBtn" type="checkbox" />
|
||||
</div>
|
||||
</div>
|
||||
<div class=" col-sm-6 button-group" style="padding: 0;">
|
||||
<button type ="button" class="btn btn-default btn-sm pull-right" onclick="doSearchUser();"><i class="fa fa-search"> 搜索</i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div id="table_user" style="height:230px;overflow:auto;width:100%"></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" onclick="dosave()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
139
WebRoot/jsp/user/selectEquipmentProcessSection.jsp
Normal file
139
WebRoot/jsp/user/selectEquipmentProcessSection.jsp
Normal file
@ -0,0 +1,139 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@page import="java.util.Date" %>
|
||||
<%@page import="java.text.SimpleDateFormat" %>
|
||||
<%@ page import="com.sipai.tools.SessionManager"%>
|
||||
<%
|
||||
SessionManager sessionManager = new SessionManager();
|
||||
%>
|
||||
|
||||
<script type="text/javascript">
|
||||
var checkedItem="";
|
||||
var $table;
|
||||
function doselect() {
|
||||
if(checkedItem!= null && checkedItem!=""){
|
||||
//console.info(checkedItem);
|
||||
$('#processsectionid' ).val(checkedItem.id);
|
||||
$('#processsectionCode' ).val(checkedItem.code);
|
||||
$('#processsectionName').val(checkedItem.name);
|
||||
closeModal("equipmentProcessSectionSubModal");
|
||||
}
|
||||
};
|
||||
|
||||
var dosearchprocess = function() {
|
||||
$("#equipmentProcessSection").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
|
||||
//显示已经勾选的数据
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag=false;
|
||||
if(row.id=='${processsectionId}'){
|
||||
flag=true;
|
||||
checkedItem = row;
|
||||
}
|
||||
if (flag)
|
||||
return {
|
||||
checked : true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$table = $("#equipmentProcessSection").bootstrapTable({ // 对应table标签的id
|
||||
//url: ext.contextPath + '/equipment/getList.do', // 获取表格数据的url
|
||||
//url: ext.contextPath + '/equipment/equipmentBelong/getList.do', // 获取表格数据的url
|
||||
url: ext.contextPath + '/user/processSection/getlist.do', // 获取表格数据的url
|
||||
clickToSelect:true,
|
||||
singleSelect:true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
//responseHandler:responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_code: '${companyId}',
|
||||
search_name: $('#search_processname').val()
|
||||
}
|
||||
},
|
||||
queryParamsType: "limit",
|
||||
sortName: 'morder', // 要排序的字段
|
||||
sortOrder: 'asc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
formatter: stateFormatter
|
||||
},{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},{
|
||||
field: 'code', // 返回json数据中的name
|
||||
title: '编号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
},
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("equipmentProcessSection");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e,rows, obj) {
|
||||
if('check'==e.type){
|
||||
$('#equipmentProcessSection .checked').removeClass("checked");
|
||||
obj.parent().addClass("checked");
|
||||
checkedItem = rows;
|
||||
}else{
|
||||
obj.parent().removeClass("checked");
|
||||
checkedItem = "";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="equipmentProcessSectionSubModal" >
|
||||
<div class="modal-dialog modal-md" >
|
||||
<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 id="alertDiv_MaintainPlanSelect"></div>
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="menu4SelectDiv"></div>
|
||||
<div id="modal-body">
|
||||
<div class="input-group input-group-sm" style="width: 250px;float: right;margin-bottom: 15px;">
|
||||
<input type="text" id="search_processname" name="search_processname" class="form-control pull-right" placeholder="名称/编号">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="dosearchprocess();"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-scrollable">
|
||||
<table class="table table-bordered table-striped" style="overflow:auto;width:100%" id="equipmentProcessSection"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</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="doselect()" id="btn_save">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
89
WebRoot/jsp/user/showManual.jsp
Normal file
89
WebRoot/jsp/user/showManual.jsp
Normal file
@ -0,0 +1,89 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
|
||||
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
|
||||
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
|
||||
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
|
||||
<!--[if !IE]><!-->
|
||||
<html lang="zh-CN">
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<!-- PDF预览 begin -->
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/bootstrap/pdf/web/viewer.css">
|
||||
<link rel="resource" type="application/l10n" href="<%=request.getContextPath()%>/bootstrap/pdf/web/locale/locale.properties">
|
||||
<!-- END -->
|
||||
</head>
|
||||
<body class="page-container-bg-solid">
|
||||
<div class="page-wrapper">
|
||||
<!-- 引用top -->
|
||||
<jsp:include page="/top.jsp"></jsp:include>
|
||||
<!-- BEGIN CONTAINER -->
|
||||
<div class="page-wrapper-row full-height">
|
||||
<div class="page-wrapper-middle">
|
||||
<div class="page-container">
|
||||
<!-- BEGIN page-content-wrapper -->
|
||||
<div class="page-content-wrapper">
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
<div class="page-content-body">
|
||||
<c:choose>
|
||||
<c:when test="${CommFile.type == 'PDF'}">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="height:50px;margin-left:30px">
|
||||
<a class="btn green-turquoise " href="fd?method=down&id=${CommFile.id}&t=tb_manual_file">用户操作手册文件下载</a>
|
||||
</div>
|
||||
</div>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<input type="hidden" id="abspath" value="${CommFile.abspath}">
|
||||
<c:choose>
|
||||
<c:when test="${CommFile.type == 'PDF'}">
|
||||
<div id="PDF_container">
|
||||
<div class="lightbox"></div>
|
||||
<div id="pop" class="pop" style="text-align: center;"></div>
|
||||
</div>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<h1>暂时未上传操作手册</h1>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CONTAINER -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 引用bottom -->
|
||||
<jsp:include page="/bottom.jsp"></jsp:include>
|
||||
</div>
|
||||
<!-- 引用js -->
|
||||
<jsp:include page="/JS.jsp"></jsp:include>
|
||||
<!-- PDF预览 begin -->
|
||||
<script type="text/javascript" src="bootstrap/pdf/build/pdf.js"></script>
|
||||
<script type="text/javascript" src="bootstrap/js/ShowPDF.js"></script>
|
||||
<!-- END -->
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
var abspath = document.getElementById("abspath").value;
|
||||
//PDF预览
|
||||
showPDFWidth(abspath);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
536
WebRoot/jsp/user/showTotalTimeList.jsp
Normal file
536
WebRoot/jsp/user/showTotalTimeList.jsp
Normal file
@ -0,0 +1,536 @@
|
||||
<%@ 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" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject" %>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
|
||||
<head>
|
||||
<!-- <style type="text/css">
|
||||
.input { padding: 5px; margin: 0; border: 1px solid #beceeb; }
|
||||
.clear { display: none;
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin: 6px 0 0 -20px;
|
||||
background: url(../IMG/remove-icon-small.png);}
|
||||
|
||||
.input::-ms-clear { display: none; }
|
||||
.input:valid + .clear { display: inline; }
|
||||
|
||||
</style> -->
|
||||
<title>
|
||||
<%= ServerObject.atttable.get("TOPTITLE")%>
|
||||
</title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<!-- 引入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>
|
||||
<script type="text/javascript">
|
||||
|
||||
var addFun = function () {
|
||||
$.post(ext.contextPath + '/user/addUser.do', {companyId: companyId}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
var editFun = function (id) {
|
||||
$.post(ext.contextPath + '/user/editUser.do', {id: id}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
var viewFun = function (userId) {
|
||||
$.post(ext.contextPath + '/user/showTotalTimeView.do', {userId, curDateStart, curDateEnd}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
var deleteFun = function (id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/work/group/delete.do', {id: id}, function (data) {
|
||||
if (data == 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var deletesFun = function () {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||||
} else {
|
||||
swal({
|
||||
text: "您确定要禁用这些用户吗?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/deleteUsers.do', {ids: datas}, function (data) {
|
||||
if (data > 0) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '禁用失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//重置密码
|
||||
var pwdFun = function (id) {
|
||||
swal({
|
||||
text: "您确定要重置密码吗?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/resetPassword.do', {id: id}, function (data) {
|
||||
if (data == 1) {
|
||||
showAlert('s', '重置成功', 'mainAlertdiv');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '重置失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var syncFun = function () {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||||
} else {
|
||||
swal({
|
||||
text: "您确定要同步所选用户至数据中心?同步前请确认已配置用户所在单位的基本数据权限!",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/syncUsers.do', {ids: datas}, function (data) {
|
||||
if (data > 0) {
|
||||
showAlert('s', '同步成功', 'mainAlertdiv');
|
||||
} else {
|
||||
showAlert('d', '部分用户同步失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var curDateStart = "";
|
||||
var curDateEnd = "";
|
||||
|
||||
function timeControl() {
|
||||
//区间时间插件
|
||||
$("#timeScope").daterangepicker(
|
||||
{
|
||||
// timePicker: true, //显示时间
|
||||
// timePicker24Hour: true, //时间制
|
||||
// timePickerSeconds: true, //时间显示到秒
|
||||
autoUpdateInput: false,
|
||||
opens: 'right',
|
||||
linkedCalendars: false,
|
||||
//startDate:moment().startOf('month'),
|
||||
//endDate:moment().endOf('month'),
|
||||
//startDate : '',
|
||||
//endDate : '',
|
||||
/* ranges : {
|
||||
'今天' : [ moment(), moment() ],
|
||||
'昨天' : [ moment().subtract(1, 'days'),
|
||||
moment().subtract(1, 'days') ],
|
||||
'近7天' : [ moment().subtract(7, 'days'), moment() ],
|
||||
'这个月' : [ moment().startOf('month'),
|
||||
moment().endOf('month') ],
|
||||
'上个月' : [
|
||||
moment().subtract(1, 'month').startOf('month'),
|
||||
moment().subtract(1, 'month').endOf('month') ],
|
||||
}, */
|
||||
locale: {
|
||||
format: "YYYY-MM-DD HH:mm:ss",
|
||||
separator: " - ",
|
||||
applyLabel: "确认",
|
||||
cancelLabel: "清空",
|
||||
fromLabel: "开始时间",
|
||||
toLabel: "结束时间",
|
||||
customRangeLabel: "自定义",
|
||||
daysOfWeek: ["日", "一", "二", "三", "四", "五", "六"],
|
||||
monthNames: ["一月", "二月", "三月", "四月", "五月", "六月",
|
||||
"七月", "八月", "九月", "十月", "十一月", "十二月"]
|
||||
},
|
||||
|
||||
}).on('cancel.daterangepicker', function (ev, picker) {
|
||||
$("#timeScope").val("请选择日期范围");
|
||||
curDateStart = "";
|
||||
curDateEnd = ""
|
||||
//refreshPageData();
|
||||
//$("#startTime").val("");
|
||||
// $("#endTime").val("");
|
||||
}).on(
|
||||
'apply.daterangepicker',
|
||||
function (ev, picker) {
|
||||
// $("#startTime").val(picker.startDate.format('YYYY-MM-DD'));
|
||||
// $("#endTime").val(picker.endDate.format('YYYY-MM-DD'));
|
||||
$("#timeScope").val(
|
||||
picker.startDate.format('YYYY-MM-DD HH:mm:ss')
|
||||
+ "~"
|
||||
+ picker.endDate
|
||||
.format('YYYY-MM-DD HH:mm:ss'));
|
||||
curDateStart = picker.startDate
|
||||
.format('YYYY-MM-DD HH:mm:ss');
|
||||
curDateEnd = picker.endDate.format('YYYY-MM-DD HH:mm:ss');
|
||||
//refreshPageData();
|
||||
});
|
||||
}
|
||||
|
||||
var initFun = function () {
|
||||
$("#tables").bootstrapTable('destroy'); //加载前先销毁
|
||||
$table = $("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUsers.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
sortable: true,
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 20, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_name').val(),
|
||||
curDateStart: curDateStart,
|
||||
curDateEnd: curDateEnd,
|
||||
search_pid: unitId,
|
||||
timeScope: $('#timeScope').val(),
|
||||
active: $('#active').val()
|
||||
}
|
||||
},
|
||||
sortName: 'totaltime', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
onClickRow: function (row) {//单击行事件,执行查看功能
|
||||
viewFun(row.id);
|
||||
},
|
||||
columns: [
|
||||
// {
|
||||
// checkbox: true, // 显示一个勾选框
|
||||
// },
|
||||
{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '登录名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'caption', // 返回json数据中的name
|
||||
title: '姓名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: '_pname', // 返回json数据中的name
|
||||
title: '公司/部门', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'sex', // 返回json数据中的name
|
||||
title: '性别', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
if (value == '0') {
|
||||
return '女';
|
||||
} else {
|
||||
return '男';
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'insdt', // 返回json数据中的name
|
||||
title: '注册时间', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
sortable: true, //所在列是否排序
|
||||
formatter: function (value, row, index) {
|
||||
return value.substring(0, 19);
|
||||
}
|
||||
}, {
|
||||
field: 'totaltime', // 返回json数据中的name
|
||||
title: '在线时长', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
sortable: true, //所在列是否排序
|
||||
formatter: function (value, row, index) {
|
||||
return value.toFixed(2);
|
||||
}
|
||||
}, {
|
||||
field: 'lastlogintime', // 返回json数据中的name
|
||||
title: '上次登录时间', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
sortable: true, //所在列是否排序
|
||||
formatter: function (value, row, index) {
|
||||
return value.substring(0, 19);
|
||||
}
|
||||
}, {
|
||||
field: 'lastloginduration', // 返回json数据中的name
|
||||
title: '上次登录时长', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
// sortable: true, //所在列是否排序
|
||||
formatter: function (value, row, index) {
|
||||
return value.toFixed(2);
|
||||
}
|
||||
}, {
|
||||
field: 'source', // 返回json数据中的name
|
||||
title: '上次登录方式', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
},
|
||||
{
|
||||
field: 'weekloginduration', // 返回json数据中的name
|
||||
title: '最近一周登录时长', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
sortable: true, //所在列是否排序
|
||||
formatter: function (value, row, index) {
|
||||
return value.toFixed(2);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'roles', // 返回json数据中的name
|
||||
title: '角色权限', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
var res = "";
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
// res += "<a class='linkbutton' href='javascript:void(0)' onclick='showMenu(\"" + value[i].id + "\",\"" + value[i].name + "\")'>" + value[i].name + "</a>" + ", ";
|
||||
res += value[i].name + ", ";
|
||||
}
|
||||
return res.replace(/, $/g, "");
|
||||
}
|
||||
}, {
|
||||
field: 'active', // 返回json数据中的name
|
||||
title: '状态', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
switch (value) {
|
||||
case '0':
|
||||
return '禁用';
|
||||
case '1':
|
||||
return '启用';
|
||||
case '2':
|
||||
return '退休';
|
||||
case '3':
|
||||
return '离职';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var $table;
|
||||
var companyId;
|
||||
|
||||
var dosearch = function () {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
$(function () {
|
||||
initFun();
|
||||
timeControl();
|
||||
|
||||
$('#removea').click(function () {
|
||||
$('#search_name').val("");
|
||||
})
|
||||
$("#active").select2({
|
||||
placeholder: '请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
escapeMarkup: function (markup) {
|
||||
return markup;
|
||||
}, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||||
});
|
||||
//巡检模式触发方法
|
||||
$("#active").on("change", function (e) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<div class="content-wrapper">
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid" style="padding-top: 0px;">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="unit4SelectDiv"></div>
|
||||
<div>
|
||||
<!-- <div id="companySelectTree"></div> -->
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-group pull-right form-inline ">
|
||||
<div class="input-group input-group-sm" style="width: 120px;">
|
||||
<select class="form-control select2 " id="active" name="active" style="width: 120px;">
|
||||
<option value="1" selected>启用</option>
|
||||
<option value="0">禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group pull-right form-inline ">
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right"
|
||||
placeholder="姓名">
|
||||
<a class="glyphicon glyphicon-remove form-control-feedback btn-sm" id="removea"
|
||||
style="padding-top:6px;pointer-events: auto"></a>
|
||||
</input>
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-default"
|
||||
onclick="$table.bootstrapTable('refresh');"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group pull-right form-inline ">
|
||||
<div class="input-group input-group-sm" style="width: 260px;">
|
||||
<input type="text" id="timeScope" name="timeScope"
|
||||
class="form-control pull-left" placeholder="请选择时间">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="dosearch();"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
120
WebRoot/jsp/user/showTotalTimeView.jsp
Normal file
120
WebRoot/jsp/user/showTotalTimeView.jsp
Normal file
@ -0,0 +1,120 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<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 initFun = function () {
|
||||
$("#table_detail").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getListDetail.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
paginationDetailHAlign: ' hidden',//去除分页的显示
|
||||
sidePagination: 'client', // 设置为服务器端分页
|
||||
//showFooter: true,//添加页脚
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
userId: $("#userId").val(),
|
||||
curDateStart: curDateStart,
|
||||
curDateEnd: curDateEnd
|
||||
}
|
||||
},
|
||||
sortName: 'sdate', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
/* {
|
||||
checkbox: true, // 显示一个勾选框
|
||||
}, */{
|
||||
field: 'ip', // 返回json数据中的name
|
||||
title: '上网IP', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
},
|
||||
{
|
||||
field: 'sdate',
|
||||
title: '开始时间 ',
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
return value.substring(0, 19);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'edate',
|
||||
title: '结束时间 ',
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
return value.substring(0, 19);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'logintime',
|
||||
title: '持续时间',
|
||||
align: 'center',
|
||||
valign: 'middle'
|
||||
}
|
||||
// ,
|
||||
// {
|
||||
// title: "操作",
|
||||
// align: 'center',
|
||||
// valign: 'middle',
|
||||
// width: 120, // 定义列的宽度,单位为像素px
|
||||
// formatter: function (value, row, index) {
|
||||
// var buts = '';
|
||||
// buts += '<button class="btn btn-default btn-sm" onclick="editFun(\'' + row.id + '\')" data-toggle="tooltip" title="编辑"><i class="fa fa-edit "></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
||||
// buts += '<button class="btn btn-default btn-sm" onclick="deleteFun(\'' + row.id + '\')" data-toggle="tooltip" title="删除"><i class="fa fa-trash-o "></i><span class="hidden-md hidden-lg"> 删除</span></button>';
|
||||
// buts = '<div class = "btn-group">' + buts + '</div>';
|
||||
// return buts;
|
||||
// }
|
||||
// }
|
||||
],
|
||||
//注册加载子表的事件。index:父表当前行的行索引,row:父表当前行的Json数据对象,$detail:当前行下面创建的新行里面的td对象。
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_detail");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
$(function () {
|
||||
initFun();
|
||||
})
|
||||
</script>
|
||||
<div class="modal fade" id="subModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<input type="hidden" id="userId" name="userId" value="${userId}"/>
|
||||
<input type="hidden" id="curDateStart" name="curDateStart" value="${curDateStart}"/>
|
||||
<input type="hidden" id="curDateEnd" name="curDateEnd" value="${curDateEnd}"/>
|
||||
<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">
|
||||
<table id="table_detail"></table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
250
WebRoot/jsp/user/teamForSelectByCompany.jsp
Normal file
250
WebRoot/jsp/user/teamForSelectByCompany.jsp
Normal file
@ -0,0 +1,250 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<script type="text/javascript">
|
||||
var doSearchUser = function () {
|
||||
$("#table_team").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
function doSelect() {
|
||||
var checkedItems = $("#table_team").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
datas_name = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
datas_name += item.name + ",";
|
||||
});
|
||||
$('#${param.formId} #${param.hiddenId}').val(datas);
|
||||
$('#${param.formId} #${param.textId}').val(datas_name);
|
||||
closeModal("user4SelectModal")
|
||||
};
|
||||
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag = false;
|
||||
$.each(eval('${users}'), function (index, item) {
|
||||
if (row.id == item.id) {
|
||||
flag = true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked: true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
|
||||
var $table;
|
||||
var switchStatus = false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds() {
|
||||
var check_array = eval('${users}');
|
||||
if (check_array != null && check_array.length > 0) {
|
||||
selectionIds = new Array(check_array.length);
|
||||
for (var i = 0; i < check_array.length; i++) {
|
||||
selectionIds[i] = check_array[i].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*function getCheckedIds() {
|
||||
var ids = "";
|
||||
var check_array = eval('${users}');
|
||||
$.each(check_array, function (index, item) {
|
||||
if (ids != "") {
|
||||
ids += ",";
|
||||
}
|
||||
ids += item.id;
|
||||
});
|
||||
return ids;
|
||||
}*/
|
||||
|
||||
function queryParams(params) {
|
||||
|
||||
var temp = {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
groupTypeCode: 'E',
|
||||
unitId: unitId
|
||||
};
|
||||
return temp;
|
||||
}
|
||||
|
||||
var companyId = "";
|
||||
$(function () {
|
||||
$("#search_userName").keyup(function () {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车查询
|
||||
doSearchUser();
|
||||
event.stopPropagation();
|
||||
}
|
||||
})
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + '/user/getAllCompanyForTree.do', {ng: ''}, function (data) {
|
||||
if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
||||
$('#companiestree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companiestree').on('nodeSelected', function (event, data) {
|
||||
$("#search_userPid").val(data.id);
|
||||
$("#coname_input").val(data.text);
|
||||
document.getElementById('user_tree').style.display = "none";
|
||||
companyId = data.id;
|
||||
doSearchUser();
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#user_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#user_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
})
|
||||
|
||||
initialSelectionIds();
|
||||
|
||||
$table = $("#table_team").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/work/groupDetail/getlist.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect: true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
clickToSelect: true,
|
||||
responseHandler: responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
formatter: function (i, row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if ($.inArray(row.id, Array.from(selectionIds)) != -1) { // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked: true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'name',
|
||||
title: "部门",
|
||||
align: 'center',
|
||||
valign: 'middle'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_team");
|
||||
|
||||
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
/*$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e, rows, obj) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
if ('check' == e.type) {
|
||||
obj.parent().addClass("checked");
|
||||
} else {
|
||||
obj.parent().removeClass("checked");
|
||||
}
|
||||
//adjustBootstrapTableView("table_team");
|
||||
});*/
|
||||
});
|
||||
//选中事件操作数组
|
||||
/*var union = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
if ($.inArray(id, array) == -1) {
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};*/
|
||||
//取消选中事件操作数组
|
||||
/*var difference = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id, array);
|
||||
if (index != -1) {
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union": union, "difference": difference};*/
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="user4SelectModal">
|
||||
<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 " style="width:100%">
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="jobIds" name="jobIds" class="form-control" placeholder="职位Ids"
|
||||
value="${jobIds }">
|
||||
<ul id="companyForUserSelect" style="list-style-type:none;padding-left:0px;width:260px;">
|
||||
<li class="dropdown" style="width:260px;">
|
||||
|
||||
<%--<ul id="user_tree" class="dropdown-menu" data-stopPropagation="true">
|
||||
<li class="header">
|
||||
<div id="companiestree" style="width: 250px;height:300px; overflow:auto;"></div>
|
||||
</li>
|
||||
</ul>--%>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="input-group input-group-sm pull-right" style="width: 250px;">
|
||||
<%--<input type="text" id="search_userName" autocomplete="off" name="search_userName"
|
||||
class="form-control" style="height:34px" placeholder="姓名">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchUser();" style="height:34px"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>--%>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table_team"></table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" onclick="doSelect()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
51
WebRoot/jsp/user/unit4select.jsp
Normal file
51
WebRoot/jsp/user/unit4select.jsp
Normal file
@ -0,0 +1,51 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<script type="text/javascript">
|
||||
var selectMenu = function() {
|
||||
|
||||
alert('${param.hiddenId}'+'${param.textId}');
|
||||
}
|
||||
$(function() {
|
||||
$.fn.update = function(value){
|
||||
$(this).each(function(){
|
||||
if(value!=this.value){
|
||||
this.value = value;
|
||||
this.onchange();
|
||||
}
|
||||
});
|
||||
};
|
||||
$.post(ext.contextPath + '/user/getUnitsJson.do', {ng:'',type:'${param.type}'} , function(data) {
|
||||
//console.info(data)
|
||||
if(data.length>0){
|
||||
$('#unit_select_tree').treeview({
|
||||
data: data,
|
||||
});
|
||||
$('#unit_select_tree').on('nodeSelected', function(event, data) {
|
||||
$('#${param.formId} #${param.hiddenId}' ).val(data.id).change();
|
||||
$('#${param.formId} #${param.textId}').val(data.text);
|
||||
closeModal("unit4SelectModal")
|
||||
});
|
||||
}
|
||||
},'json');
|
||||
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="unit4SelectModal">
|
||||
<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">
|
||||
<div id="unit_select_tree" style="height:430px;overflow:auto;width:100%"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<!-- <button type="button" class="btn btn-primary" onclick="selectMenu()">保存</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
57
WebRoot/jsp/user/unit4selectlimited.jsp
Normal file
57
WebRoot/jsp/user/unit4selectlimited.jsp
Normal file
@ -0,0 +1,57 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<script type="text/javascript">
|
||||
var selectMenu = function () {
|
||||
|
||||
alert('${param.hiddenId}' + '${param.textId}');
|
||||
}
|
||||
$(function () {
|
||||
$.fn.update = function (value) {
|
||||
$(this).each(function () {
|
||||
if (value != this.value) {
|
||||
this.value = value;
|
||||
this.onchange();
|
||||
}
|
||||
});
|
||||
};
|
||||
//$.post(ext.contextPath + '/user/getUnitForTree_Dept.do', { ng: '', type: '${param.type}' }, function (data) {
|
||||
$.post(ext.contextPath + '/user/getUnitForTree_Dept_All.do', { ng: '', type: '${param.type}' }, function (data) {
|
||||
//console.info(data)
|
||||
if (data.length > 0) {
|
||||
$('#unit_select_tree').treeview({
|
||||
data: data,
|
||||
});
|
||||
$('#unit_select_tree').on('nodeSelected', function (event, data) {
|
||||
$('#${param.formId} #${param.hiddenId}').val(data.id).change();
|
||||
$('#${param.formId} #${param.textId}').val(data.text);
|
||||
closeModal("unit4SelectModal_Limited");
|
||||
//20190820 不清空权限下拉
|
||||
// if ($('#_roles').length > 0) {
|
||||
// $('#_roles').empty();
|
||||
// loadRole();
|
||||
// }
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="unit4SelectModal_Limited">
|
||||
<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">
|
||||
<div id="unit_select_tree" style="height:430px;overflow:auto;width:100%"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<!-- <button type="button" class="btn btn-primary" onclick="selectMenu()">保存</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
109
WebRoot/jsp/user/unit4selectlimitedcheck.jsp
Normal file
109
WebRoot/jsp/user/unit4selectlimitedcheck.jsp
Normal file
@ -0,0 +1,109 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8" %>
|
||||
<script type="text/javascript">
|
||||
var selectMenu = function () {
|
||||
|
||||
alert('${param.hiddenId}' + '${param.textId}');
|
||||
}
|
||||
|
||||
|
||||
$(function () {
|
||||
$.fn.update = function (value) {
|
||||
$(this).each(function () {
|
||||
if (value != this.value) {
|
||||
this.value = value;
|
||||
this.onchange();
|
||||
}
|
||||
});
|
||||
};
|
||||
getTree(0, 0)
|
||||
|
||||
|
||||
});
|
||||
|
||||
function saveCheckedItems() {
|
||||
let selectedNodes = $('#unit_select_tree_check').treeview('getChecked')
|
||||
|
||||
$('#${formId} #${hiddenId}').val(selectedNodes.map(item=>item.id).join(','));
|
||||
$('#${formId} #${textId}').val(selectedNodes.map(item=>item.text).join(','));
|
||||
closeModal('unit4SelectModal_Limited_Check');
|
||||
}
|
||||
|
||||
|
||||
function initNodes(nodes, call) {
|
||||
return nodes.map(item => {
|
||||
call(item)
|
||||
if (item.nodes) initNodes(item.nodes, call)
|
||||
return item
|
||||
})
|
||||
}
|
||||
|
||||
//加载树结构
|
||||
function getTree(id, nodeId) {
|
||||
|
||||
$.post(ext.contextPath + '/user/getAllParentByUnitId.do', {ng: '', type: '${param.type}',unitId:unitId}, function (data) {
|
||||
|
||||
let selectedNodeIds = '${param.deptIds}'.split(',')
|
||||
let temp = initNodes(data, (node) => {
|
||||
if(selectedNodeIds.find(id=>id===node.id)){
|
||||
node.state = {checked: true}
|
||||
}else {
|
||||
node.state = {checked: false}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
$('#unit_select_tree_check').treeview({
|
||||
data: data,
|
||||
showCheckbox: true,
|
||||
showTags: true,
|
||||
showBorder: false,
|
||||
hierarchicalCheck: false,
|
||||
selectable: false,
|
||||
checkable: false,
|
||||
onInitialized: function (event, nodes) {
|
||||
// console.log(event, "onInitialized")
|
||||
// console.log(nodes, "onInitialized")
|
||||
},
|
||||
onNodeSelected: function (event, node) {
|
||||
// console.log(event, "onNodeSelected")
|
||||
// console.log(node, "onNodeSelected")
|
||||
},
|
||||
onNodeUnchecked: function (event, node) {
|
||||
// console.log(event, "onNodeUnchecked")
|
||||
// console.log(node, "onNodeUnchecked")
|
||||
},
|
||||
onNodeChecked: function (event, node) {
|
||||
// console.log(event, "onNodeChecked")
|
||||
// console.log(node, "onNodeChecked")
|
||||
},
|
||||
onRendered: function (event, nodes) {
|
||||
}
|
||||
|
||||
})
|
||||
}, 'json');
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<div class="modal fade" id="unit4SelectModal_Limited_Check">
|
||||
<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">
|
||||
<div id="unit_select_tree_check" style="height:430px;overflow:auto;width:100%"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-default" onclick="saveCheckedItems()">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
100
WebRoot/jsp/user/unitTree.jsp
Normal file
100
WebRoot/jsp/user/unitTree.jsp
Normal file
@ -0,0 +1,100 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<jsp:include page="../inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('#unitTree').tree({
|
||||
url : ext.contextPath + '/user/getUnitsJson.do?random=' + Math.random(),
|
||||
parentField : 'pid',
|
||||
dnd:true,
|
||||
onClick : function(node) {
|
||||
if(node.pid != ''){
|
||||
if(node.attributes.type=='C'){
|
||||
$("#mainFrame").attr("src",ext.contextPath+"/user/showCompanyEdit.do?id="+node.id);
|
||||
}else{
|
||||
$("#mainFrame").attr("src",ext.contextPath+"/user/showDeptEdit.do?id="+node.id);
|
||||
}
|
||||
}
|
||||
},
|
||||
onDrop:function(target,source,point){
|
||||
var next = $('#unitTree').tree('getNode',target);
|
||||
/* var parentNode;
|
||||
if(point=='append'){
|
||||
parentNode = next;
|
||||
}else{
|
||||
parentNode = $('#unitTree').tree('getParent',next.target);
|
||||
}
|
||||
var childrenNodes= $('#unitTree').tree('getChildren',parentNode.target);
|
||||
alert(childrenNodes.length);
|
||||
|
||||
var datas = {};
|
||||
for(var i=0;i<childrenNodes.length;i++) {
|
||||
datas["children["+i+"].id"]=childrenNodes[i].id;
|
||||
datas["children["+i+"].name"]=childrenNodes[i].text;
|
||||
datas["children["+i+"].pid"]=childrenNodes[i].pid;
|
||||
} */
|
||||
$.ajax({
|
||||
url : ext.contextPath + '/user/saveUnitOrder.do',
|
||||
type: 'post',
|
||||
data : {
|
||||
target:next.id,
|
||||
source:source.id,
|
||||
point:point
|
||||
},
|
||||
dataType : 'json',
|
||||
success : function(r){
|
||||
if(r>0){
|
||||
top.$.messager.alert('提示','顺序保存成功','info');
|
||||
}else{
|
||||
top.$.messager.alert('提示','顺序保存失败','info');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
function reloadTree(){
|
||||
$('#unitTree').tree('options').url = ext.contextPath+ '/user/getUnitsJson.do?random=' + Math.random();
|
||||
$('#unitTree').tree('reload');
|
||||
}
|
||||
|
||||
function getSelectedPid(){
|
||||
var t = $('#unitTree').tree('getSelected');
|
||||
var pid="";
|
||||
if(t!=null){
|
||||
pid=t.id;
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
|
||||
function addComp(){
|
||||
$("#mainFrame").attr("src",ext.contextPath+"/user/showCompanyAdd.do?pid="+getSelectedPid());
|
||||
}
|
||||
|
||||
function addDept(){
|
||||
$("#mainFrame").attr("src",ext.contextPath+"/user/showDeptAdd.do?pid="+getSelectedPid());
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="easyui-layout" data-options="fit:true">
|
||||
<div id="leftdiv" data-options="region:'west',split:true" style="width:250px;position:relative">
|
||||
<div style="padding:2px;background-color:#eeeeee">
|
||||
<a class="easyui-linkbutton" href="#" data-options="iconCls:'icon-add',plain:true" onclick="addComp()">公司</a>
|
||||
<a class="easyui-linkbutton" href="#" data-options="iconCls:'icon-add',plain:true" onclick="addDept()">部门</a>
|
||||
</div>
|
||||
<ul id="unitTree" class="easyui-tree" data-options="method:'get',animate:true"></ul>
|
||||
</div>
|
||||
<div id="rightdiv" data-options="region:'center'" style="overflow: hidden;">
|
||||
<iframe id="mainFrame" src="" allowTransparency="true" style="border: 0; width: 100%; height: 100%;" frameBorder="0" scrolling="auto"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
251
WebRoot/jsp/user/userAdd.jsp
Normal file
251
WebRoot/jsp/user/userAdd.jsp
Normal file
@ -0,0 +1,251 @@
|
||||
<!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 loadRole() {
|
||||
$.post(ext.contextPath + "/user/getJsonRole.do", function (data) {
|
||||
var select = $("#_roles").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; } // 函数用于呈现当前的选择
|
||||
});
|
||||
/*var roles = "${user.roles}";
|
||||
var items = new Array();
|
||||
$.each(JSON.parse(roles),function(index,value,array){
|
||||
items.put(value.id);
|
||||
}); */
|
||||
// select.val(items).trigger("change");
|
||||
}, 'json');
|
||||
}
|
||||
function positionApi() {
|
||||
$.post(ext.contextPath + "/user/getPositionTagId.do", { cardid: '${user.cardid}' }, function (data) {
|
||||
if(data.length>0){
|
||||
$(".cardid_input").remove();
|
||||
$(".cardid_select").show();
|
||||
var selelct_ = $("#cardid").select2({
|
||||
data: data,
|
||||
cache: false,
|
||||
placeholder: '请选择',//默认文字提示
|
||||
allowClear: true,//允许清空
|
||||
escapeMarkup: function (markup) {
|
||||
return markup;
|
||||
}, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 10,//数据超过10个,显示搜索框
|
||||
formatResult: function formatRepo(repo) {
|
||||
console.log("repo is ", repo)
|
||||
return repo.text;
|
||||
}, // 函数用来渲染结果
|
||||
formatSelection: function formatRepoSelection(repo) {
|
||||
console.log("repo1 is ", repo)
|
||||
return repo.text;
|
||||
} // 函数用于呈现当前的选择
|
||||
});
|
||||
selelct_.val('${user.cardid}').trigger("change");
|
||||
}else{
|
||||
$(".cardid_select").remove();
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
$(function () {
|
||||
$("#sex").select2({ minimumResultsForSearch: 10 }).val($("#sex").val()).trigger("change");
|
||||
$("#active").select2({ minimumResultsForSearch: 10 }).val($("#active").val()).trigger("change");
|
||||
loadRole();
|
||||
positionApi();
|
||||
});
|
||||
</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="${user.name}" style="border-radius:4px">
|
||||
</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="caption" name="caption" placeholder="姓名" style="border-radius:4px"
|
||||
value="${user.caption}">
|
||||
</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="userCardId" name="userCardId" placeholder="工号" style="border-radius:4px"
|
||||
value="${user.userCardId}">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">性别</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="sex" name="sex" class="form-control select2">
|
||||
<option value="1" selected>男</option>
|
||||
<option value="0">女</option>
|
||||
</select>
|
||||
</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="_pname" name="_pname" placeholder="公司/部门" style="border-radius:4px;background-color:white"
|
||||
onclick="showUnit4SelectFun();" value="${unit.name}" readonly />
|
||||
<input id="pid" name="pid" type="hidden" value="${unit.id}" />
|
||||
</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="mobile" name="mobile" placeholder="手机" style="border-radius:4px" value="${user.mobile}" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%-- <label class="col-sm-2 control-label">QQ号</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="qq" name="qq" placeholder="请输入QQ号码" style="border-radius:4px" value="${user.qq}">
|
||||
</div>--%>
|
||||
<label class="col-sm-2 control-label">定位卡号</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control select2 cardid_select" id="cardid" name="cardid"
|
||||
style="width: 95%; display: none">
|
||||
</select>
|
||||
<input type="text" class="form-control cardid_input" id="cardid" name="cardid" placeholder="人员定位卡号" value="${user.cardid}" 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="_roles" name="_roles" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">用户状态</label>
|
||||
<div class="col-sm-10">
|
||||
<select id="active" name="active" class="form-control select2">
|
||||
<option value="1">启用</option>
|
||||
<option value="0">禁用</option>
|
||||
<option value="2">退休</option>
|
||||
<option value="3">离职</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">顺序</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="number" class="form-control" id="morder" name="morder" value="0" style="border-radius:4px">
|
||||
</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>
|
||||
259
WebRoot/jsp/user/userEdit.jsp
Normal file
259
WebRoot/jsp/user/userEdit.jsp
Normal file
@ -0,0 +1,259 @@
|
||||
<!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 doupdate() {
|
||||
$("#editForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/user/updateUser.do", $("#editForm").serialize(), function (data) {
|
||||
if (data.res == 1) {
|
||||
//保存权限
|
||||
var val = $('#_roles').val();
|
||||
var rolestr = "";
|
||||
$.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 if (data.res == 0) {
|
||||
showAlert('d', '用户信息保存失败');
|
||||
} else {
|
||||
showAlert('d', data.res);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
var showUnit4SelectFun = function () {
|
||||
$.post(ext.contextPath + '/user/showUnit4Select_Limited.do', { formId: "editForm", hiddenId: "pid", textId: "_pname" }, function (data) {
|
||||
$("#unit4SelectDiv").html(data);
|
||||
openModal("unit4SelectModal_Limited");
|
||||
});
|
||||
};
|
||||
|
||||
$("#editForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '登陆名不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
_pname: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '公司/部门不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
_roles: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '权限不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function loadRole() {
|
||||
$.post(ext.contextPath + "/user/getJsonRole.do", { companyId: $("#pid").val() }, function (data) {
|
||||
var select = $("#_roles").select2({
|
||||
data: data,
|
||||
placeholder: '请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 5,//数据超过十个启用搜索框
|
||||
multiple: true,
|
||||
formatResult: function formatRepo(repo) { return repo.text; }, // 函数用来渲染结果
|
||||
formatSelection: function formatRepoSelection(repo) { return repo.text; } // 函数用于呈现当前的选择
|
||||
});
|
||||
}, 'json');
|
||||
}
|
||||
function positionApi() {
|
||||
$.post(ext.contextPath + "/user/getPositionTagId.do", { cardid: '${user.cardid}' }, function (data) {
|
||||
if(data.length>0){
|
||||
$(".cardid_input").remove();
|
||||
$(".cardid_select").show();
|
||||
var selelct_ = $("#cardid").select2({
|
||||
data: data,
|
||||
cache: false,
|
||||
placeholder: '请选择',//默认文字提示
|
||||
allowClear: true,//允许清空
|
||||
escapeMarkup: function (markup) {
|
||||
return markup;
|
||||
}, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 10,//数据超过10个,显示搜索框
|
||||
formatResult: function formatRepo(repo) {
|
||||
console.log("repo is ", repo)
|
||||
return repo.text;
|
||||
}, // 函数用来渲染结果
|
||||
formatSelection: function formatRepoSelection(repo) {
|
||||
console.log("repo1 is ", repo)
|
||||
return repo.text;
|
||||
} // 函数用于呈现当前的选择
|
||||
});
|
||||
selelct_.val('${user.cardid}').trigger("change");
|
||||
}else{
|
||||
$(".cardid_select").remove();
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$("#sex").select2({ minimumResultsForSearch: 10 }).val("${user.sex}").trigger("change");
|
||||
$("#active").select2({ minimumResultsForSearch: 10 }).val("${user.active}").trigger("change");
|
||||
$.post(ext.contextPath + "/user/getJsonRole.do", { companyId: "${user.pid}" }, function (data) {
|
||||
var selelct = $("#_roles").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; } // 函数用于呈现当前的选择
|
||||
});
|
||||
var roleitems = new Array();
|
||||
var roles = JSON.parse('${roles}');
|
||||
for (var i = 0; i < roles.length; i++) {
|
||||
roleitems.push(roles[i].id);
|
||||
}
|
||||
//console.log("roles", roles);
|
||||
selelct.val(roleitems).trigger("change");
|
||||
}, 'json');
|
||||
positionApi();
|
||||
});
|
||||
</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强制为editForm -->
|
||||
<form class="form-horizontal" id="editForm">
|
||||
<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="${user.name}" style="border-radius:4px">
|
||||
</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="caption" name="caption" placeholder="姓名" style="border-radius:4px"
|
||||
value="${user.caption}">
|
||||
</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="userCardId" name="userCardId" placeholder="工号" style="border-radius:4px"
|
||||
value="${user.userCardId}">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">性别</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="sex" name="sex" class="form-control select2">
|
||||
<option value="1">男</option>
|
||||
<option value="0">女</option>
|
||||
</select>
|
||||
</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="_pname" name="_pname" placeholder="公司/部门" style="border-radius:4px;background-color: white"
|
||||
onclick="showUnit4SelectFun();" value="${user._pname}" readonly />
|
||||
<input id="pid" name="pid" type="hidden" value="${user.pid}" />
|
||||
</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="mobile" name="mobile" placeholder="手机" value="${user.mobile}" style="border-radius:4px">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%--<label class="col-sm-2 control-label">QQ号</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="qq" name="qq" placeholder="请输入QQ号码" value="${user.qq}" style="border-radius:4px">
|
||||
</div>--%>
|
||||
<label class="col-sm-2 control-label">定位卡号</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control select2 cardid_select" id="cardid" name="cardid"
|
||||
style="width: 95%; display: none">
|
||||
</select>
|
||||
<input type="text" class="form-control cardid_input" id="cardid" name="cardid" placeholder="人员定位卡号" value="${user.cardid}" 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="_roles" name="_roles" style="width: 100%;">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">用户状态</label>
|
||||
<div class="col-sm-10">
|
||||
<select id="active" name="active" class="form-control select2">
|
||||
<option value="1">启用</option>
|
||||
<option value="0">禁用</option>
|
||||
<option value="2">退休</option>
|
||||
<option value="3">离职</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">顺序</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="number" class="form-control" id="morder" name="morder" value="${user.morder}" style="border-radius:4px">
|
||||
</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="doupdate()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
270
WebRoot/jsp/user/userForOneSelect.jsp
Normal file
270
WebRoot/jsp/user/userForOneSelect.jsp
Normal file
@ -0,0 +1,270 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.sipai.tools.SessionManager"%>
|
||||
<%
|
||||
SessionManager sessionManager = new SessionManager();
|
||||
%>
|
||||
<%@page import="com.sipai.entity.scada.MPoint"%>
|
||||
<%request.setAttribute("Flag_Enable",MPoint.Flag_Enable);%>
|
||||
<%request.setAttribute("Flag_Disable",MPoint.Flag_Disable);%>
|
||||
|
||||
<script type="text/javascript">
|
||||
var doSearchUser = function() {
|
||||
$("#table_user").bootstrapTable('refresh');
|
||||
};
|
||||
function doselect(dialog,grid) {
|
||||
if (checkedItem == "") {
|
||||
showAlert('d', "请选择人员", 'mpoint_mainAlertdiv');
|
||||
} else {
|
||||
$.post(ext.contextPath + '/user/getUsersByIds.do', {userIds : checkedItem.id}, function(resp) {
|
||||
console.log(checkedItem)
|
||||
console.log(resp);
|
||||
$('#${param.formId} #${param.hiddenId}').val(resp[0].id);
|
||||
$('#${param.formId} #${param.textId}').val(resp[0].caption);
|
||||
closeModal("user4SelectModal");
|
||||
},'json');
|
||||
}
|
||||
};
|
||||
|
||||
//显示已经勾选的数据
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag=false;
|
||||
if(row.id=='${userId}'){
|
||||
flag=true;
|
||||
checkedItem = "";
|
||||
}
|
||||
if (flag)
|
||||
return {
|
||||
checked : true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
|
||||
var $table;
|
||||
|
||||
function queryParams(params) {
|
||||
|
||||
var temp={
|
||||
pid: companyId,
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order, // 排序规则
|
||||
search_name: $('#search_name_user').val(),
|
||||
<%--search_pid:'${param.companyId}'--%>
|
||||
search_pid: companyId
|
||||
};
|
||||
/* var status =$('#switchBtn').bootstrapSwitch('state')
|
||||
if(status){
|
||||
temp.checkedIds=getCheckedIds();
|
||||
}
|
||||
*/ return temp;
|
||||
}
|
||||
|
||||
var companyId = "";
|
||||
var checkedItem = "";
|
||||
$(function() {
|
||||
/* $.post(ext.contextPath + "/user/getSearchBizsByUserId4Select.do", {}, function(data) {
|
||||
if(data.length == 1){
|
||||
//选择厂区为一个厂时隐藏选择框
|
||||
$("#search_code").css("display", "none");
|
||||
$("#company").text(data[0].text);
|
||||
companyId=data[0].id;
|
||||
dosearchMp();
|
||||
}else{
|
||||
$("#company").css("display", "none");
|
||||
var selelct=$("#search_code").select2({
|
||||
data : data ,
|
||||
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.val('').trigger("change");
|
||||
//refreshSelect();
|
||||
selelct.on("change",function(e){
|
||||
companyId= $(this).val();
|
||||
dosearchMp();
|
||||
});
|
||||
}
|
||||
},'json'); */
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + '/user/getAllCompanyForTree.do', { ng: '' }, function (data) {
|
||||
if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
||||
$('#companiestree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companiestree').on('nodeSelected', function (event, data) {
|
||||
$("#search_userPid").val(data.id);
|
||||
$("#coname_input").val(data.text);
|
||||
document.getElementById('user_tree').style.display = "none";
|
||||
companyId= data.id;
|
||||
doSearchUser();
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#user_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#user_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
})
|
||||
|
||||
//initialSelectionIds();
|
||||
//alert();
|
||||
$table=$("#table_user").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUserForSelects.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect:true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
//responseHandler:responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
formatter: stateFormatter
|
||||
},{
|
||||
field: 'caption',
|
||||
title: "姓名",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '30%'
|
||||
},{
|
||||
field: '_pname',
|
||||
title: "部门",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '70%'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table_user");
|
||||
|
||||
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e,rows, obj) {
|
||||
if('check'==e.type){
|
||||
$('#table_user .checked').removeClass("checked");
|
||||
obj.parent().addClass("checked");
|
||||
checkedItem = rows;
|
||||
}else{
|
||||
obj.parent().removeClass("checked");
|
||||
checkedItem = "";
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="user4SelectModal" >
|
||||
<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" style="width:100%">
|
||||
|
||||
<div id="mpoint_mainAlertdiv"></div>
|
||||
<div id="menu4SelectDiv"></div>
|
||||
<div id="modal-body">
|
||||
<!-- <div class="form-group">
|
||||
<label class="form-label" id="companylabel">水厂:</label>
|
||||
<label class="form-label" id="company" style="width:180px;border: none;background: transparent;" ></label>
|
||||
<select class="form-control select2 " id="search_code" name ="search_code" style="width: 220px;"></select>
|
||||
</div> -->
|
||||
<%-- <div class="form-group " style="margin-bottom:10px;">--%>
|
||||
<%-- <input id="search_code" name="search_code" type="hidden" />--%>
|
||||
<%-- <span id="company" style="height:31px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold"></span>--%>
|
||||
<%-- </div>--%>
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="jobIds"name="jobIds" class="form-control" placeholder="职位Ids" value="${jobIds }">
|
||||
<ul id="companyForUserSelect" style="list-style-type:none;padding-left:0px;width:260px;">
|
||||
<li class="dropdown" style="width:260px;">
|
||||
<!-- Menu toggle button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
||||
style="width:260px;" onclick="document.getElementById('user_tree').style.display = 'block';">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"
|
||||
style="height:34px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
||||
<input class="form-control " id="coname_input" name="coname_input" placeholder="请选择"
|
||||
style="height:34px;width: 200px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
|
||||
readonly />
|
||||
</div><!-- /input-group -->
|
||||
</a>
|
||||
<ul id="user_tree" class="dropdown-menu" data-stopPropagation="true">
|
||||
<li class="header">
|
||||
<div id="companiestree" style="width: 250px;height:300px; overflow:auto;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-group pull-right form-inline" >
|
||||
<div class="input-group input-group-sm " style="width: 220px;">
|
||||
|
||||
<input type="text" id="search_name_user" name="search_name_user" class="form-control " placeholder="姓名">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchUser();"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <button type="button" class="btn btn-default" onclick="addFun();"><i class="fa fa-plus"></i> 重置</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group " style="padding:0;">
|
||||
<label class="form-label">班组</label>
|
||||
<select class="form-control select2 " id="search_code" name ="search_code" style="width: 220px;"></select>
|
||||
<div class="form-group pull-right" >
|
||||
<div class="input-group input-group-sm" style="width: 500px;">
|
||||
<input type="text" id="search_pid" name="search_pid" class="form-control pull-right" style="width: 200px;" placeholder="所属车间">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right" style="width: 200px;margin-right:10px" placeholder="系统名称">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> -->
|
||||
<div class="table-scrollable">
|
||||
<table class="table table-bordered table-striped" style="overflow:auto;width:100%" id="table_user"></table>
|
||||
</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" onclick="doselect()" id="btn_save">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
302
WebRoot/jsp/user/userForSelect.jsp
Normal file
302
WebRoot/jsp/user/userForSelect.jsp
Normal file
@ -0,0 +1,302 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css"/>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js" charset="utf-8"></script>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/*.fixed-table-body {
|
||||
height: 50%;
|
||||
}*/
|
||||
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
var doSearchUser = function() {
|
||||
$("#table_user").bootstrapTable('refresh');
|
||||
};
|
||||
function doSelect(dialog,grid) {
|
||||
//var checkedItems = $("#table_user").bootstrapTable('getAllSelections');
|
||||
var datas="";
|
||||
datas_name="";
|
||||
$.each(selectionIds, function(index, item){
|
||||
if(datas!=""){
|
||||
datas+=",";
|
||||
}
|
||||
datas+=item;
|
||||
});
|
||||
$.post(ext.contextPath + '/user/getUsersByIds.do', {userIds : datas}, function(resp) {
|
||||
$.each(resp, function(index, item){
|
||||
if(datas_name!=""){
|
||||
datas_name+=",";
|
||||
}
|
||||
datas_name+=item.caption;
|
||||
});
|
||||
$('#${param.formId} #${param.hiddenId}').val(datas);
|
||||
$('#${param.formId} #${param.textId}').val(datas_name);
|
||||
// closeModal("user4SelectModal")
|
||||
|
||||
document.getElementById("user4SelectModal").setAttribute("class", "modal hidden fade");
|
||||
$(".modal-backdrop").remove();
|
||||
},'json');
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag=false;
|
||||
$.each(eval('${users}'), function(index, item){
|
||||
if(row.id==item.id){
|
||||
flag=true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked : true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
var $table;
|
||||
var switchStatus=false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds(){
|
||||
var check_array =eval('${users}');
|
||||
if(check_array!=null&& check_array.length>0){
|
||||
selectionIds =new Array(check_array.length);
|
||||
for(var i=0;i<check_array.length;i++){
|
||||
selectionIds[i]=check_array[i].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getCheckedIds(){
|
||||
var ids="";
|
||||
var check_array =eval('${users}');
|
||||
$.each(check_array, function(index, item){
|
||||
if(ids!=""){
|
||||
ids+=",";
|
||||
}
|
||||
ids+=item.id;
|
||||
});
|
||||
return ids;
|
||||
}
|
||||
function queryParams(params) {
|
||||
|
||||
var temp={
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_name_user').val(),
|
||||
search_pid:'${param.companyId}'
|
||||
};
|
||||
var status =$('#switchBtn').bootstrapSwitch('state')
|
||||
if(status){
|
||||
temp.checkedIds=getCheckedIds();
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
$(function() {
|
||||
$("#searchForm_User").attr("onsubmit", "return false;");
|
||||
$("#search_name_user").keyup(function () {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车执行查询
|
||||
doSearchUser();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
//jquery html()方法加载,导致box无法执行boxwidget(),手动初始化
|
||||
$('#searchBox').boxWidget();
|
||||
/* $("#search_pid").select2({
|
||||
ajax: {
|
||||
type:'POST',
|
||||
url: ext.contextPath +"/work/group/getListForSelect.do",
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
processResults: function (data) {
|
||||
return {
|
||||
results: data
|
||||
}
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
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;} // 函数用于呈现当前的选择
|
||||
}); */
|
||||
//$("#active").select2({minimumResultsForSearch: 10}).val("${menu.active}").trigger("change");
|
||||
$('#switchBtn').bootstrapSwitch({
|
||||
onText:'是',
|
||||
offText:'否',
|
||||
size:"small",
|
||||
});
|
||||
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'});
|
||||
|
||||
initialSelectionIds();
|
||||
|
||||
$table=$("#table_user").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUsers.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect:true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 20, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
responseHandler:responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
//formatter: stateFormatter
|
||||
formatter: function (i,row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if($.inArray(row.id,Array.from(selectionIds))!=-1){ // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked : true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
},{
|
||||
field: 'caption',
|
||||
title: "姓名",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '30%'
|
||||
},{
|
||||
field: '_pname',
|
||||
title: "部门",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '70%'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table_user");
|
||||
|
||||
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e,rows, obj) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
if('check'==e.type){
|
||||
obj.parent().addClass("checked");
|
||||
}else{
|
||||
obj.parent().removeClass("checked");
|
||||
}
|
||||
//adjustBootstrapTableView("table_user");
|
||||
});
|
||||
});
|
||||
//选中事件操作数组
|
||||
var union = function(array,ids){
|
||||
$.each(ids, function (i, id) {
|
||||
if($.inArray(id,array)==-1){
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//取消选中事件操作数组
|
||||
var difference = function(array,ids){
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id,array);
|
||||
if(index!=-1){
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union":union,"difference":difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="user4SelectModal">
|
||||
<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 " style="width:100%;">
|
||||
<div id="alertDiv"></div>
|
||||
|
||||
<div class="box box-primary box-solid collapsed-box" id="searchBox" collapsed>
|
||||
<div class="box-header">
|
||||
<!-- tools box -->
|
||||
<div class="pull-right box-tools">
|
||||
<button type="button" class="btn btn-primary btn-sm pull-right" data-widget="collapse"
|
||||
style="margin-right: 5px;">
|
||||
<i class="fa fa-plus"></i></button>
|
||||
</div>
|
||||
<!-- /. tools -->
|
||||
<i class="fa fa-search"></i>
|
||||
</div>
|
||||
<div class="box-body collapse" >
|
||||
<form class="form-horizontal" id="searchForm_User">
|
||||
<div class="form-group" style="margin-right: 20px;">
|
||||
<!-- <label class="col-sm-2 control-label">部门</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control select2 " id="search_pid" name ="search_pid" style="width:170px;"></select>
|
||||
</div> -->
|
||||
<label class="col-sm-2 control-label">姓名</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" id="search_name_user" name="search_name_user" class="form-control input-sm" placeholder="姓名" style="width:170px;">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">只看选中</label>
|
||||
<div class="col-sm-4">
|
||||
<div class="switch" data-on="primary" data-off="info">
|
||||
<input id ="switchBtn" type="checkbox" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-right: 20px;">
|
||||
|
||||
<div class=" col-sm-offset-6 button-group" style="padding: 0;">
|
||||
<button type ="button" class="btn btn-default btn-sm pull-right" onclick="doSearchUser();"><i class="fa fa-search"> 搜索</i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div id="table_user" style="height:90%;overflow:auto;width:100%"></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" onclick="doSelect()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
282
WebRoot/jsp/user/userForSelect4FirstActiviti.jsp
Normal file
282
WebRoot/jsp/user/userForSelect4FirstActiviti.jsp
Normal file
@ -0,0 +1,282 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<script type="text/javascript">
|
||||
var doSearchUser = function () {
|
||||
$("#table_user").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
function doSelect(dialog, grid) {
|
||||
//var checkedItems = $("#table_user").bootstrapTable('getAllSelections');
|
||||
var datas = "";
|
||||
datas_name = "";
|
||||
$.each(selectionIds, function (index, item) {
|
||||
if (datas != "") {
|
||||
datas += ",";
|
||||
}
|
||||
datas += item;
|
||||
});
|
||||
$.post(ext.contextPath + '/user/getUsersByIds.do', {userIds: datas}, function (resp) {
|
||||
$.each(resp, function (index, item) {
|
||||
if (datas_name != "") {
|
||||
datas_name += ",";
|
||||
}
|
||||
datas_name += item.caption;
|
||||
});
|
||||
$('#${param.formId} #${param.hiddenId}').val(datas);
|
||||
$('#${param.formId} #${param.textId}').val(datas_name);
|
||||
closeModal("user4SelectModal")
|
||||
}, 'json');
|
||||
};
|
||||
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag = false;
|
||||
$.each(eval('${users}'), function (index, item) {
|
||||
if (row.id == item.id) {
|
||||
flag = true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked: true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
|
||||
var $table;
|
||||
var switchStatus = false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds() {
|
||||
var check_array = eval('${users}');
|
||||
if (check_array != null && check_array.length > 0) {
|
||||
selectionIds = new Array(check_array.length);
|
||||
for (var i = 0; i < check_array.length; i++) {
|
||||
selectionIds[i] = check_array[i].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getCheckedIds() {
|
||||
var ids = "";
|
||||
var check_array = eval('${users}');
|
||||
$.each(check_array, function (index, item) {
|
||||
if (ids != "") {
|
||||
ids += ",";
|
||||
}
|
||||
ids += item.id;
|
||||
});
|
||||
return ids;
|
||||
}
|
||||
|
||||
function queryParams(params) {
|
||||
var temp = {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_userName').val(),
|
||||
pid: companyId,
|
||||
unitId: unitId,
|
||||
jobIds: $('#jobIds').val(),
|
||||
type: '${param.type}'
|
||||
};
|
||||
return temp;
|
||||
}
|
||||
|
||||
var companyId = '';
|
||||
$(function () {
|
||||
$("#search_userName").keyup(function () {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车查询
|
||||
doSearchUser();
|
||||
event.stopPropagation();
|
||||
}
|
||||
})
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + '/user/getAllCompanyForTree.do', {ng: ''}, function (data) {
|
||||
if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
||||
$('#companiestree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companiestree').on('nodeSelected', function (event, data) {
|
||||
$("#search_userPid").val(data.id);
|
||||
$("#coname_input").val(data.text);
|
||||
document.getElementById('user_tree').style.display = "none";
|
||||
companyId = data.id;
|
||||
doSearchUser();
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#user_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#user_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
})
|
||||
|
||||
initialSelectionIds();
|
||||
|
||||
$table = $("#table_user").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUsers4FirstActiviti.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect: true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
clickToSelect: true,
|
||||
responseHandler: responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
//formatter: stateFormatter
|
||||
formatter: function (i, row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if ($.inArray(row.id, Array.from(selectionIds)) != -1) { // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked: true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'caption',
|
||||
title: "姓名",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '30%'
|
||||
}, {
|
||||
field: '_pname',
|
||||
title: "部门",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '70%'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_user");
|
||||
|
||||
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e, rows, obj) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
if ('check' == e.type) {
|
||||
obj.parent().addClass("checked");
|
||||
} else {
|
||||
obj.parent().removeClass("checked");
|
||||
}
|
||||
//adjustBootstrapTableView("table_user");
|
||||
});
|
||||
});
|
||||
//选中事件操作数组
|
||||
var union = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
if ($.inArray(id, array) == -1) {
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//取消选中事件操作数组
|
||||
var difference = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id, array);
|
||||
if (index != -1) {
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union": union, "difference": difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="user4SelectModal">
|
||||
<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 " style="width:100%">
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="jobIds" name="jobIds" class="form-control" placeholder="职位Ids"
|
||||
value="${jobIds }">
|
||||
<ul id="companyForUserSelect" style="list-style-type:none;padding-left:0px;width:260px;">
|
||||
<li class="dropdown" style="width:260px;">
|
||||
<!-- Menu toggle button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
||||
style="width:260px;"
|
||||
onclick="document.getElementById('user_tree').style.display = 'block';">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"
|
||||
style="height:34px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
||||
<input class="form-control " id="coname_input" name="coname_input"
|
||||
placeholder="请选择"
|
||||
style="height:34px;width: 200px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
|
||||
readonly/>
|
||||
</div><!-- /input-group -->
|
||||
</a>
|
||||
<ul id="user_tree" class="dropdown-menu" data-stopPropagation="true">
|
||||
<li class="header">
|
||||
<div id="companiestree" style="width: 250px;height:300px; overflow:auto;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="input-group input-group-sm pull-right" style="width: 250px;">
|
||||
<input type="text" id="search_userName" autocomplete="off" name="search_userName"
|
||||
class="form-control" style="height:34px" placeholder="姓名">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchUser();" style="height:34px"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table_user"></table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" onclick="doSelect()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
282
WebRoot/jsp/user/userForSelectByAbnormity.jsp
Normal file
282
WebRoot/jsp/user/userForSelectByAbnormity.jsp
Normal file
@ -0,0 +1,282 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<script type="text/javascript">
|
||||
var doSearchUser = function () {
|
||||
$("#table_user").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
function doSelect(dialog, grid) {
|
||||
//var checkedItems = $("#table_user").bootstrapTable('getAllSelections');
|
||||
var datas = "";
|
||||
datas_name = "";
|
||||
$.each(selectionIds, function (index, item) {
|
||||
if (datas != "") {
|
||||
datas += ",";
|
||||
}
|
||||
datas += item;
|
||||
});
|
||||
$.post(ext.contextPath + '/user/getUsersByIds.do', {userIds: datas}, function (resp) {
|
||||
$.each(resp, function (index, item) {
|
||||
if (datas_name != "") {
|
||||
datas_name += ",";
|
||||
}
|
||||
datas_name += item.caption;
|
||||
});
|
||||
$('#${param.formId} #${param.hiddenId}').val(datas);
|
||||
$('#${param.formId} #${param.textId}').val(datas_name);
|
||||
closeModal("user4SelectModal")
|
||||
}, 'json');
|
||||
};
|
||||
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag = false;
|
||||
$.each(eval('${users}'), function (index, item) {
|
||||
if (row.id == item.id) {
|
||||
flag = true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked: true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
|
||||
var $table;
|
||||
var switchStatus = false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds() {
|
||||
var check_array = eval('${users}');
|
||||
if (check_array != null && check_array.length > 0) {
|
||||
selectionIds = new Array(check_array.length);
|
||||
for (var i = 0; i < check_array.length; i++) {
|
||||
selectionIds[i] = check_array[i].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getCheckedIds() {
|
||||
var ids = "";
|
||||
var check_array = eval('${users}');
|
||||
$.each(check_array, function (index, item) {
|
||||
if (ids != "") {
|
||||
ids += ",";
|
||||
}
|
||||
ids += item.id;
|
||||
});
|
||||
return ids;
|
||||
}
|
||||
|
||||
function queryParams(params) {
|
||||
var temp = {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_userName').val(),
|
||||
pid: companyId,
|
||||
unitId: unitId,
|
||||
jobIds: $('#jobIds').val(),
|
||||
type: $('#type').val()
|
||||
};
|
||||
return temp;
|
||||
}
|
||||
|
||||
var companyId = '';
|
||||
$(function () {
|
||||
$("#search_userName").keyup(function () {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车查询
|
||||
doSearchUser();
|
||||
event.stopPropagation();
|
||||
}
|
||||
})
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + '/user/getAllCompanyForTree.do', {ng: ''}, function (data) {
|
||||
if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
||||
$('#companiestree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companiestree').on('nodeSelected', function (event, data) {
|
||||
$("#search_userPid").val(data.id);
|
||||
$("#coname_input").val(data.text);
|
||||
document.getElementById('user_tree').style.display = "none";
|
||||
companyId = data.id;
|
||||
doSearchUser();
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#user_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#user_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
})
|
||||
|
||||
initialSelectionIds();
|
||||
|
||||
$table = $("#table_user").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUsers4Abnormity.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect: true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
clickToSelect: true,
|
||||
responseHandler: responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
//formatter: stateFormatter
|
||||
formatter: function (i, row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if ($.inArray(row.id, Array.from(selectionIds)) != -1) { // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked: true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'caption',
|
||||
title: "姓名",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '30%'
|
||||
}, {
|
||||
field: '_pname',
|
||||
title: "部门",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '70%'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_user");
|
||||
|
||||
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e, rows, obj) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
if ('check' == e.type) {
|
||||
obj.parent().addClass("checked");
|
||||
} else {
|
||||
obj.parent().removeClass("checked");
|
||||
}
|
||||
//adjustBootstrapTableView("table_user");
|
||||
});
|
||||
});
|
||||
//选中事件操作数组
|
||||
var union = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
if ($.inArray(id, array) == -1) {
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//取消选中事件操作数组
|
||||
var difference = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id, array);
|
||||
if (index != -1) {
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union": union, "difference": difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="user4SelectModal">
|
||||
<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 " style="width:100%">
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="jobIds" name="jobIds" class="form-control" placeholder="职位Ids"
|
||||
value="${jobIds }">
|
||||
<ul id="companyForUserSelect" style="list-style-type:none;padding-left:0px;width:260px;">
|
||||
<li class="dropdown" style="width:260px;">
|
||||
<!-- Menu toggle button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
||||
style="width:260px;"
|
||||
onclick="document.getElementById('user_tree').style.display = 'block';">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"
|
||||
style="height:34px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
||||
<input class="form-control " id="coname_input" name="coname_input"
|
||||
placeholder="请选择"
|
||||
style="height:34px;width: 200px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
|
||||
readonly/>
|
||||
</div><!-- /input-group -->
|
||||
</a>
|
||||
<ul id="user_tree" class="dropdown-menu" data-stopPropagation="true">
|
||||
<li class="header">
|
||||
<div id="companiestree" style="width: 250px;height:300px; overflow:auto;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="input-group input-group-sm pull-right" style="width: 250px;">
|
||||
<input type="text" id="search_userName" autocomplete="off" name="search_userName"
|
||||
class="form-control" style="height:34px" placeholder="姓名">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchUser();" style="height:34px"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table_user"></table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" onclick="doSelect()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
272
WebRoot/jsp/user/userForSelectByCompany.jsp
Normal file
272
WebRoot/jsp/user/userForSelectByCompany.jsp
Normal file
@ -0,0 +1,272 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<script type="text/javascript">
|
||||
var doSearchUser = function() {
|
||||
$("#table_user").bootstrapTable('refresh');
|
||||
};
|
||||
function doSelect(dialog,grid) {
|
||||
//var checkedItems = $("#table_user").bootstrapTable('getAllSelections');
|
||||
var datas="";
|
||||
datas_name="";
|
||||
$.each(selectionIds, function(index, item){
|
||||
if(datas!=""){
|
||||
datas+=",";
|
||||
}
|
||||
datas+=item;
|
||||
});
|
||||
$.post(ext.contextPath + '/user/getUsersByIds.do', {userIds : datas}, function(resp) {
|
||||
$.each(resp, function(index, item){
|
||||
if(datas_name!=""){
|
||||
datas_name+=",";
|
||||
}
|
||||
datas_name+=item.caption;
|
||||
});
|
||||
$('#${param.formId} #${param.hiddenId}' ).val(datas);
|
||||
$('#${param.formId} #${param.textId}').val(datas_name);
|
||||
closeModal("user4SelectModal")
|
||||
},'json');
|
||||
|
||||
|
||||
};
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag=false;
|
||||
$.each(eval('${users}'), function(index, item){
|
||||
if(row.id==item.id){
|
||||
flag=true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked : true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
var $table;
|
||||
var switchStatus=false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds(){
|
||||
var check_array =eval('${users}');
|
||||
if(check_array!=null&& check_array.length>0){
|
||||
selectionIds =new Array(check_array.length);
|
||||
for(var i=0;i<check_array.length;i++){
|
||||
selectionIds[i]=check_array[i].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
function getCheckedIds(){
|
||||
var ids="";
|
||||
var check_array =eval('${users}');
|
||||
$.each(check_array, function(index, item){
|
||||
if(ids!=""){
|
||||
ids+=",";
|
||||
}
|
||||
ids+=item.id;
|
||||
});
|
||||
return ids;
|
||||
}
|
||||
function queryParams(params) {
|
||||
var temp={
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_userName').val(),
|
||||
pid:companyId,
|
||||
jobIds:$('#jobIds').val(),
|
||||
unitId: unitId
|
||||
};
|
||||
return temp;
|
||||
}
|
||||
var companyId = "";
|
||||
$(function() {
|
||||
$("#search_userName").keyup(function(){
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车查询
|
||||
doSearchUser();
|
||||
event.stopPropagation();
|
||||
}
|
||||
})
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + '/user/getAllCompanyForTree.do', { ng: '' }, function (data) {
|
||||
if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
||||
$('#companiestree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companiestree').on('nodeSelected', function (event, data) {
|
||||
$("#search_userPid").val(data.id);
|
||||
$("#coname_input").val(data.text);
|
||||
document.getElementById('user_tree').style.display = "none";
|
||||
companyId= data.id;
|
||||
doSearchUser();
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#user_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#user_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
})
|
||||
|
||||
initialSelectionIds();
|
||||
|
||||
$table=$("#table_user").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUserForSelects.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect:true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
clickToSelect:true,
|
||||
responseHandler:responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
//formatter: stateFormatter
|
||||
formatter: function (i,row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if($.inArray(row.id,Array.from(selectionIds))!=-1){ // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked : true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
},{
|
||||
field: 'caption',
|
||||
title: "姓名",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '30%'
|
||||
},{
|
||||
field: '_pname',
|
||||
title: "部门",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '70%'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
adjustBootstrapTableView("table_user");
|
||||
|
||||
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e,rows, obj) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
if('check'==e.type){
|
||||
obj.parent().addClass("checked");
|
||||
}else{
|
||||
obj.parent().removeClass("checked");
|
||||
}
|
||||
//adjustBootstrapTableView("table_user");
|
||||
});
|
||||
});
|
||||
//选中事件操作数组
|
||||
var union = function(array,ids){
|
||||
$.each(ids, function (i, id) {
|
||||
if($.inArray(id,array)==-1){
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//取消选中事件操作数组
|
||||
var difference = function(array,ids){
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id,array);
|
||||
if(index!=-1){
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union":union,"difference":difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="user4SelectModal">
|
||||
<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 " style="width:100%">
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="jobIds"name="jobIds" class="form-control" placeholder="职位Ids" value="${jobIds }">
|
||||
<ul id="companyForUserSelect" style="list-style-type:none;padding-left:0px;width:260px;">
|
||||
<li class="dropdown" style="width:260px;">
|
||||
<!-- Menu toggle button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
||||
style="width:260px;" onclick="document.getElementById('user_tree').style.display = 'block';">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"
|
||||
style="height:34px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
||||
<input class="form-control " id="coname_input" name="coname_input" placeholder="请选择"
|
||||
style="height:34px;width: 200px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
|
||||
readonly />
|
||||
</div><!-- /input-group -->
|
||||
</a>
|
||||
<ul id="user_tree" class="dropdown-menu" data-stopPropagation="true">
|
||||
<li class="header">
|
||||
<div id="companiestree" style="width: 250px;height:300px; overflow:auto;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="input-group input-group-sm pull-right" style="width: 250px;">
|
||||
<input type="text" id="search_userName" autocomplete="off" name="search_userName" class="form-control" style="height:34px" placeholder="姓名">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchUser();" style="height:34px"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table_user"></table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" onclick="doSelect()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
281
WebRoot/jsp/user/userForSelectByStructure.jsp
Normal file
281
WebRoot/jsp/user/userForSelectByStructure.jsp
Normal file
@ -0,0 +1,281 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<script type="text/javascript">
|
||||
var doSearchUser = function () {
|
||||
$("#table_user").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
function doSelect(dialog,grid) {
|
||||
//var checkedItems = $("#table_user").bootstrapTable('getAllSelections');
|
||||
var datas="";
|
||||
datas_name="";
|
||||
$.each(selectionIds, function(index, item){
|
||||
if(datas!=""){
|
||||
datas+=",";
|
||||
}
|
||||
datas+=item;
|
||||
});
|
||||
$.post(ext.contextPath + '/user/getUsersByIds.do', {userIds : datas}, function(resp) {
|
||||
$.each(resp, function(index, item){
|
||||
if(datas_name!=""){
|
||||
datas_name+=",";
|
||||
}
|
||||
datas_name+=item.caption;
|
||||
});
|
||||
$('#${param.formId} #${param.hiddenId}' ).val(datas);
|
||||
$('#${param.formId} #${param.textId}').val(datas_name);
|
||||
closeModal("user4SelectModal")
|
||||
},'json');
|
||||
};
|
||||
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag = false;
|
||||
$.each(eval('${users}'), function (index, item) {
|
||||
if (row.id == item.id) {
|
||||
flag = true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked: true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
|
||||
var $table;
|
||||
var switchStatus = false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds() {
|
||||
var check_array = eval('${users}');
|
||||
if (check_array != null && check_array.length > 0) {
|
||||
selectionIds = new Array(check_array.length);
|
||||
for (var i = 0; i < check_array.length; i++) {
|
||||
selectionIds[i] = check_array[i].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getCheckedIds() {
|
||||
var ids = "";
|
||||
var check_array = eval('${users}');
|
||||
$.each(check_array, function (index, item) {
|
||||
if (ids != "") {
|
||||
ids += ",";
|
||||
}
|
||||
ids += item.id;
|
||||
});
|
||||
return ids;
|
||||
}
|
||||
|
||||
function queryParams(params) {
|
||||
|
||||
var temp = {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_userName').val(),
|
||||
pid: companyId,
|
||||
jobIds: $('#jobIds').val()
|
||||
};
|
||||
return temp;
|
||||
}
|
||||
|
||||
var companyId = "";
|
||||
$(function () {
|
||||
$("#search_userName").keyup(function () {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车查询
|
||||
doSearchUser();
|
||||
event.stopPropagation();
|
||||
}
|
||||
})
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + '/user/getAllCompanyForTree.do', {ng: ''}, function (data) {
|
||||
if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
||||
$('#companiestree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companiestree').on('nodeSelected', function (event, data) {
|
||||
$("#search_userPid").val(data.id);
|
||||
$("#coname_input").val(data.text);
|
||||
document.getElementById('user_tree').style.display = "none";
|
||||
companyId = data.id;
|
||||
doSearchUser();
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#user_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#user_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
})
|
||||
|
||||
initialSelectionIds();
|
||||
|
||||
$table = $("#table_user").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUserForSelects.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect: true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 10, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
clickToSelect: true,
|
||||
responseHandler: responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
//formatter: stateFormatter
|
||||
formatter: function (i, row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if ($.inArray(row.id, Array.from(selectionIds)) != -1) { // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked: true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'caption',
|
||||
title: "姓名",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '30%'
|
||||
}, {
|
||||
field: '_pname',
|
||||
title: "部门",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '70%'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_user");
|
||||
|
||||
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e, rows, obj) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
if ('check' == e.type) {
|
||||
obj.parent().addClass("checked");
|
||||
} else {
|
||||
obj.parent().removeClass("checked");
|
||||
}
|
||||
//adjustBootstrapTableView("table_user");
|
||||
});
|
||||
});
|
||||
//选中事件操作数组
|
||||
var union = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
if ($.inArray(id, array) == -1) {
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//取消选中事件操作数组
|
||||
var difference = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id, array);
|
||||
if (index != -1) {
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union": union, "difference": difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="user4SelectModal">
|
||||
<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 " style="width:100%">
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="jobIds" name="jobIds" class="form-control" placeholder="职位Ids"
|
||||
value="${jobIds }">
|
||||
<ul id="companyForUserSelect" style="list-style-type:none;padding-left:0px;width:260px;">
|
||||
<li class="dropdown" style="width:260px;">
|
||||
<!-- Menu toggle button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
||||
style="width:260px;"
|
||||
onclick="document.getElementById('user_tree').style.display = 'block';">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"
|
||||
style="height:34px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
||||
<input class="form-control " id="coname_input" name="coname_input"
|
||||
placeholder="请选择"
|
||||
style="height:34px;width: 200px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
|
||||
readonly/>
|
||||
</div><!-- /input-group -->
|
||||
</a>
|
||||
<ul id="user_tree" class="dropdown-menu" data-stopPropagation="true">
|
||||
<li class="header">
|
||||
<div id="companiestree" style="width: 250px;height:300px; overflow:auto;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="input-group input-group-sm pull-right" style="width: 250px;">
|
||||
<input type="text" id="search_userName" autocomplete="off" name="search_userName"
|
||||
class="form-control" style="height:34px" placeholder="姓名">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchUser();" style="height:34px"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table_user"></table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" onclick="doSelect()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
289
WebRoot/jsp/user/userForSelectByWorkOrder.jsp
Normal file
289
WebRoot/jsp/user/userForSelectByWorkOrder.jsp
Normal file
@ -0,0 +1,289 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<script type="text/javascript">
|
||||
var doSearchUser = function () {
|
||||
$("#table_user").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
function doSelect(dialog, grid) {
|
||||
var datas = "";
|
||||
$.each(selectionIds, function (index, item) {
|
||||
if (datas != "") {
|
||||
datas += ",";
|
||||
}
|
||||
datas += item;
|
||||
});
|
||||
if (datas != null && datas != '') {
|
||||
$("#xiafa").hide();
|
||||
$("#xiafazhong").show();
|
||||
$.post(ext.contextPath + '/maintenance/equipmentPlanEqu/doIssue.do', {
|
||||
userIds: datas,
|
||||
ids: '${param.ids}'
|
||||
}, function (resp) {
|
||||
/*$.each(resp, function (index, item) {
|
||||
console.log(item.caption);
|
||||
});*/
|
||||
|
||||
closeModal("user4SelectModal");
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}, 'json');
|
||||
} else {
|
||||
alert('请选择人员');
|
||||
}
|
||||
};
|
||||
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag = false;
|
||||
$.each(eval('${users}'), function (index, item) {
|
||||
if (row.id == item.id) {
|
||||
flag = true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked: true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
|
||||
var $table;
|
||||
var switchStatus = false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds() {
|
||||
var check_array = eval('${users}');
|
||||
if (check_array != null && check_array.length > 0) {
|
||||
selectionIds = new Array(check_array.length);
|
||||
for (var i = 0; i < check_array.length; i++) {
|
||||
selectionIds[i] = check_array[i].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getCheckedIds() {
|
||||
var ids = "";
|
||||
var check_array = eval('${users}');
|
||||
$.each(check_array, function (index, item) {
|
||||
if (ids != "") {
|
||||
ids += ",";
|
||||
}
|
||||
ids += item.id;
|
||||
});
|
||||
return ids;
|
||||
}
|
||||
|
||||
function queryParams(params) {
|
||||
|
||||
var temp = {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_userName').val(),
|
||||
pid: companyId,
|
||||
jobIds: $('#jobIds').val()
|
||||
};
|
||||
return temp;
|
||||
}
|
||||
|
||||
var companyId = "";
|
||||
$(function () {
|
||||
$("#xiafazhong").hide();
|
||||
$("#search_userName").keyup(function () {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车查询
|
||||
doSearchUser();
|
||||
event.stopPropagation();
|
||||
}
|
||||
})
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + '/user/getAllCompanyForTree.do', {ng: ''}, function (data) {
|
||||
if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
||||
$('#companiestree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companiestree').on('nodeSelected', function (event, data) {
|
||||
$("#search_userPid").val(data.id);
|
||||
$("#coname_input").val(data.text);
|
||||
document.getElementById('user_tree').style.display = "none";
|
||||
companyId = data.id;
|
||||
doSearchUser();
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#user_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#user_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
})
|
||||
|
||||
initialSelectionIds();
|
||||
|
||||
$table = $("#table_user").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUserForSelects.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect: true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20], // 设置页面可以显示的数据条数
|
||||
pageSize: 20, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
clickToSelect: true,
|
||||
responseHandler: responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
//formatter: stateFormatter
|
||||
formatter: function (i, row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if ($.inArray(row.id, Array.from(selectionIds)) != -1) { // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked: true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'caption',
|
||||
title: "姓名",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '30%'
|
||||
}, {
|
||||
field: '_pname',
|
||||
title: "部门",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '70%'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table_user");
|
||||
|
||||
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e, rows, obj) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
if ('check' == e.type) {
|
||||
obj.parent().addClass("checked");
|
||||
} else {
|
||||
obj.parent().removeClass("checked");
|
||||
}
|
||||
//adjustBootstrapTableView("table_user");
|
||||
});
|
||||
});
|
||||
//选中事件操作数组
|
||||
var union = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
if ($.inArray(id, array) == -1) {
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//取消选中事件操作数组
|
||||
var difference = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id, array);
|
||||
if (index != -1) {
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union": union, "difference": difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="user4SelectModal">
|
||||
<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 " style="width:100%">
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="jobIds" name="jobIds" class="form-control" placeholder="职位Ids"
|
||||
value="${jobIds }">
|
||||
<ul id="companyForUserSelect" style="list-style-type:none;padding-left:0px;width:260px;">
|
||||
<li class="dropdown" style="width:260px;">
|
||||
<!-- Menu toggle button -->
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
||||
style="width:260px;"
|
||||
onclick="document.getElementById('user_tree').style.display = 'block';">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"
|
||||
style="height:34px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
||||
<input class="form-control " id="coname_input" name="coname_input"
|
||||
placeholder="请选择"
|
||||
style="height:34px;width: 200px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
|
||||
readonly/>
|
||||
</div><!-- /input-group -->
|
||||
</a>
|
||||
<ul id="user_tree" class="dropdown-menu" data-stopPropagation="true">
|
||||
<li class="header">
|
||||
<div id="companiestree" style="width: 250px;height:300px; overflow:auto;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="input-group input-group-sm pull-right" style="width: 250px;">
|
||||
<input type="text" id="search_userName" autocomplete="off" name="search_userName"
|
||||
class="form-control" style="height:34px" placeholder="姓名">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchUser();" style="height:34px"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table_user"></table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="guanbi" type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button id="xiafa" type="button" class="btn btn-primary" onclick="doSelect()">确认</button>
|
||||
<button id="xiafazhong" type="button" class="btn btn-primary">
|
||||
<i class="fa fa-spinner fa-pulse"></i>下发中
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
170
WebRoot/jsp/user/userForSelect_Backup.jsp
Normal file
170
WebRoot/jsp/user/userForSelect_Backup.jsp
Normal file
@ -0,0 +1,170 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
|
||||
function doSearch(orgids,type){
|
||||
document.getElementById("prompt").style.visibility="hidden";
|
||||
$.getJSON(ext.contextPath +"/user/queryUsers.do?orgid="+orgids+"&type="+type+"",callback);
|
||||
}
|
||||
|
||||
function callback(data){
|
||||
$("#a_Users").empty();
|
||||
// if(data.resultcode=='SUCCESS'){
|
||||
if(data.rows.length > 0)
|
||||
{
|
||||
for(var i = 0;i<data.rows.length;i++){
|
||||
//alert(data.object[i].usercode);
|
||||
var userid = data.rows[i].id;
|
||||
//var username = data.object[i].username+"("+data.object[i].usercode+")";
|
||||
var username = data.rows[i].name;
|
||||
|
||||
$("#a_Users").append("<option value='"+userid+"'>"+username+"</option>");
|
||||
}
|
||||
}else{
|
||||
document.getElementById("prompt").style.visibility="visible";//显示
|
||||
}
|
||||
|
||||
//}else{
|
||||
// document.getElementById("prompt").style.visibility="visible";//显示
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
function addToSelect(){
|
||||
|
||||
// getAllselect('a_Users');
|
||||
|
||||
//removeFromSelect();
|
||||
$("#a_selectUsers").append("<option value='"+$("#a_Users option:selected").val()+"'>"+$("#a_Users option:selected").text()+"</option>");
|
||||
}
|
||||
|
||||
|
||||
function removeFromSelect(){
|
||||
var selOpt = $("#a_selectUsers option:selected");
|
||||
selOpt.remove();
|
||||
}
|
||||
|
||||
|
||||
function removeFromSelectAll(){
|
||||
$("#a_selectUsers").empty();
|
||||
}
|
||||
|
||||
|
||||
function addToSelectAll(){
|
||||
//$("#a_selectUsers").empty();
|
||||
for(var i=0;i<$("#a_Users option").length;i++){
|
||||
$("#a_selectUsers").append("<option value='"+$("#a_Users").get(0).options[i].value+"'>"+$("#a_Users").get(0).options[i].text+"</option>");
|
||||
}
|
||||
}
|
||||
function addToSelectMulti(){
|
||||
for(var i=0;i<$("#a_Users option").length;i++){
|
||||
if($("#a_Users").get(0).options[i].selected){
|
||||
$("#a_selectUsers").append("<option value='"+$("#a_Users").get(0).options[i].value+"'>"+$("#a_Users").get(0).options[i].text+"</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
function getUser(){
|
||||
document.getElementById("prompt").style.visibility="hidden";
|
||||
var username = $('#queryusername').val();
|
||||
$.getJSON(ext.contextPath +"/user/queryUsers.do?queryusername="+encodeURI(encodeURI(username)), callback );
|
||||
}
|
||||
|
||||
function selectOK() {
|
||||
var username="",userid="";
|
||||
for(var i=0;i<$("#a_selectUsers option").length;i++){
|
||||
userid+=$("#a_selectUsers").get(0).options[i].value+",";
|
||||
username+=$("#a_selectUsers").get(0).options[i].text+",";
|
||||
}
|
||||
var retn= userid+")"+username;
|
||||
//alert(retn);
|
||||
return retn;
|
||||
}
|
||||
/* function selectCancel() {
|
||||
alert('提示', "取消操作", 'info');
|
||||
|
||||
} */
|
||||
$(function() {
|
||||
$('#unitTree').tree({
|
||||
url : ext.contextPath + '/user/getUnitsJson.do?random=' + Math.random(),
|
||||
parentField : 'pid',
|
||||
onClick : function(node) {
|
||||
if(node.pid != ''){
|
||||
// if(node.attributes.type=='D'){
|
||||
doSearch(node.id,node.attributes.type);
|
||||
// }else{
|
||||
// doSearch(node.id);
|
||||
// }
|
||||
}
|
||||
}
|
||||
});
|
||||
$.each(eval('${json}'), function(index, item){
|
||||
$("#a_selectUsers").append("<option value='"+item.id+"'>"+item.caption+"</option>");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body class="easyui-layout" data-options="fit:true,border:false">
|
||||
<div id="divadd" style="display:block;">
|
||||
<div>
|
||||
<div >
|
||||
<table width="100%" class="easyui-datagrid" toolbar="#tb" border="0">
|
||||
</table>
|
||||
<div id="tb" >
|
||||
<span style="font-size:12px"> 姓名查询</span>
|
||||
<input class="easyui-searchbox" type="text" style=" width: 180px;" data-options="prompt:'请输入关键字',searcher:getUser" id="queryusername"
|
||||
name="queryusername" />
|
||||
<!-- <a class="easyui-linkbutton" data-options="iconCls:'icon-search'" href="#" onclick="getUser();" -->
|
||||
<!-- style="width:80px;height:24px">查询</a> -->
|
||||
<span id="prompt" name="prompt" style="color: red;visibility:hidden"> 无用户</span>
|
||||
</div>
|
||||
<table width="100%" cellspacing="0">
|
||||
<tr>
|
||||
<th width="40%">
|
||||
<div
|
||||
style="width: 100%; height: 340px;overflow: auto; overflow-x:hidden; text-align: left;font-Weight:normal">
|
||||
<div region="west" style="padding: 4px;width: 200px;"
|
||||
border="false" >
|
||||
<%-- <fsdp:tree id="tt"
|
||||
url="${ctx}/jsp/user/unitTree"
|
||||
onclick="clickTree"></fsdp:tree> --%>
|
||||
<ul id="unitTree" class="easyui-tree" data-options="method:'get',animate:true"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</th>
|
||||
<td id="usertd1" style="width:170px;"><span style="font-size:12px">人员(双击选择): </span><br /> <select
|
||||
name="a_Users" id="a_Users" style="width:170px; height:340px;margin:-2px"
|
||||
ondblclick="addToSelect()" multiple="multiple" border="1px solid #FFF;"></select>
|
||||
</td>
|
||||
<td id="usertd2" style="width:160px;"><span style="font-size:12px">已选(双击移除): </span><br/>
|
||||
<select name="a_selectUsers" id="a_selectUsers"
|
||||
ondblclick="removeFromSelect();"
|
||||
style="width:160px; height:340px;margin:-2px" multiple="multiple" border="1px solid #FFF;"></select>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr style="height: 10px;"></tr> -->
|
||||
<!-- <tr>
|
||||
<td class="nobg" colspan="3" align="center"
|
||||
style="text-align:center;">
|
||||
<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)"
|
||||
onclick="addToSelect();" style="width:80px">添加</a>
|
||||
<a class="easyui-linkbutton" data-options="iconCls:'icon-no'"
|
||||
href="javascript:void(0)" onclick="removeFromSelect();"
|
||||
style="width:80px">移出</a>
|
||||
<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="addToSelectAll();"style="width:80px">全部添加</a>
|
||||
<a class="easyui-linkbutton" data-options="iconCls:'icon-reload'" href="javascript:void(0)" onclick="removeFromSelectAll();" style="width:80px">全部移出</a>
|
||||
<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'"
|
||||
href="javascript:void(0)" onclick="selectOK();"
|
||||
style="width:80px">确定</a>
|
||||
</td>
|
||||
</tr> -->
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
96
WebRoot/jsp/user/userForSingleSelect.jsp
Normal file
96
WebRoot/jsp/user/userForSingleSelect.jsp
Normal file
@ -0,0 +1,96 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
returnstr="";
|
||||
function doSearch(orgids,type){
|
||||
document.getElementById("prompt").style.visibility="hidden";
|
||||
$.getJSON(ext.contextPath +"/user/queryUsers.do?orgid="+orgids+"&type="+type+"",callback);
|
||||
}
|
||||
|
||||
function callback(data){
|
||||
$("#a_Users").empty();
|
||||
if(data.rows.length > 0)
|
||||
{
|
||||
for(var i = 0;i<data.rows.length;i++){
|
||||
var userid = data.rows[i].id;
|
||||
var username = data.rows[i].caption;
|
||||
|
||||
$("#a_Users").append("<option value='"+userid+"'>"+username+"</option>");
|
||||
}
|
||||
}else{
|
||||
document.getElementById("prompt").style.visibility="visible";//显示
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addToSelect(){
|
||||
var selectid=$("#a_Users option:selected").val();
|
||||
var selecttext=$("#a_Users option:selected").text();
|
||||
returnstr=selectid+","+selecttext;
|
||||
|
||||
}
|
||||
|
||||
function getUser(){
|
||||
document.getElementById("prompt").style.visibility="hidden";
|
||||
var username = $('#queryusername').val();
|
||||
$.getJSON(ext.contextPath +"/user/queryUsers.do?queryusername="+encodeURI(encodeURI(username)), callback );
|
||||
}
|
||||
|
||||
function selectOK() {
|
||||
addToSelect();
|
||||
return returnstr;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$('#unitTree').tree({
|
||||
url : ext.contextPath + '/user/getUnitsJson.do?random=' + Math.random(),
|
||||
parentField : 'pid',
|
||||
onClick : function(node) {
|
||||
if(node.pid != ''){
|
||||
doSearch(node.id,node.attributes.type);
|
||||
}
|
||||
}
|
||||
});
|
||||
var recvid=parent.$('#'+'${param.iframeId}')[0].contentWindow.$("#"+'${param.recvid}').val();
|
||||
$.getJSON(ext.contextPath +"/user/getRecvusersJson.do?recvid="+recvid, function(data){
|
||||
$("#a_selectUsers").empty();
|
||||
for(var i = 0;i<data.rows.length;i++){
|
||||
var userid = data.rows[i].id;
|
||||
var username = data.rows[i].caption;
|
||||
$("#a_selectUsers").append("<option value='"+userid+"'>"+username+"</option>");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body style="margin:0px">
|
||||
<input id="recvid" name="recvid" type="hidden" />
|
||||
<div style="background-color:#f4f4f4;padding-top:2px;padding-bottom:2px;border-bottom:1px solid #e4e4e4;font-size:12px;">
|
||||
<span style="padding:2px 5px 2px 5px">姓名</span>
|
||||
<input id="queryusername" name="queryusername" class="easyui-searchbox" style="width: 180px;"
|
||||
data-options="prompt:'请输入关键字',searcher:getUser" />
|
||||
<span id="prompt" name="prompt" style="color:red;visibility:hidden;padding:2px 5px 2px 5px">无用户</span>
|
||||
</div>
|
||||
<table cellspacing="2" cellpadding="0" style="font-size:12px;">
|
||||
<tr>
|
||||
<td valign="top" style="border:1px solid #e4e4e4">
|
||||
<div style="width: 250px;height: 370px;overflow:auto">
|
||||
<ul id="unitTree" class="easyui-tree" data-options="method:'get',animate:true"></ul>
|
||||
</div>
|
||||
</td>
|
||||
<td valign="top" style="border:1px solid #e4e4e4">
|
||||
<div style="background-color:#f4f4f4;padding:2px 5px 2px 5px;border-bottom:1px solid #e4e4e4">
|
||||
人员 (单击选择)
|
||||
</div>
|
||||
<select name="a_Users" id="a_Users" onclick="addToSelect()"
|
||||
style="width:160px; height:350px;border:0px;padding:2px;" multiple="multiple"></select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
298
WebRoot/jsp/user/userHeadPortrait.jsp
Normal file
298
WebRoot/jsp/user/userHeadPortrait.jsp
Normal file
@ -0,0 +1,298 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<!-- cropper -->
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/cropper/dist/cropper.min.css"/>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/cropper/dist/cropper.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
var console = window.console || { log: function () {} };
|
||||
var URL = window.URL || window.webkitURL;
|
||||
var $image = $('#image');
|
||||
//var $download = $('#download');
|
||||
//获取图片截取的位置
|
||||
var $dataX = $('#dataX');
|
||||
var $dataY = $('#dataY');
|
||||
var $dataHeight = $('#dataHeight');
|
||||
var $dataWidth = $('#dataWidth');
|
||||
var $dataRotate = $('#dataRotate');
|
||||
var $dataScaleX = $('#dataScaleX');
|
||||
var $dataScaleY = $('#dataScaleY');
|
||||
var options = {
|
||||
aspectRatio: 1 / 1, //裁剪框比例1:1
|
||||
preview: '.img-preview',
|
||||
viewMode:1,
|
||||
dragMode:'move',
|
||||
crop: function (e) {
|
||||
$dataX.val(Math.round(e.x));
|
||||
$dataY.val(Math.round(e.y));
|
||||
$dataHeight.val(Math.round(e.height));
|
||||
$dataWidth.val(Math.round(e.width));
|
||||
$dataRotate.val(e.rotate);
|
||||
$dataScaleX.val(e.scaleX);
|
||||
$dataScaleY.val(e.scaleY);
|
||||
}
|
||||
};
|
||||
var originalImageURL = $image.attr('src');
|
||||
var uploadedImageURL;
|
||||
|
||||
|
||||
// Tooltip
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
|
||||
|
||||
// Cropper
|
||||
$image.cropper(options);
|
||||
|
||||
|
||||
// Buttons
|
||||
if (!$.isFunction(document.createElement('canvas').getContext)) {
|
||||
$('button[data-method="getCroppedCanvas"]').prop('disabled', true);
|
||||
}
|
||||
|
||||
if (typeof document.createElement('cropper').style.transition === 'undefined') {
|
||||
$('button[data-method="rotate"]').prop('disabled', true);
|
||||
$('button[data-method="scale"]').prop('disabled', true);
|
||||
}
|
||||
|
||||
|
||||
// Options
|
||||
$('.docs-toggles').on('change', 'input', function () {
|
||||
var $this = $(this);
|
||||
var name = $this.attr('name');
|
||||
var type = $this.prop('type');
|
||||
var cropBoxData;
|
||||
var canvasData;
|
||||
|
||||
if (!$image.data('cropper')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === 'checkbox') {
|
||||
options[name] = $this.prop('checked');
|
||||
cropBoxData = $image.cropper('getCropBoxData');
|
||||
canvasData = $image.cropper('getCanvasData');
|
||||
|
||||
options.ready = function () {
|
||||
$image.cropper('setCropBoxData', cropBoxData);
|
||||
$image.cropper('setCanvasData', canvasData);
|
||||
};
|
||||
} else if (type === 'radio') {
|
||||
options[name] = $this.val();
|
||||
}
|
||||
|
||||
$image.cropper('destroy').cropper(options);
|
||||
});
|
||||
|
||||
|
||||
// Methods
|
||||
// 点击开始计算图片位置,获取位置
|
||||
$('.docs-buttons').on('click', '[data-method]', function () {
|
||||
var $this = $(this);
|
||||
var data = $this.data();
|
||||
var $target;
|
||||
var result;
|
||||
|
||||
if ($this.prop('disabled') || $this.hasClass('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($image.data('cropper') && data.method) {
|
||||
data = $.extend({}, data); // Clone a new one
|
||||
|
||||
if (typeof data.target !== 'undefined') {
|
||||
$target = $(data.target);
|
||||
|
||||
if (typeof data.option === 'undefined') {
|
||||
try {
|
||||
data.option = JSON.parse($target.val());
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data.method === 'rotate') {
|
||||
$image.cropper('clear');
|
||||
}
|
||||
|
||||
result = $image.cropper(data.method, data.option, data.secondOption);
|
||||
|
||||
if (data.method === 'rotate') {
|
||||
$image.cropper('crop');
|
||||
}
|
||||
|
||||
switch (data.method) {
|
||||
case 'scaleX':
|
||||
case 'scaleY':
|
||||
$(this).data('option', -data.option);
|
||||
break;
|
||||
|
||||
case 'getCroppedCanvas':
|
||||
//上传头像
|
||||
if (result) {
|
||||
var imgBase=result.toDataURL('image/jpeg');
|
||||
var data={imgBase:imgBase};
|
||||
$.post(ext.contextPath+ "/user/saveHeadPortrait.do",data,function(ret){
|
||||
if(ret==1){
|
||||
$('img[alt|="User Image"]').attr('src',imgBase); ;
|
||||
closeModal('userHeadPortraitModal');
|
||||
}else{
|
||||
showAlert('d','上传失败','headAlertDiv');
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'destroy':
|
||||
if (uploadedImageURL) {
|
||||
URL.revokeObjectURL(uploadedImageURL);
|
||||
uploadedImageURL = '';
|
||||
$image.attr('src', originalImageURL);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ($.isPlainObject(result) && $target) {
|
||||
try {
|
||||
$target.val(JSON.stringify(result));
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Keyboard
|
||||
$(document.body).on('keydown', function (e) {
|
||||
|
||||
if (!$image.data('cropper') || this.scrollTop > 300) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (e.which) {
|
||||
case 37:
|
||||
e.preventDefault();
|
||||
$image.cropper('move', -1, 0);
|
||||
break;
|
||||
|
||||
case 38:
|
||||
e.preventDefault();
|
||||
$image.cropper('move', 0, -1);
|
||||
break;
|
||||
|
||||
case 39:
|
||||
e.preventDefault();
|
||||
$image.cropper('move', 1, 0);
|
||||
break;
|
||||
|
||||
case 40:
|
||||
e.preventDefault();
|
||||
$image.cropper('move', 0, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Import image
|
||||
var $inputImage = $('#inputImage');
|
||||
|
||||
if (URL) {
|
||||
$inputImage.change(function () {
|
||||
var files = this.files;
|
||||
var file;
|
||||
|
||||
if (!$image.data('cropper')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (files && files.length) {
|
||||
file = files[0];
|
||||
|
||||
if (/^image\/\w+$/.test(file.type)) {
|
||||
if (uploadedImageURL) {
|
||||
URL.revokeObjectURL(uploadedImageURL);
|
||||
}
|
||||
|
||||
uploadedImageURL = URL.createObjectURL(file);
|
||||
$image.cropper('destroy').attr('src', uploadedImageURL).cropper(options);
|
||||
$inputImage.val('');
|
||||
} else {
|
||||
showAlert('d','请选择图片文件','headAlertDiv');
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$inputImage.prop('disabled', true).parent().addClass('disabled');
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
<div class="modal fade" id="userHeadPortraitModal">
|
||||
<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强制为subForm -->
|
||||
<div id="headAlertDiv"></div>
|
||||
<form class="form-horizontal" id="fileInputModalForm" style="padding:10px">
|
||||
<div class="row" style="margin-bottom: 10px">
|
||||
<div class="col-md-12">
|
||||
<!-- <h3>Demo:</h3> -->
|
||||
<div class="img-container">
|
||||
<img id="image" style="height:350px">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-md-3">
|
||||
<h3>Preview:</h3>
|
||||
<div class="docs-preview clearfix">
|
||||
<div class="img-preview preview-sm" style="width:50px;height:50px"></div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-9 docs-buttons">
|
||||
<!-- <h3>Toolbar:</h3> -->
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-method="rotate" data-option="-90" title="左转90º">
|
||||
<i class="fa fa-rotate-left"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" data-method="rotate" data-option="90" title="右转90º">
|
||||
<i class="fa fa-rotate-right"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" data-method="reset" title="刷新">
|
||||
<i class="fa fa-refresh"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="btn-group">
|
||||
<label class="btn btn-danger btn-upload" for="inputImage" title="选择图片">
|
||||
<input type="file" class="sr-only" id="inputImage" name="file" accept="image/gif,image/jpg,image/jpeg,image/bmp,image/png,.jpg,.jpeg,.png,.gif,.bmp,.tiff">
|
||||
<i class="fa fa-file-picture-o"> 选择</i>
|
||||
</label>
|
||||
</div>
|
||||
<div class="btn-group btn-group-crop">
|
||||
<button class="btn btn-primary" data-method="getCroppedCanvas" data-option="{ "width": 180, "height": 90 }" type="button" title="上传">
|
||||
<i class="fa fa-upload"> 上传</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
100
WebRoot/jsp/user/userImport.jsp
Normal file
100
WebRoot/jsp/user/userImport.jsp
Normal file
@ -0,0 +1,100 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@page import="com.sipai.tools.CommUtil"%>
|
||||
<%request.setAttribute("nowDate", CommUtil.nowDate().replaceAll("[[\\s-:punct:]]","")); %>
|
||||
<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 control;
|
||||
function initUpload(ctrlName, uploadUrl) {
|
||||
control = $('#' + ctrlName);
|
||||
control.fileinput({
|
||||
language: 'zh', //设置语言
|
||||
uploadUrl: uploadUrl, //上传的地址
|
||||
uploadAsync: true, //默认异步上传
|
||||
showCaption: true,//是否显示标题
|
||||
showUpload: false, //是否显示上传按钮
|
||||
browseClass: "btn btn-primary", //按钮样式
|
||||
allowedFileExtensions: ["xls", "xlsx"], //接收的文件后缀
|
||||
maxFileCount: 1,//最大上传文件数限制
|
||||
previewFileIcon: '<i class="glyphicon glyphicon-file"></i>',
|
||||
showPreview: false, //是否显示预览
|
||||
previewFileIconSettings: {
|
||||
'docx': '<i ass="fa fa-file-word-o text-primary"></i>',
|
||||
'xlsx': '<i class="fa fa-file-excel-o text-success"></i>',
|
||||
'xls': '<i class="fa fa-file-excel-o text-success"></i>',
|
||||
'pptx': '<i class="fa fa-file-powerpoint-o text-danger"></i>',
|
||||
'jpg': '<i class="fa fa-file-photo-o text-warning"></i>',
|
||||
'pdf': '<i class="fa fa-file-archive-o text-muted"></i>',
|
||||
'zip': '<i class="fa fa-file-archive-o text-muted"></i>',
|
||||
},
|
||||
//参数
|
||||
uploadExtraData: function () {
|
||||
var data = {
|
||||
"companyId": unitId, //此处自定义传参
|
||||
};
|
||||
return data;
|
||||
}
|
||||
});
|
||||
control.on("fileuploaded", function (event, data, previewId, index) {
|
||||
if(data.response.status == true){
|
||||
closeModal('subModal');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
showAlert('s',data.response.msg,'mainAlertdiv');
|
||||
}else{
|
||||
showAlert('d',data.response.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
initUpload("filelist", ext.contextPath+ "/work/mpoint/saveExcelData.do?companyId="+unitId);
|
||||
})
|
||||
//导入上传文件的数据
|
||||
function importExcelFun(){
|
||||
if($("#filelist").val() == null || $("#filelist").val()==""){
|
||||
showAlert('d','上传的文件不能为空!');
|
||||
}else{
|
||||
control.fileinput("upload");
|
||||
}
|
||||
}
|
||||
// 导出模板
|
||||
function importExcelTemp(){
|
||||
window.open(ext.contextPath + "/user/downtemplate.do?unitId=" + unitId);
|
||||
}
|
||||
</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">
|
||||
<form id="importFile" name="importFile" class="form-horizontal" method="post"
|
||||
enctype="multipart/form-data">
|
||||
<div id="alertDiv"></div>
|
||||
<div class="box-body">
|
||||
<div>
|
||||
<input id="filelist" name="filelist" class="file-loading" type="file" multiple accept=".xls,.xlsx">
|
||||
</div>
|
||||
</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" onclick="importExcelTemp()">模板下载</button>
|
||||
<button type="button" class="btn btn-primary" onclick="importExcelFun()" id="btn_save">导入</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
594
WebRoot/jsp/user/userList.jsp
Normal file
594
WebRoot/jsp/user/userList.jsp
Normal file
@ -0,0 +1,594 @@
|
||||
<%@ 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" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject" %>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
|
||||
<head>
|
||||
<!-- <style type="text/css">
|
||||
.input { padding: 5px; margin: 0; border: 1px solid #beceeb; }
|
||||
.clear { display: none;
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin: 6px 0 0 -20px;
|
||||
background: url(../IMG/remove-icon-small.png);}
|
||||
|
||||
.input::-ms-clear { display: none; }
|
||||
.input:valid + .clear { display: inline; }
|
||||
|
||||
</style> -->
|
||||
<title>
|
||||
<%= ServerObject.atttable.get("TOPTITLE")%>
|
||||
</title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
var addFun = function () {
|
||||
$.post(ext.contextPath + '/user/addUser.do', {companyId: companyId}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
var editFun = function (id) {
|
||||
$.post(ext.contextPath + '/user/editUser.do', {id: id}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
var deleteFun = function (id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/work/group/delete.do', {id: id}, function (data) {
|
||||
if (data == 1) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '删除失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
var deletesFun = function () {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||||
} else {
|
||||
swal({
|
||||
text: "您确定要禁用这些用户吗?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/deleteUsers.do', {ids: datas}, function (data) {
|
||||
if (data > 0) {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '禁用失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//重置密码
|
||||
var pwdFun = function (id) {
|
||||
swal({
|
||||
text: "您确定要重置密码吗?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/resetPassword.do', {id: id}, function (data) {
|
||||
if (data == 1) {
|
||||
showAlert('s', '重置成功', 'mainAlertdiv');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '重置失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
var unlockFun = function (id) {
|
||||
swal({
|
||||
text: "您确定要解除锁定吗?",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/unlockFun.do', {id: id}, function (data) {
|
||||
if (data == 1) {
|
||||
showAlert('s', '解锁成功', 'mainAlertdiv');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '解锁失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
var syncFun = function () {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas = "";
|
||||
$.each(checkedItems, function (index, item) {
|
||||
datas += item.id + ",";
|
||||
});
|
||||
if (datas == "") {
|
||||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||||
} else {
|
||||
swal({
|
||||
text: "您确定要同步所选用户至数据中心?同步前请确认已配置用户所在单位的基本数据权限!",
|
||||
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(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/user/syncUsers.do', {ids: datas}, function (data) {
|
||||
if (data > 0) {
|
||||
showAlert('s', '同步成功', 'mainAlertdiv');
|
||||
} else {
|
||||
showAlert('d', '部分用户同步失败', 'mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//人员定位
|
||||
var locationFun = function (id){
|
||||
stopBubbleDefaultEvent();
|
||||
$.post(ext.contextPath + '/cmd/cmdController/locationUser.do', {id: id}, function (data) {
|
||||
alert('已发送定位指令');
|
||||
});
|
||||
}
|
||||
|
||||
var initFun = function () {
|
||||
$table = $("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUsers.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_name').val(),
|
||||
search_pid: companyId,
|
||||
pid: $('#listpid').val(),
|
||||
lock: $('#lock').val(),
|
||||
active: $('#listactive').val()
|
||||
}
|
||||
},
|
||||
// sortName: 'id', // 要排序的字段
|
||||
// sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
}, {
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '登录名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'caption', // 返回json数据中的name
|
||||
title: '姓名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: '_pname', // 返回json数据中的name
|
||||
title: '公司/部门', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'sex', // 返回json数据中的name
|
||||
title: '性别', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
if (value == '0') {
|
||||
return '女';
|
||||
} else {
|
||||
return '男';
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'insdt', // 返回json数据中的name
|
||||
title: '注册时间', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
return value.substring(0, 19);
|
||||
}
|
||||
}, {
|
||||
field: 'totaltime', // 返回json数据中的name
|
||||
title: '在线时长', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
return value.toFixed(2);
|
||||
}
|
||||
}, {
|
||||
field: 'lastlogintime', // 返回json数据中的name
|
||||
title: '上次登录时间', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
return value.substring(0, 19);
|
||||
}
|
||||
}, {
|
||||
field: 'roles', // 返回json数据中的name
|
||||
title: '角色权限', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
var res = "";
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
res += "<a class='linkbutton' href='javascript:void(0)' onclick='showMenu(\"" + value[i].id + "\",\"" + value[i].name + "\")'>" + value[i].name + "</a>" + ", ";
|
||||
}
|
||||
return res.replace(/, $/g, "");
|
||||
}
|
||||
}, {
|
||||
field: 'cardid', // 返回json数据中的name
|
||||
title: '人员定位卡号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
}, {
|
||||
field: 'active', // 返回json数据中的name
|
||||
title: '状态', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
var lock = '';
|
||||
if (row.locktime != null && row.locktime != '') {
|
||||
lock = '(<i class="fa fa-lock"></i>)';
|
||||
}
|
||||
switch (value) {
|
||||
case '0':
|
||||
return '禁用' + lock;
|
||||
case '1':
|
||||
return '启用' + lock;
|
||||
case '2':
|
||||
return '退休';
|
||||
case '3':
|
||||
return '离职';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
}, {
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
// width: 60, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var str = '';
|
||||
str += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i></button>';
|
||||
str += '<button class="btn btn-default btn-sm" title="重置密码" onclick="pwdFun(\'' + row.id + '\')"><i class="fa fa-repeat"></i></button>';
|
||||
if (row.locktime != null && row.locktime != '') {
|
||||
str += '<button class="btn btn-default btn-sm" title="解除锁定" onclick="unlockFun(\'' + row.id + '\')"><i class="fa fa-unlock"></i></button>';
|
||||
}
|
||||
|
||||
str += '<security:authorize buttonUrl="user/location.do">';
|
||||
str += '<button class="btn btn-default btn-sm" title="定位" onclick="locationFun(\'' + row.id + '\')"><i class="fa fa-map-marker"></i><span class="hidden-md hidden-lg"> 定位</span></button>';
|
||||
str += '</security:authorize>';
|
||||
|
||||
str = '<div class="btn-group" >' + str + '</div>';
|
||||
return str;
|
||||
/* return '<i class="fa fa-edit" onclick="editFun()(\'' + row.id + '\')></i>'; */
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
|
||||
// 职位下拉
|
||||
$.post(ext.contextPath + "/user/getUnitJson2.do", {unitId: unitId}, function (data) {
|
||||
//console.log('data is ', data)
|
||||
$("#listpid").empty();
|
||||
var selelct_ = $("#listpid").select2({
|
||||
data: data,
|
||||
cache: false,
|
||||
placeholder: '请选择',//默认文字提示
|
||||
allowClear: true,//允许清空
|
||||
escapeMarkup: function (markup) {
|
||||
return markup;
|
||||
}, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 10,//数据超过10个,显示搜索框
|
||||
formatResult: function formatRepo(repo) {
|
||||
console.log("repo is ", repo)
|
||||
return repo.text;
|
||||
}, // 函数用来渲染结果
|
||||
formatSelection: function formatRepoSelection(repo) {
|
||||
console.log("repo1 is ", repo)
|
||||
return repo.text;
|
||||
} // 函数用于呈现当前的选择
|
||||
});
|
||||
selelct_.val('').trigger("change");
|
||||
selelct_.on("change", function (e) {
|
||||
dosearch();
|
||||
});
|
||||
}, 'json');
|
||||
|
||||
};
|
||||
var $table;
|
||||
var companyId;
|
||||
var dosearch = function () {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
getLockNum();
|
||||
};
|
||||
$(function () {
|
||||
//init();
|
||||
//简易公司combotree
|
||||
/* $.post(ext.contextPath + "/user/showCompanySelectTree.do", {unitId:unitId}, function (data) {
|
||||
$('#companySelectTree').html(data);
|
||||
}); */
|
||||
|
||||
companyId = unitId;
|
||||
initFun();
|
||||
$('#removea').click(function () {
|
||||
$('#search_name').val("");
|
||||
})
|
||||
});
|
||||
|
||||
var activeChange = function () {
|
||||
dosearch();
|
||||
}
|
||||
var getLockNum = function () {
|
||||
$.post(ext.contextPath + '/user/getLockNum.do', {
|
||||
search_name: $('#search_name').val(),
|
||||
search_pid: companyId,
|
||||
pid: $('#listpid').val(),
|
||||
lock: 1,
|
||||
active: $('#listactive').val()
|
||||
}, function (data) {
|
||||
if (data > 0) {
|
||||
$("#lockLabel").html("(" + data + "位)");
|
||||
} else {
|
||||
$("#lockLabel").empty();
|
||||
}
|
||||
});
|
||||
}
|
||||
var downFun = function() {
|
||||
searchForm.action = ext.contextPath + '/user/downtemplate.do';
|
||||
searchForm.submit();
|
||||
};
|
||||
|
||||
var importFun = function() {
|
||||
$.post(ext.contextPath + '/user/doimport.do', {}, function (data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
};
|
||||
|
||||
var exportFun = function() {
|
||||
//通过response导出,用户自己选择路径
|
||||
searchForm.action = ext.contextPath + '/user/exportUsersByResponse.do';
|
||||
searchForm.submit();
|
||||
var win = $.messager.progress({
|
||||
title:'提示',
|
||||
msg:'文件正在导出,请稍后...'
|
||||
});
|
||||
setTimeout(function(){
|
||||
$.messager.progress('close');
|
||||
},3000);
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<%-- <!-- 引用top --> --%>
|
||||
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
|
||||
<!-- 菜单栏 -->
|
||||
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="unit4SelectDiv"></div>
|
||||
<div>
|
||||
<!-- <div id="companySelectTree"></div> -->
|
||||
<div class="form-group form-inline">
|
||||
<div class="btn-group" style="width: 400px;padding-bottom:10px;">
|
||||
<security:authorize buttonUrl="user/addUser.do">
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i
|
||||
class="fa fa-plus"></i>
|
||||
新增
|
||||
</button>
|
||||
</security:authorize>
|
||||
<!-- <button type="button" class="btn btn-default" onclick="editFun();"><i class="fa fa-edit"></i> 编辑</button> -->
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i
|
||||
class="fa fa-warning"></i>禁用
|
||||
</button>
|
||||
<%-- <button type="button" class="btn btn-default btn-sm" onclick='importFun()'><i--%>
|
||||
<%-- class="fa fa-cloud-upload"></i>--%>
|
||||
<%-- 导入--%>
|
||||
<%-- </button>--%>
|
||||
<%-- <button type="button" class="btn btn-default btn-sm" onclick="exportFun();"><i--%>
|
||||
<%-- class="fa fa-cloud-download"></i>--%>
|
||||
<%-- 导出--%>
|
||||
<%-- </button>--%>
|
||||
<!--<button type="button" class="btn btn-default" onclick="syncFun();"><i class="fa fa-upload"></i> 同步</button> -->
|
||||
</div>
|
||||
|
||||
<div class="form-group pull-right form-inline ">
|
||||
<!-- <div class="form-group has-feedback ">
|
||||
<input type="text" class="form-control " id="search_group" name ="search_group" placeholder="小组" onclick="showUnit4SelectFun();" style="width: 250px;height:30px">
|
||||
<a class="glyphicon glyphicon-remove form-control-feedback btn-sm" id="removea" style="padding-top:6px;pointer-events: auto"></a>
|
||||
</input>
|
||||
</div>
|
||||
<input id="search_pid" class="form-control" name="search_pid" type="hidden" /> -->
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label text-center"
|
||||
style="padding-left: 10px; padding-top: 7px">锁定情况<span class="text-red"
|
||||
id="lockLabel"></span></label>
|
||||
<select class="form-control select2 " id="lock" name="lock" onchange="activeChange()"
|
||||
style="width: 100px; height: 30px; border-radius: 5px">
|
||||
<option value="" selected>全部</option>
|
||||
<option value="0">未锁定</option>
|
||||
<option value="1">已锁定</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label text-center"
|
||||
style="padding-left: 10px; padding-top: 7px">层级部门:</label>
|
||||
<select class="form-control select2 " id="listpid" name="listpid"
|
||||
style="width: 160px;">
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label text-center">状态:</label>
|
||||
<select class="form-control select2 " onchange="activeChange()" id="listactive" name="listactive"
|
||||
style="width: 100px; height: 30px; border-radius: 5px">
|
||||
<option value="0">禁用</option>
|
||||
<option value="1" selected>启用</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right"
|
||||
placeholder="姓名">
|
||||
<a class="glyphicon glyphicon-remove form-control-feedback btn-sm" id="removea"
|
||||
style="padding-top:6px;pointer-events: auto"></a>
|
||||
</input>
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-default"
|
||||
onclick="dosearch();"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
|
||||
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
|
||||
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
150
WebRoot/jsp/user/userOutsidersList.jsp
Normal file
150
WebRoot/jsp/user/userOutsidersList.jsp
Normal file
@ -0,0 +1,150 @@
|
||||
<%@ 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" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject" %>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
|
||||
<head>
|
||||
<title>
|
||||
<%= ServerObject.atttable.get("TOPTITLE")%>
|
||||
</title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
var initFun = function () {
|
||||
$table = $("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getList4UserOutsiders.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_name').val(),
|
||||
type: $('#type').val(),
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '姓名', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'cardid', // 返回json数据中的name
|
||||
title: '定位卡号', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle'
|
||||
}, {
|
||||
field: 'pid', // 返回json数据中的name
|
||||
title: '类型', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
if (value == '1') {
|
||||
return '访客';
|
||||
} else {
|
||||
if (value == '2') {
|
||||
return '承包商';
|
||||
} else {
|
||||
return '其他';
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'insdt', // 返回json数据中的name
|
||||
title: '更新时间', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',
|
||||
formatter: function (value, row, index) {
|
||||
return value.substring(0, 19);
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
adjustBootstrapTableView("table");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
var $table;
|
||||
var companyId;
|
||||
var dosearch = function () {
|
||||
$("#table").bootstrapTable('refresh');
|
||||
};
|
||||
$(function () {
|
||||
companyId = unitId;
|
||||
initFun();
|
||||
$('#removea').click(function () {
|
||||
$('#search_name').val("");
|
||||
dosearch();
|
||||
})
|
||||
});
|
||||
|
||||
var activeChange = function () {
|
||||
dosearch();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="unit4SelectDiv"></div>
|
||||
<div>
|
||||
<div class="form-group form-inline">
|
||||
<div class="btn-group" style="width: 400px;padding-bottom:10px;">
|
||||
</div>
|
||||
<div class="form-group pull-right form-inline ">
|
||||
<div class="form-group">
|
||||
<label class="form-label text-center">类型:</label>
|
||||
<select class="form-control select2 " onchange="activeChange()" id="type" name="type"
|
||||
style="width: 120px; height: 30px; border-radius: 5px">
|
||||
<option value="">全部</option>
|
||||
<option value="1">访客</option>
|
||||
<option value="2">承包商</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group input-group-sm" style="width: 250px;">
|
||||
<input type="text" id="search_name" name="search_name" class="form-control pull-right"
|
||||
placeholder="姓名">
|
||||
<a class="glyphicon glyphicon-remove form-control-feedback btn-sm" id="removea"
|
||||
style="padding-top:6px;pointer-events: auto"></a>
|
||||
</input>
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-default"
|
||||
onclick="dosearch();"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
324
WebRoot/jsp/user/userSelectLayer.jsp
Normal file
324
WebRoot/jsp/user/userSelectLayer.jsp
Normal file
@ -0,0 +1,324 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<script type="text/javascript">
|
||||
var doSearchUser = function () {
|
||||
$("#table_user").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
var doSearchOnlyChoose = function (status) {
|
||||
// console.log(status);
|
||||
// var isChoose = $('#isChoose').val();
|
||||
if (status == 'yes') {
|
||||
$('#isChoose').val('yes');
|
||||
|
||||
$("#onlyChooseYes").hide();
|
||||
$("#onlyChooseNo").show();
|
||||
}
|
||||
if (status == 'no') {
|
||||
$('#isChoose').val('no');
|
||||
|
||||
$("#onlyChooseYes").show();
|
||||
$("#onlyChooseNo").hide();
|
||||
}
|
||||
|
||||
$("#table_user").bootstrapTable('refresh');
|
||||
};
|
||||
|
||||
function doSelect(dialog, grid) {
|
||||
//fucname为传的方法名
|
||||
var fucname = '${param.fucname}';
|
||||
var datas = "";
|
||||
datas_name = "";
|
||||
$.each(selectionIds, function (index, item) {
|
||||
if (datas != "") {
|
||||
datas += ",";
|
||||
}
|
||||
datas += item;
|
||||
});
|
||||
$.post(ext.contextPath + '/user/getUsersByIds.do', {userIds: datas}, function (resp) {
|
||||
$.each(resp, function (index, item) {
|
||||
if (datas_name != "") {
|
||||
datas_name += ",";
|
||||
}
|
||||
datas_name += item.caption;
|
||||
});
|
||||
$('#${param.formId} #${param.hiddenId}').val(datas);
|
||||
$('#${param.formId} #${param.textId}').val(datas_name);
|
||||
//调用保存点位方法
|
||||
eval(fucname + "('" + datas + "')")
|
||||
closeModal("user4SelectModal")
|
||||
}, 'json');
|
||||
};
|
||||
|
||||
function stateFormatter(value, row, index) {
|
||||
var flag = false;
|
||||
$.each(eval('${users}'), function (index, item) {
|
||||
if (row.id == item.id) {
|
||||
flag = true;
|
||||
}
|
||||
});
|
||||
if (flag)
|
||||
return {
|
||||
checked: true//设置选中
|
||||
};
|
||||
return value;
|
||||
}
|
||||
|
||||
var $table;
|
||||
var switchStatus = false;
|
||||
var selectionIds = []; //保存选中ids
|
||||
function initialSelectionIds() {
|
||||
var check_array = eval('${users}');
|
||||
if (check_array != null && check_array.length > 0) {
|
||||
selectionIds = new Array(check_array.length);
|
||||
for (var i = 0; i < check_array.length; i++) {
|
||||
selectionIds[i] = check_array[i].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getCheckedIds() {
|
||||
var ids = "";
|
||||
if ('${users}' != null && '${users}' != '') {
|
||||
var check_array = eval('${users}');
|
||||
$.each(check_array, function (index, item) {
|
||||
if (ids != "") {
|
||||
ids += ",";
|
||||
}
|
||||
ids += item.id;
|
||||
});
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
function queryParams(params) {
|
||||
var temp = {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order,
|
||||
search_name: $('#search_userName').val(),
|
||||
pid: companyId,
|
||||
jobIds: $('#jobIds').val(),
|
||||
userIds: getCheckedIds(),
|
||||
isChoose: $('#isChoose').val(),
|
||||
unitId: '${param.unitId}',
|
||||
type: '${param.type}',
|
||||
num: '${param.num}'
|
||||
};
|
||||
return temp;
|
||||
}
|
||||
|
||||
var companyId = "";
|
||||
$(function () {
|
||||
|
||||
//默认按钮的显示和隐藏
|
||||
$("#onlyChooseYes").show();
|
||||
$("#onlyChooseNo").hide();
|
||||
|
||||
$("#search_userName").keyup(function () {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
//回车查询
|
||||
doSearchUser();
|
||||
event.stopPropagation();
|
||||
}
|
||||
})
|
||||
//简易公司combotree
|
||||
$.post(ext.contextPath + '/user/getAllCompanyForTree.do', {ng: ''}, function (data) {
|
||||
if ((data.length == 1 && data.nodes != "") || data.length > 1) {
|
||||
$('#companiestree').treeview({
|
||||
data: data,
|
||||
showBorder: false,
|
||||
levels: 3,
|
||||
});
|
||||
$('#companiestree').on('nodeSelected', function (event, data) {
|
||||
$("#search_userPid").val(data.id);
|
||||
$("#coname_input").val(data.text);
|
||||
document.getElementById('user_tree').style.display = "none";
|
||||
companyId = data.id;
|
||||
doSearchUser();
|
||||
});
|
||||
}
|
||||
}, 'json');
|
||||
//防止点击树的+号收起下拉框
|
||||
$("#user_tree").on("click", function (e) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
//点击空白隐藏树
|
||||
$(document).click(function (e) {
|
||||
var divTree = $('#user_tree'); // 设置目标区域
|
||||
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
||||
divTree.hide()
|
||||
}
|
||||
})
|
||||
|
||||
initialSelectionIds();
|
||||
|
||||
$table = $("#table_user").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/user/getUserForSelects.do', // 获取表格数据的url
|
||||
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
clickToSelect: true,
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 20, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
clickToSelect: true,
|
||||
responseHandler: responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
|
||||
queryParams: queryParams,
|
||||
queryParamsType: "limit",
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
/* showColumns: true,
|
||||
showRefresh: true, */
|
||||
columns: [
|
||||
{
|
||||
checkbox: true, // 显示一个勾选框
|
||||
//formatter: stateFormatter
|
||||
formatter: function (i, row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if ($.inArray(row.id, Array.from(selectionIds)) != -1) { // 因为 Set是集合,需要先转换成数组
|
||||
return {
|
||||
checked: true // 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
field: 'caption',
|
||||
title: "姓名",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '30%'
|
||||
}, {
|
||||
field: '_pname',
|
||||
title: "部门",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: '70%'
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function (data) { //加载成功时执行
|
||||
if(data.rows.length==0){
|
||||
// layer.msg('无数据,可切换弹窗左上角,重新选择层级!');
|
||||
// layer.msg('无数据,可切换弹窗左上角,重新选择层级!',{time:1000,area:['80px','66px']})
|
||||
// layer.msg("无数据,可切换弹窗左上角,重新选择层级!" ,{ offset: [$(window).height() - 3130, $(window).width() - 890] });
|
||||
layer.msg('无数据,可切换弹窗左上角,重新选择层级!', {
|
||||
offset: '20', //上边距
|
||||
});
|
||||
}
|
||||
adjustBootstrapTableView("table_user");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//绑定选中事件、取消事件、全部选中、全部取消
|
||||
$table.on('check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table', function (e, rows, obj) {
|
||||
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
|
||||
return row.id;
|
||||
});
|
||||
func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference';
|
||||
selectionIds = _[func](selectionIds, ids);
|
||||
if ('check' == e.type) {
|
||||
obj.parent().addClass("checked");
|
||||
} else {
|
||||
obj.parent().removeClass("checked");
|
||||
}
|
||||
//adjustBootstrapTableView("table_user");
|
||||
});
|
||||
});
|
||||
//选中事件操作数组
|
||||
var union = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
if ($.inArray(id, array) == -1) {
|
||||
array[array.length] = id;
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
//取消选中事件操作数组
|
||||
var difference = function (array, ids) {
|
||||
$.each(ids, function (i, id) {
|
||||
var index = $.inArray(id, array);
|
||||
if (index != -1) {
|
||||
array.splice(index, 1);
|
||||
}
|
||||
});
|
||||
return array;
|
||||
};
|
||||
var _ = {"union": union, "difference": difference};
|
||||
|
||||
//表格分页之前处理多选框数据
|
||||
function responseHandler(res) {
|
||||
$.each(res.rows, function (i, row) {
|
||||
row.checkStatus = $.inArray(row.id, selectionIds) != -1; //判断当前行的数据id是否存在与选中的数组,存在则将多选框状态变为true
|
||||
});
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="user4SelectModal">
|
||||
<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 " style="width:100%">
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="jobIds" name="jobIds" class="form-control" placeholder="职位Ids"
|
||||
value="${jobIds }">
|
||||
<input type="hidden" id="isChoose" name="isChoose" class="form-control" value="no">
|
||||
<ul id="companyForUserSelect" style="list-style-type:none;padding-left:0px;width:260px;">
|
||||
<li class="dropdown" style="width:260px;">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
||||
style="width:260px;"
|
||||
onclick="document.getElementById('user_tree').style.display = 'block';">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"
|
||||
style="height:34px;color:#000000;border-top-left-radius: 4px;border-bottom-left-radius: 4px;font-weight:bold">公司:</span>
|
||||
<input class="form-control " id="coname_input" name="coname_input"
|
||||
placeholder="请选择"
|
||||
style="height:34px;width: 200px;border-top-right-radius: 4px;border-bottom-right-radius: 4px;"
|
||||
readonly/>
|
||||
</div>
|
||||
</a>
|
||||
<ul id="user_tree" class="dropdown-menu" data-stopPropagation="true">
|
||||
<li class="header">
|
||||
<div id="companiestree" style="width: 250px;height:300px; overflow:auto;"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="input-group input-group-sm pull-right" style="width: 250px;">
|
||||
<input type="text" id="search_userName" autocomplete="off" name="search_userName"
|
||||
class="form-control" style="height:34px" placeholder="姓名">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" onclick="doSearchUser();" style="height:34px"><i
|
||||
class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="table_user"></table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" onclick="doSearchOnlyChoose('yes')" id="onlyChooseYes">
|
||||
仅看已选
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" onclick="doSearchOnlyChoose('no')" id="onlyChooseNo">
|
||||
全部人员
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" onclick="doSelect()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
97
WebRoot/jsp/user/userView.jsp
Normal file
97
WebRoot/jsp/user/userView.jsp
Normal file
@ -0,0 +1,97 @@
|
||||
<!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"%>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<jsp:include page="../inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
function initcombobox(){
|
||||
var roleids = "";
|
||||
<c:forEach var="role" items="${user.roles}">
|
||||
roleids+="${role.name},";
|
||||
</c:forEach>
|
||||
if(roleids != ""){
|
||||
roleids=roleids.substring(0,roleids.length-1);
|
||||
}
|
||||
$('#role').text(roleids);
|
||||
|
||||
var jobids = "";
|
||||
<c:forEach var="job" items="${user.jobs}">
|
||||
jobids+="${job.name},";
|
||||
</c:forEach>
|
||||
if(jobids != ""){
|
||||
jobids=jobids.substring(0,jobids.length-1);
|
||||
}
|
||||
$('#job').text(jobids);
|
||||
}
|
||||
|
||||
$(function() {
|
||||
initcombobox();
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post" class="form">
|
||||
<input type="hidden" name="id" value="${user.id }"/>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<td>${user.name}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>姓名</th>
|
||||
<td>${user.caption}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>工号</th>
|
||||
<td>${user.serial}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>卡号</th>
|
||||
<td>${user.cardid}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>性别</th>
|
||||
<td>
|
||||
<c:if test="${user.sex=='1'}">男</c:if>
|
||||
<c:if test="${user.sex=='0'}">女</c:if>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>部门</th>
|
||||
<td>
|
||||
${user._pname}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>职位</th>
|
||||
<td>
|
||||
<span id="job"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>权限</th>
|
||||
<td>
|
||||
<span id="role"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>用户状态</th>
|
||||
<td>
|
||||
<c:if test="${user.sex=='1'}">启用</c:if>
|
||||
<c:if test="${user.sex=='0'}">禁用</c:if>
|
||||
<c:if test="${user.sex=='3'}">离职</c:if>
|
||||
<c:if test="${user.sex=='2'}">退休</c:if>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>顺序</th>
|
||||
<td>${user.morder}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
173
WebRoot/jsp/user/viewPersonalInformation.jsp
Normal file
173
WebRoot/jsp/user/viewPersonalInformation.jsp
Normal file
@ -0,0 +1,173 @@
|
||||
<%@ 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">
|
||||
function linkWeChat() {
|
||||
$("#btn_wechat").attr('href','http://wx.sipaiis.com/wxAuth/wxLogin?systemFlag='+ext.contextPath.substring(1,ext.contextPath.length)+'&id=${user.id}');
|
||||
//closeModal('subPasswordModal');
|
||||
/* $.ajax({
|
||||
type: "GET",
|
||||
url: 'http://wx.sipaiis.com/wxAuth/wxLogin?systemFlag=SSMBootstrap'+'&id='+'${user.id}',
|
||||
//data: {username:$("#username").val(), content:$("#content").val()},
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
alert()
|
||||
}
|
||||
}); */
|
||||
}
|
||||
function showBonusPoints(){
|
||||
$.post(ext.contextPath + '/bonuspoint/showBonusPoints.do', {} , function(data) {
|
||||
$("#bonusPointDiv").html(data);
|
||||
openModal('bonusPointModal');
|
||||
});
|
||||
}
|
||||
$(function(){
|
||||
var sex='${user.sex}';
|
||||
console.info(sex);
|
||||
if(sex== '0'){
|
||||
$('#sex').html('女');
|
||||
}else if(sex == '1'){
|
||||
$('#sex').html('男');
|
||||
}else{
|
||||
$('#sex').html('未知');
|
||||
}
|
||||
|
||||
var openid = '${user.wechatid}';
|
||||
if(openid==null || openid==''){
|
||||
$('#wechatid').html('未绑定');
|
||||
$('#wechatid').css('color','red');
|
||||
}else{
|
||||
$('#wechatid').html('已绑定');
|
||||
$('#wechatid').css('color','green');
|
||||
$('#link').hide();
|
||||
}
|
||||
$.post(ext.contextPath + "/bonuspoint/getCurrentPoints.do", function(data) {
|
||||
$('#currentBonusPoint').text(data.res)
|
||||
},'json');
|
||||
})
|
||||
//上传头像界面
|
||||
var fileinput = function() {
|
||||
$.post(ext.contextPath + '/user/fileinputHeadPortrait.do', {} , function(data) {
|
||||
$("#fileinputHeadPortraitDiv").html(data);
|
||||
openModal('fileinputHeadPortraitModal');
|
||||
});
|
||||
};
|
||||
//上传头像界面
|
||||
var userHeadPortrait = function() {
|
||||
$.post(ext.contextPath + '/user/userHeadPortrait.do', {} , function(data) {
|
||||
$("#fileinputHeadPortraitDiv").html(data);
|
||||
openModal('userHeadPortraitModal');
|
||||
});
|
||||
};
|
||||
|
||||
var recoverMainPage = function(){
|
||||
$.post(ext.contextPath + '/base/mainPageTypeUser/clearRecord.do', {} , function(data) {
|
||||
if(data>=0){
|
||||
goToMainPage();
|
||||
}else{
|
||||
showAlert('d','尝试恢复默认首页显示失败,请稍后重试!','alertDiv_userInfo');
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
</script>
|
||||
<div class="modal fade" id="subPasswordModal">
|
||||
<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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm" enctype="multipart/form-data" >
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<table>
|
||||
<tr style="height:50px">
|
||||
<th style="width: 80px; text-align:left" >头像</th>
|
||||
<td style="width: 80px;" align="center">
|
||||
<c:if test="${not empty cu.userDetail}">
|
||||
<c:choose>
|
||||
<c:when test="${not empty cu.userDetail.icon}">
|
||||
<img src="${cu.userDetail.icon}"class="img-circle" style="width: 60px; height:60px" alt="User Image">
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<c:choose>
|
||||
<c:when test="${cu.sex=='0'}">
|
||||
<img src="<%=request.getContextPath()%>/plugins/AdminLTE/img/avatar2.png" class="img-circle" style="width: 60px;" alt="User Image">
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<img src="<%=request.getContextPath()%>/plugins/AdminLTE/img/avatar5.png" style="width: 60px;" class="img-circle" alt="User Image">
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</c:if>
|
||||
<!--如果用户没有上传过头像,显示系统默认头像 -->
|
||||
<c:if test="${empty cu.userDetail}">
|
||||
<c:choose>
|
||||
<c:when test="${cu.sex=='0'}">
|
||||
<img src="<%=request.getContextPath()%>/plugins/AdminLTE/img/avatar2.png" class="img-circle" style="width: 60px;" alt="User Image">
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<img src="<%=request.getContextPath()%>/plugins/AdminLTE/img/avatar5.png" style="width: 60px;" class="img-circle" alt="User Image">
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</c:if>
|
||||
</td>
|
||||
<td><a class="pull-right " onclick="userHeadPortrait();" style="cursor:pointer ">更换</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="height:50px">
|
||||
<th style="width: 80px; text-align:left" >用户名</th>
|
||||
<td style="width: 420px;" align="center">${user.name}</td>
|
||||
</tr>
|
||||
<tr style="height:50px">
|
||||
<th style="text-align:left" >姓名</th>
|
||||
<td style="width: 420px;" align="center">${user.caption}</td>
|
||||
</tr>
|
||||
<tr style="height:50px">
|
||||
<th style="text-align:left" >性别</th>
|
||||
<td id="sex" style="width: 420px;" align="center"></td>
|
||||
</tr>
|
||||
<tr style="height:50px">
|
||||
<th style="text-align:left" >手机号</th>
|
||||
<td style="width: 420px;" align="center">${user.mobile}</td>
|
||||
</tr>
|
||||
<tr style="height:50px">
|
||||
<th style="text-align:left; width: 50px;" >公司</th>
|
||||
<td style="width: 420px;" align="center">${company.name}</td>
|
||||
</tr>
|
||||
<tr style="height:50px">
|
||||
<th style="text-align:left; width: 50px;" >微信</th>
|
||||
<td id="wechatid" style="width: 420px;" align="center"></td>
|
||||
<td id="link" style="width: 60px;"><a id="btn_wechat" class=" pull-right" style="cursor:pointer" onclick="linkWeChat()">绑定</a></td>
|
||||
</tr>
|
||||
<tr style="height:50px">
|
||||
<th style="text-align:left; width: 50px;" >当前积分</th>
|
||||
<td style="width: 420px;" align="center" id ="currentBonusPoint">0</td>
|
||||
<td style="width: 120px;"><a class="pull-right " onclick="showBonusPoints();" style="cursor:pointer ">查看详情
|
||||
</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" onclick="recoverMainPage();">恢复默认首页</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user