codeChildmain.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /**
  2. * 字典数据维护
  3. *
  4. */
  5. $.namespace("codeChild.main");
  6. codeChild.main.init=function(){
  7. //把form传入,构造翻页控件
  8. pageinfo($("#codeChildform"));
  9. }
  10. codeChild.main.search=function(){
  11. $("#codeChildform").submit();
  12. }
  13. codeChild.main.back=function(){
  14. location.href=$.app+"/code/main";
  15. }
  16. codeChild.main.del=function(data){
  17. $.confirm({
  18. title: '确认框',
  19. content: '确认删除吗',
  20. confirm: function(){
  21. $.post($.app + "/codeChild/delete", {
  22. id : data
  23. }, function(data) {
  24. if (data.success) {
  25. $.alert({
  26. title: '提示',
  27. content: '删除成功',
  28. confirm: function(){
  29. $("#codeChildform").submit();
  30. }
  31. });
  32. } else {
  33. $.alert({
  34. title: '提示',
  35. content: data.message,
  36. confirm: function(){
  37. }
  38. });
  39. }
  40. }, "json");
  41. },
  42. cancel: function(){
  43. }
  44. });
  45. }
  46. codeChild.main.edit=function(data){
  47. $.post($.app + "/codeChild/edit", {
  48. id : data
  49. }, function(data) {
  50. if(data){
  51. for(var a in data){
  52. if($("#edit"+a)){
  53. $("#edit"+a).val(data[a]);
  54. }
  55. }
  56. }
  57. }, "json");
  58. }
  59. codeChild.main.save=function(){
  60. $.ajax({
  61. url:$.app+"/codeChild/save",
  62. data:$("#addform").serialize(),
  63. type:"post",
  64. dataType:"json",
  65. success:function(data){//ajax返回的数据
  66. if (data.success) {
  67. $.alert({
  68. title: '提示',
  69. content: '保存成功',
  70. confirm: function(){
  71. $("#codeChildform").submit();
  72. }
  73. });
  74. }else {
  75. $.alert({
  76. title: '提示',
  77. content: data.message,
  78. confirm: function(){
  79. }
  80. });
  81. }
  82. }
  83. });
  84. }