admin-role.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. $(function () {
  2. });
  3. /*
  4. 参数解释:
  5. title 标题
  6. url 请求的url
  7. id 需要操作的数据id
  8. w 弹出层宽度(缺省调默认值)
  9. h 弹出层高度(缺省调默认值)
  10. */
  11. /*管理员-角色-添加*/
  12. function admin_role_add(title,url,w,h){
  13. layer_show(title,url,w,h);
  14. }
  15. /*管理员-角色-删除*/
  16. function admin_role_del(obj, url){
  17. layer.confirm('确认要删除吗?',function(index){
  18. //此处请求后台程序,下方是成功后的前台处理……
  19. $.ajax({
  20. type:"DELETE",
  21. dataType:"json",
  22. url: url,
  23. data:{
  24. "timestamp":new Date().getTime()
  25. },
  26. statusCode: {
  27. 200 : function(data){
  28. $(obj).parents("tr").remove();
  29. var total = $("#total").text();
  30. $("#total").text(parseInt(total)-1);
  31. succeedMessage(data.responseText);
  32. },
  33. 403: function () {
  34. errorMessage("该角色下有用户存在,不允许删除!");
  35. },
  36. 404 : function(data){
  37. errorMessage(data.responseText);
  38. },
  39. 500 : function(){
  40. errorMessage('系统错误!');
  41. }
  42. }
  43. });
  44. });
  45. }
  46. /*管理员-角色-编辑*/
  47. function admin_role_edit(title,url,w,h){
  48. layer_show(title,url,w,h);
  49. }
  50. /**
  51. * 角色授权
  52. * @param title
  53. * @param url
  54. * @param w
  55. * @param h
  56. */
  57. function admin_role_permission(title,url,w,h) {
  58. layer_show(title,url,w,h);
  59. }