enterprise_edit.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. var Register = {};
  2. var enterpriseCountDown = 0;
  3. var enterpriseSmsBtn = $("#enterprise_sms_btn");
  4. var persionCountDown = 0;
  5. var psSmsBtn = $("#ps_sms_btn");
  6. Register.enterpriseUserRegister = function () {
  7. $("#agentPhone").removeAttr("disabled");
  8. var type = $("#type").val();
  9. var special = $("#special").val();
  10. var enterpriseTypeName = "医院";
  11. var idCardName = "登记号";
  12. var username = $("#username").val();
  13. var name = $("#name").val();
  14. var idCard = $("#idCard").val();
  15. var legal = $("#legal").val();
  16. var ephone = $("#ephone").val();
  17. var medicalCommunityId = $("#medicalCommunityId").val();
  18. var isGeneral = $("#isGeneral").val();
  19. var province = $("#province").val();
  20. var city = $("#city").val();
  21. var county = $("#county").val();
  22. var address = $("#address").val();
  23. var agentName = $("#agentName").val();
  24. var agentPhone = $("#agentPhone").val();
  25. var agentEmail = $("#agentEmail").val();
  26. if (username == null || username == '') {
  27. Feng.info("请填写账号!");
  28. return;
  29. }
  30. if (username.length > 50) {
  31. Feng.info("账号最多50个字符!");
  32. return;
  33. }
  34. if (name == null || name == '') {
  35. Feng.info("请填写" + enterpriseTypeName + "名称!");
  36. return;
  37. }
  38. if (name.length > 100) {
  39. Feng.info(enterpriseTypeName + "名称最多100个字符!");
  40. return;
  41. }
  42. if (idCard == null || idCard == '') {
  43. Feng.info("请填写" + idCardName + "!");
  44. return;
  45. }
  46. if (idCard.length > 40) {
  47. Feng.info(idCardName + "最多40个字符!");
  48. return;
  49. }
  50. if (legal == null || legal == '') {
  51. Feng.info("请填写法人代表!");
  52. return;
  53. }
  54. if (ephone == null || ephone == '') {
  55. Feng.info("请填写" + enterpriseTypeName + "电话");
  56. return;
  57. }
  58. if (medicalCommunityId == null || medicalCommunityId == '') {
  59. Feng.info("请选择医共体");
  60. return;
  61. }
  62. if (isGeneral == null || isGeneral == '') {
  63. Feng.info("请选择是否总院");
  64. return;
  65. }
  66. if (province == null || province == '') {
  67. Feng.info("请选择" + enterpriseTypeName + "所在省份!");
  68. return;
  69. }
  70. if (city == null || city == '') {
  71. Feng.info("请选择" + enterpriseTypeName + "所在市!");
  72. return;
  73. }
  74. if ((county == null || county == '') && $("#county option").length > 1 && $("#county option:selected").length == 0) {
  75. Feng.info("请选择" + enterpriseTypeName + "所在县\区!");
  76. return;
  77. }
  78. if (address == null || address == '') {
  79. Feng.info("请填写" + enterpriseTypeName + "地址!");
  80. return;
  81. }
  82. if (agentName == null || agentName == '') {
  83. Feng.info("请填写人才联络员!");
  84. return;
  85. }
  86. if (agentName.length > 30) {
  87. Feng.info("人才联络员最多30个字符!");
  88. return;
  89. }
  90. if (agentPhone == null || agentPhone == '') {
  91. Feng.info("请填写人才联络员电话!");
  92. return;
  93. }
  94. if (agentEmail == null || agentEmail == '') {
  95. Feng.info("请填写电子邮箱!");
  96. return;
  97. }
  98. if (!/(^(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})))$/.test(ephone)) {
  99. Feng.info(enterpriseTypeName + "电话格式不合法!");
  100. return;
  101. }
  102. if (!/(^(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})))$/.test(agentPhone)) {
  103. Feng.info("人才联络员电话格式不合法!");
  104. return;
  105. }
  106. if (!/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(agentEmail)) {
  107. Feng.info("电子邮箱格式不合法!");
  108. return;
  109. }
  110. $("#ep_form")[0].submit();
  111. };
  112. /**
  113. * 企业用户注册回调
  114. */
  115. Register.epCallBack = function (data) {
  116. $("#agentPhone").prop("disabled", true);
  117. Feng.info(data.msg);
  118. if (data.code == 200) {
  119. setInterval(function () {
  120. window.location.href = Feng.ctxPath + "/";
  121. }, 3000);
  122. }
  123. };
  124. $("#imgurl,#bankImg,#beian,#domainImg,#typeImg").change(function (e) {
  125. var that = this;
  126. if (!Feng.chkFileInvalid(that.files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "只允许上传PDF或图片")) {
  127. return;
  128. }
  129. var file = that.files[0];
  130. var imgSrc;
  131. var reader = new FileReader();
  132. reader.readAsDataURL(file);
  133. reader.onload = function () {
  134. if (Feng.isImg(file.type)) {
  135. imgSrc = this.result;
  136. $(that).prev("img").attr("src", imgSrc);
  137. } else {
  138. $(that).prev("img").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
  139. }
  140. };
  141. });
  142. Register.setFieldDisabled = function () {
  143. //注释注册驳回$("#ep_form :input").not("button").prop("disabled", true);
  144. var fields = $("#fields").val().split(",");
  145. for (var i in fields) {
  146. $("#" + fields[i]).removeAttr("disabled");
  147. }
  148. var files = $("#files").val().split(",");
  149. for (var i in files) {
  150. switch (files[i]) {
  151. case "imgurl":
  152. $("#imgurl").removeAttr("disabled");
  153. var html = $("#imgurl").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  154. $("#imgurl").parent().find("label").html(html);
  155. break;
  156. case "bankImg":
  157. $("#bankImg").removeAttr("disabled");
  158. var html = $("#bankImg").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  159. $("#bankImg").parent().find("label").html(html);
  160. break;
  161. case "domainImg":
  162. $("#domainImg").removeAttr("disabled");
  163. var html = $("#domainImg").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  164. $("#domainImg").parent().find("label").html(html);
  165. break;
  166. case "typeImg":
  167. $("#typeImg").removeAttr("disabled");
  168. var html = $("#typeImg").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  169. $("#typeImg").parent().find("label").html(html);
  170. break;
  171. case "beian":
  172. $("#beian").removeAttr("disabled");
  173. var html = $("#beian").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  174. $("#beian").parent().find("label").html(html);
  175. break;
  176. }
  177. }
  178. }
  179. Register.afterSelectProvince = function () {
  180. var province = $("#province").val();
  181. $("#city").empty();
  182. $("#county").empty();
  183. if (province == null || province == '') {
  184. return;
  185. }
  186. Feng.addAjaxSelect({
  187. "id": "city",
  188. "displayCode": "code",
  189. "displayName": "name",
  190. "type": "GET",
  191. "url": Feng.ctxPath + "/common/tool/findCityByProvinceSelect/code/" + province
  192. });
  193. }
  194. /**
  195. * 加载县
  196. */
  197. Register.afterSelectCity = function () {
  198. var city = $("#city").val();
  199. $("#county").empty();
  200. if (city == null || city == '') {
  201. return;
  202. }
  203. Feng.addAjaxSelect({
  204. "id": "county",
  205. "displayCode": "code",
  206. "displayName": "name",
  207. "type": "GET",
  208. "url": Feng.ctxPath + "/common/tool/findCountyByCitySelect/code/" + city
  209. });
  210. }
  211. $(function () {
  212. //加载省份
  213. Feng.addAjaxSelect({
  214. "id": "province",
  215. "displayCode": "code",
  216. "displayName": "name",
  217. "type": "GET",
  218. "url": Feng.ctxPath + "/common/tool/getProvinceSelect"
  219. });
  220. $("select").each(function () {
  221. $(this).val($(this).attr("value"));
  222. $(this).trigger("change");
  223. });
  224. Register.setFieldDisabled();
  225. });