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.
238 lines
7.7 KiB
238 lines
7.7 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/getUserDataByCon',method:'POST',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:'machineName', width:100">Linked Scanning Machine</th>
|
|
<th data-options="field:'status', 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="addUserModal()">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="user_id" name="id" class="easyui-textbox">
|
|
<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="User 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="user_status" class="easyui-combobox" name="status" label="Active:" style="width:100%">
|
|
<option value="Y">Activate</option>
|
|
<option value="N">Disabled</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div style="margin-bottom:10px">
|
|
|
|
<select class="easyui-combobox" name="authorities" required multiple="true" label="Authority:" style="width:100%;">
|
|
<option>prepress</option>
|
|
<option>basic_info</option>
|
|
<option>indigo</option>
|
|
<option>AOI</option>
|
|
<option>scan_stock</option>
|
|
<option>Query</option>
|
|
<option>inventoryTasks</option>
|
|
<option>delivery</option>
|
|
<option>team_auth</option>
|
|
<option>switch_order</option>
|
|
<option>inventoryTasks</option>
|
|
</select>
|
|
</div>
|
|
|
|
<#-- <div style="margin-bottom:10px">-->
|
|
<#-- <input id="user_machine_name" class="easyui-combobox" name="machineName" label="Linked Scaning Machine:" style="width:100%" data-options="-->
|
|
<#-- valueField: 'machineName',-->
|
|
<#-- textField: 'machineName',-->
|
|
<#-- url: '/user/getVariousMachine',-->
|
|
<#-- onLoadSuccess: function(data) {-->
|
|
<#-- if(data.success){-->
|
|
<#-- let machines = data.rows; -->
|
|
<#-- $('#user_machine_name').combobox('loadData', data.rows);-->
|
|
<#-- }-->
|
|
<#-- }-->
|
|
<#-- ">-->
|
|
<#-- </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();
|
|
});
|
|
|
|
//首页查询
|
|
$("#queryLink").click(function(){
|
|
var dg = $('#dg').datagrid({
|
|
queryParams: {
|
|
username: $("#username").val()
|
|
}
|
|
});
|
|
});
|
|
|
|
//功能菜单
|
|
function formatAction(value, row){
|
|
return "<a href='javascript:editUserModal()'>修改</a> | <a href='javascript:deleteUser()'>Delete</a>";
|
|
}
|
|
|
|
//用户信息状态设置
|
|
function formatStatus(value, row){
|
|
if('Y' == value){
|
|
return "Activate";
|
|
}else{
|
|
return "Disabled";
|
|
}
|
|
}
|
|
|
|
//新增用户modal
|
|
var url;
|
|
function addUserModal(){
|
|
$('#dlg').dialog('open').dialog('center').dialog('setTitle','Create a new user');
|
|
$("#txtUsername").textbox({"disabled" : false});
|
|
$("#pwd").passwordbox({
|
|
prompt: '',
|
|
required: true
|
|
});
|
|
$('#fm').form('clear');
|
|
$("#user_id").textbox("setValue", 0);
|
|
$('#user_id').next().hide();
|
|
$('#user_status').combobox('setValue', 'Y');
|
|
url = '/user/addUser';
|
|
}
|
|
|
|
//修改用户modal
|
|
function editUserModal(){
|
|
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
|
|
});
|
|
$('#user_id').next().hide();
|
|
url = '/user/updateUser';
|
|
}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 deleteUser(){
|
|
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/deleteUserById',{'userId': row.id},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>
|
|
|