companyInfoManage_add.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. //自定义jQuery校验保留5位小数
  2. jQuery.validator.addMethod("isFloat5Fn",function(value,element){
  3. return this.optional(element) || /^\d+(\.\d{1,5})?$/.test(value);
  4. },"小数点后最多5位小数");
  5. /*自定义jQuery校验是9位数字和字母*/
  6. jQuery.validator.addMethod("LetterAndNum9",function(value,element){
  7. return this.optional(element) || /^[a-zA-Z0-9]{9}$/.test(value);
  8. },"组织机构代码由9位数字或字母组成");
  9. //保存企业信息
  10. $("#form-information-add").validate({
  11. rules: {
  12. company_name: {
  13. required: true,
  14. minlength: 1,
  15. maxlength: 60,
  16. remote: {
  17. url: pagePath + "/company/companyInfoManage/getConpanyName",
  18. type: "get",
  19. data: {
  20. company_name: function () {
  21. return $("#company_name").val();
  22. },
  23. id: ''
  24. }
  25. }
  26. },
  27. organization_code: {
  28. required: true,
  29. minlength: 1,
  30. maxlength: 60,
  31. remote: {
  32. url: pagePath + "/company/companyInfoManage/getOrganization_code",
  33. type: "get",
  34. data: {
  35. organization_code: function () {
  36. return $("#organization_code").val();
  37. },
  38. id: ''
  39. }
  40. },
  41. LetterAndNum9:$("#organization_code").val(),
  42. },
  43. /* uscc: {
  44. required: true,
  45. minlength: 1,
  46. maxlength: 60,
  47. remote: {
  48. url: pagePath + "/company/companyInfoManage/getUscc",
  49. type: "get",
  50. data: {
  51. uscc: function () {
  52. return $("#uscc").val();
  53. },
  54. id: ''
  55. }
  56. }
  57. },*/
  58. no: {
  59. minlength: 1,
  60. maxlength: 60,
  61. },
  62. industry_code: {
  63. minlength: 1,
  64. maxlength: 60,
  65. },
  66. legal_representative: {
  67. minlength: 1,
  68. maxlength: 60,
  69. },
  70. business: {
  71. minlength: 1,
  72. maxlength: 200,
  73. },
  74. registration_capital: {
  75. minlength: 1,
  76. maxlength: 14,
  77. number:true,
  78. isFloat:$("#registration_capital").val(),
  79. isFloat5Fn:$("#registration_capital").val()
  80. },
  81. value: {
  82. required: true,
  83. minlength: 1,
  84. maxlength: 60
  85. },
  86. relation_name: {
  87. minlength: 1,
  88. maxlength: 100
  89. },
  90. location: {
  91. minlength: 1,
  92. maxlength: 200
  93. }
  94. },
  95. messages: {
  96. company_name: {
  97. remote: "该公司名已存在!"
  98. },
  99. organization_code: {
  100. remote: "该组织机构代码已存在!"
  101. },
  102. /*uscc: {
  103. remote: "该社会统一信用代码已存在!"
  104. }*/
  105. },
  106. onkeyup: false,
  107. focusCleanup: true,
  108. success: "valid",
  109. submitHandler: function (form) {
  110. // $(form).find(":submit").attr("disabled", true);
  111. $(form).ajaxSubmit({
  112. type: 'post',
  113. url: pagePath + "/company/companyInfoManage/saveInfo",
  114. dataType: "json",
  115. success: function (data) {
  116. if (data.success) {
  117. succeedMessage(data.message);
  118. setTimeClose();
  119. } else {
  120. // $(form).find(":submit").attr("disabled", false);
  121. errorMessage(data.message);
  122. }
  123. },
  124. error: function () {
  125. errorMessage('系统错误!');
  126. }
  127. });
  128. return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
  129. }
  130. });
  131. //});
  132. /*
  133. 参数解释:
  134. title 标题
  135. url 请求的url
  136. id 需要操作的数据id
  137. w 弹出层宽度(缺省调默认值)
  138. h 弹出层高度(缺省调默认值)
  139. */
  140. function addFiles(title, url, w, h) {
  141. //var index = layer_show(title, pagePath+url, w, h);
  142. //默认全屏
  143. //layer.full(index);
  144. layer_show(title, pagePath+url, w, h);
  145. }
  146. /*选择所在区域*/
  147. function select_Region(title, url, w, h){
  148. layer_show(title, pagePath+url, w, h);
  149. }