|
|
|
@ -1,13 +1,153 @@ |
|
|
|
|
$(function() { |
|
|
|
|
|
|
|
|
|
// remove
|
|
|
|
|
$('.remove').on('click', function(){ |
|
|
|
|
var id = $(this).attr('id'); |
|
|
|
|
// init date tables
|
|
|
|
|
var jobGroupTable = $("#jobgroup_list").dataTable({ |
|
|
|
|
"deferRender": true, |
|
|
|
|
"processing" : true, |
|
|
|
|
"serverSide": true, |
|
|
|
|
"ajax": { |
|
|
|
|
url: base_url + "/jobgroup/pageList", |
|
|
|
|
type:"post", |
|
|
|
|
data : function ( d ) { |
|
|
|
|
var obj = {}; |
|
|
|
|
obj.appName = $('#appName').val(); |
|
|
|
|
obj.title = $('#title').val(); |
|
|
|
|
obj.start = d.start; |
|
|
|
|
obj.length = d.length; |
|
|
|
|
return obj; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
"searching": false, |
|
|
|
|
"ordering": false, |
|
|
|
|
//"scrollX": true, // scroll x,close self-adaption
|
|
|
|
|
"columns": [ |
|
|
|
|
{ |
|
|
|
|
"data": 'id', |
|
|
|
|
"visible" : false |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"data": 'appName', |
|
|
|
|
"visible" : true, |
|
|
|
|
"width":'30%' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"data": 'title', |
|
|
|
|
"visible" : true, |
|
|
|
|
"width":'30%' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"data": 'addressType', |
|
|
|
|
"width":'10%', |
|
|
|
|
"visible" : true, |
|
|
|
|
"render": function ( data, type, row ) { |
|
|
|
|
if (row.addressType == 0) { |
|
|
|
|
return I18n.jobgroup_field_addressType_0; |
|
|
|
|
} else { |
|
|
|
|
return I18n.jobgroup_field_addressType_1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"data": 'registryList', |
|
|
|
|
"width":'15%', |
|
|
|
|
"visible" : true, |
|
|
|
|
"render": function ( data, type, row ) { |
|
|
|
|
return row.registryList |
|
|
|
|
?'<a class="show_registryList" href="javascript:;" _id="'+ row.id +'" >' |
|
|
|
|
+ I18n.system_show +' ( ' + row.registryList.length+ ' )</a>' |
|
|
|
|
:I18n.system_empty; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"data": I18n.system_opt , |
|
|
|
|
"width":'15%', |
|
|
|
|
"render": function ( data, type, row ) { |
|
|
|
|
return function(){ |
|
|
|
|
// data
|
|
|
|
|
tableData['key'+row.id] = row; |
|
|
|
|
|
|
|
|
|
// opt
|
|
|
|
|
var html = '<div class="btn-group">\n' + |
|
|
|
|
' <button type="button" class="btn btn-primary btn-sm">'+ I18n.system_opt +'</button>\n' + |
|
|
|
|
' <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">\n' + |
|
|
|
|
' <span class="caret"></span>\n' + |
|
|
|
|
' <span class="sr-only">Toggle Dropdown</span>\n' + |
|
|
|
|
' </button>\n' + |
|
|
|
|
' <ul class="dropdown-menu" role="menu" _id="'+ row.id +'" >\n' + |
|
|
|
|
' <li><a href="javascript:void(0);" class="opt_edit" >'+ I18n.system_opt_edit +'</a></li>\n' + |
|
|
|
|
' <li><a href="javascript:void(0);" class="opt_del" >'+ I18n.system_opt_del +'</a></li>\n' + |
|
|
|
|
' </ul>\n' + |
|
|
|
|
' </div>'; |
|
|
|
|
|
|
|
|
|
return html; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
"language" : { |
|
|
|
|
"sProcessing" : I18n.dataTable_sProcessing , |
|
|
|
|
"sLengthMenu" : I18n.dataTable_sLengthMenu , |
|
|
|
|
"sZeroRecords" : I18n.dataTable_sZeroRecords , |
|
|
|
|
"sInfo" : I18n.dataTable_sInfo , |
|
|
|
|
"sInfoEmpty" : I18n.dataTable_sInfoEmpty , |
|
|
|
|
"sInfoFiltered" : I18n.dataTable_sInfoFiltered , |
|
|
|
|
"sInfoPostFix" : "", |
|
|
|
|
"sSearch" : I18n.dataTable_sSearch , |
|
|
|
|
"sUrl" : "", |
|
|
|
|
"sEmptyTable" : I18n.dataTable_sEmptyTable , |
|
|
|
|
"sLoadingRecords" : I18n.dataTable_sLoadingRecords , |
|
|
|
|
"sInfoThousands" : ",", |
|
|
|
|
"oPaginate" : { |
|
|
|
|
"sFirst" : I18n.dataTable_sFirst , |
|
|
|
|
"sPrevious" : I18n.dataTable_sPrevious , |
|
|
|
|
"sNext" : I18n.dataTable_sNext , |
|
|
|
|
"sLast" : I18n.dataTable_sLast |
|
|
|
|
}, |
|
|
|
|
"oAria" : { |
|
|
|
|
"sSortAscending" : I18n.dataTable_sSortAscending , |
|
|
|
|
"sSortDescending" : I18n.dataTable_sSortDescending |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// table data
|
|
|
|
|
var tableData = {}; |
|
|
|
|
|
|
|
|
|
// search btn
|
|
|
|
|
$('#searchBtn').on('click', function(){ |
|
|
|
|
jobGroupTable.fnDraw(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// job registryinfo
|
|
|
|
|
$("#jobgroup_list").on('click', '.show_registryList',function() { |
|
|
|
|
var id = $(this).attr("_id"); |
|
|
|
|
var row = tableData['key'+id]; |
|
|
|
|
|
|
|
|
|
var html = '<center>'; |
|
|
|
|
if (row.registryList) { |
|
|
|
|
for (var index in row.registryList) { |
|
|
|
|
html += '<span class="badge bg-green" >' + row.registryList[index] + '</span><br>'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
html += '</center>'; |
|
|
|
|
|
|
|
|
|
layer.open({ |
|
|
|
|
title: I18n.jobinfo_opt_registryinfo , |
|
|
|
|
btn: [ I18n.system_ok ], |
|
|
|
|
content: html |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// opt_del
|
|
|
|
|
$("#jobgroup_list").on('click', '.opt_del',function() { |
|
|
|
|
var id = $(this).parents('ul').attr("_id"); |
|
|
|
|
|
|
|
|
|
layer.confirm( (I18n.system_ok + I18n.jobgroup_del + '?') , { |
|
|
|
|
icon: 3, |
|
|
|
|
title: I18n.system_tips , |
|
|
|
|
btn: [ I18n.system_ok, I18n.system_cancel ] |
|
|
|
|
btn: [ I18n.system_ok, I18n.system_cancel ] |
|
|
|
|
}, function(index){ |
|
|
|
|
layer.close(index); |
|
|
|
|
|
|
|
|
@ -20,17 +160,17 @@ $(function() { |
|
|
|
|
if (data.code == 200) { |
|
|
|
|
layer.open({ |
|
|
|
|
title: I18n.system_tips , |
|
|
|
|
btn: [ I18n.system_ok ], |
|
|
|
|
btn: [ I18n.system_ok ], |
|
|
|
|
content: (I18n.jobgroup_del + I18n.system_success), |
|
|
|
|
icon: '1', |
|
|
|
|
end: function(layero, index){ |
|
|
|
|
window.location.reload(); |
|
|
|
|
jobGroupTable.fnDraw(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
layer.open({ |
|
|
|
|
title: I18n.system_tips, |
|
|
|
|
btn: [ I18n.system_ok ], |
|
|
|
|
btn: [ I18n.system_ok ], |
|
|
|
|
content: (data.msg || (I18n.jobgroup_del + I18n.system_fail)), |
|
|
|
|
icon: '2' |
|
|
|
|
}); |
|
|
|
@ -38,9 +178,9 @@ $(function() { |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// jquery.validate “low letters start, limit contants、 letters、numbers and line-through.”
|
|
|
|
|
jQuery.validator.addMethod("myValid01", function(value, element) { |
|
|
|
|
var length = value.length; |
|
|
|
@ -64,11 +204,6 @@ $(function() { |
|
|
|
|
title : { |
|
|
|
|
required : true, |
|
|
|
|
rangelength:[4, 12] |
|
|
|
|
}, |
|
|
|
|
order : { |
|
|
|
|
required : true, |
|
|
|
|
digits:true, |
|
|
|
|
range:[1,1000] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
messages : { |
|
|
|
@ -80,11 +215,6 @@ $(function() { |
|
|
|
|
title : { |
|
|
|
|
required : I18n.system_please_input + I18n.jobgroup_field_title , |
|
|
|
|
rangelength: I18n.jobgroup_field_title_length |
|
|
|
|
}, |
|
|
|
|
order : { |
|
|
|
|
required : I18n.system_please_input + I18n.jobgroup_field_order , |
|
|
|
|
digits: I18n.jobgroup_field_order_digits , |
|
|
|
|
range: I18n.jobgroup_field_orderrange |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
highlight : function(element) { |
|
|
|
@ -107,7 +237,7 @@ $(function() { |
|
|
|
|
content: I18n.system_add_suc , |
|
|
|
|
icon: '1', |
|
|
|
|
end: function(layero, index){ |
|
|
|
|
window.location.reload(); |
|
|
|
|
jobGroupTable.fnDraw(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
@ -141,20 +271,20 @@ $(function() { |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// update
|
|
|
|
|
$('.update').on('click', function(){ |
|
|
|
|
$("#updateModal .form input[name='id']").val($(this).attr("id")); |
|
|
|
|
$("#updateModal .form input[name='appName']").val($(this).attr("appName")); |
|
|
|
|
$("#updateModal .form input[name='title']").val($(this).attr("title")); |
|
|
|
|
$("#updateModal .form input[name='order']").val($(this).attr("order")); |
|
|
|
|
// opt_edit
|
|
|
|
|
$("#jobgroup_list").on('click', '.opt_edit',function() { |
|
|
|
|
var id = $(this).parents('ul').attr("_id"); |
|
|
|
|
var row = tableData['key'+id]; |
|
|
|
|
|
|
|
|
|
$("#updateModal .form input[name='id']").val( row.id ); |
|
|
|
|
$("#updateModal .form input[name='appName']").val( row.appName ); |
|
|
|
|
$("#updateModal .form input[name='title']").val( row.title ); |
|
|
|
|
|
|
|
|
|
// 注册方式
|
|
|
|
|
var addressType = $(this).attr("addressType"); |
|
|
|
|
$("#updateModal .form input[name='addressType']").removeAttr('checked'); |
|
|
|
|
//$("#updateModal .form input[name='addressType'][value='"+ addressType +"']").attr('checked', 'true');
|
|
|
|
|
$("#updateModal .form input[name='addressType'][value='"+ addressType +"']").click(); |
|
|
|
|
$("#updateModal .form input[name='addressType'][value='"+ row.addressType +"']").click(); |
|
|
|
|
// 机器地址
|
|
|
|
|
$("#updateModal .form textarea[name='addressList']").val($(this).attr("addressList")); |
|
|
|
|
$("#updateModal .form textarea[name='addressList']").val( row.addressList ); |
|
|
|
|
|
|
|
|
|
$('#updateModal').modal({backdrop: false, keyboard: false}).modal('show'); |
|
|
|
|
}); |
|
|
|
@ -171,11 +301,6 @@ $(function() { |
|
|
|
|
title : { |
|
|
|
|
required : true, |
|
|
|
|
rangelength:[4, 12] |
|
|
|
|
}, |
|
|
|
|
order : { |
|
|
|
|
required : true, |
|
|
|
|
digits:true, |
|
|
|
|
range:[1,1000] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
messages : { |
|
|
|
@ -187,11 +312,6 @@ $(function() { |
|
|
|
|
title : { |
|
|
|
|
required : I18n.system_please_input + I18n.jobgroup_field_title , |
|
|
|
|
rangelength: I18n.jobgroup_field_title_length |
|
|
|
|
}, |
|
|
|
|
order : { |
|
|
|
|
required : I18n.system_please_input + I18n.jobgroup_field_order , |
|
|
|
|
digits: I18n.jobgroup_field_order_digits , |
|
|
|
|
range: I18n.jobgroup_field_orderrange |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
highlight : function(element) { |
|
|
|
@ -207,7 +327,7 @@ $(function() { |
|
|
|
|
submitHandler : function(form) { |
|
|
|
|
$.post(base_url + "/jobgroup/update", $("#updateModal .form").serialize(), function(data, status) { |
|
|
|
|
if (data.code == "200") { |
|
|
|
|
$('#addModal').modal('hide'); |
|
|
|
|
$('#updateModal').modal('hide'); |
|
|
|
|
|
|
|
|
|
layer.open({ |
|
|
|
|
title: I18n.system_tips , |
|
|
|
@ -215,7 +335,7 @@ $(function() { |
|
|
|
|
content: I18n.system_update_suc , |
|
|
|
|
icon: '1', |
|
|
|
|
end: function(layero, index){ |
|
|
|
|
window.location.reload(); |
|
|
|
|
jobGroupTable.fnDraw(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|