talentInfo_info.js 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var locked = false;
  5. var step = $("#step").val();
  6. var TalentInfoInfoDlg = step == 1 ? {
  7. talentInfoInfoData: {},
  8. validateFields: {
  9. source_county: {validators: {notEmpty: {message: '入选来源县市区不能为空'}}},
  10. talent_type: {validators: {notEmpty: {message: '人才类型不能为空'}}},
  11. name: {validators: {notEmpty: {message: '姓名不能为空'}}},
  12. card_type: {validators: {notEmpty: {message: '证件类型不能为空'}}},
  13. card_number: {
  14. validators: {
  15. notEmpty: {message: '证件号码不能为空'},
  16. regexp: {
  17. regexp: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
  18. message: "身份证号码格式不正确"
  19. }
  20. }
  21. },
  22. sex: {validators: {notEmpty: {message: '性别不能为空'}}},
  23. birthday: {validators: {notEmpty: {message: '出生日期不能为空'}}},
  24. nationality: {validators: {notEmpty: {message: '国籍/地区不能为空'}}},
  25. province: {validators: {notEmpty: {message: '户籍省份不能为空'}}},
  26. city: {validators: {notEmpty: {message: '户籍市不能为空'}}},
  27. nation: {validators: {notEmpty: {message: '民族不能为空'}}},
  28. politics: {validators: {notEmpty: {message: '政治面貌不能为空'}}},
  29. experience: {validators: {notEmpty: {message: '工作简历不能为空'}}},
  30. education: {validators: {notEmpty: {message: '教育背景不能为空'}}}
  31. }
  32. } : {
  33. talentInfoInfoData: {},
  34. validateFields: {
  35. apply_year: {validators: {notEmpty: {message: '申报年度不能为空'}}},
  36. import_way: {validators: {notEmpty: {message: '引进方式不能为空'}}},
  37. cur_entry_time: {validators: {notEmpty: {message: '本单位入职时间不能为空'}}},
  38. position: {validators: {notEmpty: {message: '本单位现任职务不能为空'}}},
  39. source: {validators: {notEmpty: {message: '申报来源不能为空'}}},
  40. talent_arrange: {validators: {notEmpty: {message: '人才层次不能为空'}}},
  41. talent_condition: {validators: {notEmpty: {message: '认定条件不能为空'}}},
  42. highest_degree: {validators: {notEmpty: {message: '最高学历不能为空'}}},
  43. graduate_school: {validators: {notEmpty: {message: '毕业院校不能为空'}}},
  44. major: {validators: {notEmpty: {message: '专业不能为空'}}},
  45. bank: {
  46. validators: {
  47. notEmpty: {
  48. message: '开户银行不能为空'
  49. },
  50. regexp: {
  51. regexp: /^[\u4e00-\u9fa5]*银行$/,
  52. message: "开户银行格式不正确"
  53. }
  54. }
  55. },
  56. bank_number: {
  57. validators: {
  58. notEmpty: {
  59. message: '银行行号不能为空'
  60. },
  61. regexp: {
  62. regexp: /^\d+$/,
  63. message: "银行行号格式不正确"
  64. }
  65. }
  66. },
  67. bank_branch_name: {
  68. validators: {
  69. notEmpty: {
  70. message: '开户银行网点不能为空'
  71. },
  72. regexp: {
  73. regexp: /^[\u4e00-\u9fa5]*银行[\u4e00-\u9fa5]*省?[\u4e00-\u9fa5]+市[\u4e00-\u9fa5]*$/,
  74. message: "开户银行格式不正确"
  75. }
  76. }
  77. },
  78. bank_account: {
  79. validators: {
  80. notEmpty: {
  81. message: '银行账号不能为空'
  82. },
  83. regexp: {
  84. regexp: /^\d+$/,
  85. message: "银行账号格式不正确"
  86. }
  87. }
  88. },
  89. phone: {
  90. validators: {
  91. notEmpty: {
  92. message: '手机号码不能为空'
  93. },
  94. regexp: {
  95. regexp: /0?(13|14|15|16|17|18|19)[0-9]{9}/,
  96. message: "手机号码格式不正确"
  97. }
  98. }
  99. },
  100. email: {
  101. validators: {
  102. notEmpty: {
  103. message: '电子邮箱不能为空'
  104. },
  105. emailAddress: {
  106. message: "电子邮箱格式不正确"
  107. }
  108. }
  109. }
  110. }
  111. };
  112. /**
  113. * 清除数据
  114. */
  115. TalentInfoInfoDlg.clearData = function () {
  116. this.talentInfoInfoData = {};
  117. }
  118. /**
  119. * 设置对话框中的数据
  120. *
  121. * @param key 数据的名称
  122. * @param val 数据的具体值
  123. */
  124. TalentInfoInfoDlg.set = function (key, val) {
  125. var dis = $("#" + key).attr("disabled");
  126. if (dis == "disabled") {
  127. $("#" + key).removeAttr("disabled");
  128. }
  129. this.talentInfoInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
  130. if (dis == "disabled") {
  131. $("#" + key).prop("disabled", true);
  132. }
  133. return this;
  134. }
  135. /**
  136. * 设置对话框中的数据
  137. *
  138. * @param key 数据的名称
  139. * @param val 数据的具体值
  140. */
  141. TalentInfoInfoDlg.get = function (key) {
  142. return $("#" + key).val();
  143. }
  144. /**
  145. * 关闭此对话框
  146. */
  147. TalentInfoInfoDlg.close = function () {
  148. parent.layer.close(window.parent.TalentInfo.layerIndex);
  149. }
  150. /**
  151. * 收集数据
  152. */
  153. TalentInfoInfoDlg.collectData = function () {
  154. this
  155. .set('id')
  156. .set('type')
  157. .set('talent_type')
  158. .set('tax_insurance_month')
  159. .set('labor_contract_rangetime')
  160. .set('pre_import_type')
  161. .set('salary_pay_way')
  162. .set('salary_pay_month')
  163. .set('enterprise_id')
  164. .set('name')
  165. .set('photo')
  166. .set('card_type')
  167. .set('card_number')
  168. .set('sex')
  169. .set('birthday')
  170. .set('nationality')
  171. .set('province')
  172. .set('city')
  173. .set('county')
  174. .set('nation')
  175. .set('politics')
  176. .set('talent_arrange')
  177. .set('talent_condition')
  178. .set('highest_degree')
  179. .set('graduate_school')
  180. .set('major')
  181. .set('professional')
  182. .set('bank')
  183. .set('bank_number')
  184. .set('bank_branch_name')
  185. .set('bank_account')
  186. .set('study_abroad')
  187. .set('abroad_school')
  188. .set('abroad_major')
  189. .set('phone')
  190. .set('email')
  191. .set('apply_year')
  192. .set('import_way')
  193. .set('fst_work_time')
  194. .set('cur_entry_time')
  195. .set('position')
  196. .set('source')
  197. .set('fujian_highcert_pubtime')
  198. .set('fujian_highcert_exptime')
  199. .set('quanzhou_highcert_pubtime')
  200. .set('quanzhou_highcert_exptime');
  201. if ($("#province").val() != null && $("#province").val() != '') {
  202. this.talentInfoInfoData["province_name"] = $("#province").find("option:selected").text();
  203. }
  204. if ($("#city").val() != null && $("#city").val() != '') {
  205. this.talentInfoInfoData["city_name"] = $("#city").find("option:selected").text();
  206. }
  207. if ($("#county").val() != null && $("#county").val() != '') {
  208. this.talentInfoInfoData["county_name"] = $("#county").find("option:selected").text();
  209. }
  210. if ($("#source_city").val() != null && $("#source_city").val() != '') {
  211. this.talentInfoInfoData["source_city_name"] = $("#source_city").find("option:selected").text();
  212. }
  213. if ($("#source_county").val() != null && $("#source_county").val() != '') {
  214. this.talentInfoInfoData["source_county_name"] = $("#source_county").find("option:selected").text();
  215. }
  216. }
  217. /**
  218. * 验证数据
  219. */
  220. TalentInfoInfoDlg.validate = function () {
  221. $('#talentInfoForm').data("bootstrapValidator").resetForm();
  222. $('#talentInfoForm').bootstrapValidator('validate');
  223. return $("#talentInfoForm").data('bootstrapValidator').isValid();
  224. }
  225. /**
  226. * 提交添加
  227. */
  228. TalentInfoInfoDlg.addSubmit = function () {
  229. this.clearData();
  230. this.collectData();
  231. /*if (!TalentInfoInfoDlg.validate()) {
  232. return;
  233. }*/
  234. var id = $('#id').val();
  235. $("#province_name").val($("#province").find("option:selected").text());
  236. $("#city_name").val($("#city").find("option:selected").text());
  237. if ($("#county").val() != null && $("#county").val() != '') {
  238. $("#county_name").val($("#county").find("option:selected").text());
  239. }
  240. if ($("#source_city").val() != null && $("#source_city").val() != '') {
  241. $("#source_city_name").val($("#source_city").find("option:selected").text());
  242. }
  243. if ($("#source_county").val() != null && $("#source_county").val() != '') {
  244. $("#source_county_name").val($("#source_county").find("option:selected").text());
  245. }
  246. if (id != null && id != '') {
  247. if (!TalentInfoInfoDlg.validateIsEdit())
  248. return;
  249. }
  250. $("select").each(function () {
  251. $(this).removeAttr("disabled");
  252. });
  253. if (locked) {
  254. return;
  255. }
  256. locked = true;
  257. $("#talentInfoForm").attr("action", "/enterprise/base/add");
  258. $("#talentInfoForm")[0].submit();
  259. }
  260. //回调
  261. TalentInfoInfoDlg.infoCallback = function (data) {
  262. locked = false;
  263. TalentInfoInfoDlg.setNoChangeField();
  264. Feng.info(data.msg);
  265. if (data.code == 200) {
  266. window.parent.TalentInfo.table.refresh();
  267. $("#id").val(data.obj.id);
  268. $("#fileLi").removeAttr("style");
  269. $("#checkState").val(data.obj.checkState);
  270. }
  271. }
  272. /**
  273. * 获取人才认定
  274. */
  275. TalentInfoInfoDlg.getIdentifyCondition = function () {
  276. var level = $("#talent_arrange").val();
  277. var id = $('#id').val();
  278. Feng.addAjaxSelect({
  279. "id": "talent_condition",
  280. "displayCode": "id",
  281. "displayName": "name",
  282. "type": "GET",
  283. "url": Feng.ctxPath + "/common/api/findIdentifyConditionByLevel/level/" + level + "/id/" + id
  284. });
  285. $("#talent_condition").trigger('chosen:updated');
  286. }
  287. TalentInfoInfoDlg.getIdentifyNeedsFileTypes = function () {
  288. var queryData = {};
  289. queryData['project'] = CONFIG.project_rcrd;
  290. queryData['type'] = $("#type").val();
  291. queryData["talent_condition"] = $("#talent_condition").val();
  292. queryData['checkState'] = $("#checkState").val();
  293. $("#fileTable").bootstrapTable("refresh", {query: queryData});
  294. }
  295. TalentInfoInfoDlg.bankChange = function () {
  296. var bank = $("#bank").val();
  297. if ($.trim(bank) == '中国工商银行') {
  298. $("#bank_number").val('102391050013');
  299. } else {
  300. $("#bank_number").val('');
  301. }
  302. }
  303. TalentInfoInfoDlg.changeStudyAbroad = function () {
  304. var is_abroad = $("#study_abroad").val();
  305. if (is_abroad == 1) {
  306. $("#abroad_school").parent().css("display", "block");
  307. $("#abroad_major").parent().css("display", "block");
  308. $('#talentInfoForm').bootstrapValidator('addField', "abroad_school", {validators: {notEmpty: {message: '留学毕业院校不能为空'}}});
  309. $('#talentInfoForm').bootstrapValidator('addField', "abroad_major", {validators: {notEmpty: {message: '留学专业不能为空'}}});
  310. } else {
  311. $("#abroad_school").val("").parent().css("display", "none");
  312. $("#abroad_major").val("").parent().css("display", "none");
  313. $('#talentInfoForm').bootstrapValidator('removeField', "abroad_school");
  314. $('#talentInfoForm').bootstrapValidator('removeField', "abroad_major");
  315. }
  316. }
  317. /**
  318. * 加载市
  319. */
  320. TalentInfoInfoDlg.afterSelectProvince = function () {
  321. var province = $("#province").val();
  322. $("#city").empty();
  323. $("#county").empty();
  324. if (province == null || province == '') {
  325. return;
  326. }
  327. Feng.addAjaxSelect({
  328. "id": "city",
  329. "displayCode": "code",
  330. "displayName": "name",
  331. "type": "GET",
  332. "url": Feng.ctxPath + "/common/tool/findCityByProvinceSelect/code/" + province
  333. });
  334. }
  335. /**
  336. * 加载县
  337. */
  338. TalentInfoInfoDlg.afterSelectCity = function () {
  339. var city = $("#city").val();
  340. $("#county").empty();
  341. if (city == null || city == '') {
  342. return;
  343. }
  344. Feng.addAjaxSelect({
  345. "id": "county",
  346. "displayCode": "code",
  347. "displayName": "name",
  348. "type": "GET",
  349. "url": Feng.ctxPath + "/common/tool/findCountyByCitySelect/code/" + city
  350. });
  351. }
  352. TalentInfoInfoDlg.isAgeChecked = false;
  353. TalentInfoInfoDlg.birthdayChange = function () {
  354. let birthday = parseInt($("#birthday").val().substring(0, 4));
  355. let currentYear = parseInt(new Date().getFullYear());
  356. let age = currentYear - (isNaN(birthday) ? 0 : birthday);
  357. let option = $("[data-rel=birthday]");
  358. let limitAge = option.data("option");
  359. if (age >= limitAge) {
  360. option.css("display", "table-row");
  361. option.next("tr.detail-view").css("display", "table-row");
  362. if (!TalentInfoInfoDlg.isAgeChecked) {
  363. layer.alert("由于您的年龄大于70岁(含),要求提供人社局的允许申报的批文,请线下前往人社局办理。如已办理,请将该批文作为附件上传至对应附件栏中。");
  364. TalentInfoInfoDlg.isAgeChecked = true;
  365. return false;
  366. }
  367. } else {
  368. TalentInfoInfoDlg.isAgeChecked = false;
  369. option.css("display", "none");
  370. option.next("tr.detail-view").css("display", "none");
  371. }
  372. return true;
  373. }
  374. TalentInfoInfoDlg.initBirthday = function () {
  375. let birthday = parseInt($("#birthday").val().substring(0, 4));
  376. let currentYear = parseInt(new Date().getFullYear());
  377. let age = currentYear - (isNaN(birthday) ? 0 : birthday);
  378. let option = $("[data-rel=birthday]");
  379. let isFileExists = option.next("tr.detail-view").find("ul.imgs").find("li").length > 3 ? true : false;
  380. let limitAge = option.data("option");
  381. if (!isNaN(birthday)) {
  382. if (age >= limitAge && isFileExists) {
  383. TalentInfoInfoDlg.isAgeChecked = true;
  384. }
  385. TalentInfoInfoDlg.birthdayChange();
  386. }
  387. }
  388. TalentInfoInfoDlg.talentTypeChange = function () {
  389. var talent_type = $("#talent_type").val();
  390. //$("#tax_insurance_month").val("").parent().css("display", "none");
  391. //$("#labor_contract_rangetime").val("").parent().css("display", "none");
  392. $(".talentType1-2").css("display", "none");
  393. $(".talentType3").css("display", "none");
  394. var text = "";
  395. switch (talent_type) {
  396. case "1":
  397. TalentInfoInfoDlg.talentTypeOneTwo = true;
  398. $("#tipsBlock").css('display', 'block');
  399. $("#typeTips").html("含经晋江市认定且还在晋江市就业创业的人才,或在晋江市就业创业但未曾申报过晋江市现代产业体系人才的人才。");
  400. //$("#desc_talent_type").html("请上传社会保险或个人所得税缴费佐证材料");
  401. $(".talentType1-2").css("display", "table-row");
  402. $("#talentType_first").css('display', "none");
  403. $('#talentInfoForm').bootstrapValidator('addField', "tax_insurance_month", {
  404. validators: {
  405. notEmpty: {message: '在我市缴交社会保险或个人所得税月份不能为空'}
  406. }
  407. });
  408. $('#talentInfoForm').bootstrapValidator('addField', "labor_contract_rangetime", {validators: {notEmpty: {message: '劳动合同起止时间'}}});
  409. $('#talentInfoForm').bootstrapValidator('addField', "salary_pay_way", {validators: {notEmpty: {message: '请选择工资发放渠道'}}});
  410. $('#talentInfoForm').bootstrapValidator('addField', "salary_pay_month", {validators: {notEmpty: {message: '请选择工资发放月份'}}});
  411. if (TalentInfoInfoDlg.talentTypeFlag) {
  412. TalentInfoInfoDlg.talentTypeFlag = false;
  413. $('#talentInfoForm').bootstrapValidator('removeField', "pre_import_type");
  414. }
  415. text = $("#fst_work_time").length > 0 ? $("#fst_work_time").prev("label").html().replace(/首次/, "近三年") : "";
  416. $("#come_in_jin").length > 0 ? $("#come_in_jin").css('display', 'table-row') : "";
  417. $("#come_in_jin_str").length > 0 ? $("#come_in_jin_str").css('display', 'table-cell') : "";
  418. break;
  419. case "2":
  420. TalentInfoInfoDlg.talentTypeOneTwo = true;
  421. $("#tipsBlock").css('display', 'block');
  422. $("#typeTips").html("含本办法出台后首次从晋江市以外引进认定的人才,或者流出晋江市满3年后又返回晋江市就业创业(不含企业集团内部人员调动)的人才。")
  423. //$("#desc_talent_type").html("请上传社会保险或个人所得税缴费佐证材料与来我市前工作情况证明,例如原工作单位出具的工作证明、离职证明或原创(领)办企业的营业执照复印件、经市场监管部门备案的公司章程复印件等证明材料");
  424. $(".talentType1-2").css("display", "table-row");
  425. $("#talentType_first").css('display', "inline");
  426. $('#talentInfoForm').bootstrapValidator('addField', "tax_insurance_month", {
  427. validators: {
  428. notEmpty: {message: '在我市缴交社会保险或个人所得税月份不能为空'}
  429. }
  430. });
  431. $('#talentInfoForm').bootstrapValidator('addField', "labor_contract_rangetime", {validators: {notEmpty: {message: '劳动合同起止时间'}}});
  432. $('#talentInfoForm').bootstrapValidator('addField', "salary_pay_way", {validators: {notEmpty: {message: '请选择工资发放渠道'}}});
  433. $('#talentInfoForm').bootstrapValidator('addField', "salary_pay_month", {validators: {notEmpty: {message: '请选择工资发放月份'}}});
  434. if (TalentInfoInfoDlg.talentTypeFlag) {
  435. TalentInfoInfoDlg.talentTypeFlag = false;
  436. $('#talentInfoForm').bootstrapValidator('removeField', "pre_import_type");
  437. }
  438. text = $("#fst_work_time").length > 0 ? $("#fst_work_time").prev("label").html().replace(/近三年/, "首次") : "";
  439. $("#come_in_jin").length > 0 ? $("#come_in_jin").css('display', 'table-row') : "";
  440. $("#come_in_jin_str").length > 0 ? $("#come_in_jin_str").css('display', 'none') : "";
  441. break;
  442. case "3":
  443. TalentInfoInfoDlg.talentTypeFlag = true;
  444. $("#tipsBlock").css('display', 'block');
  445. $("#typeTips").html("含已经与晋江市用人单位达成就业意向且签订预引进意向合作协议(合同)的人才,或拟来我市创业且提交企业名称预先核准的人才。")
  446. //$("#desc_talent_type").html("请先提供意向合作协议(合同)或企业名称预先核准材料,落地我市后再补齐上述材料");
  447. $(".talentType3").css("display", "table-row");
  448. $("#talentType_first").css('display', "none");
  449. $('#talentInfoForm').bootstrapValidator('addField', "pre_import_type", {validators: {notEmpty: {message: '请选择预引进类型'}}});
  450. if (TalentInfoInfoDlg.talentTypeOneTwo) {
  451. TalentInfoInfoDlg.talentTypeOneTwo = false;
  452. $('#talentInfoForm').bootstrapValidator('removeField', "labor_contract_rangetime");
  453. $('#talentInfoForm').bootstrapValidator('removeField', "tax_insurance_month");
  454. $('#talentInfoForm').bootstrapValidator('removeField', "salary_pay_way");
  455. $('#talentInfoForm').bootstrapValidator('removeField', "salary_pay_month");
  456. }
  457. text = $("#fst_work_time").length > 0 ? $("#fst_work_time").prev("label").html().replace(/近三年/, "首次") : "";
  458. $("#come_in_jin").length > 0 ? $("#come_in_jin").css('display', 'none') : "";
  459. $("#come_in_jin_str").length > 0 ? $("#come_in_jin_str").css('display', 'none') : "";
  460. break;
  461. default:
  462. $("#tipsBlock").css('display', 'none');
  463. text = $("#fst_work_time").length > 0 ? $("#fst_work_time").prev("label").html().replace(/近三年/, "首次") : "";
  464. break;
  465. }
  466. $("#fst_work_time").prev("label").html(text);
  467. for (var i = 0; i < $("[data-rel=talent_type]").length; i++) {
  468. let option = $("[data-rel=talent_type]").eq(i);
  469. let options = option.data("option").toString().split(",");
  470. if (options.indexOf(talent_type) > -1) {
  471. option.css("display", "table-row");
  472. option.next("tr.detail-view").css("display", "table-row");
  473. } else {
  474. option.css("display", "none");
  475. option.next("tr.detail-view").css("display", "none");
  476. }
  477. }
  478. }
  479. TalentInfoInfoDlg.sourceChange = function () {
  480. var source = $("#source").val();
  481. $("#source_batch").val("").parent().css("display", "none");
  482. $("#fujian_highcert_pubtime").val("").parent().css("display", "none");
  483. $("#fujian_highcert_exptime").val("").parent().css("display", "none");
  484. $("#quanzhou_highcert_pubtime").val("").parent().css("display", "none");
  485. $("#quanzhou_highcert_exptime").val("").parent().css("display", "none");
  486. $("#source_city").val("").parent().css("display", "none");
  487. $("#source_county").val("").parent().css("display", "none");
  488. $('#talentInfoForm').bootstrapValidator('removeField', "source_batch");
  489. $('#talentInfoForm').bootstrapValidator('removeField', "fujian_highcert_pubtime");
  490. $('#talentInfoForm').bootstrapValidator('removeField', "fujian_highcert_exptime");
  491. $('#talentInfoForm').bootstrapValidator('removeField', "quanzhou_highcert_pubtime");
  492. $('#talentInfoForm').bootstrapValidator('removeField', "quanzhou_highcert_exptime");
  493. $('#talentInfoForm').bootstrapValidator('removeField', "source_city");
  494. $('#talentInfoForm').bootstrapValidator('removeField', "source_county");
  495. switch (source) {
  496. case "1":
  497. case "3":
  498. $("#source_batch").parent().css("display", "block");
  499. $("#fujian_highcert_pubtime").parent().css("display", "block");
  500. $("#fujian_highcert_exptime").parent().css("display", "block");
  501. $('#talentInfoForm').bootstrapValidator('addField', "source_batch", {validators: {notEmpty: {message: '申报来源批次不能为空'}}});
  502. $('#talentInfoForm').bootstrapValidator('addField', "fujian_highcert_pubtime", {validators: {notEmpty: {message: '福建省高层次人才证书发证日期不能为空'}}});
  503. $('#talentInfoForm').bootstrapValidator('addField', "fujian_highcert_exptime", {validators: {notEmpty: {message: '福建省高层次人才证书有效期不能为空'}}});
  504. break;
  505. case "2":
  506. case "4":
  507. $("#source_batch").parent().css("display", "block");
  508. $("#quanzhou_highcert_pubtime").parent().css("display", "block");
  509. $("#quanzhou_highcert_exptime").parent().css("display", "block");
  510. $('#talentInfoForm').bootstrapValidator('addField', "source_batch", {validators: {notEmpty: {message: '申报来源批次不能为空'}}});
  511. $('#talentInfoForm').bootstrapValidator('addField', "quanzhou_highcert_pubtime", {validators: {notEmpty: {message: '泉州高层次人才证书发证日期不能为空'}}});
  512. $('#talentInfoForm').bootstrapValidator('addField', "quanzhou_highcert_exptime", {validators: {notEmpty: {message: '泉州高层次人才证书有效期不能为空'}}});
  513. break;
  514. }
  515. if (source == 3) {
  516. //显示入选来源地级市除泉
  517. $("#source_city").parent().css("display", "block");
  518. Feng.addAjaxSelect({
  519. "id": "source_city",
  520. "displayCode": "code",
  521. "displayName": "name",
  522. "type": "GET",
  523. "url": "/common/tool/findChildAreaByCode/code/35/no/350500"
  524. });
  525. $('#talentInfoForm').bootstrapValidator('addField', "source_city", {validators: {notEmpty: {message: '入选来源地级市不能为空'}}});
  526. }
  527. if (source == 4) {
  528. //显示入选来源县市区除晋
  529. $("#source_county").parent().css("display", "block");
  530. Feng.addAjaxSelect({
  531. "id": "source_county",
  532. "displayCode": "code",
  533. "displayName": "name",
  534. "type": "GET",
  535. "url": "/common/tool/findChildAreaByCode/code/3505/no/350582"
  536. });
  537. $('#talentInfoForm').bootstrapValidator('addField', "source_county", {validators: {notEmpty: {message: '入选来源县市区不能为空'}}});
  538. }
  539. }
  540. /**
  541. * 初始化表格的列
  542. */
  543. TalentInfoInfoDlg._initFileTypeColumn = function () {
  544. return [
  545. {field: 'selectItem', checkbox: false, visible: false},
  546. {title: '名称', field: 'name', visible: true, align: 'left', valign: 'middle', width: "75%", 'class': 'uitd_showTip',
  547. formatter: function (value, row, index) {
  548. let str = '<div class="word-wrap">';
  549. if (row.must == 1) {
  550. str = str + '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + value;
  551. }
  552. if (row.must == 2) {
  553. str = str + '<i class="fa fa-paste"></i>' + value;
  554. }
  555. str = str + '<br /><span id="desc_' + row.rel + '">' + row.description + '</span></div>'
  556. return str;
  557. }
  558. },
  559. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "8%",
  560. formatter: function (value, row, index) {
  561. if (value == null || value == '' || value == 'null') {
  562. return '';
  563. }
  564. return "<button type='button' onclick=\"TalentInfoInfoDlg.downloadFile('" + row.id + "',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  565. "<i class=\"fa fa-download\"></i>下载" +
  566. "</button>";
  567. }
  568. },
  569. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "17%",
  570. formatter: function (value, row, index) {
  571. return TalentInfoInfoDlg.validUploadButton(1, value, '', row.tableIndex, row.trIndex);
  572. }
  573. }
  574. ]
  575. };
  576. TalentInfoInfoDlg.initFile = function () {
  577. var ajax = new $ax("/common/api/findCommonFileType", function (data) {
  578. if (data == null || data.length == 0) {
  579. return;
  580. }
  581. var datas = new Array();
  582. for (var i = 0; i < $(".fileTable").length; i++) {
  583. datas.push([]);//创建空的多维数组,等下用来存每个附件表的各自的列
  584. }
  585. var enterpriseTag = $("#enterprise_tag").val();
  586. for (var k in data["rows"]) {
  587. if (data["rows"][k].enterprise_tag != "" && data["rows"][k].enterprise_tag != null && data["rows"][k].enterprise_tag.indexOf(enterpriseTag) == -1) {
  588. continue;
  589. }
  590. var rel = data["rows"][k].rel;
  591. if ($("#" + rel).length > 0) {
  592. var tableIndex = $("#" + rel).parents(".table").find("table.fileTable").index(".fileTable");
  593. data["rows"][k].rel = rel;
  594. data["rows"][k].tableIndex = tableIndex;
  595. data["rows"][k].trIndex = datas[tableIndex].length;
  596. datas[tableIndex].push(data["rows"][k]);
  597. if (data["rows"][k].option) {
  598. //指定了选项
  599. if (rel == "birthday") {
  600. let age = 0;
  601. if ($("#" + rel).val()) {
  602. let birthDate = new Date($("#" + rel).val());//生日日期
  603. let birthYear = birthDate.getFullYear();
  604. let birthMonth = birthDate.getMonth() + 1;
  605. let currentDate = new Date();//当前日期
  606. let currentYear = currentDate.getFullYear();
  607. let currentMonth = currentDate.getMonth() + 1;
  608. age = (currentYear * 12 + currentMonth - birthYear * 12 - birthMonth) / 12;
  609. }
  610. if (age < data["rows"][k].option)
  611. data["rows"][k].hidden = true;
  612. } else {
  613. let selectVal = $("#" + rel).val();
  614. let options = data["rows"][k].option.split(",");
  615. if (options.indexOf(selectVal) == -1) {
  616. data["rows"][k].hidden = true;
  617. }
  618. }
  619. }
  620. } else {
  621. if (data["rows"][k].isConditionFile) {
  622. var tableIndex = $("#talent_condition").parents(".row").next(".row").find("table.fileTable").index(".fileTable");
  623. data["rows"][k].tableIndex = tableIndex;
  624. data["rows"][k].trIndex = datas[tableIndex].length;
  625. datas[tableIndex].push(data["rows"][k]);//放入人才条件后面的附件表
  626. } else {
  627. var tableIndex = $(".fileTable").length - 1;
  628. data["rows"][k].tableIndex = tableIndex;
  629. data["rows"][k].trIndex = datas[tableIndex].length;
  630. datas[$(".fileTable").length - 1].push(data["rows"][k]);//没有归属,放入最后一个附件表
  631. }
  632. }
  633. }
  634. for (var i = 0; i < $(".fileTable").length; i++) {
  635. var that = $(".fileTable").eq(i);
  636. that.bootstrapTable({
  637. columns: TalentInfoInfoDlg._initFileTypeColumn(),
  638. data: datas[i],
  639. showHeader: false,
  640. rowStyle: function (row, index) {
  641. return {classes: ""};
  642. },
  643. onPostBody: function (data) {
  644. for (var k in data) {
  645. var files = data[k].files;
  646. var html = '<ul class="imgs"><li style="width: 70%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li><li style="width: 20%;font-weight: bold;padding-top: 5px;">操作</li>';
  647. for (var key in files) {
  648. var btn = TalentInfoInfoDlg.validUploadButton(2, data[k].id, files[key].id, i, k);
  649. var sn = files[key].url.lastIndexOf(".");
  650. var suffix = files[key].ext;//files[key].url.substring(sn + 1, files[key].url.length);
  651. var imgStr = "";
  652. if (suffix == "pdf" || suffix == "PDF") {
  653. imgStr = "<button type='button' onclick=\"Feng.showPdf('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  654. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS' || suffix == 'docx' || suffix == 'doc' || suffix == 'DOCX' || suffix == 'DOC') {
  655. imgStr = "<button type='button' onclick=\"Feng.showExcel('" + files[key].url + "','" + files[key].id + "','" + files[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  656. } else {
  657. imgStr = '<img class=\"imgUrl\" onclick=\"Feng.showImg(this)\" src=\"' + files[key].url + '\" style=\"width:25px;height:25px;\">';
  658. }
  659. html += '<li data-id="' + files[key].id + '">\n\
  660. <div><input type="hidden" name="uploadFiles[]" value="' + files[key].id + '"></div>\n' +
  661. '<div style="width: 70%;">' + files[key].orignName + '</div>\n' +
  662. '<div style="width: 10%;">' + imgStr + '</div>\n' +
  663. '<div style="width: 20%;">' + btn + '</div>\n\
  664. </li>';
  665. }
  666. html = html + '</ul>';
  667. that.find("tr[data-index='" + k + "']").attr("data-rel", data[k]["rel"]);
  668. that.find("tr[data-index='" + k + "']").attr("data-option", data[k]["option"]);
  669. that.find("tr[data-index='" + k + "']").after('<tr class="detail-view"><td colspan="5">' + html + '</td></tr>');
  670. if (typeof data[k].hidden != "undefined") {
  671. that.find("tr[data-index='" + k + "']").css("display", "none");
  672. that.find("tr[data-index='" + k + "']").next("tr.detail-view").css("display", "none");
  673. }
  674. }
  675. $("td.uitd_showTip").bind("mouseover", function () {
  676. //var htm = $(this).html();
  677. //$(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  678. });
  679. },
  680. });
  681. }
  682. //$(".ibox-content").viewer({fullscreen: false});
  683. }, function (data) {
  684. Feng.error("查询失败!" + data.responseJSON.message + "!");
  685. });
  686. var queryData = {};
  687. queryData["mainId"] = $("#id").val();
  688. queryData['project'] = CONFIG.project_rcrd;
  689. queryData['type'] = $("#type").val();
  690. queryData["talent_condition"] = $("#talent_condition option:selected").val();
  691. queryData['checkState'] = $("#checkState").val();
  692. ajax.set(queryData);
  693. ajax.start();
  694. }
  695. //校验是否保存基础信息
  696. TalentInfoInfoDlg.validId = function () {
  697. var id = $("#id").val();
  698. if (id != null && id != '') {
  699. $("#fileLi").removeAttr("style");
  700. } else {
  701. $("#fileLi").attr("style", "pointer-events: none");
  702. }
  703. }
  704. //选择附件并显示附件名
  705. TalentInfoInfoDlg.checkFile = function (content, fileTypeId, fileId, tableIndex, trIndex) {
  706. if (!TalentInfoInfoDlg.validateIsEdit())
  707. return;
  708. $("#upload_file").unbind("change");
  709. $("#upload_file").change(function () {
  710. if (!Feng.chkFileInvalid(this.files[0], 5, 10))
  711. return;
  712. TalentInfoInfoDlg.upload(fileTypeId, fileId, tableIndex, trIndex);
  713. });
  714. $('#upload_file').val("");
  715. $('#upload_file').click();
  716. }
  717. //上传附件
  718. TalentInfoInfoDlg.upload = function (fileTypeId, fileId, tableIndex, trIndex) {
  719. var id = $("#id").val();
  720. if (!TalentInfoInfoDlg.validateIsEdit())
  721. return;
  722. if (fileId != null && fileId != 'null') {
  723. $("#fileId").val(fileId)
  724. } else {
  725. $("#fileId").val("");
  726. }
  727. $("#mainId").val(id);
  728. $("#fileTypeId").val(fileTypeId);
  729. $("#tableIndex").val(tableIndex);
  730. $("#trIndex").val(trIndex);
  731. var index = layer.load(0, {shade: false, time: 0});
  732. $("#index").val(index);
  733. $("#uploadForm").submit();
  734. }
  735. //删除附件
  736. TalentInfoInfoDlg.deleteFile = function (id, state) {
  737. if (!TalentInfoInfoDlg.validateIsEdit())
  738. return;
  739. var operation = function () {
  740. var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
  741. if (data.code == 200) {
  742. Feng.success(data.msg);
  743. $("input[name='uploadFiles[]'][value='" + id + "']").parents("li").remove();
  744. //$("#fileTable").bootstrapTable("refresh", {});
  745. } else {
  746. Feng.error(data.msg);
  747. }
  748. }, function (data) {
  749. Feng.error("删除失败!" + data.responseJSON.message + "!");
  750. });
  751. ajax.set("id", id);
  752. ajax.set("type", 1);
  753. ajax.start();
  754. }
  755. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  756. }
  757. /**
  758. * 提交审核
  759. */
  760. TalentInfoInfoDlg.submitToCheck = function () {
  761. /*if (!TalentInfoInfoDlg.validate()) {
  762. return;
  763. }*/
  764. if (!TalentInfoInfoDlg.birthdayChange())
  765. return;
  766. var id = $("#id").val();
  767. /*if (id == null || id == "") {
  768. Feng.info("请先填写基础信息并上传附件");
  769. return;
  770. }*/
  771. if (!TalentInfoInfoDlg.validateIsEdit())
  772. return;
  773. var operation = function () {
  774. TalentInfoInfoDlg.clearData();
  775. TalentInfoInfoDlg.collectData();
  776. /*if (!TalentInfoInfoDlg.validate()) {
  777. return;
  778. }*/
  779. var id = $('#id').val();
  780. if (id != null && id != '') {
  781. if (!TalentInfoInfoDlg.validateIsEdit())
  782. return;
  783. }
  784. $("select").each(function () {
  785. $(this).removeAttr("disabled");
  786. });
  787. if (locked) {
  788. return;
  789. }
  790. locked = true;
  791. $("#talentInfoForm").attr("action", "/enterprise/base/submit");
  792. $("#talentInfoForm")[0].submit();
  793. return;
  794. var ajax = new $ax(Feng.ctxPath + "/enterprise/base/submit", function (data) {
  795. if (data.code == 200) {
  796. Feng.success(data.msg);
  797. // $("#checkState").val(data.obj);
  798. window.parent.TalentInfo.table.refresh();
  799. TalentInfoInfoDlg.close();
  800. } else {
  801. Feng.error(data.msg);
  802. }
  803. }, function (data) {
  804. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  805. });
  806. ajax.set("id", id);
  807. ajax.start();
  808. }
  809. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  810. }
  811. //回调
  812. TalentInfoInfoDlg.submitCallback = function (data) {
  813. locked = false;
  814. TalentInfoInfoDlg.setNoChangeField();
  815. if (data.code == 200) {
  816. Feng.success(data.msg);
  817. // $("#checkState").val(data.obj);
  818. window.parent.TalentInfo.table.refresh();
  819. TalentInfoInfoDlg.close();
  820. } else {
  821. Feng.error(data.msg);
  822. }
  823. }
  824. /**
  825. * 校验是否可以修改/提交审核
  826. */
  827. TalentInfoInfoDlg.validateIsEdit = function () {
  828. var checkState = $("#checkState").val();
  829. if (checkState != 0 && checkState != 1 && checkState != 3 && checkState != 5 && checkState != 8) {
  830. if (checkState == 16 || checkState == -1 || checkState == -2 || checkState == 7) {
  831. Feng.error("您的申报审核不通过,无法再修改");
  832. return false;
  833. } else if (checkState == 28) {
  834. Feng.error("申报已完成");
  835. return false;
  836. } else if (checkState == 14) {
  837. Feng.error("您的申报已审核通过,无法再修改");
  838. return false;
  839. } else if (checkState == 22 || checkState == 25 || checkState == 27) {
  840. Feng.error("该申报已终止");
  841. return false;
  842. } else {
  843. Feng.error("您的申报正在审核中,请耐心等待");
  844. return false;
  845. }
  846. }
  847. return true;
  848. }
  849. /**
  850. * 校验是否显示按钮
  851. * @param type 类型 1-上传按钮,2-修改删除按钮
  852. * @param row
  853. * @returns {string}
  854. */
  855. TalentInfoInfoDlg.validUploadButton = function (type, fileTypeId, fileId, tableIndex, trIndex) {
  856. var files = $("#files").val();
  857. files = files.split(",");
  858. var checkState = $("#checkState").val();
  859. var realState = $("#realState").val();
  860. if (Feng.isEmptyStr(checkState) || checkState == 0 || (checkState == 1 && realState != 4) || checkState == 3 || checkState == 8 || (realState == 4 && files.indexOf(fileTypeId.toString()) != -1)) {
  861. if ((checkState == 3 || checkState == 8))
  862. return "";
  863. if (type == 1) { //上传
  864. return "<button type='button' onclick=\"TalentInfoInfoDlg.checkFile(this," + fileTypeId + "," + null + "," + tableIndex + "," + trIndex + ")\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  865. "<i class=\"fa fa-upload\"></i>上传" +
  866. "</button>";
  867. } else {
  868. return "<button type=\'button\' onclick=\"TalentInfoInfoDlg.checkFile(this," + fileTypeId + "," + fileId + "," + tableIndex + "," + trIndex + ")\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
  869. "<i class=\"fa fa-paste\"></i>修改" +
  870. "</button>" +
  871. "<button type='button' onclick=\"TalentInfoInfoDlg.deleteFile(" + fileId + ")\" class=\"btn btn-xs btn-danger\">" +
  872. "<i class=\"fa fa-times\"></i>删除" +
  873. "</button>";
  874. }
  875. } else {
  876. return type == 1 ? "" : "";
  877. }
  878. }
  879. //回调
  880. TalentInfoInfoDlg.callBack = function (data) {
  881. layer.close(data.obj);
  882. Feng.info(data.msg);
  883. if (data.code == 200) {
  884. var tableIndex = $("#tableIndex").val();
  885. var trIndex = $("#trIndex").val();
  886. var sn = data.info.lastIndexOf(".");
  887. var suffix = data.ext;//data.info.substring(sn + 1, data.info.length);
  888. var imgStr = "";
  889. if (suffix == "pdf" || suffix == "PDF") {
  890. imgStr = "<button type='button' onclick=\"Feng.showPdf('" + data.info + "','" + data.id + "','" + data.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  891. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS' || suffix == 'docx' || suffix == 'doc' || suffix == 'DOCX' || suffix == 'DOC') {
  892. imgStr = "<button type='button' onclick=\"Feng.showExcel('" + data.info + "','" + data.id + "','" + data.orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  893. } else {
  894. imgStr = '<img class="imgUrl" onclick=\"Feng.showImg(this)\" src="' + data.info + '" style="width:25px;height:25px;">';
  895. }
  896. var li = $("input[name='uploadFiles[]'][value='" + data.id + "'").parents("li");
  897. if (li.length > 0) {
  898. li.find("div").eq(1).html(data.orignName);
  899. li.find("div").eq(2).html(imgStr);
  900. } else {
  901. var html = '<li data-id="' + data.id + '">\n\
  902. <div><input type="hidden" name="uploadFiles[]" value="' + data.id + '"></div>\n\
  903. <div style="width: 70%;">' + data.orignName + '</div>\n\
  904. <div style="width: 10%;">' + imgStr + '</div>\n\
  905. <div style="width: 20%;">\n\
  906. <button type="button" onclick="TalentInfoInfoDlg.checkFile(this,' + data.typeId + ',' + data.id + ',' + tableIndex + ',' + trIndex + ')" style="margin-right: 10px" class="btn btn-xs btn-info"><i class="fa fa-paste"></i>修改</button>\n\
  907. <button type="button" onclick="TalentInfoInfoDlg.deleteFile(' + data.id + ')" class="btn btn-xs btn-danger"><i class="fa fa-times"></i>删除</button>\n\
  908. </div></li></ul>';
  909. $(".fileTable").eq(tableIndex).find("tr[data-index='" + trIndex + "']").next("tr.detail-view").find(".imgs").append(html);
  910. }
  911. //$(".fileTable").eq(tableIndex).find("tr[data-index='" + trIndex + "']").next("tr.detail-view").find(".imgs").viewer({fullscreen: false});
  912. }
  913. }
  914. TalentInfoInfoDlg.downloadFile = function (id, type) {
  915. window.location.href = Feng.ctxPath + "/api/common/downloadFile?id=" + id + "&type=" + type;
  916. }
  917. //设置不可修改的字段
  918. TalentInfoInfoDlg.setNoChangeField = function () {
  919. var checkState = $("#checkState").val();
  920. var fields = $("#fields").val();
  921. var realState = $("#realState").val();
  922. if (realState == 4) {
  923. $("input,textarea").each(function () {
  924. $(this).attr("readonly", "readonly");
  925. });
  926. $("select,input[type=radio]").each(function () {
  927. $(this).attr("disabled", "disabled");
  928. });
  929. if (fields != null && fields != '') {
  930. var arr = fields.split(",");
  931. for (var key in arr) {
  932. if (arr[key] != "") {
  933. var name = $("#" + arr[key]).prop("tagName");
  934. if (name == 'select' || name == 'SELECT') {
  935. $("#" + arr[key]).removeAttr("disabled");
  936. } else if (name == "input" || name == 'textarea' || name == "INPUT" || name == 'TEXTAREA') {
  937. $("#" + arr[key]).removeAttr("readonly");
  938. } else {
  939. if (typeof name == "undefined") {
  940. $("input[name=" + arr[key] + "]").removeAttr("disabled").removeAttr("readonly");
  941. }
  942. }
  943. }
  944. }
  945. }
  946. }
  947. }
  948. TalentInfoInfoDlg.__initValidateCondition = function () {
  949. var step = $("#step").val();
  950. if (step == 1) {
  951. $('#talentInfoForm').bootstrapValidator('addField', "source_county", {validators: {notEmpty: {message: '入选来源县市区不能为空'}}});
  952. $('#talentInfoForm').bootstrapValidator('addField', "talent_type", {validators: {notEmpty: {message: '人才类型不能为空'}}});
  953. $('#talentInfoForm').bootstrapValidator('addField', "name", {validators: {notEmpty: {message: '姓名不能为空'}}});
  954. $('#talentInfoForm').bootstrapValidator('addField', "card_type", {validators: {notEmpty: {message: '证件类型不能为空'}}});
  955. $('#talentInfoForm').bootstrapValidator('addField', "card_number", {validators: {notEmpty: {message: '证件号码不能为空'}}});
  956. $('#talentInfoForm').bootstrapValidator('addField', "sex", {validators: {notEmpty: {message: '性别不能为空'}}});
  957. $('#talentInfoForm').bootstrapValidator('addField', "birthday", {validators: {notEmpty: {message: '出生日期不能为空'}}});
  958. $('#talentInfoForm').bootstrapValidator('addField', "nationality", {validators: {notEmpty: {message: '国籍/地区不能为空'}}});
  959. $('#talentInfoForm').bootstrapValidator('addField', "province", {validators: {notEmpty: {message: '户籍省份不能为空'}}});
  960. $('#talentInfoForm').bootstrapValidator('addField', "city", {validators: {notEmpty: {message: '户籍市不能为空'}}});
  961. $('#talentInfoForm').bootstrapValidator('addField', "nation", {validators: {notEmpty: {message: '民族不能为空'}}});
  962. $('#talentInfoForm').bootstrapValidator('addField', "politics", {validators: {notEmpty: {message: '政治面貌不能为空'}}});
  963. } else {
  964. $('#talentInfoForm').bootstrapValidator('addField', "apply_year", {validators: {notEmpty: {message: '申报年度不能为空'}}});
  965. $('#talentInfoForm').bootstrapValidator('addField', "import_way", {validators: {notEmpty: {message: '引进方式不能为空'}}});
  966. $('#talentInfoForm').bootstrapValidator('addField', "cur_entry_time", {validators: {notEmpty: {message: '本单位入职时间不能为空'}}});
  967. $('#talentInfoForm').bootstrapValidator('addField', "position", {validators: {notEmpty: {message: '本单位现任职务不能为空'}}});
  968. $('#talentInfoForm').bootstrapValidator('addField', "source", {validators: {notEmpty: {message: '申报来源不能为空'}}});
  969. $('#talentInfoForm').bootstrapValidator('addField', "talent_arrange", {validators: {notEmpty: {message: '人才层次不能为空'}}});
  970. $('#talentInfoForm').bootstrapValidator('addField', "talent_condition", {validators: {notEmpty: {message: '认定条件不能为空'}}});
  971. $('#talentInfoForm').bootstrapValidator('addField', "highest_degree", {validators: {notEmpty: {message: '最高学历不能为空'}}});
  972. $('#talentInfoForm').bootstrapValidator('addField', "graduate_school", {validators: {notEmpty: {message: '毕业院校不能为空'}}});
  973. $('#talentInfoForm').bootstrapValidator('addField', "major", {validators: {notEmpty: {message: '专业不能为空'}}});
  974. $('#talentInfoForm').bootstrapValidator('addField', "bank", {
  975. validators: {
  976. notEmpty: {
  977. message: '开户银行不能为空'
  978. },
  979. regexp: {
  980. regexp: /^[\u4e00-\u9fa5]*银行$/,
  981. message: "开户银行格式不正确"
  982. }
  983. }
  984. });
  985. $('#talentInfoForm').bootstrapValidator('addField', "bank_number", {
  986. validators: {
  987. notEmpty: {
  988. message: '银行行号不能为空'
  989. },
  990. regexp: {
  991. regexp: /^\d+$/,
  992. message: "银行行号格式不正确"
  993. }
  994. }
  995. });
  996. $('#talentInfoForm').bootstrapValidator('addField', "bank_branch_name", {
  997. validators: {
  998. notEmpty: {
  999. message: '开户银行网点不能为空'
  1000. },
  1001. regexp: {
  1002. regexp: /^[\u4e00-\u9fa5]*银行[\u4e00-\u9fa5]*省?[\u4e00-\u9fa5]+市[\u4e00-\u9fa5]*$/,
  1003. message: "开户银行格式不正确"
  1004. }
  1005. }
  1006. });
  1007. $('#talentInfoForm').bootstrapValidator('addField', "bank_account", {
  1008. validators: {
  1009. notEmpty: {
  1010. message: '银行账号不能为空'
  1011. },
  1012. regexp: {
  1013. regexp: /^\d+$/,
  1014. message: "银行账号格式不正确"
  1015. }
  1016. }
  1017. });
  1018. $('#talentInfoForm').bootstrapValidator('addField', "phone", {
  1019. validators: {
  1020. notEmpty: {
  1021. message: '手机号码不能为空'
  1022. },
  1023. regexp: {
  1024. regexp: /0?(13|14|15|16|17|18|19)[0-9]{9}/,
  1025. message: "手机号码格式不正确"
  1026. }
  1027. }
  1028. });
  1029. $('#talentInfoForm').bootstrapValidator('addField', "email", {
  1030. validators: {
  1031. notEmpty: {
  1032. message: '电子邮箱不能为空'
  1033. },
  1034. emailAddress: {
  1035. message: "电子邮箱格式不正确"
  1036. }
  1037. }
  1038. });
  1039. }
  1040. }
  1041. $("#card_type").change(function () {
  1042. async_padding($("#card_number").val().trim(), $(this).val());
  1043. })
  1044. $("#card_number").blur(function () {
  1045. async_padding($(this).val().trim(), $("#card_type").val());
  1046. })
  1047. function async_padding(card_number, card_type) {
  1048. if (card_number != "" && card_number.length == 18 && card_type == "1") {
  1049. var year = card_number.substring(6, 10);
  1050. var month = card_number.substring(10, 12);
  1051. var day = card_number.substring(12, 14);
  1052. var birthday = year + "-" + month + "-" + day;
  1053. var rule = /\d{4}-\d{2}-\d{2}/;
  1054. if (rule.test(birthday))
  1055. $("#birthday").val(birthday);
  1056. var num = card_number.substring(17, 1);
  1057. if (num % 2 == 0) {
  1058. $("#sex").val(2);
  1059. } else {
  1060. $("#sex").val(1);
  1061. }
  1062. }
  1063. }
  1064. $(function () {
  1065. TalentInfoInfoDlg.talentTypeFlag = false;
  1066. TalentInfoInfoDlg.talentTypeOneTwo = true;
  1067. //Feng.initValidatorTip("talentInfoForm", TalentInfoInfoDlg.validateFields);
  1068. var id = $("#id").val();
  1069. var checkState = $("#checkState").val();
  1070. //批量加载字典表数据
  1071. var arr = [
  1072. {"name": "nation", "code": "nation"},
  1073. {"name": "talent_arrange", "code": "talent_arrange"},
  1074. {"name": "nationality", "code": "nationality"},
  1075. {"name": "politics", "code": "politics"},
  1076. {"name": "highest_degree", "code": "highest_degree"},
  1077. {"name": "source", "code": "source"},
  1078. {"name": "import_way", "code": "import_way"}];
  1079. Feng.findChildDictBatch(JSON.stringify(arr))
  1080. //加载省份
  1081. Feng.addAjaxSelect({
  1082. "id": "province",
  1083. "displayCode": "code",
  1084. "displayName": "name",
  1085. "type": "GET",
  1086. "url": "/common/tool/getProvinceSelect"
  1087. });
  1088. //批量加载时间控件
  1089. $(".date").each(function () {
  1090. laydate.render({
  1091. elem: this
  1092. , type: 'date'
  1093. , trigger: 'click'
  1094. });
  1095. });
  1096. laydate.render({
  1097. elem: "#birthday"
  1098. })
  1099. $(".rangedate").each(function () {
  1100. laydate.render({
  1101. elem: this,
  1102. type: "date",
  1103. range: true,
  1104. trigger: "click"
  1105. })
  1106. })
  1107. $(".rangemonth").each(function () {
  1108. laydate.render({
  1109. elem: this,
  1110. type: "month",
  1111. range: true,
  1112. trigger: "click"
  1113. })
  1114. })
  1115. if (id != null && id != '') {
  1116. //select初始化
  1117. $("select").each(function () {
  1118. $(this).val($(this).attr("value")).trigger("change");
  1119. });
  1120. Feng.getCheckLog("logTable", {"type": CONFIG.project_rcrd, "mainId": id, "typeFileId": "", "active": 1})
  1121. }
  1122. $("#talent_type").val($("#talent_type").attr("value"));
  1123. $("#card_type").val($("#card_type").attr("value"));
  1124. $("#sex").val($("#sex").attr("value"));
  1125. $("#enterprise_tag").val($("#enterprise_tag").attr("value"));
  1126. $("#address").val($("#address").attr("value"));
  1127. $("#nation").val($("#nation").attr("value"));
  1128. $("#nationality").val($("#nationality").attr("value"));
  1129. $("#industry_field").val($("#industry_field").attr("value"));
  1130. $("#province").val($("#province").attr("value"));
  1131. TalentInfoInfoDlg.afterSelectProvince();
  1132. $("#city").val($("#city").attr("value"));
  1133. TalentInfoInfoDlg.afterSelectCity();
  1134. $("#county").val($("#county").attr("value"));
  1135. TalentInfoInfoDlg.getIdentifyCondition();
  1136. $("#politics").val($("#politics").attr("value"));
  1137. $("#talent_arrange").val($("#talent_arrange").attr("value"));
  1138. $("#talent_condition").val($("#talent_condition").attr("value"));
  1139. $("#tax_insurance_month").val($("#tax_insurance_month").attr("value"));
  1140. $("#labor_contract_rangetime").val($("#labor_contract_rangetime").attr("value"));
  1141. TalentInfoInfoDlg.validId();
  1142. $("#photo").change(function (e) {
  1143. var tag = e.target;
  1144. var file = tag.files[0];
  1145. var imgSrc;
  1146. var reader = new FileReader();
  1147. reader.readAsDataURL(file);
  1148. reader.onload = function () {
  1149. imgSrc = this.result;
  1150. $("#photoImg").attr("src", imgSrc);
  1151. };
  1152. });
  1153. TalentInfoInfoDlg.setNoChangeField();
  1154. $("#talent_condition").on('chosen:ready', function (e, params) {
  1155. $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
  1156. });
  1157. $("#talent_condition").chosen({
  1158. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  1159. disable_search: false,
  1160. width: "100%",
  1161. enable_split_word_search: true,
  1162. rtl: true
  1163. });
  1164. TalentInfoInfoDlg.initFile();
  1165. TalentInfoInfoDlg.initBirthday();
  1166. });