safesite/safesite/templates/getusers.html

176 lines
8.7 KiB
HTML

<div class="easyui-layout" style="width:100%;height:100%">
<div data-options="region:'center',border:false">
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'center',border:false" title="按部门选择" style="height:50%;">
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'west',split:true,border:false" style="width:30%;height:100%;">
<ul id="ddpartree"></ul>
</div>
<div data-options="region:'center',split:true,border:false" style="height:100%">
<div id="usersearchbar" style="padding:5px;height:auto">
<label>姓名</label><input name='name' id="sname" style="width:auto;" class="easyui-textbox"/>
<a id="usersearch" onclick="usersearch()" class="easyui-linkbutton" iconCls='fa-search' plain=true>查询</a>
</div>
<table id="ddusertable" style="width:100%;height:100%;" data-options="
rownumbers:true,
singleSelect:false,
striped: true,
url:'getuser?a=datagrid',
method:'get',
fitColumns:true,
toolbar:'#usersearchbar'">
<thead>
<tr>
<th field="ck" checkbox="true" width="10%"></th>
<th data-options="field:'userid',hidden:true">用户ID</th>
<th data-options="field:'empid',width:'20%',align:'right'">工号</th>
<th data-options="field:'name',width:'20%',align:'right'">姓名</th>
<th data-options="field:'ubelongpart__partname',width:'30%',align:'right'">所属部门</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<div data-options="region:'south',collapsible:false,border:false" title="按用户组选择" style="height:50%;">
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'west',split:true,border:false" id='groupdiv' style="width:30%;height:100%;">
<table id="ddgrouptable" style="height:100%;"></table>
</div>
<div data-options="region:'center',split:true,border:false" id='guserdiv' style="height:100%;">
<table id="ddgusertable" style="height:100%;"></table>
</div>
</div>
</div>
</div>
</div>
<div data-options="region:'east',collapsible:false,border:false" title="已选人员" style="width:25%;height:92%;">
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'center'" style="height:92%">
<ol id="yxry" style="list-style-type:decimal"></ol>
</div>
<div data-options="region:'south'" style="height:8%">
<a href="javascript:void(0)" iconCls="fa-check" class="easyui-linkbutton" onclick="GetUsersChecked()"
style="width:auto;height:100%" id="submitform">提交</a>
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closed2Form()" style="width:auto;height:100%">取消</a>
</div>
</div>
</div>
<script>
$('#ddpartree').tree({
url: 'parthandle?a=tree',
animate: true,
ansyc: false,
loadFilter: function (rows) {
return convert(rows);
},
formatter: function (node) {
var s = node.text;
if (node.children) {
s += '&nbsp;<span style=\'color:blue\'>(' + node.children.length + ')</span>';
}
return s;
},
onSelect: function (row) {
$("#ddusertable").datagrid({
url: 'getuser?partid=' + row.id + '&a=datagrid',
});
}
});
$('#ddgusertable').datagrid({
rownumbers: true,
singleSelect: false,
striped: true,
method: 'get',
fitColumns: true,
columns: [[
{ field: 'ck', checkbox: true , width: '10%'},
{ field: 'userid', title: '用户组ID', hidden: true },
{ field: 'empid', title: '工号', width: '20%' },
{ field: 'name', title: '名字', width: '20%' },
{ field: 'ubelongpart__partname', title: '部门', width: '30%' },
]],
onSelect: function (index, item) {
var id = item.userid;
if (document.getElementById(id) == null) { $("#yxry").append('<li class="auser" style="margin-top:5px" id="' + item.userid + '" name="' + item.name + '">' + item.name + '<span> </span><a href="#" onclick="removep(this)">移除</a></li>'); }
},
onUnselect: function (index, item) {
var x = document.getElementById(item.userid);
x.remove();
},
onSelectAll: function (rows) {
$.each(rows, function (index, item) {
var x = document.getElementById(item.userid);
if (x == null) { $("#yxry").append('<li class="auser" style="margin-top:5px" id="' + item.userid + '" name="' + item.name + '">' + item.name + '<span> </span><a href="#" onclick="removep(this)">移除</a></li>'); }
});
},
onUnselectAll: function (rows) {
$.each(rows, function (index, item) {
var x = document.getElementById(item.userid);
x.remove();
});
}
});
$('#ddgrouptable').datagrid({
url: 'grouphandle?a=list',
rownumbers: true,
singleSelect: true,
striped: true,
method: 'get',
columns: [[
{ field: 'groupid', title: '用户组ID', hidden: true },
{ field: 'groupname', title: '名称', width: 100 },
]],
onClickRow: function (index, row) {
$("#ddgusertable").datagrid({
url: 'getuser?groupid=' + row.groupid + '&a=datagrid',
});
}
});
function GetUsersChecked() {
var a = GetQueryString2("a");
var userids = [];
var usernames = [];
$(".auser").each(function () {
userids.push($(this).attr("id"));
usernames.push($(this).attr("name"));
});
top.$('#in').attr('value', userids);
top.$('#in').attr('show', usernames);
top.$('#in').attr('total', userids.length);
top.$('#in').attr('target', a);
//console.log(top.$('#in').attr('value'))
//top.$('#getb').click();
aaa(a);
$('#userdd').dialog("close");
}
$("#ddusertable").datagrid({
onSelect: function (index, item) {
var id = item.userid;
if (document.getElementById(id) == null) { $("#yxry").append('<li class="auser" style="margin-top:5px" id="' + item.userid + '" name="' + item.name + '">' + item.name + '<span> </span><a href="#" onclick="removep(this)">移除</a></li>'); }
},
onUnselect: function (index, item) {
var x = document.getElementById(item.userid);
x.remove();
},
onSelectAll: function (rows) {
$.each(rows, function (index, item) {
var x = document.getElementById(item.userid);
if (x == null) { $("#yxry").append('<li class="auser" style="margin-top:5px" id="' + item.userid + '" name="' + item.name + '">' + item.name + '<span> </span><a href="#" onclick="removep(this)">移除</a></li>'); }
});
},
onUnselectAll: function (rows) {
$.each(rows, function (index, item) {
var x = document.getElementById(item.userid);
x.remove();
});
}
});
function usersearch(){
$('#ddusertable').datagrid({url:'getuser?a=datagrid&name='+$('#sname').val()});
}
</script>
</div>