apply_edit.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. $(function () {
  2. $("#form-projectApplication-edit").validate({
  3. rules: {
  4. "companyInfo.company_name": {
  5. required: true
  6. },
  7. "companyInfo.industry_code": {
  8. required: true
  9. },
  10. "companyInfo.registration_address": {
  11. required: true
  12. },
  13. "companyInfo.currency_unit": {
  14. required: true
  15. },
  16. "companyInfo.registration_capital": {
  17. required: true,
  18. min: 0,
  19. max: 999999999.9999,
  20. isFloat: true,
  21. isFloat4Fn: true
  22. },
  23. "companyInfo.legal_representative": {
  24. required: true
  25. },
  26. "companyInfo.contact": {
  27. required: true
  28. },
  29. "companyInfo.lr_position": {
  30. required: true
  31. },
  32. "companyInfo.contact_position": {
  33. required: true
  34. },
  35. "companyInfo.lr_phone": {
  36. required: true,
  37. isTel: true
  38. },
  39. "companyInfo.contact_phone": {
  40. required: true,
  41. isTel: true
  42. },
  43. "companyInfo.total_assets_currency_unit": {
  44. required: true
  45. },
  46. "companyInfo.total_assets": {
  47. required: true,
  48. min: 0,
  49. max: 999999999.999999,
  50. isFloat: true,
  51. isFloat6Fn: true
  52. },
  53. "companyInfo.fixed_assets_currency_unit": {
  54. required: true
  55. },
  56. "companyInfo.fixed_assets": {
  57. required: true,
  58. min: 0,
  59. max: 999999999.999999,
  60. isFloat: true,
  61. isFloat6Fn: true
  62. },
  63. "project_type": {
  64. required: true
  65. },
  66. "customize_name": {
  67. required: true
  68. }
  69. },
  70. messages: {},
  71. onkeyup: false,
  72. focusCleanup: true,
  73. success: "valid"
  74. });
  75. });
  76. function submit() {
  77. if (!($("#isDraft").val() == 1)) {
  78. if ($("#form-projectApplication-edit").valid()) {
  79. var valid = true;
  80. $("#applyMaterials").find(".uploadFileName").each(function(){
  81. if($(this).val()==""){
  82. errorMessage('请上传所有申报材料!');
  83. valid = false;
  84. }
  85. });
  86. if (!$("#isStatement").is(":checked")) {
  87. errorMessage('请勾选企业声明!');
  88. valid = false;
  89. }
  90. if (!valid) {
  91. return false;
  92. }
  93. } else {
  94. return false;
  95. }
  96. } else {
  97. //保存草稿
  98. var validateBaseInfo = true;
  99. if ($("#project_type").val() == "" || $("#project_id").val() == "") {
  100. errorMessage('请选择项目!');
  101. validateBaseInfo = false;
  102. }
  103. if (!validateBaseInfo) {
  104. return false;
  105. }
  106. }
  107. //提交
  108. $("#form-projectApplication-edit").ajaxSubmit({
  109. type: 'post',
  110. url: pagePath + "/projectApplication/save",
  111. dataType: "json",
  112. success: function (data) {
  113. if (data.success) {
  114. layer.open({
  115. title: '提示!'
  116. , content: data.message
  117. , btn: ['确定']
  118. , yes: function (index, layero) {
  119. layer.close(index);
  120. var index = parent.layer.getFrameIndex(window.name);
  121. if (index) {
  122. parent.location.reload();
  123. parent.layer.close(index);
  124. } else {
  125. // window.location.href = pagePath + "/home/informList/69";
  126. history.back(-2);
  127. }
  128. }
  129. , cancel: function () {
  130. var index = parent.layer.getFrameIndex(window.name);
  131. if (index) {
  132. parent.location.reload();
  133. parent.layer.close(index);
  134. } else {
  135. // window.location.href = pagePath + "/home/informList/69";
  136. history.back(-2);
  137. }
  138. return true;
  139. }
  140. });
  141. } else {
  142. // $(form).find(":submit").attr("disabled", false);
  143. errorMessage(data.message);
  144. }
  145. },
  146. error: function () {
  147. errorMessage('系统错误!');
  148. }
  149. });
  150. return false;
  151. }
  152. //弹出框
  153. function open_dialog(title, url, w, h) {
  154. layer_show(title, pagePath + url, w, h);
  155. }
  156. //添加文件
  157. function addFile(title, url, w, h) {
  158. layer_show(title, pagePath + url, w, h);
  159. }
  160. //添加相应name的文件
  161. function addFileByName(url, obj) {
  162. var name = $(obj).next().attr("name");
  163. url += "?fileIdName=" + name;
  164. layer_show('添加文件', pagePath + url, 800, 350);
  165. }