talentInfo_info.js 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193
  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|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 birthday = parseInt($("#" + rel).val().substring(0, 4));
  601. let currentYear = parseInt(new Date().getFullYear());
  602. let age = currentYear - (isNaN(birthday) ? 0 : birthday);
  603. if (isNaN(birthday) || (!isNaN(birthday) && age < data["rows"][k].option))
  604. data["rows"][k].hidden = true;
  605. } else {
  606. let selectVal = $("#" + rel).val();
  607. let options = data["rows"][k].option.split(",");
  608. if (options.indexOf(selectVal) == -1) {
  609. data["rows"][k].hidden = true;
  610. }
  611. }
  612. }
  613. } else {
  614. if (data["rows"][k].isConditionFile) {
  615. var tableIndex = $("#talent_condition").parents(".row").next(".row").find("table.fileTable").index(".fileTable");
  616. data["rows"][k].tableIndex = tableIndex;
  617. data["rows"][k].trIndex = datas[tableIndex].length;
  618. datas[tableIndex].push(data["rows"][k]);//放入人才条件后面的附件表
  619. } else {
  620. var tableIndex = $(".fileTable").length - 1;
  621. data["rows"][k].tableIndex = tableIndex;
  622. data["rows"][k].trIndex = datas[tableIndex].length;
  623. datas[$(".fileTable").length - 1].push(data["rows"][k]);//没有归属,放入最后一个附件表
  624. }
  625. }
  626. }
  627. for (var i = 0; i < $(".fileTable").length; i++) {
  628. var that = $(".fileTable").eq(i);
  629. that.bootstrapTable({
  630. columns: TalentInfoInfoDlg._initFileTypeColumn(),
  631. data: datas[i],
  632. showHeader: false,
  633. rowStyle: function (row, index) {
  634. return {classes: ""};
  635. },
  636. onPostBody: function (data) {
  637. for (var k in data) {
  638. var files = data[k].files;
  639. 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>';
  640. for (var key in files) {
  641. var btn = TalentInfoInfoDlg.validUploadButton(2, data[k].id, files[key].id, i, k);
  642. var sn = files[key].url.lastIndexOf(".");
  643. var suffix = files[key].ext;//files[key].url.substring(sn + 1, files[key].url.length);
  644. var imgStr = "";
  645. if (suffix == "pdf" || suffix == "PDF") {
  646. 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>";
  647. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS' || suffix == 'docx' || suffix == 'doc' || suffix == 'DOCX' || suffix == 'DOC') {
  648. 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>";
  649. } else {
  650. imgStr = '<img class=\"imgUrl\" onclick=\"Feng.showImg(this)\" src=\"' + files[key].url + '\" style=\"width:25px;height:25px;\">';
  651. }
  652. html += '<li data-id="' + files[key].id + '">\n\
  653. <div><input type="hidden" name="uploadFiles[]" value="' + files[key].id + '"></div>\n' +
  654. '<div style="width: 70%;">' + files[key].orignName + '</div>\n' +
  655. '<div style="width: 10%;">' + imgStr + '</div>\n' +
  656. '<div style="width: 20%;">' + btn + '</div>\n\
  657. </li>';
  658. }
  659. html = html + '</ul>';
  660. that.find("tr[data-index='" + k + "']").attr("data-rel", data[k]["rel"]);
  661. that.find("tr[data-index='" + k + "']").attr("data-option", data[k]["option"]);
  662. that.find("tr[data-index='" + k + "']").after('<tr class="detail-view"><td colspan="5">' + html + '</td></tr>');
  663. if (typeof data[k].hidden != "undefined") {
  664. that.find("tr[data-index='" + k + "']").css("display", "none");
  665. that.find("tr[data-index='" + k + "']").next("tr.detail-view").css("display", "none");
  666. }
  667. }
  668. $("td.uitd_showTip").bind("mouseover", function () {
  669. //var htm = $(this).html();
  670. //$(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  671. });
  672. },
  673. });
  674. }
  675. //$(".ibox-content").viewer({fullscreen: false});
  676. }, function (data) {
  677. Feng.error("查询失败!" + data.responseJSON.message + "!");
  678. });
  679. var queryData = {};
  680. queryData["mainId"] = $("#id").val();
  681. queryData['project'] = CONFIG.project_rcrd;
  682. queryData['type'] = $("#type").val();
  683. queryData["talent_condition"] = $("#talent_condition option:selected").val();
  684. queryData['checkState'] = $("#checkState").val();
  685. ajax.set(queryData);
  686. ajax.start();
  687. }
  688. //校验是否保存基础信息
  689. TalentInfoInfoDlg.validId = function () {
  690. var id = $("#id").val();
  691. if (id != null && id != '') {
  692. $("#fileLi").removeAttr("style");
  693. } else {
  694. $("#fileLi").attr("style", "pointer-events: none");
  695. }
  696. }
  697. //选择附件并显示附件名
  698. TalentInfoInfoDlg.checkFile = function (content, fileTypeId, fileId, tableIndex, trIndex) {
  699. if (!TalentInfoInfoDlg.validateIsEdit())
  700. return;
  701. $("#upload_file").unbind("change");
  702. $("#upload_file").change(function () {
  703. if (!Feng.chkFileInvalid(this.files[0], 5, 10))
  704. return;
  705. TalentInfoInfoDlg.upload(fileTypeId, fileId, tableIndex, trIndex);
  706. });
  707. $('#upload_file').val("");
  708. $('#upload_file').click();
  709. }
  710. //上传附件
  711. TalentInfoInfoDlg.upload = function (fileTypeId, fileId, tableIndex, trIndex) {
  712. var id = $("#id").val();
  713. if (!TalentInfoInfoDlg.validateIsEdit())
  714. return;
  715. if (fileId != null && fileId != 'null') {
  716. $("#fileId").val(fileId)
  717. } else {
  718. $("#fileId").val("");
  719. }
  720. $("#mainId").val(id);
  721. $("#fileTypeId").val(fileTypeId);
  722. $("#tableIndex").val(tableIndex);
  723. $("#trIndex").val(trIndex);
  724. var index = layer.load(0, {shade: false, time: 0});
  725. $("#index").val(index);
  726. $("#uploadForm").submit();
  727. }
  728. //删除附件
  729. TalentInfoInfoDlg.deleteFile = function (id, state) {
  730. if (!TalentInfoInfoDlg.validateIsEdit())
  731. return;
  732. var operation = function () {
  733. var ajax = new $ax(Feng.ctxPath + "/common/api/deleteFile", function (data) {
  734. if (data.code = 200) {
  735. Feng.success(data.msg);
  736. $("input[name='uploadFiles[]'][value='" + id + "']").parents("li").remove();
  737. //$("#fileTable").bootstrapTable("refresh", {});
  738. } else {
  739. Feng.error(data.msg);
  740. }
  741. }, function (data) {
  742. Feng.error("删除失败!" + data.responseJSON.message + "!");
  743. });
  744. ajax.set("id", id);
  745. ajax.set("type", 1);
  746. ajax.start();
  747. }
  748. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  749. }
  750. /**
  751. * 提交审核
  752. */
  753. TalentInfoInfoDlg.submitToCheck = function () {
  754. /*if (!TalentInfoInfoDlg.validate()) {
  755. return;
  756. }*/
  757. if (!TalentInfoInfoDlg.birthdayChange())
  758. return;
  759. var id = $("#id").val();
  760. /*if (id == null || id == "") {
  761. Feng.info("请先填写基础信息并上传附件");
  762. return;
  763. }*/
  764. if (!TalentInfoInfoDlg.validateIsEdit())
  765. return;
  766. var operation = function () {
  767. TalentInfoInfoDlg.clearData();
  768. TalentInfoInfoDlg.collectData();
  769. /*if (!TalentInfoInfoDlg.validate()) {
  770. return;
  771. }*/
  772. var id = $('#id').val();
  773. if (id != null && id != '') {
  774. if (!TalentInfoInfoDlg.validateIsEdit())
  775. return;
  776. }
  777. $("select").each(function () {
  778. $(this).removeAttr("disabled");
  779. });
  780. if (locked) {
  781. return;
  782. }
  783. locked = true;
  784. $("#talentInfoForm").attr("action", "/enterprise/base/submit");
  785. $("#talentInfoForm")[0].submit();
  786. return;
  787. var ajax = new $ax(Feng.ctxPath + "/enterprise/base/submit", function (data) {
  788. if (data.code == 200) {
  789. Feng.success(data.msg);
  790. // $("#checkState").val(data.obj);
  791. window.parent.TalentInfo.table.refresh();
  792. TalentInfoInfoDlg.close();
  793. } else {
  794. Feng.error(data.msg);
  795. }
  796. }, function (data) {
  797. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  798. });
  799. ajax.set("id", id);
  800. ajax.start();
  801. }
  802. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  803. }
  804. //回调
  805. TalentInfoInfoDlg.submitCallback = function (data) {
  806. locked = false;
  807. TalentInfoInfoDlg.setNoChangeField();
  808. if (data.code == 200) {
  809. Feng.success(data.msg);
  810. // $("#checkState").val(data.obj);
  811. window.parent.TalentInfo.table.refresh();
  812. TalentInfoInfoDlg.close();
  813. } else {
  814. Feng.error(data.msg);
  815. }
  816. }
  817. /**
  818. * 校验是否可以修改/提交审核
  819. */
  820. TalentInfoInfoDlg.validateIsEdit = function () {
  821. var checkState = $("#checkState").val();
  822. if (checkState != 0 && checkState != 1 && checkState != 3 && checkState != 5 && checkState != 8) {
  823. if (checkState == 16 || checkState == -1 || checkState == -2 || checkState == 7) {
  824. Feng.error("您的申报审核不通过,无法再修改");
  825. return false;
  826. } else if (checkState == 28) {
  827. Feng.error("申报已完成");
  828. return false;
  829. } else if (checkState == 14) {
  830. Feng.error("您的申报已审核通过,无法再修改");
  831. return false;
  832. } else if (checkState == 22 || checkState == 25 || checkState == 27) {
  833. Feng.error("该申报已终止");
  834. return false;
  835. } else {
  836. Feng.error("您的申报正在审核中,请耐心等待");
  837. return false;
  838. }
  839. }
  840. return true;
  841. }
  842. /**
  843. * 校验是否显示按钮
  844. * @param type 类型 1-上传按钮,2-修改删除按钮
  845. * @param row
  846. * @returns {string}
  847. */
  848. TalentInfoInfoDlg.validUploadButton = function (type, fileTypeId, fileId, tableIndex, trIndex) {
  849. var files = $("#files").val();
  850. files = files.split(",");
  851. var checkState = $("#checkState").val();
  852. var realState = $("#realState").val();
  853. if (Feng.isEmptyStr(checkState) || checkState == 0 || (checkState == 1 && realState != 4) || checkState == 3 || checkState == 8 || (realState == 4 && files.indexOf(fileTypeId.toString()) != -1)) {
  854. if ((checkState == 3 || checkState == 8))
  855. return "";
  856. if (type == 1) { //上传
  857. return "<button type='button' onclick=\"TalentInfoInfoDlg.checkFile(this," + fileTypeId + "," + null + "," + tableIndex + "," + trIndex + ")\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  858. "<i class=\"fa fa-upload\"></i>上传" +
  859. "</button>";
  860. } else {
  861. return "<button type=\'button\' onclick=\"TalentInfoInfoDlg.checkFile(this," + fileTypeId + "," + fileId + "," + tableIndex + "," + trIndex + ")\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
  862. "<i class=\"fa fa-paste\"></i>修改" +
  863. "</button>" +
  864. "<button type='button' onclick=\"TalentInfoInfoDlg.deleteFile(" + fileId + ")\" class=\"btn btn-xs btn-danger\">" +
  865. "<i class=\"fa fa-times\"></i>删除" +
  866. "</button>";
  867. }
  868. } else {
  869. return type == 1 ? "" : "";
  870. }
  871. }
  872. //回调
  873. TalentInfoInfoDlg.callBack = function (data) {
  874. layer.close(data.obj);
  875. Feng.info(data.msg);
  876. if (data.code == 200) {
  877. var tableIndex = $("#tableIndex").val();
  878. var trIndex = $("#trIndex").val();
  879. var sn = data.info.lastIndexOf(".");
  880. var suffix = data.ext;//data.info.substring(sn + 1, data.info.length);
  881. var imgStr = "";
  882. if (suffix == "pdf" || suffix == "PDF") {
  883. 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>";
  884. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS' || suffix == 'docx' || suffix == 'doc' || suffix == 'DOCX' || suffix == 'DOC') {
  885. 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>";
  886. } else {
  887. imgStr = '<img class="imgUrl" onclick=\"Feng.showImg(this)\" src="' + data.info + '" style="width:25px;height:25px;">';
  888. }
  889. var li = $("input[name='uploadFiles[]'][value='" + data.id + "'").parents("li");
  890. if (li.length > 0) {
  891. li.find("div").eq(1).html(data.orignName);
  892. li.find("div").eq(2).html(imgStr);
  893. } else {
  894. var html = '<li data-id="' + data.id + '">\n\
  895. <div><input type="hidden" name="uploadFiles[]" value="' + data.id + '"></div>\n\
  896. <div style="width: 70%;">' + data.orignName + '</div>\n\
  897. <div style="width: 10%;">' + imgStr + '</div>\n\
  898. <div style="width: 20%;">\n\
  899. <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\
  900. <button type="button" onclick="TalentInfoInfoDlg.deleteFile(' + data.id + ')" class="btn btn-xs btn-danger"><i class="fa fa-times"></i>删除</button>\n\
  901. </div></li></ul>';
  902. $(".fileTable").eq(tableIndex).find("tr[data-index='" + trIndex + "']").next("tr.detail-view").find(".imgs").append(html);
  903. }
  904. //$(".fileTable").eq(tableIndex).find("tr[data-index='" + trIndex + "']").next("tr.detail-view").find(".imgs").viewer({fullscreen: false});
  905. }
  906. }
  907. TalentInfoInfoDlg.downloadFile = function (id, type) {
  908. window.location.href = Feng.ctxPath + "/api/common/downloadFile?id=" + id + "&type=" + type;
  909. }
  910. //设置不可修改的字段
  911. TalentInfoInfoDlg.setNoChangeField = function () {
  912. var checkState = $("#checkState").val();
  913. var fields = $("#fields").val();
  914. var realState = $("#realState").val();
  915. if (realState == 4) {
  916. $("input,textarea").each(function () {
  917. $(this).attr("readonly", "readonly");
  918. });
  919. $("select").each(function () {
  920. $(this).attr("disabled", "disabled");
  921. });
  922. if (fields != null && fields != '') {
  923. var arr = fields.split(",");
  924. for (var key in arr) {
  925. var name = $("#" + arr[key]).prop("tagName");
  926. if (name == 'select' || name == 'SELECT') {
  927. $("#" + arr[key]).removeAttr("disabled");
  928. } else if (name == "input" || name == 'textarea' || name == "INPUT" || name == 'TEXTAREA') {
  929. $("#" + arr[key]).removeAttr("readonly");
  930. } else {
  931. if (name == "undefined") {
  932. $("input[name=" + arr[key] + "]").removeAttr("disabled");
  933. }
  934. }
  935. }
  936. }
  937. }
  938. }
  939. TalentInfoInfoDlg.__initValidateCondition = function () {
  940. var step = $("#step").val();
  941. if (step == 1) {
  942. $('#talentInfoForm').bootstrapValidator('addField', "source_county", {validators: {notEmpty: {message: '入选来源县市区不能为空'}}});
  943. $('#talentInfoForm').bootstrapValidator('addField', "talent_type", {validators: {notEmpty: {message: '人才类型不能为空'}}});
  944. $('#talentInfoForm').bootstrapValidator('addField', "name", {validators: {notEmpty: {message: '姓名不能为空'}}});
  945. $('#talentInfoForm').bootstrapValidator('addField', "card_type", {validators: {notEmpty: {message: '证件类型不能为空'}}});
  946. $('#talentInfoForm').bootstrapValidator('addField', "card_number", {validators: {notEmpty: {message: '证件号码不能为空'}}});
  947. $('#talentInfoForm').bootstrapValidator('addField', "sex", {validators: {notEmpty: {message: '性别不能为空'}}});
  948. $('#talentInfoForm').bootstrapValidator('addField', "birthday", {validators: {notEmpty: {message: '出生日期不能为空'}}});
  949. $('#talentInfoForm').bootstrapValidator('addField', "nationality", {validators: {notEmpty: {message: '国籍/地区不能为空'}}});
  950. $('#talentInfoForm').bootstrapValidator('addField', "province", {validators: {notEmpty: {message: '户籍省份不能为空'}}});
  951. $('#talentInfoForm').bootstrapValidator('addField', "city", {validators: {notEmpty: {message: '户籍市不能为空'}}});
  952. $('#talentInfoForm').bootstrapValidator('addField', "nation", {validators: {notEmpty: {message: '民族不能为空'}}});
  953. $('#talentInfoForm').bootstrapValidator('addField', "politics", {validators: {notEmpty: {message: '政治面貌不能为空'}}});
  954. } else {
  955. $('#talentInfoForm').bootstrapValidator('addField', "apply_year", {validators: {notEmpty: {message: '申报年度不能为空'}}});
  956. $('#talentInfoForm').bootstrapValidator('addField', "import_way", {validators: {notEmpty: {message: '引进方式不能为空'}}});
  957. $('#talentInfoForm').bootstrapValidator('addField', "cur_entry_time", {validators: {notEmpty: {message: '本单位入职时间不能为空'}}});
  958. $('#talentInfoForm').bootstrapValidator('addField', "position", {validators: {notEmpty: {message: '本单位现任职务不能为空'}}});
  959. $('#talentInfoForm').bootstrapValidator('addField', "source", {validators: {notEmpty: {message: '申报来源不能为空'}}});
  960. $('#talentInfoForm').bootstrapValidator('addField', "talent_arrange", {validators: {notEmpty: {message: '人才层次不能为空'}}});
  961. $('#talentInfoForm').bootstrapValidator('addField', "talent_condition", {validators: {notEmpty: {message: '认定条件不能为空'}}});
  962. $('#talentInfoForm').bootstrapValidator('addField', "highest_degree", {validators: {notEmpty: {message: '最高学历不能为空'}}});
  963. $('#talentInfoForm').bootstrapValidator('addField', "graduate_school", {validators: {notEmpty: {message: '毕业院校不能为空'}}});
  964. $('#talentInfoForm').bootstrapValidator('addField', "major", {validators: {notEmpty: {message: '专业不能为空'}}});
  965. $('#talentInfoForm').bootstrapValidator('addField', "bank", {
  966. validators: {
  967. notEmpty: {
  968. message: '开户银行不能为空'
  969. },
  970. regexp: {
  971. regexp: /^[\u4e00-\u9fa5]*银行$/,
  972. message: "开户银行格式不正确"
  973. }
  974. }
  975. });
  976. $('#talentInfoForm').bootstrapValidator('addField', "bank_number", {
  977. validators: {
  978. notEmpty: {
  979. message: '银行行号不能为空'
  980. },
  981. regexp: {
  982. regexp: /^\d+$/,
  983. message: "银行行号格式不正确"
  984. }
  985. }
  986. });
  987. $('#talentInfoForm').bootstrapValidator('addField', "bank_branch_name", {
  988. validators: {
  989. notEmpty: {
  990. message: '开户银行网点不能为空'
  991. },
  992. regexp: {
  993. regexp: /^[\u4e00-\u9fa5]*银行[\u4e00-\u9fa5]*省?[\u4e00-\u9fa5]+市[\u4e00-\u9fa5]*$/,
  994. message: "开户银行格式不正确"
  995. }
  996. }
  997. });
  998. $('#talentInfoForm').bootstrapValidator('addField', "bank_account", {
  999. validators: {
  1000. notEmpty: {
  1001. message: '银行账号不能为空'
  1002. },
  1003. regexp: {
  1004. regexp: /^\d+$/,
  1005. message: "银行账号格式不正确"
  1006. }
  1007. }
  1008. });
  1009. $('#talentInfoForm').bootstrapValidator('addField', "phone", {
  1010. validators: {
  1011. notEmpty: {
  1012. message: '手机号码不能为空'
  1013. },
  1014. regexp: {
  1015. regexp: /0?(13|14|15|17|18|19)[0-9]{9}/,
  1016. message: "手机号码格式不正确"
  1017. }
  1018. }
  1019. });
  1020. $('#talentInfoForm').bootstrapValidator('addField', "email", {
  1021. validators: {
  1022. notEmpty: {
  1023. message: '电子邮箱不能为空'
  1024. },
  1025. emailAddress: {
  1026. message: "电子邮箱格式不正确"
  1027. }
  1028. }
  1029. });
  1030. }
  1031. }
  1032. $("#card_type").change(function () {
  1033. async_padding($("#card_number").val().trim(), $(this).val());
  1034. })
  1035. $("#card_number").blur(function () {
  1036. async_padding($(this).val().trim(), $("#card_type").val());
  1037. })
  1038. function async_padding(card_number, card_type) {
  1039. if (card_number != "" && card_number.length == 18 && card_type == "1") {
  1040. var year = card_number.substring(6, 10);
  1041. var month = card_number.substring(10, 12);
  1042. var day = card_number.substring(12, 14);
  1043. var birthday = year + "-" + month + "-" + day;
  1044. var rule = /\d{4}-\d{2}-\d{2}/;
  1045. if (rule.test(birthday))
  1046. $("#birthday").val(birthday);
  1047. var num = card_number.substring(17, 1);
  1048. if (num % 2 == 0) {
  1049. $("#sex").val(2);
  1050. } else {
  1051. $("#sex").val(1);
  1052. }
  1053. }
  1054. }
  1055. $(function () {
  1056. TalentInfoInfoDlg.talentTypeFlag = false;
  1057. TalentInfoInfoDlg.talentTypeOneTwo = true;
  1058. //Feng.initValidatorTip("talentInfoForm", TalentInfoInfoDlg.validateFields);
  1059. var id = $("#id").val();
  1060. var checkState = $("#checkState").val();
  1061. //批量加载字典表数据
  1062. var arr = [
  1063. {"name": "nation", "code": "nation"},
  1064. {"name": "talent_arrange", "code": "talent_arrange"},
  1065. {"name": "nationality", "code": "nationality"},
  1066. {"name": "politics", "code": "politics"},
  1067. {"name": "highest_degree", "code": "highest_degree"},
  1068. {"name": "source", "code": "source"},
  1069. {"name": "import_way", "code": "import_way"}];
  1070. Feng.findChildDictBatch(JSON.stringify(arr))
  1071. //加载省份
  1072. Feng.addAjaxSelect({
  1073. "id": "province",
  1074. "displayCode": "code",
  1075. "displayName": "name",
  1076. "type": "GET",
  1077. "url": "/common/tool/getProvinceSelect"
  1078. });
  1079. //批量加载时间控件
  1080. $(".date").each(function () {
  1081. laydate.render({
  1082. elem: this
  1083. , type: 'date'
  1084. , trigger: 'click'
  1085. });
  1086. });
  1087. laydate.render({
  1088. elem: "#birthday"
  1089. })
  1090. $(".rangedate").each(function () {
  1091. laydate.render({
  1092. elem: this,
  1093. type: "date",
  1094. range: true,
  1095. trigger: "click"
  1096. })
  1097. })
  1098. $(".rangemonth").each(function () {
  1099. laydate.render({
  1100. elem: this,
  1101. type: "month",
  1102. range: true,
  1103. trigger: "click"
  1104. })
  1105. })
  1106. if (id != null && id != '') {
  1107. //select初始化
  1108. $("select").each(function () {
  1109. $(this).val($(this).attr("value")).trigger("change");
  1110. });
  1111. Feng.getCheckLog("logTable", {"type": CONFIG.project_rcrd, "mainId": id, "typeFileId": "", "active": 1})
  1112. }
  1113. $("#talent_type").val($("#talent_type").attr("value"));
  1114. $("#card_type").val($("#card_type").attr("value"));
  1115. $("#sex").val($("#sex").attr("value"));
  1116. $("#enterprise_tag").val($("#enterprise_tag").attr("value"));
  1117. $("#address").val($("#address").attr("value"));
  1118. $("#nation").val($("#nation").attr("value"));
  1119. $("#nationality").val($("#nationality").attr("value"));
  1120. $("#industry_field").val($("#industry_field").attr("value"));
  1121. $("#province").val($("#province").attr("value"));
  1122. TalentInfoInfoDlg.afterSelectProvince();
  1123. $("#city").val($("#city").attr("value"));
  1124. TalentInfoInfoDlg.afterSelectCity();
  1125. $("#county").val($("#county").attr("value"));
  1126. TalentInfoInfoDlg.getIdentifyCondition();
  1127. $("#politics").val($("#politics").attr("value"));
  1128. $("#talent_arrange").val($("#talent_arrange").attr("value"));
  1129. $("#talent_condition").val($("#talent_condition").attr("value"));
  1130. $("#tax_insurance_month").val($("#tax_insurance_month").attr("value"));
  1131. $("#labor_contract_rangetime").val($("#labor_contract_rangetime").attr("value"));
  1132. TalentInfoInfoDlg.validId();
  1133. $("#photo").change(function (e) {
  1134. var tag = e.target;
  1135. var file = tag.files[0];
  1136. var imgSrc;
  1137. var reader = new FileReader();
  1138. reader.readAsDataURL(file);
  1139. reader.onload = function () {
  1140. imgSrc = this.result;
  1141. $("#photoImg").attr("src", imgSrc);
  1142. };
  1143. });
  1144. TalentInfoInfoDlg.setNoChangeField();
  1145. $("#talent_condition").on('chosen:ready', function (e, params) {
  1146. $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
  1147. });
  1148. $("#talent_condition").chosen({
  1149. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  1150. disable_search: false,
  1151. width: "100%",
  1152. enable_split_word_search: true,
  1153. rtl: true
  1154. });
  1155. TalentInfoInfoDlg.initFile();
  1156. TalentInfoInfoDlg.initBirthday();
  1157. });