bwmain.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /**
  2. * bw
  3. *
  4. */
  5. $.namespace("bw.main");
  6. bw.main.init=function(){
  7. //把form传入,构造翻页控件
  8. pageinfo($("#bwform"));
  9. }
  10. bw.main.search=function(){
  11. $('#pagejump').val(1);
  12. $("#bwform").submit();
  13. }
  14. bw.main.del=function(data){
  15. $.confirm({
  16. title: '确认框',
  17. content: '确认删除吗',
  18. confirm: function(){
  19. $.post($.app + "/bw/delete", {
  20. id : data
  21. }, function(data) {
  22. if (data.success) {
  23. $.alert({
  24. title: '提示',
  25. content: '删除成功',
  26. confirm: function(){
  27. $("#bwform").submit();
  28. }
  29. });
  30. } else {
  31. $.alert({
  32. title: '提示',
  33. content: data.message,
  34. confirm: function(){
  35. }
  36. });
  37. }
  38. }, "json");
  39. },
  40. cancel: function(){
  41. }
  42. });
  43. }
  44. bw.main.edit=function(data){
  45. location.href=$.app+"/bw/edit?id="+data;
  46. }
  47. bw.main.view=function(data){
  48. location.href=$.app+"/bw/view?id="+data;
  49. }
  50. /**
  51. * 弹出新增页面
  52. * */
  53. bw.main.add=function(){
  54. location.href=$.app+"/bw/add";
  55. }
  56. bw.main.initSfwxpbw=function(divid, existVal){
  57. $.post($.app + "/bw/selectSfwxpbw", {
  58. }, function(data) {
  59. if (data) {
  60. var str = "";
  61. str+="<select class='sfwxpbwselectpicker' name='wxpbwid' >";
  62. str+="<option></option>";
  63. for(var i=0;i<data.length;i++){
  64. var sfwxpbw = data[i];
  65. if(sfwxpbw.id==existVal){
  66. str+=" <option selected='selected' value='"+sfwxpbw.id+"' >"+sfwxpbw.text+"</option>";
  67. }else{
  68. str+=" <option value='"+sfwxpbw.id+"' >"+sfwxpbw.text+"</option>";
  69. }
  70. }
  71. str+="</select>";
  72. $("#"+divid).empty();
  73. $("#"+divid).append(str);
  74. $('.sfwxpbwselectpicker').selectpicker({
  75. width:'80%'
  76. });
  77. } else {
  78. }
  79. }, "json");
  80. };
  81. bw.main.initBwsx=function(divid, existVal){
  82. $.post($.app + "/bw/selectBwsx", {
  83. }, function(data) {
  84. if (data) {
  85. var str = "";
  86. str+="<select class='bwsxselectpicker' name='bwsxid' id='bwsxid'>";
  87. str+="<option></option>";
  88. for(var i=0;i<data.length;i++){
  89. var bwsx = data[i];
  90. if(bwsx.id==existVal){
  91. str+=" <option selected='selected' value='"+bwsx.id+"' >"+bwsx.text+"</option>";
  92. }else{
  93. str+=" <option value='"+bwsx.id+"' >"+bwsx.text+"</option>";
  94. }
  95. }
  96. str+="</select>";
  97. $("#"+divid).empty();
  98. $("#"+divid).append(str);
  99. $('.bwsxselectpicker').selectpicker({
  100. width:'80%'
  101. });
  102. } else {
  103. }
  104. }, "json");
  105. };
  106. bw.main.initFwlx=function(divid, existVal){
  107. $.post($.app + "/bw/selectFwlx", {
  108. }, function(data) {
  109. if (data) {
  110. var str = "";
  111. str+="<select class='fwlxselectpicker' name='fwlxid' >";
  112. str+="<option></option>";
  113. for(var i=0;i<data.length;i++){
  114. var fwlx = data[i];
  115. if(fwlx.id==existVal){
  116. str+=" <option selected='selected' value='"+fwlx.id+"' >"+fwlx.text+"</option>";
  117. }else{
  118. str+=" <option value='"+fwlx.id+"' >"+fwlx.text+"</option>";
  119. }
  120. }
  121. str+="</select>";
  122. $("#"+divid).empty();
  123. $("#"+divid).append(str);
  124. $('.fwlxselectpicker').selectpicker({
  125. width:'80%'
  126. });
  127. } else {
  128. }
  129. }, "json");
  130. };
  131. bw.main.initSfdwkf=function(divid, existVal){
  132. $.post($.app + "/bw/selectSfdwkf", {
  133. }, function(data) {
  134. if (data) {
  135. var str = "";
  136. str+="<select class='sfdwkfselectpicker' name='sfdwkfid' >";
  137. str+="<option></option>";
  138. for(var i=0;i<data.length;i++){
  139. var sfdwkf = data[i];
  140. if(sfdwkf.id==existVal){
  141. str+=" <option selected='selected' value='"+sfdwkf.id+"' >"+sfdwkf.text+"</option>";
  142. }else{
  143. str+=" <option value='"+sfdwkf.id+"' >"+sfdwkf.text+"</option>";
  144. }
  145. }
  146. str+="</select>";
  147. $("#"+divid).empty();
  148. $("#"+divid).append(str);
  149. $('.sfdwkfselectpicker').selectpicker({
  150. width:'80%'
  151. });
  152. } else {
  153. }
  154. }, "json");
  155. };
  156. bw.main.initBwyt=function(divid, existVal){
  157. $.post($.app + "/bw/selectBwyt", {
  158. }, function(data) {
  159. if (data) {
  160. var existValArr = existVal.split(",");
  161. var str = "";
  162. str+="<select multiple='multiple' class='bwytselectpicker' name='bwbwyt' >";
  163. str+="<option></option>";
  164. for(var i=0;i<data.length;i++){
  165. var flag = false;
  166. var bwyt = data[i];
  167. for(var j = 0; j < existValArr.length; j++){
  168. if(bwyt.id==existValArr[j]){
  169. flag = true;
  170. str+=" <option selected='selected' value='"+bwyt.id+"' >"+bwyt.text+"</option>";
  171. break;
  172. } else {
  173. flag = false;
  174. }
  175. }
  176. if(!flag){
  177. str+=" <option value='"+bwyt.id+"' >"+bwyt.text+"</option>";
  178. }
  179. }
  180. str+="</select>";
  181. $("#"+divid).empty();
  182. $("#"+divid).append(str);
  183. $('.bwytselectpicker').selectpicker({
  184. width: '80%'
  185. });
  186. } else {
  187. }
  188. }, "json");
  189. };