xkzxxdetail.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. /**
  2. *xkzxx
  3. *
  4. */
  5. $.namespace("xkzxx.detail");
  6. xkzxx.detail.path=null;
  7. xkzxx.detail.init=function(){
  8. };
  9. xkzxx.detail.back=function(){
  10. if(xkzxx.detail.path!=null&&xkzxx.detail.path!=''){
  11. location.href=$.app+xkzxx.detail.path;
  12. }else{
  13. location.href=$.app+"/xkzxx/main";
  14. }
  15. };
  16. /* 当前页面高度 */
  17. function pageHeight() {
  18. return document.body.scrollHeight;
  19. };
  20. /* 当前页面宽度 */
  21. function pageWidth() {
  22. return document.body.scrollWidth;
  23. };
  24. xkzxx.detail.show=function(objs){
  25. $("#overlay").fadeTo(500, 0.5);
  26. $("#dv"+objs).show(500);
  27. $("#dv"+objs).css("left",pageWidth()*0.1);
  28. $("#dv"+objs).css("top",pageHeight()*0.1);
  29. };
  30. xkzxx.detail.hide=function(objs){
  31. $("#dv"+objs).hide(500);
  32. $("#overlay").fadeOut(500);
  33. };
  34. xkzxx.detail.showTwoCode=function(){
  35. $("#overlay").fadeTo(500, 0.5);
  36. $("#dvTwoCode").show(500);
  37. $("#dvTwoCode").css("left",pageWidth()*0.1);
  38. $("#dvTwoCode").css("top",pageHeight()*0.1);
  39. };
  40. xkzxx.detail.hideTwoCode=function(){
  41. $("#dvTwoCode").hide(500);
  42. $("#overlay").fadeOut(500);
  43. };
  44. /**
  45. xkzxx.detail.preview=function(){
  46. $("#overlay").fadeTo(500, 0.5);
  47. $("#previewDiv").show(500);
  48. $("#previewDiv").css("left",pageWidth()*0.1);
  49. $("#previewDiv").css("top",pageHeight()*0.1);
  50. };
  51. xkzxx.detail.hidePreview=function(){
  52. $("#previewDiv").hide(500);
  53. $("#overlay").fadeOut(500);
  54. };
  55. */
  56. vae = function(a, b) {
  57. if (isEmpty(a.val())) {
  58. ts(b + "不能为空", a);
  59. return false;
  60. }
  61. return true;
  62. };
  63. xkzxx.detail.save=function(){
  64. // 验证必填字段是否为空
  65. if (vae($('#addform input[name=fddbr]'), "法定代表人") == false) {
  66. return false;
  67. }
  68. if (vae($('#addform input[name=dz]'), "办公地址") == false) {
  69. return false;
  70. }
  71. if (vae($('#addform input[name=cq]'), "经营地域") == false) {
  72. return false;
  73. }
  74. if (vae($('#addform input[name=zyqyfw]'), "经营范围") == false) {
  75. return false;
  76. }
  77. if (vae($('#addform input[name=gkjyxkzh]'), "许可证编号") == false) {
  78. return false;
  79. }
  80. if (vae($('#addform input[name=fzjg]'), "发证机关") == false) {
  81. return false;
  82. }
  83. if (vae($('#addform input[name=yxqz]'), "有效期") == false) {
  84. return false;
  85. }
  86. if (vae($('#addform input[name=fzrq]'), "发证日期") == false) {
  87. return false;
  88. }
  89. if (vae($('#addform input[name=zmpicid]'), "附证电子扫描件(正面)") == false) {
  90. return false;
  91. }
  92. $(".btn").attr("disabled",true);
  93. $.ajax({
  94. url:$.app+"/xkzxx/save",
  95. data:$("#addform").serialize(),
  96. type:"post",
  97. dataType:"json",
  98. success:function(data){//ajax返回的数据
  99. if (data.success) {
  100. $.alert({
  101. title: '提示',
  102. content: '操作成功',
  103. confirm:function(){
  104. if(xkzxx.detail.path!=null&&xkzxx.detail.path!='') {
  105. location.href=$.app+xkzxx.detail.path;
  106. } else {
  107. location.href=$.app+"/xkzxx/main";
  108. }
  109. }
  110. });
  111. }else {
  112. $.alert({
  113. title: '提示',
  114. content: data.message,
  115. confirm: function(){
  116. $(".btn").attr("disabled",false);
  117. }
  118. });
  119. }
  120. }
  121. });
  122. };
  123. xkzxx.detail.back=function(){
  124. if(xkzxx.detail.path!=null&&xkzxx.detail.path!='') {
  125. location.href=$.app+xkzxx.detail.path;
  126. } else {
  127. location.href=$.app+"/xkzxx/main";
  128. }
  129. };
  130. /*//添加附件弹出
  131. xkzxx.detail.scfz=function(i){
  132. $("#flag").val(i);
  133. $('#zmpic').val("");
  134. $('#fmpic').val("");
  135. $('#theme-popover-mask').fadeIn(100);
  136. $('#theme-popover').slideDown(0);
  137. }
  138. xkzxx.detail.fzguanbipop=function(){
  139. $('.theme-popover-mask').fadeOut(100);
  140. $('.theme-popover').slideUp(0);
  141. }*/
  142. xkzxx.detail.saveFile1 = function(){
  143. $("#flag").val("1");
  144. var i=$("#flag").val();
  145. $('#addform').form('submit', {
  146. url : $.app + '/xkzxx/saveFz',
  147. success : function(data, status) {
  148. var file = $('#zmpic');
  149. file.after(file.clone().val(""));
  150. file.remove();
  151. if (data) {
  152. data = data.replace("<audio controls=\"controls\" style=\"display: none;\"></audio>","");
  153. data = $.parseJSON(data);
  154. }
  155. if (data.success) {
  156. $("#fzzm").attr("style","display:none;");
  157. var accContect = data.attrs.acc.name;
  158. var accid = data.attrs.acc.id;
  159. $('#zmpicid').val(accid);
  160. var str = "";
  161. str = "<span id='fzmc1'>"
  162. + "<a class='main_title' href='/jsjy/accessory/download?id="+ accid +"'> " + accContect +"</a>"+"</span>";
  163. str+="<a class='main_title' onclick=\"xkzxx.detail.delFj('"+ accid +"','"+i+"');\" class='btn btn-default btn-xs'><i class='glyphicon glyphicon-trash'></i>删除</a>"
  164. $("#fjxq1").empty();
  165. $("#fjxq1").append(str);
  166. $("#fzzm"+i).text(accContect);
  167. //给附件id文本框赋值
  168. $("#delid"+i).val(accid);
  169. accContect = "";
  170. $("#zmpic").val("");
  171. $("#fzzm").hide();
  172. }
  173. else {
  174. $.messager.showError(data.message);
  175. }
  176. }
  177. });
  178. }
  179. xkzxx.detail.saveFile2 = function(){
  180. $("#flag").val("2");
  181. var i=$("#flag").val();
  182. $('#addform').form('submit', {
  183. url : $.app + '/xkzxx/saveFz',
  184. success : function(data, status) {
  185. var file = $('#fmpic');
  186. file.after(file.clone().val(""));
  187. file.remove();
  188. if (data) {
  189. data = data.replace("<audio controls=\"controls\" style=\"display: none;\"></audio>","");
  190. data = $.parseJSON(data);
  191. }
  192. if (data.success) {
  193. $("#fzfm").attr("style","display:none;");
  194. var accContect = data.attrs.fmacc.name;
  195. var accid = data.attrs.fmacc.id;
  196. $('#fmpicid').val(accid);
  197. var str = "";
  198. str = "<span id='fzmc2'>"
  199. + "<a class='main_title' href='/jsjy/accessory/download?id="+ accid +"'> " + accContect +"</a>"+"</span>";
  200. str+="<a class='main_title' onclick=\"xkzxx.detail.delFj('"+ accid +"','"+i+"');\" class='btn btn-default btn-xs'><i class='glyphicon glyphicon-trash'></i>图片</a>"
  201. $("#fjxq2").empty();
  202. $("#fjxq2").append(str);
  203. $("#fzfm"+i).text(accContect);
  204. //给附件id文本框赋值
  205. $("#delid"+i).val(accid);
  206. accContect = "";
  207. $("#fmpic").val("");
  208. $("#fzfm").hide();
  209. }
  210. else {
  211. $.messager.showError(data.message);
  212. }
  213. }
  214. });
  215. }
  216. xkzxx.detail.delFj = function(data,flag){
  217. var id=data;
  218. if (true) {
  219. $.confirm({
  220. title: '确认框',
  221. content: '确认删除吗',
  222. confirm: function(){
  223. $.post($.app + "/xkzxx/delFile?id="+id, {}, function(data, status) {
  224. if (data.success) {
  225. $("#fzmc"+flag).html("");
  226. $("#fjxq"+flag).empty();
  227. if(flag==1){
  228. $("#fzzm").removeAttr("style");
  229. }else if(flag==2){
  230. $("#fzfm").removeAttr("style");
  231. }
  232. $("#delid"+flag).val("");
  233. } else {
  234. $.alert({
  235. title: '提示',
  236. content: data.message,
  237. confirm: function(){
  238. }
  239. });
  240. }
  241. }, "json");
  242. },
  243. cancel: function(){
  244. }
  245. });
  246. }
  247. }