<!DOCTYPE html>
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
<head>
|
<th:block th:include="include :: header('用户列表')" />
|
<th:block th:include="include :: layout-latest-css" />
|
<th:block th:include="include :: ztree-css" />
|
</head>
|
<body class="gray-bg">
|
<div class="ui-layout-west">
|
<div class="box box-main">
|
<div class="box-header">
|
<div class="box-title">
|
<i class="fa icon-grid"></i> 组织机构
|
</div>
|
<div class="box-tools pull-right">
|
<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
|
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
|
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新部门"><i class="fa fa-refresh"></i></button>
|
</div>
|
</div>
|
<div class="ui-layout-content">
|
<div id="tree" class="ztree"></div>
|
</div>
|
</div>
|
</div>
|
<div class="ui-layout-center" style="width:550px;">
|
<div class="container-div">
|
<div class="row">
|
<div class="col-sm-12 search-collapse" style="height:50px;margin-top:0px;">
|
<input type="hidden" id="fingerIndex">
|
<input type="hidden" id="fingerIndexUserId">
|
<form id="user-form">
|
<input type="hidden" id="teamId" name="teamId">
|
<input type="hidden" id="deptId" name="deptId">
|
<input type="hidden" id="deptParentId" name="deptParentId">
|
<input type="hidden" id="organizationId" name="organizationId">
|
<div class="select-list">
|
<ul>
|
<li>
|
用户名:<input type="text" name="userName"/>
|
</li>
|
<li>
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="adds()"><i class="fa fa-add"></i> 批量添加</a>
|
</li>
|
</ul>
|
</div>
|
</form>
|
</div>
|
|
<div class="col-sm-12 select-table table-striped">
|
<table id="bootstrap-table"></table>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<div class="ui-layout-east">
|
<div class="box box-main">
|
<div class="box-header">
|
<div class="box-title">
|
<i class="fa icon-grid"></i> 组成员
|
</div>
|
</div>
|
<div class="col-sm-12 select-table table-striped">
|
<table id="bootstrap-table2"></table>
|
</div>
|
</div>
|
</div>
|
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: layout-latest-js" />
|
<th:block th:include="include :: ztree-js" />
|
<script th:inline="javascript">
|
var editFlag = [[${@permission.hasPermi('station:workUser:edit')}]];
|
var removeFlag = [[${@permission.hasPermi('station:workUser:remove')}]];
|
var prefix = ctx + "station/workUser";
|
|
$(function() {
|
$('#teamId').val(parent.$('#teamId').val());
|
var panehHidden = false;
|
if ($(this).width() < 769) {
|
panehHidden = true;
|
}
|
$('body').layout({ initClosed: panehHidden, west__size: 185 });
|
queryUserList();
|
queryDeptTree();
|
queryTeamUserList();
|
$('.ui-layout-center').width("500px");
|
$('.ui-layout-east').width("500px");
|
$('.ui-layout-west').width("200px");
|
});
|
|
function queryUserList() {
|
var options = {
|
url: prefix + "/list",
|
createUrl: prefix + "/add",
|
updateUrl: prefix + "/edit/{id}",
|
removeUrl: prefix + "/remove",
|
importUrl: prefix + "/importData",
|
importTemplateUrl: prefix + "/importTemplate",
|
exportUrl: prefix + "/export",
|
sortName: "createTime",
|
modalName: "工作人员",
|
columns: [{
|
checkbox: true
|
},
|
{
|
field: 'userName',
|
title: '用户名称'
|
},
|
// {
|
// field: 'organizationName',
|
// title: '组织名称'
|
// },
|
{
|
field: 'deptName',
|
title: '部门名称'
|
},
|
// {
|
// field: 'enable',
|
// title: '是否激活',
|
// formatter: function(value, item, index) {
|
// if (item.enable == "0" ){
|
// return '<span class="label label-success">已激活</span>';
|
// }
|
// else if (item.enable =="1") {
|
// return '<span class="label label-primary">未激活</span>';
|
// }
|
// }
|
// },
|
{
|
title: '操作',
|
align: 'center',
|
formatter: function(value, row, index) {
|
var actions = [];
|
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="addPeople(\'' + row.id + '\')">添加</a>');
|
return actions.join('');
|
}
|
}]
|
};
|
$.table.init(options);
|
}
|
|
function queryDeptTree()
|
{
|
var url = ctx + "station/dept/treeData";
|
var options = {
|
url: url,
|
expandLevel: 2,
|
onClick : zOnClick
|
};
|
$.tree.init(options);
|
|
function zOnClick(event, treeId, treeNode) {
|
$("#deptId").val(treeNode.id);
|
$("#deptParentId").val(treeNode.pId);
|
//$.table.search();
|
$('#bootstrap-table').bootstrapTable("refresh");
|
}
|
}
|
|
$('#btnExpand').click(function() {
|
$._tree.expandAll(true);
|
$(this).hide();
|
$('#btnCollapse').show();
|
});
|
|
$('#btnCollapse').click(function() {
|
$._tree.expandAll(false);
|
$(this).hide();
|
$('#btnExpand').show();
|
});
|
|
$('#btnRefresh').click(function() {
|
queryDeptTree();
|
});
|
|
/* 用户状态显示 */
|
function statusTools(row) {
|
if (row.status == 1) {
|
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
|
} else {
|
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
|
}
|
}
|
|
var prefix2 = ctx + "station/member";
|
|
function addPeople(id){
|
$.operate.post(prefix2+"/add",{teamId:parent.$('#teamId').val(),userId:id},function resq(res) {
|
if(res.code==500){
|
$.modal.alertSuccess("已经添加了")
|
}
|
});
|
$('#bootstrap-table2').bootstrapTable("refresh");
|
}
|
|
// 查询组成员
|
function queryTeamUserList() {
|
var options = {
|
id:'bootstrap-table2',
|
url: prefix2 + "/list",
|
removeUrl: prefix2 + "/remove",
|
sortName: "createTime",
|
sortOrder:'desc',
|
modalName: "组人员",
|
columns: [
|
{
|
field: 'userName',
|
title: '用户名称'
|
},
|
{
|
title: '操作',
|
align: 'center',
|
formatter: function(value, row, index) {
|
var actions = [];
|
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="updateStatus(\'' + row.id + '\')">删除</a>');
|
return actions.join('');
|
}
|
}]
|
};
|
$.table.init(options);
|
// $.table.search("user-form2","teamId");
|
}
|
|
function submitHandler(){
|
parent.location.reload();
|
$.modal.close();
|
}
|
|
function updateStatus(id) {
|
$.operate.post(prefix2+"/updateStatus",{id:id});
|
}
|
|
function adds() {
|
var rows = $("#bootstrap-table").bootstrapTable('getSelections');
|
$(rows).each(function() {// 通过获得别选中的来进行遍历
|
$.operate.post(prefix2+"/add",{teamId:parent.$('#teamId').val(),userId:this.id},function resq(res) {
|
if(res.code==500){
|
$.modal.alertSuccess("已经添加了")
|
}
|
});
|
});
|
$('#bootstrap-table2').bootstrapTable("refresh");
|
}
|
|
</script>
|
|
</body>
|
</html>
|