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.
184 lines
6.5 KiB
184 lines
6.5 KiB
<#import "../master.ftl" as master>
|
|
<@master.layout>
|
|
|
|
<style>
|
|
#fm label {
|
|
width: 150px;
|
|
}
|
|
</style>
|
|
|
|
<div class="page-header">
|
|
<h3>Scan Jobs</h3>
|
|
</div>
|
|
|
|
<table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
|
|
data-options="pagination: true, showFooter: true, singleSelect:true, fitColumns:true , url:'/scanning/jobs/all',method:'get',pageSize:20,toolbar:'#tb'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'jobId',width:100">Scanning machine number</th>
|
|
<#--<th data-options="field:'createdBy',width:80,align:'left'">Created By</th>-->
|
|
<#--<th data-options="field:'createdDate',width:150,align:'center',formatter:formatDateTime">Created Time</th>-->
|
|
<th data-options="field:'jdbcUrl',width:400">Database url</th>
|
|
<th data-options="field:'scanType',width:400,formatter:passageway">Scanning channel</th>
|
|
<th data-options="field:'id',width:100,editor:'textbox',formatter:formatAction">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
|
|
<div id="tb" style="padding:10px 5px;display: none;">
|
|
<div>
|
|
<#--任务号: <input class="easyui-textbox" id="jobId" style="width:110px">-->
|
|
<#--创建日期: <input class="easyui-datebox" id="createdDateFrom" style="width:100px">-->
|
|
<#--到: <input class="easyui-datebox" id="createdDateTo" style="width:100px">-->
|
|
<#--<a href="#nowhere" id="queryLink" class="easyui-linkbutton" iconCls="icon-search">Search</a>-->
|
|
<#-- -->
|
|
<#if currentUser.isAdmin>
|
|
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newJob()">New scanning machine</a>
|
|
</#if>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div id="dlg" class="easyui-dialog" style="width:600px;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="dlgJobId" name="jobId" class="easyui-textbox" required="true" label="Scanning machine number:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input name="jdbcUrl" class="easyui-textbox" required="true" label="Database url" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input name="jdbcUsername" class="easyui-textbox" required="true" label="数据库用户:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input name="jdbcPassword" class="easyui-textbox" required="true" label="数据库密码:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<select class="easyui-combobox" name="scanType" required="true" label="Scanning channel" style="width:100%">
|
|
<option value="h">High Speed</option>
|
|
<option value="l">Low Speed</option>
|
|
</select>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div id="dlg-buttons" style="display: none;">
|
|
<a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveJobInfo()" 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: {
|
|
jobId: $("#jobId").val(),
|
|
createdDateFrom: $("#createdDateFrom").val(),
|
|
createdDateTo: $("#createdDateTo").val()
|
|
}
|
|
});
|
|
});
|
|
|
|
function passageway(value,row){
|
|
if("l"==value){
|
|
return "Low Speed";
|
|
}else if("h"==value){
|
|
return "High Speed";
|
|
}
|
|
return "";
|
|
}
|
|
function formatAction(value,row){
|
|
var a = "<a href='/scanning/jobdtls/"+row.id+"'>Scanning</a>";
|
|
// if(!row.status || row.status == "Created") {
|
|
<#if currentUser.isAdmin>
|
|
a = a + " | <a href='javascript:editJob("+row.id+");'>Edit</a>";
|
|
a = a + " | <a href='javascript:delJob("+row.id+");'>Delete</a>";
|
|
</#if>
|
|
// }
|
|
return a;
|
|
}
|
|
|
|
|
|
var url;
|
|
function newJob(){
|
|
// $.post("/scanning/jobs/add", {}, function (ret) {
|
|
// if (ret.success){
|
|
// $('#dg').datagrid('reload'); // reload the user data
|
|
// }
|
|
// })
|
|
$('#dlg').dialog('open').dialog('center').dialog('setTitle','New scanning machine');
|
|
$('#fm').form('clear');
|
|
url = '/scanning/jobs/add';
|
|
}
|
|
|
|
function editJob(){
|
|
var row = $('#dg').datagrid('getSelected');
|
|
if (row){
|
|
$('#dlg').dialog('open').dialog('center').dialog('setTitle','Edit Scanning machine');
|
|
$('#fm').form('load',row);
|
|
url = '/scanning/jobs/'+row.id+'/update';
|
|
}else{
|
|
$.messager.alert('Warning','Please select a row.', 'warning');
|
|
}
|
|
}
|
|
|
|
function delJob(id) {
|
|
$.messager.confirm('Confirm', 'Are you sure to delete the data?', function (r) {
|
|
if (r) {
|
|
$.post('/scanning/jobs/del', {id: id}, function (result) {
|
|
if (result.success) {
|
|
$('#dg').datagrid('reload');
|
|
$.messager.alert('Success', 'Successfully', 'info');
|
|
} else {
|
|
$.messager.alert('Error', result.errorMsg, 'error');
|
|
}
|
|
}, 'json');
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
var delay = (function(){
|
|
var timer = 0;
|
|
return function(callback, ms){
|
|
clearTimeout (timer);
|
|
timer = setTimeout(callback, ms);
|
|
};
|
|
})();
|
|
|
|
function saveJobInfo(){
|
|
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);
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
</@master.layout>
|
|
|