jdjcdetail.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. /**
  2. *角色管理
  3. *
  4. */
  5. $.namespace("jdjc.detail");
  6. jdjc.detail.init=function(set,jyrset){
  7. $.fn.zTree.init($("#usertree"), set);
  8. $.fn.zTree.init($("#jyrtree"), jyrset);
  9. }
  10. jdjc.detail.back=function(){
  11. location.href=$.app+"/jdjc/main";
  12. }
  13. vae = function(a, b) {
  14. if (isEmpty(a.val())) {
  15. ts(b + "不能为空", a);
  16. return false;
  17. }
  18. return true;
  19. };
  20. jdjc.detail.save=function(){
  21. // 验证必填字段是否为空
  22. if(vae($('#szdsel select'),"所在地")==false){return false;}
  23. if(vae($('#gksel select'),"港口")==false){return false;}
  24. if(vae($('#gqsel select'),"港区")==false){return false;}
  25. if(vae($('#zgqx'), "整改期限 ")==false){return false;}
  26. if(vae($('#jyrmc'),"被督查单位")==false){return false;}
  27. $(".btn").attr("disabled",true);
  28. $.ajax({
  29. url:$.app+"/jdjc/save",
  30. data:$("#addform").serialize(),
  31. type:"post",
  32. async:false,
  33. dataType:"json",
  34. success:function(data){//ajax返回的数据
  35. if (data.success) {
  36. $.alert({
  37. title: '提示',
  38. content: '操作成功',
  39. confirm: function(){
  40. location.href=$.app+'/jdjc/main';
  41. }
  42. });
  43. }else {
  44. $.alert({
  45. title: '提示',
  46. content: data.message,
  47. confirm: function(){
  48. $(".btn").attr("disabled",false);
  49. }
  50. });
  51. }
  52. }
  53. });
  54. };
  55. jdjc.detail.savexf=function(){
  56. // 验证必填字段是否为空
  57. if(vae($('#szdsel select'),"所在地")==false){return false;}
  58. if(vae($('#gksel select'),"港口")==false){return false;}
  59. if(vae($('#gqsel select'),"港区")==false){return false;}
  60. if(vae($('#zgqx'), "整改期限 ")==false){return false;}
  61. if(vae($('#jyrmc'),"被督查单位")==false){return false;}
  62. $(".btn").attr("disabled",true);
  63. $.ajax({
  64. url:$.app+"/jdjc/savexf",
  65. data:$("#addform").serialize(),
  66. type:"post",
  67. async:false,
  68. dataType:"json",
  69. success:function(data){//ajax返回的数据
  70. if (data.success) {
  71. $.alert({
  72. title: '提示',
  73. content: '操作成功',
  74. confirm: function(){
  75. location.href=$.app+'/jdjc/main';
  76. }
  77. });
  78. }else {
  79. $.alert({
  80. title: '提示',
  81. content: data.message,
  82. confirm: function(){
  83. $(".btn").attr("disabled",false);
  84. }
  85. });
  86. }
  87. }
  88. });
  89. };
  90. jdjc.detail.submit=function(){
  91. // 验证必填字段是否为空
  92. if(vae($('#szdsel select'),"所在地")==false){return false;}
  93. if(vae($('#gksel select'),"港口")==false){return false;}
  94. if(vae($('#gqsel select'),"港区")==false){return false;}
  95. if(vae($('#zgqx'), "整改期限 ")==false){return false;}
  96. if(vae($('#jyrmc'),"被督查单位")==false){return false;}
  97. $(".btn").attr("disabled",true);
  98. $.ajax({
  99. url:$.app+"/jdjc/submit",
  100. data:$("#addform").serialize(),
  101. type:"post",
  102. dataType:"json",
  103. success:function(data){//ajax返回的数据
  104. if (data.success) {
  105. $.alert({
  106. title: '提示',
  107. content: '操作成功',
  108. confirm: function(){
  109. location.href=$.app+'/jdjc/main';
  110. }
  111. });
  112. }else {
  113. $.alert({
  114. title: '提示',
  115. content: data.message,
  116. confirm: function(){
  117. $(".btn").attr("disabled",false);
  118. }
  119. });
  120. }
  121. }
  122. });
  123. };
  124. jdjc.detail.audit=function(auditpass,id){
  125. $(".btn").attr("disabled",true);
  126. var audit;
  127. if(auditpass=="Y"){
  128. audit=true;
  129. }else{
  130. audit=false;
  131. }
  132. $('#flag').val(audit);
  133. $(".btn").attr("disabled",true);
  134. $.ajax({
  135. url:$.app + "/jdjc/audit",
  136. data:$("#addform").serialize(),
  137. type:"post",
  138. dataType:"json",
  139. success:function(data){//ajax返回的数据
  140. if (data.success) {
  141. $.alert({
  142. title: '提示',
  143. content: '操作成功',
  144. confirm: function(){
  145. jdjc.detail.back();
  146. }
  147. });
  148. }else {
  149. $.alert({
  150. title: '提示',
  151. content: data.message,
  152. confirm: function(){
  153. $(".btn").attr("disabled",false);
  154. }
  155. });
  156. }
  157. }
  158. });
  159. /*$.post($.app + "/jdjc/audit", {
  160. id:id,
  161. shyj:shyj,
  162. flag:audit,
  163. accid:accid
  164. }, function(data) {
  165. if (data.success) {
  166. $.alert({
  167. title: '提示',
  168. content: '操作成功',
  169. confirm: function(){
  170. jdjc.detail.back();
  171. }
  172. });
  173. }else {
  174. $.alert({
  175. title: '提示',
  176. content: data.message,
  177. confirm: function(){
  178. $(".btn").attr("disabled",false);
  179. }
  180. });
  181. }
  182. }, "json");*/
  183. };
  184. jdjc.detail.submitFile = function(){
  185. $('#addform').form('submit',{
  186. url : $.app + '/jdjc/saveFile',
  187. onSubmit : function() {},
  188. success : function(data, status) {
  189. if (data) {
  190. data = data.replace("<audio controls=\"controls\" style=\"display: none;\"></audio>","");
  191. data = $.parseJSON(data);
  192. }
  193. if (data.success) {
  194. var len = $('#tableId tr').length;
  195. var accContect = data.attrs.acc.fjmc;
  196. var fjid = data.attrs.acc.fjid;
  197. var accid = data.attrs.acc.id;
  198. var str = "<tr align='center'>";
  199. str =str +"<td style='width:40%'>"+ "<input id='accid' value='"
  200. + accid
  201. + "' name='accid' type='hidden'>"
  202. + "<a class='main_title' href='/jsjy/accessory/download?id="
  203. + fjid + "'> " + accContect + "</a>" +"</td>";
  204. str =str+"<td style='width:15%'>"+ '<a class="btn btn-default btn-xs" href="#" onclick="jdjc.detail.delFj(\''
  205. + accid
  206. + '\','
  207. + '$(this)'
  208. + ')">删除</a>' +"</td></tr>";
  209. $('#tableId').append(str);
  210. } else {
  211. $.messager.showError(data.message);
  212. }
  213. }
  214. });
  215. }
  216. //删除accid 附件关联ID,id 是第几行附件
  217. jdjc.detail.delFj = function(accid, tr) {
  218. $.confirm({
  219. title : '确认框',
  220. content : '确认删除吗',
  221. confirm : function() {
  222. $.post($.app + "/jdjc/delFile", {
  223. accid : accid
  224. }, function(data) {
  225. if (data.success) {
  226. $(tr).parent().parent().remove();
  227. } else {
  228. $.alert({
  229. title : '提示',
  230. content : data.message,
  231. confirm : function() {
  232. }
  233. });
  234. }
  235. }, "json");
  236. },
  237. cancel : function() {
  238. }
  239. });
  240. }