axmain.js 2.0 KB

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