apply_add.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. $(function () {
  2. $("#form-projectApplication-add").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. "super_type_name": {
  64. required: true
  65. }/*,
  66. "project_id" :{
  67. remote : {
  68. url: pagePath+"/projectApplication/canApply",
  69. type: "get",
  70. data: {
  71. name: function () {
  72. return $("#project_id").val();
  73. }
  74. }
  75. }
  76. }*/
  77. },
  78. messages: {
  79. "project_id": {
  80. remote: "已经申请过该项目(互斥类),不能重复申请"
  81. }
  82. },
  83. onkeyup: false,
  84. focusCleanup: true,
  85. success: "valid"
  86. });
  87. });
  88. function submit() {
  89. if (!($("#isDraft").val() == 1)) {
  90. if ($("#form-projectApplication-add").valid()) {
  91. var valid = true;
  92. /*$("#applyMaterials").find(".uploadFileName").each(function(){
  93. if($(this).val()==""){
  94. errorMessage('请上传所有申报材料!');
  95. valid = false;
  96. }
  97. });*/
  98. if (!$("#isStatement").is(":checked")) {
  99. errorMessage('请勾选企业声明!');
  100. valid = false;
  101. }
  102. if (!valid) {
  103. return false;
  104. }
  105. } else {
  106. return false;
  107. }
  108. } /*else {
  109. //保存草稿
  110. var validateBaseInfo = true;
  111. if ($("#project_type").val() == "" || $("#project_id").val() == "") {
  112. errorMessage('请选择项目!');
  113. validateBaseInfo = false;
  114. }
  115. if (!validateBaseInfo) {
  116. return false;
  117. }
  118. }*/
  119. //提交
  120. $("#form-projectApplication-add").ajaxSubmit({
  121. type: 'post',
  122. url: pagePath + "/projectProvinces/save",
  123. dataType: "json",
  124. success: function (data) {
  125. if (data.success) {
  126. layer.open({
  127. title: '提示!'
  128. , content: data.message
  129. , btn: ['确定']
  130. , yes: function (index, layero) {
  131. layer.close(index);
  132. var index = parent.layer.getFrameIndex(window.name);
  133. if (index) {
  134. parent.location.reload();
  135. parent.layer.close(index);
  136. } else {
  137. window.location.href = pagePath + "/index/#/projectList";
  138. //history.back(-2);
  139. }
  140. }
  141. , cancel: function () {
  142. var index = parent.layer.getFrameIndex(window.name);
  143. if (index) {
  144. parent.location.reload();
  145. parent.layer.close(index);
  146. } else {
  147. window.location.href = pagePath+"/index/#/projectList";
  148. //history.back(-2);
  149. }
  150. return true;
  151. }
  152. });
  153. } else {
  154. // $(form).find(":submit").attr("disabled", false);
  155. errorMessage(data.message);
  156. }
  157. },
  158. error: function () {
  159. errorMessage('系统错误!');
  160. }
  161. });
  162. return false;
  163. }
  164. //弹出框
  165. function open_dialog(title, url, w, h) {
  166. layer_show(title, pagePath + url, w, h);
  167. }
  168. //添加文件
  169. function addFile(title, url, w, h) {
  170. layer_show(title, pagePath + url, w, h);
  171. }
  172. //添加相应name的文件
  173. function addFileByName(url, obj) {
  174. var name = $(obj).next().attr("name");
  175. url += "?fileIdName=" + name;
  176. layer_show('添加文件', pagePath + url, 800, 350);
  177. }