companyInfoManage_edit.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. $(function () {
  2. //自定义jQuery 校验
  3. jQuery.validator.addMethod("isFloat5Fn",function(value,element){
  4. return this.optional(element) || /^\d+(\.\d{1,5})?$/.test(value);
  5. },"小数点后最多5位小数");
  6. /*自定义jQuery校验是9位数字和字母*/
  7. jQuery.validator.addMethod("LetterAndNum9",function(value,element){
  8. return this.optional(element) || /^[a-zA-Z0-9]{9}$/.test(value);
  9. },"组织机构代码由9位数字或字母组成");
  10. //保存企业信息
  11. $("#form-information-edit").validate({
  12. rules: {
  13. name: {
  14. required: true,
  15. minlength: 1,
  16. maxlength: 64,
  17. remote: {
  18. url: pagePath + "/company/companyInfoManage/isExistCompanyName",
  19. type: "get",
  20. data: {
  21. company_name: function () {
  22. return $("#company_name").val();
  23. },
  24. id: ''
  25. }
  26. }
  27. },
  28. /*organization_code: {
  29. required: true,
  30. minlength: 1,
  31. maxlength: 60,
  32. remote: {
  33. url: pagePath + "/company/companyInfoManage/getOrganization_code",
  34. type: "get",
  35. data: {
  36. organization_code: function () {
  37. return $("#organization_code").val();
  38. },
  39. id: function () {
  40. return $("#companyId").val();
  41. }
  42. }
  43. },
  44. LetterAndNum9:$("#organization_code").val(),
  45. },*/
  46. value: {
  47. required: true,
  48. minlength: 1,
  49. maxlength: 64
  50. },
  51. registration_capital: {
  52. minlength: 1,
  53. maxlength: 14,
  54. number:true,
  55. isFloat:$("#registration_capital").val(),
  56. isFloat5Fn:$("#registration_capital").val()
  57. },
  58. },
  59. messages: {
  60. company_name: {
  61. remote: "该公司名已存在!"
  62. },organization_code: {
  63. remote: "该组织机构代码已存在!"
  64. }
  65. },
  66. onkeyup: false,
  67. focusCleanup: true,
  68. success: "valid",
  69. submitHandler: function (form) {
  70. // $(form).find(":submit").attr("disabled", true);
  71. $(form).ajaxSubmit({
  72. type: 'post',
  73. url: pagePath + "/company/companyInfoManage/editInfo/" + $("#companyId").val(),
  74. dataType: "json",
  75. success: function (data) {
  76. if (data.success) {
  77. succeedMessage(data.message);
  78. setTimeClose();
  79. } else {
  80. // $(form).find(":submit").attr("disabled", false);
  81. errorMessage(data.message);
  82. }
  83. },
  84. error: function () {
  85. errorMessage('系统错误!');
  86. }
  87. });
  88. return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
  89. }
  90. });
  91. });
  92. /*
  93. 参数解释:
  94. title 标题
  95. url 请求的url
  96. id 需要操作的数据id
  97. w 弹出层宽度(缺省调默认值)
  98. h 弹出层高度(缺省调默认值)
  99. */
  100. /*管理员-增加*/
  101. function addFiles(title, url, w, h) {
  102. //var index = layer_show(title, pagePath+url, w, h);
  103. //默认全屏
  104. //layer.full(index);
  105. layer_show(title, pagePath+url, w, h);
  106. }