ggdetail.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /**
  2. *角色管理
  3. *
  4. */
  5. $.namespace("gg.detail");
  6. gg.detail.init=function(){
  7. gg.detail.initIstopSel('80%');
  8. gg.detail.initSendSel('80%');
  9. }
  10. gg.detail.back=function(){
  11. location.href=$.app+"/gg/main";
  12. }
  13. gg.detail.save=function(){
  14. $.ajax({
  15. url:$.app+"/gg/save",
  16. data:$("#addform").serialize(),
  17. type:"post",
  18. dataType:"json",
  19. success:function(data){//ajax返回的数据
  20. if (data.success) {
  21. $.alert({
  22. title: '提示',
  23. content: '操作成功',
  24. confirm: function(){
  25. location.href=$.app+'/gg/main';
  26. }
  27. });
  28. }else {
  29. $.alert({
  30. title: '提示',
  31. content: data.message,
  32. confirm: function(){
  33. }
  34. });
  35. }
  36. }
  37. });
  38. }
  39. gg.detail.submit=function(){
  40. $.ajax({
  41. url:$.app+"/gg/submit",
  42. data:$("#addform").serialize(),
  43. type:"post",
  44. dataType:"json",
  45. success:function(data){//ajax返回的数据
  46. if (data.success) {
  47. $.alert({
  48. title: '提示',
  49. content: '操作成功',
  50. confirm: function(){
  51. location.href=$.app+'/gg/main';
  52. }
  53. });
  54. }else {
  55. $.alert({
  56. title: '提示',
  57. content: data.message,
  58. confirm: function(){
  59. }
  60. });
  61. }
  62. }
  63. });
  64. }
  65. gg.detail.initIstopSel=function(width){
  66. var str = "";
  67. str+="<select class='selectpicker' name='istopid' id='istopid' >";
  68. str+="<option></option>";
  69. if(gg.detail.istopDate){
  70. var x=$.parseJSON(gg.detail.istopDate);
  71. for(var i=0;i<x.length;i++){
  72. var select = x[i];
  73. if(gg.detail.istop == select.id){
  74. str+=" <option selected value='"+select.id+"' >"+select.text+"</option>";
  75. }else{
  76. str+=" <option value='"+select.id+"' >"+select.text+"</option>";
  77. }
  78. }
  79. }
  80. str+="</select>";
  81. $("#istopSel").empty();
  82. $("#istopSel").append(str);
  83. $('.selectpicker').selectpicker({
  84. width:width
  85. });
  86. }
  87. gg.detail.initSendSel=function(width){
  88. var str = "";
  89. str+="<select class='selectpicker' name='sendid' id='sendid' >";
  90. str+="<option></option>";
  91. if(gg.detail.sendDate){
  92. var x=$.parseJSON(gg.detail.sendDate);
  93. for(var i=0;i<x.length;i++){
  94. var select = x[i];
  95. if(gg.detail.send == select.id){
  96. str+=" <option selected value='"+select.id+"' >"+select.text+"</option>";
  97. }else{
  98. str+=" <option value='"+select.id+"' >"+select.text+"</option>";
  99. }
  100. }
  101. }
  102. str+="</select>";
  103. $("#sendSel").empty();
  104. $("#sendSel").append(str);
  105. $('.selectpicker').selectpicker({
  106. width:width
  107. });
  108. }
  109. gg.detail.audit=function(auditpass,id){
  110. var shyj="";
  111. var audit;
  112. if(auditpass=="Y"){
  113. audit=true;
  114. shyj="同意";
  115. }else{
  116. audit=false;
  117. shyj="不同意";
  118. }
  119. var jyrdel = null;
  120. var rydel = null;
  121. if($('#jyrdel').val()!=null){
  122. jyrdel = $('#jyrdel').val().join(",");
  123. }
  124. if($('#rydel').val()!=null){
  125. rydel = $('#rydel').val().join(",");
  126. }
  127. $.post($.app + "/gg/audit", {
  128. id:id,
  129. shyj:shyj,
  130. flag:audit,
  131. jyrdel:jyrdel,
  132. rydel:rydel
  133. }, function(data) {
  134. if (data.success) {
  135. $.alert({
  136. title: '提示',
  137. content: '操作成功',
  138. confirm: function(){
  139. location.href=$.app+'/gg/main';
  140. }
  141. });
  142. }else {
  143. $.alert({
  144. title: '提示',
  145. content: data.message,
  146. confirm: function(){
  147. }
  148. });
  149. }
  150. }, "json");
  151. };
  152. gg.detail.initJyrSelect=function(divid,divid2){
  153. $.post($.app + "/gg/selectJyr", {
  154. }, function(data) {
  155. var str="";
  156. str+="<select multiple='multiple' style='width:95%;height:160px' name='jyradd' id='jyradd'>";
  157. if(data){
  158. for(var i=0;i<data.length;i++){
  159. var jyr = data[i];
  160. str+=" <option value='"+jyr.id+"' >"+jyr.gkjyr+"</option>";
  161. }
  162. }
  163. str+="</select>";
  164. $("#"+divid).empty();
  165. $("#"+divid).append(str);
  166. var str2="";
  167. str2+="<select multiple='multiple' style='width:95%;height:160px' name='jyrdel' id='jyrdel'>";
  168. str+="</select>";
  169. $("#"+divid2).empty();
  170. $("#"+divid2).append(str2);
  171. $('#add').click(function(){
  172. $('#jyradd option:selected').appendTo('#jyrdel');
  173. });
  174. $('#del').click(function(){
  175. $('#jyrdel option:selected').appendTo('#jyradd');
  176. });
  177. $('#addAll').click(function(){
  178. $('#jyradd option').appendTo('#jyrdel');
  179. });
  180. $('#delAll').click(function(){
  181. $('#jyrdel option').appendTo('#jyradd');
  182. });
  183. }, "json");
  184. };
  185. gg.detail.initRySelect=function(divid,divid2){
  186. $.post($.app + "/gg/selectRy", {
  187. }, function(data) {
  188. var str="";
  189. str+="<select multiple='multiple' style='width:95%;height:160px' name='ryadd' id='ryadd'>";
  190. if(data){
  191. for(var i=0;i<data.length;i++){
  192. var ry = data[i];
  193. str+=" <option value='"+ry.id+"' >"+ry.xm+"</option>";
  194. }
  195. }
  196. str+="</select>";
  197. $("#"+divid).empty();
  198. $("#"+divid).append(str);
  199. var str2="";
  200. str2+="<select multiple='multiple' style='width:95%;height:160px' name='rydel' id='rydel'>";
  201. str+="</select>";
  202. $("#"+divid2).empty();
  203. $("#"+divid2).append(str2);
  204. $('#add2').click(function(){
  205. $('#ryadd option:selected').appendTo('#rydel');
  206. });
  207. $('#del2').click(function(){
  208. $('#rydel option:selected').appendTo('#ryadd');
  209. });
  210. $('#addAll2').click(function(){
  211. $('#ryadd option').appendTo('#rydel');
  212. });
  213. $('#delAll2').click(function(){
  214. $('#rydel option').appendTo('#ryadd');
  215. });
  216. }, "json");
  217. };