You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
229 lines
7.8 KiB
229 lines
7.8 KiB
<#import "../master.ftl" as master>
|
|
<@master.layout>
|
|
<style>
|
|
#fm label {
|
|
width: 150px;
|
|
}
|
|
</style>
|
|
|
|
<div class="page-header">
|
|
<h3>User Management</h3>
|
|
</div>
|
|
|
|
<table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
|
|
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , url:'/user/json',method:'get',pageSize:20,toolbar:'#tb'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'username', width:100">User ID</th>
|
|
<th data-options="field:'display', width:100">User Name</th>
|
|
<th data-options="field:'authorities', width:150">Permission Set</th>
|
|
<th data-options="field:'scanMachine', width:100">Scanning Machine</th>
|
|
<th data-options="field:'enabled', width:50,formatter:formatStatus">User Status</th>
|
|
<th data-options="field:'id',width:60,align:'center',formatter:formatAction">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
|
|
<div id="tb" style="padding:10px 5px;display: none;">
|
|
<div>
|
|
User ID: <input class="easyui-textbox" id="username" style="width:110px">
|
|
<a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a>
|
|
|
|
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newUser()">New</a>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div id="dlg" class="easyui-dialog" style="width:500px;display: none;"
|
|
closed="true" buttons="#dlg-buttons">
|
|
<form id="fm" method="post" novalidate style="margin:0;padding:20px 20px">
|
|
<div style="margin-bottom:10px">
|
|
<input id="txtUsername" name="username" class="easyui-textbox" required="true" label="User ID:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input name="display" class="easyui-textbox" required="true" label="Name:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="pwd" name="password" class="easyui-passwordbox" required="true" label="Password:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<select id="selEnabled" class="easyui-combobox" name="enabled" label="Active status:" style="width:100%">
|
|
<option value="1">Activate</option>
|
|
<option value="0">Disabled</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div style="margin-bottom:10px">
|
|
|
|
<select class="easyui-combobox" name="authorities" required multiple="true" label="Access right:" style="width:100%;">
|
|
<option>prepress</option>
|
|
<option>indigo</option>
|
|
<option>thermal</option>
|
|
<option>cut</option>
|
|
<option>abg</option>
|
|
<option>aoi</option>
|
|
<option>rewind</option>
|
|
<option>scanning</option>
|
|
<option>cqc</option>
|
|
<option>receiving</option>
|
|
<option>dispatch</option>
|
|
<option>query</option>
|
|
<option>counting</option>
|
|
<option>switch_order</option>
|
|
<option>super_leader</option>
|
|
<option>deleteFinalRoll</option>
|
|
<option>closeorder</option>
|
|
<option>freezeAndThaw</option>
|
|
<option>printer</option>
|
|
<option>boxManage</option>
|
|
<option>shipPlan_update</option>
|
|
<option>emailConfig</option>
|
|
<option>refreshRollStatus</option>
|
|
<option>printer_roll</option>
|
|
<option>basic_info</option>
|
|
<!-- <option>delete-serials</option> -->
|
|
</select>
|
|
</div>
|
|
|
|
<div style="margin-bottom:10px">
|
|
<input id="scanMachine" class="easyui-combobox" name="scanMachine" label="Scanning machine:" style="width:100%" data-options="
|
|
valueField: 'jobId',
|
|
textField: 'jobId',
|
|
url: '/user/scanMachine'
|
|
">
|
|
</div>
|
|
|
|
|
|
</form>
|
|
</div>
|
|
<div id="dlg-buttons" style="display: none;">
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveUser()" style="width:90px">Save</a>
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
|
$(window).resize(function () {
|
|
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 20});
|
|
});
|
|
|
|
$(function () {
|
|
$(window).resize();
|
|
});
|
|
|
|
function formatAction(value, row){
|
|
return "<a href='javascript:editUser()'>Edit</a> | <a href='javascript:removeUser()'>Delete</a>";
|
|
}
|
|
|
|
function formatStatus(value, row){
|
|
return value == 1 ? "Activate" : "Disabled";
|
|
}
|
|
|
|
$("#queryLink").click(function(){
|
|
var dg = $('#dg').datagrid({
|
|
queryParams: {
|
|
username: $.trim($("#username").val())
|
|
}
|
|
});
|
|
});
|
|
|
|
var url;
|
|
function newUser(){
|
|
$('#dlg').dialog('open').dialog('center').dialog('setTitle','Create a new user');
|
|
$("#txtUsername").textbox({"disabled" : false});
|
|
|
|
$("#pwd").passwordbox({
|
|
prompt: '',
|
|
required: true
|
|
});
|
|
$('#fm').form('clear');
|
|
$('#selEnabled').combobox('setValue', '1');
|
|
|
|
url = '/user/add';
|
|
}
|
|
|
|
function editUser(){
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row){
|
|
$('#dlg').dialog('open').dialog('center').dialog('setTitle','Modify User Info.');
|
|
$('#fm').form('load',row);
|
|
$("#txtUsername").textbox({"disabled" : true});
|
|
$("#pwd").passwordbox({
|
|
prompt: 'Keep null if don\'t modify password',
|
|
required: false
|
|
});
|
|
url = '/user/'+row.id+'/update';
|
|
}else{
|
|
$.messager.alert('Warning','Please select user.', 'warning');
|
|
}
|
|
}
|
|
|
|
var delay = (function(){
|
|
var timer = 0;
|
|
return function(callback, ms){
|
|
clearTimeout (timer);
|
|
timer = setTimeout(callback, ms);
|
|
};
|
|
})();
|
|
|
|
function saveUser(){
|
|
delay(function(){
|
|
$('#fm').form('submit',{
|
|
url: url,
|
|
onSubmit: function(){
|
|
return $(this).form('validate');
|
|
},
|
|
success: function(result){
|
|
var result = eval("("+result+")");
|
|
if (result.errorMsg){
|
|
$.messager.alert('error',result.errorMsg, 'error');
|
|
} else {
|
|
$('#dlg').dialog('close'); // close the dialog
|
|
$('#dg').datagrid('reload'); // reload the user data
|
|
}
|
|
}
|
|
});
|
|
}, 500);
|
|
}
|
|
|
|
function removeUser(){
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row){
|
|
$.messager.confirm('Confirm','Are you sure to delete user <b>'+row.username+'</b> ?',function(r){
|
|
if (r){
|
|
$.post('/user/'+row.id+'/delete',{},function(result){
|
|
if (result.success){
|
|
$('#dg').datagrid('reload'); // reload the user data
|
|
} else {
|
|
$.messager.alert('error',result.errorMsg, 'error');
|
|
}
|
|
},'json');
|
|
}
|
|
});
|
|
}else{
|
|
$.messager.alert('Warning','Please select user', 'warning');
|
|
}
|
|
}
|
|
|
|
function setupAuthorities(){
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row) {
|
|
alert(row.username);
|
|
}
|
|
}
|
|
|
|
function setupScan(){
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row) {
|
|
alert(row.username);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
</@master.layout>
|
|
|