enterprise_edit.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. switch (special) {
  13. case 0:
  14. if (type == 5) {
  15. enterpriseTypeName = "医院";
  16. idCardName = "登记号";
  17. }
  18. if (type == 6) {
  19. enterpriseTypeName = "学校";
  20. }
  21. break;
  22. case 1:
  23. enterpriseTypeName = "单位";
  24. break;
  25. }
  26. var username = $("#username").val();
  27. var name = $("#name").val();
  28. var idCard = $("#idCard").val();
  29. var agentName = $("#agentName").val();
  30. var agentPhone = $("#agentPhone").val();
  31. var legal = $("#legal").val();
  32. var street = $("#street").val();
  33. var province = $("#province").val();
  34. var city = $("#city").val();
  35. var county = $("#county").val();
  36. var address = $("#address").val();
  37. var agencyType = $("#agencyType").val();
  38. var agentEmail = $("#agentEmail").val();
  39. var ephone = $("#ephone").val();
  40. var medicalCommunityId = $("#medicalCommunityId").val();
  41. var isGeneral = $("#isGeneral").val();
  42. var bankCard = $("#bankCard").val();
  43. var bank = $("#bank").val();
  44. var bankNetwork = $("#bankNetwork").val();
  45. if (username == null || username == '') {
  46. Feng.info("请填写账号!");
  47. return;
  48. }
  49. if (username.length > 50) {
  50. Feng.info("账号最多50个字符!");
  51. return;
  52. }
  53. if (name == null || name == '') {
  54. Feng.info("请填写" + enterpriseTypeName + "名称!");
  55. return;
  56. }
  57. if (name.length > 100) {
  58. Feng.info(enterpriseTypeName + "名称最多100个字符!");
  59. return;
  60. }
  61. if ((idCard == null || idCard == '') && special != "1" && type != 6) {
  62. Feng.info("请填写" + idCardName + "!");
  63. return;
  64. }
  65. if (idCard.length > 40) {
  66. Feng.info(idCardName + "最多40个字符!");
  67. return;
  68. }
  69. if ((legal == null || legal == '') && special != "1") {
  70. Feng.info("请填写法人代表!");
  71. return;
  72. }
  73. if (ephone == null || ephone == '') {
  74. Feng.info("请填写" + enterpriseTypeName + "电话");
  75. return;
  76. }
  77. if ((medicalCommunityId == null || medicalCommunityId == '') && type == 5) {
  78. Feng.info("请选择医共体");
  79. return;
  80. }
  81. if ((isGeneral == null || isGeneral == '') && type == 5) {
  82. Feng.info("请选择是否总院");
  83. return;
  84. }
  85. if ((street == null || street == '') && [3, 4].indexOf(type) == -1) {
  86. Feng.info("请选择所属街道!");
  87. return;
  88. }
  89. if ((province == null || province == '') && [5, 6].indexOf(type) > -1) {
  90. Feng.info("请选择" + enterpriseTypeName + "所在省份!");
  91. return;
  92. }
  93. if ((city == null || city == '') && [5, 6].indexOf(type) > -1) {
  94. Feng.info("请选择" + enterpriseTypeName + "所在市!");
  95. return;
  96. }
  97. if (address == null || address == '') {
  98. Feng.info("请填写" + enterpriseTypeName + "地址!");
  99. return;
  100. }
  101. if (special != "1" && [2, 5, 6].indexOf(type) == -1) {
  102. if (bankCard == null || bankCard == '') {
  103. Feng.info("请填写企业银行账号!");
  104. return;
  105. }
  106. if (bank == null || bank == '') {
  107. Feng.info("请填写企业开户银行!");
  108. return;
  109. }
  110. if (bankNetwork == null || bankNetwork == '') {
  111. Feng.info("请填写企业开户银行网点!");
  112. return;
  113. }
  114. }
  115. if ((type == null || type == '') && special == "0") {
  116. Feng.info("请选择申报类型!");
  117. return;
  118. }
  119. if (special == "0" && type == 1) {
  120. if (agencyType == null || agencyType == '') {
  121. Feng.info("请选择机构类型");
  122. return;
  123. }
  124. var industryFieldNew = $("#industryFieldNew").val();
  125. var industryFieldOld = $("#industryFieldOld").val();
  126. var enterpriseTag = $("#enterpriseTag").val();
  127. var enterpriseType = $("#enterpriseType").val();
  128. switch (agencyType) {
  129. case "1":
  130. if (industryFieldNew == null || industryFieldNew == '') {
  131. Feng.info("请选择产业领域");
  132. return;
  133. }
  134. if (industryFieldOld == null || industryFieldOld == '') {
  135. Feng.info("请选择行业领域");
  136. return;
  137. }
  138. break;
  139. case "2":
  140. break;
  141. }
  142. if (enterpriseTag == null || enterpriseTag == '') {
  143. Feng.info("请选择企业标签!");
  144. return;
  145. }
  146. if (enterpriseType == null || enterpriseType == '') {
  147. Feng.info("请选择企业类型!");
  148. return;
  149. }
  150. }
  151. if (agentName == null || agentName == '') {
  152. Feng.info("请填写人才联络员!");
  153. return;
  154. }
  155. if (agentName.length > 30) {
  156. Feng.info("人才联络员最多30个字符!");
  157. return;
  158. }
  159. if (agentPhone == null || agentPhone == '') {
  160. Feng.info("请填写人才联络员电话!");
  161. return;
  162. }
  163. if (agentEmail == null || agentEmail == '') {
  164. Feng.info("请填写电子邮箱!");
  165. return;
  166. }
  167. 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)) {
  168. Feng.info(enterpriseTypeName + "电话格式不合法!");
  169. return;
  170. }
  171. 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)) {
  172. Feng.info("人才联络员电话格式不合法!");
  173. return;
  174. }
  175. if (!/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(agentEmail)) {
  176. Feng.info("电子邮箱格式不合法!");
  177. return;
  178. }
  179. $("#ep_form")[0].submit();
  180. };
  181. Register.changeEnterpriseType = function () {
  182. var enterpriseType = $("#enterpriseType").val();
  183. switch (enterpriseType) {
  184. case "guishang":
  185. case "gaoxinjishu":
  186. case "zhuanjingtexin":
  187. $("td.typeUploader").css("display", "table-cell");
  188. break;
  189. default:
  190. $("td.typeUploader").css("display", "none");
  191. break;
  192. }
  193. };
  194. /**
  195. * 企业用户注册回调
  196. */
  197. Register.epCallBack = function (data) {
  198. $("#agentPhone").prop("disabled", true);
  199. Feng.info(data.msg);
  200. if (data.code == 200) {
  201. setInterval(function () {
  202. window.location.href = Feng.ctxPath + "/";
  203. }, 3000);
  204. }
  205. };
  206. Register.typeChange = function () {
  207. var type = $("#type").val();
  208. if (type == 1) {
  209. $(".agencyType").attr("style", "display:block");
  210. } else {
  211. $(".agencyType").attr("style", "display:none");
  212. $("#typeGroup").attr("style", "display:none");
  213. $("#enterpriseTag,#industryFieldNew,#industryFieldOld,#enterpriseType").val("");
  214. $("#bankCard").parent().find("span").css("display", "none");
  215. $("#bankNetwork").parent().find("span").css("display", "none");
  216. $("#bank").parent().find("span").css("display", "none");
  217. $("#bankImg").parent().find("span").css("display", "none");
  218. }
  219. }
  220. Register.agencyTypeChange = function () {
  221. var agencyType = $("#agencyType").val();
  222. switch (agencyType) {
  223. case "1":
  224. $("#typeGroup").attr("style", "display:block");
  225. $(".agencyType1").attr("style", "");
  226. $(".agencyType2").attr("style", "");
  227. break;
  228. case "2":
  229. $("#typeGroup").attr("style", "display:block");
  230. $(".agencyType1").attr("style", "display:none");
  231. $(".agencyType2").attr("style", "");
  232. $("#industryFieldNew").val("");
  233. $("#industryFieldOld").val("");
  234. break;
  235. default:
  236. $("#typeGroup").attr("style", "display:none");
  237. break;
  238. }
  239. }
  240. Register.industryChange = function () {
  241. var industryNew = $("#industryFieldNew").val();
  242. var arr = [{"name": "industryFieldOld", "code": industryNew + "_field"}];
  243. Feng.findChildDictBatch(JSON.stringify(arr));
  244. }
  245. $("#imgurl,#bankImg,#beian,#domainImg,#typeImg").change(function (e) {
  246. var that = this;
  247. if (!Feng.chkFileInvalid(that.files[0], 5, 10, ["image/jpeg", "image/gif", "image/png", "image/jpg", "application/pdf"], "只允许上传PDF或图片")) {
  248. return;
  249. }
  250. var file = that.files[0];
  251. var imgSrc;
  252. var reader = new FileReader();
  253. reader.readAsDataURL(file);
  254. reader.onload = function () {
  255. if (Feng.isImg(file.type)) {
  256. imgSrc = this.result;
  257. $(that).prev("img").attr("src", imgSrc);
  258. } else {
  259. $(that).prev("img").attr("src", Feng.ctxPath + "/static/img/Pdf.png");
  260. }
  261. };
  262. });
  263. Register.setFieldDisabled = function () {
  264. //注释注册驳回$("#ep_form :input").not("button").prop("disabled", true);
  265. var fields = $("#fields").val().split(",");
  266. for (var i in fields) {
  267. $("#" + fields[i]).removeAttr("disabled");
  268. }
  269. var files = $("#files").val().split(",");
  270. for (var i in files) {
  271. switch (files[i]) {
  272. case "imgurl":
  273. $("#imgurl").removeAttr("disabled");
  274. var html = $("#imgurl").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  275. $("#imgurl").parent().find("label").html(html);
  276. break;
  277. case "bankImg":
  278. $("#bankImg").removeAttr("disabled");
  279. var html = $("#bankImg").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  280. $("#bankImg").parent().find("label").html(html);
  281. break;
  282. case "domainImg":
  283. $("#domainImg").removeAttr("disabled");
  284. var html = $("#domainImg").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  285. $("#domainImg").parent().find("label").html(html);
  286. break;
  287. case "typeImg":
  288. $("#typeImg").removeAttr("disabled");
  289. var html = $("#typeImg").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  290. $("#typeImg").parent().find("label").html(html);
  291. break;
  292. case "beian":
  293. $("#beian").removeAttr("disabled");
  294. var html = $("#beian").parent().find("label").html() + "<br><span style=\"color:red;\">(可修改)</span>";
  295. $("#beian").parent().find("label").html(html);
  296. break;
  297. }
  298. }
  299. }
  300. $(function () {
  301. var industryNew = $("#industryFieldNew").attr("value");
  302. var arr = [
  303. {"name": "street", "code": "street"},
  304. {"name": "enterpriseTag", "code": "enterprise_tag"},
  305. {"name": "organizationTag", "code": "organization_tag"},
  306. {"name": "institutionTag", "code": "institution_tag"},
  307. {"name": "enterpriseType", "code": "enterprise_type"},
  308. {"name": "industryFieldNew", "code": "industry_field"},
  309. {"name": "industryFieldOld", "code": industryNew + "_field"},
  310. {"name": "agencyType", "code": "agency_type"}];
  311. Feng.findChildDictBatch(JSON.stringify(arr));
  312. $("select").each(function () {
  313. $(this).val($(this).attr("value"));
  314. $(this).trigger("change");
  315. });
  316. Register.setFieldDisabled();
  317. });