tzjhglmain.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. $.namespace("tzjhgl.main");
  2. tzjhgl.main.init=function(){
  3. //把form传入,构造翻页控件
  4. pageinfo($("#tzjhglform"));
  5. }
  6. tzjhgl.main.search=function(){
  7. $('#pagejump').val(1);
  8. $("#tzjhglform").submit();
  9. }
  10. tzjhgl.main.del=function(data){
  11. $.confirm({
  12. title: '确认框',
  13. content: '确认删除吗',
  14. confirm: function(){
  15. $.post($.app + "/tzjhgl/delete", {
  16. id : data
  17. }, function(data) {
  18. if (data.success) {
  19. $.alert({
  20. title: '提示',
  21. content: '删除成功',
  22. confirm: function(){
  23. $("#tzjhglform").submit();
  24. }
  25. });
  26. } else {
  27. $.alert({
  28. title: '提示',
  29. content: data.message,
  30. confirm: function(){
  31. }
  32. });
  33. }
  34. }, "json");
  35. },
  36. cancel: function(){
  37. }
  38. });
  39. };
  40. tzjhgl.main.edit=function(data){
  41. location.href=$.app+"/tzjhgl/edit?id="+data;
  42. };
  43. tzjhgl.main.view=function(data){
  44. location.href=$.app+"/tzjhgl/view?id="+data;
  45. };
  46. /**
  47. * 弹出新增页面
  48. * */
  49. tzjhgl.main.add=function(){
  50. location.href=$.app+"/tzjhgl/add";
  51. };
  52. tzjhgl.main.initSfyzjbzsel=function(divid,existVal,width){
  53. $.post($.app + "/tzjhgl/selectSf", {
  54. }, function(data) {
  55. if (data) {
  56. var str = "";
  57. str+="<select class='sfyzjbzselectpicker' name='sfyzjbzid' >";
  58. str+="<option></option>";
  59. for(var i=0;i<data.length;i++){
  60. var sfyzjbz = data[i];
  61. if(sfyzjbz.id==existVal){
  62. str+=" <option selected='selected' value='"+sfyzjbz.id+"' >"+sfyzjbz.text+"</option>";
  63. }else{
  64. str+=" <option value='"+sfyzjbz.id+"' >"+sfyzjbz.text+"</option>";
  65. }
  66. }
  67. str+="</select>";
  68. $("#"+divid).empty();
  69. $("#"+divid).append(str);
  70. $('.sfyzjbzselectpicker').selectpicker({
  71. width:width
  72. });
  73. } else {
  74. }
  75. }, "json");
  76. };