gkmain.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /**
  2. *港口
  3. *
  4. */
  5. $.namespace("gk.main");
  6. gk.main.init=function(){
  7. //把form传入,构造翻页控件
  8. pageinfo($("#gkform"));
  9. }
  10. gk.main.search=function(){
  11. $('#pagejump').val(1);
  12. $("#gkform").submit();
  13. }
  14. function initSzdSelect(divid,existVal,changefunc,width){
  15. $.post($.app + "/selectSzd", {
  16. }, function(data) {
  17. var str = "";
  18. if(changefunc!=null&&changefunc!=""){
  19. str+="<select class='szdselectpicker' name='szd' onchange='"+changefunc+"()' >";
  20. }else{
  21. str+="<select class='szdselectpicker' name='szd' >";
  22. }
  23. str+=" <option ></option>";
  24. if(data){
  25. for(var i=0;i<data.length;i++){
  26. var szd = data[i];
  27. if(szd.val==existVal){
  28. str+=" <option selected='selected' value='"+szd.id+"' >"+szd.text+"</option>";
  29. }else{
  30. str+=" <option value='"+szd.id+"' >"+szd.text+"</option>";
  31. }
  32. }
  33. }
  34. str+="</select>";
  35. $("#"+divid).empty();
  36. $("#"+divid).append(str);
  37. $('.szdselectpicker').selectpicker({
  38. width:width
  39. });
  40. }, "json");
  41. }
  42. function initGlbmSelect(divid,existVal,szd,changefunc,width){
  43. $.post($.app + "/xzglbm/selectGlbm", {
  44. szd:szd
  45. }, function(data) {
  46. var str = "";
  47. if(changefunc!=null&&changefunc!=""){
  48. str+="<select class='Glbmselectpicker' name='ssgkglbm' onchange='"+changefunc+"()' >";
  49. }else{
  50. str+="<select class='Glbmselectpicker' name='ssgkglbm' >";
  51. }
  52. str+="<option></option>";
  53. if(data){
  54. for(var i=0;i<data.length;i++){
  55. var gk = data[i];
  56. if(gk.id==existVal){
  57. str+=" <option selected='selected' value='"+gk.id+"' >"+gk.gkglbmqc+"</option>";
  58. }else{
  59. str+=" <option value='"+gk.id+"' >"+gk.gkglbmqc+"</option>";
  60. }
  61. }
  62. }
  63. str+="</select>";
  64. $("#"+divid).empty();
  65. $("#"+divid).append(str);
  66. $('.Glbmselectpicker').selectpicker({
  67. width:width
  68. });
  69. }, "json");
  70. }
  71. gk.main.del=function(data){
  72. $.confirm({
  73. title: '确认框',
  74. content: '确认删除吗',
  75. confirm: function(){
  76. $.post($.app + "/gk/delete", {
  77. id : data
  78. }, function(data) {
  79. if (data.success) {
  80. $.alert({
  81. title: '提示',
  82. content: '操作成功',
  83. confirm: function(){
  84. $("#gkform").submit();
  85. }
  86. });
  87. } else {
  88. $.alert({
  89. title: '提示',
  90. content: data.message,
  91. confirm: function(){
  92. }
  93. });
  94. }
  95. }, "json");
  96. },
  97. cancel: function(){
  98. }
  99. });
  100. }
  101. gk.main.edit=function(data){
  102. location.href=$.app+"/gk/edit?id="+data;
  103. }
  104. gk.main.view=function(data){
  105. location.href=$.app+"/gk/view?id="+data;
  106. }
  107. /**
  108. * 弹出新增页面
  109. * */
  110. gk.main.add=function(){
  111. location.href=$.app+"/gk/add";
  112. }